From 717f5cd9dacf30fe6bf1561db9297e75fd27fdef Mon Sep 17 00:00:00 2001 From: fusion32 Date: Fri, 16 May 2025 18:46:18 -0300 Subject: [PATCH] initial commit - getting at TSkill structs --- .gitignore | 5 + TODO.md | 9 + build.bat | 25 + reference/enums.hh | 605 + reference/game.c | 115412 ++++++++++++++++++++++++++++++++++++++++++ reference/types.hh | 1712 + src/creature.cc | 429 + src/creature.hh | 76 + src/enums.hh | 219 + src/main.cc | 38 + src/main.hh | 78 + 11 files changed, 118608 insertions(+) create mode 100644 .gitignore create mode 100644 TODO.md create mode 100644 build.bat create mode 100644 reference/enums.hh create mode 100644 reference/game.c create mode 100644 reference/types.hh create mode 100644 src/creature.cc create mode 100644 src/creature.hh create mode 100644 src/enums.hh create mode 100644 src/main.cc create mode 100644 src/main.hh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d680a30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.vscode +bin +build +local +*.log diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..4ffe221 --- /dev/null +++ b/TODO.md @@ -0,0 +1,9 @@ +## TODO NEXT +- ALL TSkill structures +- TSkillBase +- TCreature +- TPlayer +- TNonPlayer + +## Estimate +The decompiled file has ~115K lines of C. If we take ~15K lines to be rubbish, this can be round to ~100K. Considering a low estimate of 200 lines per day, the whole process could take up to 500 days which is quite a bit but not impossible. Now considering a high estimate of 1K lines per day, it could take 100 days which is also quite a bit. diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..d969bee --- /dev/null +++ b/build.bat @@ -0,0 +1,25 @@ +@echo off +setlocal + +pushd %~dp0 +del /q .\build\* +mkdir .\build +pushd .\build + +set OUTPUTEXE=out.exe +set OUTPUTPDB=out.pdb +set INSTALLDIR=..\bin + +set SRC="../src/creature.cc" "../src/main.cc" +cl -W3 -WX -Zi -we4244 -we4456 -we4457 -wd4996 -std:c++14 -utf-8 -MP8 -DBUILD_DEBUG=1 -DARCH_X64=1 -D_CRT_SECURE_NO_WARNINGS=1 -Fe:"%OUTPUTEXE%" -Fd:"%OUTPUTPDB%" %* %SRC% /link -subsystem:console -incremental:no -opt:ref -dynamicbase "ws2_32.lib" + +if errorlevel 1 exit /b errorlevel + +mkdir "%INSTALLDIR%" +copy /Y "%OUTPUTEXE%" "%INSTALLDIR%" +copy /Y "%OUTPUTPDB%" "%INSTALLDIR%" + +popd +popd + +endlocal diff --git a/reference/enums.hh b/reference/enums.hh new file mode 100644 index 0000000..9e999c4 --- /dev/null +++ b/reference/enums.hh @@ -0,0 +1,605 @@ + +enum CreatureType: int { + PLAYER=0, + MONSTER=1, + NPC=2 +}; + +enum CONNECTIONSTATE: int { + CONNECTION_FREE=0, + CONNECTION_ASSIGNED=1, + CONNECTION_CONNECTED=2, + CONNECTION_LOGIN=3, + CONNECTION_GAME=4, + CONNECTION_DEAD=5, + CONNECTION_LOGOUT=6, + CONNECTION_DISCONNECTED=7 +}; + +enum KNOWNCREATURESTATE: int { + KNOWNCREATURE_FREE=0, + KNOWNCREATURE_UPTODATE=1, + KNOWNCREATURE_OUTDATED=2 +}; + +enum ToDoType: int { + TDWait=0, + TDGo=1, + TDRotate=2, + TDMove=3, + TDTrade=4, + TDUse=5, + TDTurn=6, + TDAttack=7, + TDTalk=8, + TDChangeState=9 +}; + +enum GAMESTATE: int { + GAME_STARTING=0, + GAME_RUNNING=1, + GAME_CLOSING=2, + GAME_ENDING=3 +}; + +enum STATE: int { + SLEEPING=0, + IDLE=1, + UNDERATTACK=2, + TALKING=3, + LEAVING=4, + ATTACKING=5, + PANIC=6 +}; + +enum SpellShapeType: int { + SHAPE_ACTOR=0, + SHAPE_VICTIM=1, + SHAPE_ORIGIN=2, + SHAPE_DESTINATION=3, + SHAPE_ANGLE=4 +}; + +enum SpellImpactType: int { + IMPACT_DAMAGE=0, + IMPACT_FIELD=1, + IMPACT_HEALING=2, + IMPACT_SPEED=3, + IMPACT_DRUNKEN=4, + IMPACT_STRENGTH=5, + IMPACT_OUTFIT=6, + IMPACT_SUMMON=7 +}; + +enum RESULT: int { + ERROR=-1, + NOERROR=0, + NOTACCESSIBLE=1, + NOTMOVABLE=2, + NOTTAKABLE=3, + NOROOM=4, + OUTOFRANGE=5, + OUTOFHOME=6, + CANNOTTHROW=7, + TOOHEAVY=8, + CROSSREFERENCE=9, + CONTAINERFULL=10, + WRONGPOSITION=11, + WRONGPOSITION2=12, + WRONGCLOTHES=13, + HANDSNOTFREE=14, + HANDBLOCKED=15, + ONEWEAPONONLY=16, + NOMATCH=17, + NOTCUMULABLE=18, + TOOMANYPARTS=19, + EMPTYCONTAINER=20, + SPLITOBJECT=21, + NOKEYMATCH=22, + UPSTAIRS=23, + DOWNSTAIRS=24, + CREATURENOTEXISTING=25, + PLAYERNOTEXISTING=26, + PLAYERNOTONLINE=27, + NAMEAMBIGUOUS=28, + NOTUSABLE=29, + FEDUP=30, + DESTROYED=31, + SPELLUNKNOWN=32, + LOWMAGICLEVEL=33, + MAGICITEM=34, + NOTENOUGHMANA=35, + NOSKILL=36, + TARGETLOST=37, + OUTOFAMMO=38, + NOCREATURE=39, + TOOLONG=40, + TARGETOUTOFRANGE=41, + TARGETHIDDEN=42, + ATTACKNOTALLOWED=43, + NOWAY=44, + LOGINERROR=45, + LOGINABORT=46, + PROTECTIONZONE=47, + ENTERPROTECTIONZONE=48, + EXHAUSTED=49, + NOTINVITED=50, + NOPREMIUMACCOUNT=51, + MOVENOTPOSSIBLE=52, + ALREADYTRADING=53, + PARTNERTRADING=54, + TOOMANYOBJECTS=55, + TOOMANYSLAVES=56, + NOTTURNABLE=57, + SECUREMODE=58, + NOTENOUGHSOULPOINTS=59, + LOWLEVEL=60 +}; + +enum ActionType: int { + ACTION_CREATEONMAP=0, + ACTION_CREATE=1, + ACTION_MONSTERONMAP=2, + ACTION_MONSTER=3, + ACTION_EFFECTONMAP=4, + ACTION_EFFECT=5, + ACTION_TEXTONMAP=6, + ACTION_TEXT=7, + ACTION_CHANGEONMAP=8, + ACTION_CHANGE=9, + ACTION_CHANGEREL=10, + ACTION_SETATTRIBUTE=11, + ACTION_CHANGEATTRIBUTE=12, + ACTION_SETQUESTVALUE=13, + ACTION_DAMAGE=14, + ACTION_SETSTART=15, + ACTION_WRITENAME=16, + ACTION_WRITETEXT=17, + ACTION_LOGOUT=18, + ACTION_MOVEALLONMAP=19, + ACTION_MOVEALL=20, + ACTION_MOVEALLREL=21, + ACTION_MOVETOPONMAP=22, + ACTION_MOVETOP=23, + ACTION_MOVETOPREL=24, + ACTION_MOVE=25, + ACTION_MOVEREL=26, + ACTION_RETRIEVE=27, + ACTION_DELETEALLONMAP=28, + ACTION_DELETETOPONMAP=29, + ACTION_DELETEONMAP=30, + ACTION_DELETE=31, + ACTION_DELETEININVENTORY=32, + ACTION_DESCRIPTION=33, + ACTION_LOADDEPOT=34, + ACTION_SAVEDEPOT=35, + ACTION_SENDMAIL=36, + ACTION_NOP=37 +}; + +enum ModifierType: int { + MODIFIER_NORMAL=0, + MODIFIER_INVERT=1, + MODIFIER_TRUE=2 +}; + +enum ConditionType: int { + CONDITION_ISPOSITION=0, + CONDITION_ISTYPE=1, + CONDITION_ISCREATURE=2, + CONDITION_ISPLAYER=3, + CONDITION_HASFLAG=4, + CONDITION_HASTYPEATTRIBUTE=5, + CONDITION_HASINSTANCEATTRIBUTE=6, + CONDITION_HASTEXT=7, + CONDITION_ISPEACEFUL=8, + CONDITION_MAYLOGOUT=9, + CONDITION_HASPROFESSION=10, + CONDITION_HASLEVEL=11, + CONDITION_HASRIGHT=12, + CONDITION_HASQUESTVALUE=13, + CONDITION_TESTSKILL=14, + CONDITION_COUNTOBJECTS=15, + CONDITION_COUNTOBJECTSONMAP=16, + CONDITION_ISOBJECTTHERE=17, + CONDITION_ISCREATURETHERE=18, + CONDITION_ISPLAYERTHERE=19, + CONDITION_ISOBJECTININVENTORY=20, + CONDITION_ISPROTECTIONZONE=21, + CONDITION_ISHOUSE=22, + CONDITION_ISHOUSEOWNER=23, + CONDITION_ISDRESSED=24, + CONDITION_RANDOM=25 +}; + +enum INSTANCEATTRIBUTE: int { + CONTENT=0, + CHESTQUESTNUMBER=1, + AMOUNT=2, + KEYNUMBER=3, + KEYHOLENUMBER=4, + DOORLEVEL=5, + DOORQUESTNUMBER=6, + DOORQUESTVALUE=7, + CHARGES=8, + TEXTSTRING=9, + EDITOR=10, + CONTAINERLIQUIDTYPE=11, + POOLLIQUIDTYPE=12, + ABSTELEPORTDESTINATION=13, + RESPONSIBLE=14, + REMAININGEXPIRETIME=15, + SAVEDEXPIRETIME=16, + REMAININGUSES=17 +}; + +enum TYPEATTRIBUTE: int { + WAYPOINTS=0, + CAPACITY=1, + CHANGETARGET=2, + KEYDOORTARGET=3, + NAMEDOORTARGET=4, + LEVELDOORTARGET=5, + QUESTDOORTARGET=6, + NUTRITION=7, + INFORMATIONTYPE=8, + FONTSIZE=9, + MAXLENGTH=10, + MAXLENGTHONCE=11, + SOURCELIQUIDTYPE=12, + ABSTELEPORTEFFECT=13, + RELTELEPORTDISPLACEMENT=14, + RELTELEPORTEFFECT=15, + AVOIDDAMAGETYPES=16, + MINIMUMLEVEL=17, + PROFESSIONS=18, + WEIGHT=19, + ROTATETARGET=20, + DESTROYTARGET=21, + BODYPOSITION=22, + SKILLNUMBER=23, + SKILLMODIFICATION=24, + PROTECTIONDAMAGETYPES=25, + DAMAGEREDUCTION=26, + BRIGHTNESS=27, + LIGHTCOLOR=28, + CORPSETYPE=29, + TOTALEXPIRETIME=30, + EXPIRETARGET=31, + TOTALUSES=32, + WEAROUTTARGET=33, + WEAPONTYPE=34, + WEAPONATTACKVALUE=35, + WEAPONDEFENDVALUE=36, + SHIELDDEFENDVALUE=37, + BOWRANGE=38, + BOWAMMOTYPE=39, + THROWRANGE=40, + THROWATTACKVALUE=41, + THROWDEFENDVALUE=42, + THROWMISSILE=43, + THROWSPECIALEFFECT=44, + THROWEFFECTSTRENGTH=45, + THROWFRAGILITY=46, + WANDRANGE=47, + WANDMANACONSUMPTION=48, + WANDATTACKSTRENGTH=49, + WANDATTACKVARIATION=50, + WANDDAMAGETYPE=51, + WANDMISSILE=52, + AMMOTYPE=53, + AMMOATTACKVALUE=54, + AMMOMISSILE=55, + AMMOSPECIALEFFECT=56, + AMMOEFFECTSTRENGTH=57, + ARMORVALUE=58, + ELEVATION=59, + DISGUISETARGET=60, + MEANING=61 +}; + +enum FLAG: int { + BANK=0, + CLIP=1, + BOTTOM=2, + TOP=3, + CONTAINER=4, + CHEST=5, + CUMULATIVE=6, + USEEVENT=7, + CHANGEUSE=8, + FORCEUSE=9, + MULTIUSE=10, + DISTUSE=11, + MOVEMENTEVENT=12, + COLLISIONEVENT=13, + SEPARATIONEVENT=14, + KEY=15, + KEYDOOR=16, + NAMEDOOR=17, + LEVELDOOR=18, + QUESTDOOR=19, + BED=20, + FOOD=21, + RUNE=22, + INFORMATION=23, + TEXT=24, + WRITE=25, + WRITEONCE=26, + LIQUIDCONTAINER=27, + LIQUIDSOURCE=28, + LIQUIDPOOL=29, + TELEPORTABSOLUTE=30, + TELEPORTRELATIVE=31, + UNPASS=32, + UNMOVE=33, + UNTHROW=34, + UNLAY=35, + AVOID=36, + MAGICFIELD=37, + RESTRICTLEVEL=38, + RESTRICTPROFESSION=39, + TAKE=40, + HANG=41, + HOOKSOUTH=42, + HOOKEAST=43, + ROTATE=44, + DESTROY=45, + CLOTHES=46, + SKILLBOOST=47, + PROTECTION=48, + LIGHT=49, + ROPESPOT=50, + CORPSE=51, + EXPIRE=52, + EXPIRESTOP=53, + WEAROUT=54, + WEAPON=55, + SHIELD=56, + BOW=57, + THROW=58, + WAND=59, + AMMO=60, + ARMOR=61, + HEIGHT=62, + DISGUISE=63, + SHOWDETAIL=64, + SPECIALOBJECT=65 +}; + +enum SPECIALMEANING: int { + MONEY_ONE=1, + MONEY_HUNDRED=2, + MONEY_TENTHOUSAND=3, + INVENTORY_RIGHTHAND=10, + INVENTORY_LEFTHAND=11, + INVENTORY_BODY_MALE=12, + INVENTORY_BODY_FEMALE=13, + INVENTORY_CONTAINER=14, + INVENTORY_FOOD=15, + DEPOT_LOCKER=20, + DEPOT_CHEST=21, + PARCEL_NEW=22, + PARCEL_STAMPED=23, + PARCEL_LABEL=24, + LETTER_NEW=25, + LETTER_STAMPED=26, + BLOOD_SPLASH=30, + BLOOD_POOL=31, + RUNE_BLANK=40, + MAGICFIELD_FIRE_DANGEROUS=41, + MAGICFIELD_FIRE_HARMLESS=42, + MAGICFIELD_POISON_DANGEROUS=43, + MAGICFIELD_POISON_HARMLESS=44, + MAGICFIELD_ENERGY_DANGEROUS=45, + MAGICFIELD_ENERGY_HARMLESS=46, + MAGICFIELD_MAGICWALL=47, + MAGICFIELD_RUSHWOOD=48 +}; + +enum RIGHT: int { + PREMIUM_ACCOUNT=0, + NOTATION=1, + NAMELOCK=2, + STATEMENT_REPORT=3, + BANISHMENT=4, + FINAL_WARNING=5, + IP_BANISHMENT=6, + KICK=7, + HOME_TELEPORT=8, + GAMEMASTER_BROADCAST=9, + ANONYMOUS_BROADCAST=10, + NO_BANISHMENT=11, + ALLOW_MULTICLIENT=12, + LOG_COMMUNICATION=13, + READ_GAMEMASTER_CHANNEL=14, + READ_TUTOR_CHANNEL=15, + HIGHLIGHT_HELP_CHANNEL=16, + SEND_BUGREPORTS=17, + NAME_INSULTING=18, + NAME_SENTENCE=19, + NAME_NONSENSICAL_LETTERS=20, + NAME_BADLY_FORMATTED=21, + NAME_NO_PERSON=22, + NAME_CELEBRITY=23, + NAME_COUNTRY=24, + NAME_FAKE_IDENTITY=25, + NAME_FAKE_POSITION=26, + STATEMENT_INSULTING=27, + STATEMENT_SPAMMING=28, + STATEMENT_ADVERT_OFFTOPIC=29, + STATEMENT_ADVERT_MONEY=30, + STATEMENT_NON_ENGLISH=31, + STATEMENT_CHANNEL_OFFTOPIC=32, + STATEMENT_VIOLATION_INCITING=33, + CHEATING_BUG_ABUSE=34, + CHEATING_GAME_WEAKNESS=35, + CHEATING_MACRO_USE=36, + CHEATING_MODIFIED_CLIENT=37, + CHEATING_HACKING=38, + CHEATING_MULTI_CLIENT=39, + CHEATING_ACCOUNT_TRADING=40, + CHEATING_ACCOUNT_SHARING=41, + GAMEMASTER_THREATENING=42, + GAMEMASTER_PRETENDING=43, + GAMEMASTER_INFLUENCE=44, + GAMEMASTER_FALSE_REPORTS=45, + KILLING_EXCESSIVE_UNJUSTIFIED=46, + DESTRUCTIVE_BEHAVIOUR=47, + SPOILING_AUCTION=48, + INVALID_PAYMENT=49, + TELEPORT_TO_CHARACTER=50, + TELEPORT_TO_MARK=51, + TELEPORT_VERTICAL=52, + TELEPORT_TO_COORDINATE=53, + LEVITATE=54, + SPECIAL_MOVEUSE=55, + MODIFY_GOSTRENGTH=56, + SHOW_COORDINATE=57, + RETRIEVE=58, + ENTER_HOUSES=59, + OPEN_NAMEDOORS=60, + INVULNERABLE=61, + UNLIMITED_MANA=62, + KEEP_INVENTORY=63, + ALL_SPELLS=64, + UNLIMITED_CAPACITY=65, + ZERO_CAPACITY=66, + ATTACK_EVERYWHERE=67, + NO_ATTACK=68, + NO_RUNES=69, + NO_LOGOUT_BLOCK=70, + GAMEMASTER_OUTFIT=71, + ILLUMINATE=72, + CHANGE_PROFESSION=73, + IGNORED_BY_MONSTERS=74, + SHOW_KEYHOLE_NUMBERS=75, + CREATE_OBJECTS=76, + CREATE_MONEY=77, + CREATE_MONSTERS=78, + CHANGE_SKILLS=79, + CLEANUP_FIELDS=80, + NO_STATISTICS=81 +}; + +enum TWriterThreadReplyType: int { + REPLY_BROADCAST=0, + REPLY_DIRECT=1, + REPLY_LOGOUT=2 +}; + +enum TWriterThreadOrderType: int { + ORDER_TERMINATE=0, + ORDER_LOGOUT=1, + ORDER_PLAYERLIST=2, + ORDER_KILLSTATISTICS=3, + ORDER_PUNISHMENT=4, + ORDER_CHARACTERDEATH=5, + ORDER_ADDBUDDY=6, + ORDER_REMOVEBUDDY=7, + ORDER_DECREMENTISONLINE=8, + ORDER_SAVEPLAYERDATA=9 +}; + +enum TALK_MODE: int { + TALK_SAY=1, + TALK_WHISPER=2, + TALK_YELL=3, + TALK_PRIVATE_MESSAGE=4, + TALK_CHANNEL_CALL=5, + TALK_GAMEMASTER_REQUEST=6, + TALK_GAMEMASTER_ANSWER=7, + TALK_PLAYER_ANSWER=8, + TALK_GAMEMASTER_BROADCAST=9, + TALK_GAMEMASTER_CHANNELCALL=10, + TALK_GAMEMASTER_MESSAGE=11, + TALK_HIGHLIGHT_CHANNELCALL=12, + TALK_ANONYMOUS_BROADCAST=13, + TALK_ANONYMOUS_CHANNELCALL=14, + TALK_ANONYMOUS_MESSAGE=15, + TALK_ANIMAL_LOW=16, + TALK_ANIMAL_LOUD=17, + TALK_ADMIN_MESSAGE=18, + TALK_EVENT_MESSAGE=19, + TALK_LOGIN_MESSAGE=20, + TALK_STATUS_MESSAGE=21, + TALK_INFO_MESSAGE=22, + TALK_FAILURE_MESSAGE=23 +}; + +enum CHANNEL: int { + GUILD_CHANNEL=0, + GAMEMASTER_CHANNEL=1, + TUTOR_CHANNEL=2, + REQUEST_QUEUE=3, + GAME_CHANNEL=4, + TRADE_CHANNEL=5, + REALLIFE_CHANNEL=6, + HELP_CHANNEL=7 +}; + +enum EventType: int { + EVENT_USE=0, + EVENT_MULTIUSE=1, + EVENT_MOVEMENT=2, + EVENT_COLLISION=3, + EVENT_SEPARATION=4 +}; + +enum ParameterType: int { + PARAMETER_OBJECT=0, + PARAMETER_TYPE=1, + PARAMETER_FLAG=2, + PARAMETER_TYPEATTRIBUTE=3, + PARAMETER_INSTANCEATTRIBUTE=4, + PARAMETER_COORDINATE=5, + PARAMETER_VECTOR=6, + PARAMETER_RIGHT=7, + PARAMETER_SKILL=8, + PARAMETER_NUMBER=9, + PARAMETER_TEXT=10, + PARAMETER_COMPARISON=11 +}; + +enum TReaderThreadOrderType: int { + ORDER_TERMINATE=0, + ORDER_LOADSECTOR=1, + ORDER_LOADCHARACTER=2 +}; + +enum TReaderThreadReplyType: int { + REPLY_SECTORDATA=0, + REPLY_CHARACTERDATA=1 +}; + +enum TOKEN: int { + ENDOFFILE=0, + IDENTIFIER=1, + NUMBER=2, + STRING=3, + BYTES=4, + COORDINATE=5, + SPECIAL=6 +}; + +enum SITUATION: int { + DEFAULT=0, + ADDRESS=1, + ADDRESSQUEUE=2, + BUSY=3, + VANISH=4 +}; + +enum BloodType: int { + BT_BLOOD=0, + BT_SLIME=1, + BT_BONES=2, + BT_FIRE=3, + BT_ENERGY=4 +}; + +enum TWorldType: int { + NORMAL=0, + NON_PVP=1, + PVP_ENFORCED=2 +}; diff --git a/reference/game.c b/reference/game.c new file mode 100644 index 0000000..bf1797d --- /dev/null +++ b/reference/game.c @@ -0,0 +1,115412 @@ +typedef unsigned char undefined; + +typedef unsigned char bool; +typedef unsigned char byte; +typedef unsigned char dwfenc; +typedef unsigned int dword; +typedef long double longdouble; +typedef long long longlong; +typedef unsigned long long qword; +typedef int sdword; +typedef long long sqword; +typedef short sword; +typedef unsigned char uchar; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned long long ulonglong; +typedef unsigned char undefined1; +typedef unsigned short undefined2; +typedef unsigned int undefined4; +typedef unsigned long long undefined6; +typedef unsigned long long undefined7; +typedef unsigned long long undefined8; +typedef unsigned short ushort; +typedef int wchar_t; +typedef unsigned short word; +typedef pointer pointer __((offset(0x8))); + +typedef struct eh_frame_hdr eh_frame_hdr, *Peh_frame_hdr; + +struct eh_frame_hdr { + byte eh_frame_hdr_version; // Exception Handler Frame Header Version + dwfenc eh_frame_pointer_encoding; // Exception Handler Frame Pointer Encoding + dwfenc eh_frame_desc_entry_count_encoding; // Encoding of # of Exception Handler FDEs + dwfenc eh_frame_table_encoding; // Exception Handler Table Encoding +}; + +typedef struct fde_table_entry fde_table_entry, *Pfde_table_entry; + +struct fde_table_entry { + dword initial_loc; // Initial Location + dword data_loc; // Data location +}; + +typedef struct stat stat, *Pstat; + +typedef ulonglong __u_quad_t; + +typedef __u_quad_t __dev_t; + +typedef ulong __ino_t; + +typedef uint __mode_t; + +typedef uint __nlink_t; + +typedef uint __uid_t; + +typedef uint __gid_t; + +typedef long __off_t; + +typedef long __blksize_t; + +typedef long __blkcnt_t; + +typedef struct timespec timespec, *Ptimespec; + +typedef long __time_t; + +struct timespec { + __time_t tv_sec; + long tv_nsec; +}; + +struct stat { + __dev_t st_dev; + ushort __pad1; + __ino_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + ushort __pad2; + __off_t st_size; + __blksize_t st_blksize; + __blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + ulong __unused4; + ulong __unused5; +}; + +typedef int __ssize_t; + +typedef __ssize_t ssize_t; + +typedef int __pid_t; + +typedef int __key_t; + +typedef __key_t key_t; + +typedef longlong __quad_t; + +typedef __quad_t __off64_t; + +typedef uint __useconds_t; + +typedef uint __socklen_t; + +typedef long __suseconds_t; + +typedef long __clock_t; + +typedef struct pollfd pollfd, *Ppollfd; + +struct pollfd { + int fd; + short events; + short revents; +}; + +typedef ulong nfds_t; + +typedef struct hostent hostent, *Phostent; + +struct hostent { + char *h_name; + char **h_aliases; + int h_addrtype; + int h_length; + char **h_addr_list; +}; + +typedef union pthread_mutex_t pthread_mutex_t, *Ppthread_mutex_t; + +typedef struct __pthread_mutex_s __pthread_mutex_s, *P__pthread_mutex_s; + +typedef union _union_13 _union_13, *P_union_13; + +typedef struct __pthread_internal_slist __pthread_internal_slist, *P__pthread_internal_slist; + +typedef struct __pthread_internal_slist __pthread_slist_t; + +struct __pthread_internal_slist { + struct __pthread_internal_slist *__next; +}; + +union _union_13 { + int __spins; + __pthread_slist_t __list; +}; + +struct __pthread_mutex_s { + int __lock; + uint __count; + int __owner; + int __kind; + uint __nusers; + union _union_13 field5_0x14; +}; + +union pthread_mutex_t { + struct __pthread_mutex_s __data; + char __size[24]; + long __align; +}; + +typedef union pthread_mutexattr_t pthread_mutexattr_t, *Ppthread_mutexattr_t; + +union pthread_mutexattr_t { + char __size[4]; + int __align; +}; + +typedef union pthread_cond_t pthread_cond_t, *Ppthread_cond_t; + +typedef struct _struct_16 _struct_16, *P_struct_16; + +struct _struct_16 { + int __lock; + uint __futex; + ulonglong __total_seq; + ulonglong __wakeup_seq; + ulonglong __woken_seq; + void *__mutex; + uint __nwaiters; + uint __broadcast_seq; +}; + +union pthread_cond_t { + struct _struct_16 __data; + char __size[48]; + longlong __align; +}; + +typedef ulong pthread_t; + +typedef union pthread_attr_t pthread_attr_t, *Ppthread_attr_t; + +union pthread_attr_t { + char __size[36]; + long __align; +}; + +typedef union pthread_condattr_t pthread_condattr_t, *Ppthread_condattr_t; + +union pthread_condattr_t { + char __size[4]; + int __align; +}; + +typedef struct __dirstream __dirstream, *P__dirstream; + +typedef struct __dirstream DIR; + +struct __dirstream { +}; + +typedef struct dirent dirent, *Pdirent; + +struct dirent { + __ino_t d_ino; + __off_t d_off; + ushort d_reclen; + uchar d_type; + char d_name[256]; +}; + +typedef union _union_1031 _union_1031, *P_union_1031; + +typedef struct _struct_1032 _struct_1032, *P_struct_1032; + +typedef struct _struct_1033 _struct_1033, *P_struct_1033; + +typedef struct _struct_1034 _struct_1034, *P_struct_1034; + +typedef struct _struct_1035 _struct_1035, *P_struct_1035; + +typedef struct _struct_1036 _struct_1036, *P_struct_1036; + +typedef struct _struct_1037 _struct_1037, *P_struct_1037; + +typedef union sigval sigval, *Psigval; + +typedef union sigval sigval_t; + +struct _struct_1032 { + __pid_t si_pid; + __uid_t si_uid; +}; + +union sigval { + int sival_int; + void *sival_ptr; +}; + +struct _struct_1033 { + int si_tid; + int si_overrun; + sigval_t si_sigval; +}; + +struct _struct_1035 { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __clock_t si_utime; + __clock_t si_stime; +}; + +struct _struct_1037 { + long si_band; + int si_fd; +}; + +struct _struct_1036 { + void *si_addr; +}; + +struct _struct_1034 { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; +}; + +union _union_1031 { + int _pad[29]; + struct _struct_1032 _kill; + struct _struct_1033 _timer; + struct _struct_1034 _rt; + struct _struct_1035 _sigchld; + struct _struct_1036 _sigfault; + struct _struct_1037 _sigpoll; +}; + +typedef struct siginfo siginfo, *Psiginfo; + +struct siginfo { + int si_signo; + int si_errno; + int si_code; + union _union_1031 _sifields; +}; + +typedef struct siginfo siginfo_t; + + +// WARNING! conflicting data type names: /DWARF/__blkcnt_t - /types.h/__blkcnt_t + +typedef int __priority_which_t; + + +// WARNING! conflicting data type names: /DWARF/__off_t - /types.h/__off_t + +typedef uint uint_fast16_t; + +typedef dword uint32_t; + +typedef uchar u_int8_t; + +typedef dword uint_least32_t; + +typedef int error_t; + +typedef int int_type; + + +// WARNING! conflicting data type names: /DWARF/pthread_t - /pthreadtypes.h/pthread_t + +typedef uchar __uint8_t; + +typedef int __fd_mask; + +typedef int __daddr_t; + +typedef int ptrdiff_t; + +typedef word __uint16_t; + +typedef uchar uint8_t; + +typedef qword __uint64_t; + +typedef uint pthread_key_t; + +typedef int nl_item; + +typedef int greg_t; + +typedef sqword __blkcnt64_t; + +typedef dword uint_fast32_t; + +typedef qword __ino64_t; + +typedef undefined1 double_t[12]; + +typedef char value_type; + +typedef uchar uint_fast8_t; + +typedef qword uint_fast64_t; + +typedef uint wint_t; + + +// WARNING! conflicting data type names: /DWARF/__time_t - /types.h/__time_t + +typedef ulonglong uintmax_t; + +typedef qword __fsfilcnt64_t; + +typedef int value_type.conflict; + + +// WARNING! conflicting data type names: /DWARF/__off64_t - /types.h/__off64_t + +typedef dword _G_uint32_t; + +typedef char int8_t; + +typedef word uint16_t; + +typedef char int_fast8_t; + +typedef sword _G_int16_t; + +typedef uint size_t; + +typedef int __rlimit_resource_t; + +typedef ushort __ipc_pid_t; + +typedef qword __fsblkcnt64_t; + +typedef char __int8_t; + + +// WARNING! conflicting data type names: /DWARF/ulong - /ulong + +typedef int streamoff; + +typedef ushort mask; + +typedef word _G_uint16_t; + +typedef sdword _G_int32_t; + +typedef uint __u_long; + + +// WARNING! conflicting data type names: /DWARF/__ino_t - /types.h/__ino_t + +typedef uchar uint_least8_t; + +typedef undefined1 float_t[12]; + +typedef qword uint64_t; + +typedef int catalog; + + +// WARNING! conflicting data type names: /DWARF/ushort - /ushort + +typedef word u_int16_t; + +typedef int __clockid_t; + +typedef int char_type.conflict; + +typedef int _Atomic_word; + + +// WARNING! conflicting data type names: /DWARF/__clock_t - /types.h/__clock_t + +typedef short __int_type; + +typedef sdword int_fast32_t; + +typedef sqword int64_t; + +typedef dword u_int32_t; + +typedef int __int_type.conflict; + +typedef int register_t; + +typedef longlong __pthread_cond_align_t; + +typedef sdword __int32_t; + +typedef sqword __int64_t; + +typedef uint __fsblkcnt_t; + +typedef int __sig_atomic_t; + +typedef sdword int32_t; + +typedef int __swblk_t; + +typedef uint __u_int; + + +// WARNING! conflicting data type names: /DWARF/uint - /uint + +typedef sqword int_least64_t; + +typedef uint Thread; + +typedef int __itimer_which_t; + +typedef int __rusage_who_t; + +typedef uint __fsfilcnt_t; + +typedef qword uint_least64_t; + +typedef uint __rlim_t; + +typedef ushort __u_short; + +typedef qword __rlim64_t; + +typedef uint shmatt_t; + +typedef longlong intmax_t; + +typedef char char_type; + +typedef sqword int_fast64_t; + +typedef uint uintptr_t; + +typedef qword u_int64_t; + + +// WARNING! conflicting data type names: /DWARF/__suseconds_t - /types.h/__suseconds_t + +typedef sdword int_least32_t; + +typedef uint __id_t; + +typedef int __timer_t; + + +// WARNING! conflicting data type names: /DWARF/__blksize_t - /types.h/__blksize_t + +typedef int pthread_once_t; + +typedef char int_least8_t; + +typedef ushort sa_family_t; + +typedef uchar __u_char; + +typedef sword int16_t; + + +// WARNING! conflicting data type names: /DWARF/__dev_t - /types.h/__dev_t + +typedef dword __uint32_t; + +typedef word uint_least16_t; + +typedef sword int_least16_t; + +typedef int __intptr_t; + +typedef sword __int16_t; + +typedef uint category; + + +// WARNING! conflicting data type names: /DWARF/nfds_t - /poll.h/nfds_t + +typedef uint wctype_t; + +typedef int int_fast16_t; + +typedef void (*terminate_handler)(void); + +typedef void (*unexpected_handler)(void); + +typedef struct char_traits char_traits, *Pchar_traits; + +struct char_traits { +}; + +typedef struct char_traits char_traits, *Pchar_traits; + +struct char_traits { +}; + +typedef struct fpos<__mbstate_t> fpos<__mbstate_t>, *Pfpos<__mbstate_t>; + +typedef struct fpos<__mbstate_t> streampos; + +typedef streampos pos_type; + +typedef struct __mbstate_t __mbstate_t, *P__mbstate_t; + +typedef struct __mbstate_t mbstate_t; + +typedef union anon_union_4_2_91654ee9_for___value anon_union_4_2_91654ee9_for___value, *Panon_union_4_2_91654ee9_for___value; + +union anon_union_4_2_91654ee9_for___value { + wint_t __wch; + char __wchb[4]; +}; + +struct __mbstate_t { + int __count; + union anon_union_4_2_91654ee9_for___value __value; +}; + +struct fpos<__mbstate_t> { + streamoff _M_off; + mbstate_t _M_st; +}; + +typedef streamoff off_type; + +typedef mbstate_t state_type; + + +// WARNING! conflicting data type names: /DWARF/char_traits.h/char_traits/pos_type - /DWARF/char_traits.h/char_traits/pos_type + + +// WARNING! conflicting data type names: /DWARF/char_traits.h/char_traits/int_type - /DWARF/int_type + +typedef struct sentry sentry, *Psentry; + +typedef struct basic_ostream_> basic_ostream_>, *Pbasic_ostream_>; + +struct basic_ostream_> { // Original name: basic_ostream > +}; + +struct sentry { + bool _M_ok; + struct basic_ostream_> *_M_os; +}; + + +// WARNING! conflicting data type names: /DWARF/ostream/basic_ostream_>/sentry - /DWARF/ostream/basic_ostream_>/sentry + +typedef struct TSkillHitpoints TSkillHitpoints, *PTSkillHitpoints; + +typedef struct TSkillAdd TSkillAdd, *PTSkillAdd; + +typedef struct TSkill TSkill, *PTSkill; + +typedef struct TCreature TCreature, *PTCreature; + +typedef struct TSkillBase TSkillBase, *PTSkillBase; + +typedef struct TCombat TCombat, *PTCombat; + +typedef struct TOutfit TOutfit, *PTOutfit; + +typedef enum CreatureType { + PLAYER=0, + MONSTER=1, + NPC=2 +} CreatureType; + +typedef struct TKnownCreature TKnownCreature, *PTKnownCreature; + +typedef struct Object Object, *PObject; + +typedef struct vector vector, *Pvector; + +typedef struct TConnection TConnection, *PTConnection; + +typedef struct TCombatEntry TCombatEntry, *PTCombatEntry; + +typedef union anon_union_4_2_730cd3ca_for_TOutfit_2 anon_union_4_2_730cd3ca_for_TOutfit_2, *Panon_union_4_2_730cd3ca_for_TOutfit_2; + +typedef enum KNOWNCREATURESTATE { + KNOWNCREATURE_FREE=0, + KNOWNCREATURE_UPTODATE=1, + KNOWNCREATURE_OUTDATED=2 +} KNOWNCREATURESTATE; + +typedef struct TToDoEntry TToDoEntry, *PTToDoEntry; + +typedef enum CONNECTIONSTATE { + CONNECTION_FREE=0, + CONNECTION_ASSIGNED=1, + CONNECTION_CONNECTED=2, + CONNECTION_LOGIN=3, + CONNECTION_GAME=4, + CONNECTION_DEAD=5, + CONNECTION_LOGOUT=6, + CONNECTION_DISCONNECTED=7 +} CONNECTIONSTATE; + +typedef __pid_t pid_t; + +typedef struct TXTEASymmetricKey TXTEASymmetricKey, *PTXTEASymmetricKey; + +typedef enum ToDoType { + TDWait=0, + TDGo=1, + TDRotate=2, + TDMove=3, + TDTrade=4, + TDUse=5, + TDTurn=6, + TDAttack=7, + TDTalk=8, + TDChangeState=9 +} ToDoType; + +typedef union anon_union_20_9_0cf291fe_for_TToDoEntry_2 anon_union_20_9_0cf291fe_for_TToDoEntry_2, *Panon_union_20_9_0cf291fe_for_TToDoEntry_2; + +typedef struct anon_struct_4_1_898373eb_for_Wait anon_struct_4_1_898373eb_for_Wait, *Panon_struct_4_1_898373eb_for_Wait; + +typedef struct anon_struct_12_3_4e92e0dd_for_Go anon_struct_12_3_4e92e0dd_for_Go, *Panon_struct_12_3_4e92e0dd_for_Go; + +typedef struct anon_struct_4_1_53aaadff_for_Rotate anon_struct_4_1_53aaadff_for_Rotate, *Panon_struct_4_1_53aaadff_for_Rotate; + +typedef struct anon_struct_20_5_1de5e93d_for_Move anon_struct_20_5_1de5e93d_for_Move, *Panon_struct_20_5_1de5e93d_for_Move; + +typedef struct anon_struct_8_2_91e27a16_for_Trade anon_struct_8_2_91e27a16_for_Trade, *Panon_struct_8_2_91e27a16_for_Trade; + +typedef struct anon_struct_12_3_f5043ff3_for_Use anon_struct_12_3_f5043ff3_for_Use, *Panon_struct_12_3_f5043ff3_for_Use; + +typedef struct anon_struct_4_1_ba1cf037_for_Turn anon_struct_4_1_ba1cf037_for_Turn, *Panon_struct_4_1_ba1cf037_for_Turn; + +typedef struct anon_struct_16_4_1017f030_for_Talk anon_struct_16_4_1017f030_for_Talk, *Panon_struct_16_4_1017f030_for_Talk; + +typedef struct anon_struct_4_1_3d35b86f_for_ChangeState anon_struct_4_1_3d35b86f_for_ChangeState, *Panon_struct_4_1_3d35b86f_for_ChangeState; + +struct anon_struct_4_1_53aaadff_for_Rotate { + int Direction; +}; + +struct TSkill { + int (**_vptr.TSkill)(...); + int DAct; + int MDAct; + ushort SkNr; + struct TCreature *Master; + int Act; + int Max; + int Min; + int FactorPercent; + int LastLevel; + int NextLevel; + int Delta; + int Exp; + int Cycle; + int MaxCycle; + int Count; + int MaxCount; + int AddLevel; +}; + +struct TSkillAdd { + struct TSkill super_TSkill; +}; + +struct TSkillHitpoints { + struct TSkillAdd super_TSkillAdd; +}; + +struct anon_struct_20_5_1de5e93d_for_Move { + ulong Obj; + int x; + int y; + int z; + int Count; +}; + +struct anon_struct_4_1_898373eb_for_Wait { + ulong Time; +}; + +struct TCombatEntry { + ulong ID; + ulong Damage; + int TimeStamp; +}; + +struct Object { + ulong ObjectID; +}; + +struct TCombat { + struct TCreature *Master; + ulong EarliestAttackTime; + ulong EarliestDefendTime; + ulong LastDefendTime; + ulong LatestAttackTime; + uchar AttackMode; + uchar ChaseMode; + uchar SecureMode; + ulong AttackDest; + bool Following; + struct Object Shield; + struct Object Close; + struct Object Missile; + struct Object Throw; + struct Object Wand; + struct Object Ammo; + bool Fist; + ulong CombatDamage; + int ActCombatEntry; + struct TCombatEntry CombatList[20]; + int LearningPoints; +}; + +union anon_union_4_2_730cd3ca_for_TOutfit_2 { + ushort ObjectType; + uchar Colors[4]; +}; + +struct anon_struct_12_3_f5043ff3_for_Use { + ulong Obj1; + ulong Obj2; + int Dummy; +}; + +struct anon_struct_12_3_4e92e0dd_for_Go { + int x; + int y; + int z; +}; + +struct TXTEASymmetricKey { + int (**_vptr.TXTEASymmetricKey)(...); + uchar m_SymmetricKey[16]; +}; + +struct anon_struct_4_1_3d35b86f_for_ChangeState { + int NewState; +}; + +struct anon_struct_16_4_1017f030_for_Talk { + ulong Text; + int Mode; + ulong Addressee; + bool CheckSpamming; +}; + +struct anon_struct_4_1_ba1cf037_for_Turn { + ulong Obj; +}; + +struct anon_struct_8_2_91e27a16_for_Trade { + ulong Obj; + ulong Partner; +}; + +union anon_union_20_9_0cf291fe_for_TToDoEntry_2 { + struct anon_struct_4_1_898373eb_for_Wait Wait; + struct anon_struct_12_3_4e92e0dd_for_Go Go; + struct anon_struct_4_1_53aaadff_for_Rotate Rotate; + struct anon_struct_20_5_1de5e93d_for_Move Move; + struct anon_struct_8_2_91e27a16_for_Trade Trade; + struct anon_struct_12_3_f5043ff3_for_Use Use; + struct anon_struct_4_1_ba1cf037_for_Turn Turn; + struct anon_struct_16_4_1017f030_for_Talk Talk; + struct anon_struct_4_1_3d35b86f_for_ChangeState ChangeState; +}; + +struct TKnownCreature { + enum KNOWNCREATURESTATE State; + ulong CreatureID; + struct TKnownCreature *Next; + struct TConnection *Connection; +}; + +struct TSkillBase { + struct TSkill *Skills[25]; + struct TSkill *TimerList[25]; + ushort FirstFreeTimer; +}; + +struct TOutfit { + int OutfitID; + union anon_union_4_2_730cd3ca_for_TOutfit_2 field_1; +}; + +struct TToDoEntry { + enum ToDoType Code; + union anon_union_20_9_0cf291fe_for_TToDoEntry_2 field_1; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TToDoEntry init; + struct TToDoEntry *entry; +}; + +struct TCreature { + int (**_vptr.TCreature)(...); + struct TSkillBase super_TSkillBase; + struct TCombat Combat; + ulong ID; + struct TCreature *NextHashEntry; + ulong NextChainCreature; + char Name[31]; + char Murderer[31]; + struct TOutfit OrgOutfit; + struct TOutfit Outfit; + int startx; + int starty; + int startz; + int posx; + int posy; + int posz; + int Sex; + int Race; + int Direction; + int Radius; + enum CreatureType Type; + bool IsDead; + int LoseInventory; + bool LoggingOut; + bool LogoutAllowed; + ulong EarliestLogoutRound; + ulong EarliestProtectionZoneRound; + ulong EarliestYellRound; + ulong EarliestTradeChannelRound; + ulong EarliestSpellTime; + ulong EarliestMultiuseTime; + ulong EarliestWalkTime; + ulong LifeEndRound; + struct TKnownCreature *FirstKnowingConnection; + int SummonedCreatures; + ulong FireDamageOrigin; + ulong PoisonDamageOrigin; + ulong EnergyDamageOrigin; + struct Object CrObject; + struct vector ToDoList; + int ActToDo; + int NrToDo; + ulong NextWakeup; + bool Stop; + bool LockToDo; + uchar Profession; + struct TConnection *Connection; +}; + +struct TConnection { + uchar InData[2048]; + int InDataSize; + bool SigIOPending; + bool WaitingForACK; + uchar OutData[16384]; + undefined field5_0x4806; + undefined field6_0x4807; + int NextToSend; + int NextToCommit; + int NextToWrite; + bool Overflow; + bool WillingToSend; + undefined field12_0x4816; + undefined field13_0x4817; + struct TConnection *NextSendingConnection; + uint RandomSeed; + enum CONNECTIONSTATE State; + pid_t PID; + int Socket; + char IPAddress[16]; + struct TXTEASymmetricKey SymmetricKey; + bool ConnectionIsOk; + bool ClosingIsDelayed; + undefined field23_0x4852; + undefined field24_0x4853; + ulong TimeStamp; + ulong TimeStampAction; + int TerminalType; + int TerminalVersion; + int TerminalOffsetX; + int TerminalOffsetY; + int TerminalWidth; + int TerminalHeight; + ulong CharacterID; + char Name[31]; + undefined field35_0x4897; + struct TKnownCreature KnownCreatureTable[150]; +}; + +typedef struct TSkillSoulpoints TSkillSoulpoints, *PTSkillSoulpoints; + +struct TSkillSoulpoints { + struct TSkillAdd super_TSkillAdd; +}; + +typedef struct TSkillProbe TSkillProbe, *PTSkillProbe; + +struct TSkillProbe { + struct TSkill super_TSkill; +}; + +typedef struct TSkillMana TSkillMana, *PTSkillMana; + +struct TSkillMana { + struct TSkillAdd super_TSkillAdd; +}; + +typedef struct TSkillGoStrength TSkillGoStrength, *PTSkillGoStrength; + +struct TSkillGoStrength { + struct TSkillAdd super_TSkillAdd; +}; + +typedef struct TSkillLight TSkillLight, *PTSkillLight; + +struct TSkillLight { + struct TSkill super_TSkill; +}; + +typedef struct TSkillEnergy TSkillEnergy, *PTSkillEnergy; + +struct TSkillEnergy { + struct TSkill super_TSkill; +}; + +typedef struct TSkillCarryStrength TSkillCarryStrength, *PTSkillCarryStrength; + +struct TSkillCarryStrength { + struct TSkillAdd super_TSkillAdd; +}; + +typedef struct TSkillPoison TSkillPoison, *PTSkillPoison; + +struct TSkillPoison { + struct TSkill super_TSkill; +}; + +typedef struct TSkillBurning TSkillBurning, *PTSkillBurning; + +struct TSkillBurning { + struct TSkill super_TSkill; +}; + +typedef struct TSkillFed TSkillFed, *PTSkillFed; + +struct TSkillFed { + struct TSkill super_TSkill; +}; + +typedef struct TSkillIllusion TSkillIllusion, *PTSkillIllusion; + +struct TSkillIllusion { + struct TSkill super_TSkill; +}; + +typedef struct TSkillLevel TSkillLevel, *PTSkillLevel; + +struct TSkillLevel { + struct TSkill super_TSkill; +}; + +typedef struct __normal_iterator,_std::allocator_>_> __normal_iterator,_std::allocator_>_>, *P__normal_iterator,_std::allocator_>_>; + +struct __normal_iterator,_std::allocator_>_> { // Original name: __normal_iterator, std::allocator > > +Missing member super_iterator : iterator at offset 0x0 [conflicting member at same offset] + char *_M_current; +}; + +typedef struct __normal_iterator,_std::allocator_>_> __normal_iterator,_std::allocator_>_>, *P__normal_iterator,_std::allocator_>_>; + +struct __normal_iterator,_std::allocator_>_> { // Original name: __normal_iterator, std::allocator > > +Missing member super_iterator : iterator at offset 0x0 [conflicting member at same offset] + char *_M_current; +}; + +typedef char *reference; + +typedef ptrdiff_t difference_type; + +typedef char *pointer; + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/pthread_mutex_t - /pthreadtypes.h/pthread_mutex_t + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/pthread_mutexattr_t - /pthreadtypes.h/pthread_mutexattr_t + +typedef struct _pthread_rwlock_t _pthread_rwlock_t, *P_pthread_rwlock_t; + +typedef struct _pthread_fastlock _pthread_fastlock, *P_pthread_fastlock; + +typedef struct _pthread_descr_struct _pthread_descr_struct, *P_pthread_descr_struct; + +typedef struct _pthread_descr_struct *_pthread_descr; + +struct _pthread_fastlock { + long __status; + int __spinlock; +}; + +struct _pthread_rwlock_t { + struct _pthread_fastlock __rw_lock; + int __rw_readers; + _pthread_descr __rw_writer; + _pthread_descr __rw_read_waiting; + _pthread_descr __rw_write_waiting; + int __rw_kind; + int __rw_pshared; +}; + +struct _pthread_descr_struct { +}; + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/pthread_cond_t - /pthreadtypes.h/pthread_cond_t + +typedef struct __pthread_attr_s __pthread_attr_s, *P__pthread_attr_s; + +typedef struct __sched_param __sched_param, *P__sched_param; + +struct __sched_param { + int __sched_priority; +}; + +struct __pthread_attr_s { + int __detachstate; + int __schedpolicy; + struct __sched_param __schedparam; + int __inheritsched; + int __scope; + size_t __guardsize; + int __stackaddr_set; + void *__stackaddr; + size_t __stacksize; +}; + +typedef struct pthread_rwlockattr_t pthread_rwlockattr_t, *Ppthread_rwlockattr_t; + +struct pthread_rwlockattr_t { + int __lockkind; + int __pshared; +}; + +typedef struct pthread_barrier_t pthread_barrier_t, *Ppthread_barrier_t; + +struct pthread_barrier_t { + struct _pthread_fastlock __ba_lock; + int __ba_required; + int __ba_present; + _pthread_descr __ba_waiting; +}; + +typedef struct pthread_barrierattr_t pthread_barrierattr_t, *Ppthread_barrierattr_t; + +struct pthread_barrierattr_t { + int __pshared; +}; + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/pthread_attr_t - /pthreadtypes.h/pthread_attr_t + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/pthread_condattr_t - /pthreadtypes.h/pthread_condattr_t + +typedef struct _pthread_rwlock_t pthread_rwlock_t; + +typedef int pthread_spinlock_t; + + +// WARNING! conflicting data type names: /DWARF/pthreadtypes.h/StartThread/pthread_attr_t - /pthreadtypes.h/pthread_attr_t + +typedef union wait wait, *Pwait; + +typedef struct anon_struct_4_3_c58d0830_for___wait_terminated anon_struct_4_3_c58d0830_for___wait_terminated, *Panon_struct_4_3_c58d0830_for___wait_terminated; + +typedef struct anon_struct_4_2_37e31311_for___wait_stopped anon_struct_4_2_37e31311_for___wait_stopped, *Panon_struct_4_2_37e31311_for___wait_stopped; + +struct anon_struct_4_2_37e31311_for___wait_stopped { + uint __w_stopval:8; + uint __w_stopsig:8; +}; + +struct anon_struct_4_3_c58d0830_for___wait_terminated { + uint __w_termsig:7; + uint __w_coredump:1; + uint __w_retcode:8; +}; + +union wait { + int w_status; + struct anon_struct_4_3_c58d0830_for___wait_terminated __wait_terminated; + struct anon_struct_4_2_37e31311_for___wait_stopped __wait_stopped; +}; + +typedef struct TDatabasePoolConnection TDatabasePoolConnection, *PTDatabasePoolConnection; + +typedef struct TDatabaseConnectionPool TDatabaseConnectionPool, *PTDatabaseConnectionPool; + +typedef struct TDatabaseConnection TDatabaseConnection, *PTDatabaseConnection; + +typedef struct TDatabaseSettings TDatabaseSettings, *PTDatabaseSettings; + +typedef struct Semaphore Semaphore, *PSemaphore; + +struct TDatabasePoolConnection { + struct TDatabaseConnectionPool *DatabaseConnectionPool; + struct TDatabaseConnection *DatabaseConnection; + bool TransactionRunning; +}; + +struct TDatabaseSettings { + char Product[30]; + char Database[30]; + char Login[30]; + char Password[30]; + char Host[30]; + char Port[6]; +}; + +struct Semaphore { + int value; + struct pthread_mutex_t mutex; + struct pthread_cond_t condition; +}; + +struct TDatabaseConnectionPool { + int NumberOfConnections; + struct TDatabaseSettings DatabaseSettings; + struct TDatabaseConnection **DatabaseConnection; + bool *DatabaseConnectionFree; + struct Semaphore FreeDatabaseConnections; + struct Semaphore DatabaseConnectionMutex; +}; + +struct TDatabaseConnection { +}; + +typedef struct TPreparedQuery TPreparedQuery, *PTPreparedQuery; + +struct TPreparedQuery { + int Number; + char *Query; + char *DBTypes; + char *CTypes; + char *Name; +}; + +typedef char *__gnuc_va_list; + +typedef struct TSharedMemory TSharedMemory, *PTSharedMemory; + +typedef enum GAMESTATE { + GAME_STARTING=0, + GAME_RUNNING=1, + GAME_CLOSING=2, + GAME_ENDING=3 +} GAMESTATE; + +struct TSharedMemory { + int Command; + char CommandBuffer[256]; + ulong RoundNr; + ulong ObjectCounter; + ulong Errors; + int PlayersOnline; + int NewbiesOnline; + int PrintBufferPosition; + char PrintBuffer[200][128]; + enum GAMESTATE GameState; + pid_t GameThreadPID; +}; + +typedef struct char_traits traits_type; + +typedef struct basic_istream_> basic_istream_>, *Pbasic_istream_>; + +typedef struct basic_istream_> istream_type; + +struct basic_istream_> { // Original name: basic_istream > +}; + +typedef struct basic_streambuf_> basic_streambuf_>, *Pbasic_streambuf_>; + +typedef struct basic_streambuf_> streambuf_type; + +struct basic_streambuf_> { // Original name: basic_streambuf > +}; + +typedef struct basic_ostream_> basic_ostream_>, *Pbasic_ostream_>; + +typedef struct basic_ostream_> ostream_type; + +struct basic_ostream_> { // Original name: basic_ostream > +}; + +typedef struct storeunit storeunit, *Pstoreunit; + +typedef union storeitem storeitem, *Pstoreitem; + +typedef struct TPlayerIndexLeafNode TPlayerIndexLeafNode, *PTPlayerIndexLeafNode; + +typedef struct TPlayerIndexNode TPlayerIndexNode, *PTPlayerIndexNode; + +typedef struct TPlayerIndexEntry TPlayerIndexEntry, *PTPlayerIndexEntry; + +struct TPlayerIndexEntry { + char Name[30]; + ulong CharacterID; +}; + +struct TPlayerIndexNode { + bool InternalNode; +}; + +struct TPlayerIndexLeafNode { + struct TPlayerIndexNode super_TPlayerIndexNode; + int Count; + struct TPlayerIndexEntry Entry[10]; +}; + +union storeitem { + union storeitem *next; + struct TPlayerIndexLeafNode data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +typedef struct store store, *Pstore; + +typedef struct list_> list_>, *Plist_>; + +typedef union storeitem storeitem, *Pstoreitem; + +typedef struct listnode_> listnode_>, *Plistnode_>; + +typedef struct TPlayerIndexInternalNode TPlayerIndexInternalNode, *PTPlayerIndexInternalNode; + +typedef struct storeunit storeunit, *Pstoreunit; + +struct TPlayerIndexInternalNode { + struct TPlayerIndexNode super_TPlayerIndexNode; + struct TPlayerIndexNode *Child[27]; +}; + +union storeitem { + union storeitem *next; + struct TPlayerIndexInternalNode data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +typedef union storeitem storeitem, *Pstoreitem; + +typedef struct TNode TNode, *PTNode; + +struct TNode { + int Type; + int Data; + struct TNode *Left; + struct TNode *Right; +}; + +union storeitem { + union storeitem *next; + struct TNode data; +}; + +typedef struct vector vector, *Pvector; + +typedef struct THouse THouse, *PTHouse; + +typedef struct vector vector, *Pvector; + +typedef struct THouseGuest THouseGuest, *PTHouseGuest; + +struct THouseGuest { + char Name[60]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouseGuest init; + struct THouseGuest *entry; +}; + +struct THouse { + ushort ID; + char Name[50]; + char Description[500]; + int Size; + ulong Rent; + int DepotNr; + bool NoAuction; + bool GuildHouse; + int ExitX; + int ExitY; + int ExitZ; + int CenterX; + int CenterY; + int CenterZ; + ulong OwnerID; + char OwnerName[30]; + int LastTransition; + int PaidUntil; + struct vector Subowner; + int Subowners; + struct vector Guest; + int Guests; + int Help; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouse init; + struct THouse *entry; +}; + +typedef struct matrix matrix, *Pmatrix; + +struct matrix { // Original name: matrix + int xmin; + int ymin; + int dx; + int dy; + ulong *entry; +}; + +typedef struct listnode_> listnode_>, *Plistnode_>; + +typedef struct storeunit storeunit, *Pstoreunit; + +typedef union storeitem storeitem, *Pstoreitem; + +typedef struct TWaitinglistEntry TWaitinglistEntry, *PTWaitinglistEntry; + +struct TWaitinglistEntry { + struct TWaitinglistEntry *Next; + char Name[30]; + ulong NextTry; + bool FreeAccount; + bool Newbie; + bool Sleeping; +}; + +union storeitem { + union storeitem *next; + struct TWaitinglistEntry data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +typedef struct vector vector, *Pvector; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCreature *init; + struct TCreature **entry; +}; + +typedef struct priority_queue_entry priority_queue_entry, *Ppriority_queue_entry; + +struct priority_queue_entry { // Original name: priority_queue_entry + ulong Key; + ulong Data; +}; + +typedef struct priority_queue_entry priority_queue_entry, *Ppriority_queue_entry; + +typedef struct TAttackWave TAttackWave, *PTAttackWave; + +typedef struct vector vector, *Pvector; + +typedef struct TItemData TItemData, *PTItemData; + +typedef struct ObjectType ObjectType, *PObjectType; + +struct ObjectType { + int TypeID; +}; + +struct priority_queue_entry { // Original name: priority_queue_entry + ulong Key; + struct TAttackWave *Data; +}; + +struct TItemData { + struct ObjectType Type; + int Maximum; + int Probability; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TItemData init; + struct TItemData *entry; +}; + +struct TAttackWave { + int x; + int y; + int z; + int Spread; + int Race; + int MinCount; + int MaxCount; + int Radius; + int Lifetime; + ulong Message; + int ExtraItems; + struct vector ExtraItem; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TSkillData TSkillData, *PTSkillData; + +struct TSkillData { + int Nr; + int Actual; + int Minimum; + int Maximum; + int NextLevel; + int FactorPercent; + int AddLevel; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TSkillData init; + struct TSkillData *entry; +}; + +typedef struct store store, *Pstore; + +typedef struct list_> list_>, *Plist_>; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TNonplayer TNonplayer, *PTNonplayer; + +typedef enum STATE { + SLEEPING=0, + IDLE=1, + UNDERATTACK=2, + TALKING=3, + LEAVING=4, + ATTACKING=5, + PANIC=6 +} STATE; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TNonplayer *init; + struct TNonplayer **entry; +}; + +struct TNonplayer { + struct TCreature super_TCreature; + enum STATE State; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TDelayedMail TDelayedMail, *PTDelayedMail; + +struct TDelayedMail { + ulong CharacterID; + int DepotNumber; + uchar *Packet; + int PacketSize; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TDelayedMail init; + struct TDelayedMail *entry; +}; + +typedef struct listIterator_> listIterator_>, *PlistIterator_>; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +typedef struct vector_> vector_>, *Pvector_>; + +struct vector_> { // Original name: vector > + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct priority_queue_entry init; + struct priority_queue_entry *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TSpellData TSpellData, *PTSpellData; + +typedef enum SpellShapeType { + SHAPE_ACTOR=0, + SHAPE_VICTIM=1, + SHAPE_ORIGIN=2, + SHAPE_DESTINATION=3, + SHAPE_ANGLE=4 +} SpellShapeType; + +typedef enum SpellImpactType { + IMPACT_DAMAGE=0, + IMPACT_FIELD=1, + IMPACT_HEALING=2, + IMPACT_SPEED=3, + IMPACT_DRUNKEN=4, + IMPACT_STRENGTH=5, + IMPACT_OUTFIT=6, + IMPACT_SUMMON=7 +} SpellImpactType; + +struct TSpellData { + enum SpellShapeType Shape; + int ShapeParam1; + int ShapeParam2; + int ShapeParam3; + int ShapeParam4; + enum SpellImpactType Impact; + int ImpactParam1; + int ImpactParam2; + int ImpactParam3; + int ImpactParam4; + int Delay; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TSpellData init; + struct TSpellData *entry; +}; + +typedef struct listnode_> listnode_>, *Plistnode_>; + +typedef struct storeunit storeunit, *Pstoreunit; + +struct storeunit { + union storeitem item[256]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +typedef struct matrix matrix, *Pmatrix; + +typedef struct TShortwayPoint TShortwayPoint, *PTShortwayPoint; + +struct TShortwayPoint { + int x; + int y; + int Waypoints; + int Waylength; + int Heuristic; + struct TShortwayPoint *Predecessor; + struct TShortwayPoint *NextToExpand; +}; + +struct matrix { + int xmin; + int ymin; + int dx; + int dy; + struct TShortwayPoint *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TCronEntry TCronEntry, *PTCronEntry; + +struct TCronEntry { + struct Object Obj; + ulong RoundNr; + int Previous; + int Next; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCronEntry init; + struct TCronEntry *entry; +}; + +typedef struct list list, *Plist; + +typedef struct listnode listnode, *Plistnode; + +typedef struct TStaticStringTableBlock TStaticStringTableBlock, *PTStaticStringTableBlock; + +struct TStaticStringTableBlock { + int TotalTextLength; + char Text[65536]; +}; + +struct listnode { + struct listnode *next; + struct listnode *prev; + struct TStaticStringTableBlock data; +}; + +struct list { + struct listnode *firstNode; + struct listnode *lastNode; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TMonsterhome TMonsterhome, *PTMonsterhome; + +struct TMonsterhome { + int Race; + int x; + int y; + int z; + int Radius; + int MaxMonsters; + int ActMonsters; + int RegenerationTime; + int Timer; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMonsterhome init; + struct TMonsterhome *entry; +}; + +typedef struct listIterator listIterator, *PlistIterator; + +struct listIterator { + struct listnode *actNode; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TCondition TCondition, *PTCondition; + +struct TCondition { + int Type; + ulong Text; + struct TNode *Expression; + int Property; + int Number; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCondition init; + struct TCondition *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TChannel TChannel, *PTChannel; + +typedef struct vector vector, *Pvector; + +struct vector { // Original name: vector + int min; + int max; + int start; + int space; + int block; + bool initialized; + ulong init; + ulong *entry; +}; + +struct TChannel { + ulong Moderator; + char ModeratorName[30]; + struct vector Subscriber; + int Subscribers; + struct vector InvitedPlayer; + int InvitedPlayers; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TChannel init; + struct TChannel *entry; +}; + +typedef struct matrix matrix, *Pmatrix; + +struct matrix { + int xmin; + int ymin; + int dx; + int dy; + int *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct THelpDepot THelpDepot, *PTHelpDepot; + +struct THelpDepot { + ulong CharacterID; + struct Object Box; + int DepotNr; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THelpDepot init; + struct THelpDepot *entry; +}; + +typedef struct listIterator_> listIterator_>, *PlistIterator_>; + +typedef struct listnode_> listnode_>, *Plistnode_>; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TParty TParty, *PTParty; + +struct TParty { + ulong Leader; + struct vector Member; + int Members; + struct vector InvitedPlayer; + int InvitedPlayers; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TParty init; + struct TParty *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TMoveUseRule TMoveUseRule, *PTMoveUseRule; + +struct TMoveUseRule { + int FirstCondition; + int LastCondition; + int FirstAction; + int LastAction; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseRule init; + struct TMoveUseRule *entry; +}; + +typedef struct listnode listnode, *Plistnode; + +typedef struct TDynamicStringTableBlock TDynamicStringTableBlock, *PTDynamicStringTableBlock; + +struct TDynamicStringTableBlock { + int FreeEntries; + int TotalTextLength; + bool Dirty; + uchar EntryType[256]; + ushort StringOffset[256]; + char Text[32768]; +}; + +struct listnode { + struct listnode *next; + struct listnode *prev; + struct TDynamicStringTableBlock data; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TObjectType TObjectType, *PTObjectType; + +struct TObjectType { + char *Name; + char *Description; + uchar Flags[9]; + ulong Attributes[62]; + int AttributeOffsets[18]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TObjectType init; + struct TObjectType *entry; +}; + +typedef struct listIterator_> listIterator_>, *PlistIterator_>; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +typedef struct fifo fifo, *Pfifo; + +typedef struct TListener TListener, *PTListener; + +struct TListener { + ulong StatementID; + ulong CharacterID; +}; + +struct fifo { + struct TListener *Entry; + int Size; + int Head; + int Tail; +}; + +typedef struct vector vector, *Pvector; + +typedef struct THouseArea THouseArea, *PTHouseArea; + +struct THouseArea { + ushort ID; + int SQMPrice; + int DepotNr; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouseArea init; + struct THouseArea *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TAction TAction, *PTAction; + +struct TAction { + int Type; + ulong Text; + int Number; + struct TNode *Expression; + struct TNode *Expression2; + struct TNode *Expression3; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TAction init; + struct TAction *entry; +}; + +typedef struct fifoIterator fifoIterator, *PfifoIterator; + +typedef struct fifo fifo, *Pfifo; + +typedef struct TStatement TStatement, *PTStatement; + +struct fifoIterator { + struct fifo *Fifo; + int Position; +}; + +struct fifo { + struct TStatement *Entry; + int Size; + int Head; + int Tail; +}; + +struct TStatement { + ulong StatementID; + ulong TimeStamp; + ulong CharacterID; + int Mode; + int Channel; + ulong Text; + bool Reported; +}; + +typedef struct fifoIterator fifoIterator, *PfifoIterator; + +struct fifoIterator { + struct fifo *Fifo; + int Position; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TReportedStatement TReportedStatement, *PTReportedStatement; + +struct TReportedStatement { + ulong StatementID; + ulong TimeStamp; + ulong CharacterID; + int Mode; + int Channel; + char Text[256]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TReportedStatement init; + struct TReportedStatement *entry; +}; + +typedef struct vector_> vector_>, *Pvector_>; + +struct vector_> { // Original name: vector > + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct priority_queue_entry init; + struct priority_queue_entry *entry; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TBehaviour TBehaviour, *PTBehaviour; + +struct TBehaviour { + struct vector Condition; + struct vector Action; + int Conditions; + int Actions; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TBehaviour init; + struct TBehaviour *entry; +}; + +typedef struct priority_queue priority_queue, *Ppriority_queue; + +struct priority_queue { // Original name: priority_queue + struct vector_> *Entry; + int Entries; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TMoveUseCondition TMoveUseCondition, *PTMoveUseCondition; + +typedef enum ModifierType { + MODIFIER_NORMAL=0, + MODIFIER_INVERT=1, + MODIFIER_TRUE=2 +} ModifierType; + +typedef enum ConditionType { + CONDITION_ISPOSITION=0, + CONDITION_ISTYPE=1, + CONDITION_ISCREATURE=2, + CONDITION_ISPLAYER=3, + CONDITION_HASFLAG=4, + CONDITION_HASTYPEATTRIBUTE=5, + CONDITION_HASINSTANCEATTRIBUTE=6, + CONDITION_HASTEXT=7, + CONDITION_ISPEACEFUL=8, + CONDITION_MAYLOGOUT=9, + CONDITION_HASPROFESSION=10, + CONDITION_HASLEVEL=11, + CONDITION_HASRIGHT=12, + CONDITION_HASQUESTVALUE=13, + CONDITION_TESTSKILL=14, + CONDITION_COUNTOBJECTS=15, + CONDITION_COUNTOBJECTSONMAP=16, + CONDITION_ISOBJECTTHERE=17, + CONDITION_ISCREATURETHERE=18, + CONDITION_ISPLAYERTHERE=19, + CONDITION_ISOBJECTININVENTORY=20, + CONDITION_ISPROTECTIONZONE=21, + CONDITION_ISHOUSE=22, + CONDITION_ISHOUSEOWNER=23, + CONDITION_ISDRESSED=24, + CONDITION_RANDOM=25 +} ConditionType; + +struct TMoveUseCondition { + enum ModifierType Modifier; + enum ConditionType Condition; + int Parameters[5]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseCondition init; + struct TMoveUseCondition *entry; +}; + +typedef struct listIterator listIterator, *PlistIterator; + +struct listIterator { + struct listnode *actNode; +}; + +typedef struct store store, *Pstore; + +typedef struct list_> list_>, *Plist_>; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +typedef struct list_> list_>, *Plist_>; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +typedef struct priority_queue priority_queue, *Ppriority_queue; + +struct priority_queue { // Original name: priority_queue + struct vector_> *Entry; + int Entries; +}; + +typedef struct matrix3d matrix3d, *Pmatrix3d; + +typedef struct TSector TSector, *PTSector; + +struct matrix3d { + int xmin; + int ymin; + int zmin; + int dx; + int dy; + int dz; + struct TSector **entry; +}; + +struct TSector { + struct Object MapCon[32][32]; + ulong TimeStamp; + uchar Status; + uchar MapFlags; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TPlayer TPlayer, *PTPlayer; + +typedef enum RESULT { + ERROR=-1, + NOERROR=0, + NOTACCESSIBLE=1, + NOTMOVABLE=2, + NOTTAKABLE=3, + NOROOM=4, + OUTOFRANGE=5, + OUTOFHOME=6, + CANNOTTHROW=7, + TOOHEAVY=8, + CROSSREFERENCE=9, + CONTAINERFULL=10, + WRONGPOSITION=11, + WRONGPOSITION2=12, + WRONGCLOTHES=13, + HANDSNOTFREE=14, + HANDBLOCKED=15, + ONEWEAPONONLY=16, + NOMATCH=17, + NOTCUMULABLE=18, + TOOMANYPARTS=19, + EMPTYCONTAINER=20, + SPLITOBJECT=21, + NOKEYMATCH=22, + UPSTAIRS=23, + DOWNSTAIRS=24, + CREATURENOTEXISTING=25, + PLAYERNOTEXISTING=26, + PLAYERNOTONLINE=27, + NAMEAMBIGUOUS=28, + NOTUSABLE=29, + FEDUP=30, + DESTROYED=31, + SPELLUNKNOWN=32, + LOWMAGICLEVEL=33, + MAGICITEM=34, + NOTENOUGHMANA=35, + NOSKILL=36, + TARGETLOST=37, + OUTOFAMMO=38, + NOCREATURE=39, + TOOLONG=40, + TARGETOUTOFRANGE=41, + TARGETHIDDEN=42, + ATTACKNOTALLOWED=43, + NOWAY=44, + LOGINERROR=45, + LOGINABORT=46, + PROTECTIONZONE=47, + ENTERPROTECTIONZONE=48, + EXHAUSTED=49, + NOTINVITED=50, + NOPREMIUMACCOUNT=51, + MOVENOTPOSSIBLE=52, + ALREADYTRADING=53, + PARTNERTRADING=54, + TOOMANYOBJECTS=55, + TOOMANYSLAVES=56, + NOTTURNABLE=57, + SECUREMODE=58, + NOTENOUGHSOULPOINTS=59, + LOWLEVEL=60 +} RESULT; + +typedef struct TPlayerData TPlayerData, *PTPlayerData; + +typedef __time_t time_t; + +struct TPlayerData { + ulong CharacterID; + pid_t Locked; + int Sticky; + bool Dirty; + int Race; + struct TOutfit OriginalOutfit; + struct TOutfit CurrentOutfit; + time_t LastLoginTime; + time_t LastLogoutTime; + int startx; + int starty; + int startz; + int posx; + int posy; + int posz; + int Profession; + int PlayerkillerEnd; + int Actual[25]; + int Maximum[25]; + int Minimum[25]; + int DeltaAct[25]; + int MagicDeltaAct[25]; + int Cycle[25]; + int MaxCycle[25]; + int Count[25]; + int MaxCount[25]; + int AddLevel[25]; + int Experience[25]; + int FactorPercent[25]; + int NextLevel[25]; + int Delta[25]; + uchar SpellList[256]; + int QuestValues[500]; + int MurderTimestamps[20]; + uchar *Inventory; + int InventorySize; + uchar *Depot[9]; + int DepotSize[9]; + ulong AccountID; + int Sex; + char Name[30]; + uchar Rights[12]; + char Guild[31]; + char Rank[31]; + char Title[31]; + int Buddies; + ulong Buddy[100]; + char BuddyName[100][30]; + ulong EarliestYellRound; + ulong EarliestTradeChannelRound; + ulong EarliestSpellTime; + ulong EarliestMultiuseTime; + ulong TalkBufferFullTime; + ulong MutingEndRound; + ulong Addressees[20]; + ulong AddresseesTimes[20]; + int NumberOfMutings; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TPlayer *init; + struct TPlayer **entry; +}; + +struct TPlayer { + struct TCreature super_TCreature; + ulong AccountID; + char Guild[31]; + char Rank[31]; + char Title[31]; + char IPAddress[16]; + uchar Rights[12]; + struct Object Depot; + int DepotNr; + int DepotSpace; + enum RESULT ConstructError; + struct TPlayerData *PlayerData; + struct Object TradeObject; + ulong TradePartner; + bool TradeAccepted; + int OldState; + ulong Request; + int RequestTimestamp; + ulong RequestProcessingGamemaster; + int TutorActivities; + uchar SpellList[256]; + int QuestValues[500]; + struct Object OpenContainer[16]; + struct vector AttackedPlayers; + int NumberOfAttackedPlayers; + bool Aggressor; + struct vector FormerAttackedPlayers; + int NumberOfFormerAttackedPlayers; + bool FormerAggressor; + ulong FormerLogoutRound; + ulong PartyLeader; + ulong PartyLeavingRound; + ulong TalkBufferFullTime; + ulong MutingEndRound; + int NumberOfMutings; + ulong Addressees[20]; + ulong AddresseesTimes[20]; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TMark TMark, *PTMark; + +struct TMark { + char Name[20]; + int x; + int y; + int z; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMark init; + struct TMark *entry; +}; + +typedef struct listIterator_> listIterator_>, *PlistIterator_>; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +typedef struct store store, *Pstore; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TMoveUseAction TMoveUseAction, *PTMoveUseAction; + +typedef enum ActionType { + ACTION_CREATEONMAP=0, + ACTION_CREATE=1, + ACTION_MONSTERONMAP=2, + ACTION_MONSTER=3, + ACTION_EFFECTONMAP=4, + ACTION_EFFECT=5, + ACTION_TEXTONMAP=6, + ACTION_TEXT=7, + ACTION_CHANGEONMAP=8, + ACTION_CHANGE=9, + ACTION_CHANGEREL=10, + ACTION_SETATTRIBUTE=11, + ACTION_CHANGEATTRIBUTE=12, + ACTION_SETQUESTVALUE=13, + ACTION_DAMAGE=14, + ACTION_SETSTART=15, + ACTION_WRITENAME=16, + ACTION_WRITETEXT=17, + ACTION_LOGOUT=18, + ACTION_MOVEALLONMAP=19, + ACTION_MOVEALL=20, + ACTION_MOVEALLREL=21, + ACTION_MOVETOPONMAP=22, + ACTION_MOVETOP=23, + ACTION_MOVETOPREL=24, + ACTION_MOVE=25, + ACTION_MOVEREL=26, + ACTION_RETRIEVE=27, + ACTION_DELETEALLONMAP=28, + ACTION_DELETETOPONMAP=29, + ACTION_DELETEONMAP=30, + ACTION_DELETE=31, + ACTION_DELETEININVENTORY=32, + ACTION_DESCRIPTION=33, + ACTION_LOADDEPOT=34, + ACTION_SAVEDEPOT=35, + ACTION_SENDMAIL=36, + ACTION_NOP=37 +} ActionType; + +struct TMoveUseAction { + enum ActionType Action; + int Parameters[5]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseAction init; + struct TMoveUseAction *entry; +}; + +typedef struct list list, *Plist; + +struct list { + struct listnode *firstNode; + struct listnode *lastNode; +}; + +typedef struct vector vector, *Pvector; + +typedef struct TDepotInfo TDepotInfo, *PTDepotInfo; + +struct TDepotInfo { + char Town[20]; + int Size; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TDepotInfo init; + struct TDepotInfo *entry; +}; + +typedef struct _pthread_cleanup_buffer _pthread_cleanup_buffer, *P_pthread_cleanup_buffer; + +struct _pthread_cleanup_buffer { + void (*__routine)(void *); + void *__arg; + int __canceltype; + struct _pthread_cleanup_buffer *__prev; +}; + +typedef __sig_atomic_t sig_atomic_t; + +typedef void (*__sighandler_t)(int); + +typedef __sighandler_t sig_t; + +typedef struct sigvec sigvec, *Psigvec; + +struct sigvec { + __sighandler_t sv_handler; + int sv_mask; + int sv_flags; +}; + +typedef __sighandler_t sighandler_t; + +typedef struct __sigset_t __sigset_t, *P__sigset_t; + +typedef struct __sigset_t sigset_t; + +struct __sigset_t { + ulong __val[32]; +}; + +typedef struct shmid_ds shmid_ds, *Pshmid_ds; + +typedef struct ipc_perm ipc_perm, *Pipc_perm; + +struct ipc_perm { + __key_t __key; + __uid_t uid; + __gid_t gid; + __uid_t cuid; + __gid_t cgid; + ushort mode; + ushort __pad1; + ushort __seq; + ushort __pad2; + ulong __unused1; + ulong __unused2; +}; + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + __time_t shm_atime; + ulong __unused1; + __time_t shm_dtime; + ulong __unused2; + __time_t shm_ctime; + ulong __unused3; + __pid_t shm_cpid; + __pid_t shm_lpid; + shmatt_t shm_nattch; + ulong __unused4; + ulong __unused5; +}; + +typedef struct shm_info shm_info, *Pshm_info; + +struct shm_info { + int used_ids; + ulong shm_tot; + ulong shm_rss; + ulong shm_swp; + ulong swap_attempts; + ulong swap_successes; +}; + +typedef struct shminfo shminfo, *Pshminfo; + +struct shminfo { + ulong shmmax; + ulong shmmin; + ulong shmmni; + ulong shmseg; + ulong shmall; + ulong __unused1; + ulong __unused2; + ulong __unused3; + ulong __unused4; +}; + +typedef struct _IO_FILE.conflict _IO_FILE.conflict, *P_IO_FILE.conflict; + +typedef struct _IO_marker _IO_marker, *P_IO_marker; + +typedef void _IO_lock_t; + +typedef struct _IO_FILE _IO_FILE, *P_IO_FILE; + +typedef struct _IO_codecvt _IO_codecvt, *P_IO_codecvt; + +typedef enum __codecvt_result { + __codecvt_ok=0, + __codecvt_partial=1, + __codecvt_error=2, + __codecvt_noconv=3 +} __codecvt_result; + +typedef struct _IO_wide_data _IO_wide_data, *P_IO_wide_data; + +typedef union _G_iconv_t _G_iconv_t, *P_G_iconv_t; + +typedef struct _IO_jump_t _IO_jump_t, *P_IO_jump_t; + +typedef struct __gconv_info __gconv_info, *P__gconv_info; + +typedef struct anon_struct_44_2_2f34be42_for___combined anon_struct_44_2_2f34be42_for___combined, *Panon_struct_44_2_2f34be42_for___combined; + +typedef struct __gconv_step __gconv_step, *P__gconv_step; + +typedef struct __gconv_step_data __gconv_step_data, *P__gconv_step_data; + +typedef struct __gconv_loaded_object __gconv_loaded_object, *P__gconv_loaded_object; + +typedef int (*__gconv_fct)(struct __gconv_step *, struct __gconv_step_data *, uchar **, uchar *, uchar **, size_t *, int, int); + +typedef wint_t (*__gconv_btowc_fct)(struct __gconv_step *, uchar); + +typedef int (*__gconv_init_fct)(struct __gconv_step *); + +typedef void (*__gconv_end_fct)(struct __gconv_step *); + +typedef struct __gconv_trans_data __gconv_trans_data, *P__gconv_trans_data; + +typedef int (*__gconv_trans_fct)(struct __gconv_step *, struct __gconv_step_data *, void *, uchar *, uchar **, uchar *, uchar **, size_t *); + +typedef int (*__gconv_trans_context_fct)(void *, uchar *, uchar *, uchar *, uchar *); + +typedef void (*__gconv_trans_end_fct)(void *); + +struct _IO_FILE.conflict { + int _flags; + char *_IO_read_ptr; + char *_IO_read_end; + char *_IO_read_base; + char *_IO_write_base; + char *_IO_write_ptr; + char *_IO_write_end; + char *_IO_buf_base; + char *_IO_buf_end; + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + struct _IO_marker *_markers; + struct _IO_FILE.conflict *_chain; + int _fileno; + int _flags2; + __off_t _old_offset; + ushort _cur_column; + char _vtable_offset; + char _shortbuf[1]; + _IO_lock_t *_lock; + __off64_t _offset; + void *__pad1; + void *__pad2; + int _mode; + char _unused2[52]; +}; + +struct _IO_marker { + struct _IO_marker *_next; + struct _IO_FILE *_sbuf; + int _pos; +}; + +struct __gconv_step_data { + uchar *__outbuf; + uchar *__outbufend; + int __flags; + int __invocation_counter; + int __internal_use; + struct __mbstate_t *__statep; + struct __mbstate_t __state; + struct __gconv_trans_data *__trans; +}; + +struct __gconv_info { + size_t __nsteps; + struct __gconv_step *__steps; + struct __gconv_step_data __data[0]; +}; + +struct _IO_FILE { + int _flags; + char *_IO_read_ptr; + char *_IO_read_end; + char *_IO_read_base; + char *_IO_write_base; + char *_IO_write_ptr; + char *_IO_write_end; + char *_IO_buf_base; + char *_IO_buf_end; + char *_IO_save_base; + char *_IO_backup_base; + char *_IO_save_end; + struct _IO_marker *_markers; + struct _IO_FILE *_chain; + int _fileno; + int _flags2; + __off_t _old_offset; + ushort _cur_column; + char _vtable_offset; + char _shortbuf[1]; + _IO_lock_t *_lock; + __off64_t _offset; + struct _IO_codecvt *_codecvt; + struct _IO_wide_data *_wide_data; + int _mode; + char _unused2[52]; +}; + +struct anon_struct_44_2_2f34be42_for___combined { + struct __gconv_info __cd; + struct __gconv_step_data __data; +}; + +union _G_iconv_t { + struct __gconv_info __cd; + struct anon_struct_44_2_2f34be42_for___combined __combined; +}; + +struct _IO_codecvt { + void (*__codecvt_destr)(struct _IO_codecvt *); + __codecvt_result (*__codecvt_do_out)(struct _IO_codecvt *, struct __mbstate_t *, wchar_t *, wchar_t *, wchar_t **, char *, char *, char **); + __codecvt_result (*__codecvt_do_unshift)(struct _IO_codecvt *, struct __mbstate_t *, char *, char *, char **); + __codecvt_result (*__codecvt_do_in)(struct _IO_codecvt *, struct __mbstate_t *, char *, char *, char **, wchar_t *, wchar_t *, wchar_t **); + int (*__codecvt_do_encoding)(struct _IO_codecvt *); + int (*__codecvt_do_always_noconv)(struct _IO_codecvt *); + int (*__codecvt_do_length)(struct _IO_codecvt *, struct __mbstate_t *, char *, char *, uint); + int (*__codecvt_do_max_length)(struct _IO_codecvt *); + union _G_iconv_t __cd_in; + union _G_iconv_t __cd_out; +}; + +struct _IO_wide_data { + wchar_t *_IO_read_ptr; + wchar_t *_IO_read_end; + wchar_t *_IO_read_base; + wchar_t *_IO_write_base; + wchar_t *_IO_write_ptr; + wchar_t *_IO_write_end; + wchar_t *_IO_buf_base; + wchar_t *_IO_buf_end; + wchar_t *_IO_save_base; + wchar_t *_IO_backup_base; + wchar_t *_IO_save_end; + struct __mbstate_t _IO_state; + struct __mbstate_t _IO_last_state; + struct _IO_codecvt _codecvt; + wchar_t _shortbuf[1]; + struct _IO_jump_t *_wide_vtable; +}; + +struct _IO_jump_t { +}; + +struct __gconv_loaded_object { +}; + +struct __gconv_trans_data { + __gconv_trans_fct __trans_fct; + __gconv_trans_context_fct __trans_context_fct; + __gconv_trans_end_fct __trans_end_fct; + void *__data; + struct __gconv_trans_data *__next; +}; + +struct __gconv_step { + struct __gconv_loaded_object *__shlib_handle; + char *__modname; + int __counter; + char *__from_name; + char *__to_name; + __gconv_fct __fct; + __gconv_btowc_fct __btowc_fct; + __gconv_init_fct __init_fct; + __gconv_end_fct __end_fct; + int __min_needed_from; + int __max_needed_from; + int __min_needed_to; + int __max_needed_to; + int __stateful; + void *__data; +}; + +typedef __ssize_t (cookie_write_function_t)(void *, char *, uint); + +typedef int (cookie_seek_function_t)(void *, __off64_t *, int); + +typedef int (__io_close_fn)(void *); + +typedef struct _IO_cookie_io_functions_t _IO_cookie_io_functions_t, *P_IO_cookie_io_functions_t; + +struct _IO_cookie_io_functions_t { + __ssize_t (*read)(void *, char *, uint); + __ssize_t (*write)(void *, char *, uint); + int (*seek)(void *, __off64_t *, int); + __io_close_fn *close; +}; + +typedef __io_close_fn cookie_close_function_t; + +typedef __ssize_t (cookie_read_function_t)(void *, char *, uint); + +typedef struct _IO_cookie_io_functions_t cookie_io_functions_t; + +typedef enum RIGHT { + PREMIUM_ACCOUNT=0, + NOTATION=1, + NAMELOCK=2, + STATEMENT_REPORT=3, + BANISHMENT=4, + FINAL_WARNING=5, + IP_BANISHMENT=6, + KICK=7, + HOME_TELEPORT=8, + GAMEMASTER_BROADCAST=9, + ANONYMOUS_BROADCAST=10, + NO_BANISHMENT=11, + ALLOW_MULTICLIENT=12, + LOG_COMMUNICATION=13, + READ_GAMEMASTER_CHANNEL=14, + READ_TUTOR_CHANNEL=15, + HIGHLIGHT_HELP_CHANNEL=16, + SEND_BUGREPORTS=17, + NAME_INSULTING=18, + NAME_SENTENCE=19, + NAME_NONSENSICAL_LETTERS=20, + NAME_BADLY_FORMATTED=21, + NAME_NO_PERSON=22, + NAME_CELEBRITY=23, + NAME_COUNTRY=24, + NAME_FAKE_IDENTITY=25, + NAME_FAKE_POSITION=26, + STATEMENT_INSULTING=27, + STATEMENT_SPAMMING=28, + STATEMENT_ADVERT_OFFTOPIC=29, + STATEMENT_ADVERT_MONEY=30, + STATEMENT_NON_ENGLISH=31, + STATEMENT_CHANNEL_OFFTOPIC=32, + STATEMENT_VIOLATION_INCITING=33, + CHEATING_BUG_ABUSE=34, + CHEATING_GAME_WEAKNESS=35, + CHEATING_MACRO_USE=36, + CHEATING_MODIFIED_CLIENT=37, + CHEATING_HACKING=38, + CHEATING_MULTI_CLIENT=39, + CHEATING_ACCOUNT_TRADING=40, + CHEATING_ACCOUNT_SHARING=41, + GAMEMASTER_THREATENING=42, + GAMEMASTER_PRETENDING=43, + GAMEMASTER_INFLUENCE=44, + GAMEMASTER_FALSE_REPORTS=45, + KILLING_EXCESSIVE_UNJUSTIFIED=46, + DESTRUCTIVE_BEHAVIOUR=47, + SPOILING_AUCTION=48, + INVALID_PAYMENT=49, + TELEPORT_TO_CHARACTER=50, + TELEPORT_TO_MARK=51, + TELEPORT_VERTICAL=52, + TELEPORT_TO_COORDINATE=53, + LEVITATE=54, + SPECIAL_MOVEUSE=55, + MODIFY_GOSTRENGTH=56, + SHOW_COORDINATE=57, + RETRIEVE=58, + ENTER_HOUSES=59, + OPEN_NAMEDOORS=60, + INVULNERABLE=61, + UNLIMITED_MANA=62, + KEEP_INVENTORY=63, + ALL_SPELLS=64, + UNLIMITED_CAPACITY=65, + ZERO_CAPACITY=66, + ATTACK_EVERYWHERE=67, + NO_ATTACK=68, + NO_RUNES=69, + NO_LOGOUT_BLOCK=70, + GAMEMASTER_OUTFIT=71, + ILLUMINATE=72, + CHANGE_PROFESSION=73, + IGNORED_BY_MONSTERS=74, + SHOW_KEYHOLE_NUMBERS=75, + CREATE_OBJECTS=76, + CREATE_MONEY=77, + CREATE_MONSTERS=78, + CHANGE_SKILLS=79, + CLEANUP_FIELDS=80, + NO_STATISTICS=81 +} RIGHT; + +typedef struct _libc_fpreg _libc_fpreg, *P_libc_fpreg; + +struct _libc_fpreg { + ushort significand[4]; + ushort exponent; +}; + +typedef struct _libc_fpstate _libc_fpstate, *P_libc_fpstate; + +struct _libc_fpstate { + ulong cw; + ulong sw; + ulong tag; + ulong ipoff; + ulong cssel; + ulong dataoff; + ulong datasel; + struct _libc_fpreg _st[8]; + ulong status; +}; + +typedef struct mcontext_t mcontext_t, *Pmcontext_t; + +typedef greg_t gregset_t[19]; + +typedef struct _libc_fpstate *fpregset_t; + +struct mcontext_t { + gregset_t gregs; + fpregset_t fpregs; + ulong oldmask; + ulong cr2; +}; + +typedef struct ucontext ucontext, *Pucontext; + +typedef struct sigaltstack sigaltstack, *Psigaltstack; + +typedef struct sigaltstack stack_t; + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +struct ucontext { + ulong uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct mcontext_t uc_mcontext; + struct __sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; +}; + +typedef struct ucontext ucontext_t; + +typedef struct __locale_struct __locale_struct, *P__locale_struct; + +typedef struct __locale_struct *__locale_t; + +typedef __locale_t __c_locale; + +typedef struct locale_data locale_data, *Plocale_data; + +struct locale_data { +}; + +struct __locale_struct { + struct locale_data *__locales[13]; + ushort *__ctype_b; + int *__ctype_tolower; + int *__ctype_toupper; + char *__names[13]; +}; + +typedef struct sockaddr sockaddr, *Psockaddr; + +struct sockaddr { + sa_family_t sa_family; + char sa_data[14]; +}; + +typedef enum __socket_type { + SOCK_STREAM=1, + SOCK_DGRAM=2, + SOCK_RAW=3, + SOCK_RDM=4, + SOCK_SEQPACKET=5, + SOCK_PACKET=10 +} __socket_type; + +typedef struct osockaddr osockaddr, *Posockaddr; + +struct osockaddr { + ushort sa_family; + uchar sa_data[14]; +}; + +typedef struct msghdr msghdr, *Pmsghdr; + +typedef __socklen_t socklen_t; + +typedef struct iovec iovec, *Piovec; + +struct msghdr { + void *msg_name; + socklen_t msg_namelen; + struct iovec *msg_iov; + size_t msg_iovlen; + void *msg_control; + size_t msg_controllen; + int msg_flags; +}; + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +typedef struct linger linger, *Plinger; + +struct linger { + int l_onoff; + int l_linger; +}; + +typedef struct ucred ucred, *Pucred; + +typedef __uid_t uid_t; + +typedef __gid_t gid_t; + +struct ucred { + pid_t pid; + uid_t uid; + gid_t gid; +}; + +typedef struct sockaddr_storage sockaddr_storage, *Psockaddr_storage; + +struct sockaddr_storage { + sa_family_t ss_family; + __uint32_t __ss_align; + char __ss_padding[120]; +}; + +typedef struct cmsghdr cmsghdr, *Pcmsghdr; + +struct cmsghdr { + size_t cmsg_len; + int cmsg_level; + int cmsg_type; + uchar __cmsg_data[0]; +}; + +typedef struct TDirectReplyData TDirectReplyData, *PTDirectReplyData; + +struct TDirectReplyData { + ulong CharacterID; + char Message[100]; +}; + +typedef struct TWriterThreadReply TWriterThreadReply, *PTWriterThreadReply; + +typedef enum TWriterThreadReplyType { + REPLY_BROADCAST=0, + REPLY_DIRECT=1, + REPLY_LOGOUT=2 +} TWriterThreadReplyType; + +struct TWriterThreadReply { + enum TWriterThreadReplyType ReplyType; + void *Data; +}; + +typedef enum TWriterThreadOrderType { + ORDER_TERMINATE=0, + ORDER_LOGOUT=1, + ORDER_PLAYERLIST=2, + ORDER_KILLSTATISTICS=3, + ORDER_PUNISHMENT=4, + ORDER_CHARACTERDEATH=5, + ORDER_ADDBUDDY=6, + ORDER_REMOVEBUDDY=7, + ORDER_DECREMENTISONLINE=8, + ORDER_SAVEPLAYERDATA=9 +} TWriterThreadOrderType; + +typedef struct TLogoutOrderData TLogoutOrderData, *PTLogoutOrderData; + +struct TLogoutOrderData { + ulong CharacterID; + int Level; + int Profession; + time_t LastLoginTime; + int TutorActivities; + char Residence[30]; +}; + +typedef struct TCharacterDeathOrderData TCharacterDeathOrderData, *PTCharacterDeathOrderData; + +struct TCharacterDeathOrderData { + ulong CharacterID; + int Level; + ulong Offender; + char Remark[30]; + bool Unjustified; + time_t Time; +}; + +typedef struct TNotationOrderData TNotationOrderData, *PTNotationOrderData; + +struct TNotationOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CharacterName[30]; + char Comment[200]; +}; + +typedef struct TProtocolThreadOrder TProtocolThreadOrder, *PTProtocolThreadOrder; + +struct TProtocolThreadOrder { + char ProtocolName[20]; + char Text[256]; +}; + +typedef struct TPlayerlistOrderData TPlayerlistOrderData, *PTPlayerlistOrderData; + +struct TPlayerlistOrderData { + int NumberOfPlayers; + char *PlayerNames; + int *PlayerLevels; + int *PlayerProfessions; +}; + +typedef struct TKillStatisticsOrderData TKillStatisticsOrderData, *PTKillStatisticsOrderData; + +struct TKillStatisticsOrderData { + int NumberOfRaces; + char *RaceNames; + int *KilledPlayers; + int *KilledCreatures; +}; + +typedef struct TWriterThreadOrder TWriterThreadOrder, *PTWriterThreadOrder; + +struct TWriterThreadOrder { + enum TWriterThreadOrderType OrderType; + void *Data; +}; + +typedef struct TPunishmentOrderData TPunishmentOrderData, *PTPunishmentOrderData; + +struct TPunishmentOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CriminalName[30]; + char CriminalIPAddress[16]; + int Reason; + int Action; + char Comment[200]; + int NumberOfStatements; + struct vector *ReportedStatements; + ulong StatementID; + bool IPBanishment; +}; + +typedef struct TNameLockOrderData TNameLockOrderData, *PTNameLockOrderData; + +struct TNameLockOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CharacterName[30]; + bool OldNameVisible; +}; + +typedef struct TBuddyOrderData TBuddyOrderData, *PTBuddyOrderData; + +struct TBuddyOrderData { + ulong AccountID; + ulong Buddy; +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef enum float_round_style { + round_indeterminate=-1, + round_toward_zero=0, + round_to_nearest=1, + round_toward_infinity=2, + round_toward_neg_infinity=3 +} float_round_style; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef enum float_denorm_style { + denorm_indeterminate=-1, + denorm_absent=0, + denorm_present=1 +} float_denorm_style; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct __numeric_limits_base __numeric_limits_base, *P__numeric_limits_base; + +struct __numeric_limits_base { +}; + +typedef struct numeric_limits numeric_limits, *Pnumeric_limits; + +struct numeric_limits { // Original name: numeric_limits +}; + +typedef struct __enc_traits __enc_traits, *P__enc_traits; + +typedef void *iconv_t; + +struct __enc_traits { + char _M_int_enc[32]; + char _M_ext_enc[32]; + iconv_t _M_in_desc; + iconv_t _M_out_desc; + int _M_ext_bom; + int _M_int_bom; +}; + +typedef iconv_t __desc_type; + + +// WARNING! conflicting data type names: /DWARF/istream/basic_istream_>/sentry - /DWARF/ostream/basic_ostream_>/sentry + +typedef struct basic_streambuf_> basic_streambuf_>, *Pbasic_streambuf_>; + +typedef struct basic_streambuf_> __streambuf_type; + +struct basic_streambuf_> { // Original name: basic_streambuf > +}; + + +// WARNING! conflicting data type names: /DWARF/istream/basic_istream_>/sentry/__int_type - /DWARF/__int_type + +typedef struct ctype ctype, *Pctype; + +typedef struct ctype __ctype_type; + +struct ctype { +}; + +typedef struct basic_istream_> basic_istream_>, *Pbasic_istream_>; + +typedef struct basic_istream_> __istream_type; + +struct basic_istream_> { // Original name: basic_istream > +}; + + +// WARNING! conflicting data type names: /DWARF/istream/basic_istream_>/sentry - /DWARF/ostream/basic_ostream_>/sentry + +typedef struct timezone timezone, *Ptimezone; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +typedef __clockid_t clockid_t; + +typedef struct timeval timeval, *Ptimeval; + +struct timeval { + __time_t tv_sec; + __suseconds_t tv_usec; +}; + +typedef __timer_t timer_t; + +typedef struct timezone *__timezone_ptr_t; + +typedef __clock_t clock_t; + +typedef enum __itimer_which { + ITIMER_REAL=0, + ITIMER_VIRTUAL=1, + ITIMER_PROF=2 +} __itimer_which; + +typedef struct itimerval itimerval, *Pitimerval; + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +typedef struct itimerspec itimerspec, *Pitimerspec; + + +// WARNING! conflicting data type names: /DWARF/time.h/timespec - /time.h/timespec + +struct itimerspec { + struct timespec it_interval; + struct timespec it_value; +}; + +typedef struct tm tm, *Ptm; + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + long tm_gmtoff; + char *tm_zone; +}; + +typedef struct TMoveUseDatabase TMoveUseDatabase, *PTMoveUseDatabase; + +struct TMoveUseDatabase { + struct vector Rules; + int NumberOfRules; +}; + +typedef enum ParameterType { + PARAMETER_OBJECT=0, + PARAMETER_TYPE=1, + PARAMETER_FLAG=2, + PARAMETER_TYPEATTRIBUTE=3, + PARAMETER_INSTANCEATTRIBUTE=4, + PARAMETER_COORDINATE=5, + PARAMETER_VECTOR=6, + PARAMETER_RIGHT=7, + PARAMETER_SKILL=8, + PARAMETER_NUMBER=9, + PARAMETER_TEXT=10, + PARAMETER_COMPARISON=11 +} ParameterType; + +typedef enum EventType { + EVENT_USE=0, + EVENT_MULTIUSE=1, + EVENT_MOVEMENT=2, + EVENT_COLLISION=3, + EVENT_SEPARATION=4 +} EventType; + +typedef struct _Rb_tree_node_base _Rb_tree_node_base, *P_Rb_tree_node_base; + +typedef enum _Rb_tree_color { + _M_red=0, + _M_black=1 +} _Rb_tree_color; + +struct _Rb_tree_node_base { + enum _Rb_tree_color _M_color; + struct _Rb_tree_node_base *_M_parent; + struct _Rb_tree_node_base *_M_left; + struct _Rb_tree_node_base *_M_right; +}; + +typedef struct _Rb_tree_base_iterator _Rb_tree_base_iterator, *P_Rb_tree_base_iterator; + +struct _Rb_tree_base_iterator { + struct _Rb_tree_node_base *_M_node; +}; + +typedef struct _Rb_tree_node_base *_Base_ptr; + +typedef struct bidirectional_iterator_tag bidirectional_iterator_tag, *Pbidirectional_iterator_tag; + +typedef struct bidirectional_iterator_tag iterator_category; + +typedef struct forward_iterator_tag forward_iterator_tag, *Pforward_iterator_tag; + +typedef struct input_iterator_tag input_iterator_tag, *Pinput_iterator_tag; + +struct input_iterator_tag { +}; + +struct forward_iterator_tag { + struct input_iterator_tag super_input_iterator_tag; +}; + +struct bidirectional_iterator_tag { + struct forward_iterator_tag super_forward_iterator_tag; +}; + +typedef struct TObject TObject, *PTObject; + +struct TObject { + ulong ObjectID; + struct Object NextObject; + struct Object Container; + struct ObjectType Type; + ulong Attributes[4]; +}; + +typedef struct TObjectBlock TObjectBlock, *PTObjectBlock; + +struct TObjectBlock { + struct TObject Object[32768]; +}; + +typedef struct TFindCreatures TFindCreatures, *PTFindCreatures; + +struct TFindCreatures { + int startx; + int starty; + int endx; + int endy; + int blockx; + int blocky; + ulong ActID; + ulong SkipID; + int Mask; + bool finished; +}; + +typedef struct __exception __exception, *P__exception; + +struct __exception { + int type; + char *name; + double arg1; + double arg2; + double retval; +}; + +typedef enum _LIB_VERSION_TYPE { + _IEEE_=-1, + _SVID_=0, + _XOPEN_=1, + _POSIX_=2, + _ISOC_=3 +} _LIB_VERSION_TYPE; + +typedef struct __true_type __true_type, *P__true_type; + +struct __true_type { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __false_type __false_type, *P__false_type; + +struct __false_type { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { // Original name: _Is_integer +}; + +typedef struct __type_traits __type_traits, *P__type_traits; + +struct __type_traits { // Original name: __type_traits +}; + +typedef struct _Is_integer _Is_integer, *P_Is_integer; + +struct _Is_integer { +}; + +typedef struct __true_type has_trivial_copy_constructor; + +typedef struct __true_type has_trivial_assignment_operator; + +typedef struct __true_type is_POD_type; + +typedef struct __true_type has_trivial_default_constructor; + +typedef struct __true_type has_trivial_destructor; + +typedef struct __true_type _Integral; + +typedef void *nl_catd; + +typedef pthread_key_t __gthread_key_t; + +typedef pthread_once_t __gthread_once_t; + +typedef struct pthread_mutex_t __gthread_mutex_t; + +typedef struct lconv lconv, *Plconv; + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_p_sep_by_space; + char int_n_cs_precedes; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + +typedef __locale_t locale_t; + +typedef struct sched_param sched_param, *Psched_param; + +struct sched_param { + int __sched_priority; +}; + +typedef int (*__gconv_trans_init_fct)(void **, char *); + +typedef int (*__gconv_trans_query_fct)(char *, char ***, size_t *); + +typedef struct __gconv_info *__gconv_t; + +typedef enum anon_enum_32 { + __GCONV_OK=0, + __GCONV_IS_LAST=1, + __GCONV_NOCONV=1, + __GCONV_IGNORE_ERRORS=2, + __GCONV_NODB=2, + __GCONV_NOMEM=3, + __GCONV_EMPTY_INPUT=4, + __GCONV_FULL_OUTPUT=5, + __GCONV_ILLEGAL_INPUT=6, + __GCONV_INCOMPLETE_INPUT=7, + __GCONV_ILLEGAL_DESCRIPTOR=8, + __GCONV_INTERNAL_ERROR=9 +} anon_enum_32; + +typedef enum idtype_t { + P_ALL=0, + P_PID=1, + P_PGID=2 +} idtype_t; + +typedef struct locale locale, *Plocale; + +typedef struct _Impl _Impl, *P_Impl; + +typedef struct facet facet, *Pfacet; + +struct _Impl { + _Atomic_word _M_references; + struct facet **_M_facets; + size_t _M_facets_size; + char *_M_names[12]; +}; + +struct locale { + struct _Impl *_M_impl; +}; + +struct facet { +}; + +typedef struct id id, *Pid; + +struct id { + size_t _M_index; +}; + +typedef struct TBehaviourDatabase TBehaviourDatabase, *PTBehaviourDatabase; + +struct TBehaviourDatabase { + struct vector Behaviour; + int Behaviours; +}; + +typedef struct TMonster TMonster, *PTMonster; + +struct TMonster { + struct TNonplayer super_TNonplayer; + int Home; + ulong Master; + ulong Target; +}; + +typedef struct TNPC TNPC, *PTNPC; + +struct TNPC { + struct TNonplayer super_TNonplayer; + ulong Interlocutor; + int Topic; + int Price; + int Amount; + int TypeID; + ulong Data; + ulong LastTalk; + struct vector QueuedPlayers; + struct vector QueuedAddresses; + int QueueLength; + struct TBehaviourDatabase *Behaviour; +}; + +typedef enum SITUATION { + DEFAULT=0, + ADDRESS=1, + ADDRESSQUEUE=2, + BUSY=3, + VANISH=4 +} SITUATION; + +typedef struct fpos<__mbstate_t> wstreampos; + +typedef mbstate_t __state_type; + +typedef struct rebind rebind, *Prebind; + +struct rebind { +}; + +typedef struct __default_alloc_template __default_alloc_template, *P__default_alloc_template; + +typedef struct __default_alloc_template __alloc; + +struct __default_alloc_template { +}; + +typedef struct __default_alloc_template __default_alloc_template, *P__default_alloc_template; + +typedef struct __default_alloc_template __single_client_alloc; + +struct __default_alloc_template { +}; + +typedef struct allocator allocator, *Pallocator; + +struct allocator { +}; + +typedef struct __new_alloc __new_alloc, *P__new_alloc; + +struct __new_alloc { +}; + +typedef struct __new_alloc __mem_interface; + +typedef struct allocator allocator, *Pallocator; + +typedef struct allocator other; + +struct allocator { +}; + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/pointer - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/pointer + +typedef size_t size_type; + +typedef wchar_t *const_pointer; + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/reference - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/reference + +typedef wchar_t *const_reference; + +typedef struct __default_alloc_template _Alloc; + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/pointer - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/pointer + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/value_type - /DWARF/value_type + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/const_pointer - /DWARF/stl_alloc.h/allocator/const_pointer + +typedef union _Obj _Obj, *P_Obj; + +union _Obj { + union _Obj *_M_free_list_link; + char _M_client_data[1]; +}; + +typedef struct _Lock _Lock, *P_Lock; + +struct _Lock { +}; + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/const_pointer - /DWARF/stl_alloc.h/allocator/const_pointer + + +// WARNING! conflicting data type names: /DWARF/stl_alloc.h/allocator/const_reference - /DWARF/stl_alloc.h/allocator/const_reference + +typedef struct TRaceData TRaceData, *PTRaceData; + +typedef enum BloodType { + BT_BLOOD=0, + BT_SLIME=1, + BT_BONES=2, + BT_FIRE=3, + BT_ENERGY=4 +} BloodType; + +struct TRaceData { + char Name[30]; + char Article[3]; + struct TOutfit Outfit; + struct ObjectType MaleCorpse; + struct ObjectType FemaleCorpse; + enum BloodType Blood; + int ExperiencePoints; + int FleeThreshold; + int Attack; + int Defend; + int Armor; + int Poison; + int SummonCost; + int LoseTarget; + int Strategy[4]; + bool KickBoxes; + bool KickCreatures; + bool SeeInvisible; + bool Unpushable; + bool DistanceFighting; + bool NoSummon; + bool NoIllusion; + bool NoConvince; + bool NoBurning; + bool NoPoison; + bool NoEnergy; + bool NoHit; + bool NoLifeDrain; + bool NoParalyze; + int Skills; + struct vector Skill; + int Talks; + struct vector Talk; + int Items; + struct vector Item; + int Spells; + struct vector Spell; +}; + +typedef enum _Ios_Fmtflags { + _M_ios_fmtflags_end=65536 +} _Ios_Fmtflags; + +typedef struct ios_base ios_base, *Pios_base; + +typedef ptrdiff_t streamsize; + +typedef enum _Ios_Iostate { + _M_ios_iostate_end=65536 +} _Ios_Iostate; + +typedef struct _Callback_list _Callback_list, *P_Callback_list; + +typedef enum event { + erase_event=0, + imbue_event=1, + copyfmt_event=2 +} event; + +typedef struct _Words _Words, *P_Words; + +struct _Callback_list { + struct _Callback_list *_M_next; + void (*_M_fn)(enum event, struct ios_base *, int); + int _M_index; + _Atomic_word _M_refcount; +}; + +struct _Words { + void *_M_pword; + long _M_iword; +}; + +struct ios_base { + streamsize _M_precision; + streamsize _M_width; + enum _Ios_Fmtflags _M_flags; + enum _Ios_Iostate _M_exception; + enum _Ios_Iostate _M_streambuf_state; + struct _Callback_list *_M_callbacks; + struct _Words _M_word_zero; + struct _Words _M_local_word[8]; + int _M_word_size; + struct _Words *_M_word; + struct locale _M_ios_locale; +}; + +typedef enum _Ios_Seekdir { + _M_ios_seekdir_end=65536 +} _Ios_Seekdir; + +typedef enum _Ios_Openmode { + _M_ios_openmode_end=65536 +} _Ios_Openmode; + +typedef enum _Ios_Iostate iostate; + +typedef enum _Ios_Seekdir seekdir; + +typedef struct Init Init, *PInit; + +struct Init { +}; + +typedef enum _Ios_Openmode openmode; + +typedef enum _Ios_Fmtflags fmtflags; + +typedef void (*event_callback)(enum event, struct ios_base *, int); + +typedef struct __basic_file __basic_file, *P__basic_file; + +typedef struct _IO_FILE FILE; + +typedef FILE __c_file; + +struct __basic_file { + __c_file *_M_cfile; + bool _M_cfile_created; +}; + +typedef __intptr_t intptr_t; + +typedef struct TRSAPrivateKey TRSAPrivateKey, *PTRSAPrivateKey; + +typedef struct vlong vlong, *Pvlong; + +typedef struct vlong_value vlong_value, *Pvlong_value; + +typedef struct vlong_flex_unit vlong_flex_unit, *Pvlong_flex_unit; + +struct vlong { + int (**_vptr.vlong)(...); + struct vlong_value *value; + int negative; +}; + +struct vlong_flex_unit { + uint n; + uint *a; + uint z; +}; + +struct vlong_value { + struct vlong_flex_unit super_vlong_flex_unit; + uint share; +}; + +struct TRSAPrivateKey { + int (**_vptr.TRSAPrivateKey)(...); + struct vlong m_PrimeP; + struct vlong m_PrimeQ; + struct vlong m_U; + struct vlong m_DP; + struct vlong m_DQ; +}; + +typedef struct ctype_base ctype_base, *Pctype_base; + +struct ctype_base { +}; + +typedef int *__to_type; + +typedef __fd_mask fd_mask; + +typedef struct fd_set fd_set, *Pfd_set; + +struct fd_set { + __fd_mask fds_bits[32]; +}; + +typedef __int32_t *wctrans_t; + +typedef struct TSpellList TSpellList, *PTSpellList; + +struct TSpellList { + uchar Syllable[10]; + uchar RuneGr; + uchar RuneNr; + char *Comment; + ushort Level; + ushort RuneLevel; + ushort Flags; + int Mana; + int SoulPoints; + int Amount; +}; + +typedef struct TCircle TCircle, *PTCircle; + +struct TCircle { + int x[32]; + int y[32]; + int Count; +}; + +typedef struct THealingImpact THealingImpact, *PTHealingImpact; + +typedef struct TImpact TImpact, *PTImpact; + +struct TImpact { + int (**_vptr.TImpact)(...); +}; + +struct THealingImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int Power; +}; + +typedef struct TOutfitImpact TOutfitImpact, *PTOutfitImpact; + +struct TOutfitImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + struct TOutfit Outfit; + int Duration; +}; + +typedef struct TSpeedImpact TSpeedImpact, *PTSpeedImpact; + +struct TSpeedImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int Percent; + int Duration; +}; + +typedef struct TFieldImpact TFieldImpact, *PTFieldImpact; + +struct TFieldImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int FieldType; +}; + +typedef struct TStrengthImpact TStrengthImpact, *PTStrengthImpact; + +struct TStrengthImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int Skills; + int Percent; + int Duration; +}; + +typedef struct TDamageImpact TDamageImpact, *PTDamageImpact; + +struct TDamageImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int DamageType; + int Power; + bool AllowDefense; +}; + +typedef struct TDrunkenImpact TDrunkenImpact, *PTDrunkenImpact; + +struct TDrunkenImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int Power; + int Duration; +}; + +typedef struct TSummonImpact TSummonImpact, *PTSummonImpact; + +struct TSummonImpact { + struct TImpact super_TImpact; + struct TCreature *Actor; + int Race; + int Maximum; +}; + +typedef __suseconds_t suseconds_t; + +typedef struct __fsid_t __fsid_t, *P__fsid_t; + +typedef struct __fsid_t fsid_t; + +struct __fsid_t { + int __val[2]; +}; + +typedef __useconds_t useconds_t; + +typedef __quad_t quad_t; + +typedef __off64_t __loff_t; + +typedef __fsfilcnt64_t fsfilcnt64_t; + +typedef __u_long u_long; + +typedef __mode_t mode_t; + +typedef __fsfilcnt_t fsfilcnt_t; + +typedef __loff_t loff_t; + +typedef __daddr_t daddr_t; + +typedef __u_int u_int; + +typedef __fsblkcnt_t fsblkcnt_t; + +typedef __off64_t off64_t; + +typedef __quad_t *__qaddr_t; + +typedef __blkcnt64_t blkcnt64_t; + +typedef __blkcnt_t blkcnt_t; + +typedef __u_quad_t u_quad_t; + +typedef char *__caddr_t; + +typedef __id_t id_t; + +typedef __u_short u_short; + +typedef __off_t off_t; + +typedef __nlink_t nlink_t; + +typedef __u_char u_char; + +typedef __fsblkcnt64_t fsblkcnt64_t; + +typedef __caddr_t caddr_t; + +typedef __dev_t dev_t; + +typedef __blksize_t blksize_t; + +typedef __ino_t ino_t; + +typedef __ino64_t ino64_t; + + +// WARNING! conflicting data type names: /DWARF/dirent.h/dirent - /dirent.h/dirent + +typedef struct dirent64 dirent64, *Pdirent64; + +struct dirent64 { + __ino64_t d_ino; + __off64_t d_off; + ushort d_reclen; + uchar d_type; + char d_name[256]; +}; + + +// WARNING! conflicting data type names: /DWARF/dirent.h/DIR - /dirent.h/DIR + + +// WARNING! conflicting data type names: /DWARF/dirent.h/DeleteSwappedSectors/DIR - /dirent.h/DIR + + +// WARNING! conflicting data type names: /DWARF/dirent.h/InitNPCs/DIR - /dirent.h/DIR + + +// WARNING! conflicting data type names: /DWARF/dirent.h/ApplyPatches/DIR - /dirent.h/DIR + + +// WARNING! conflicting data type names: /DWARF/dirent.h/LoadRaces/DIR - /dirent.h/DIR + + +// WARNING! conflicting data type names: /DWARF/dirent.h/TreatAllFiles/DIR - /dirent.h/DIR + +typedef struct sigstack sigstack, *Psigstack; + +struct sigstack { + void *ss_sp; + int ss_onstack; +}; + +typedef struct sigevent sigevent, *Psigevent; + +typedef struct sigevent sigevent_t; + +typedef union anon_union_52_3_fd6d425a_for__sigev_un anon_union_52_3_fd6d425a_for__sigev_un, *Panon_union_52_3_fd6d425a_for__sigev_un; + +typedef struct anon_struct_8_2_a09fd341_for__sigev_thread anon_struct_8_2_a09fd341_for__sigev_thread, *Panon_struct_8_2_a09fd341_for__sigev_thread; + +struct anon_struct_8_2_a09fd341_for__sigev_thread { + void (*_function)(union sigval); + void *_attribute; +}; + +union anon_union_52_3_fd6d425a_for__sigev_un { + int _pad[13]; + __pid_t _tid; + struct anon_struct_8_2_a09fd341_for__sigev_thread _sigev_thread; +}; + +struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union anon_union_52_3_fd6d425a_for__sigev_un _sigev_un; +}; + + +// WARNING! conflicting data type names: /DWARF/siginfo.h/siginfo - /siginfo.h/siginfo + +typedef union anon_union_116_7_b489c2e4_for__sifields anon_union_116_7_b489c2e4_for__sifields, *Panon_union_116_7_b489c2e4_for__sifields; + +typedef struct anon_struct_8_2_0a3d7222_for__kill anon_struct_8_2_0a3d7222_for__kill, *Panon_struct_8_2_0a3d7222_for__kill; + +typedef struct anon_struct_12_3_5124685d_for__timer anon_struct_12_3_5124685d_for__timer, *Panon_struct_12_3_5124685d_for__timer; + +typedef struct anon_struct_12_3_9bedbd60_for__rt anon_struct_12_3_9bedbd60_for__rt, *Panon_struct_12_3_9bedbd60_for__rt; + +typedef struct anon_struct_20_5_7a025f54_for__sigchld anon_struct_20_5_7a025f54_for__sigchld, *Panon_struct_20_5_7a025f54_for__sigchld; + +typedef struct anon_struct_4_1_ff5bff1a_for__sigfault anon_struct_4_1_ff5bff1a_for__sigfault, *Panon_struct_4_1_ff5bff1a_for__sigfault; + +typedef struct anon_struct_8_2_686959ae_for__sigpoll anon_struct_8_2_686959ae_for__sigpoll, *Panon_struct_8_2_686959ae_for__sigpoll; + +struct anon_struct_4_1_ff5bff1a_for__sigfault { + void *si_addr; +}; + +struct anon_struct_12_3_5124685d_for__timer { + int si_tid; + int si_overrun; + sigval_t si_sigval; +}; + +struct anon_struct_8_2_0a3d7222_for__kill { + __pid_t si_pid; + __uid_t si_uid; +}; + +struct anon_struct_20_5_7a025f54_for__sigchld { + __pid_t si_pid; + __uid_t si_uid; + int si_status; + __clock_t si_utime; + __clock_t si_stime; +}; + +struct anon_struct_12_3_9bedbd60_for__rt { + __pid_t si_pid; + __uid_t si_uid; + sigval_t si_sigval; +}; + +struct anon_struct_8_2_686959ae_for__sigpoll { + long si_band; + int si_fd; +}; + +union anon_union_116_7_b489c2e4_for__sifields { + int _pad[29]; + struct anon_struct_8_2_0a3d7222_for__kill _kill; + struct anon_struct_12_3_5124685d_for__timer _timer; + struct anon_struct_12_3_9bedbd60_for__rt _rt; + struct anon_struct_20_5_7a025f54_for__sigchld _sigchld; + struct anon_struct_4_1_ff5bff1a_for__sigfault _sigfault; + struct anon_struct_8_2_686959ae_for__sigpoll _sigpoll; +}; + + +// WARNING! conflicting data type names: /DWARF/siginfo.h/anon_subr/siginfo_t - /siginfo.h/siginfo_t + +typedef struct basic_string,std::allocator_> basic_string,std::allocator_>, *Pbasic_string,std::allocator_>; + +typedef struct _Alloc_hider _Alloc_hider, *P_Alloc_hider; + +struct _Alloc_hider { // Missing member super_allocator : allocator at offset 0x0 [conflicting member at same offset] + wchar_t *_M_p; +}; + +struct basic_string,std::allocator_> { // Original name: basic_string,std::allocator > + struct _Alloc_hider _M_dataplus; +}; + +typedef struct allocator allocator, *Pallocator; + +struct allocator { +}; + +typedef struct basic_string,std::allocator_> basic_string,std::allocator_>, *Pbasic_string,std::allocator_>; + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/_Alloc_hider - /DWARF/basic_string.h/basic_string,std::allocator_>/_Alloc_hider + +struct basic_string,std::allocator_> { // Original name: basic_string,std::allocator > + struct _Alloc_hider _M_dataplus; +}; + +typedef struct basic_string,std::allocator_> wstring; + + +// WARNING! conflicting data type names: /DWARF/stringfwd.h/locale/string - /string + + +// WARNING! conflicting data type names: /DWARF/stringfwd.h/TRSAPrivateKey/init/lexical_block_4/lexical_block_4_1/string - /string + +typedef struct sigaction sigaction, *Psigaction; + +typedef union anon_union_4_2_5ad2d23e_for___sigaction_handler anon_union_4_2_5ad2d23e_for___sigaction_handler, *Panon_union_4_2_5ad2d23e_for___sigaction_handler; + +union anon_union_4_2_5ad2d23e_for___sigaction_handler { + __sighandler_t sa_handler; + void (*sa_sigaction)(int, siginfo_t *, void *); +}; + +struct sigaction { + union anon_union_4_2_5ad2d23e_for___sigaction_handler __sigaction_handler; + struct __sigset_t sa_mask; + int sa_flags; + void (*sa_restorer)(void); +}; + +typedef enum TYPEATTRIBUTE { + WAYPOINTS=0, + CAPACITY=1, + CHANGETARGET=2, + KEYDOORTARGET=3, + NAMEDOORTARGET=4, + LEVELDOORTARGET=5, + QUESTDOORTARGET=6, + NUTRITION=7, + INFORMATIONTYPE=8, + FONTSIZE=9, + MAXLENGTH=10, + MAXLENGTHONCE=11, + SOURCELIQUIDTYPE=12, + ABSTELEPORTEFFECT=13, + RELTELEPORTDISPLACEMENT=14, + RELTELEPORTEFFECT=15, + AVOIDDAMAGETYPES=16, + MINIMUMLEVEL=17, + PROFESSIONS=18, + WEIGHT=19, + ROTATETARGET=20, + DESTROYTARGET=21, + BODYPOSITION=22, + SKILLNUMBER=23, + SKILLMODIFICATION=24, + PROTECTIONDAMAGETYPES=25, + DAMAGEREDUCTION=26, + BRIGHTNESS=27, + LIGHTCOLOR=28, + CORPSETYPE=29, + TOTALEXPIRETIME=30, + EXPIRETARGET=31, + TOTALUSES=32, + WEAROUTTARGET=33, + WEAPONTYPE=34, + WEAPONATTACKVALUE=35, + WEAPONDEFENDVALUE=36, + SHIELDDEFENDVALUE=37, + BOWRANGE=38, + BOWAMMOTYPE=39, + THROWRANGE=40, + THROWATTACKVALUE=41, + THROWDEFENDVALUE=42, + THROWMISSILE=43, + THROWSPECIALEFFECT=44, + THROWEFFECTSTRENGTH=45, + THROWFRAGILITY=46, + WANDRANGE=47, + WANDMANACONSUMPTION=48, + WANDATTACKSTRENGTH=49, + WANDATTACKVARIATION=50, + WANDDAMAGETYPE=51, + WANDMISSILE=52, + AMMOTYPE=53, + AMMOATTACKVALUE=54, + AMMOMISSILE=55, + AMMOSPECIALEFFECT=56, + AMMOEFFECTSTRENGTH=57, + ARMORVALUE=58, + ELEVATION=59, + DISGUISETARGET=60, + MEANING=61 +} TYPEATTRIBUTE; + +typedef enum FLAG { + BANK=0, + CLIP=1, + BOTTOM=2, + TOP=3, + CONTAINER=4, + CHEST=5, + CUMULATIVE=6, + USEEVENT=7, + CHANGEUSE=8, + FORCEUSE=9, + MULTIUSE=10, + DISTUSE=11, + MOVEMENTEVENT=12, + COLLISIONEVENT=13, + SEPARATIONEVENT=14, + KEY=15, + KEYDOOR=16, + NAMEDOOR=17, + LEVELDOOR=18, + QUESTDOOR=19, + BED=20, + FOOD=21, + RUNE=22, + INFORMATION=23, + TEXT=24, + WRITE=25, + WRITEONCE=26, + LIQUIDCONTAINER=27, + LIQUIDSOURCE=28, + LIQUIDPOOL=29, + TELEPORTABSOLUTE=30, + TELEPORTRELATIVE=31, + UNPASS=32, + UNMOVE=33, + UNTHROW=34, + UNLAY=35, + AVOID=36, + MAGICFIELD=37, + RESTRICTLEVEL=38, + RESTRICTPROFESSION=39, + TAKE=40, + HANG=41, + HOOKSOUTH=42, + HOOKEAST=43, + ROTATE=44, + DESTROY=45, + CLOTHES=46, + SKILLBOOST=47, + PROTECTION=48, + LIGHT=49, + ROPESPOT=50, + CORPSE=51, + EXPIRE=52, + EXPIRESTOP=53, + WEAROUT=54, + WEAPON=55, + SHIELD=56, + BOW=57, + THROW=58, + WAND=59, + AMMO=60, + ARMOR=61, + HEIGHT=62, + DISGUISE=63, + SHOWDETAIL=64, + SPECIALOBJECT=65 +} FLAG; + +typedef enum INSTANCEATTRIBUTE { + CONTENT=0, + CHESTQUESTNUMBER=1, + AMOUNT=2, + KEYNUMBER=3, + KEYHOLENUMBER=4, + DOORLEVEL=5, + DOORQUESTNUMBER=6, + DOORQUESTVALUE=7, + CHARGES=8, + TEXTSTRING=9, + EDITOR=10, + CONTAINERLIQUIDTYPE=11, + POOLLIQUIDTYPE=12, + ABSTELEPORTDESTINATION=13, + RESPONSIBLE=14, + REMAININGEXPIRETIME=15, + SAVEDEXPIRETIME=16, + REMAININGUSES=17 +} INSTANCEATTRIBUTE; + +typedef enum SPECIALMEANING { + MONEY_ONE=1, + MONEY_HUNDRED=2, + MONEY_TENTHOUSAND=3, + INVENTORY_RIGHTHAND=10, + INVENTORY_LEFTHAND=11, + INVENTORY_BODY_MALE=12, + INVENTORY_BODY_FEMALE=13, + INVENTORY_CONTAINER=14, + INVENTORY_FOOD=15, + DEPOT_LOCKER=20, + DEPOT_CHEST=21, + PARCEL_NEW=22, + PARCEL_STAMPED=23, + PARCEL_LABEL=24, + LETTER_NEW=25, + LETTER_STAMPED=26, + BLOOD_SPLASH=30, + BLOOD_POOL=31, + RUNE_BLANK=40, + MAGICFIELD_FIRE_DANGEROUS=41, + MAGICFIELD_FIRE_HARMLESS=42, + MAGICFIELD_POISON_DANGEROUS=43, + MAGICFIELD_POISON_HARMLESS=44, + MAGICFIELD_ENERGY_DANGEROUS=45, + MAGICFIELD_ENERGY_HARMLESS=46, + MAGICFIELD_MAGICWALL=47, + MAGICFIELD_RUSHWOOD=48 +} SPECIALMEANING; + +typedef struct rusage rusage, *Prusage; + +struct rusage { + struct timeval ru_utime; + struct timeval ru_stime; + long ru_maxrss; + long ru_ixrss; + long ru_idrss; + long ru_isrss; + long ru_minflt; + long ru_majflt; + long ru_nswap; + long ru_inblock; + long ru_oublock; + long ru_msgsnd; + long ru_msgrcv; + long ru_nsignals; + long ru_nvcsw; + long ru_nivcsw; +}; + +typedef struct rlimit rlimit, *Prlimit; + +typedef __rlim_t rlim_t; + +struct rlimit { + rlim_t rlim_cur; + rlim_t rlim_max; +}; + +typedef struct rlimit64 rlimit64, *Prlimit64; + +typedef __rlim64_t rlim64_t; + +struct rlimit64 { + rlim64_t rlim_cur; + rlim64_t rlim_max; +}; + +typedef enum __rusage_who { + RUSAGE_BOTH=-2, + RUSAGE_CHILDREN=-1, + RUSAGE_SELF=0 +} __rusage_who; + +typedef enum __priority_which { + PRIO_PROCESS=0, + PRIO_PGRP=1, + PRIO_USER=2 +} __priority_which; + +typedef enum __rlimit_resource { + RLIMIT_CPU=0, + RLIMIT_FSIZE=1, + RLIMIT_DATA=2, + RLIMIT_STACK=3, + RLIMIT_CORE=4, + RLIMIT_RSS=5, + RLIMIT_NPROC=6, + RLIMIT_NOFILE=7, + RLIMIT_OFILE=7, + RLIMIT_MEMLOCK=8, + RLIMIT_AS=9, + RLIMIT_LOCKS=10, + RLIMIT_NLIMITS=11, + RLIM_NLIMITS=11 +} __rlimit_resource; + +typedef struct codecvt_base codecvt_base, *Pcodecvt_base; + +struct codecvt_base { +}; + +typedef enum result { + ok=0, + partial=1, + error=2, + noconv=3 +} result; + +typedef struct __normal_iterator,_std::allocator_>_> const_iterator; + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/const_pointer - /DWARF/stl_alloc.h/allocator/const_pointer + +typedef struct _Rep _Rep, *P_Rep; + +struct _Rep { + size_t _M_length; + size_t _M_capacity; + _Atomic_word _M_references; +}; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>, *Preverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> reverse_iterator; + +struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> { // Original name: reverse_iterator<__gnu_cxx::__normal_iterator, std::allocator > > > +}; + +typedef struct __normal_iterator,_std::allocator_>_> iterator; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>, *Preverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> const_reverse_iterator; + +struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> { // Original name: reverse_iterator<__gnu_cxx::__normal_iterator, std::allocator > > > +}; + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/const_reference - /DWARF/stl_alloc.h/allocator/const_reference + +typedef struct allocator allocator_type; + +typedef struct allocator _Raw_bytes_alloc; + +typedef struct random_access_iterator_tag random_access_iterator_tag, *Prandom_access_iterator_tag; + +typedef struct random_access_iterator_tag _Tag; + +struct random_access_iterator_tag { + struct bidirectional_iterator_tag super_bidirectional_iterator_tag; +}; + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/const_iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/const_iterator + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/reference - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/reference + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/iterator + + +// WARNING! conflicting data type names: /DWARF/basic_string.h/basic_string,std::allocator_>/pointer - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/pointer + +typedef struct TWriteStream TWriteStream, *PTWriteStream; + +struct TWriteStream { + int (**_vptr.TWriteStream)(...); +}; + +typedef struct TDynamicWriteBuffer TDynamicWriteBuffer, *PTDynamicWriteBuffer; + +typedef struct TWriteBuffer TWriteBuffer, *PTWriteBuffer; + +struct TWriteBuffer { + struct TWriteStream super_TWriteStream; + uchar *Data; + int Size; + int Position; +}; + +struct TDynamicWriteBuffer { + struct TWriteBuffer super_TWriteBuffer; +}; + +typedef struct TReadBuffer TReadBuffer, *PTReadBuffer; + +typedef struct TReadStream TReadStream, *PTReadStream; + +struct TReadStream { + int (**_vptr.TReadStream)(...); +}; + +struct TReadBuffer { + struct TReadStream super_TReadStream; + uchar *Data; + int Size; + int Position; +}; + +typedef __gnuc_va_list va_list; + +typedef struct _IO_FILE.conflict FILE.conflict; + +typedef struct _IO_FILE __FILE; + +typedef struct _G_fpos64_t _G_fpos64_t, *P_G_fpos64_t; + +typedef struct _G_fpos64_t fpos64_t; + +struct _G_fpos64_t { + __off64_t __pos; + struct __mbstate_t __state; +}; + +typedef struct _G_fpos_t _G_fpos_t, *P_G_fpos_t; + +typedef struct _G_fpos_t fpos_t; + +struct _G_fpos_t { + __off_t __pos; + struct __mbstate_t __state; +}; + +typedef struct _IO_FILE.conflict __FILE.conflict; + +typedef enum TALK_MODE { + TALK_SAY=1, + TALK_WHISPER=2, + TALK_YELL=3, + TALK_PRIVATE_MESSAGE=4, + TALK_CHANNEL_CALL=5, + TALK_GAMEMASTER_REQUEST=6, + TALK_GAMEMASTER_ANSWER=7, + TALK_PLAYER_ANSWER=8, + TALK_GAMEMASTER_BROADCAST=9, + TALK_GAMEMASTER_CHANNELCALL=10, + TALK_GAMEMASTER_MESSAGE=11, + TALK_HIGHLIGHT_CHANNELCALL=12, + TALK_ANONYMOUS_BROADCAST=13, + TALK_ANONYMOUS_CHANNELCALL=14, + TALK_ANONYMOUS_MESSAGE=15, + TALK_ANIMAL_LOW=16, + TALK_ANIMAL_LOUD=17, + TALK_ADMIN_MESSAGE=18, + TALK_EVENT_MESSAGE=19, + TALK_LOGIN_MESSAGE=20, + TALK_STATUS_MESSAGE=21, + TALK_INFO_MESSAGE=22, + TALK_FAILURE_MESSAGE=23 +} TALK_MODE; + +typedef enum CHANNEL { + GUILD_CHANNEL=0, + GAMEMASTER_CHANNEL=1, + TUTOR_CHANNEL=2, + REQUEST_QUEUE=3, + GAME_CHANNEL=4, + TRADE_CHANNEL=5, + REALLIFE_CHANNEL=6, + HELP_CHANNEL=7 +} CHANNEL; + +typedef struct iterator iterator, *Piterator; + +struct iterator { // Original name: iterator +}; + +typedef struct iterator_traits iterator_traits, *Piterator_traits; + +struct iterator_traits { // Original name: iterator_traits +}; + +typedef struct iterator iterator, *Piterator; + +struct iterator { // Original name: iterator +}; + +typedef struct iterator_traits iterator_traits, *Piterator_traits; + +struct iterator_traits { +}; + +typedef struct iterator iterator, *Piterator; + +struct iterator { +}; + +typedef struct iterator iterator, *Piterator; + +struct iterator { +}; + +typedef struct output_iterator_tag output_iterator_tag, *Poutput_iterator_tag; + +struct output_iterator_tag { +}; + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator_traits/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator_traits/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/difference_type - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/difference_type + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/reference - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/reference + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/difference_type - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/difference_type + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/value_type - /DWARF/value_type + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/pointer - /DWARF/stl_iterator.h/__normal_iterator,_std::allocator_>_>/pointer + + +// WARNING! conflicting data type names: /DWARF/stl_iterator_base_types.h/iterator/iterator_category - /DWARF/stl_tree.h/_Rb_tree_base_iterator/iterator_category + +typedef int (ThreadFunction)(void *); + +typedef struct stat64 stat64, *Pstat64; + +struct stat64 { + __dev_t st_dev; + uint __pad1; + __ino_t __st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + uint __pad2; + __off64_t st_size; + __blksize_t st_blksize; + __blkcnt64_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + __ino64_t st_ino; +}; + + +// WARNING! conflicting data type names: /DWARF/stat.h/stat - /stat.h/stat + +typedef struct exception exception, *Pexception; + +struct exception { +}; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>, *Preverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>; + +struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> { // Original name: reverse_iterator<__gnu_cxx::__normal_iterator, std::allocator > > > +}; + +typedef struct __si_class_type_info_pseudo __si_class_type_info_pseudo, *P__si_class_type_info_pseudo; + +struct __si_class_type_info_pseudo { + undefined field0_0x0; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + undefined field4_0x4; + undefined field5_0x5; + undefined field6_0x6; + undefined field7_0x7; + undefined field8_0x8; + undefined field9_0x9; + undefined field10_0xa; + undefined field11_0xb; +}; + +typedef struct basic_filebuf_> basic_filebuf_>, *Pbasic_filebuf_>; + +struct basic_filebuf_> { // Original name: basic_filebuf > +}; + +typedef struct __pointer_type_info_pseudo __pointer_type_info_pseudo, *P__pointer_type_info_pseudo; + +struct __pointer_type_info_pseudo { + undefined field0_0x0; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + undefined field4_0x4; + undefined field5_0x5; + undefined field6_0x6; + undefined field7_0x7; + undefined field8_0x8; + undefined field9_0x9; + undefined field10_0xa; + undefined field11_0xb; + undefined field12_0xc; + undefined field13_0xd; + undefined field14_0xe; + undefined field15_0xf; +}; + +typedef struct numpunct numpunct, *Pnumpunct; + +struct numpunct { +}; + +typedef struct __enum_type_info_pseudo __enum_type_info_pseudo, *P__enum_type_info_pseudo; + +struct __enum_type_info_pseudo { + undefined field0_0x0; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + undefined field4_0x4; + undefined field5_0x5; + undefined field6_0x6; + undefined field7_0x7; +}; + +typedef struct ctype ctype, *Pctype; + +struct ctype { +}; + +typedef struct codecvt codecvt, *Pcodecvt; + +struct codecvt { +}; + +typedef struct __class_type_info __class_type_info, *P__class_type_info; + +struct __class_type_info { +}; + +typedef struct bad_alloc bad_alloc, *Pbad_alloc; + +struct bad_alloc { +}; + +typedef struct __normal_iterator,_std::allocator_>_> __normal_iterator,_std::allocator_>_>, *P__normal_iterator,_std::allocator_>_>; + +struct __normal_iterator,_std::allocator_>_> { // Original name: __normal_iterator, std::allocator > > +}; + +typedef struct basic_filebuf_> basic_filebuf_>, *Pbasic_filebuf_>; + +struct basic_filebuf_> { // Original name: basic_filebuf > +}; + +typedef struct basic_ios_> basic_ios_>, *Pbasic_ios_>; + +struct basic_ios_> { // Original name: basic_ios > +}; + +typedef struct __enum_type_info __enum_type_info, *P__enum_type_info; + +struct __enum_type_info { +}; + +typedef struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>, *Preverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_>; + +struct reverse_iterator<__gnu_cxx::__normal_iterator,_std::allocator_>_>_> { // Original name: reverse_iterator<__gnu_cxx::__normal_iterator, std::allocator > > > +}; + +typedef struct basic_stringbuf,std::allocator_> basic_stringbuf,std::allocator_>, *Pbasic_stringbuf,std::allocator_>; + +struct basic_stringbuf,std::allocator_> { // Original name: basic_stringbuf,std::allocator > +}; + +typedef struct basic_ifstream_> basic_ifstream_>, *Pbasic_ifstream_>; + +struct basic_ifstream_> { // Original name: basic_ifstream > +}; + +typedef struct __class_type_info_pseudo __class_type_info_pseudo, *P__class_type_info_pseudo; + +struct __class_type_info_pseudo { + undefined field0_0x0; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + undefined field4_0x4; + undefined field5_0x5; + undefined field6_0x6; + undefined field7_0x7; +}; + +typedef struct basic_stringbuf,std::allocator_> basic_stringbuf,std::allocator_>, *Pbasic_stringbuf,std::allocator_>; + +struct basic_stringbuf,std::allocator_> { // Original name: basic_stringbuf,std::allocator > +}; + +typedef struct __normal_iterator,_std::allocator_>_> __normal_iterator,_std::allocator_>_>, *P__normal_iterator,_std::allocator_>_>; + +struct __normal_iterator,_std::allocator_>_> { // Original name: __normal_iterator, std::allocator > > +}; + +typedef struct basic_iostream_> basic_iostream_>, *Pbasic_iostream_>; + +struct basic_iostream_> { // Original name: basic_iostream > +}; + +typedef struct basic_ofstream_> basic_ofstream_>, *Pbasic_ofstream_>; + +struct basic_ofstream_> { // Original name: basic_ofstream > +}; + +typedef struct basic_ifstream_> basic_ifstream_>, *Pbasic_ifstream_>; + +struct basic_ifstream_> { // Original name: basic_ifstream > +}; + +typedef struct __si_class_type_info __si_class_type_info, *P__si_class_type_info; + +struct __si_class_type_info { +}; + +typedef struct basic_istringstream,std::allocator_> basic_istringstream,std::allocator_>, *Pbasic_istringstream,std::allocator_>; + +struct basic_istringstream,std::allocator_> { // Original name: basic_istringstream,std::allocator > +}; + +typedef struct __fundamental_type_info __fundamental_type_info, *P__fundamental_type_info; + +struct __fundamental_type_info { +}; + +typedef struct __vmi_class_type_info __vmi_class_type_info, *P__vmi_class_type_info; + +struct __vmi_class_type_info { +}; + +typedef struct basic_ofstream_> basic_ofstream_>, *Pbasic_ofstream_>; + +struct basic_ofstream_> { // Original name: basic_ofstream > +}; + +typedef struct _IO_FILE_plus _IO_FILE_plus, *P_IO_FILE_plus; + +struct _IO_FILE_plus { +}; + +typedef struct obstack obstack, *Pobstack; + +struct obstack { +}; + +typedef struct basic_istringstream,std::allocator_> basic_istringstream,std::allocator_>, *Pbasic_istringstream,std::allocator_>; + +struct basic_istringstream,std::allocator_> { // Original name: basic_istringstream,std::allocator > +}; + +typedef struct basic_iostream_> basic_iostream_>, *Pbasic_iostream_>; + +struct basic_iostream_> { // Original name: basic_iostream > +}; + +typedef struct basic_fstream_> basic_fstream_>, *Pbasic_fstream_>; + +struct basic_fstream_> { // Original name: basic_fstream > +}; + +typedef struct basic_ostringstream,std::allocator_> basic_ostringstream,std::allocator_>, *Pbasic_ostringstream,std::allocator_>; + +struct basic_ostringstream,std::allocator_> { // Original name: basic_ostringstream,std::allocator > +}; + +typedef struct basic_ostringstream,std::allocator_> basic_ostringstream,std::allocator_>, *Pbasic_ostringstream,std::allocator_>; + +struct basic_ostringstream,std::allocator_> { // Original name: basic_ostringstream,std::allocator > +}; + +typedef struct basic_stringstream,std::allocator_> basic_stringstream,std::allocator_>, *Pbasic_stringstream,std::allocator_>; + +struct basic_stringstream,std::allocator_> { // Original name: basic_stringstream,std::allocator > +}; + +typedef struct basic_fstream_> basic_fstream_>, *Pbasic_fstream_>; + +struct basic_fstream_> { // Original name: basic_fstream > +}; + +typedef struct num_put_>_> num_put_>_>, *Pnum_put_>_>; + +struct num_put_>_> { // Original name: num_put > > +}; + +typedef struct basic_stringstream,std::allocator_> basic_stringstream,std::allocator_>, *Pbasic_stringstream,std::allocator_>; + +struct basic_stringstream,std::allocator_> { // Original name: basic_stringstream,std::allocator > +}; + +typedef struct _IO_cookie_file _IO_cookie_file, *P_IO_cookie_file; + +struct _IO_cookie_file { +}; + +typedef struct basic_ios_> basic_ios_>, *Pbasic_ios_>; + +struct basic_ios_> { // Original name: basic_ios > +}; + +typedef struct num_get_>_> num_get_>_>, *Pnum_get_>_>; + +struct num_get_>_> { // Original name: num_get > > +}; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/__dirstream - /dirent.h/__dirstream + +typedef struct storeunit storeunit; + +typedef struct __sigset_t anon_unknown.dwarf_28aa3e; + +typedef struct __sigset_t anon_unknown.dwarf_2b7894; + +typedef struct __sigset_t anon_unknown.dwarf_2cbbea; + +typedef struct __sigset_t anon_unknown.dwarf_22fecb; + +typedef struct __sigset_t anon_unknown.dwarf_227ae; + +typedef struct __sigset_t anon_unknown.dwarf_14b701; + +typedef struct __sigset_t anon_unknown.dwarf_ec758; + +typedef struct __sigset_t anon_unknown.dwarf_102239; + +typedef struct __sigset_t anon_unknown.dwarf_273921; + +typedef struct __sigset_t anon_unknown.dwarf_1ac72b; + +typedef struct __sigset_t anon_unknown.dwarf_1ff902; + +typedef struct __sigset_t anon_unknown.dwarf_83c50; + +typedef struct __sigset_t anon_unknown.dwarf_16ba91; + +typedef struct __sigset_t anon_unknown.dwarf_12abd9; + +typedef struct __sigset_t anon_unknown.dwarf_5328a; + +typedef struct __sigset_t anon_unknown.dwarf_1e5d74; + +typedef struct __sigset_t anon_unknown.dwarf_c4c20; + +typedef struct __sigset_t anon_unknown.dwarf_42618; + +typedef struct __sigset_t anon_unknown.dwarf_25d7c6; + +typedef struct __sigset_t anon_unknown.dwarf_dd3e6; + +typedef struct __sigset_t anon_unknown.dwarf_a91d2; + +typedef struct __sigset_t anon_unknown.dwarf_191d22; + +typedef struct __sigset_t anon_unknown.dwarf_63a16; + +typedef struct __sigset_t anon_unknown.dwarf_96eae; + +typedef struct __sigset_t anon_unknown.dwarf_d465; + +typedef struct __sigset_t anon_unknown.dwarf_746ed; + +typedef struct __sigset_t anon_unknown.dwarf_2bea79; + +typedef struct __sigset_t anon_unknown.dwarf_243fa7; + +typedef struct __sigset_t anon_unknown.dwarf_216bda; + +typedef struct __sigset_t anon_unknown.dwarf_29d2f2; + +typedef struct __sigset_t anon_unknown.dwarf_113095; + +typedef struct __sigset_t anon_unknown.dwarf_1c8cbc; + +typedef struct __sigset_t anon_unknown.dwarf_3193b; + +typedef struct store store; + +typedef struct pthread_cond_t anon_unknown.dwarf_25f167; + +typedef struct pthread_cond_t anon_unknown.dwarf_2b7975; + +typedef struct pthread_cond_t anon_unknown.dwarf_23186c; + +typedef struct pthread_cond_t anon_unknown.dwarf_28c3df; + +typedef struct pthread_cond_t anon_unknown.dwarf_3554c; + +typedef struct pthread_cond_t anon_unknown.dwarf_29ec93; + +typedef struct pthread_cond_t anon_unknown.dwarf_46257; + +typedef struct pthread_cond_t anon_unknown.dwarf_21857b; + +typedef struct pthread_cond_t anon_unknown.dwarf_56a9e; + +typedef struct pthread_cond_t anon_unknown.dwarf_2bec56; + +typedef struct pthread_cond_t anon_unknown.dwarf_14d083; + +typedef struct pthread_cond_t anon_unknown.dwarf_9884f; + +typedef struct pthread_cond_t anon_unknown.dwarf_13e093; + +typedef struct pthread_cond_t anon_unknown.dwarf_1ae0cc; + +typedef struct pthread_cond_t anon_unknown.dwarf_1936c3; + +typedef struct pthread_cond_t anon_unknown.dwarf_245948; + +typedef struct pthread_cond_t anon_unknown.dwarf_ee06; + +typedef struct pthread_cond_t anon_unknown.dwarf_de7ac; + +typedef struct pthread_cond_t anon_unknown.dwarf_65398; + +typedef struct pthread_cond_t anon_unknown.dwarf_1e7715; + +typedef struct pthread_cond_t anon_unknown.dwarf_16d432; + +typedef struct pthread_cond_t anon_unknown.dwarf_24a47; + +typedef struct pthread_cond_t anon_unknown.dwarf_1ca65d; + +typedef struct pthread_cond_t anon_unknown.dwarf_114a36; + +typedef struct pthread_cond_t anon_unknown.dwarf_274ce7; + +typedef struct pthread_cond_t anon_unknown.dwarf_2ccfb0; + +typedef struct pthread_cond_t anon_unknown.dwarf_2012a3; + +typedef struct pthread_cond_t anon_unknown.dwarf_1041e9; + +typedef struct pthread_cond_t anon_unknown.dwarf_b79ac; + +typedef struct pthread_cond_t anon_unknown.dwarf_89dd6; + +typedef struct pthread_cond_t anon_unknown.dwarf_ee0f9; + +typedef struct pthread_cond_t anon_unknown.dwarf_c65a2; + +typedef struct pthread_cond_t anon_unknown.dwarf_768c5; + +typedef struct vector vector; + +typedef struct _Is_integer _Is_integer; + +typedef struct __type_traits __type_traits; + +typedef struct numeric_limits numeric_limits; + +typedef struct _G_fpos64_t anon_unknown.dwarf_19f1ca; + +typedef struct _G_fpos64_t anon_unknown.dwarf_1bb7e2; + +typedef struct _G_fpos64_t anon_unknown.dwarf_1d8867; + +typedef struct _G_fpos64_t anon_unknown.dwarf_f4d63; + +typedef struct _G_fpos64_t anon_unknown.dwarf_9be4f; + +typedef struct _G_fpos64_t anon_unknown.dwarf_27d309; + +typedef struct _G_fpos64_t anon_unknown.dwarf_df555; + +typedef struct _G_fpos64_t anon_unknown.dwarf_b7602; + +typedef struct _G_fpos64_t anon_unknown.dwarf_209878; + +typedef struct _G_fpos64_t anon_unknown.dwarf_351c9; + +typedef struct _G_fpos64_t anon_unknown.dwarf_13dd1b; + +typedef struct _G_fpos64_t anon_unknown.dwarf_6717d; + +typedef struct _G_fpos64_t anon_unknown.dwarf_cff8b; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2ac1ee; + +typedef struct _G_fpos64_t anon_unknown.dwarf_236b3c; + +typedef struct _G_fpos64_t anon_unknown.dwarf_45ead; + +typedef struct _G_fpos64_t anon_unknown.dwarf_566f4; + +typedef struct _G_fpos64_t anon_unknown.dwarf_89a2c; + +typedef struct _G_fpos64_t anon_unknown.dwarf_28feeb; + +typedef struct _G_fpos64_t anon_unknown.dwarf_105de0; + +typedef struct _G_fpos64_t anon_unknown.dwarf_76526; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2cd994; + +typedef struct _G_fpos64_t anon_unknown.dwarf_184832; + +typedef struct _G_fpos64_t anon_unknown.dwarf_152a6; + +typedef struct _G_fpos64_t anon_unknown.dwarf_1f25a7; + +typedef struct _G_fpos64_t anon_unknown.dwarf_222855; + +typedef struct _G_fpos64_t anon_unknown.dwarf_15e493; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2469d; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2b753a; + +typedef struct _G_fpos64_t anon_unknown.dwarf_11d900; + +typedef struct _G_fpos64_t anon_unknown.dwarf_250490; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2bf1b8; + +typedef struct _G_fpos64_t anon_unknown.dwarf_2665b0; + +typedef struct listnode_> listnode; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/iterator/iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/iterator + +typedef struct pthread_barrier_t anon_unknown.dwarf_2befa5; + +typedef struct pthread_barrier_t anon_unknown.dwarf_d04fb; + +typedef struct pthread_barrier_t anon_unknown.dwarf_13e32f; + +typedef struct pthread_barrier_t anon_unknown.dwarf_67703; + +typedef struct pthread_barrier_t anon_unknown.dwarf_56d3a; + +typedef struct pthread_barrier_t anon_unknown.dwarf_106350; + +typedef struct pthread_barrier_t anon_unknown.dwarf_464f3; + +typedef struct pthread_barrier_t anon_unknown.dwarf_1bbd52; + +typedef struct pthread_barrier_t anon_unknown.dwarf_27d86e; + +typedef struct pthread_barrier_t anon_unknown.dwarf_76b61; + +typedef struct pthread_barrier_t anon_unknown.dwarf_15816; + +typedef struct pthread_barrier_t anon_unknown.dwarf_8a072; + +typedef struct pthread_barrier_t anon_unknown.dwarf_f52b7; + +typedef struct pthread_barrier_t anon_unknown.dwarf_2b7c11; + +typedef struct pthread_barrier_t anon_unknown.dwarf_19f73a; + +typedef struct pthread_barrier_t anon_unknown.dwarf_2509e4; + +typedef struct pthread_barrier_t anon_unknown.dwarf_2cdf18; + +typedef struct pthread_barrier_t anon_unknown.dwarf_9c3bf; + +typedef struct pthread_barrier_t anon_unknown.dwarf_dfac1; + +typedef struct pthread_barrier_t anon_unknown.dwarf_1d8dd7; + +typedef struct pthread_barrier_t anon_unknown.dwarf_2ac75e; + +typedef struct pthread_barrier_t anon_unknown.dwarf_357e8; + +typedef struct pthread_barrier_t anon_unknown.dwarf_209de8; + +typedef struct pthread_barrier_t anon_unknown.dwarf_222dc5; + +typedef struct pthread_barrier_t anon_unknown.dwarf_266b20; + +typedef struct pthread_barrier_t anon_unknown.dwarf_2370ac; + +typedef struct pthread_barrier_t anon_unknown.dwarf_b7c48; + +typedef struct pthread_barrier_t anon_unknown.dwarf_24ce3; + +typedef struct pthread_barrier_t anon_unknown.dwarf_184d86; + +typedef struct pthread_barrier_t anon_unknown.dwarf_29045b; + +typedef struct pthread_barrier_t anon_unknown.dwarf_15e9e7; + +typedef struct pthread_barrier_t anon_unknown.dwarf_1f2b17; + +typedef struct pthread_barrier_t anon_unknown.dwarf_11de70; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef union _G_iconv_t anon_unknown.dwarf_e0f98; + +typedef union _G_iconv_t anon_unknown.dwarf_1a0f6b; + +typedef union _G_iconv_t anon_unknown.dwarf_27f27e; + +typedef union _G_iconv_t anon_unknown.dwarf_268161; + +typedef union _G_iconv_t anon_unknown.dwarf_36e58; + +typedef union _G_iconv_t anon_unknown.dwarf_8b6ee; + +typedef union _G_iconv_t anon_unknown.dwarf_b9460; + +typedef union _G_iconv_t anon_unknown.dwarf_11f419; + +typedef union _G_iconv_t anon_unknown.dwarf_16fee; + +typedef union _G_iconv_t anon_unknown.dwarf_2ae166; + +typedef union _G_iconv_t anon_unknown.dwarf_180f; + +typedef union _G_iconv_t anon_unknown.dwarf_f6a79; + +typedef union _G_iconv_t anon_unknown.dwarf_22470b; + +typedef union _G_iconv_t anon_unknown.dwarf_1f4142; + +typedef union _G_iconv_t anon_unknown.dwarf_1078d5; + +typedef union _G_iconv_t anon_unknown.dwarf_2617b; + +typedef union _G_iconv_t anon_unknown.dwarf_47aca; + +typedef union _G_iconv_t anon_unknown.dwarf_d1c26; + +typedef union _G_iconv_t anon_unknown.dwarf_291b32; + +typedef union _G_iconv_t anon_unknown.dwarf_7801b; + +typedef union _G_iconv_t anon_unknown.dwarf_68f2d; + +typedef union _G_iconv_t anon_unknown.dwarf_252006; + +typedef union _G_iconv_t anon_unknown.dwarf_9da12; + +typedef union _G_iconv_t anon_unknown.dwarf_1bd4fc; + +typedef union _G_iconv_t anon_unknown.dwarf_2c042a; + +typedef union _G_iconv_t anon_unknown.dwarf_1602d1; + +typedef union _G_iconv_t anon_unknown.dwarf_1da5b4; + +typedef union _G_iconv_t anon_unknown.dwarf_2bf317; + +typedef union _G_iconv_t anon_unknown.dwarf_20b41a; + +typedef union _G_iconv_t anon_unknown.dwarf_13fa2f; + +typedef union _G_iconv_t anon_unknown.dwarf_2387e7; + +typedef union _G_iconv_t anon_unknown.dwarf_186562; + +typedef union _G_iconv_t anon_unknown.dwarf_58256; + +typedef struct list_> list; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct listIterator_> listIterator; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listnode_>/listnode - /DWARF/_UNCATEGORIZED_/listnode_>/listnode + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeunit/storeunit - /DWARF/_UNCATEGORIZED_/storeunit/storeunit + +typedef struct matrix matrix; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/list/list - /DWARF/_UNCATEGORIZED_/list_>/list + +typedef struct istreambuf_iterator_> istreambuf_iterator_>, *Pistreambuf_iterator_>; + +typedef struct istreambuf_iterator_> istreambuf_iterator; + +struct istreambuf_iterator_> { // Original name: istreambuf_iterator > +Missing member super_iterator : iterator at offset 0x0 [conflicting member at same offset] + struct basic_streambuf_> *_M_sbuf; + int _M_c; +}; + +typedef struct _G_fpos_t anon_unknown.dwarf_34a70; + +typedef struct _G_fpos_t anon_unknown.dwarf_265e0e; + +typedef struct _G_fpos_t anon_unknown.dwarf_1f1e05; + +typedef struct _G_fpos_t anon_unknown.dwarf_23f35; + +typedef struct _G_fpos_t anon_unknown.dwarf_9b6ad; + +typedef struct _G_fpos_t anon_unknown.dwarf_b6e6a; + +typedef struct _G_fpos_t anon_unknown.dwarf_11d15e; + +typedef struct _G_fpos_t anon_unknown.dwarf_1840a2; + +typedef struct _G_fpos_t anon_unknown.dwarf_55f63; + +typedef struct _G_fpos_t anon_unknown.dwarf_1d80cf; + +typedef struct _G_fpos_t anon_unknown.dwarf_2b6f0e; + +typedef struct _G_fpos_t anon_unknown.dwarf_75d97; + +typedef struct _G_fpos_t anon_unknown.dwarf_2aba62; + +typedef struct _G_fpos_t anon_unknown.dwarf_f45c1; + +typedef struct _G_fpos_t anon_unknown.dwarf_891ec; + +typedef struct _G_fpos_t anon_unknown.dwarf_10563e; + +typedef struct _G_fpos_t anon_unknown.dwarf_669ff; + +typedef struct _G_fpos_t anon_unknown.dwarf_27cb7d; + +typedef struct _G_fpos_t anon_unknown.dwarf_2090d6; + +typedef struct _G_fpos_t anon_unknown.dwarf_deded; + +typedef struct _G_fpos_t anon_unknown.dwarf_1bb040; + +typedef struct _G_fpos_t anon_unknown.dwarf_2bf124; + +typedef struct _G_fpos_t anon_unknown.dwarf_2cd25f; + +typedef struct _G_fpos_t anon_unknown.dwarf_15dc6b; + +typedef struct _G_fpos_t anon_unknown.dwarf_2363b0; + +typedef struct _G_fpos_t anon_unknown.dwarf_19ea32; + +typedef struct _G_fpos_t anon_unknown.dwarf_14a78; + +typedef struct _G_fpos_t anon_unknown.dwarf_24fcee; + +typedef struct _G_fpos_t anon_unknown.dwarf_13d571; + +typedef struct _G_fpos_t anon_unknown.dwarf_45703; + +typedef struct _G_fpos_t anon_unknown.dwarf_cf7e9; + +typedef struct _G_fpos_t anon_unknown.dwarf_2220b3; + +typedef struct _G_fpos_t anon_unknown.dwarf_28f749; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listIterator/listIterator - /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/matrix/matrix - /DWARF/_UNCATEGORIZED_/matrix/matrix + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator - /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct __default_alloc_template __default_alloc_template; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1221c7; + +typedef struct pthread_mutex_t anon_unknown.dwarf_e3d46; + +typedef struct pthread_mutex_t anon_unknown.dwarf_2b0b7b; + +typedef struct pthread_mutex_t anon_unknown.dwarf_39c06; + +typedef struct pthread_mutex_t anon_unknown.dwarf_6bcdb; + +typedef struct pthread_mutex_t anon_unknown.dwarf_10a683; + +typedef struct pthread_mutex_t anon_unknown.dwarf_23b595; + +typedef struct pthread_mutex_t anon_unknown.dwarf_7adc9; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1c02aa; + +typedef struct pthread_mutex_t anon_unknown.dwarf_26af0f; + +typedef struct pthread_mutex_t anon_unknown.dwarf_bc20e; + +typedef struct pthread_mutex_t anon_unknown.dwarf_2c31d8; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1f6ef0; + +typedef struct pthread_mutex_t anon_unknown.dwarf_20e1c8; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1dd362; + +typedef struct pthread_mutex_t anon_unknown.dwarf_d49d4; + +typedef struct pthread_mutex_t anon_unknown.dwarf_28202c; + +typedef struct pthread_mutex_t anon_unknown.dwarf_f9827; + +typedef struct pthread_mutex_t anon_unknown.dwarf_16307f; + +typedef struct pthread_mutex_t anon_unknown.dwarf_28f29; + +typedef struct pthread_mutex_t anon_unknown.dwarf_2948e0; + +typedef struct pthread_mutex_t anon_unknown.dwarf_45bd; + +typedef struct pthread_mutex_t anon_unknown.dwarf_254db4; + +typedef struct pthread_mutex_t anon_unknown.dwarf_8e49c; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1a3d19; + +typedef struct pthread_mutex_t anon_unknown.dwarf_5b004; + +typedef struct pthread_mutex_t anon_unknown.dwarf_2274b9; + +typedef struct pthread_mutex_t anon_unknown.dwarf_2bedb5; + +typedef struct pthread_mutex_t anon_unknown.dwarf_a07c0; + +typedef struct pthread_mutex_t anon_unknown.dwarf_4a878; + +typedef struct pthread_mutex_t anon_unknown.dwarf_189310; + +typedef struct pthread_mutex_t anon_unknown.dwarf_1427dd; + +typedef struct pthread_mutex_t anon_unknown.dwarf_19d9c; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_89f08; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_27d704; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2ac5f4; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_769f7; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_9c255; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_3567e; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2902f1; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_156ac; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_46389; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_1d8c6d; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2bee3b; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_222c5b; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_236f42; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_df957; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_24b79; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2cddae; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2b7aa7; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_13e1c5; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_11dd06; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_1061e6; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_15e87d; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_1f29ad; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_56bd0; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_25087a; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_b7ade; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_f514d; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_209c7e; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_67599; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_19f5d0; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_2669b6; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_d0391; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_184c1c; + +typedef struct pthread_mutexattr_t anon_unknown.dwarf_1bbbe8; + +typedef struct basic_string,std::allocator_> basic_string; + +typedef union storeitem storeitem; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator - /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator + +typedef struct priority_queue_entry priority_queue_entry; + +typedef struct char_traits char_traits; + +typedef struct ldiv_t ldiv_t, *Pldiv_t; + +typedef struct ldiv_t anon_unknown.dwarf_1bbf42; + +struct ldiv_t { + long quot; + long rem; +}; + +typedef struct ldiv_t anon_unknown.dwarf_56f2a; + +typedef struct ldiv_t anon_unknown.dwarf_27da79; + +typedef struct ldiv_t anon_unknown.dwarf_24ed3; + +typedef struct ldiv_t anon_unknown.dwarf_23729c; + +typedef struct ldiv_t anon_unknown.dwarf_76d51; + +typedef struct ldiv_t anon_unknown.dwarf_184f76; + +typedef struct ldiv_t anon_unknown.dwarf_29064b; + +typedef struct ldiv_t anon_unknown.dwarf_250bd4; + +typedef struct ldiv_t anon_unknown.dwarf_2ce108; + +typedef struct ldiv_t anon_unknown.dwarf_f54a7; + +typedef struct ldiv_t anon_unknown.dwarf_19f92a; + +typedef struct ldiv_t anon_unknown.dwarf_2be4f8; + +typedef struct ldiv_t anon_unknown.dwarf_15a21; + +typedef struct ldiv_t anon_unknown.dwarf_d06eb; + +typedef struct ldiv_t anon_unknown.dwarf_1d8fc7; + +typedef struct ldiv_t anon_unknown.dwarf_13e51f; + +typedef struct ldiv_t anon_unknown.dwarf_11e060; + +typedef struct ldiv_t anon_unknown.dwarf_359d8; + +typedef struct ldiv_t anon_unknown.dwarf_dfca6; + +typedef struct ldiv_t anon_unknown.dwarf_222fb5; + +typedef struct ldiv_t anon_unknown.dwarf_2b7de0; + +typedef struct ldiv_t anon_unknown.dwarf_106540; + +typedef struct ldiv_t anon_unknown.dwarf_678f3; + +typedef struct ldiv_t anon_unknown.dwarf_15ebd7; + +typedef struct ldiv_t anon_unknown.dwarf_8a262; + +typedef struct ldiv_t anon_unknown.dwarf_2ac94e; + +typedef struct ldiv_t anon_unknown.dwarf_1f2d07; + +typedef struct ldiv_t anon_unknown.dwarf_9c5af; + +typedef struct ldiv_t anon_unknown.dwarf_209fd8; + +typedef struct ldiv_t anon_unknown.dwarf_466e3; + +typedef struct ldiv_t anon_unknown.dwarf_b7e38; + +typedef struct ldiv_t anon_unknown.dwarf_266d10; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/iterator/iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/iterator + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listnode_>/listnode - /DWARF/_UNCATEGORIZED_/listnode_>/listnode + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/iterator/iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/iterator + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_154d0; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_13df34; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_209aa2; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2667da; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_248c7; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_184a4b; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2506a9; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_b782c; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_76750; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2b7764; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_673a7; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2bf4ed; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_19f3f4; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_5691e; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_1f27d1; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_290115; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_1d8a91; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_df770; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_353e2; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_10600a; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_11db2a; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2ac418; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_460d7; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_9c079; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_f4f7c; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_15e6ac; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_2cdbbe; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_1bba0c; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_222a7f; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_d01b5; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_236d66; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_27d533; + +typedef struct _IO_cookie_io_functions_t anon_unknown.dwarf_89c56; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/iterator/iterator - /DWARF/basic_string.h/basic_string,std::allocator_>/iterator + +typedef struct allocator allocator; + +typedef struct __basic_file __basic_file; + +typedef struct fifoIterator fifoIterator; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/fifoIterator/fifoIterator - /DWARF/_UNCATEGORIZED_/fifoIterator/fifoIterator + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector_>/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct fd_set anon_unknown.dwarf_b80c8; + +typedef struct fd_set anon_unknown.dwarf_46973; + +typedef struct fd_set anon_unknown.dwarf_2acbc8; + +typedef struct fd_set anon_unknown.dwarf_11e2f0; + +typedef struct fd_set anon_unknown.dwarf_2908db; + +typedef struct fd_set anon_unknown.dwarf_237516; + +typedef struct fd_set anon_unknown.dwarf_f5737; + +typedef struct fd_set anon_unknown.dwarf_266fa0; + +typedef struct fd_set anon_unknown.dwarf_2beb25; + +typedef struct fd_set anon_unknown.dwarf_67b83; + +typedef struct fd_set anon_unknown.dwarf_2ce398; + +typedef struct fd_set anon_unknown.dwarf_9c83f; + +typedef struct fd_set anon_unknown.dwarf_dff36; + +typedef struct fd_set anon_unknown.dwarf_250e64; + +typedef struct fd_set anon_unknown.dwarf_1bc1d2; + +typedef struct fd_set anon_unknown.dwarf_35c68; + +typedef struct fd_set anon_unknown.dwarf_1d9257; + +typedef struct fd_set anon_unknown.dwarf_1067d0; + +typedef struct fd_set anon_unknown.dwarf_19fbba; + +typedef struct fd_set anon_unknown.dwarf_223245; + +typedef struct fd_set anon_unknown.dwarf_27dcf3; + +typedef struct fd_set anon_unknown.dwarf_20a268; + +typedef struct fd_set anon_unknown.dwarf_13e7af; + +typedef struct fd_set anon_unknown.dwarf_185206; + +typedef struct fd_set anon_unknown.dwarf_76fe1; + +typedef struct fd_set anon_unknown.dwarf_8a4f2; + +typedef struct fd_set anon_unknown.dwarf_25163; + +typedef struct fd_set anon_unknown.dwarf_15cb1; + +typedef struct fd_set anon_unknown.dwarf_d097b; + +typedef struct fd_set anon_unknown.dwarf_1f2f97; + +typedef struct fd_set anon_unknown.dwarf_15ee67; + +typedef struct fd_set anon_unknown.dwarf_2b8086; + +typedef struct fd_set anon_unknown.dwarf_571ba; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeunit/storeunit - /DWARF/_UNCATEGORIZED_/storeunit/storeunit + +typedef struct priority_queue priority_queue; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeitem/storeitem - /DWARF/_UNCATEGORIZED_/storeitem/storeitem + +typedef struct iterator_traits iterator_traits; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct __fsid_t anon_unknown.dwarf_9bc8b; + +typedef struct __fsid_t anon_unknown.dwarf_105c1c; + +typedef struct __fsid_t anon_unknown.dwarf_19f018; + +typedef struct __fsid_t anon_unknown.dwarf_2cd7d1; + +typedef struct __fsid_t anon_unknown.dwarf_2be71d; + +typedef struct __fsid_t anon_unknown.dwarf_45ce9; + +typedef struct __fsid_t anon_unknown.dwarf_df392; + +typedef struct __fsid_t anon_unknown.dwarf_2ac035; + +typedef struct __fsid_t anon_unknown.dwarf_1f23e3; + +typedef struct __fsid_t anon_unknown.dwarf_cfdc7; + +typedef struct __fsid_t anon_unknown.dwarf_15e2cf; + +typedef struct __fsid_t anon_unknown.dwarf_1bb61e; + +typedef struct __fsid_t anon_unknown.dwarf_89868; + +typedef struct __fsid_t anon_unknown.dwarf_3503d; + +typedef struct __fsid_t anon_unknown.dwarf_2502cc; + +typedef struct __fsid_t anon_unknown.dwarf_184680; + +typedef struct __fsid_t anon_unknown.dwarf_b7450; + +typedef struct __fsid_t anon_unknown.dwarf_f4b9f; + +typedef struct __fsid_t anon_unknown.dwarf_236983; + +typedef struct __fsid_t anon_unknown.dwarf_27d150; + +typedef struct __fsid_t anon_unknown.dwarf_76363; + +typedef struct __fsid_t anon_unknown.dwarf_2b7372; + +typedef struct __fsid_t anon_unknown.dwarf_56530; + +typedef struct __fsid_t anon_unknown.dwarf_244da; + +typedef struct __fsid_t anon_unknown.dwarf_66fba; + +typedef struct __fsid_t anon_unknown.dwarf_13db57; + +typedef struct __fsid_t anon_unknown.dwarf_2096b4; + +typedef struct __fsid_t anon_unknown.dwarf_28fd27; + +typedef struct __fsid_t anon_unknown.dwarf_1d86b5; + +typedef struct __fsid_t anon_unknown.dwarf_11d73c; + +typedef struct __fsid_t anon_unknown.dwarf_2663ec; + +typedef struct __fsid_t anon_unknown.dwarf_150e2; + +typedef struct __fsid_t anon_unknown.dwarf_222691; + +typedef struct __pad_> __pad_>, *P__pad_>; + +typedef struct __pad_> __pad; + +struct __pad_> { // Original name: __pad > +}; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/matrix/matrix - /DWARF/_UNCATEGORIZED_/matrix/matrix + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listnode_>/listnode - /DWARF/_UNCATEGORIZED_/listnode_>/listnode + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/priority_queue_entry/priority_queue_entry - /DWARF/_UNCATEGORIZED_/priority_queue_entry/priority_queue_entry + +typedef struct mcontext_t anon_unknown.dwarf_16c4b4; + +typedef struct mcontext_t anon_unknown.dwarf_113ab8; + +typedef struct mcontext_t anon_unknown.dwarf_192745; + +typedef struct mcontext_t anon_unknown.dwarf_231d1; + +typedef struct mcontext_t anon_unknown.dwarf_a9bf5; + +typedef struct mcontext_t anon_unknown.dwarf_3235e; + +typedef struct mcontext_t anon_unknown.dwarf_64439; + +typedef struct mcontext_t anon_unknown.dwarf_1c96df; + +typedef struct mcontext_t anon_unknown.dwarf_29dd15; + +typedef struct mcontext_t anon_unknown.dwarf_2175fd; + +typedef struct mcontext_t anon_unknown.dwarf_102c5c; + +typedef struct mcontext_t anon_unknown.dwarf_274344; + +typedef struct mcontext_t anon_unknown.dwarf_75110; + +typedef struct mcontext_t anon_unknown.dwarf_2449ca; + +typedef struct mcontext_t anon_unknown.dwarf_2cc60d; + +typedef struct mcontext_t anon_unknown.dwarf_12b5fc; + +typedef struct mcontext_t anon_unknown.dwarf_2308ee; + +typedef struct mcontext_t anon_unknown.dwarf_ed17b; + +typedef struct mcontext_t anon_unknown.dwarf_25e1e9; + +typedef struct mcontext_t anon_unknown.dwarf_53cad; + +typedef struct mcontext_t anon_unknown.dwarf_200325; + +typedef struct mcontext_t anon_unknown.dwarf_de88; + +typedef struct mcontext_t anon_unknown.dwarf_c5643; + +typedef struct mcontext_t anon_unknown.dwarf_28b461; + +typedef struct mcontext_t anon_unknown.dwarf_84673; + +typedef struct mcontext_t anon_unknown.dwarf_978d1; + +typedef struct mcontext_t anon_unknown.dwarf_dde09; + +typedef struct mcontext_t anon_unknown.dwarf_4303b; + +typedef struct mcontext_t anon_unknown.dwarf_14c124; + +typedef struct mcontext_t anon_unknown.dwarf_1ad14e; + +typedef struct mcontext_t anon_unknown.dwarf_1e6797; + +typedef struct failure failure, *Pfailure; + +struct failure { +}; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeunit/storeunit - /DWARF/_UNCATEGORIZED_/storeunit/storeunit + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct pthread_condattr_t anon_unknown.dwarf_2b7a0b; + +typedef struct pthread_condattr_t anon_unknown.dwarf_f50b1; + +typedef struct pthread_condattr_t anon_unknown.dwarf_19f534; + +typedef struct pthread_condattr_t anon_unknown.dwarf_10614a; + +typedef struct pthread_condattr_t anon_unknown.dwarf_462ed; + +typedef struct pthread_condattr_t anon_unknown.dwarf_27d668; + +typedef struct pthread_condattr_t anon_unknown.dwarf_df8bb; + +typedef struct pthread_condattr_t anon_unknown.dwarf_2ac558; + +typedef struct pthread_condattr_t anon_unknown.dwarf_2becec; + +typedef struct pthread_condattr_t anon_unknown.dwarf_56b34; + +typedef struct pthread_condattr_t anon_unknown.dwarf_89e6c; + +typedef struct pthread_condattr_t anon_unknown.dwarf_674fd; + +typedef struct pthread_condattr_t anon_unknown.dwarf_1bbb4c; + +typedef struct pthread_condattr_t anon_unknown.dwarf_1d8bd1; + +typedef struct pthread_condattr_t anon_unknown.dwarf_26691a; + +typedef struct pthread_condattr_t anon_unknown.dwarf_d02f5; + +typedef struct pthread_condattr_t anon_unknown.dwarf_13e129; + +typedef struct pthread_condattr_t anon_unknown.dwarf_290255; + +typedef struct pthread_condattr_t anon_unknown.dwarf_236ea6; + +typedef struct pthread_condattr_t anon_unknown.dwarf_355e2; + +typedef struct pthread_condattr_t anon_unknown.dwarf_209be2; + +typedef struct pthread_condattr_t anon_unknown.dwarf_2cdd12; + +typedef struct pthread_condattr_t anon_unknown.dwarf_24add; + +typedef struct pthread_condattr_t anon_unknown.dwarf_7695b; + +typedef struct pthread_condattr_t anon_unknown.dwarf_15610; + +typedef struct pthread_condattr_t anon_unknown.dwarf_2507de; + +typedef struct pthread_condattr_t anon_unknown.dwarf_1f2911; + +typedef struct pthread_condattr_t anon_unknown.dwarf_184b80; + +typedef struct pthread_condattr_t anon_unknown.dwarf_222bbf; + +typedef struct pthread_condattr_t anon_unknown.dwarf_b7a42; + +typedef struct pthread_condattr_t anon_unknown.dwarf_11dc6a; + +typedef struct pthread_condattr_t anon_unknown.dwarf_9c1b9; + +typedef struct pthread_condattr_t anon_unknown.dwarf_15e7e1; + +typedef struct fifo fifo; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/store/store - /DWARF/_UNCATEGORIZED_/store/store + +typedef struct fpos<__mbstate_t> fpos; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct __normal_iterator,_std::allocator_>_> __normal_iterator; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector_>/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct __mbstate_t anon_unknown.dwarf_1698a; + +typedef struct __mbstate_t anon_unknown.dwarf_f6415; + +typedef struct __mbstate_t anon_unknown.dwarf_25b17; + +typedef struct __mbstate_t anon_unknown.dwarf_9d3ae; + +typedef struct __mbstate_t anon_unknown.dwarf_47466; + +typedef struct __mbstate_t anon_unknown.dwarf_185efe; + +typedef struct __mbstate_t anon_unknown.dwarf_11ab; + +typedef struct __mbstate_t anon_unknown.dwarf_15fc6d; + +typedef struct __mbstate_t anon_unknown.dwarf_2adaec; + +typedef struct __mbstate_t anon_unknown.dwarf_8b08a; + +typedef struct __mbstate_t anon_unknown.dwarf_2240a7; + +typedef struct __mbstate_t anon_unknown.dwarf_13f3cb; + +typedef struct __mbstate_t anon_unknown.dwarf_107271; + +typedef struct __mbstate_t anon_unknown.dwarf_267afd; + +typedef struct __mbstate_t anon_unknown.dwarf_57bf2; + +typedef struct __mbstate_t anon_unknown.dwarf_1bce98; + +typedef struct __mbstate_t anon_unknown.dwarf_b8dfc; + +typedef struct __mbstate_t anon_unknown.dwarf_367f4; + +typedef struct __mbstate_t anon_unknown.dwarf_688c9; + +typedef struct __mbstate_t anon_unknown.dwarf_20adb6; + +typedef struct __mbstate_t anon_unknown.dwarf_2b9d7a; + +typedef struct __mbstate_t anon_unknown.dwarf_11edb5; + +typedef struct __mbstate_t anon_unknown.dwarf_e0934; + +typedef struct __mbstate_t anon_unknown.dwarf_1d9f50; + +typedef struct __mbstate_t anon_unknown.dwarf_2914ce; + +typedef struct __mbstate_t anon_unknown.dwarf_2bfdc6; + +typedef struct __mbstate_t anon_unknown.dwarf_1f3ade; + +typedef struct __mbstate_t anon_unknown.dwarf_d15c2; + +typedef struct __mbstate_t anon_unknown.dwarf_1a0907; + +typedef struct __mbstate_t anon_unknown.dwarf_238183; + +typedef struct __mbstate_t anon_unknown.dwarf_2519a2; + +typedef struct __mbstate_t anon_unknown.dwarf_27ec1a; + +typedef struct __mbstate_t anon_unknown.dwarf_779b7; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_1589c; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_209e6e; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_1d8e5d; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_67789; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_222e4b; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_3586e; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_d0581; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_184e0c; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_266ba6; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_2b7c97; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_2ac7e4; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_1f2b9d; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_15ea6d; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_11def6; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_46579; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_250a6a; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_b7cce; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_27d8f4; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_9c445; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_24d69; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_2904e1; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_1063d6; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_1bbdd8; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_19f7c0; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_76be7; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_8a0f8; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_2bf02b; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_13e3b5; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_f533d; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_56dc0; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_2cdf9e; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_237132; + +typedef struct pthread_barrierattr_t anon_unknown.dwarf_dfb47; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/list_>/list - /DWARF/_UNCATEGORIZED_/list_>/list + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_2cde58; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_9c2ff; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_2ac69e; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_1d8d17; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_24c23; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_184cc6; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_76aa1; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_35728; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_b7b88; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_29039b; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_266a60; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_222d05; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_27d7ae; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_89fb2; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_1f2a57; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_d043b; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_dfa01; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_13e26f; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_2beee5; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_f51f7; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_46433; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_67643; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_236fec; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_106290; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_1bbc92; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_56c7a; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_15e927; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_209d28; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_15756; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_250924; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_2b7b51; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_19f67a; + +typedef struct pthread_rwlockattr_t anon_unknown.dwarf_11ddb0; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator - /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/list/list - /DWARF/_UNCATEGORIZED_/list_>/list + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/basic_string,std::allocator_>/basic_string - /DWARF/_UNCATEGORIZED_/basic_string,std::allocator_>/basic_string + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listnode/listnode - /DWARF/_UNCATEGORIZED_/listnode_>/listnode + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/store/store - /DWARF/_UNCATEGORIZED_/store/store + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/list_>/list - /DWARF/_UNCATEGORIZED_/list_>/list + +typedef struct _Swap_lock_struct<0> _Swap_lock_struct<0>, *P_Swap_lock_struct<0>; + +typedef struct _Swap_lock_struct<0> _Swap_lock_struct; + +struct _Swap_lock_struct<0> { +}; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeitem/storeitem - /DWARF/_UNCATEGORIZED_/storeitem/storeitem + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/priority_queue/priority_queue - /DWARF/_UNCATEGORIZED_/priority_queue/priority_queue + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/list_>/list - /DWARF/_UNCATEGORIZED_/list_>/list + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/fifo/fifo - /DWARF/_UNCATEGORIZED_/fifo/fifo + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listnode/listnode - /DWARF/_UNCATEGORIZED_/listnode_>/listnode + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/storeitem/storeitem - /DWARF/_UNCATEGORIZED_/storeitem/storeitem + +typedef struct lldiv_t lldiv_t, *Plldiv_t; + +typedef struct lldiv_t anon_unknown.dwarf_18500a; + +struct lldiv_t { + longlong quot; + longlong rem; +}; + +typedef struct lldiv_t anon_unknown.dwarf_67987; + +typedef struct lldiv_t anon_unknown.dwarf_11e0f4; + +typedef struct lldiv_t anon_unknown.dwarf_2906df; + +typedef struct lldiv_t anon_unknown.dwarf_266da4; + +typedef struct lldiv_t anon_unknown.dwarf_2ac9e2; + +typedef struct lldiv_t anon_unknown.dwarf_1f2d9b; + +typedef struct lldiv_t anon_unknown.dwarf_15ec6b; + +typedef struct lldiv_t anon_unknown.dwarf_46777; + +typedef struct lldiv_t anon_unknown.dwarf_20a06c; + +typedef struct lldiv_t anon_unknown.dwarf_27db0d; + +typedef struct lldiv_t anon_unknown.dwarf_b7ecc; + +typedef struct lldiv_t anon_unknown.dwarf_2be58c; + +typedef struct lldiv_t anon_unknown.dwarf_250c68; + +typedef struct lldiv_t anon_unknown.dwarf_9c643; + +typedef struct lldiv_t anon_unknown.dwarf_24f67; + +typedef struct lldiv_t anon_unknown.dwarf_56fbe; + +typedef struct lldiv_t anon_unknown.dwarf_1065d4; + +typedef struct lldiv_t anon_unknown.dwarf_2ce19c; + +typedef struct lldiv_t anon_unknown.dwarf_223049; + +typedef struct lldiv_t anon_unknown.dwarf_1bbfd6; + +typedef struct lldiv_t anon_unknown.dwarf_76de5; + +typedef struct lldiv_t anon_unknown.dwarf_8a2f6; + +typedef struct lldiv_t anon_unknown.dwarf_1d905b; + +typedef struct lldiv_t anon_unknown.dwarf_13e5b3; + +typedef struct lldiv_t anon_unknown.dwarf_2b7e74; + +typedef struct lldiv_t anon_unknown.dwarf_dfd3a; + +typedef struct lldiv_t anon_unknown.dwarf_d077f; + +typedef struct lldiv_t anon_unknown.dwarf_f553b; + +typedef struct lldiv_t anon_unknown.dwarf_15ab5; + +typedef struct lldiv_t anon_unknown.dwarf_19f9be; + +typedef struct lldiv_t anon_unknown.dwarf_237330; + +typedef struct lldiv_t anon_unknown.dwarf_35a6c; + +typedef struct rebind rebind; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef struct matrix3d matrix3d; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/listIterator/listIterator - /DWARF/_UNCATEGORIZED_/listIterator_>/listIterator + +typedef struct div_t div_t, *Pdiv_t; + +typedef struct div_t anon_unknown.dwarf_6785f; + +struct div_t { + int quot; + int rem; +}; + +typedef struct div_t anon_unknown.dwarf_19f896; + +typedef struct div_t anon_unknown.dwarf_13e48b; + +typedef struct div_t anon_unknown.dwarf_11dfcc; + +typedef struct div_t anon_unknown.dwarf_2ce074; + +typedef struct div_t anon_unknown.dwarf_f5413; + +typedef struct div_t anon_unknown.dwarf_4664f; + +typedef struct div_t anon_unknown.dwarf_56e96; + +typedef struct div_t anon_unknown.dwarf_d0657; + +typedef struct div_t anon_unknown.dwarf_b7da4; + +typedef struct div_t anon_unknown.dwarf_9c51b; + +typedef struct div_t anon_unknown.dwarf_24e3f; + +typedef struct div_t anon_unknown.dwarf_2ac8ba; + +typedef struct div_t anon_unknown.dwarf_1064ac; + +typedef struct div_t anon_unknown.dwarf_2b7d4c; + +typedef struct div_t anon_unknown.dwarf_237208; + +typedef struct div_t anon_unknown.dwarf_266c7c; + +typedef struct div_t anon_unknown.dwarf_250b40; + +typedef struct div_t anon_unknown.dwarf_184ee2; + +typedef struct div_t anon_unknown.dwarf_209f44; + +typedef struct div_t anon_unknown.dwarf_1d8f33; + +typedef struct div_t anon_unknown.dwarf_dfc12; + +typedef struct div_t anon_unknown.dwarf_27d9e5; + +typedef struct div_t anon_unknown.dwarf_35944; + +typedef struct div_t anon_unknown.dwarf_1598d; + +typedef struct div_t anon_unknown.dwarf_222f21; + +typedef struct div_t anon_unknown.dwarf_1bbeae; + +typedef struct div_t anon_unknown.dwarf_2be464; + +typedef struct div_t anon_unknown.dwarf_76cbd; + +typedef struct div_t anon_unknown.dwarf_2905b7; + +typedef struct div_t anon_unknown.dwarf_8a1ce; + +typedef struct div_t anon_unknown.dwarf_15eb43; + +typedef struct div_t anon_unknown.dwarf_1f2c73; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/store/store - /DWARF/_UNCATEGORIZED_/store/store + +typedef struct ostreambuf_iterator_> ostreambuf_iterator_>, *Postreambuf_iterator_>; + +typedef struct ostreambuf_iterator_> ostreambuf_iterator; + +struct ostreambuf_iterator_> { // Original name: ostreambuf_iterator > +Missing member super_iterator : iterator at offset 0x0 [conflicting member at same offset] + struct basic_streambuf_> *_M_sbuf; + bool _M_failed; +}; + + +// WARNING! conflicting data type names: /DWARF/_UNCATEGORIZED_/vector/vector - /DWARF/_UNCATEGORIZED_/vector/vector + +typedef void (*new_handler)(void); + +typedef struct nothrow_t nothrow_t, *Pnothrow_t; + +struct nothrow_t { +}; + +typedef enum TReaderThreadOrderType { + ORDER_TERMINATE=0, + ORDER_LOADSECTOR=1, + ORDER_LOADCHARACTER=2 +} TReaderThreadOrderType; + +typedef struct TReaderThreadOrder TReaderThreadOrder, *PTReaderThreadOrder; + +struct TReaderThreadOrder { + enum TReaderThreadOrderType OrderType; + int SectorX; + int SectorY; + int SectorZ; + ulong CharacterID; +}; + +typedef enum TReaderThreadReplyType { + REPLY_SECTORDATA=0, + REPLY_CHARACTERDATA=1 +} TReaderThreadReplyType; + +typedef struct TReaderThreadReply TReaderThreadReply, *PTReaderThreadReply; + +struct TReaderThreadReply { + enum TReaderThreadReplyType ReplyType; + int SectorX; + int SectorY; + int SectorZ; + uchar *Data; + int Size; +}; + +typedef struct flock flock, *Pflock; + +struct flock { + short l_type; + short l_whence; + __off_t l_start; + __off_t l_len; + __pid_t l_pid; +}; + +typedef struct flock64 flock64, *Pflock64; + +struct flock64 { + short l_type; + short l_whence; + __off64_t l_start; + __off64_t l_len; + __pid_t l_pid; +}; + +typedef struct TReadScriptFile TReadScriptFile, *PTReadScriptFile; + +typedef enum TOKEN { + ENDOFFILE=0, + IDENTIFIER=1, + NUMBER=2, + STRING=3, + BYTES=4, + COORDINATE=5, + SPECIAL=6 +} TOKEN; + +struct TReadScriptFile { + enum TOKEN Token; + FILE *File[3]; + char Filename[3][4096]; + int Line[3]; + char String[4000]; + int RecursionDepth; + uchar *Bytes; + int Number; + int CoordX; + int CoordY; + int CoordZ; + char Special; +}; + +typedef struct TWriteBinaryFile TWriteBinaryFile, *PTWriteBinaryFile; + +struct TWriteBinaryFile { + struct TWriteStream super_TWriteStream; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + FILE *File; + char Filename[4096]; +}; + +typedef struct TReadBinaryFile TReadBinaryFile, *PTReadBinaryFile; + +struct TReadBinaryFile { + struct TReadStream super_TReadStream; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + FILE *File; + char Filename[4096]; + int FileSize; +}; + +typedef struct TWriteScriptFile TWriteScriptFile, *PTWriteScriptFile; + +struct TWriteScriptFile { + FILE *File; + char Filename[4096]; + int Line; +}; + +typedef struct _Refcount_Base _Refcount_Base, *P_Refcount_Base; + +struct _Refcount_Base { + size_t _M_ref_count; + __gthread_mutex_t _M_ref_count_lock; +}; + +typedef struct _STL_mutex_lock _STL_mutex_lock, *P_STL_mutex_lock; + +struct _STL_mutex_lock { + __gthread_mutex_t _M_lock; +}; + +typedef struct _STL_auto_lock _STL_auto_lock, *P_STL_auto_lock; + +struct _STL_auto_lock { + struct _STL_mutex_lock *_M_lock; +}; + +typedef size_t _RC_t; + +typedef struct TThreadStarter TThreadStarter, *PTThreadStarter; + +struct TThreadStarter { + ThreadFunction *Function; + void *Argument; + bool Detach; +}; + +typedef int (*__compar_fn_t)(void *, void *); + +typedef struct random_data random_data, *Prandom_data; + +struct random_data { + int32_t *fptr; + int32_t *rptr; + int32_t *state; + int rand_type; + int rand_deg; + int rand_sep; + int32_t *end_ptr; +}; + +typedef struct drand48_data drand48_data, *Pdrand48_data; + +struct drand48_data { + ushort __x[3]; + ushort __old_x[3]; + ushort __c; + ushort __init; + ulonglong __a; +}; + +typedef __compar_fn_t comparison_fn_t; + +typedef struct addrinfo addrinfo, *Paddrinfo; + +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; + +typedef struct rpcent rpcent, *Prpcent; + +struct rpcent { + char *r_name; + char **r_aliases; + int r_number; +}; + +typedef struct protoent protoent, *Pprotoent; + +struct protoent { + char *p_name; + char **p_aliases; + int p_proto; +}; + +typedef struct netent netent, *Pnetent; + +struct netent { + char *n_name; + char **n_aliases; + int n_addrtype; + uint32_t n_net; +}; + +typedef struct servent servent, *Pservent; + +struct servent { + char *s_name; + char **s_aliases; + int s_port; + char *s_proto; +}; + +typedef struct gaicb gaicb, *Pgaicb; + +struct gaicb { + char *ar_name; + char *ar_service; + struct addrinfo *ar_request; + struct addrinfo *ar_result; + int __return; + int __unused[5]; +}; + +typedef struct TQueryManagerConnection TQueryManagerConnection, *PTQueryManagerConnection; + +struct TQueryManagerConnection { + int BufferSize; + uchar *Buffer; + struct TReadBuffer ReadBuffer; + struct TWriteBuffer WriteBuffer; + int Socket; + bool QueryOk; + undefined field6_0x2d; + undefined field7_0x2e; + undefined field8_0x2f; +}; + +typedef struct TQueryManagerPoolConnection TQueryManagerPoolConnection, *PTQueryManagerPoolConnection; + +typedef struct TQueryManagerConnectionPool TQueryManagerConnectionPool, *PTQueryManagerConnectionPool; + +struct TQueryManagerPoolConnection { + struct TQueryManagerConnectionPool *QueryManagerConnectionPool; + struct TQueryManagerConnection *QueryManagerConnection; +}; + +struct TQueryManagerConnectionPool { + int NumberOfConnections; + struct TQueryManagerConnection *QueryManagerConnection; + bool *QueryManagerConnectionFree; + struct Semaphore FreeQueryManagerConnections; + struct Semaphore QueryManagerConnectionMutex; +}; + +typedef struct TQueryManagerSettings TQueryManagerSettings, *PTQueryManagerSettings; + +struct TQueryManagerSettings { + char Host[50]; + int Port; + char Password[30]; +}; + +typedef struct vlong_montgomery vlong_montgomery, *Pvlong_montgomery; + +struct vlong_montgomery { + struct vlong R; + struct vlong R1; + struct vlong m; + struct vlong n1; + struct vlong T; + struct vlong k; + uint N; +}; + +typedef enum TWorldType { + NORMAL=0, + NON_PVP=1, + PVP_ENFORCED=2 +} TWorldType; + +typedef struct __ios_flags __ios_flags, *P__ios_flags; + +struct __ios_flags { +}; + +typedef fpos_t __c_streampos; + +typedef __gthread_mutex_t __c_lock; + +typedef ptrdiff_t wstreamsize; + +typedef struct _xmmreg _xmmreg, *P_xmmreg; + +struct _xmmreg { + ulong element[4]; +}; + +typedef struct _fpreg _fpreg, *P_fpreg; + +struct _fpreg { + ushort significand[4]; + ushort exponent; +}; + +typedef struct _fpxreg _fpxreg, *P_fpxreg; + +struct _fpxreg { + ushort significand[4]; + ushort exponent; + ushort padding[3]; +}; + +typedef struct sigcontext sigcontext, *Psigcontext; + +typedef struct _fpstate _fpstate, *P_fpstate; + +struct sigcontext { + ushort gs; + ushort __gsh; + ushort fs; + ushort __fsh; + ushort es; + ushort __esh; + ushort ds; + ushort __dsh; + ulong edi; + ulong esi; + ulong ebp; + ulong esp; + ulong ebx; + ulong edx; + ulong ecx; + ulong eax; + ulong trapno; + ulong err; + ulong eip; + ushort cs; + ushort __csh; + ulong eflags; + ulong esp_at_signal; + ushort ss; + ushort __ssh; + struct _fpstate *fpstate; + ulong oldmask; + ulong cr2; +}; + +struct _fpstate { + ulong cw; + ulong sw; + ulong tag; + ulong ipoff; + ulong cssel; + ulong dataoff; + ulong datasel; + struct _fpreg _st[8]; + ushort status; + ushort magic; + ulong _fxsr_env[6]; + ulong mxcsr; + ulong reserved; + struct _fpxreg _fxsr_st[8]; + struct _xmmreg _xmm[8]; + ulong padding[56]; +}; + +typedef struct __num_base __num_base, *P__num_base; + +struct __num_base { +}; + +typedef struct time_base time_base, *Ptime_base; + +struct time_base { +}; + +typedef struct messages_base messages_base, *Pmessages_base; + +struct messages_base { +}; + +typedef struct money_base money_base, *Pmoney_base; + +struct money_base { +}; + +typedef struct pattern pattern, *Ppattern; + +struct pattern { + char field[4]; +}; + +typedef enum part { + none=0, + space=1, + symbol=2, + sign=3, + value=4 +} part; + +typedef enum dateorder { + no_order=0, + dmy=1, + mdy=2, + ymd=3, + ydm=4 +} dateorder; + +typedef struct in_addr in_addr, *Pin_addr; + +typedef uint32_t in_addr_t; + +struct in_addr { + in_addr_t s_addr; +}; + +typedef struct ip_mreqn ip_mreqn, *Pip_mreqn; + +struct ip_mreqn { + struct in_addr imr_multiaddr; + struct in_addr imr_address; + int imr_ifindex; +}; + +typedef struct ip_opts ip_opts, *Pip_opts; + +struct ip_opts { + struct in_addr ip_dst; + char ip_opts[40]; +}; + +typedef struct in6_pktinfo in6_pktinfo, *Pin6_pktinfo; + +typedef struct in6_addr in6_addr, *Pin6_addr; + +typedef union anon_union_16_3_65e4bd2d_for_in6_u anon_union_16_3_65e4bd2d_for_in6_u, *Panon_union_16_3_65e4bd2d_for_in6_u; + +union anon_union_16_3_65e4bd2d_for_in6_u { + uint8_t u6_addr8[16]; + uint16_t u6_addr16[8]; + uint32_t u6_addr32[4]; +}; + +struct in6_addr { + union anon_union_16_3_65e4bd2d_for_in6_u in6_u; +}; + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + uint ipi6_ifindex; +}; + +typedef struct ip_mreq ip_mreq, *Pip_mreq; + +struct ip_mreq { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; +}; + +typedef struct in_pktinfo in_pktinfo, *Pin_pktinfo; + +struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +typedef struct ipv6_mreq ipv6_mreq, *Pipv6_mreq; + +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + uint ipv6mr_interface; +}; + +typedef struct sockaddr_in6 sockaddr_in6, *Psockaddr_in6; + +typedef uint16_t in_port_t; + +struct sockaddr_in6 { + sa_family_t sin6_family; + in_port_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; + uint32_t sin6_scope_id; +}; + +typedef struct sockaddr_in sockaddr_in, *Psockaddr_in; + +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + uchar sin_zero[8]; +}; + +typedef struct TShortway TShortway, *PTShortway; + +struct TShortway { + struct matrix *Map; + struct TShortwayPoint *FirstToExpand; + struct TCreature *cr; + int VisibleX; + int VisibleY; + int StartX; + int StartY; + int StartZ; + int MinWaypoints; +}; + +typedef struct basic_ios_> wios; + +typedef struct basic_ostream_> ostream; + +typedef struct basic_ios_> ios; + +typedef struct basic_ostream_> wostream; + +typedef struct basic_ofstream_> wofstream; + +typedef struct basic_streambuf_> wstreambuf; + +typedef struct basic_istringstream,std::allocator_> istringstream; + +typedef struct basic_filebuf_> wfilebuf; + +typedef struct basic_stringstream,std::allocator_> wstringstream; + +typedef struct basic_iostream_> iostream; + +typedef struct basic_ofstream_> ofstream; + +typedef struct __vmi_class_type_info_pseudo1 __vmi_class_type_info_pseudo1, *P__vmi_class_type_info_pseudo1; + +struct __vmi_class_type_info_pseudo1 { + undefined field0_0x0; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + undefined field4_0x4; + undefined field5_0x5; + undefined field6_0x6; + undefined field7_0x7; + undefined field8_0x8; + undefined field9_0x9; + undefined field10_0xa; + undefined field11_0xb; + undefined field12_0xc; + undefined field13_0xd; + undefined field14_0xe; + undefined field15_0xf; + undefined field16_0x10; + undefined field17_0x11; + undefined field18_0x12; + undefined field19_0x13; + undefined field20_0x14; + undefined field21_0x15; + undefined field22_0x16; + undefined field23_0x17; + undefined field24_0x18; + undefined field25_0x19; + undefined field26_0x1a; + undefined field27_0x1b; + undefined field28_0x1c; + undefined field29_0x1d; + undefined field30_0x1e; + undefined field31_0x1f; +}; + +typedef struct basic_ifstream_> ifstream; + +typedef struct basic_fstream_> wfstream; + +typedef struct basic_stringstream,std::allocator_> stringstream; + +typedef struct basic_istream_> wistream; + +typedef struct basic_iostream_> wiostream; + +typedef struct basic_streambuf_> streambuf; + +typedef struct basic_istringstream,std::allocator_> wistringstream; + +typedef struct basic_istream_> istream; + +typedef struct basic_ifstream_> wifstream; + +typedef struct basic_stringbuf,std::allocator_> wstringbuf; + +typedef struct basic_stringbuf,std::allocator_> stringbuf; + +typedef struct basic_fstream_> fstream; + +typedef struct basic_ostringstream,std::allocator_> ostringstream; + +typedef struct basic_ostringstream,std::allocator_> wostringstream; + +typedef struct basic_filebuf_> filebuf; + + +// WARNING! conflicting data type names: /stdarg.h/__gnuc_va_list - /DWARF/stdarg.h/__gnuc_va_list + +typedef union _union_1051 _union_1051, *P_union_1051; + + +// WARNING! conflicting data type names: /signal.h/__sighandler_t - /DWARF/signal.h/sigaction/anon_union_4_2_5ad2d23e_for___sigaction_handler/__sighandler_t + +union _union_1051 { + __sighandler_t sa_handler; + void (*sa_sigaction)(int, siginfo_t *, void *); +}; + + +// WARNING! conflicting data type names: /sigaction.h/sigaction - /DWARF/sigaction.h/sigaction + + +// WARNING! conflicting data type names: /stddef.h/size_t - /DWARF/size_t + + +// WARNING! conflicting data type names: /shm.h/shmatt_t - /DWARF/shmatt_t + + +// WARNING! conflicting data type names: /shm.h/shmid_ds - /DWARF/shm.h/shmid_ds + + +// WARNING! conflicting data type names: /Demangler/std/string - /string + + +// WARNING! conflicting data type names: /Demangler/std/ostream - /DWARF/iosfwd/ostream + + +// WARNING! conflicting data type names: /Demangler/std/locale - /DWARF/localefwd.h/locale + + +// WARNING! conflicting data type names: /Demangler/std/ios - /DWARF/iosfwd/ios + + +// WARNING! conflicting data type names: /Demangler/std/streambuf - /DWARF/iosfwd/streambuf + + +// WARNING! conflicting data type names: /Demangler/std/allocator - /DWARF/_UNCATEGORIZED_/allocator/allocator + + +// WARNING! conflicting data type names: /Demangler/std/ios_base - /DWARF/ios_base.h/ios_base + + +// WARNING! conflicting data type names: /Demangler/std/_Ios_Openmode - /DWARF/ios_base.h/_Ios_Openmode + + +// WARNING! conflicting data type names: /Demangler/std/_Ios_Iostate - /DWARF/ios_base.h/_Ios_Iostate + + +// WARNING! conflicting data type names: /Demangler/std/istream - /DWARF/iosfwd/istream + + +// WARNING! conflicting data type names: /Demangler/std/stringbuf - /DWARF/iosfwd/stringbuf + + +// WARNING! conflicting data type names: /Demangler/std/filebuf - /DWARF/iosfwd/filebuf + + +// WARNING! conflicting data type names: /Demangler/std/__basic_file - /DWARF/basic_file.h/__basic_file + + +// WARNING! conflicting data type names: /libio.h/_IO_marker - /DWARF/libio.h/_IO_marker + + +// WARNING! conflicting data type names: /stdio.h/_IO_FILE - /DWARF/libio.h/_IO_FILE + + +// WARNING! conflicting data type names: /stdio.h/FILE - /DWARF/stdio.h/__basic_file/FILE + +typedef struct evp_pkey_ctx_st evp_pkey_ctx_st, *Pevp_pkey_ctx_st; + +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +struct evp_pkey_ctx_st { +}; + + +// WARNING! conflicting data type names: /time.h/itimerval - /DWARF/time.h/itimerval + + +// WARNING! conflicting data type names: /time.h/time_t - /DWARF/time.h/TPlayerData/time_t + + +// WARNING! conflicting data type names: /time.h/__itimer_which_t - /DWARF/__itimer_which_t + + +// WARNING! conflicting data type names: /time.h/timeval - /DWARF/time.h/timeval + + +// WARNING! conflicting data type names: /in.h/in_addr - /DWARF/in.h/in_addr + + +// WARNING! conflicting data type names: /in.h/in_addr_t - /DWARF/in.h/in_addr/in_addr_t + +typedef struct Elf32_Shdr Elf32_Shdr, *PElf32_Shdr; + +typedef enum Elf_SectionHeaderType_x86 { + SHT_NULL=0, + SHT_PROGBITS=1, + SHT_SYMTAB=2, + SHT_STRTAB=3, + SHT_RELA=4, + SHT_HASH=5, + SHT_DYNAMIC=6, + SHT_NOTE=7, + SHT_NOBITS=8, + SHT_REL=9, + SHT_SHLIB=10, + SHT_DYNSYM=11, + SHT_INIT_ARRAY=14, + SHT_FINI_ARRAY=15, + SHT_PREINIT_ARRAY=16, + SHT_GROUP=17, + SHT_SYMTAB_SHNDX=18, + SHT_ANDROID_REL=1610612737, + SHT_ANDROID_RELA=1610612738, + SHT_GNU_ATTRIBUTES=1879048181, + SHT_GNU_HASH=1879048182, + SHT_GNU_LIBLIST=1879048183, + SHT_CHECKSUM=1879048184, + SHT_SUNW_move=1879048186, + SHT_SUNW_COMDAT=1879048187, + SHT_SUNW_syminfo=1879048188, + SHT_GNU_verdef=1879048189, + SHT_GNU_verneed=1879048190, + SHT_GNU_versym=1879048191 +} Elf_SectionHeaderType_x86; + +struct Elf32_Shdr { + dword sh_name; + enum Elf_SectionHeaderType_x86 sh_type; + dword sh_flags; + dword sh_addr; + dword sh_offset; + dword sh_size; + dword sh_link; + dword sh_info; + dword sh_addralign; + dword sh_entsize; +}; + +typedef struct Elf32_Sym Elf32_Sym, *PElf32_Sym; + +struct Elf32_Sym { + dword st_name; + dword st_value; + dword st_size; + byte st_info; + byte st_other; + word st_shndx; +}; + +typedef enum Elf32_DynTag_x86 { + DT_NULL=0, + DT_NEEDED=1, + DT_PLTRELSZ=2, + DT_PLTGOT=3, + DT_HASH=4, + DT_STRTAB=5, + DT_SYMTAB=6, + DT_RELA=7, + DT_RELASZ=8, + DT_RELAENT=9, + DT_STRSZ=10, + DT_SYMENT=11, + DT_INIT=12, + DT_FINI=13, + DT_SONAME=14, + DT_RPATH=15, + DT_SYMBOLIC=16, + DT_REL=17, + DT_RELSZ=18, + DT_RELENT=19, + DT_PLTREL=20, + DT_DEBUG=21, + DT_TEXTREL=22, + DT_JMPREL=23, + DT_BIND_NOW=24, + DT_INIT_ARRAY=25, + DT_FINI_ARRAY=26, + DT_INIT_ARRAYSZ=27, + DT_FINI_ARRAYSZ=28, + DT_RUNPATH=29, + DT_FLAGS=30, + DT_PREINIT_ARRAY=32, + DT_PREINIT_ARRAYSZ=33, + DT_RELRSZ=35, + DT_RELR=36, + DT_RELRENT=37, + DT_ANDROID_REL=1610612751, + DT_ANDROID_RELSZ=1610612752, + DT_ANDROID_RELA=1610612753, + DT_ANDROID_RELASZ=1610612754, + DT_ANDROID_RELR=1879040000, + DT_ANDROID_RELRSZ=1879040001, + DT_ANDROID_RELRENT=1879040003, + DT_GNU_PRELINKED=1879047669, + DT_GNU_CONFLICTSZ=1879047670, + DT_GNU_LIBLISTSZ=1879047671, + DT_CHECKSUM=1879047672, + DT_PLTPADSZ=1879047673, + DT_MOVEENT=1879047674, + DT_MOVESZ=1879047675, + DT_FEATURE_1=1879047676, + DT_POSFLAG_1=1879047677, + DT_SYMINSZ=1879047678, + DT_SYMINENT=1879047679, + DT_GNU_XHASH=1879047924, + DT_GNU_HASH=1879047925, + DT_TLSDESC_PLT=1879047926, + DT_TLSDESC_GOT=1879047927, + DT_GNU_CONFLICT=1879047928, + DT_GNU_LIBLIST=1879047929, + DT_CONFIG=1879047930, + DT_DEPAUDIT=1879047931, + DT_AUDIT=1879047932, + DT_PLTPAD=1879047933, + DT_MOVETAB=1879047934, + DT_SYMINFO=1879047935, + DT_VERSYM=1879048176, + DT_RELACOUNT=1879048185, + DT_RELCOUNT=1879048186, + DT_FLAGS_1=1879048187, + DT_VERDEF=1879048188, + DT_VERDEFNUM=1879048189, + DT_VERNEED=1879048190, + DT_VERNEEDNUM=1879048191, + DT_AUXILIARY=2147483645, + DT_FILTER=2147483647 +} Elf32_DynTag_x86; + +typedef struct Elf32_Phdr Elf32_Phdr, *PElf32_Phdr; + +typedef enum Elf_ProgramHeaderType_x86 { + PT_NULL=0, + PT_LOAD=1, + PT_DYNAMIC=2, + PT_INTERP=3, + PT_NOTE=4, + PT_SHLIB=5, + PT_PHDR=6, + PT_TLS=7, + PT_GNU_EH_FRAME=1685382480, + PT_GNU_STACK=1685382481, + PT_GNU_RELRO=1685382482 +} Elf_ProgramHeaderType_x86; + +struct Elf32_Phdr { + enum Elf_ProgramHeaderType_x86 p_type; + dword p_offset; + dword p_vaddr; + dword p_paddr; + dword p_filesz; + dword p_memsz; + dword p_flags; + dword p_align; +}; + +typedef struct Elf32_Dyn_x86 Elf32_Dyn_x86, *PElf32_Dyn_x86; + +struct Elf32_Dyn_x86 { + enum Elf32_DynTag_x86 d_tag; + dword d_val; +}; + +typedef struct NoteAbiTag NoteAbiTag, *PNoteAbiTag; + +struct NoteAbiTag { + dword namesz; // Length of name field + dword descsz; // Length of description field + dword type; // Vendor specific type + char name[4]; // Vendor name + dword abiType; // 0 == Linux + dword requiredKernelVersion[3]; // Major.minor.patch +}; + +typedef struct Elf32_Rel Elf32_Rel, *PElf32_Rel; + +struct Elf32_Rel { + dword r_offset; // location to apply the relocation action + dword r_info; // the symbol table index and the type of relocation +}; + +typedef struct Elf32_Ehdr Elf32_Ehdr, *PElf32_Ehdr; + +struct Elf32_Ehdr { + byte e_ident_magic_num; + char e_ident_magic_str[3]; + byte e_ident_class; + byte e_ident_data; + byte e_ident_version; + byte e_ident_osabi; + byte e_ident_abiversion; + byte e_ident_pad[7]; + word e_type; + word e_machine; + dword e_version; + dword e_entry; + dword e_phoff; + dword e_shoff; + dword e_flags; + word e_ehsize; + word e_phentsize; + word e_phnum; + word e_shentsize; + word e_shnum; + word e_shstrndx; +}; + + +// WARNING! conflicting data type names: /stdint.h/uint32_t - /DWARF/uint32_t + + + + +void _init(void) + +{ + call_gmon_start(); + frame_dummy(); + __do_global_ctors_aux(); + return; +} + + + +void FUN_0804a82c(void) + +{ + (*(code *)(undefined *)0x0)(); + return; +} + + + +// std::filebuf::~filebuf() + +void __thiscall std::filebuf::~filebuf(filebuf *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::istream::peek() + +void std::istream::peek(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_cond_wait(pthread_cond_t *__cond,pthread_mutex_t *__mutex) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_detach(pthread_t __th) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_attr_init(pthread_attr_t *__attr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigfillset(sigset_t *__set) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int usleep(__useconds_t __useconds) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __divdi3(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_allocate_exception(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int rename(char *__old,char *__new) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigaction(int __sig,sigaction *__act,sigaction *__oact) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strchr(char *__s,int __c) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::istream::get() + +void std::istream::get(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int ungetc(int __c,FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_pure_virtual(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::filebuf::filebuf() + +void __thiscall std::filebuf::filebuf(filebuf *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +__pid_t getpid(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::string::_Rep::_M_dispose(std::allocator const&) + +void std::string::_Rep::_M_dispose(allocator *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_attr_setstacksize(pthread_attr_t *__attr,size_t __stacksize) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ios_base::~ios_base() + +void __thiscall std::ios_base::~ios_base(ios_base *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int isprint(int param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ostream::TEMPNAMEPLACEHOLDERVALUE(long) + +void __thiscall std::ostream::operator<<(ostream *this,long param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ssize_t write(int __fd,void *__buf,size_t __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int poll(pollfd *__fds,nfds_t __nfds,int __timeout) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +tm * localtime(time_t *__timer) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int strcmp(char *__s1,char *__s2) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int close(int __fd) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::istream::~istream() + +void __thiscall std::istream::~istream(istream *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int fprintf(FILE *__stream,char *__format,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +__pid_t fork(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * getenv(char *__name) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +__mode_t umask(__mode_t __mask) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_create(pthread_t *__newthread,pthread_attr_t *__attr,__start_routine *__start_routine, + void *__arg) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int unlink(char *__name) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigblock(int __mask) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::terminate() + +void std::terminate(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int vsnprintf(char *__s,size_t __maxlen,char *__format,__gnuc_va_list __arg) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strerror(int __errnum) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_cancel(pthread_t __th) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_call_unexpected(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ios::clear(std::_Ios_Iostate) + +void std::ios::clear(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_atexit(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// operator delete(void*) + +void operator_delete(void *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int * __errno_location(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +long ftell(FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int accept(int __fd,sockaddr *__addr,socklen_t *__addr_len) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_attr_setstack(pthread_attr_t *__attr,void *__stackaddr,size_t __stacksize) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * inet_ntoa(in_addr __in) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ios_base::ios_base() + +void __thiscall std::ios_base::ios_base(ios_base *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int puts(char *__s) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int listen(int __fd,int __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::istream::TEMPNAMEPLACEHOLDERVALUE(int&) + +void __thiscall std::istream::operator>>(istream *this,int *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void * malloc(size_t __size) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sched_yield(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +__pid_t setsid(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_mutex_init(pthread_mutex_t *__mutex,pthread_mutexattr_t *__mutexattr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +size_t strftime(char *__s,size_t __maxsize,char *__format,tm *__tp) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_mutex_destroy(pthread_mutex_t *__mutex) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pipe(int *__pipedes) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +size_t fread(void *__ptr,size_t __size,size_t __n,FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void * memmove(void *__dest,void *__src,size_t __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int setitimer(__itimer_which_t __which,itimerval *__new,itimerval *__old) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ostream::~ostream() + +void __thiscall std::ostream::~ostream(ostream *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_rethrow(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::__basic_file::~__basic_file() + +void __thiscall std::__basic_file::~__basic_file(__basic_file *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int shmget(key_t __key,size_t __size,int __shmflg) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void abort(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_throw(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::filebuf::open(char const*, std::_Ios_Openmode) + +int std::filebuf::open(char *__file,int __oflag,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int __xstat(int __ver,char *__filename,stat *__stat_buf) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int setsockopt(int __fd,int __level,int __optname,void *__optval,socklen_t __optlen) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +long sysconf(int __name) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int execv(char *__path,char **__argv) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int getpeername(int __fd,sockaddr *__addr,socklen_t *__len) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int fseek(FILE *__stream,long __off,int __whence) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +__pid_t waitpid(__pid_t __pid,int *__stat_loc,int __options) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +time_t time(time_t *__timer) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int __sigpause(int __sig_or_mask,int __is_sig) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_mutex_lock(pthread_mutex_t *__mutex) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int execlp(char *__file,char *__arg,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::streambuf::~streambuf() + +void __thiscall std::streambuf::~streambuf(streambuf *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int chdir(char *__path) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::locale::~locale() + +void __thiscall std::locale::~locale(locale *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::filebuf::close() + +int std::filebuf::close(int __fd) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strstr(char *__haystack,char *__needle) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +size_t strlen(char *__s) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +uint sleep(uint __seconds) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_end_catch(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __strtol_internal(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int rand_r(uint *__seed) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::__throw_logic_error(char const*) + +void std::__throw_logic_error(char *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_cond_signal(pthread_cond_t *__cond) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ios::~ios() + +void __thiscall std::ios::~ios(ios *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::bad_alloc::~bad_alloc() + +void __thiscall std::bad_alloc::~bad_alloc(bad_alloc *this) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigprocmask(int __how,sigset_t *__set,sigset_t *__oset) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +in_addr_t inet_addr(char *__cp) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __gxx_personality_v0(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_cond_init(pthread_cond_t *__cond,pthread_condattr_t *__cond_attr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int shmdt(void *__shmaddr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::string::_Rep::_S_create(unsigned int, std::allocator const&) + +void std::string::_Rep::_S_create(uint param_1,allocator *param_2) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int putc(int __c,FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __libc_start_main(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::string::reserve(unsigned int) + +void std::string::reserve(uint param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::istream::istream(std::streambuf*) + +void __thiscall std::istream::istream(istream *this,streambuf *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int dup2(int __fd,int __fd2) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strcat(char *__dest,char *__src) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_attr_destroy(pthread_attr_t *__attr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int printf(char *__format,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int bind(int __fd,sockaddr *__addr,socklen_t __len) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int fcntl(int __fd,int __cmd,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void * memcpy(void *__dest,void *__src,size_t __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::__throw_length_error(char const*) + +void std::__throw_length_error(char *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int fclose(FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * ctime(time_t *__timer) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int gethostbyname_r(char *__name,hostent *__result_buf,char *__buf,size_t __buflen, + hostent **__result,int *__h_errnop) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int shmctl(int __shmid,int __cmd,shmid_ds *__buf) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ostream::TEMPNAMEPLACEHOLDERVALUE(unsigned long) + +void __thiscall std::ostream::operator<<(ostream *this,ulong param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int closedir(DIR *__dirp) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void srand(uint __seed) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +DIR * opendir(char *__name) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int snprintf(char *__s,size_t __maxlen,char *__format,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigemptyset(sigset_t *__set) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::stringbuf::stringbuf(std::string const&, std::_Ios_Openmode) + +void __thiscall std::stringbuf::stringbuf(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_join(pthread_t __th,void **__thread_return) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void pthread_exit(void *__retval) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void exit(int __status) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sscanf(char *__s,char *__format,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void free(void *__ptr) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void __cxa_begin_catch(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void * memset(void *__s,int __c,size_t __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int connect(int __fd,sockaddr *__addr,socklen_t __len) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_cond_destroy(pthread_cond_t *__cond) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strncpy(char *__dest,char *__src,size_t __n) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::__default_alloc_template::deallocate(void*, unsigned int) + +void std::__default_alloc_template::deallocate(void *param_1,uint param_2) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +FILE * fopen(char *__filename,char *__modes) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sigwait(sigset_t *__set,int *__sig) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void _Unwind_Resume(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::istream::get(char*, int, char) + +void std::istream::get(char *param_1,int param_2,char param_3) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int pthread_mutex_unlock(pthread_mutex_t *__mutex) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// operator new[](unsigned int) + +void * operator_new__(uint param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int kill(__pid_t __pid,int __sig) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int getc(FILE *__stream) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// operator delete[](void*) + +void operator_delete__(void *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int sprintf(char *__s,char *__format,...) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::ios::init(std::streambuf*) + +int std::ios::init(EVP_PKEY_CTX *ctx) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +size_t fwrite(void *__ptr,size_t __size,size_t __n,FILE *__s) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// std::ostream::ostream(std::streambuf*) + +void __thiscall std::ostream::ostream(ostream *this,streambuf *param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int socket(int __domain,int __type,int __protocol) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +dirent * readdir(DIR *__dirp) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// std::string::_M_mutate(unsigned int, unsigned int, unsigned int) + +void std::string::_M_mutate(uint param_1,uint param_2,uint param_3) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int rand(void) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ssize_t read(int __fd,void *__buf,size_t __nbytes) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked +// operator new(unsigned int) + +void * operator_new(uint param_1) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +uint alarm(uint __seconds) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void * shmat(int __shmid,void *__shmaddr,int __shmflg) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * strcpy(char *__dest,char *__src) + +{ + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void processEntry _start(undefined4 param_1,undefined4 param_2) + +{ + undefined1 auStack_4 [4]; + + __libc_start_main(main,param_2,&stack0x00000004,__libc_csu_init,__libc_csu_fini,param_1, + auStack_4); + do { + // WARNING: Do nothing block with infinite loop + } while( true ); +} + + + +void call_gmon_start(void) + +{ + __gmon_start__(); + return; +} + + + +void __do_global_dtors_aux(void) + +{ + code *pcVar1; + + if (completed_1 == '\0') { + completed_1 = 0; + pcVar1 = *(code **)p_0; + while (pcVar1 != (code *)0x0) { + p_0 = p_0 + 4; + (*pcVar1)(); + pcVar1 = *(code **)p_0; + } + completed_1 = '\x01'; + } + return; +} + + + +// WARNING: Removing unreachable block (ram,0x0804b29c) + +void frame_dummy(void) + +{ + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessCommand(void) + +{ + char *CommandBuffer; + int iVar1; + char *pcVar2; + int Command; + + iVar1 = GetCommand(); + if (iVar1 != 0) { + pcVar2 = GetCommandBuffer(); + if (iVar1 == 1) { + if (pcVar2 == (char *)0x0) { + error(&DAT_080ee440); + } + else { + BroadcastMessage(0x12,"%s",pcVar2); + } + } + else { + error("ProcessCommand: Unbekanntes Kommando %d.\n",iVar1); + } + SetCommand(0,(char *)0x0); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Color + +void AdvanceGame(int Delay) + +{ + int iVar1; + TConnection *Connection_00; + TConnection *Connection; + int Time; + char *pcVar2; + int local_20; + int Hour; + int Minute; + int Brightness; + int Color; + + AdvanceGame::SkillTimeCounter = AdvanceGame::SkillTimeCounter + Delay; + AdvanceGame::OtherTimeCounter = AdvanceGame::OtherTimeCounter + Delay; + AdvanceGame::CreaturesTimeCounter = AdvanceGame::CreaturesTimeCounter + Delay; + AdvanceGame::CronTimeCounter = AdvanceGame::CronTimeCounter + Delay; + if (0x6d5 < AdvanceGame::CreaturesTimeCounter) { + AdvanceGame::CreaturesTimeCounter = AdvanceGame::CreaturesTimeCounter + -1000; + ProcessCreatures(); + } + if (0x5db < AdvanceGame::CronTimeCounter) { + AdvanceGame::CronTimeCounter = AdvanceGame::CronTimeCounter + -1000; + ProcessCronSystem(); + } + if (0x4e1 < AdvanceGame::SkillTimeCounter) { + AdvanceGame::SkillTimeCounter = AdvanceGame::SkillTimeCounter + -1000; + ProcessSkills(); + } + if (999 < AdvanceGame::OtherTimeCounter) { + AdvanceGame::OtherTimeCounter = AdvanceGame::OtherTimeCounter + -1000; + RoundNr = RoundNr + 1; + SetRoundNr(RoundNr); + ProcessConnections(); + ProcessMonsterhomes(); + ProcessMonsterRaids(); + ProcessCommunicationControl(); + ProcessReaderThreadReplies(RefreshSector,SendMails); + ProcessWriterThreadReplies(); + ProcessCommand(); + GetAmbiente(&Minute,&Brightness); + if (Minute != AdvanceGame::OldAmbiente) { + AdvanceGame::OldAmbiente = Minute; + Connection_00 = GetFirstConnection(); + while (Connection_00 != (TConnection *)0x0) { + if (Connection_00->State - CONNECTION_LOGIN < 4) { + SendAmbiente(Connection_00); + } + Connection_00 = GetNextConnection(); + } + } + if (RoundNr == (RoundNr / 10) * 10) { + NetLoadCheck(); + } + if (AdvanceGame::NextMinute <= RoundNr) { + GetRealTime(&local_20,&Hour); + RefreshCylinders(); + if (Hour == (Hour / 5) * 5) { + CreatePlayerList(true); + } + if (Hour == (Hour / 0xf) * 0xf) { + SavePlayerDataOrder(); + } + if (Hour == 0) { + NetLoadSummary(); + } + if (Hour == 0x37) { + WriteKillStatistics(); + } + iVar1 = Hour + local_20 * 0x3c; + if ((iVar1 + 5) % 0x5a0 == RebootTime) { + if (Reboot == false) { + pcVar2 = "Server is going down in 5 minutes.\nPlease log out."; + } + else { + pcVar2 = "Server is saving game in 5 minutes.\nPlease come back in 10 minutes."; + } + BroadcastMessage(0x12,pcVar2); + CloseGame(); + } + if ((iVar1 + 3) % 0x5a0 == RebootTime) { + if (Reboot == false) { + pcVar2 = "Server is going down in 3 minutes.\nPlease log out."; + } + else { + pcVar2 = "Server is saving game in 3 minutes.\nPlease come back in 10 minutes."; + } + BroadcastMessage(0x12,pcVar2); + } + if ((iVar1 + 1) % 0x5a0 == RebootTime) { + if (Reboot == false) { + pcVar2 = "Server is going down in one minute.\nPlease log out."; + } + else { + pcVar2 = "Server is saving game in one minute.\nPlease log out."; + } + BroadcastMessage(0x12,pcVar2); + } + if (iVar1 == RebootTime) { + CloseGame(); + LogoutAllPlayers(); + SendAll(); + if (Reboot != false) { + RefreshMap(); + } + SaveMap(); + SaveMapOn = false; + EndGame(); + } + AdvanceGame::NextMinute = GetRoundForNextMinute(); + } + CleanupDynamicStrings(); + } + if (Beat < Delay) { + Log("lag",&DAT_080ee9c7,Delay); + } + if (Delay < 1000) { + MoveCreatures(Delay); + AdvanceGame::Lag = false; + } + else { + if ((AdvanceGame::Lag == false) && (10 < RoundNr)) { + error(&DAT_080ee480,Delay); + } + AdvanceGame::Lag = true; + } + SendAll(); + return; +} + + + +void HandlerSigAlarm(int param_1) + +{ + undefined1 local_2c [4]; + itimerval ov; + itimerval v; + + ov.it_value.tv_usec = 0; + SigAlarmCounter = SigAlarmCounter + 1; + setitimer(ITIMER_REAL,(itimerval *)&ov.it_value.tv_usec,(itimerval *)local_2c); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void TimeReset(void) + +{ + SigAlarmCounter = 0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitTime(void) + +{ + undefined1 local_2c [4]; + itimerval ov; + itimerval v; + + SigAlarmCounter = 0; + handler(0xe,HandlerSigAlarm); + ov.it_value.tv_usec = 0; + SigAlarmCounter = SigAlarmCounter + 1; + setitimer(ITIMER_REAL,(itimerval *)&ov.it_value.tv_usec,(itimerval *)local_2c); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitTime(void) + +{ + undefined1 local_2c [4]; + itimerval ov; + itimerval v; + + ov.it_value.tv_usec = 0; + setitimer(ITIMER_REAL,(itimerval *)&ov.it_value.tv_usec,(itimerval *)local_2c); + handler(0xe,(_func_void_int *)0x1); + return; +} + + + +void SigHupHandler(int param_1) + +{ + return; +} + + + +void SigAbortHandler(int param_1) + +{ + print(); + AbortWriter(); + return; +} + + + +void HandlerSigUsr1(int param_1) + +{ + SigUsr1Counter = SigUsr1Counter + 1; + return; +} + + + +// WARNING: Variable defined which should be unmapped: s + +void DefaultHandler(int signo) + +{ + int local_94; + int Hour; + int Minute; + char s [128]; + + snprintf((char *)&Minute,0x80,"SigNr. %d: %s",signo,*(undefined4 *)(sys_siglist + signo * 4)); + print(); + handler(2,(_func_void_int *)0x1); + handler(3,(_func_void_int *)0x1); + handler(0xf,(_func_void_int *)0x1); + handler(0x18,(_func_void_int *)0x1); + handler(0x19,(_func_void_int *)0x1); + handler(0x1e,(_func_void_int *)0x1); + SaveMapOn = false; + if (((signo == 3) || (signo == 0xf)) || (signo == 0x1e)) { + SaveMapOn = true; + } + if (signo == 0xf) { + GetRealTime(&local_94,&Hour); + RebootTime = (Hour + 6 + local_94 * 0x3c) % 0x5a0; + CloseGame(); + } + else { + EndGame(); + } + Reboot = false; + return; +} + + + +void ErrorHandler(int signo) + +{ + char local_8c [4]; + char s [128]; + + snprintf(local_8c,0x80,"SigNr. %d: %s",signo,*(undefined4 *)(sys_siglist + signo * 4)); + error("ErrorHandler: %s\n",local_8c); + EndGame(); + LogoutAllPlayers(); + // WARNING: Subroutine does not return + exit(1); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitSignalHandler(void) + +{ + int count; + + handler(1,SigHupHandler); + handler(2,DefaultHandler); + handler(3,DefaultHandler); + handler(6,SigAbortHandler); + handler(10,(_func_void_int *)0x1); + handler(0xc,(_func_void_int *)0x1); + handler(0xd,(_func_void_int *)0x1); + handler(0xe,(_func_void_int *)0x1); + handler(0xf,DefaultHandler); + handler(0x10,(_func_void_int *)0x1); + handler(0x11,(_func_void_int *)0x1); + handler(0x14,(_func_void_int *)0x1); + handler(0x15,(_func_void_int *)0x1); + handler(0x16,(_func_void_int *)0x1); + handler(0x17,(_func_void_int *)0x1); + handler(0x18,DefaultHandler); + handler(0x19,DefaultHandler); + handler(0x1a,(_func_void_int *)0x1); + handler(0x1c,(_func_void_int *)0x1); + handler(0x1d,(_func_void_int *)0x1); + handler(0x1e,DefaultHandler); + print(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitSignalHandler(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void UnlockGame(void) + +{ + int iVar1; + __pid_t _Var2; + int local_1140; + int Pid; + ifstream IF; + undefined4 local_1134 [3]; + uint auStack_1128 [23]; + __basic_file local_10cc [25]; + undefined1 local_10b3; + undefined *local_10ac; + ios_base local_10a8 [16]; + uint local_1098; + char local_101c [4]; + char FileName [4096]; + + std::ios_base::ios_base(local_10a8); + local_10ac = (undefined *)0x8128950; + // try { // try from 0804bd94 to 0804bd98 has its CatchHandler @ 0804bf54 + std::istream::istream((istream *)&Pid,(streambuf *)(std::ifstream::VTT + 4)); + Pid = (int)&DAT_08128994; + local_10ac = &DAT_081289a8; + // try { // try from 0804bdb8 to 0804bdbc has its CatchHandler @ 0804bf50 + std::filebuf::filebuf((filebuf *)local_1134); + // try { // try from 0804bdca to 0804bdce has its CatchHandler @ 0804bf14 + std::ios::init((EVP_PKEY_CTX *)&local_10ac); + strcpy(local_101c,SAVEPATH); + strcat(local_101c,"/game.pid"); + // try { // try from 0804be04 to 0804be36 has its CatchHandler @ 0804bf58 + iVar1 = std::filebuf::open((char *)local_1134,(int)local_101c,8); + if (iVar1 == 0) { + std::ios::clear((istream *)&Pid + *(int *)(Pid + -0xc), + *(uint *)((int)auStack_1128 + *(int *)(Pid + -0xc)) | 4); + } + if ((local_1098 & 5) == 0) { + std::istream::operator>>((istream *)&Pid,&local_1140); + iVar1 = std::filebuf::close((int)local_1134); + if (iVar1 == 0) { + // try { // try from 0804bee1 to 0804bf0e has its CatchHandler @ 0804bf58 + std::ios::clear((istream *)&Pid + *(int *)(Pid + -0xc), + *(uint *)((int)auStack_1128 + *(int *)(Pid + -0xc)) | 4); + } + _Var2 = getpid(); + if (local_1140 == _Var2) { + unlink(local_101c); + } + } + Pid = (int)&DAT_08128994; + local_10ac = &DAT_081289a8; + local_1134[0] = 0x8128ad0; + std::filebuf::close((int)local_1134); + local_10b3 = 0; + std::__basic_file::~__basic_file(local_10cc); + std::streambuf::~streambuf((streambuf *)local_1134); + std::istream::~istream((istream *)&Pid); + std::ios::~ios((ios *)&local_10ac); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LockGame(void) + +{ + uint uVar1; + int iVar2; + ulong uVar3; + undefined4 *puVar4; + int local_1260; + int Pid; + char FileName [4096]; + ofstream OF; + uint auStack_250 [24]; + __basic_file local_1f0 [25]; + undefined1 local_1d7; + undefined *local_1d0; + ios_base local_1cc [144]; + undefined *local_13c; + ifstream IF; + undefined4 local_134 [3]; + uint auStack_128 [23]; + __basic_file local_cc [25]; + undefined1 local_b3; + undefined *local_ac; + ios_base local_a8 [16]; + uint local_98; + + // try { // try from 0804bff1 to 0804bff5 has its CatchHandler @ 0804c550 + std::ios_base::ios_base(local_a8); + local_ac = (undefined *)0x8128950; + // try { // try from 0804c014 to 0804c018 has its CatchHandler @ 0804c3f0 + std::istream::istream((istream *)&local_13c,(streambuf *)(std::ifstream::VTT + 4)); + local_13c = &DAT_08128994; + local_ac = &DAT_081289a8; + // try { // try from 0804c038 to 0804c03c has its CatchHandler @ 0804c3e7 + std::filebuf::filebuf((filebuf *)local_134); + // try { // try from 0804c050 to 0804c054 has its CatchHandler @ 0804c3a0 + std::ios::init((EVP_PKEY_CTX *)&local_ac); + // try { // try from 0804c05e to 0804c062 has its CatchHandler @ 0804c546 + std::ios_base::ios_base(local_1cc); + local_1d0 = (undefined *)0x8128950; + // try { // try from 0804c087 to 0804c08b has its CatchHandler @ 0804c4be + std::ostream::ostream((ostream *)(FileName + 0xffc),(streambuf *)(std::ofstream::VTT + 4)); + FileName._4092_4_ = &DAT_08128a64; + local_1d0 = &DAT_08128a78; + // try { // try from 0804c0ab to 0804c0af has its CatchHandler @ 0804c4b5 + std::filebuf::filebuf((filebuf *)&OF); + // try { // try from 0804c0c3 to 0804c0c7 has its CatchHandler @ 0804c3f6 + std::ios::init((EVP_PKEY_CTX *)&local_1d0); + strcpy((char *)&Pid,SAVEPATH); + strcat((char *)&Pid,"/game.pid"); + // try { // try from 0804c103 to 0804c194 has its CatchHandler @ 0804c4c7 + iVar2 = std::filebuf::open((char *)local_134,(int)&Pid,8); + if (iVar2 == 0) { + std::ios::clear((istream *)&local_13c + *(int *)(local_13c + -0xc), + *(uint *)((int)auStack_128 + *(int *)(local_13c + -0xc)) | 4); + } + if ((local_98 & 5) == 0) { + std::istream::operator>>((istream *)&local_13c,&local_1260); + iVar2 = std::filebuf::close((int)local_134); + if (iVar2 == 0) { + std::ios::clear((istream *)&local_13c + *(int *)(local_13c + -0xc), + *(uint *)((int)auStack_128 + *(int *)(local_13c + -0xc)) | 4); + } + if (local_1260 != 0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "Game-Server is already running, PID file exists."; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char_const*::typeinfo,0); + } + } + else { + iVar2 = std::filebuf::close((int)local_134); + if (iVar2 == 0) { + std::ios::clear((istream *)&local_13c + *(int *)(local_13c + -0xc), + *(uint *)((int)auStack_128 + *(int *)(local_13c + -0xc)) | 4); + } + iVar2 = std::filebuf::open((char *)&OF,(int)&Pid,0x30); + if (iVar2 == 0) { + std::ios::clear(FileName + *(int *)(FileName._4092_4_ + -0xc) + 0xffc, + *(uint *)((int)auStack_250 + *(int *)(FileName._4092_4_ + -0xc) + 8) | 4 + ); + } + uVar3 = getpid(); + uVar1 = *(uint *)((int)auStack_250 + *(int *)(FileName._4092_4_ + -0xc)); + if (((uVar1 & 0x40) == 0) && ((uVar1 & 8) == 0)) { + // try { // try from 0804c2a1 to 0804c397 has its CatchHandler @ 0804c4c7 + std::ostream::operator<<((ostream *)(FileName + 0xffc),uVar3); + } + else { + std::ostream::operator<<((ostream *)(FileName + 0xffc),uVar3); + } + atexit(UnlockGame); + } + FileName._4092_4_ = &DAT_08128a64; + local_1d0 = &DAT_08128a78; + _OF = 0x8128ad0; + // try { // try from 0804c1cb to 0804c216 has its CatchHandler @ 0804c546 + std::filebuf::close((int)&OF); + local_1d7 = 0; + std::__basic_file::~__basic_file(local_1f0); + std::streambuf::~streambuf((streambuf *)&OF); + std::ostream::~ostream((ostream *)(FileName + 0xffc)); + std::ios::~ios((ios *)&local_1d0); + local_13c = &DAT_08128994; + local_ac = &DAT_081289a8; + local_134[0] = 0x8128ad0; + // try { // try from 0804c241 to 0804c286 has its CatchHandler @ 0804c550 + std::filebuf::close((int)local_134); + local_b3 = 0; + std::__basic_file::~__basic_file(local_cc); + std::streambuf::~streambuf((streambuf *)local_134); + std::istream::~istream((istream *)&local_13c); + std::ios::~ios((ios *)&local_ac); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadWorldConfig(void) + +{ + TQueryManagerConnection *this; + int iVar1; + undefined4 *puVar2; + TWorldType *pTVar3; + int *piVar4; + int *piVar5; + int *piVar6; + int *piVar7; + int *piVar8; + int *piVar9; + int *piVar10; + TWorldType local_60; + int HelpWorldType; + int HelpGameAddress [4]; + TQueryManagerConnection Connection; + + this = (TQueryManagerConnection *)(HelpGameAddress + 3); + // try { // try from 0804c590 to 0804c594 has its CatchHandler @ 0804c6b7 + TQueryManagerConnection::TQueryManagerConnection(this,0x4000); + if (Connection.WriteBuffer.Position < 0) { + error("LoadWorldConfig: Kann nicht zum Query-Manager verbinden.\n"); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "cannot connect to querymanager"; + } + else { + piVar10 = &PremiumNewbieBuffer; + piVar5 = &HelpWorldType; + pTVar3 = &local_60; + piVar9 = &MaxNewbies; + piVar8 = &PremiumPlayerBuffer; + piVar7 = &MaxPlayers; + piVar6 = &GamePort; + piVar4 = &RebootTime; + // try { // try from 0804c5e6 to 0804c5ea has its CatchHandler @ 0804c6a0 + iVar1 = TQueryManagerConnection::loadWorldConfig(this); + if (iVar1 == 0) { + iVar1 = 0x10; + WorldType = local_60; + snprintf(GameAddress,0x10,"%d.%d.%d.%d",HelpWorldType,HelpGameAddress[0], + HelpGameAddress[1],HelpGameAddress[2]); + // try { // try from 0804c632 to 0804c636 has its CatchHandler @ 0804c6b7 + TQueryManagerConnection::~TQueryManagerConnection(this,iVar1); + return; + } + // try { // try from 0804c64b to 0804c685 has its CatchHandler @ 0804c6a0 + error("LoadWorldConfig: Kann Konfigurationsdaten nicht holen.\n",pTVar3,piVar4,piVar5,piVar6 + ,piVar7,piVar8,piVar9,piVar10); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "cannot load world config"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitAll(void) + +{ + uint __seed; + undefined1 local_2c [4]; + itimerval ov; + itimerval v; + + // try { // try from 0804c6d9 to 0804c7d4 has its CatchHandler @ 0804c7e0 + ReadConfig(); + SetQueryManagerLoginData(1,WorldName); + LoadWorldConfig(); + InitSHM((bool)(BeADaemon ^ 1)); + LockGame(); + InitLog("game"); + __seed = time((time_t *)0x0); + srand(__seed); + InitSignalHandler(); + InitConnections(); + InitCommunication(); + InitStrings(); + InitWriter(); + InitReader(); + InitObjects(); + InitMap(); + InitInfo(); + InitMoveUse(); + InitMagic(); + InitCr(); + InitHouses(); + SigAlarmCounter = 0; + handler(0xe,HandlerSigAlarm); + SigAlarmCounter = SigAlarmCounter + 1; + ov.it_value.tv_usec = 0; + setitimer(ITIMER_REAL,(itimerval *)&ov.it_value.tv_usec,(itimerval *)local_2c); + ApplyPatches(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitAll(void) + +{ + undefined1 local_2c [4]; + itimerval ov; + itimerval v; + + EndGame(); + ov.it_value.tv_usec = 0; + setitimer(ITIMER_REAL,(itimerval *)&ov.it_value.tv_usec,(itimerval *)local_2c); + handler(0xe,(_func_void_int *)0x1); + ExitCr(); + ExitMagic(); + ExitMoveUse(); + ExitInfo(); + ExitHouses(); + ExitMap(SaveMapOn); + ExitObjects(); + ExitReader(); + ExitWriter(); + ExitStrings(); + ExitCommunication(); + ExitConnections(); + ExitSHM(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LaunchGame(void) + +{ + int iVar1; + bool bVar2; + + SigUsr1Counter = 0; + handler(10,HandlerSigUsr1); + StartGame(); + getpid(); + print(); + SaveMapOn = true; + SigAlarmCounter = 0; + while (bVar2 = GameRunning(), bVar2) { + sigblock(0x200); + while ((SigUsr1Counter == 0 && (SigAlarmCounter == 0))) { + __sigpause(0,0); + } + if (0 < SigUsr1Counter) { + SigUsr1Counter = 0; + ReceiveData(); + } + iVar1 = SigAlarmCounter; + if (0 < SigAlarmCounter) { + SigAlarmCounter = 0; + AdvanceGame(iVar1 * Beat); + } + } + LogoutAllPlayers(); + return; +} + + + +int DaemonInit(bool NoFork) + +{ + pid_t Pid; + __pid_t _Var1; + long lVar2; + int i; + int __fd; + int iVar3; + int openmax; + + if (!NoFork) { + _Var1 = fork(); + if (_Var1 < 0) { + return 1; + } + if (_Var1 != 0) { + // WARNING: Subroutine does not return + exit(0); + } + setsid(); + } + umask(0); + umask(0x7f); + chdir(SAVEPATH); + lVar2 = sysconf(4); + if (lVar2 < 0) { + lVar2 = 0x400; + } + __fd = 0; + if (0 < lVar2) { + do { + iVar3 = __fd + 1; + close(__fd); + __fd = iVar3; + } while (iVar3 < lVar2); + } + return 0; +} + + + +int main(int argc,char **argv) + +{ + RESULT r; + int iVar1; + char *pcVar2; + char *pcVar3; + bool bVar4; + int local_1024; + int i; + char local_101c [3]; + bool NoFork; + char FileName [4096]; + + local_1024 = 1; + bVar4 = argc == 1; + i._3_1_ = false; + BeADaemon = false; + Reboot = true; + if (1 < argc) { + do { + iVar1 = 7; + pcVar2 = argv[local_1024]; + pcVar3 = "daemon"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = *pcVar2 == *pcVar3; + pcVar2 = pcVar2 + 1; + pcVar3 = pcVar3 + 1; + } while (bVar4); + if (bVar4) { + BeADaemon = true; + } + iVar1 = 7; + pcVar2 = argv[local_1024]; + pcVar3 = "nofork"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = *pcVar2 == *pcVar3; + pcVar2 = pcVar2 + 1; + pcVar3 = pcVar3 + 1; + } while (bVar4); + if (bVar4) { + i._3_1_ = true; + } + local_1024 = local_1024 + 1; + bVar4 = local_1024 == argc; + } while (local_1024 < argc); + } + if (((BeADaemon != false) || + (puts("Tibia Game-Server\n(c) by CIP Productions, 2003.\n"), BeADaemon != false)) && + (iVar1 = DaemonInit(i._3_1_), iVar1 != 0)) { + return 2; + } + InitAll(); + atexit(ExitAll); + // try { // try from 0804cb24 to 0804cb28 has its CatchHandler @ 0804cbb5 + LaunchGame(); + if (Reboot != false) { + UnlockGame(); + sprintf(local_101c,"%s/reboot-daily",BINPATH); + bVar4 = FileExists(local_101c); + if (bVar4) { + ExitAll(); + print(); + execv(local_101c,argv); + } + } + print(); + return 0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_BeADaemon(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +_func_void_int * handler(int signr,_func_void_int *sighandler) + +{ + int iVar1; + _union_1051 _Var2; + _union_1051 local_12c; + sigaction alt_handler; + _union_1051 local_9c; + sigaction neu_handler; + + local_9c.sa_handler = (__sighandler_t)sighandler; + sigemptyset((sigset_t *)&neu_handler); + neu_handler.sa_mask.__val[0x1f] = 0x20000000; + if (signr != 0xe) { + neu_handler.sa_mask.__val[0x1f] = 0x10000000; + } + iVar1 = sigaction(signr,(sigaction *)&local_9c,(sigaction *)&local_12c); + _Var2 = (_union_1051)0xffffffff; + if (-1 < iVar1) { + _Var2 = local_12c; + } + return (_func_void_int *)_Var2.sa_handler; +} + + + +bool isSpace(int c) + +{ + bool bVar1; + + bVar1 = false; + if ((((c == 0x20) || (c == 0xc)) || (c == 10)) || (((c == 0xd || (c == 9)) || (c == 0xb)))) { + bVar1 = true; + } + return bVar1; +} + + + +bool isAlpha(int c) + +{ + bool bVar1; + + bVar1 = false; + if ((((((c - 0x61U < 0x1a) || (c - 0x41U < 0x1a)) || (c == -0x1c)) || ((c == -10 || (c == -4)))) + || ((c == -0x3c || ((c == -0x2a || (c == -0x24)))))) || (c == -0x21)) { + bVar1 = true; + } + return bVar1; +} + + + +bool isEngAlpha(int c) + +{ + bool bVar1; + + bVar1 = false; + if ((c - 0x61U < 0x1a) || (c - 0x41U < 0x1a)) { + bVar1 = true; + } + return bVar1; +} + + + +bool isDigit(int c) + +{ + return c - 0x30U < 10; +} + + + +int toLower(int c) + +{ + if ((c - 0x41U < 0x1a) || ((byte)((char)(c - 0x41U) + 0x81U) < 0x1f)) { + c = c + 0x20; + } + return c; +} + + + +int toUpper(int c) + +{ + if ((c - 0x61U < 0x1a) || ((byte)((char)(c - 0x61U) + 0x81U) < 0x1f)) { + c = c + -0x20; + } + return c; +} + + + +char * strLower(char *s) + +{ + char cVar1; + int i; + int iVar2; + + iVar2 = 0; + cVar1 = *s; + while (cVar1 != '\0') { + if (((int)cVar1 - 0x41U < 0x1a) || ((byte)((char)((int)cVar1 - 0x41U) + 0x81U) < 0x1f)) { + cVar1 = cVar1 + ' '; + } + s[iVar2] = cVar1; + iVar2 = iVar2 + 1; + cVar1 = s[iVar2]; + } + return s; +} + + + +char * strUpper(char *s) + +{ + char cVar1; + int i; + int iVar2; + + iVar2 = 0; + cVar1 = *s; + while (cVar1 != '\0') { + if (((int)cVar1 - 0x61U < 0x1a) || ((byte)((char)((int)cVar1 - 0x61U) + 0x81U) < 0x1f)) { + cVar1 = cVar1 + -0x20; + } + s[iVar2] = cVar1; + iVar2 = iVar2 + 1; + cVar1 = s[iVar2]; + } + return s; +} + + + +int stricmp(char *s1,char *s2,int Pos) + +{ + char cVar1; + int iVar2; + int iVar3; + int i; + int iVar4; + + iVar4 = 0; + while( true ) { + if (iVar4 == Pos) { + return 0; + } + cVar1 = s1[iVar4]; + iVar2 = (int)cVar1; + if ((iVar2 - 0x41U < 0x1a) || ((byte)((char)(iVar2 - 0x41U) + 0x81U) < 0x1f)) { + iVar2 = iVar2 + 0x20; + } + iVar3 = (int)s2[iVar4]; + if ((iVar3 - 0x41U < 0x1a) || ((byte)((char)(iVar3 - 0x41U) + 0x81U) < 0x1f)) { + iVar3 = iVar3 + 0x20; + } + if (iVar3 < iVar2) break; + iVar2 = (int)cVar1; + if ((iVar2 - 0x41U < 0x1a) || ((byte)((char)(iVar2 - 0x41U) + 0x81U) < 0x1f)) { + iVar2 = iVar2 + 0x20; + } + iVar3 = (int)s2[iVar4]; + if ((iVar3 - 0x41U < 0x1a) || ((byte)((char)(iVar3 - 0x41U) + 0x81U) < 0x1f)) { + iVar3 = iVar3 + 0x20; + } + if (iVar2 < iVar3) { + return -1; + } + if (cVar1 == '\0') { + return 0; + } + iVar4 = iVar4 + 1; + } + return 1; +} + + + +char * findFirst(char *s,char c) + +{ + char *pcVar1; + + pcVar1 = strchr(s,(int)c); + return pcVar1; +} + + + +char * findLast(char *s,char c) + +{ + char *pcVar1; + char *p; + char *pcVar2; + + pcVar2 = (char *)0x0; + while( true ) { + pcVar1 = strchr(s,(int)c); + if (pcVar1 == (char *)0x0) break; + s = pcVar1 + 1; + pcVar2 = pcVar1; + } + return pcVar2; +} + + + +void SetPrintFunction(TPrintFunction *Function) + +{ + PrintFunction = Function; + return; +} + + + +void SetErrorFunction(TErrorFunction *Function) + +{ + ErrorFunction = Function; + return; +} + + + +void SilentHandler(int param_1,char *param_2) + +{ + return; +} + + + +void SilentHandler(char *param_1) + +{ + return; +} + + + +void LogfileHandler(int param_1,char *Text) + +{ + FILE *__stream; + int iVar1; + FILE *f; + + if (StandardLogfile[0] != '\0') { + __stream = fopen(StandardLogfile,"at"); + if (__stream != (FILE *)0x0) { + fprintf(__stream,"%s",Text); + iVar1 = fclose(__stream); + if (iVar1 != 0) { + __errno_location(); + error(&DAT_080eeb60); + return; + } + } + } + return; +} + + + +void LogfileHandler(char *Text) + +{ + FILE *__stream; + int iVar1; + int *piVar2; + FILE *f; + + if (StandardLogfile[0] != '\0') { + __stream = fopen(StandardLogfile,"at"); + if (__stream != (FILE *)0x0) { + fprintf(__stream,"%s",Text); + iVar1 = fclose(__stream); + if (iVar1 != 0) { + piVar2 = __errno_location(); + error(&DAT_080eeb60,*piVar2); + } + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void print(void) + +{ + int in_stack_00000004; + char *in_stack_00000008; + char local_40c [4]; + char s [1024]; + + vsnprintf(local_40c,0x400,in_stack_00000008,&stack0x0000000c); + if (PrintFunction == (TPrintFunction *)0x0) { + printf("%s",local_40c); + } + else { + (*PrintFunction)(in_stack_00000004,local_40c); + } + return; +} + + + +void error(char *Text,...) + +{ + char local_40c [4]; + char s [1024]; + + vsnprintf(local_40c,0x400,Text,&stack0x00000008); + if (ErrorFunction == (TErrorFunction *)0x0) { + printf("%s",local_40c); + } + else { + (*ErrorFunction)(local_40c); + } + return; +} + + + +// DWARF original prototype: bool readFlag(TReadStream * this) + +bool __thiscall TReadStream::readFlag(TReadStream *this) + +{ + int iVar1; + + // try { // try from 0804d1ce to 0804d1d0 has its CatchHandler @ 0804d1e0 + iVar1 = (*this->_vptr_TReadStream[1])(this); + return (char)iVar1 != '\0'; +} + + + +// WARNING: Variable defined which should be unmapped: Lo +// DWARF original prototype: ushort readWord(TReadStream * this) + +ushort __thiscall TReadStream::readWord(TReadStream *this) + +{ + uchar Hi; + int iVar1; + uint uVar2; + uchar Lo; + + // try { // try from 0804d211 to 0804d21e has its CatchHandler @ 0804d232 + iVar1 = (*this->_vptr_TReadStream[1])(this); + uVar2 = (*this->_vptr_TReadStream[1])(this); + return (ushort)(byte)iVar1 | (ushort)((uVar2 & 0xff) << 8); +} + + + +// WARNING: Variable defined which should be unmapped: hi +// DWARF original prototype: ulong readQuad(TReadStream * this) + +ulong __thiscall TReadStream::readQuad(TReadStream *this) + +{ + int iVar1; + int iVar2; + int iVar3; + int iVar4; + uchar Hi; + uchar hi; + uchar lo; + uchar Lo; + + // try { // try from 0804d261 to 0804d284 has its CatchHandler @ 0804d2b0 + iVar1 = (*this->_vptr_TReadStream[1])(this); + iVar2 = (*this->_vptr_TReadStream[1])(this); + iVar3 = (*this->_vptr_TReadStream[1])(this); + iVar4 = (*this->_vptr_TReadStream[1])(this); + return (uint)CONCAT12((char)iVar3,CONCAT11((char)iVar2,(char)iVar1)) | iVar4 << 0x18; +} + + + +// DWARF original prototype: void readString(TReadStream * this, char * Buffer, int MaxLength) + +void __thiscall TReadStream::readString(TReadStream *this,char *Buffer,int MaxLength) + +{ + uint uVar1; + undefined4 *puVar2; + int Length; + + if (Buffer != (char *)0x0) { + // try { // try from 0804d2f2 to 0804d3a4 has its CatchHandler @ 0804d3a5 + uVar1 = (*this->_vptr_TReadStream[2])(this); + uVar1 = uVar1 & 0xffff; + if (uVar1 == 0xffff) { + uVar1 = (*this->_vptr_TReadStream[3])(this); + } + *Buffer = '\0'; + if (uVar1 != 0) { + if ((MaxLength < 0) || ((int)uVar1 < MaxLength)) { + (*this->_vptr_TReadStream[5])(this,Buffer,uVar1); + Buffer[uVar1] = '\0'; + } + else { + (*this->_vptr_TReadStream[5])(this,Buffer,MaxLength + -1); + Buffer[MaxLength + -1] = '\0'; + (*this->_vptr_TReadStream[7])(this,(uVar1 - MaxLength) + 1); + } + } + return; + } + error(&DAT_080eeba0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "internal error"; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void readBytes(TReadStream * this, uchar * Buffer, int Count) + +void __thiscall TReadStream::readBytes(TReadStream *this,uchar *Buffer,int Count) + +{ + int iVar1; + undefined4 *puVar2; + int i; + int iVar3; + + if (Buffer == (uchar *)0x0) { + error(&DAT_080eebe0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "internal error"; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); + } + iVar3 = 0; + if (0 < Count) { + do { + // try { // try from 0804d3f5 to 0804d43a has its CatchHandler @ 0804d440 + iVar1 = (*this->_vptr_TReadStream[1])(this); + Buffer[iVar3] = (uchar)iVar1; + iVar3 = iVar3 + 1; + } while (iVar3 < Count); + } + return; +} + + + +// DWARF original prototype: void writeFlag(TWriteStream * this, bool f) + +void __thiscall TWriteStream::writeFlag(TWriteStream *this,bool f) + +{ + // try { // try from 0804d47b to 0804d47d has its CatchHandler @ 0804d482 + (*this->_vptr_TWriteStream[1])(this,(uint)f); + return; +} + + + +// DWARF original prototype: void writeWord(TWriteStream * this, ushort w) + +void __thiscall TWriteStream::writeWord(TWriteStream *this,ushort w) + +{ + // try { // try from 0804d4c1 to 0804d4d7 has its CatchHandler @ 0804d4e2 + (*this->_vptr_TWriteStream[1])(this,w & 0xff); + (*this->_vptr_TWriteStream[1])(this,w >> 8); + return; +} + + + +// DWARF original prototype: void writeQuad(TWriteStream * this, ulong q) + +void __thiscall TWriteStream::writeQuad(TWriteStream *this,ulong q) + +{ + // try { // try from 0804d51e to 0804d553 has its CatchHandler @ 0804d560 + (*this->_vptr_TWriteStream[1])(this,q & 0xff); + (*this->_vptr_TWriteStream[1])(this,q >> 8 & 0xff); + (*this->_vptr_TWriteStream[1])(this,q >> 0x10 & 0xff); + (*this->_vptr_TWriteStream[1])(this,q >> 0x18); + return; +} + + + +// DWARF original prototype: void writeString(TWriteStream * this, char * s) + +void __thiscall TWriteStream::writeString(TWriteStream *this,char *s) + +{ + size_t sVar1; + + if (s == (char *)0x0) { + (*this->_vptr_TWriteStream[2])(this,0); + } + else { + sVar1 = strlen(s); + if ((int)sVar1 < 0xffff) { + (*this->_vptr_TWriteStream[2])(this,sVar1 & 0xffff); + } + else { + // try { // try from 0804d5b7 to 0804d610 has its CatchHandler @ 0804d613 + (*this->_vptr_TWriteStream[2])(this,0xffff); + (*this->_vptr_TWriteStream[3])(this,sVar1); + } + if (sVar1 != 0) { + (*this->_vptr_TWriteStream[5])(this,s,sVar1); + } + } + return; +} + + + +// DWARF original prototype: void writeBytes(TWriteStream * this, uchar * Buffer, int Count) + +void __thiscall TWriteStream::writeBytes(TWriteStream *this,uchar *Buffer,int Count) + +{ + undefined4 *puVar1; + int i; + int iVar2; + + if (Buffer == (uchar *)0x0) { + error(&DAT_080eec20); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "internal error"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); + } + iVar2 = 0; + if (0 < Count) { + do { + // try { // try from 0804d673 to 0804d6b2 has its CatchHandler @ 0804d6b3 + (*this->_vptr_TWriteStream[1])(this,(uint)Buffer[iVar2]); + iVar2 = iVar2 + 1; + } while (iVar2 < Count); + } + return; +} + + + +// DWARF original prototype: void TReadBuffer(TReadBuffer * this, uchar * data, int size) + +void __thiscall TReadBuffer::TReadBuffer(TReadBuffer *this,uchar *data,int size) + +{ + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081267c8; + this->Data = data; + this->Size = size; + this->Position = 0; + if (data == (uchar *)0x0) { + error("TReadBuffer::TReadBuffer: data ist NULL.\n"); + } + else { + if (-1 < size) { + return; + } + error(&DAT_080eec60,size); + } + this->Size = 0; + return; +} + + + +// DWARF original prototype: void TReadBuffer(TReadBuffer * this, uchar * data, int size) + +void __thiscall TReadBuffer::TReadBuffer(TReadBuffer *this,uchar *data,int size) + +{ + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081267c8; + this->Data = data; + this->Size = size; + this->Position = 0; + if (data == (uchar *)0x0) { + error("TReadBuffer::TReadBuffer: data ist NULL.\n"); + } + else { + if (-1 < size) { + return; + } + error(&DAT_080eec60,size); + } + this->Size = 0; + return; +} + + + +// DWARF original prototype: uchar readByte(TReadBuffer * this) + +uchar __thiscall TReadBuffer::readByte(TReadBuffer *this) + +{ + uchar uVar1; + int iVar2; + undefined4 *puVar3; + uchar b; + + iVar2 = this->Position; + if (iVar2 <= this->Size + -1) { + uVar1 = this->Data[iVar2]; + this->Position = iVar2 + 1; + return uVar1; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "buffer empty"; + // WARNING: Subroutine does not return + // try { // try from 0804d7e3 to 0804d7e7 has its CatchHandler @ 0804d7e8 + __cxa_throw(puVar3,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: ushort readWord(TReadBuffer * this) + +ushort __thiscall TReadBuffer::readWord(TReadBuffer *this) + +{ + uchar uVar1; + uchar uVar2; + int iVar3; + ushort w; + undefined4 *puVar4; + + iVar3 = this->Position; + if (iVar3 <= this->Size + -2) { + uVar1 = this->Data[iVar3]; + uVar2 = this->Data[iVar3 + 1]; + this->Position = iVar3 + 2; + return CONCAT11(uVar2,uVar1); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "buffer empty"; + // WARNING: Subroutine does not return + // try { // try from 0804d860 to 0804d864 has its CatchHandler @ 0804d865 + __cxa_throw(puVar4,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: ulong readQuad(TReadBuffer * this) + +ulong __thiscall TReadBuffer::readQuad(TReadBuffer *this) + +{ + uchar uVar1; + uchar uVar2; + uchar uVar3; + uchar uVar4; + int iVar5; + uchar *puVar6; + ulong q; + undefined4 *puVar7; + + iVar5 = this->Position; + if (iVar5 <= this->Size + -4) { + puVar6 = this->Data; + uVar1 = puVar6[iVar5 + 3]; + uVar2 = puVar6[iVar5 + 2]; + uVar3 = puVar6[iVar5 + 1]; + uVar4 = puVar6[iVar5]; + this->Position = iVar5 + 4; + return CONCAT31(CONCAT21(CONCAT11(uVar1,uVar2),uVar3),uVar4); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = "buffer empty"; + // WARNING: Subroutine does not return + // try { // try from 0804d8f6 to 0804d8fa has its CatchHandler @ 0804d8fb + __cxa_throw(puVar7,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void readBytes(TReadBuffer * this, uchar * Buffer, int Count) + +void __thiscall TReadBuffer::readBytes(TReadBuffer *this,uchar *Buffer,int Count) + +{ + undefined4 *puVar1; + + if (Buffer == (uchar *)0x0) { + error(&DAT_080eece0); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer not existing"; + } + else { + if (this->Position <= this->Size - Count) { + memcpy(Buffer,this->Data + this->Position,Count); + this->Position = this->Position + Count; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer empty"; + } + // WARNING: Subroutine does not return + // try { // try from 0804d97c to 0804d98c has its CatchHandler @ 0804d9a1 + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: bool eof(TReadBuffer * this) + +bool __thiscall TReadBuffer::eof(TReadBuffer *this) + +{ + return this->Size <= this->Position; +} + + + +// DWARF original prototype: void skip(TReadBuffer * this, int Count) + +void __thiscall TReadBuffer::skip(TReadBuffer *this,int Count) + +{ + undefined4 *puVar1; + + if (this->Position <= this->Size - Count) { + this->Position = Count + this->Position; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer empty"; + // WARNING: Subroutine does not return + // try { // try from 0804da2d to 0804da31 has its CatchHandler @ 0804da32 + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void TWriteBuffer(TWriteBuffer * this, uchar * data, int size) + +void __thiscall TWriteBuffer::TWriteBuffer(TWriteBuffer *this,uchar *data,int size) + +{ + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_081267a8; + this->Data = data; + this->Size = size; + this->Position = 0; + if (data == (uchar *)0x0) { + error("TWriteBuffer::TWriteBuffer: data ist NULL.\n"); + this->Size = 0; + } + else if (size < 0) { + error(&DAT_080eed20); + return; + } + return; +} + + + +// DWARF original prototype: void TWriteBuffer(TWriteBuffer * this, uchar * data, int size) + +void __thiscall TWriteBuffer::TWriteBuffer(TWriteBuffer *this,uchar *data,int size) + +{ + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_081267a8; + this->Data = data; + this->Size = size; + this->Position = 0; + if (data == (uchar *)0x0) { + error("TWriteBuffer::TWriteBuffer: data ist NULL.\n"); + this->Size = 0; + } + else if (size < 0) { + error(&DAT_080eed20); + return; + } + return; +} + + + +// DWARF original prototype: void writeByte(TWriteBuffer * this, uchar b) + +void __thiscall TWriteBuffer::writeByte(TWriteBuffer *this,uchar b) + +{ + undefined4 *puVar1; + + if (this->Position <= this->Size + -1) { + this->Data[this->Position] = b; + this->Position = this->Position + 1; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer full"; + // WARNING: Subroutine does not return + // try { // try from 0804db5f to 0804db63 has its CatchHandler @ 0804db64 + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeWord(TWriteBuffer * this, ushort w) + +void __thiscall TWriteBuffer::writeWord(TWriteBuffer *this,ushort w) + +{ + undefined4 *puVar1; + + if (this->Position <= this->Size + -2) { + this->Data[this->Position] = (uchar)w; + this->Data[this->Position + 1] = (uchar)(w >> 8); + this->Position = this->Position + 2; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer full"; + // WARNING: Subroutine does not return + // try { // try from 0804dbe0 to 0804dbe4 has its CatchHandler @ 0804dbe5 + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeQuad(TWriteBuffer * this, ulong q) + +void __thiscall TWriteBuffer::writeQuad(TWriteBuffer *this,ulong q) + +{ + undefined4 *puVar1; + + if (this->Position <= this->Size + -4) { + this->Data[this->Position] = (uchar)q; + this->Data[this->Position + 1] = (uchar)(q >> 8); + this->Data[this->Position + 2] = (uchar)(q >> 0x10); + this->Data[this->Position + 3] = (uchar)(q >> 0x18); + this->Position = this->Position + 4; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer full"; + // WARNING: Subroutine does not return + // try { // try from 0804dc79 to 0804dc7d has its CatchHandler @ 0804dc7e + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeBytes(TWriteBuffer * this, uchar * Buffer, int Count) + +void __thiscall TWriteBuffer::writeBytes(TWriteBuffer *this,uchar *Buffer,int Count) + +{ + undefined4 *puVar1; + + if (this->Position <= this->Size - Count) { + memcpy(this->Data + this->Position,Buffer,Count); + this->Position = this->Position + Count; + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "buffer full"; + // WARNING: Subroutine does not return + // try { // try from 0804dd08 to 0804dd0c has its CatchHandler @ 0804dd0d + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void TDynamicWriteBuffer(TDynamicWriteBuffer * this, int InitialSize) + +void __thiscall TDynamicWriteBuffer::TDynamicWriteBuffer(TDynamicWriteBuffer *this,int InitialSize) + +{ + uchar *data; + + data = (uchar *)operator_new__(InitialSize); + TWriteBuffer::TWriteBuffer(&this->super_TWriteBuffer,data,InitialSize); + (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = + (_func_int_varargs **)&PTR_writeFlag_08126768; + return; +} + + + +// DWARF original prototype: void TDynamicWriteBuffer(TDynamicWriteBuffer * this, int InitialSize) + +void __thiscall TDynamicWriteBuffer::TDynamicWriteBuffer(TDynamicWriteBuffer *this,int InitialSize) + +{ + uchar *data; + + data = (uchar *)operator_new__(InitialSize); + TWriteBuffer::TWriteBuffer(&this->super_TWriteBuffer,data,InitialSize); + (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = + (_func_int_varargs **)&PTR_writeFlag_08126768; + return; +} + + + +// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) + +void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) + +{ + uchar *puVar1; + + (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = + (_func_int_varargs **)&PTR_writeFlag_08126768; + puVar1 = (this->super_TWriteBuffer).Data; + if (puVar1 != (uchar *)0x0) { + operator_delete__(puVar1); + } + return; +} + + + +// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) + +void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) + +{ + uchar *puVar1; + + (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = + (_func_int_varargs **)&PTR_writeFlag_08126768; + puVar1 = (this->super_TWriteBuffer).Data; + if (puVar1 != (uchar *)0x0) { + operator_delete__(puVar1); + } + return; +} + + + +// DWARF original prototype: void ~TDynamicWriteBuffer(TDynamicWriteBuffer * this, int __in_chrg) + +void __thiscall TDynamicWriteBuffer::~TDynamicWriteBuffer(TDynamicWriteBuffer *this,int __in_chrg) + +{ + uchar *puVar1; + + puVar1 = (this->super_TWriteBuffer).Data; + (this->super_TWriteBuffer).super_TWriteStream._vptr_TWriteStream = + (_func_int_varargs **)&PTR_writeFlag_08126768; + if (puVar1 != (uchar *)0x0) { + operator_delete__(puVar1); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void resizeBuffer(TDynamicWriteBuffer * this) + +void __thiscall TDynamicWriteBuffer::resizeBuffer(TDynamicWriteBuffer *this) + +{ + int *piVar1; + uchar *puVar2; + uchar *__dest; + uchar *Help; + + __dest = (uchar *)operator_new__((this->super_TWriteBuffer).Size * 2); + memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); + puVar2 = (this->super_TWriteBuffer).Data; + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + piVar1 = &(this->super_TWriteBuffer).Size; + *piVar1 = *piVar1 << 1; + (this->super_TWriteBuffer).Data = __dest; + return; +} + + + +// WARNING: Variable defined which should be unmapped: b_local +// DWARF original prototype: void writeByte(TDynamicWriteBuffer * this, uchar b) + +void __thiscall TDynamicWriteBuffer::writeByte(TDynamicWriteBuffer *this,uchar b) + +{ + int *piVar1; + uchar *puVar2; + uchar *__dest; + int iVar3; + int iVar4; + uchar *Help; + uchar b_local; + + iVar3 = (this->super_TWriteBuffer).Size; + iVar4 = (this->super_TWriteBuffer).Position; + if (iVar3 + -1 < iVar4) { + do { + // try { // try from 0804dee6 to 0804deea has its CatchHandler @ 0804df30 + __dest = (uchar *)operator_new__(iVar3 * 2); + memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); + puVar2 = (this->super_TWriteBuffer).Data; + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + (this->super_TWriteBuffer).Data = __dest; + iVar4 = (this->super_TWriteBuffer).Position; + iVar3 = (this->super_TWriteBuffer).Size * 2; + (this->super_TWriteBuffer).Size = iVar3; + } while (iVar3 + -1 < iVar4); + } + (this->super_TWriteBuffer).Data[iVar4] = b; + piVar1 = &(this->super_TWriteBuffer).Position; + *piVar1 = *piVar1 + 1; + return; +} + + + +// DWARF original prototype: void writeWord(TDynamicWriteBuffer * this, ushort w) + +void __thiscall TDynamicWriteBuffer::writeWord(TDynamicWriteBuffer *this,ushort w) + +{ + int *piVar1; + uchar *puVar2; + uchar *__dest; + int iVar3; + int iVar4; + uchar *Help; + + iVar3 = (this->super_TWriteBuffer).Size; + iVar4 = (this->super_TWriteBuffer).Position; + if (iVar3 + -2 < iVar4) { + do { + // try { // try from 0804dfa6 to 0804dfaa has its CatchHandler @ 0804dff0 + __dest = (uchar *)operator_new__(iVar3 * 2); + memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); + puVar2 = (this->super_TWriteBuffer).Data; + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + (this->super_TWriteBuffer).Data = __dest; + iVar4 = (this->super_TWriteBuffer).Position; + iVar3 = (this->super_TWriteBuffer).Size * 2; + (this->super_TWriteBuffer).Size = iVar3; + } while (iVar3 + -2 < iVar4); + } + (this->super_TWriteBuffer).Data[iVar4] = (uchar)w; + (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 1] = (uchar)(w >> 8); + piVar1 = &(this->super_TWriteBuffer).Position; + *piVar1 = *piVar1 + 2; + return; +} + + + +// DWARF original prototype: void writeQuad(TDynamicWriteBuffer * this, ulong q) + +void __thiscall TDynamicWriteBuffer::writeQuad(TDynamicWriteBuffer *this,ulong q) + +{ + int *piVar1; + uchar *puVar2; + uchar *__dest; + int iVar3; + int iVar4; + uchar *Help; + + iVar3 = (this->super_TWriteBuffer).Size; + iVar4 = (this->super_TWriteBuffer).Position; + if (iVar3 + -4 < iVar4) { + do { + // try { // try from 0804e076 to 0804e07a has its CatchHandler @ 0804e0c0 + __dest = (uchar *)operator_new__(iVar3 * 2); + memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); + puVar2 = (this->super_TWriteBuffer).Data; + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + (this->super_TWriteBuffer).Data = __dest; + iVar4 = (this->super_TWriteBuffer).Position; + iVar3 = (this->super_TWriteBuffer).Size * 2; + (this->super_TWriteBuffer).Size = iVar3; + } while (iVar3 + -4 < iVar4); + } + (this->super_TWriteBuffer).Data[iVar4] = (uchar)q; + (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 1] = (uchar)(q >> 8); + (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 2] = (uchar)(q >> 0x10); + (this->super_TWriteBuffer).Data[(this->super_TWriteBuffer).Position + 3] = (uchar)(q >> 0x18); + piVar1 = &(this->super_TWriteBuffer).Position; + *piVar1 = *piVar1 + 4; + return; +} + + + +// DWARF original prototype: void writeBytes(TDynamicWriteBuffer * this, uchar * Buffer, int Count) + +void __thiscall TDynamicWriteBuffer::writeBytes(TDynamicWriteBuffer *this,uchar *Buffer,int Count) + +{ + int *piVar1; + uchar *puVar2; + uchar *__dest; + int iVar3; + int iVar4; + uchar *Help; + + iVar3 = (this->super_TWriteBuffer).Size; + iVar4 = (this->super_TWriteBuffer).Position; + if (iVar3 - Count < iVar4) { + do { + // try { // try from 0804e136 to 0804e13a has its CatchHandler @ 0804e180 + __dest = (uchar *)operator_new__(iVar3 * 2); + memcpy(__dest,(this->super_TWriteBuffer).Data,(this->super_TWriteBuffer).Size); + puVar2 = (this->super_TWriteBuffer).Data; + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + (this->super_TWriteBuffer).Data = __dest; + iVar4 = (this->super_TWriteBuffer).Position; + iVar3 = (this->super_TWriteBuffer).Size * 2; + (this->super_TWriteBuffer).Size = iVar3; + } while (iVar3 - Count < iVar4); + } + memcpy((this->super_TWriteBuffer).Data + iVar4,Buffer,Count); + piVar1 = &(this->super_TWriteBuffer).Position; + *piVar1 = *piVar1 + Count; + return; +} + + + +int val(char c) + +{ + int iVar1; + + if ((byte)(c - 0x30U) < 10) { + iVar1 = c + -0x30; + } + else if ((byte)(c + 0xbfU) < 6) { + iVar1 = c + -0x37; + } + else if ((byte)(c + 0x9fU) < 6) { + iVar1 = c + -0x57; + } + else { + iVar1 = 0; + } + return iVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +long random(void) + +{ + int iVar1; + int iVar2; + int range; + int in_stack_00000004; + int in_stack_00000008; + + iVar1 = (in_stack_00000008 - in_stack_00000004) + 1; + if (0 < iVar1) { + iVar2 = rand(); + in_stack_00000004 = iVar2 % iVar1 + in_stack_00000004; + } + return in_stack_00000004; +} + + + +bool FileExists(char *FileName) + +{ + int *piVar1; + int iVar2; + bool bVar3; + undefined1 local_6c [4]; + stat Buffer; + + piVar1 = __errno_location(); + *piVar1 = 0; + iVar2 = __xstat(3,FileName,(stat *)local_6c); + bVar3 = true; + if (iVar2 != 0) { + if (*piVar1 != 2) { + error("FileExists: Unerwarteter Fehlercode %d.\n",*piVar1); + } + bVar3 = false; + } + return bVar3; +} + + + +void TreatAllFiles(char *Directory,char *Extension,TFileHandlerFunction *Function) + +{ + uint *__dest; + dirent *DirectoryEntry; + DIR *__dirp; + dirent *pdVar1; + char *pcVar2; + size_t sVar3; + int iVar4; + uint uVar5; + uint uVar6; + uint *puVar7; + uint *puVar8; + DIR *WorkingDirectory; + bool bVar9; + char local_105c [4]; + char Name [64]; + char FileName [4096]; + + __dirp = opendir(Directory); + if (__dirp != (DIR *)0x0) { + while (pdVar1 = readdir(__dirp), pdVar1 != (dirent *)0x0) { + __dest = (uint *)(Name + 0x3c); + strcpy((char *)__dest,pdVar1->d_name); + puVar8 = __dest; + do { + puVar7 = puVar8; + uVar5 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar6 = uVar5 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar6 == 0); + bVar9 = (uVar5 & 0x8080) == 0; + if (bVar9) { + uVar6 = uVar6 >> 0x10; + } + if (bVar9) { + puVar8 = (uint *)((int)puVar7 + 6); + } + pcVar2 = (char *)strlen(Extension); + puVar7 = __dest; + if (pcVar2 < (char *)((int)puVar8 + + ((-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6)) - (int)__dest))) { + do { + puVar8 = puVar7; + uVar5 = *puVar8 + 0xfefefeff & ~*puVar8; + uVar6 = uVar5 & 0x80808080; + puVar7 = puVar8 + 1; + } while (uVar6 == 0); + bVar9 = (uVar5 & 0x8080) == 0; + if (bVar9) { + uVar6 = uVar6 >> 0x10; + } + puVar7 = (uint *)((int)puVar8 + 6); + if (!bVar9) { + puVar7 = puVar8 + 1; + } + sVar3 = strlen(Extension); + iVar4 = strcmp((char *)((int)puVar7 + + ((-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6)) - sVar3)), + Extension); + if (iVar4 == 0) { + local_105c[0] = '\0'; + local_105c[1] = '\0'; + local_105c[2] = '\0'; + local_105c[3] = '\0'; + Name[0] = '\0'; + Name[1] = '\0'; + Name[2] = '\0'; + Name[3] = '\0'; + Name[4] = '\0'; + Name[5] = '\0'; + Name[6] = '\0'; + Name[7] = '\0'; + Name[0xc] = '\0'; + Name[0xd] = '\0'; + Name[0xe] = '\0'; + Name[0xf] = '\0'; + Name[0x10] = '\0'; + Name[0x11] = '\0'; + Name[0x12] = '\0'; + Name[0x13] = '\0'; + Name[0x14] = '\0'; + Name[0x15] = '\0'; + Name[0x16] = '\0'; + Name[0x17] = '\0'; + Name[0x18] = '\0'; + Name[0x19] = '\0'; + Name[0x1a] = '\0'; + Name[0x1b] = '\0'; + Name[0x1c] = '\0'; + Name[0x1d] = '\0'; + Name[0x1e] = '\0'; + Name[0x1f] = '\0'; + Name[8] = '\0'; + Name[9] = '\0'; + Name[10] = '\0'; + Name[0xb] = '\0'; + Name[0x20] = '\0'; + Name[0x21] = '\0'; + Name[0x22] = '\0'; + Name[0x23] = '\0'; + Name[0x24] = '\0'; + Name[0x25] = '\0'; + Name[0x26] = '\0'; + Name[0x27] = '\0'; + Name[0x28] = '\0'; + Name[0x29] = '\0'; + Name[0x2a] = '\0'; + Name[0x2b] = '\0'; + Name[0x30] = '\0'; + Name[0x31] = '\0'; + Name[0x32] = '\0'; + Name[0x33] = '\0'; + Name[0x34] = '\0'; + Name[0x35] = '\0'; + Name[0x36] = '\0'; + Name[0x37] = '\0'; + Name[0x2c] = '\0'; + Name[0x2d] = '\0'; + Name[0x2e] = '\0'; + Name[0x2f] = '\0'; + Name[0x38] = '\0'; + Name[0x39] = '\0'; + Name[0x3a] = '\0'; + Name[0x3b] = '\0'; + puVar8 = __dest; + do { + puVar7 = puVar8; + uVar5 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar6 = uVar5 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar6 == 0); + bVar9 = (uVar5 & 0x8080) == 0; + if (bVar9) { + uVar6 = uVar6 >> 0x10; + } + if (bVar9) { + puVar8 = (uint *)((int)puVar7 + 6); + } + sVar3 = strlen(Extension); + strncpy(local_105c,(char *)__dest, + (size_t)((int)puVar8 + + (((-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6)) - (int)__dest) - + sVar3))); + (*Function)(Directory,local_105c,Extension); + } + } + } + closedir(__dirp); + } + return; +} + + + +void SendMail(char *Address,char *Subject,char *Text) + +{ + uint *puVar1; + int iVar2; + size_t sVar3; + int iVar4; + __pid_t _Var5; + int *piVar6; + uint *puVar7; + uint *puVar8; + uint uVar9; + uint uVar10; + char_0_ *Content; + bool bVar11; + int iStack_b0; + uint auStack_94 [4]; + undefined4 local_84; + int inode [2]; + stat StatBuffer; + + iStack_b0 = 0x804e4b9; + sVar3 = strlen(Text); + iVar2 = -(sVar3 + 0x7df & 0xfffffff0); + *(undefined1 *)((int)auStack_94 + iVar2) = 0; + puVar1 = (uint *)((int)auStack_94 + iVar2); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char **)(&stack0xffffff58 + iVar2) = "From: %s\n"; + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(char **)(&stack0xffffff5c + iVar2) = SendMail::sender; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e519; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char **)(&stack0xffffff58 + iVar2) = "To: %s\n"; + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(char **)(&stack0xffffff5c + iVar2) = Address; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e567; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char **)(&stack0xffffff58 + iVar2) = "Subject: %s\n"; + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(char **)(&stack0xffffff5c + iVar2) = Subject; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e5b7; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char **)(&stack0xffffff58 + iVar2) = "Reply-To: %s\n"; + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(char **)(&stack0xffffff5c + iVar2) = SendMail::replyto; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e609; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char **)(&stack0xffffff58 + iVar2) = "X-Mailer: %s\n"; + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(char **)(&stack0xffffff5c + iVar2) = SendMail::xmailer; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e659; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + *(char **)(&stack0xffffff58 + iVar2) = "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e6a0; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + *(char **)(&stack0xffffff58 + iVar2) = "\n"; + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e6f0; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + puVar8 = puVar1; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + *(char **)(&stack0xffffff5c + iVar2) = Text; + *(char **)(&stack0xffffff58 + iVar2) = "%s\n"; + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(uint *)((int)auStack_94 + iVar2 + -0x18) = + (int)puVar8 + (-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)); + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e744; + sprintf(*(char **)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2)); + *(undefined4 *)((int)auStack_94 + iVar2 + -0x18) = 3; + *(int **)(&stack0xffffff5c + iVar2) = inode + 1; + *(char **)(&stack0xffffff58 + iVar2) = SendMail::mailer; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e761; + iVar4 = __xstat(*(int *)((int)auStack_94 + iVar2 + -0x18),*(char **)(&stack0xffffff58 + iVar2), + *(stat **)(&stack0xffffff5c + iVar2)); + if (iVar4 == 0) { + *(undefined4 **)((int)auStack_94 + iVar2 + -0x18) = &local_84; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e78f; + iVar4 = pipe(*(int **)((int)auStack_94 + iVar2 + -0x18)); + if (iVar4 == 0) { + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e7a6; + _Var5 = fork(); + if (-1 < _Var5) { + puVar8 = puVar1; + if (_Var5 == 0) { + *(undefined4 *)(&stack0xffffff58 + iVar2) = 0; + *(undefined4 *)((int)auStack_94 + iVar2 + -0x18) = local_84; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e86a; + dup2(*(int *)((int)auStack_94 + iVar2 + -0x18), + *(int *)(&stack0xffffff58 + iVar2)); + *(undefined4 *)((int)auStack_94 + iVar2 + -0x18) = local_84; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e875; + iVar4 = close(*(int *)((int)auStack_94 + iVar2 + -0x18)); + if (iVar4 < 0) { + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8e8; + piVar6 = __errno_location(); + iVar4 = *piVar6; + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eefa0; + *(int *)(&stack0xffffff58 + iVar2) = iVar4; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8fa; + error(*(char **)((int)auStack_94 + iVar2 + -0x18)); + } + *(int *)((int)auStack_94 + iVar2 + -0x18) = inode[0]; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e884; + iVar4 = close(*(int *)((int)auStack_94 + iVar2 + -0x18)); + if (iVar4 < 0) { + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8cf; + piVar6 = __errno_location(); + iVar4 = *piVar6; + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eef60; + *(int *)(&stack0xffffff58 + iVar2) = iVar4; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8e1; + error(*(char **)((int)auStack_94 + iVar2 + -0x18)); + } + *(undefined4 *)(&stack0xffffff68 + iVar2) = 0; + *(char **)(&stack0xffffff64 + iVar2) = Address; + *(undefined **)(&stack0xffffff5c + iVar2) = &DAT_080eeb56; + *(char **)(&stack0xffffff60 + iVar2) = SendMail::envelope; + *(char **)(&stack0xffffff58 + iVar2) = SendMail::mailer; + *(char **)((int)auStack_94 + iVar2 + -0x18) = SendMail::mailer; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8be; + execlp(*(char **)((int)auStack_94 + iVar2 + -0x18), + *(char **)(&stack0xffffff58 + iVar2)); + *(undefined4 *)((int)auStack_94 + iVar2 + -0x18) = 0; + // WARNING: Subroutine does not return + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e8ca; + exit(*(int *)((int)auStack_94 + iVar2 + -0x18)); + } + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + *(uint **)(&stack0xffffff58 + iVar2) = puVar1; + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(uint *)(&stack0xffffff5c + iVar2) = + (int)puVar8 + ((-3 - (uint)CARRY1((byte)uVar10,(byte)uVar10)) - (int)puVar1); + *(int *)((int)auStack_94 + iVar2 + -0x18) = inode[0]; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e805; + write(*(int *)((int)auStack_94 + iVar2 + -0x18),*(void **)(&stack0xffffff58 + iVar2) + ,*(size_t *)(&stack0xffffff5c + iVar2)); + *(undefined4 *)((int)auStack_94 + iVar2 + -0x18) = local_84; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e810; + iVar4 = close(*(int *)((int)auStack_94 + iVar2 + -0x18)); + if (iVar4 < 0) { + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e843; + piVar6 = __errno_location(); + iVar4 = *piVar6; + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eef20; + *(int *)(&stack0xffffff58 + iVar2) = iVar4; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e855; + error(*(char **)((int)auStack_94 + iVar2 + -0x18)); + } + *(int *)((int)auStack_94 + iVar2 + -0x18) = inode[0]; + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e81f; + iVar4 = close(*(int *)((int)auStack_94 + iVar2 + -0x18)); + if (-1 < iVar4) { + return; + } + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e82c; + piVar6 = __errno_location(); + iVar4 = *piVar6; + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eeee0; + *(int *)(&stack0xffffff58 + iVar2) = iVar4; + goto LAB_0804e775; + } + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eefe0; + } + else { + *(char **)((int)auStack_94 + iVar2 + -0x18) = "SendMail: Kann Pipe nicht anlegen.\n"; + } + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e79f; + error(*(char **)((int)auStack_94 + iVar2 + -0x18)); + } + else { + *(undefined **)((int)auStack_94 + iVar2 + -0x18) = &DAT_080eee60; + *(char **)(&stack0xffffff58 + iVar2) = SendMail::mailer; +LAB_0804e775: + *(undefined4 *)((int)&iStack_b0 + iVar2) = 0x804e77a; + error(*(char **)((int)auStack_94 + iVar2 + -0x18)); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: status +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RemoveZombie(void) + +{ + int local_8; + int status; + + waitpid(-1,&local_8,3); + return; +} + + + +ulong PackAbsoluteCoordinate(int x,int y,int z) + +{ + return (x + -0x6000) * 0x40000 + (y + -0x6000) * 0x10 + z; +} + + + +ulong PackRelativeCoordinate(int dx,int dy,int dz) + +{ + return (dx + 0x2000) * 0x40000 + (dy + 0x2000) * 0x10 + dz + 8; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void UnpackAbsoluteCoordinate(void) + +{ + uint in_stack_00000004; + int *in_stack_00000008; + int *in_stack_0000000c; + uint *in_stack_00000010; + + *in_stack_00000008 = (in_stack_00000004 >> 0x12) + 0x6000; + *in_stack_0000000c = (in_stack_00000004 >> 4 & 0x3fff) + 0x6000; + *in_stack_00000010 = in_stack_00000004 & 0xf; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void UnpackRelativeCoordinate(void) + +{ + uint in_stack_00000004; + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + + *in_stack_00000008 = (in_stack_00000004 >> 0x12) - 0x2000; + *in_stack_0000000c = (in_stack_00000004 >> 4 & 0x3fff) - 0x2000; + *in_stack_00000010 = (in_stack_00000004 & 0xf) - 8; + return; +} + + + +void SaveFile(char *Filename) + +{ + int iVar1; + FILE *pFVar2; + FILE *__stream; + size_t sVar3; + size_t sVar4; + int iVar5; + int *piVar6; + size_t Size; + FILE *Source; + undefined4 uStack_1040; + char *pcVar7; + undefined4 uStack_1030; + undefined1 auStack_102c [4]; + undefined1 *local_1028; + uchar_0_ *Buffer; + FILE *local_1020; + FILE *Dest; + char BackupFilename [4096]; + + Buffer = &stack0xffffefc4; + if (Filename == (char *)0x0) { + uStack_1040 = 0x804ec01; + error("SaveFile: Filename ist NULL.\n"); + return; + } + uStack_1040 = 0x804ea52; + Buffer = &stack0xffffefc4; + strcpy((char *)&Dest,Filename); + uStack_1040 = 0x804ea62; + strcat((char *)&Dest,"#"); + uStack_1040 = 0x804ea75; + __stream = fopen(Filename,"rb"); + if (__stream == (FILE *)0x0) { + pcVar7 = "SaveFile: Quelldatei %s existiert nicht.\n"; +LAB_0804ebdb: + uStack_1040 = 0x804ebe0; + error(pcVar7); + return; + } + uStack_1040 = 0x804ea8f; + local_1020 = fopen((char *)&Dest,"wb"); + if (local_1020 == (FILE *)0x0) { + pcVar7 = "SaveFile: Kann Zieldatei %s nicht anlegen.\n"; + local_1020 = (FILE *)0x0; + goto LAB_0804ebdb; + } + uStack_1040 = 0x804eab5; + fseek(__stream,0,2); + uStack_1040 = 0x804eabd; + sVar3 = ftell(__stream); + uStack_1040 = 0x804ead7; + fseek(__stream,0,0); + iVar1 = -(sVar3 + 0xf & 0xfffffff0); + local_1028 = auStack_102c + iVar1; + *(FILE **)((int)&uStack_1030 + iVar1) = __stream; + *(size_t *)(BackupFilename + iVar1 + -0x1c) = sVar3; + pcVar7 = BackupFilename + iVar1 + -0x20; + pcVar7[0] = '\x01'; + pcVar7[1] = '\0'; + pcVar7[2] = '\0'; + pcVar7[3] = '\0'; + *(undefined1 **)(&stack0xffffefc4 + iVar1) = auStack_102c + iVar1; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb01; + sVar4 = fread(*(void **)(&stack0xffffefc4 + iVar1),*(size_t *)(BackupFilename + iVar1 + -0x20), + *(size_t *)(BackupFilename + iVar1 + -0x1c),*(FILE **)((int)&uStack_1030 + iVar1)) + ; + pFVar2 = local_1020; + if (sVar4 == sVar3) { + pcVar7 = BackupFilename + iVar1 + -0x20; + pcVar7[0] = '\x01'; + pcVar7[1] = '\0'; + pcVar7[2] = '\0'; + pcVar7[3] = '\0'; + *(size_t *)(BackupFilename + iVar1 + -0x1c) = sVar4; + *(FILE **)((int)&uStack_1030 + iVar1) = pFVar2; + *(undefined1 **)(&stack0xffffefc4 + iVar1) = local_1028; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804ebb4; + sVar3 = fwrite(*(void **)(&stack0xffffefc4 + iVar1), + *(size_t *)(BackupFilename + iVar1 + -0x20), + *(size_t *)(BackupFilename + iVar1 + -0x1c), + *(FILE **)((int)&uStack_1030 + iVar1)); + if (sVar3 == sVar4) goto LAB_0804eb1e; + *(char **)(&stack0xffffefc4 + iVar1) = "SaveFile: Fehler beim Schreiben der Zieldatei %s.\n" + ; + *(char **)(BackupFilename + iVar1 + -0x20) = Filename; + } + else { + *(char **)(&stack0xffffefc4 + iVar1) = "SaveFile: Fehler beim Lesen der Quelldatei %s.\n"; + *(char **)(BackupFilename + iVar1 + -0x20) = Filename; + } + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb1e; + error(*(char **)(&stack0xffffefc4 + iVar1)); +LAB_0804eb1e: + *(FILE **)(&stack0xffffefc4 + iVar1) = __stream; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb26; + iVar5 = fclose(*(FILE **)(&stack0xffffefc4 + iVar1)); + if (iVar5 != 0) { + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb75; + piVar6 = __errno_location(); + iVar5 = *piVar6; + *(undefined **)(&stack0xffffefc4 + iVar1) = &DAT_080ef3a0; + *(int *)(BackupFilename + iVar1 + -0x20) = iVar5; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb87; + error(*(char **)(&stack0xffffefc4 + iVar1)); + } + *(FILE **)(&stack0xffffefc4 + iVar1) = local_1020; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb38; + iVar5 = fclose(*(FILE **)(&stack0xffffefc4 + iVar1)); + if (iVar5 == 0) { + return; + } + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb55; + piVar6 = __errno_location(); + iVar5 = *piVar6; + *(undefined **)(&stack0xffffefc4 + iVar1) = &DAT_080ef360; + *(int *)(BackupFilename + iVar1 + -0x20) = iVar5; + *(undefined4 *)((int)&uStack_1040 + iVar1) = 0x804eb67; + error(*(char **)(&stack0xffffefc4 + iVar1)); + return; +} + + + +// DWARF original prototype: void TReadScriptFile(TReadScriptFile * this) + +void __thiscall TReadScriptFile::TReadScriptFile(TReadScriptFile *this) + +{ + this->RecursionDepth = -1; + this->Bytes = (uchar *)this->String; + return; +} + + + +// DWARF original prototype: void TReadScriptFile(TReadScriptFile * this) + +void __thiscall TReadScriptFile::TReadScriptFile(TReadScriptFile *this) + +{ + this->RecursionDepth = -1; + this->Bytes = (uchar *)this->String; + return; +} + + + +// DWARF original prototype: void ~TReadScriptFile(TReadScriptFile * this, int __in_chrg) + +void __thiscall TReadScriptFile::~TReadScriptFile(TReadScriptFile *this,int __in_chrg) + +{ + int iVar1; + int *piVar2; + + if (this->RecursionDepth != -1) { + ::error("TReadScriptFile::~TReadScriptFile: Datei ist noch offen.\n"); + iVar1 = this->RecursionDepth; + while (iVar1 != -1) { + iVar1 = fclose((FILE *)this->File[iVar1]); + if (iVar1 != 0) { + piVar2 = __errno_location(); + ::error(&DAT_080ef4e0,*piVar2); + } + this->RecursionDepth = this->RecursionDepth + -1; + iVar1 = this->RecursionDepth; + } + } + return; +} + + + +// DWARF original prototype: void ~TReadScriptFile(TReadScriptFile * this, int __in_chrg) + +void __thiscall TReadScriptFile::~TReadScriptFile(TReadScriptFile *this,int __in_chrg) + +{ + int iVar1; + int *piVar2; + + if (this->RecursionDepth != -1) { + ::error("TReadScriptFile::~TReadScriptFile: Datei ist noch offen.\n"); + iVar1 = this->RecursionDepth; + while (iVar1 != -1) { + iVar1 = fclose((FILE *)this->File[iVar1]); + if (iVar1 != 0) { + piVar2 = __errno_location(); + ::error(&DAT_080ef4e0,*piVar2); + } + this->RecursionDepth = this->RecursionDepth + -1; + iVar1 = this->RecursionDepth; + } + } + return; +} + + + +// DWARF original prototype: void open(TReadScriptFile * this, char * FileName) + +int __thiscall TReadScriptFile::open(TReadScriptFile *this,char *__file,int __oflag,...) + +{ + int iVar1; + char *p; + int iVar2; + char *pcVar3; + char (*__dest) [4096]; + FILE *pFVar4; + int *piVar5; + undefined4 *puVar6; + int ErrorCode; + + iVar1 = this->RecursionDepth; + iVar2 = iVar1 + 1; + this->RecursionDepth = iVar2; + if (iVar2 == 3) { + ::error(&DAT_080ef560); + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = "Recursion depth too high"; + goto LAB_0804ee56; + } + if ((iVar2 < 1) || (*__file == '/')) { +LAB_0804ee70: + __dest = this->Filename + this->RecursionDepth; + } + else { + strcpy(this->Filename[this->RecursionDepth],this->Filename[iVar1]); + // try { // try from 0804eda1 to 0804ee91 has its CatchHandler @ 0804eea6 + pcVar3 = findLast(this->Filename[this->RecursionDepth],'/'); + if (pcVar3 == (char *)0x0) goto LAB_0804ee70; + __dest = (char (*) [4096])(pcVar3 + 1); + } + strcpy(*__dest,__file); + iVar1 = this->RecursionDepth; + pFVar4 = fopen(this->Filename[this->RecursionDepth],"rb"); + iVar2 = this->RecursionDepth; + this->File[iVar1] = (FILE *)pFVar4; + if (this->File[iVar2] != (FILE *)0x0) { + this->Line[iVar2] = 1; + return 1; + } + piVar5 = __errno_location(); + iVar1 = *piVar5; + ::error(&DAT_080ef520,this->Filename + iVar2); + pcVar3 = strerror(iVar1); + ::error("Fehler %d: %s.\n",iVar1,pcVar3); + this->RecursionDepth = this->RecursionDepth + -1; + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = "Cannot open script-file"; +LAB_0804ee56: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void close(TReadScriptFile * this) + +int __thiscall TReadScriptFile::close(TReadScriptFile *this,int __fd) + +{ + int iVar1; + int *piVar2; + + iVar1 = this->RecursionDepth; + if (iVar1 != -1) { + iVar1 = fclose((FILE *)this->File[iVar1]); + if (iVar1 != 0) { + piVar2 = __errno_location(); + iVar1 = *piVar2; + ::error(&DAT_080ef4e0,iVar1); + } + this->RecursionDepth = this->RecursionDepth + -1; + return iVar1; + } + ::error("TReadScriptFile::close: Keine Datei offen.\n"); + return iVar1; +} + + + +// DWARF original prototype: void error(TReadScriptFile * this, char * Text) + +void __thiscall TReadScriptFile::error(TReadScriptFile *this,char *Text) + +{ + char *pcVar1; + int iVar2; + int *piVar3; + undefined4 *puVar4; + char *p; + char (*pacVar5) [4096]; + + // try { // try from 0804ef52 to 0804f008 has its CatchHandler @ 0804f020 + pcVar1 = findLast(this->Filename[this->RecursionDepth],'/'); + if (pcVar1 == (char *)0x0) { + iVar2 = this->RecursionDepth; + pacVar5 = this->Filename + iVar2; + } + else { + iVar2 = this->RecursionDepth; + pacVar5 = (char (*) [4096])(pcVar1 + 1); + } + snprintf(ErrorString,100,"error in script-file \"%s\", line %d: %s",pacVar5,this->Line[iVar2], + Text); + iVar2 = this->RecursionDepth; + while (iVar2 != -1) { + iVar2 = fclose((FILE *)this->File[iVar2]); + if (iVar2 != 0) { + piVar3 = __errno_location(); + ::error(&DAT_080ef4e0,*piVar3); + } + this->RecursionDepth = this->RecursionDepth + -1; + iVar2 = this->RecursionDepth; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: pos +// DWARF original prototype: void nextToken(TReadScriptFile * this) + +void __thiscall TReadScriptFile::nextToken(TReadScriptFile *this) + +{ + char *__file; + FILE *__stream; + bool bVar1; + uint uVar2; + int iVar3; + int *piVar4; + int State; + undefined4 uVar5; + int c; + char *pcVar6; + int in_stack_ffffffcc; + int local_1c; + int Sign; + FILE *f; + int pos; + + if (this->RecursionDepth == -1) { + ::error(&DAT_080ef660); +LAB_0804f216: + this->Token = ENDOFFILE; + return; + } + __file = this->String; +LAB_0804f062: + f = (FILE *)0x0; + uVar5 = 0; + uVar2 = 4000; + pcVar6 = __file; + if (((uint)__file & 4) != 0) { + pcVar6 = this->String + 4; + uVar2 = 0xf9c; + this->String[0] = '\0'; + this->String[1] = '\0'; + this->String[2] = '\0'; + this->String[3] = '\0'; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + pcVar6[0] = '\0'; + pcVar6[1] = '\0'; + pcVar6[2] = '\0'; + pcVar6[3] = '\0'; + pcVar6 = pcVar6 + 4; + } + this->Number = 0; + __stream = (FILE *)this->File[this->RecursionDepth]; + local_1c = 1; +LAB_0804f0b6: + if (f == (FILE *)0xf9f) { + error(this,"string too long"); + } + switch(uVar5) { + case 0: + iVar3 = getc(__stream); + if (iVar3 != -1) { + if (iVar3 == 10) { + this->Line[this->RecursionDepth] = this->Line[this->RecursionDepth] + 1; + } + else { + // try { // try from 0804f0f5 to 0804f92b has its CatchHandler @ 0804f931 + bVar1 = isSpace(iVar3); + if (((!bVar1) && (uVar5 = 1, iVar3 != 0x23)) && (uVar5 = 0x1e, iVar3 != 0x40)) { + bVar1 = isAlpha(iVar3); + if (bVar1) { + uVar5 = 2; + this->String[(int)f] = (char)iVar3; + f = (FILE *)((int)&f->_flags + 1); + } + else { + bVar1 = isDigit(iVar3); + if (bVar1) { + this->Number = iVar3 + -0x30; + uVar5 = 3; + } + else { + uVar5 = 6; + if (((iVar3 != 0x22) && (uVar5 = 0xb, iVar3 != 0x5b)) && + ((uVar5 = 0x16, iVar3 != 0x3c && + ((uVar5 = 0x19, iVar3 != 0x3e && (uVar5 = 0x1b, iVar3 != 0x2d)))))) + { + uVar5 = 10; + this->Special = (char)iVar3; + } + } + } + } + } + goto LAB_0804f0b6; + } +LAB_0804f1c2: + iVar3 = this->RecursionDepth; + if (iVar3 < 1) goto LAB_0804f216; + if (iVar3 == -1) { + ::error("TReadScriptFile::close: Keine Datei offen.\n"); + } + else { + iVar3 = fclose((FILE *)this->File[iVar3]); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080ef4e0,*piVar4); + } + this->RecursionDepth = this->RecursionDepth + -1; + } + goto LAB_0804f062; + case 1: + iVar3 = getc(__stream); + if (iVar3 == -1) goto LAB_0804f1c2; + if (iVar3 == 10) { + this->Line[this->RecursionDepth] = this->Line[this->RecursionDepth] + 1; + goto LAB_0804f24a; + } + goto LAB_0804f0b6; + case 2: + iVar3 = getc(__stream); + if (f == (FILE *)0x1e) { + error(this,"identifier too long"); + } + if (iVar3 == -1) { +LAB_0804f2aa: + this->Token = IDENTIFIER; + return; + } + bVar1 = isAlpha(iVar3); + if (((!bVar1) && (bVar1 = isDigit(iVar3), !bVar1)) && (iVar3 != 0x5f)) { + ungetc(iVar3,__stream); + goto LAB_0804f2aa; + } + goto LAB_0804f275; + case 3: + iVar3 = getc(__stream); + if (iVar3 == -1) { +LAB_0804f31a: + this->Token = NUMBER; + return; + } + bVar1 = isDigit(iVar3); + if (bVar1) goto LAB_0804f325; + if (iVar3 != 0x2d) { + ungetc(iVar3,__stream); + goto LAB_0804f31a; + } + goto LAB_0804f2ea; + case 4: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (!bVar1) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_5; + } + uVar5 = 5; + this->Number = iVar3 + -0x30; + goto LAB_0804f0b6; + case 5: +switchD_0804f0cc_caseD_5: + iVar3 = getc(__stream); + if (iVar3 == -1) { +LAB_0804f3a8: + this->Bytes[(int)(f->_shortbuf + -0x47)] = (uchar)this->Number; + this->Token = BYTES; + return; + } + bVar1 = isDigit(iVar3); + if (bVar1) goto LAB_0804f325; + if (iVar3 != 0x2d) { + ungetc(iVar3,__stream); + goto LAB_0804f3a8; + } +LAB_0804f2ea: + this->Bytes[(int)(f->_shortbuf + -0x47)] = (uchar)this->Number; + f = (FILE *)((int)&f->_flags + 1); + uVar5 = 4; + goto LAB_0804f0b6; + case 6: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + if (iVar3 == 0x22) { + uVar5 = 8; + } + else if (iVar3 == 0x5c) { + uVar5 = 7; + } + else { + if (iVar3 == 10) { + this->Line[this->RecursionDepth] = this->Line[this->RecursionDepth] + 1; + } +LAB_0804f275: + this->String[(int)f] = (char)iVar3; + f = (FILE *)((int)&f->_flags + 1); + } + goto LAB_0804f0b6; + case 7: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + if (iVar3 == 0x6e) { + this->String[(int)f] = '\n'; + } + else { + this->String[(int)f] = (char)iVar3; + } + f = (FILE *)((int)&f->_flags + 1); + uVar5 = 6; + goto LAB_0804f0b6; + case 8: + this->Token = STRING; + return; + default: + ::error(&DAT_080ef620); +LAB_0804f24a: + uVar5 = 0; + goto LAB_0804f0b6; + case 10: + break; + case 0xb: + iVar3 = getc(__stream); + this->Special = '['; + if (iVar3 == -1) break; + bVar1 = isDigit(iVar3); + if (bVar1) { + local_1c = 1; + this->Number = iVar3 + -0x30; + } + else { + if (iVar3 != 0x2d) goto LAB_0804f507; + local_1c = -1; + this->Number = 0; + } + uVar5 = 0xc; + goto LAB_0804f0b6; + case 0xc: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (bVar1) goto LAB_0804f325; + if (iVar3 != 0x2c) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_d; + } + uVar5 = 0xd; + this->CoordX = local_1c * this->Number; + goto LAB_0804f0b6; + case 0xd: +switchD_0804f0cc_caseD_d: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (bVar1) { + local_1c = 1; + this->Number = iVar3 + -0x30; + } + else { + if (iVar3 != 0x2d) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_e; + } + local_1c = -1; + this->Number = 0; + } + uVar5 = 0xe; + goto LAB_0804f0b6; + case 0xe: +switchD_0804f0cc_caseD_e: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (bVar1) goto LAB_0804f325; + if (iVar3 != 0x2c) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_f; + } + uVar5 = 0xf; + this->CoordY = local_1c * this->Number; + goto LAB_0804f0b6; + case 0xf: +switchD_0804f0cc_caseD_f: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (bVar1) { + local_1c = 1; + this->Number = iVar3 + -0x30; + } + else { + if (iVar3 != 0x2d) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_10; + } + local_1c = -1; + this->Number = 0; + } + uVar5 = 0x10; + goto LAB_0804f0b6; + case 0x10: +switchD_0804f0cc_caseD_10: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + bVar1 = isDigit(iVar3); + if (bVar1) { +LAB_0804f325: + this->Number = iVar3 + -0x30 + this->Number * 10; + } + else { + if (iVar3 != 0x5d) { + error(this,"syntax error"); +switchD_0804f0cc_caseD_11: + this->Token = COORDINATE; + return; + } + uVar5 = 0x11; + this->CoordZ = local_1c * this->Number; + } + goto LAB_0804f0b6; + case 0x11: + goto switchD_0804f0cc_caseD_11; + case 0x16: + iVar3 = getc(__stream); + this->Special = '<'; + if (iVar3 == -1) break; + uVar5 = 0x17; + if ((iVar3 != 0x3d) && (uVar5 = 0x18, iVar3 != 0x3e)) goto LAB_0804f507; + goto LAB_0804f0b6; + case 0x17: + this->Special = 'L'; + break; + case 0x18: + this->Special = 'N'; + break; + case 0x19: + iVar3 = getc(__stream); + this->Special = '>'; + if (iVar3 == -1) break; + uVar5 = 0x1a; + if (iVar3 != 0x3d) goto LAB_0804f507; + goto LAB_0804f0b6; + case 0x1a: + this->Special = 'G'; + break; + case 0x1b: + iVar3 = getc(__stream); + this->Special = '-'; + if (iVar3 == -1) break; + uVar5 = 0x1c; + if (iVar3 == 0x3e) goto LAB_0804f0b6; +LAB_0804f507: + ungetc(iVar3,__stream); + break; + case 0x1c: + this->Special = 'I'; + break; + case 0x1e: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + if (iVar3 != 0x22) { + error(this,"syntax error"); + goto switchD_0804f0cc_caseD_1f; + } + uVar5 = 0x1f; + goto LAB_0804f0b6; + case 0x1f: +switchD_0804f0cc_caseD_1f: + iVar3 = getc(__stream); + if (iVar3 == -1) { + error(this,"unexpected end of file"); + } + if (iVar3 != 0x22) goto LAB_0804f275; + uVar5 = 0x20; + goto LAB_0804f0b6; + case 0x20: + goto switchD_0804f0cc_caseD_20; + } + this->Token = SPECIAL; + return; +switchD_0804f0cc_caseD_20: + open(this,__file,in_stack_ffffffcc); + goto LAB_0804f062; +} + + + +// DWARF original prototype: char * readIdentifier(TReadScriptFile * this) + +char * __thiscall TReadScriptFile::readIdentifier(TReadScriptFile *this) + +{ + // try { // try from 0804f95f to 0804f978 has its CatchHandler @ 0804f9b8 + nextToken(this); + if (this->Token != IDENTIFIER) { + error(this,"identifier expected"); + } + if (this->Token != IDENTIFIER) { + // try { // try from 0804f989 to 0804f99b has its CatchHandler @ 0804f9a5 + error(this,"identifier expected"); + } + strLower(this->String); + return this->String; +} + + + +// DWARF original prototype: int readNumber(TReadScriptFile * this) + +int __thiscall TReadScriptFile::readNumber(TReadScriptFile *this) + +{ + TOKEN TVar1; + int sgn; + int iVar2; + + // try { // try from 0804f9e2 to 0804fa07 has its CatchHandler @ 0804fa70 + nextToken(this); + TVar1 = this->Token; + iVar2 = 1; + if ((TVar1 == SPECIAL) && (this->Special == '-')) { + iVar2 = -1; + // try { // try from 0804fa46 to 0804fa4a has its CatchHandler @ 0804fa70 + nextToken(this); + TVar1 = this->Token; + } + if (TVar1 != NUMBER) { + error(this,"number expected"); + } + if (this->Token != NUMBER) { + // try { // try from 0804fa18 to 0804fa1c has its CatchHandler @ 0804fa4f + error(this,"number expected"); + } + return iVar2 * this->Number; +} + + + +// DWARF original prototype: char * readString(TReadScriptFile * this) + +char * __thiscall TReadScriptFile::readString(TReadScriptFile *this) + +{ + // try { // try from 0804fa8f to 0804faa8 has its CatchHandler @ 0804fae0 + nextToken(this); + if (this->Token != STRING) { + error(this,"string expected"); + } + if (this->Token != STRING) { + // try { // try from 0804fab9 to 0804fabd has its CatchHandler @ 0804facb + error(this,"string expected"); + } + return this->String; +} + + + +// DWARF original prototype: uchar * readBytesequence(TReadScriptFile * this) + +uchar * __thiscall TReadScriptFile::readBytesequence(TReadScriptFile *this) + +{ + // try { // try from 0804faff to 0804fb18 has its CatchHandler @ 0804fb50 + nextToken(this); + if (this->Token != BYTES) { + error(this,"byte-sequence expected"); + } + if (this->Token != BYTES) { + // try { // try from 0804fb29 to 0804fb2d has its CatchHandler @ 0804fb3b + error(this,"byte-sequence expected"); + } + return this->Bytes; +} + + + +// DWARF original prototype: void readCoordinate(TReadScriptFile * this, int * x, int * y, int * z) + +void __thiscall TReadScriptFile::readCoordinate(TReadScriptFile *this) + +{ + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + + // try { // try from 0804fb6f to 0804fb88 has its CatchHandler @ 0804fbe0 + nextToken(this); + if (this->Token != COORDINATE) { + error(this,"coordinates expected"); + } + if (this->Token != COORDINATE) { + // try { // try from 0804fb99 to 0804fb9d has its CatchHandler @ 0804fbc6 + error(this,"coordinates expected"); + } + *in_stack_00000008 = this->CoordX; + *in_stack_0000000c = this->CoordY; + *in_stack_00000010 = this->CoordZ; + return; +} + + + +// DWARF original prototype: char readSpecial(TReadScriptFile * this) + +char __thiscall TReadScriptFile::readSpecial(TReadScriptFile *this) + +{ + // try { // try from 0804fbff to 0804fc18 has its CatchHandler @ 0804fc50 + nextToken(this); + if (this->Token != SPECIAL) { + error(this,"special-char expected"); + } + if (this->Token != SPECIAL) { + // try { // try from 0804fc29 to 0804fc2d has its CatchHandler @ 0804fc3c + error(this,"special-char expected"); + } + return this->Special; +} + + + +// WARNING: Variable defined which should be unmapped: Symbol_local +// DWARF original prototype: void readSymbol(TReadScriptFile * this, char Symbol) + +void __thiscall TReadScriptFile::readSymbol(TReadScriptFile *this,char Symbol) + +{ + char Symbol_local; + + // try { // try from 0804fc76 to 0804fc8f has its CatchHandler @ 0804fcf0 + nextToken(this); + if (this->Token != SPECIAL) { + error(this,"special-char expected"); + if (this->Token != SPECIAL) { + // try { // try from 0804fca0 to 0804fca4 has its CatchHandler @ 0804fcd3 + error(this,"special-char expected"); + } + } + if (Symbol != this->Special) { + // try { // try from 0804fcc7 to 0804fccb has its CatchHandler @ 0804fcf0 + error(this,"special-char expected"); + } + return; +} + + + +// DWARF original prototype: char * getIdentifier(TReadScriptFile * this) + +char * __thiscall TReadScriptFile::getIdentifier(TReadScriptFile *this) + +{ + if (this->Token != IDENTIFIER) { + // try { // try from 0804fd1c to 0804fd2e has its CatchHandler @ 0804fd38 + error(this,"identifier expected"); + } + strLower(this->String); + return this->String; +} + + + +// DWARF original prototype: int getNumber(TReadScriptFile * this) + +int __thiscall TReadScriptFile::getNumber(TReadScriptFile *this) + +{ + if (this->Token != NUMBER) { + // try { // try from 0804fd6c to 0804fd70 has its CatchHandler @ 0804fd80 + error(this,"number expected"); + } + return this->Number; +} + + + +// DWARF original prototype: char * getString(TReadScriptFile * this) + +char * __thiscall TReadScriptFile::getString(TReadScriptFile *this) + +{ + if (this->Token != STRING) { + // try { // try from 0804fdbc to 0804fdc0 has its CatchHandler @ 0804fdd0 + error(this,"string expected"); + } + return this->String; +} + + + +// DWARF original prototype: uchar * getBytesequence(TReadScriptFile * this) + +uchar * __thiscall TReadScriptFile::getBytesequence(TReadScriptFile *this) + +{ + if (this->Token != BYTES) { + // try { // try from 0804fe0c to 0804fe10 has its CatchHandler @ 0804fe20 + error(this,"byte-sequence expected"); + } + return this->Bytes; +} + + + +// DWARF original prototype: void getCoordinate(TReadScriptFile * this, int * x, int * y, int * z) + +void __thiscall TReadScriptFile::getCoordinate(TReadScriptFile *this) + +{ + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + + if (this->Token != COORDINATE) { + // try { // try from 0804fe5c to 0804fe60 has its CatchHandler @ 0804fe90 + error(this,"coordinates expected"); + } + *in_stack_00000008 = this->CoordX; + *in_stack_0000000c = this->CoordY; + *in_stack_00000010 = this->CoordZ; + return; +} + + + +// DWARF original prototype: char getSpecial(TReadScriptFile * this) + +char __thiscall TReadScriptFile::getSpecial(TReadScriptFile *this) + +{ + if (this->Token != SPECIAL) { + // try { // try from 0804fecc to 0804fed0 has its CatchHandler @ 0804fee0 + error(this,"special-char expected"); + } + return this->Special; +} + + + +// DWARF original prototype: void TWriteScriptFile(TWriteScriptFile * this) + +void __thiscall TWriteScriptFile::TWriteScriptFile(TWriteScriptFile *this) + +{ + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void TWriteScriptFile(TWriteScriptFile * this) + +void __thiscall TWriteScriptFile::TWriteScriptFile(TWriteScriptFile *this) + +{ + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void ~TWriteScriptFile(TWriteScriptFile * this, int __in_chrg) + +void __thiscall TWriteScriptFile::~TWriteScriptFile(TWriteScriptFile *this,int __in_chrg) + +{ + char *pcVar1; + int iVar2; + int *piVar3; + + if (this->File != (FILE *)0x0) { + pcVar1 = ""; + if (this != (TWriteScriptFile *)0xfffffffc) { + pcVar1 = this->Filename; + } + ::error("TWriteScriptFile::~TWriteScriptFile: Datei %s ist noch offen.\n",pcVar1); + iVar2 = fclose((FILE *)this->File); + if (iVar2 != 0) { + piVar3 = __errno_location(); + ::error(&DAT_080ef6e0,*piVar3); + } + } + return; +} + + + +// DWARF original prototype: void ~TWriteScriptFile(TWriteScriptFile * this, int __in_chrg) + +void __thiscall TWriteScriptFile::~TWriteScriptFile(TWriteScriptFile *this,int __in_chrg) + +{ + char *pcVar1; + int iVar2; + int *piVar3; + + if (this->File != (FILE *)0x0) { + pcVar1 = ""; + if (this != (TWriteScriptFile *)0xfffffffc) { + pcVar1 = this->Filename; + } + ::error("TWriteScriptFile::~TWriteScriptFile: Datei %s ist noch offen.\n",pcVar1); + iVar2 = fclose((FILE *)this->File); + if (iVar2 != 0) { + piVar3 = __errno_location(); + ::error(&DAT_080ef6e0,*piVar3); + } + } + return; +} + + + +// DWARF original prototype: void open(TWriteScriptFile * this, char * FileName) + +int __thiscall TWriteScriptFile::open(TWriteScriptFile *this,char *__file,int __oflag,...) + +{ + FILE *pFVar1; + char *pcVar2; + int *piVar3; + undefined4 *puVar4; + int iVar5; + + if (this->File != (FILE *)0x0) { + ::error("TWriteScriptFile::open: Altes Skript ist noch offen.\n"); + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + piVar3 = __errno_location(); + ::error(&DAT_080ef7c0,*piVar3); + } + this->File = (FILE *)0x0; + } + pFVar1 = fopen(__file,"wb"); + this->File = (FILE *)pFVar1; + if (pFVar1 != (FILE *)0x0) { + this->Line = 0; + pcVar2 = strcpy(this->Filename,__file); + return (int)pcVar2; + } + piVar3 = __errno_location(); + iVar5 = *piVar3; + // try { // try from 08050063 to 080500eb has its CatchHandler @ 080500f0 + ::error("TWriteScriptFile: Kann Datei %s nicht anlegen.\n",__file); + pcVar2 = strerror(iVar5); + ::error("Fehler %d: %s.\n",iVar5,pcVar2); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "Cannot create script-file"; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void close(TWriteScriptFile * this) + +int __thiscall TWriteScriptFile::close(TWriteScriptFile *this,int __fd) + +{ + int iVar1; + int *piVar2; + FILE *__stream; + + __stream = (FILE *)this->File; + if (__stream != (FILE *)0x0) { + iVar1 = fclose(__stream); + if (iVar1 != 0) { + piVar2 = __errno_location(); + iVar1 = *piVar2; + ::error(&DAT_080ef800,iVar1); + } + this->File = (FILE *)0x0; + return iVar1; + } + ::error("TWriteScriptFile::close: Kein Skript offen.\n"); + return (int)__stream; +} + + + +// DWARF original prototype: void error(TWriteScriptFile * this, char * Text) + +void __thiscall TWriteScriptFile::error(TWriteScriptFile *this,char *Text) + +{ + int iVar1; + int *piVar2; + undefined4 *puVar3; + + if ((FILE *)this->File != (FILE *)0x0) { + iVar1 = fclose((FILE *)this->File); + if (iVar1 != 0) { + piVar2 = __errno_location(); + // try { // try from 080501b0 to 08050223 has its CatchHandler @ 08050224 + ::error(&DAT_080ef880,*piVar2); + } + } + this->File = (FILE *)0x0; + snprintf(ErrorString,100,"error in script-file \"%s\", line %d: %s",this->Filename,this->Line, + Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char*::typeinfo,0); +} + + + +// DWARF original prototype: void writeLn(TWriteScriptFile * this) + +void __thiscall TWriteScriptFile::writeLn(TWriteScriptFile *this) + +{ + undefined4 *puVar1; + + if ((FILE *)this->File != (FILE *)0x0) { + putc(10,(FILE *)this->File); + return; + } + // try { // try from 0805026a to 08050298 has its CatchHandler @ 08050299 + ::error(&DAT_080ef8c0); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write linefeed"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeText(TWriteScriptFile * this, char * Text) + +void __thiscall TWriteScriptFile::writeText(TWriteScriptFile *this,char *Text) + +{ + char cVar1; + undefined4 *puVar2; + FILE *__stream; + char *Text_00; + + __stream = (FILE *)this->File; + if (__stream == (FILE *)0x0) { + Text_00 = &DAT_080ef940; + } + else { + if (Text != (char *)0x0) { + cVar1 = *Text; + if (cVar1 != '\0') { + while( true ) { + Text = Text + 1; + putc((int)cVar1,__stream); + cVar1 = *Text; + if (cVar1 == '\0') break; + __stream = (FILE *)this->File; + } + } + return; + } + Text_00 = "TWriteScriptFile::writeText: Text ist NULL.\n"; + } + // try { // try from 080502fe to 0805032c has its CatchHandler @ 08050336 + ::error(Text_00); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "Cannot write text"; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeString(TWriteScriptFile * this, char * Text) + +void __thiscall TWriteScriptFile::writeString(TWriteScriptFile *this,char *Text) + +{ + undefined4 *puVar1; + char cVar2; + char *Text_00; + + if ((FILE *)this->File == (FILE *)0x0) { + Text_00 = &DAT_080ef9e0; + } + else { + if (Text != (char *)0x0) { + putc(0x22,(FILE *)this->File); + cVar2 = *Text; + while (cVar2 != '\0') { + if ((cVar2 == '\"') || (cVar2 == '\\')) { + putc(0x5c,(FILE *)this->File); + cVar2 = *Text; + } + if (cVar2 == '\n') { + putc(0x5c,(FILE *)this->File); + putc(0x6e,(FILE *)this->File); + } + else { + putc((int)cVar2,(FILE *)this->File); + } + Text = Text + 1; + cVar2 = *Text; + } + putc(0x22,(FILE *)this->File); + return; + } + Text_00 = "TWriteScriptFile::writeString: Text ist NULL.\n"; + } + // try { // try from 08050416 to 08050444 has its CatchHandler @ 0805044e + ::error(Text_00); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write string"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeNumber(TWriteScriptFile * this, int Number) + +void __thiscall TWriteScriptFile::writeNumber(TWriteScriptFile *this,int Number) + +{ + undefined4 *puVar1; + char local_2c [4]; + char s [20]; + + if (this->File != (FILE *)0x0) { + sprintf(local_2c,"%d",Number); + // try { // try from 080504a6 to 080504ea has its CatchHandler @ 080504f0 + writeText(this,local_2c); + return; + } + ::error(&DAT_080efa40); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write number"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeBytesequence(TWriteScriptFile * this, uchar * Sequence, int +// Length) + +void __thiscall +TWriteScriptFile::writeBytesequence(TWriteScriptFile *this,uchar *Sequence,int Length) + +{ + undefined4 *puVar1; + int i; + int iVar2; + char *Text; + char local_3c [4]; + char s [20]; + + if (this->File == (FILE *)0x0) { + Text = &DAT_080efb20; + } + else if (Sequence == (uchar *)0x0) { + Text = "TWriteScriptFile::writeBytesequence: Sequence ist NULL.\n"; + } + else { + if (0 < Length) { + iVar2 = 0; + if (0 < Length) { + do { + if (iVar2 != 0) { + // try { // try from 080505de to 0805061d has its CatchHandler @ 08050648 + writeText(this,"-"); + } + if (this->File == (FILE *)0x0) { + ::error(&DAT_080efa40); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write number"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); + } + sprintf(local_3c,"%d",(uint)Sequence[iVar2]); + // try { // try from 0805057c to 080505d2 has its CatchHandler @ 08050630 + writeText(this,local_3c); + iVar2 = iVar2 + 1; + } while (iVar2 < Length); + } + return; + } + Text = &DAT_080efaa0; + } + ::error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write bytesequence"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void writeCoordinate(TWriteScriptFile * this, int x, int y, int z) + +void __thiscall TWriteScriptFile::writeCoordinate(TWriteScriptFile *this,int x,int y,int z) + +{ + undefined4 *puVar1; + char local_2c [4]; + char s [20]; + + if (this->File == (FILE *)0x0) { + ::error(&DAT_080efbe0); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot write coordinate"; + } + else { + if (((-1 < x) && (-1 < y)) && (-1 < z)) { + sprintf(local_2c,"[%u,%u,%u]",x,y,z); + // try { // try from 080506b4 to 08050710 has its CatchHandler @ 08050725 + writeText(this,local_2c); + return; + } + ::error(&DAT_080efb80,x,y,z); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Invalid coordinates"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void TReadBinaryFile(TReadBinaryFile * this) + +void __thiscall TReadBinaryFile::TReadBinaryFile(TReadBinaryFile *this) + +{ + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081268c8; + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void TReadBinaryFile(TReadBinaryFile * this) + +void __thiscall TReadBinaryFile::TReadBinaryFile(TReadBinaryFile *this) + +{ + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081268c8; + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void ~TReadBinaryFile(TReadBinaryFile * this, int __in_chrg) + +void __thiscall TReadBinaryFile::~TReadBinaryFile(TReadBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081268c8; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TReadBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TReadBinaryFile::~TReadBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080efc80,*piVar4); + } + } + return; +} + + + +// DWARF original prototype: void ~TReadBinaryFile(TReadBinaryFile * this, int __in_chrg) + +void __thiscall TReadBinaryFile::~TReadBinaryFile(TReadBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081268c8; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TReadBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TReadBinaryFile::~TReadBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080efc80,*piVar4); + } + } + return; +} + + + +// DWARF original prototype: void ~TReadBinaryFile(TReadBinaryFile * this, int __in_chrg) + +void __thiscall TReadBinaryFile::~TReadBinaryFile(TReadBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TReadStream)._vptr_TReadStream = (_func_int_varargs **)&PTR_readFlag_081268c8; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TReadBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TReadBinaryFile::~TReadBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080efc80,*piVar4); + } + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void open(TReadBinaryFile * this, char * FileName) + +int __thiscall TReadBinaryFile::open(TReadBinaryFile *this,char *__file,int __oflag,...) + +{ + FILE *pFVar1; + undefined4 *puVar2; + int iVar3; + int *piVar4; + + if ((FILE *)this->File != (FILE *)0x0) { + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + // try { // try from 08050984 to 080509dc has its CatchHandler @ 080509dd + ::error(&DAT_080efce0,*piVar4); + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,"File still open"); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char*::typeinfo,0); + } + pFVar1 = fopen(__file,"rb"); + this->File = (FILE *)pFVar1; + if (pFVar1 != (FILE *)0x0) { + strcpy(this->Filename,__file); + this->FileSize = -1; + return -1; + } + sprintf(ErrorString,"Cannot open file %s",__file); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = ErrorString; + // WARNING: Subroutine does not return + // try { // try from 08050961 to 08050965 has its CatchHandler @ 080509f0 + __cxa_throw(puVar2,char*::typeinfo,0); +} + + + +// DWARF original prototype: void close(TReadBinaryFile * this) + +int __thiscall TReadBinaryFile::close(TReadBinaryFile *this,int __fd) + +{ + int __errnum; + char *pcVar1; + int *piVar2; + int ErrorCode; + + pcVar1 = (char *)fclose((FILE *)this->File); + if (pcVar1 != (char *)0x0) { + piVar2 = __errno_location(); + __errnum = *piVar2; + ::error(&DAT_080efd40); + pcVar1 = strerror(__errnum); + ::error("# Datei: %s, Fehlercode: %d (%s)\n",this->Filename,__errnum,pcVar1); + } + this->File = (FILE *)0x0; + return (int)pcVar1; +} + + + +// DWARF original prototype: void seek(TReadBinaryFile * this, long Offset) + +void __thiscall TReadBinaryFile::seek(TReadBinaryFile *this,long Offset) + +{ + FILE *__stream; + int iVar1; + int *piVar2; + undefined4 *puVar3; + + __stream = (FILE *)this->File; + if (__stream == (FILE *)0x0) { + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename, + "File not open for seek"); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = ErrorString; + // WARNING: Subroutine does not return + // try { // try from 08050b6f to 08050b73 has its CatchHandler @ 08050b74 + __cxa_throw(puVar3,char*::typeinfo,0); + } + if (-1 < Offset) { + fseek(__stream,Offset,0); + return; + } + iVar1 = fclose(__stream); + if (iVar1 != 0) { + piVar2 = __errno_location(); + // try { // try from 08050ac7 to 08050b1f has its CatchHandler @ 08050b74 + ::error(&DAT_080efce0,*piVar2); + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,"Negative offset for seek" + ); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char*::typeinfo,0); +} + + + +// DWARF original prototype: int getSize(TReadBinaryFile * this) + +int __thiscall TReadBinaryFile::getSize(TReadBinaryFile *this) + +{ + int iVar1; + long __off; + long lVar2; + int Position; + + iVar1 = this->FileSize; + if (iVar1 == -1) { + __off = ftell((FILE *)this->File); + fseek((FILE *)this->File,0,2); + lVar2 = ftell((FILE *)this->File); + this->FileSize = lVar2; + fseek((FILE *)this->File,__off,0); + iVar1 = this->FileSize; + } + return iVar1; +} + + + +// DWARF original prototype: int getPosition(TReadBinaryFile * this) + +int __thiscall TReadBinaryFile::getPosition(TReadBinaryFile *this) + +{ + long lVar1; + + lVar1 = ftell((FILE *)this->File); + return lVar1; +} + + + +// DWARF original prototype: void error(TReadBinaryFile * this, char * Text) + +void __thiscall TReadBinaryFile::error(TReadBinaryFile *this,char *Text) + +{ + int iVar1; + int *piVar2; + undefined4 *puVar3; + + if ((FILE *)this->File != (FILE *)0x0) { + iVar1 = fclose((FILE *)this->File); + if (iVar1 != 0) { + piVar2 = __errno_location(); + // try { // try from 08050c71 to 08050cd2 has its CatchHandler @ 08050cd3 + ::error(&DAT_080efce0,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: Help +// DWARF original prototype: uchar readByte(TReadBinaryFile * this) + +uchar __thiscall TReadBinaryFile::readByte(TReadBinaryFile *this) + +{ + char *Filename; + size_t sVar1; + int *piVar2; + char *pcVar3; + long lVar4; + int iVar5; + int iVar6; + undefined4 *puVar7; + int Result; + int ErrorCode; + uchar Help; + + sVar1 = fread((void *)((int)&ErrorCode + 3),1,1,(FILE *)this->File); + if (sVar1 == 1) { + return ErrorCode._3_1_; + } + piVar2 = __errno_location(); + iVar6 = *piVar2; + // try { // try from 08050d50 to 08050dc5 has its CatchHandler @ 08050e52 + ::error("TReadBinaryFile::readByte: Fehler beim Lesen eines Bytes\n"); + pcVar3 = strerror(iVar6); + lVar4 = ftell((FILE *)this->File); + Filename = this->Filename; + ::error(&DAT_080efe00,Filename,lVar4,sVar1,iVar6,pcVar3); + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + ::error(&DAT_080efe60,*piVar2,lVar4,sVar1,iVar6,pcVar3); + } + this->File = (FILE *)0x0; + SaveFile(Filename); + if ((FILE *)this->File != (FILE *)0x0) { + iVar6 = fclose((FILE *)this->File); + if (iVar6 != 0) { + // try { // try from 08050de9 to 08050e3e has its CatchHandler @ 08050e3f + ::error(&DAT_080efce0,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while reading byte"); + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar7,char*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: ErrorCode +// DWARF original prototype: void readBytes(TReadBinaryFile * this, uchar * Buffer, int Count) + +void __thiscall TReadBinaryFile::readBytes(TReadBinaryFile *this,uchar *Buffer,int Count) + +{ + char *Filename; + size_t sVar1; + int *piVar2; + char *pcVar3; + long lVar4; + int iVar5; + int iVar6; + undefined4 *puVar7; + int Result; + int ErrorCode; + + sVar1 = fread(Buffer,1,Count,(FILE *)this->File); + if (sVar1 == Count) { + return; + } + piVar2 = __errno_location(); + iVar6 = *piVar2; + // try { // try from 08050ebe to 08050f33 has its CatchHandler @ 08050fc0 + ::error("TReadBinaryFile::readBytes: Fehler beim Lesen von %d Bytes\n",Count); + pcVar3 = strerror(iVar6); + lVar4 = ftell((FILE *)this->File); + Filename = this->Filename; + ::error(&DAT_080efee0,Filename,lVar4,sVar1,iVar6,pcVar3); + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + ::error(&DAT_080efe60,*piVar2,lVar4,sVar1,iVar6,pcVar3); + } + this->File = (FILE *)0x0; + SaveFile(Filename); + if ((FILE *)this->File != (FILE *)0x0) { + iVar6 = fclose((FILE *)this->File); + if (iVar6 != 0) { + // try { // try from 08050f57 to 08050fac has its CatchHandler @ 08050fad + ::error(&DAT_080efce0,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while reading bytes"); + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar7,char*::typeinfo,0); +} + + + +// DWARF original prototype: bool eof(TReadBinaryFile * this) + +bool __thiscall TReadBinaryFile::eof(TReadBinaryFile *this) + +{ + long lVar1; + int iVar2; + long __off; + long lVar3; + undefined4 *puVar4; + int Position; + + if ((FILE *)this->File != (FILE *)0x0) { + lVar1 = ftell((FILE *)this->File); + iVar2 = this->FileSize; + if (iVar2 == -1) { + __off = ftell((FILE *)this->File); + fseek((FILE *)this->File,0,2); + lVar3 = ftell((FILE *)this->File); + this->FileSize = lVar3; + fseek((FILE *)this->File,__off,0); + iVar2 = this->FileSize; + } + return iVar2 <= lVar1; + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename, + "File not open for eof check"); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = ErrorString; + // WARNING: Subroutine does not return + // try { // try from 080510be to 080510c2 has its CatchHandler @ 080510c3 + __cxa_throw(puVar4,char*::typeinfo,0); +} + + + +// DWARF original prototype: void skip(TReadBinaryFile * this, int Count) + +void __thiscall TReadBinaryFile::skip(TReadBinaryFile *this,int Count) + +{ + long lVar1; + undefined4 *puVar2; + + if ((FILE *)this->File != (FILE *)0x0) { + lVar1 = ftell((FILE *)this->File); + // try { // try from 08051117 to 0805111b has its CatchHandler @ 08051190 + seek(this,lVar1 + Count); + return; + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,"File not open for skip"); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = ErrorString; + // WARNING: Subroutine does not return + // try { // try from 08051172 to 08051176 has its CatchHandler @ 08051177 + __cxa_throw(puVar2,char*::typeinfo,0); +} + + + +// DWARF original prototype: void TWriteBinaryFile(TWriteBinaryFile * this) + +void __thiscall TWriteBinaryFile::TWriteBinaryFile(TWriteBinaryFile *this) + +{ + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void TWriteBinaryFile(TWriteBinaryFile * this) + +void __thiscall TWriteBinaryFile::TWriteBinaryFile(TWriteBinaryFile *this) + +{ + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; + this->File = (FILE *)0x0; + return; +} + + + +// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) + +void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TWriteBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080eff80,*piVar4); + } + } + return; +} + + + +// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) + +void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TWriteBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080eff80,*piVar4); + } + } + return; +} + + + +// DWARF original prototype: void ~TWriteBinaryFile(TWriteBinaryFile * this, int __in_chrg) + +void __thiscall TWriteBinaryFile::~TWriteBinaryFile(TWriteBinaryFile *this,int __in_chrg) + +{ + FILE *pFVar1; + char *pcVar2; + int iVar3; + int *piVar4; + + pFVar1 = this->File; + (this->super_TWriteStream)._vptr_TWriteStream = (_func_int_varargs **)&PTR_writeFlag_08126888; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = ""; + if (this != (TWriteBinaryFile *)0xfffffff8) { + pcVar2 = this->Filename; + } + ::error("TWriteBinaryFile::~TWriteBinaryFile: Datei %s ist noch offen.\n",pcVar2); + iVar3 = fclose((FILE *)this->File); + if (iVar3 != 0) { + piVar4 = __errno_location(); + ::error(&DAT_080eff80,*piVar4); + } + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void open(TWriteBinaryFile * this, char * FileName) + +int __thiscall TWriteBinaryFile::open(TWriteBinaryFile *this,char *__file,int __oflag,...) + +{ + FILE *pFVar1; + char *pcVar2; + int *piVar3; + undefined4 *puVar4; + int iVar5; + + if ((FILE *)this->File != (FILE *)0x0) { + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + piVar3 = __errno_location(); + // try { // try from 0805140e to 08051466 has its CatchHandler @ 08051467 + ::error(&DAT_080f0020,*piVar3); + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,"File still open"); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char*::typeinfo,0); + } + pFVar1 = fopen(__file,"wb"); + this->File = (FILE *)pFVar1; + if (pFVar1 != (FILE *)0x0) { + pcVar2 = strcpy(this->Filename,__file); + return (int)pcVar2; + } + piVar3 = __errno_location(); + iVar5 = *piVar3; + // try { // try from 0805138d to 080513ef has its CatchHandler @ 0805147a + ::error("TWriteBinaryFile::open: Kann Datei %s nicht anlegen.\n",__file); + pcVar2 = strerror(iVar5); + ::error("Fehler %d: %s.\n",iVar5,pcVar2); + sprintf(ErrorString,"Cannot create file %s.",__file); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char*::typeinfo,0); +} + + + +// DWARF original prototype: void close(TWriteBinaryFile * this) + +int __thiscall TWriteBinaryFile::close(TWriteBinaryFile *this,int __fd) + +{ + int __errnum; + char *pcVar1; + int *piVar2; + int ErrorCode; + + pcVar1 = (char *)fclose((FILE *)this->File); + if (pcVar1 != (char *)0x0) { + piVar2 = __errno_location(); + __errnum = *piVar2; + ::error(&DAT_080f0060); + pcVar1 = strerror(__errnum); + ::error("# Datei: %s, Fehlercode: %d (%s)\n",this->Filename,__errnum,pcVar1); + } + this->File = (FILE *)0x0; + return (int)pcVar1; +} + + + +// DWARF original prototype: void error(TWriteBinaryFile * this, char * Text) + +void __thiscall TWriteBinaryFile::error(TWriteBinaryFile *this,char *Text) + +{ + int iVar1; + int *piVar2; + undefined4 *puVar3; + + if ((FILE *)this->File != (FILE *)0x0) { + iVar1 = fclose((FILE *)this->File); + if (iVar1 != 0) { + piVar2 = __errno_location(); + // try { // try from 08051531 to 08051592 has its CatchHandler @ 08051593 + ::error(&DAT_080f0020,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",this->Filename,Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: Help +// DWARF original prototype: void writeByte(TWriteBinaryFile * this, uchar Number) + +void __thiscall TWriteBinaryFile::writeByte(TWriteBinaryFile *this,uchar Number) + +{ + char *Filename; + size_t sVar1; + int *piVar2; + char *pcVar3; + int iVar4; + int iVar5; + undefined4 *puVar6; + int Result; + int ErrorCode; + uchar local_11 [4]; + uchar Help; + + local_11[0] = Number; + sVar1 = fwrite(local_11,1,1,(FILE *)this->File); + if (sVar1 == 1) { + return; + } + piVar2 = __errno_location(); + iVar5 = *piVar2; + // try { // try from 0805160f to 0805166d has its CatchHandler @ 08051700 + ::error("TWriteBinaryFile::writeByte: Fehler beim Schreiben eines Bytes\n"); + pcVar3 = strerror(iVar5); + Filename = this->Filename; + ::error(&DAT_080f00e0,Filename,sVar1,iVar5,pcVar3); + iVar4 = fclose((FILE *)this->File); + if (iVar4 != 0) { + ::error(&DAT_080f0120,*piVar2,sVar1,iVar5,pcVar3); + } + this->File = (FILE *)0x0; + SaveFile(Filename); + if ((FILE *)this->File != (FILE *)0x0) { + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + // try { // try from 08051691 to 080516e6 has its CatchHandler @ 080516e7 + ::error(&DAT_080f0020,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while writing byte"); + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar6,char*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: ErrorCode +// DWARF original prototype: void writeBytes(TWriteBinaryFile * this, uchar * Buffer, int Count) + +void __thiscall TWriteBinaryFile::writeBytes(TWriteBinaryFile *this,uchar *Buffer,int Count) + +{ + char *Filename; + size_t sVar1; + int *piVar2; + char *pcVar3; + int iVar4; + int iVar5; + undefined4 *puVar6; + int Result; + int ErrorCode; + + sVar1 = fwrite(Buffer,1,Count,(FILE *)this->File); + if (sVar1 == Count) { + return; + } + piVar2 = __errno_location(); + iVar5 = *piVar2; + // try { // try from 0805176e to 080517d2 has its CatchHandler @ 08051860 + ::error("TWriteBinaryFile::writeBytes: Fehler beim Schreiben von %d Bytes\n",Count); + Filename = this->Filename; + pcVar3 = strerror(iVar5); + ::error(&DAT_080f00e0,Filename,sVar1,iVar5,pcVar3); + iVar4 = fclose((FILE *)this->File); + if (iVar4 != 0) { + ::error(&DAT_080f01e0,*piVar2,sVar1,iVar5,pcVar3); + } + this->File = (FILE *)0x0; + SaveFile(Filename); + if ((FILE *)this->File != (FILE *)0x0) { + iVar5 = fclose((FILE *)this->File); + if (iVar5 != 0) { + // try { // try from 080517f6 to 0805184b has its CatchHandler @ 0805184c + ::error(&DAT_080f0020,*piVar2); + } + } + this->File = (FILE *)0x0; + sprintf(ErrorString,"error in binary-file \"%s\": %s.",Filename,"Error while writing bytes"); + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = ErrorString; + // WARNING: Subroutine does not return + __cxa_throw(puVar6,char*::typeinfo,0); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + StaticStringTable.firstNode = (listnode<> *)0x0; + StaticStringTable.lastNode = (listnode<> *)0x0; + __cxa_atexit(__tcf_0,0,&__dso_handle); + DynamicStringTable.firstNode = (listnode<> *)0x0; + DynamicStringTable.lastNode = (listnode<> *)0x0; + __cxa_atexit(__tcf_1,0,&__dso_handle); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: p + +char * AddStaticString(char *String) + +{ + size_t sVar1; + char *__dest; + listnode<> *plVar2; + TStaticStringTableBlock *pTVar3; + listIterator<> iter; + TStaticStringTableBlock *local_18; + char *p; + + sVar1 = strlen(String); + if ((int)sVar1 < 0x10000) { + __dest = ""; + if (sVar1 != 0) { + for (plVar2 = StaticStringTable.firstNode; plVar2 != (listnode<> *)0x0; + plVar2 = plVar2->next) { + if ((int)(sVar1 + 1) < 0x10000 - (plVar2->data).TotalTextLength) { + if (plVar2 != (listnode<> *)0x0) goto LAB_0805197a; + break; + } + } + plVar2 = list<>::append(&StaticStringTable); + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + pTVar3 = (TStaticStringTableBlock *)0x0; + } + else { + pTVar3 = &plVar2->data; + } + pTVar3->TotalTextLength = 0; + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + local_18 = (TStaticStringTableBlock *)0x0; + } + else { +LAB_0805197a: + local_18 = &plVar2->data; + } + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + pTVar3 = (TStaticStringTableBlock *)0x0; + } + else { + pTVar3 = &plVar2->data; + } + __dest = local_18->Text + pTVar3->TotalTextLength; + memcpy(__dest,String,sVar1 + 1); + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + pTVar3 = (TStaticStringTableBlock *)0x0; + } + else { + pTVar3 = &plVar2->data; + } + pTVar3->TotalTextLength = sVar1 + pTVar3->TotalTextLength + 1; + } + } + else { + error("AddStaticString: String zu lang (%d).\n",sVar1); + __dest = (char *)0x0; + } + return __dest; +} + + + +// WARNING: Variable defined which should be unmapped: iter + +ulong AddDynamicString(char *String) + +{ + int iVar1; + int i_1; + size_t sVar2; + int i; + int iVar3; + TDynamicStringTableBlock *pTVar4; + int pos; + int iVar5; + int local_18; + int count; + listIterator<> iter; + + sVar2 = strlen(String); + if ((int)sVar2 < 0x8000) { + if (sVar2 == 0) { + return 0; + } + local_18 = 0; + count = (int)DynamicStringTable.firstNode; + while ((listnode<> *)count != (listnode<> *)0x0) { + if (0 < (((listnode<> *)count)->data).FreeEntries) { + if ((listnode<> *)count == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + pTVar4 = (TDynamicStringTableBlock *)0x0; + } + else { + pTVar4 = &((listnode<> *)count)->data; + } + if ((int)(sVar2 + 1) < 0x8000 - pTVar4->TotalTextLength) { + if ((listnode<> *)count != (listnode<> *)0x0) goto LAB_08051ae9; + break; + } + } + if ((listnode<> *)count == (listnode<> *)0x0) { + error("listIterator::operator++: Iterator ist NULL.\n"); + } + else { + count = (int)((listnode<> *)count)->next; + } + local_18 = local_18 + 1; + } + count = (int)list<>::append(&DynamicStringTable); + if ((listnode<> *)count == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + pTVar4 = (TDynamicStringTableBlock *)0x0; + } + else { + pTVar4 = &((listnode<> *)count)->data; + } + pTVar4->FreeEntries = 0x100; + iVar3 = 0; + pTVar4->TotalTextLength = 0; + pTVar4->Dirty = false; + do { + pTVar4->EntryType[iVar3] = '\0'; + iVar3 = iVar3 + 1; + } while (iVar3 < 0x100); + if ((listnode<> *)count == (listnode<> *)0x0) { + pTVar4 = (TDynamicStringTableBlock *)0x0; + error("listIterator::operator*: Iterator ist NULL.\n"); + } + else { +LAB_08051ae9: + pTVar4 = &((listnode<> *)count)->data; + } + iVar3 = 0; + do { + iVar5 = iVar3; + if (pTVar4->EntryType[iVar3] == '\0') break; + iVar3 = iVar3 + 1; + iVar5 = -1; + } while (iVar3 < 0x100); + if (iVar5 != -1) { + iVar1 = pTVar4->TotalTextLength; + pTVar4->EntryType[iVar5] = '\x01'; + iVar3 = pTVar4->TotalTextLength; + pTVar4->FreeEntries = pTVar4->FreeEntries + -1; + pTVar4->StringOffset[iVar5] = (ushort)iVar1; + memcpy(pTVar4->Text + iVar3,String,sVar2 + 1); + pTVar4->TotalTextLength = sVar2 + pTVar4->TotalTextLength + 1; + return iVar5 + 1 + local_18 * 0x100; + } + error("AddDynamicString: Keinen freien Platz gefunden.\n"); + } + else { + error("AddDynamicString: String zu lang (%d)\n",sVar2); + } + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: iter + +char * GetDynamicString(ulong Number) + +{ + int count; + int iVar1; + int Block; + uint uVar2; + uint uVar3; + char *Text; + listnode<> *local_10; + listIterator<> iter; + + if (Number == 0) { + return (char *)0x0; + } + uVar2 = Number - 1 >> 8; + iVar1 = 0; + uVar3 = Number - 1 & 0xff; + local_10 = DynamicStringTable.firstNode; + if (uVar2 == 0) { +LAB_08051c50: + if (local_10 != (listnode<> *)0x0) { + if ((local_10->data).EntryType[uVar3] == '\x01') { + return (local_10->data).Text + (local_10->data).StringOffset[uVar3]; + } + Text = &DAT_080f0540; + goto LAB_08051c3a; + } + } + else if (DynamicStringTable.firstNode != (listnode<> *)0x0) { + do { + local_10 = local_10->next; + iVar1 = iVar1 + 1; + if ((int)uVar2 <= iVar1) goto LAB_08051c50; + } while (local_10 != (listnode<> *)0x0); + } + Text = &DAT_080f0500; +LAB_08051c3a: + error(Text,Number); + return (char *)0x0; +} + + + +// WARNING: Variable defined which should be unmapped: iter + +void DeleteDynamicString(ulong Number) + +{ + int count; + int iVar1; + int Block; + uint uVar2; + uint uVar3; + char *Text; + listnode<> *local_10; + listIterator<> iter; + + if (Number == 0) { + return; + } + uVar2 = Number - 1 >> 8; + iVar1 = 0; + uVar3 = Number - 1 & 0xff; + local_10 = DynamicStringTable.firstNode; + if (uVar2 == 0) { +LAB_08051ce0: + if (local_10 != (listnode<> *)0x0) { + if ((local_10->data).EntryType[uVar3] == '\x01') { + (local_10->data).EntryType[uVar3] = '\x02'; + (local_10->data).Dirty = true; + return; + } + Text = &DAT_080f05c0; + goto LAB_08051cca; + } + } + else if (DynamicStringTable.firstNode != (listnode<> *)0x0) { + do { + local_10 = local_10->next; + iVar1 = iVar1 + 1; + if ((int)uVar2 <= iVar1) goto LAB_08051ce0; + } while (local_10 != (listnode<> *)0x0); + } + Text = &DAT_080f0580; +LAB_08051cca: + error(Text,Number); + return; +} + + + +// WARNING: Variable defined which should be unmapped: iter +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CleanupDynamicStrings(void) + +{ + int *piVar1; + int iVar2; + char *__s; + ushort uVar3; + int Help; + size_t sVar4; + int j; + int iVar5; + int Offset; + uint uVar6; + int Length; + int local_18; + int i; + listIterator<> iter; + + i = (int)DynamicStringTable.firstNode; + if (DynamicStringTable.firstNode != (listnode<> *)0x0) { + do { + piVar1 = (int *)(i + 8); + if (*(char *)(i + 0x10) != '\0') { + local_18 = 0; + do { + if (*(char *)(local_18 + 9 + (int)piVar1) == '\x02') { + uVar6 = (uint)*(ushort *)(i + 0x112 + local_18 * 2); + __s = (char *)(uVar6 + 0x30a + (int)piVar1); + sVar4 = strlen(__s); + iVar2 = sVar4 + 1; + *(int *)(i + 0xc) = *(int *)(i + 0xc) - iVar2; + *(undefined1 *)(local_18 + 9 + (int)piVar1) = 0; + if ((int)(iVar2 + uVar6) < 0x8001) { + sVar4 = (-iVar2 - uVar6) + 0x8000; + if (0 < (int)sVar4) { + memmove(__s,(void *)(iVar2 + uVar6 + 0x30a + (int)piVar1),sVar4); + } + *piVar1 = *piVar1 + 1; + iVar5 = 0; + do { + if ((*(char *)(iVar5 + 9 + (int)piVar1) != '\0') && + (uVar3 = *(ushort *)(i + 0x112 + iVar5 * 2), uVar6 < uVar3)) { + *(ushort *)(i + 0x112 + iVar5 * 2) = uVar3 - (short)iVar2; + } + iVar5 = iVar5 + 1; + } while (iVar5 < 0x100); + } + else { + error("CleanupDynamicStrings: Stringende fehlt\n"); + } + } + local_18 = local_18 + 1; + } while (local_18 < 0x100); + *(undefined1 *)(i + 0x10) = 0; + } + if (i == 0) { + error("listIterator::operator++: Iterator ist NULL.\n"); + } + else { + i = *(int *)i; + } + } while (i != 0); + } + return; +} + + + +bool IsCountable(char *s) + +{ + bool bVar1; + int iVar2; + byte *pbVar3; + byte *pbVar4; + bool bVar5; + bool bVar6; + bool bVar7; + + iVar2 = 5; + bVar5 = &stack0xfffffffc < (undefined1 *)0xc; + bVar7 = &stack0x00000000 == (undefined1 *)0x10; + pbVar3 = (byte *)s; + pbVar4 = (byte *)"some "; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pbVar3 < *pbVar4; + bVar7 = *pbVar3 == *pbVar4; + pbVar3 = pbVar3 + 1; + pbVar4 = pbVar4 + 1; + } while (bVar7); + bVar1 = false; + bVar6 = (!bVar5 && !bVar7) < bVar5; + bVar5 = (!bVar5 && !bVar7) == bVar5; + if (!bVar5) { + iVar2 = 2; + pbVar3 = (byte *)s; + pbVar4 = &DAT_080f02d3; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar6 = *pbVar3 < *pbVar4; + bVar5 = *pbVar3 == *pbVar4; + pbVar3 = pbVar3 + 1; + pbVar4 = pbVar4 + 1; + } while (bVar5); + if (!bVar5) { + iVar2 = 3; + pbVar3 = &DAT_080f02d6; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar6 = (byte)*s < *pbVar3; + bVar5 = *s == *pbVar3; + s = (char *)((byte *)s + 1); + pbVar3 = pbVar3 + 1; + } while (bVar5); + if ((!bVar6 && !bVar5) != bVar6) { + return false; + } + } + bVar1 = true; + } + return bVar1; +} + + + +char * Plural(char *s,int Count) + +{ + bool bVar1; + char cVar2; + char cVar3; + int iVar4; + uint *puVar5; + uint *puVar6; + uint uVar7; + uint uVar8; + byte *pbVar9; + byte *pbVar10; + char *pcVar11; + bool bVar12; + bool bVar13; + bool bVar14; + undefined1 uVar15; + char *pcVar16; + size_t __n; + char local_5c [3]; + char Last; + char Help [50]; + + Plural::ObjectNameString._0_4_ = Plural::ObjectNameString._0_4_ & 0xffffff00; + if (s == (char *)0x0) { + error(&DAT_080f0640); + goto LAB_08051ff0; + } + strcpy(Plural::ObjectNameString,s); + bVar12 = Count == 0; + bVar14 = Count == 1; + if (bVar14) goto LAB_08051ff0; + iVar4 = 5; + pbVar9 = (byte *)Plural::ObjectNameString; + pbVar10 = (byte *)"some "; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + bVar1 = false; + bVar13 = (!bVar12 && !bVar14) < bVar12; + bVar12 = (!bVar12 && !bVar14) == bVar12; + if (!bVar12) { + iVar4 = 2; + pbVar9 = (byte *)Plural::ObjectNameString; + pbVar10 = &DAT_080f02d3; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar13 = *pbVar9 < *pbVar10; + bVar12 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar12); + if (!bVar12) { + iVar4 = 3; + pbVar9 = (byte *)Plural::ObjectNameString; + pbVar10 = &DAT_080f02d6; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar13 = *pbVar9 < *pbVar10; + bVar12 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar12); + bVar1 = false; + if ((!bVar13 && !bVar12) != bVar13) goto LAB_08051f2b; + } + bVar1 = true; + } +LAB_08051f2b: + if (!bVar1) goto LAB_08051ff0; + if (Plural::ObjectNameString[1] == 'n') { + __n = 0x2f; + pcVar16 = Plural::ObjectNameString + 3; + } + else { + __n = 0x30; + pcVar16 = Plural::ObjectNameString + 2; + } + memmove(Plural::ObjectNameString,pcVar16,__n); + if (Count < 0) goto LAB_08051ff0; + pcVar16 = strstr(Plural::ObjectNameString," of "); + uVar15 = pcVar16 == (char *)0x0; + if ((bool)uVar15) { + local_5c[0] = '\0'; + } + else { + strcpy(local_5c,pcVar16); + *pcVar16 = '\0'; + } + iVar4 = 6; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "knife"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if ((bool)uVar15) { + Plural::ObjectNameString._6_2_ = SUB42(Plural::ObjectNameString._4_4_,2) & 0xff00; + builtin_strncpy(Plural::ObjectNameString,"kniv",4); + Plural::ObjectNameString[4] = 'e'; + Plural::ObjectNameString[5] = 's'; + } + else { + iVar4 = 0xf; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "throwing knife"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if ((bool)uVar15) { + builtin_strncpy(Plural::ObjectNameString,"throwing knives",0x10); + } + else { + iVar4 = 0xd; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "orc spearman"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if ((bool)uVar15) { + Plural::ObjectNameString._12_4_ = Plural::ObjectNameString._12_4_ & 0xffffff00; + builtin_strncpy(Plural::ObjectNameString,"orc spearmen",0xc); + } + else { + iVar4 = 5; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "deer"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + iVar4 = 10; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "dead deer"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + iVar4 = 6; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "sheep"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + iVar4 = 0xc; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "black sheep"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + iVar4 = 5; + pcVar16 = Plural::ObjectNameString; + pcVar11 = "fish"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar15 = *pcVar16 == *pcVar11; + pcVar16 = pcVar16 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + puVar6 = (uint *)Plural::ObjectNameString; + do { + puVar5 = puVar6; + uVar7 = *puVar5 + 0xfefefeff & ~*puVar5; + uVar8 = uVar7 & 0x80808080; + puVar6 = puVar5 + 1; + } while (uVar8 == 0); + bVar12 = (uVar7 & 0x8080) == 0; + if (bVar12) { + uVar8 = uVar8 >> 0x10; + } + if (bVar12) { + puVar6 = (uint *)((int)puVar5 + 6); + } + if (1 < (int)puVar6 + + (-0x8128bc3 - (uint)CARRY1((byte)uVar8,(byte)uVar8))) { + puVar6 = (uint *)Plural::ObjectNameString; + do { + puVar5 = puVar6; + uVar7 = *puVar5 + 0xfefefeff & ~*puVar5; + uVar8 = uVar7 & 0x80808080; + puVar6 = puVar5 + 1; + } while (uVar8 == 0); + bVar12 = (uVar7 & 0x8080) == 0; + if (bVar12) { + uVar8 = uVar8 >> 0x10; + } + if (bVar12) { + puVar6 = (uint *)((int)puVar5 + 6); + } + iVar4 = toLower((int)*(char *)((int)puVar6 + + (-4 - (uint)CARRY1((byte)uVar8 + ,(byte) + uVar8)))); + cVar2 = (char)iVar4; + puVar6 = (uint *)Plural::ObjectNameString; + do { + puVar5 = puVar6; + uVar7 = *puVar5 + 0xfefefeff & ~*puVar5; + uVar8 = uVar7 & 0x80808080; + puVar6 = puVar5 + 1; + } while (uVar8 == 0); + bVar12 = (uVar7 & 0x8080) == 0; + if (bVar12) { + uVar8 = uVar8 >> 0x10; + } + if (bVar12) { + puVar6 = (uint *)((int)puVar5 + 6); + } + iVar4 = toLower((int)*(char *)((int)puVar6 + + (-5 - (uint)CARRY1((byte)uVar8 + ,(byte) + uVar8)))); + if (((cVar2 == 's') || (cVar2 == 'x')) || + ((cVar3 = (char)iVar4, cVar2 == 'h' && + ((cVar3 == 's' || (cVar3 == 'c')))))) { +LAB_08052224: + pcVar16 = "es"; + } + else { + if ((cVar2 == 'y') && + ((((cVar3 != 'a' && (cVar3 != 'e')) && (cVar3 != 'i') + ) && ((cVar3 != 'o' && (cVar3 != 'u')))))) { + puVar6 = (uint *)Plural::ObjectNameString; + do { + puVar5 = puVar6; + uVar7 = *puVar5 + 0xfefefeff & ~*puVar5; + uVar8 = uVar7 & 0x80808080; + puVar6 = puVar5 + 1; + } while (uVar8 == 0); + bVar12 = (uVar7 & 0x8080) == 0; + if (bVar12) { + uVar8 = uVar8 >> 0x10; + } + if (bVar12) { + puVar6 = (uint *)((int)puVar5 + 6); + } + *(undefined1 *) + ((int)puVar6 + + (-4 - (uint)CARRY1((byte)uVar8,(byte)uVar8))) = + 0x69; + goto LAB_08052224; + } + if ((cVar2 == 'f') && (cVar3 == 'l')) { + puVar6 = (uint *)Plural::ObjectNameString; + do { + puVar5 = puVar6; + uVar7 = *puVar5 + 0xfefefeff & ~*puVar5; + uVar8 = uVar7 & 0x80808080; + puVar6 = puVar5 + 1; + } while (uVar8 == 0); + bVar12 = (uVar7 & 0x8080) == 0; + if (bVar12) { + uVar8 = uVar8 >> 0x10; + } + if (bVar12) { + puVar6 = (uint *)((int)puVar5 + 6); + } + *(undefined1 *) + ((int)puVar6 + + (-4 - (uint)CARRY1((byte)uVar8,(byte)uVar8))) = + 0x76; + goto LAB_08052224; + } + if (cVar2 == 'o') goto LAB_08052224; + pcVar16 = "s"; + } + strcat(Plural::ObjectNameString,pcVar16); + } + } + } + } + } + } + } + } + } + strcat(Plural::ObjectNameString,local_5c); + strcpy(local_5c,Plural::ObjectNameString); + if (Count != 0) { + snprintf(Plural::ObjectNameString,0x32,"%d %s",Count,local_5c); + } +LAB_08051ff0: + return Plural::ObjectNameString; +} + + + +// WARNING: Variable defined which should be unmapped: start + +char * SearchForWord(char *Pattern,char *Text) + +{ + char cVar1; + char cVar2; + bool bVar3; + bool bVar4; + int iVar5; + int iVar6; + uint count; + uint uVar7; + char *c; + char *Text_00; + uint uStack_18; + bool WholeWord; + uint PatternLength; + bool start; + + if ((Pattern == (char *)0x0) || (*Pattern == '\0')) { + Text_00 = &DAT_080f0680; + } + else { + if (Text != (char *)0x0) { + bVar4 = true; + uStack_18 = strlen(Pattern); + cVar1 = Pattern[uStack_18 - 1]; + if (cVar1 == '$') { + uStack_18 = uStack_18 - 1; + } + cVar2 = *Text; + do { + if (cVar2 == '\0') { + return (char *)0x0; + } + bVar3 = isSpace((int)cVar2); + if (bVar3) { + bVar4 = true; + } + else if (bVar4) { + uVar7 = 0; + do { + if (uVar7 == uStack_18) { + if (cVar1 != '$') { + return Text; + } + bVar4 = isAlpha((int)Text[uVar7]); + if ((!bVar4) && (bVar4 = isDigit((int)Text[uVar7]), !bVar4)) { + return Text; + } +LAB_080523f6: + bVar4 = false; + break; + } + iVar5 = toLower((int)Text[uVar7]); + iVar6 = toLower((int)Pattern[uVar7]); + if (iVar5 != iVar6) goto LAB_080523f6; + uVar7 = uVar7 + 1; + } while (uVar7 <= uStack_18); + } + Text = Text + 1; + cVar2 = *Text; + } while( true ); + } + Text_00 = &DAT_080f06c0; + } + error(Text_00); + return (char *)0x0; +} + + + +// WARNING: Variable defined which should be unmapped: start + +char * SearchForNumber(int Count,char *Text) + +{ + char cVar1; + bool bVar2; + bool bVar3; + char *c; + int ofs; + int iVar4; + bool start; + + if (Count < 1) { + error("SearchForNumber: Illegale Suchnummer %d.\n",Count); + } + else if (Text == (char *)0x0) { + error(&DAT_080f0700); + } + else { + bVar2 = true; + cVar1 = *Text; + while (cVar1 != '\0') { + bVar3 = isSpace((int)cVar1); + if (bVar3) { + bVar2 = true; + } + else if (bVar2) { + bVar2 = false; + bVar3 = isDigit((int)*Text); + if (bVar3) { + iVar4 = 0; + do { + iVar4 = iVar4 + 1; + if ((Text[iVar4] == '\0') || (bVar3 = isSpace((int)Text[iVar4]), bVar3)) { + Count = Count + -1; + if (Count == 0) { + return Text; + } + break; + } + bVar3 = isDigit((int)Text[iVar4]); + } while (bVar3); + } + } + Text = Text + 1; + cVar1 = *Text; + } + } + return (char *)0x0; +} + + + +bool MatchString(char *Pattern,char *String) + +{ + char cVar1; + int iVar2; + char c; + size_t sVar3; + int iVar4; + int iVar5; + int i; + int iVar6; + int *piVar7; + int *piVar8; + int *piVar9; + bool bVar10; + undefined4 uStackY_60; + char *Text; + int aiStack_58 [3]; + int *local_4c; + int local_48; + int local_44; + int i_1; + int ins; + int del; + int edit; + int local_30; + int j; + int_0__0_ *d; + size_t local_24; + size_t local_20; + int local_1c [3]; + + d = &stack0xffffffa4; + if (Pattern == (char *)0x0) { + Text = "MatchString: Pattern ist NULL.\n"; + } + else { + if (String != (char *)0x0) { + uStackY_60 = 0x805254d; + d = &stack0xffffffa4; + local_20 = strlen(String); + uStackY_60 = 0x805255b; + sVar3 = strlen(Pattern); + local_24 = sVar3; + iVar2 = -(sVar3 * 4 + 0x13 + local_20 * (sVar3 * 4 + 4) & 0xfffffff0); + iVar6 = 0; + piVar8 = (int *)((int)aiStack_58 + iVar2); + j = (int)piVar8; + if (-1 < (int)local_20) { + do { + *piVar8 = iVar6; + iVar6 = iVar6 + 1; + piVar8 = piVar8 + sVar3 + 1; + } while (iVar6 <= (int)local_20); + } + local_30 = 1; + if (0 < (int)local_24) { + aiStack_58[2] = 4; + local_4c = (int *)(j + 4); + do { + edit = (int)(Pattern + local_30); + cVar1 = (Pattern + local_30)[-1]; + i_1 = 1; + ins = 1; + bVar10 = cVar1 == '*'; + if (bVar10) { + ins = 0; + i_1 = 0; + } + del = (int)!bVar10; + ins = (int)!bVar10; + i_1 = (int)!bVar10; + iVar6 = 0; + if (cVar1 != '?') { + iVar6 = del; + } + del = iVar6; + *(int *)(j + aiStack_58[2]) = ins + *(int *)(j + -4 + aiStack_58[2]); + local_44 = 1; + if (0 < (int)local_20) { + local_48 = local_24 * 4 + 4; + piVar9 = local_4c + local_24 + 1; + piVar8 = local_4c; + do { + *(int *)(&stack0xffffffa4 + iVar2) = (int)String[local_44 + -1]; + *(undefined4 *)((int)&uStackY_60 + iVar2) = 0x8052653; + iVar4 = toLower(*(int *)(&stack0xffffffa4 + iVar2)); + *(int *)(&stack0xffffffa4 + iVar2) = (int)*(char *)(edit + -1); + *(undefined4 *)((int)&uStackY_60 + iVar2) = 0x8052664; + iVar5 = toLower(*(int *)(&stack0xffffffa4 + iVar2)); + iVar6 = 0; + if (iVar4 != iVar5) { + iVar6 = del; + } + local_1c[2] = i_1 + *piVar8; + local_1c[1] = ins + piVar9[-1]; + piVar7 = local_1c + 1; + if (i_1 + *piVar8 <= ins + piVar9[-1]) { + piVar7 = local_1c + 2; + } + local_1c[0] = iVar6 + piVar8[-1]; + if (iVar6 + piVar8[-1] < *piVar7) { + piVar7 = local_1c; + } + *piVar9 = *piVar7; + local_44 = local_44 + 1; + piVar9 = (int *)((int)piVar9 + local_48); + piVar8 = (int *)((int)piVar8 + local_48); + } while (local_44 <= (int)local_20); + } + local_30 = local_30 + 1; + local_4c = local_4c + 1; + aiStack_58[2] = aiStack_58[2] + 4; + } while (local_30 <= (int)local_24); + } + return *(int *)(local_20 * (local_24 * 4 + 4) + local_24 * 4 + j) == 0; + } + Text = "MatchString: String ist NULL.\n"; + } + uStackY_60 = 0x805271f; + error(Text); + return false; +} + + + +void AddSlashes(char *Destination,char *Source) + +{ + char cVar1; + + if (Source == (char *)0x0) { + Destination = "AddSlashes: Source ist NULL.\n"; + } + else { + if (Destination != (char *)0x0) { + cVar1 = *Source; + while (cVar1 != '\0') { + if (('!' < cVar1) && (((cVar1 < '$' || (cVar1 == '\'')) || (cVar1 == '\\')))) { + *Destination = '\\'; + Destination = Destination + 1; + cVar1 = *Source; + } + *Destination = cVar1; + Source = Source + 1; + Destination = Destination + 1; + cVar1 = *Source; + } + *Destination = '\0'; + return; + } + Destination = "AddSlashes: Destination ist NULL.\n"; + } + error(Destination); + return; +} + + + +void Trim(char *Text) + +{ + bool bVar1; + size_t sVar2; + int i; + int iVar3; + + if (Text == (char *)0x0) { + error("Trim: Text ist NULL.\n"); + return; + } + iVar3 = 0; + while ((Text[iVar3] != '\0' && (bVar1 = isSpace((int)Text[iVar3]), bVar1))) { + iVar3 = iVar3 + 1; + } + sVar2 = strlen(Text + 1); + memmove(Text,Text + iVar3,sVar2 + 1); + sVar2 = strlen(Text); + while( true ) { + if ((int)sVar2 < 1) { + return; + } + bVar1 = isSpace((int)Text[sVar2 - 1]); + if (!bVar1) break; + Text[sVar2 - 1] = '\0'; + sVar2 = sVar2 - 1; + } + return; +} + + + +void Trim(char *Destination,char *Source) + +{ + bool bVar1; + size_t sVar2; + int i; + int iVar3; + + if (Source == (char *)0x0) { + Destination = "Trim: Source ist NULL.\n"; + } + else { + if (Destination != (char *)0x0) { + iVar3 = 0; + while ((Source[iVar3] != '\0' && (bVar1 = isSpace((int)Source[iVar3]), bVar1))) { + iVar3 = iVar3 + 1; + } + strcpy(Destination,Source + iVar3); + sVar2 = strlen(Destination); + while( true ) { + if ((int)sVar2 < 1) { + return; + } + bVar1 = isSpace((int)Destination[sVar2 - 1]); + if (!bVar1) break; + Destination[sVar2 - 1] = '\0'; + sVar2 = sVar2 - 1; + } + return; + } + Destination = "Trim: Destination ist NULL.\n"; + } + error(Destination); + return; +} + + + +void ChangeWildcards(char *String) + +{ + char cVar1; + size_t sVar2; + uint i; + uint uVar3; + + if (String != (char *)0x0) { + uVar3 = 0; + while( true ) { + sVar2 = strlen(String); + if (sVar2 <= uVar3) break; + cVar1 = String[uVar3]; + if (cVar1 == '*') { + String[uVar3] = '%'; + cVar1 = '%'; + } + if (cVar1 == '?') { + String[uVar3] = '_'; + } + uVar3 = uVar3 + 1; + } + return; + } + error("ChangeWildcards: String ist NULL.\n"); + return; +} + + + +// WARNING: Variable defined which should be unmapped: start + +char * Capitals(char *Text) + +{ + bool bVar1; + bool bVar2; + size_t sVar3; + int iVar4; + int i; + int iVar5; + bool start; + + iVar5 = 0; + bVar1 = true; + while( true ) { + sVar3 = strlen(Text); + if ((int)sVar3 <= iVar5) break; + bVar2 = isAlpha((int)Text[iVar5]); + if (bVar2) { + if (bVar1) { + iVar4 = toUpper((int)Text[iVar5]); + Text[iVar5] = (char)iVar4; + } + bVar1 = false; + } + else { + bVar1 = true; + } + iVar5 = iVar5 + 1; + } + return Text; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitStrings(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitStrings(void) + +{ + return; +} + + + +void __tcf_0(void *param_1) + +{ + listnode<> *plVar1; + listnode<> *plVar2; + listnode<> *plVar3; + + if (StaticStringTable.firstNode != (listnode<> *)0x0) { + do { + plVar2 = StaticStringTable.firstNode; + if (StaticStringTable.firstNode == (listnode<> *)0x0) { + error("list::remove: node ist NULL.\n"); + } + else { + plVar3 = (StaticStringTable.firstNode)->prev; + if (plVar3 == (listnode<> *)0x0) { + plVar3 = (StaticStringTable.firstNode)->prev; + StaticStringTable.firstNode = (StaticStringTable.firstNode)->next; + } + else { + plVar3->next = (StaticStringTable.firstNode)->next; + } + plVar1 = plVar2->next; + if (plVar1 != (listnode<> *)0x0) { + plVar1->prev = plVar3; + plVar3 = StaticStringTable.lastNode; + } + StaticStringTable.lastNode = plVar3; + operator_delete(plVar2); + } + } while (StaticStringTable.firstNode != (listnode<> *)0x0); + } + return; +} + + + +void __tcf_1(void *param_1) + +{ + listnode<> *plVar1; + listnode<> *plVar2; + listnode<> *plVar3; + + if (DynamicStringTable.firstNode != (listnode<> *)0x0) { + do { + plVar2 = DynamicStringTable.firstNode; + if (DynamicStringTable.firstNode == (listnode<> *)0x0) { + error("list::remove: node ist NULL.\n"); + } + else { + plVar3 = (DynamicStringTable.firstNode)->prev; + if (plVar3 == (listnode<> *)0x0) { + plVar3 = (DynamicStringTable.firstNode)->prev; + DynamicStringTable.firstNode = (DynamicStringTable.firstNode)->next; + } + else { + plVar3->next = (DynamicStringTable.firstNode)->next; + } + plVar1 = plVar2->next; + if (plVar1 != (listnode<> *)0x0) { + plVar1->prev = plVar3; + plVar3 = DynamicStringTable.lastNode; + } + DynamicStringTable.lastNode = plVar3; + operator_delete(plVar2); + } + } while (DynamicStringTable.firstNode != (listnode<> *)0x0); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_StaticStringTable(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: listnode * +// append(list * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x1000c); + uVar2 = 0x1000c; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x10008; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +// DWARF original prototype: listnode * +// append(list * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x8314); + uVar2 = 0x8314; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x8310; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +void DisguisePassword(char *Password,char *Key) + +{ + int a; + size_t sVar1; + size_t sVar2; + undefined4 *puVar3; + int b; + int iVar4; + int i; + int iVar5; + + if (Password == (char *)0x0) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "password is null"; + } + else if (Key == (char *)0x0) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "key for disguising password is null"; + } + else { + sVar1 = strlen(Key); + sVar2 = strlen(Password); + if (sVar2 <= sVar1) { + iVar5 = 0; + while( true ) { + sVar1 = strlen(Password); + if ((int)sVar1 <= iVar5) break; + iVar4 = ((int)Key[iVar5] - (int)Password[iVar5]) + 0x5e; + Password[iVar5] = (char)iVar4 + (char)(iVar4 / 0x5e) * -0x5e + '!'; + iVar5 = iVar5 + 1; + } + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "key for disguising password is too short"; + } + // WARNING: Subroutine does not return + // try { // try from 08052cbf to 08052cc3 has its CatchHandler @ 08052cec + __cxa_throw(puVar3,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ReadConfig(void) + +{ + TReadScriptFile *pTVar1; + bool bVar2; + char cVar3; + char *pcVar4; + char *pcVar5; + int iVar6; + undefined4 *puVar7; + int iVar8; + char *pcVar9; + undefined1 uVar10; + char *in_stack_ffffafdc; + char local_501c [4]; + char Ident [30]; + char FileName [4096]; + TReadScriptFile Script; + + PrivateWorld = false; + builtin_strncpy(GameAddress,"0.0.0.0",8); + SHMKey = 0; + QueryManagerPort = 0; + builtin_strncpy(QueryManagerAddress,"0.0.0.0",8); + AdminPort = 0; + GamePort = 0; + builtin_strncpy(AdminAddress,"0.0.0.0",8); + MaxPlayers = 0; + DebugLevel = 1; + WorldType = NORMAL; + BINPATH[0] = '\0'; + DATAPATH[0] = '\0'; + LOGPATH[0] = '\0'; + MAPPATH[0] = '\0'; + MONSTERPATH[0] = '\0'; + NPCPATH[0] = '\0'; + ORIGMAPPATH[0] = '\0'; + SAVEPATH[0] = '\0'; + USERPATH[0] = '\0'; + QueryManagerAdminPW[0] = '\0'; + QueryManagerGamePW[0] = '\0'; + QueryManagerWebPW[0] = '\0'; + MaxNewbies = 0; + PremiumPlayerBuffer = 0; + PremiumNewbieBuffer = 0; + NumberOfQueryManagers = 0; + Beat = 200; + RebootTime = 0x21c; + ADMIN_DATABASE.Database[0] = '\0'; + VOLATILE_DATABASE.Database[0] = '\0'; + WEB_DATABASE.Database[0] = '\0'; + FORUM_DATABASE.Database[0] = '\0'; + MANAGER_DATABASE.Database[0] = '\0'; + // try { // try from 08052e40 to 08052e44 has its CatchHandler @ 08053bf0 + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(FileName + 0xffc)); + pcVar5 = Ident + 0x1c; + sprintf(pcVar5,".tibia"); + pcVar4 = getenv("HOME"); + if (pcVar4 != (char *)0x0) { + in_stack_ffffafdc = getenv("HOME"); + sprintf(pcVar5,"%s/.tibia"); + } + pcVar4 = getenv("home"); + if (pcVar4 != (char *)0x0) { + in_stack_ffffafdc = getenv("home"); + sprintf(pcVar5,"%s/.tibia"); + } + // try { // try from 08052e86 to 08053b32 has its CatchHandler @ 08053bd0 + bVar2 = FileExists(pcVar5); + if (!bVar2) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = "cannot find config-file"; + // WARNING: Subroutine does not return + // try { // try from 08053b75 to 08053b79 has its CatchHandler @ 08053bd0 + __cxa_throw(puVar7,char_const*::typeinfo,0); + } + TReadScriptFile::open((TReadScriptFile *)(FileName + 0xffc),pcVar5,(int)in_stack_ffffafdc); + do { + TReadScriptFile::nextToken((TReadScriptFile *)(FileName + 0xffc)); + if (FileName._4092_4_ == 0) { + TReadScriptFile::close((TReadScriptFile *)(FileName + 0xffc),(int)pcVar5); + // try { // try from 08053b3c to 08053b40 has its CatchHandler @ 08053bf0 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(FileName + 0xffc),(int)pcVar5); + return; + } + uVar10 = FileName._4092_4_ == 1; + if (!(bool)uVar10) { + TReadScriptFile::error((TReadScriptFile *)(FileName + 0xffc),"Identifier expected"); + } + pcVar5 = TReadScriptFile::getIdentifier((TReadScriptFile *)(FileName + 0xffc)); + strcpy(local_501c,pcVar5); + pcVar5 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'='); + iVar8 = 8; + pcVar4 = local_501c; + pcVar9 = "binpath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(BINPATH,pcVar5); + } + iVar8 = 8; + pcVar4 = local_501c; + pcVar9 = "mappath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(MAPPATH,pcVar5); + } + iVar8 = 0xc; + pcVar4 = local_501c; + pcVar9 = "origmappath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(ORIGMAPPATH,pcVar5); + } + iVar8 = 9; + pcVar4 = local_501c; + pcVar9 = "datapath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(DATAPATH,pcVar5); + } + iVar8 = 0xc; + pcVar4 = local_501c; + pcVar9 = "monsterpath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(MONSTERPATH,pcVar5); + } + iVar8 = 8; + pcVar4 = local_501c; + pcVar9 = "npcpath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(NPCPATH,pcVar5); + } + iVar8 = 9; + pcVar4 = local_501c; + pcVar9 = "userpath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(USERPATH,pcVar5); + } + iVar8 = 8; + pcVar4 = local_501c; + pcVar9 = "logpath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(LOGPATH,pcVar5); + } + iVar8 = 9; + pcVar4 = local_501c; + pcVar9 = "savepath"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(SAVEPATH,pcVar5); + } + iVar8 = 4; + pcVar4 = local_501c; + pcVar9 = "shm"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + SHMKey = TReadScriptFile::readNumber((TReadScriptFile *)(FileName + 0xffc)); + } + iVar8 = 10; + pcVar4 = local_501c; + pcVar9 = "adminport"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + AdminPort = TReadScriptFile::readNumber((TReadScriptFile *)(FileName + 0xffc)); + } + iVar8 = 0xd; + pcVar4 = local_501c; + pcVar9 = "adminaddress"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(AdminAddress,pcVar5); + } + iVar8 = 0x11; + pcVar4 = local_501c; + pcVar9 = "querymanagerport"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + QueryManagerPort = TReadScriptFile::readNumber((TReadScriptFile *)(FileName + 0xffc)); + } + iVar8 = 0x14; + pcVar4 = local_501c; + pcVar9 = "querymanageraddress"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(QueryManagerAddress,pcVar5); + } + iVar8 = 0x14; + pcVar4 = local_501c; + pcVar9 = "querymanageradminpw"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(QueryManagerAdminPW,pcVar5); + } + iVar8 = 0x13; + pcVar4 = local_501c; + pcVar9 = "querymanagergamepw"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(QueryManagerGamePW,pcVar5); + } + iVar8 = 0x12; + pcVar4 = local_501c; + pcVar9 = "querymanagerwebpw"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(QueryManagerWebPW,pcVar5); + } + iVar8 = 0xb; + pcVar4 = local_501c; + pcVar9 = "debuglevel"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + DebugLevel = TReadScriptFile::readNumber((TReadScriptFile *)(FileName + 0xffc)); + } + iVar8 = 6; + pcVar4 = local_501c; + pcVar9 = "state"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar4 = TReadScriptFile::readIdentifier((TReadScriptFile *)(FileName + 0xffc)); + iVar8 = 8; + pcVar9 = "private"; + do { + PrivateWorld = (bool)uVar10; + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + PrivateWorld = (bool)uVar10; + } while ((bool)uVar10); + } + iVar8 = 6; + pcVar4 = local_501c; + pcVar9 = "world"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(FileName + 0xffc)); + strcpy(WorldName,pcVar5); + } + iVar8 = 5; + pcVar4 = local_501c; + pcVar9 = "beat"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + Beat = TReadScriptFile::readNumber((TReadScriptFile *)(FileName + 0xffc)); + } + iVar8 = 0xe; + pcVar4 = local_501c; + pcVar9 = "admindatabase"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readIdentifier(pTVar1); + strcpy(ADMIN_DATABASE.Product,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(ADMIN_DATABASE.Database,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(ADMIN_DATABASE.Login,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(ADMIN_DATABASE.Password,pcVar5); + DisguisePassword(ADMIN_DATABASE.Password,"Pm-,o%yD"); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(ADMIN_DATABASE.Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(ADMIN_DATABASE.Port,pcVar5); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + } + iVar8 = 0x11; + pcVar4 = local_501c; + pcVar9 = "volatiledatabase"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readIdentifier(pTVar1); + strcpy(VOLATILE_DATABASE.Product,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(VOLATILE_DATABASE.Database,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(VOLATILE_DATABASE.Login,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(VOLATILE_DATABASE.Password,pcVar5); + DisguisePassword(VOLATILE_DATABASE.Password,"Pm-,o%yD"); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(VOLATILE_DATABASE.Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(VOLATILE_DATABASE.Port,pcVar5); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + } + iVar8 = 0xc; + pcVar4 = local_501c; + pcVar9 = "webdatabase"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readIdentifier(pTVar1); + strcpy(WEB_DATABASE.Product,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(WEB_DATABASE.Database,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(WEB_DATABASE.Login,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(WEB_DATABASE.Password,pcVar5); + DisguisePassword(WEB_DATABASE.Password,"Pm-,o%yD"); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(WEB_DATABASE.Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(WEB_DATABASE.Port,pcVar5); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + } + iVar8 = 0xe; + pcVar4 = local_501c; + pcVar9 = "forumdatabase"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readIdentifier(pTVar1); + strcpy(FORUM_DATABASE.Product,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(FORUM_DATABASE.Database,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(FORUM_DATABASE.Login,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(FORUM_DATABASE.Password,pcVar5); + DisguisePassword(FORUM_DATABASE.Password,"Pm-,o%yD"); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(FORUM_DATABASE.Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(FORUM_DATABASE.Port,pcVar5); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + } + iVar8 = 0x10; + pcVar4 = local_501c; + pcVar9 = "managerdatabase"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readIdentifier(pTVar1); + strcpy(MANAGER_DATABASE.Product,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(MANAGER_DATABASE.Database,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(MANAGER_DATABASE.Login,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(MANAGER_DATABASE.Password,pcVar5); + DisguisePassword(MANAGER_DATABASE.Password,"Pm-,o%yD"); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(MANAGER_DATABASE.Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(MANAGER_DATABASE.Port,pcVar5); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + } + iVar8 = 0xd; + pcVar4 = local_501c; + pcVar9 = "querymanager"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar10 = *pcVar4 == *pcVar9; + pcVar4 = pcVar4 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if ((bool)uVar10) { + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'{'); + do { + if (9 < NumberOfQueryManagers) { + TReadScriptFile::error + ((TReadScriptFile *)(FileName + 0xffc), + "Cannot handle more query managers"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)(FileName + 0xffc),'('); + pTVar1 = (TReadScriptFile *)(FileName + 0xffc); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(QUERY_MANAGER[NumberOfQueryManagers].Host,pcVar5); + TReadScriptFile::readSymbol(pTVar1,','); + iVar8 = NumberOfQueryManagers; + iVar6 = TReadScriptFile::readNumber(pTVar1); + QUERY_MANAGER[iVar8].Port = iVar6; + TReadScriptFile::readSymbol(pTVar1,','); + pcVar5 = TReadScriptFile::readString(pTVar1); + strcpy(QUERY_MANAGER[NumberOfQueryManagers].Password,pcVar5); + DisguisePassword(QUERY_MANAGER[NumberOfQueryManagers].Password,"Pm-,o%yD"); + pcVar5 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + NumberOfQueryManagers = NumberOfQueryManagers + 1; + cVar3 = TReadScriptFile::readSpecial(pTVar1); + } while (cVar3 != '}'); + } + } while( true ); +} + + + +// WARNING: Variable defined which should be unmapped: t + +void GetAmbiente(int *Brightness,int *Color) + +{ + int iVar1; + int Time; + tm *ptVar2; + time_t local_14; + time_t t; + + local_14 = time((time_t *)0x0); + ptVar2 = localtime(&local_14); + iVar1 = ptVar2->tm_sec + ptVar2->tm_min * 0x3c; + iVar1 = ((iVar1 % 0x96) * 2) / 5 + (iVar1 / 0x96) * 0x3c; + if (iVar1 < 0x3c) { +LAB_08053cb0: + *Brightness = 0x33; + } + else { + if (0x77 < iVar1) { + if (iVar1 < 0xb4) { + *Brightness = 0x99; +LAB_08053c88: + *Color = 0xad; + return; + } + if (iVar1 < 0xf0) { + *Brightness = 0xcc; + goto LAB_08053c88; + } + if (0x564 < iVar1) goto LAB_08053cb0; + if (iVar1 < 0x529) { + if (0x4ec < iVar1) { + *Brightness = 0x99; +LAB_08053ce5: + *Color = 0xd0; + return; + } + if (0x4b0 < iVar1) { + *Brightness = 0xcc; + goto LAB_08053ce5; + } + *Brightness = 0xff; + goto LAB_08053cb6; + } + } + *Brightness = 0x66; + } +LAB_08053cb6: + *Color = 0xd7; + return; +} + + + +// WARNING: Variable defined which should be unmapped: t + +void GetDate(int *Year,int *Cycle,int *Day) + +{ + tm *ptVar1; + tm *Time; + int local_10; + time_t t; + + local_10 = time((time_t *)0x0); + ptVar1 = localtime(&local_10); + *Year = (local_10 / 0x15180 + 4) / 7; + *Cycle = ptVar1->tm_wday; + *Day = ptVar1->tm_hour; + return; +} + + + +// WARNING: Variable defined which should be unmapped: t + +void GetTime(int *Hour,int *Minute) + +{ + tm *ptVar1; + tm *Time; + time_t local_14; + time_t t; + + local_14 = time((time_t *)0x0); + ptVar1 = localtime(&local_14); + *Hour = (ptVar1->tm_sec + ptVar1->tm_min * 0x3c) / 0x96; + *Minute = (((ptVar1->tm_sec + ptVar1->tm_min * 0x3c) % 0x96) * 2) / 5; + return; +} + + + +// WARNING: Variable defined which should be unmapped: t + +void GetRealTime(int *Hour,int *Minute) + +{ + tm *ptVar1; + time_t local_8; + time_t t; + + local_8 = time((time_t *)0x0); + ptVar1 = localtime(&local_8); + *Hour = ptVar1->tm_hour; + *Minute = ptVar1->tm_min; + return; +} + + + +// WARNING: Variable defined which should be unmapped: t + +ulong GetRoundAtTime(int Hour,int Minute) + +{ + int Delta; + tm *ptVar1; + uint uVar2; + tm *Time; + time_t local_c; + time_t t; + + local_c = time((time_t *)0x0); + ptVar1 = localtime(&local_c); + uVar2 = ((Hour - ptVar1->tm_hour) * 0xe10 + (Minute - ptVar1->tm_min) * 0x3c) - ptVar1->tm_sec; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0x15180; + } + return uVar2 + RoundNr; +} + + + +// WARNING: Variable defined which should be unmapped: t +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ulong GetRoundForNextMinute(void) + +{ + int iVar1; + int iVar2; + ulong NewRound; + tm *ptVar3; + int Delta; + uint uVar4; + time_t local_14; + time_t t_1; + time_t t; + + t_1 = time((time_t *)0x0); + ptVar3 = localtime(&t_1); + iVar1 = ptVar3->tm_hour; + iVar2 = ptVar3->tm_min; + local_14 = time((time_t *)0x0); + ptVar3 = localtime(&local_14); + uVar4 = ((iVar1 - ptVar3->tm_hour) * 0xe10 + ((iVar2 + 1) - ptVar3->tm_min) * 0x3c) - + ptVar3->tm_sec; + if (0x7fffffff < uVar4) { + uVar4 = uVar4 + 0x15180; + } + for (uVar4 = uVar4 + 0x1e + RoundNr; uVar4 < RoundNr + 0x1e; uVar4 = uVar4 + 0x3c) { + } + for (; RoundNr + 0x5a < uVar4; uVar4 = uVar4 - 0x3c) { + } + return uVar4; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + bool bVar1; + + if ((__priority == 0xffff) && (__initialize_p == 1)) { + ObjectTypes.initialized = false; + ObjectTypes.max = 5000; + ObjectTypes.space = 0x1389; + ObjectTypes.min = 0; + ObjectTypes.start = 0; + ObjectTypes.block = 1000; + ObjectTypes.entry = (TObjectType *)operator_new__(0x19f1f4); + __cxa_atexit(__tcf_0,0,&__dso_handle); + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[1].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[2].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[3].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[4].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[5].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[6].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[7].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[8].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[9].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[10].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0xb].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0xc].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0xd].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0xe].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0xf].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x10].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x11].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x12].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x13].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x14].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x15].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x16].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x17].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x18].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x19].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x1a].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x1b].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x1c].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x1d].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x1e].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x1f].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x20].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x21].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x22].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x23].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x24].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x25].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x26].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x27].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x28].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x29].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x2a].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x2b].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x2c].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x2d].TypeID = 0; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x2e].TypeID = 0; + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + bVar1 = false; + SpecialObjects[0x2f].TypeID = 0; + if ((ObjectTypes.min < 1) && (bVar1 = true, ObjectTypes.max < 0)) { + bVar1 = false; + } + if (!bVar1) { + error(&DAT_080f0a80,0); + } + SpecialObjects[0x30].TypeID = 0; + } + return; +} + + + +int GetFlagByName(char *Name) + +{ + int iVar1; + int i; + int iVar2; + char (*s1) [20]; + + iVar2 = 0; + s1 = FlagNames; + do { + iVar1 = stricmp(*s1,Name,-1); + if (iVar1 == 0) { + return iVar2; + } + iVar2 = iVar2 + 1; + s1 = s1 + 1; + } while (iVar2 < 0x42); + return -1; +} + + + +int GetTypeAttributeByName(char *Name) + +{ + int iVar1; + int i; + int iVar2; + char (*s1) [30]; + + iVar2 = 0; + s1 = TypeAttributeNames; + do { + iVar1 = stricmp(*s1,Name,-1); + if (iVar1 == 0) { + return iVar2; + } + iVar2 = iVar2 + 1; + s1 = s1 + 1; + } while (iVar2 < 0x3e); + return -1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadObjects(void) + +{ + FLAG FVar1; + bool bVar2; + bool bVar3; + char cVar4; + char *pcVar5; + TObjectType *pTVar6; + ulong uVar7; + int iVar8; + uint uVar9; + int iVar10; + int TypeID; + int i; + FLAG FVar11; + char *pcVar12; + undefined1 uVar13; + char *pcVar14; + char (*local_5084) [20]; + char (*local_5080) [30]; + int local_5074; + uchar b; + char *local_5050; + int local_5048; + int i_2; + int Offset; + char local_501c [4]; + char Ident [30]; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + local_5050 = local_101c; + pcVar14 = DATAPATH; + sprintf(local_5050,"%s/objects.srv"); + // try { // try from 08054e09 to 08054e0d has its CatchHandler @ 08055640 + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 08054e1b to 080555fd has its CatchHandler @ 08055620 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),local_5050,(int)pcVar14); + pcVar14 = (char *)0xffffffff; +LAB_08054e25: + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffb004 == 0) { + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)local_5050); + // try { // try from 08055607 to 0805560b has its CatchHandler @ 08055640 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)local_5050); + return; + } + uVar13 = stack0xffffb004 == 1; + if (!(bool)uVar13) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Identifier expected"); + } + pcVar5 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy(local_501c,pcVar5); + local_5050 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar10 = 7; + pcVar5 = local_501c; + pcVar12 = "typeid"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar5 == *pcVar12; + pcVar5 = pcVar5 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + pcVar14 = (char *)TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->Name = (char *)0x0; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->Description = (char *)0x0; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->Flags[0] = '\0'; + pTVar6->Flags[1] = '\0'; + pTVar6->Flags[2] = '\0'; + pTVar6->Flags[3] = '\0'; + iVar10 = 0; + pTVar6->Flags[4] = '\0'; + pTVar6->Flags[5] = '\0'; + pTVar6->Flags[6] = '\0'; + pTVar6->Flags[7] = '\0'; + pTVar6->Flags[8] = '\0'; + do { + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->Attributes[iVar10] = 0; + iVar10 = iVar10 + 1; + } while (iVar10 < 0x3e); + iVar10 = 0; + do { + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->AttributeOffsets[iVar10] = -1; + iVar10 = iVar10 + 1; + } while (iVar10 < 0x12); + } + uVar13 = pcVar14 == (char *)0x0; + if ((int)pcVar14 < 0) { + local_5050 = "Invalid type id"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Invalid type id"); + } + iVar10 = 5; + pcVar5 = local_501c; + pcVar12 = "name"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar5 == *pcVar12; + pcVar5 = pcVar5 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + pcVar5 = AddStaticString(pcVar5); + pTVar6->Name = pcVar5; + } + iVar10 = 0xc; + pcVar5 = local_501c; + pcVar12 = "description"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar5 == *pcVar12; + pcVar5 = pcVar5 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + pcVar5 = AddStaticString(pcVar5); + pTVar6->Description = pcVar5; + } + iVar10 = 6; + pcVar5 = local_501c; + pcVar12 = "flags"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar5 == *pcVar12; + pcVar5 = pcVar5 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); +LAB_08055258: + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffb004 != 6) goto LAB_080552b0; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)); + i_2 = 0; + local_5048 = 0; + if (cVar4 != '}') goto code_r0x08055295; + goto LAB_08055365; + } + goto LAB_08054f04; +code_r0x08055295: + if ((stack0xffffb004 != 6) || + (cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)), cVar4 != ',')) { +LAB_080552b0: + pcVar5 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar10 = 0; + local_5084 = FlagNames; + do { + iVar8 = stricmp(*local_5084,pcVar5,-1); + if (iVar8 == 0) goto LAB_08055307; + local_5084 = local_5084 + 1; + iVar10 = iVar10 + 1; + } while (iVar10 < 0x42); + iVar10 = -1; +LAB_08055307: + if (iVar10 == -1) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Unknown flag"); + } + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + iVar8 = iVar10 + 7; + if (-1 < iVar10) { + iVar8 = iVar10; + } + pTVar6->Flags[iVar8 >> 3] = + pTVar6->Flags[iVar8 >> 3] | + (byte)(1 << ((char)iVar10 - (char)((iVar8 >> 3) << 3) & 0x1fU)); + } + goto LAB_08055258; +LAB_08055365: + do { + bVar3 = false; + bVar2 = false; + if ((ObjectTypes.min <= (int)pcVar14) && ((int)pcVar14 <= ObjectTypes.max)) { + bVar2 = true; + } + local_5050 = pcVar14; + if (!bVar2) { + error(&DAT_080f0a80,pcVar14); + local_5050 = (char *)0x0; + } + FVar1 = InstanceAttributeFlags[local_5048]; + FVar11 = FVar1; + if (0x7fffffff < FVar1) { + FVar11 = FVar1 + USEEVENT; + } + uVar9 = 1 << ((char)FVar1 + (char)((int)FVar11 >> 3) * -8 & 0x1fU); + pTVar6 = vector<>::operator()(&ObjectTypes,(int)local_5050); + if ((uint)(pTVar6->Flags[(int)FVar11 >> 3] & (byte)uVar9) == (uVar9 & 0xff)) { +LAB_08055442: + bVar3 = true; + } + else if (local_5048 == 0) { + bVar2 = false; + if ((ObjectTypes.min <= (int)pcVar14) && (bVar2 = true, ObjectTypes.max < (int)pcVar14)) + { + bVar2 = false; + } + local_5050 = pcVar14; + if (!bVar2) { + error(&DAT_080f0a80,pcVar14); + local_5050 = (char *)0x0; + } + pTVar6 = vector<>::operator()(&ObjectTypes,(int)local_5050); + if ((pTVar6->Flags[0] & 0x20) != 0) goto LAB_08055442; + } + if (bVar3) { + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + pTVar6->AttributeOffsets[local_5048] = i_2; + i_2 = i_2 + 1; + } + local_5048 = local_5048 + 1; + uVar13 = local_5048 == 0x11; + } while (local_5048 < 0x12); +LAB_08054f04: + iVar10 = 0xb; + pcVar5 = local_501c; + pcVar12 = "attributes"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar5 == *pcVar12; + pcVar5 = pcVar5 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_5050 = (char *)0x7b; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); +LAB_08054f35: + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffb004 != 6) goto LAB_08054f7d; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)); + if (cVar4 != '}') goto code_r0x08054f62; + } + goto LAB_08054e25; +code_r0x08054f62: + if ((stack0xffffb004 != 6) || + (cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)), cVar4 != ',')) { +LAB_08054f7d: + pcVar5 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + local_5074 = 0; + local_5080 = TypeAttributeNames; + do { + iVar10 = stricmp(*local_5080,pcVar5,-1); + if (iVar10 == 0) goto LAB_08054fde; + local_5080 = local_5080 + 1; + local_5074 = local_5074 + 1; + } while (local_5074 < 0x3e); + local_5074 = -1; +LAB_08054fde: + if (local_5074 == -1) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Unknown attribute"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + uVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar6->Attributes[local_5074] = uVar7; + if (local_5074 == 0x3d) { + local_5050 = pcVar14; + pTVar6 = vector<>::operator()(&ObjectTypes,(int)pcVar14); + uVar7 = pTVar6->Attributes[0x3d]; + bVar2 = false; + if ((0 < (int)uVar7) && ((int)uVar7 < 0x32)) { + bVar2 = true; + } + if (!bVar2) { + local_5050 = "Unknown meaning"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Unknown meaning"); + } + bVar2 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar2 = true; + } + if (!bVar2) { + local_5050 = (char *)0x0; + error(&DAT_080f0a80); + } + bVar2 = false; + if ((ObjectTypes.min < 1) && (bVar2 = true, ObjectTypes.max < 0)) { + bVar2 = false; + } + if (!bVar2) { + local_5050 = (char *)0x0; + error(&DAT_080f0a80); + } + if (SpecialObjects[uVar7].TypeID != 0) { + local_5050 = "Special object already defined"; + TReadScriptFile::error + ((TReadScriptFile *)(Ident + 0x1c),"Special object already defined"); + } + bVar2 = false; + if ((ObjectTypes.min <= (int)pcVar14) && ((int)pcVar14 <= ObjectTypes.max)) { + bVar2 = true; + } + pcVar5 = pcVar14; + if (!bVar2) { + local_5050 = pcVar14; + error(&DAT_080f0a80); + pcVar5 = (char *)0x0; + } + bVar2 = false; + if ((ObjectTypes.min <= (int)pcVar5) && ((int)pcVar5 <= ObjectTypes.max)) { + bVar2 = true; + } + if (!bVar2) { + local_5050 = pcVar5; + error(&DAT_080f0a80); + pcVar5 = (char *)0x0; + } + iVar8 = ObjectTypes.max; + iVar10 = ObjectTypes.min; + SpecialObjects[uVar7].TypeID = (int)pcVar5; + if ((int)pcVar5 < iVar10 || iVar8 < (int)pcVar5) { + error(&DAT_080f0a80); + local_5050 = pcVar5; + } + } + } + goto LAB_08054f35; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadConversionList(void) + +{ + istream *this; + int i; + int iVar1; + undefined4 *puVar2; + int local_1148; + int Type; + int Number; + int Group; + char FileName [4096]; + ifstream IN; + undefined4 local_134 [3]; + uint auStack_128 [23]; + __basic_file local_cc [25]; + undefined1 local_b3; + undefined *local_ac; + ios_base local_a8 [16]; + uint local_98; + + this = (istream *)(FileName + 0xffc); + // try { // try from 0805566b to 0805566f has its CatchHandler @ 08055a21 + std::ios_base::ios_base(local_a8); + local_ac = (undefined *)0x8128950; + // try { // try from 0805568e to 08055692 has its CatchHandler @ 080559a2 + std::istream::istream(this,(streambuf *)(std::ifstream::VTT + 4)); + FileName._4092_4_ = &DAT_08128994; + local_ac = &DAT_081289a8; + // try { // try from 080556b2 to 080556b6 has its CatchHandler @ 0805599c + std::filebuf::filebuf((filebuf *)local_134); + // try { // try from 080556ca to 080556ce has its CatchHandler @ 08055955 + std::ios::init((EVP_PKEY_CTX *)&local_ac); + iVar1 = 0; + do { + OldGroup[iVar1] = '\0'; + OldNumber[iVar1] = '\0'; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x2000); + iVar1 = 0; + do { + NewType[iVar1] = -1; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x10000); + sprintf((char *)&Group,"%s/conversion.lst",DATAPATH); + // try { // try from 08055742 to 08055831 has its CatchHandler @ 080559a8 + iVar1 = std::filebuf::open((char *)local_134,(int)&Group,8); + if (iVar1 == 0) { + std::ios::clear(this + *(int *)(FileName._4092_4_ + -0xc), + *(uint *)((int)auStack_128 + *(int *)(FileName._4092_4_ + -0xc)) | 4); + } + if ((local_98 & 5) == 0) { + while( true ) { + std::istream::operator>>(this,&Number); + if ((local_98 & 2) != 0) { + iVar1 = std::filebuf::close((int)local_134); + if (iVar1 == 0) { + // try { // try from 08055904 to 0805594f has its CatchHandler @ 080559a8 + std::ios::clear(this + *(int *)(FileName._4092_4_ + -0xc), + *(uint *)((int)auStack_128 + *(int *)(FileName._4092_4_ + -0xc)) + | 4); + } + iVar1 = 0; + do { + OldGroup[iVar1] = '\0'; + OldNumber[iVar1] = (uchar)iVar1; + NewType[iVar1] = iVar1; + iVar1 = iVar1 + 1; + } while (iVar1 < 0xb); + OldGroup[99] = 0xfa; + NewType[64000] = 99; + OldNumber[99] = '\0'; + FileName._4092_4_ = &DAT_08128994; + local_ac = &DAT_081289a8; + local_134[0] = 0x8128ad0; + // try { // try from 08055899 to 080558de has its CatchHandler @ 08055a21 + std::filebuf::close((int)local_134); + local_b3 = 0; + std::__basic_file::~__basic_file(local_cc); + std::streambuf::~streambuf((streambuf *)local_134); + std::istream::~istream(this); + std::ios::~ios((ios *)&local_ac); + return; + } + std::istream::operator>>(this,&Type); + std::istream::operator>>(this,&local_1148); + if (0x1ffe < local_1148 - 1U) break; + OldGroup[local_1148] = (uchar)Number; + OldNumber[local_1148] = (uchar)Type; + NewType[Number * 0x100 + Type] = local_1148; + } + error(&DAT_080f0ae0,local_1148); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "Error while loading conversion.lst"; + } + else { + error(&DAT_080f0b60); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "Cannot open conversion.lst"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +ObjectType GetNewObjectType(uchar Group,uchar Number) + +{ + bool bVar1; + int Type; + uint uVar2; + int iVar3; + undefined3 in_stack_00000005; + byte in_stack_0000000c; + + uVar2 = (uint)in_stack_0000000c; + iVar3 = NewType[CONCAT11(Number,in_stack_0000000c)]; + if (iVar3 == -1) { + error("GetNewObjectType: Objekttyp %d/%d existiert nicht.\n",(uint)Number,uVar2); + bVar1 = false; + if ((ObjectTypes.min < 1) && ((uint)ObjectTypes.max < 0x80000000)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,0,uVar2); + } + *_Group = 0; + } + else { + bVar1 = false; + if ((ObjectTypes.min <= iVar3) && (iVar3 <= ObjectTypes.max)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,iVar3); + iVar3 = 0; + } + *_Group = iVar3; + } + return (ObjectType)(int)_Group; +} + + + +void GetOldObjectType(ObjectType *Type,uchar *Group,uchar *Number) + +{ + int iVar1; + bool bVar2; + + bVar2 = false; + iVar1 = Type->TypeID; + if ((ObjectTypes.min <= iVar1) && (iVar1 <= ObjectTypes.max)) { + bVar2 = true; + } + if (bVar2) { + *Group = OldGroup[iVar1]; + *Number = OldNumber[Type->TypeID]; + return; + } + error(&DAT_080f0be0); + return; +} + + + +bool ObjectTypeExists(uchar Group,uchar Number) + +{ + return (bool)((byte)~(byte)((uint)NewType[CONCAT11(Group,Number)] >> 0x18) >> 7); +} + + + +// DWARF original prototype: void setTypeID(ObjectType * this, int _TypeID) + +void __thiscall ObjectType::setTypeID(ObjectType *this,int _TypeID) + +{ + bool bVar1; + + bVar1 = false; + if ((ObjectTypes.min <= _TypeID) && (_TypeID <= ObjectTypes.max)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080f0a80,_TypeID); + _TypeID = 0; + } + this->TypeID = _TypeID; + return; +} + + + +// DWARF original prototype: char * getName(ObjectType * this, int Count) + +char * __thiscall ObjectType::getName(ObjectType *this) + +{ + char *pcVar1; + TObjectType *pTVar2; + int in_stack_00000008; + char local_4c [4]; + char ObjectName [50]; + + local_4c[0] = '\0'; + if (this->TypeID == 99) { + error("ObjectType::getName: Der Kreaturtyp hat keinen Namen.\n"); + pcVar1 = (char *)0x0; + } + else { + pTVar2 = vector<>::operator()(&ObjectTypes,this->TypeID); + if (pTVar2->Name != (char *)0x0) { + strcpy(local_4c,pTVar2->Name); + } + pcVar1 = Plural(local_4c,in_stack_00000008); + } + return pcVar1; +} + + + +// DWARF original prototype: char * getDescription(ObjectType * this) + +char * __thiscall ObjectType::getDescription(ObjectType *this) + +{ + TObjectType *pTVar1; + + pTVar1 = vector<>::operator()(&ObjectTypes,this->TypeID); + return pTVar1->Description; +} + + + +// DWARF original prototype: bool getFlag(ObjectType * this, FLAG Flag) + +bool __thiscall ObjectType::getFlag(ObjectType *this,FLAG Flag) + +{ + uint uVar1; + TObjectType *pTVar2; + FLAG FVar3; + uchar b; + + FVar3 = Flag + USEEVENT; + if (-1 < (int)Flag) { + FVar3 = Flag; + } + uVar1 = 1 << ((char)Flag + (char)((int)FVar3 >> 3) * -8 & 0x1fU); + pTVar2 = vector<>::operator()(&ObjectTypes,this->TypeID); + return (uint)(pTVar2->Flags[(int)FVar3 >> 3] & (byte)uVar1) == (uVar1 & 0xff); +} + + + +// DWARF original prototype: ulong getAttribute(ObjectType * this, TYPEATTRIBUTE Attribute) + +ulong __thiscall ObjectType::getAttribute(ObjectType *this,TYPEATTRIBUTE Attribute) + +{ + FLAG FVar1; + uint uVar2; + TObjectType *pTVar3; + ulong uVar4; + FLAG FVar5; + uchar b; + + FVar1 = TypeAttributeFlags[Attribute]; + FVar5 = FVar1 + USEEVENT; + if (-1 < (int)FVar1) { + FVar5 = FVar1; + } + uVar2 = 1 << ((char)FVar1 + (char)((int)FVar5 >> 3) * -8 & 0x1fU); + pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID); + if ((uint)(pTVar3->Flags[(int)FVar5 >> 3] & (byte)uVar2) == (uVar2 & 0xff)) { + pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID); + uVar4 = pTVar3->Attributes[Attribute]; + } + else { + error(&DAT_080f0c60,this->TypeID,TypeAttributeFlags[Attribute],Attribute); + uVar4 = 0; + } + return uVar4; +} + + + +// DWARF original prototype: int getAttributeOffset(ObjectType * this, INSTANCEATTRIBUTE Attribute) + +int __thiscall ObjectType::getAttributeOffset(ObjectType *this,INSTANCEATTRIBUTE Attribute) + +{ + FLAG FVar1; + uint uVar2; + TObjectType *pTVar3; + int iVar4; + FLAG FVar5; + uchar b; + + FVar1 = InstanceAttributeFlags[Attribute]; + FVar5 = FVar1 + USEEVENT; + if (-1 < (int)FVar1) { + FVar5 = FVar1; + } + uVar2 = 1 << ((char)FVar1 + (char)((int)FVar5 >> 3) * -8 & 0x1fU); + pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID); + if ((uint)(pTVar3->Flags[(int)FVar5 >> 3] & (byte)uVar2) == (uVar2 & 0xff)) { +LAB_08055e2a: + pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID); + iVar4 = pTVar3->AttributeOffsets[Attribute]; + } + else { + if (Attribute == CONTENT) { + pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID); + if ((pTVar3->Flags[0] & 0x20) != 0) goto LAB_08055e2a; + } + iVar4 = -1; + } + return iVar4; +} + + + +bool ObjectTypeExists(int TypeID) + +{ + bool bVar1; + + bVar1 = false; + if ((ObjectTypes.min <= TypeID) && (TypeID <= ObjectTypes.max)) { + bVar1 = true; + } + return bVar1; +} + + + +ObjectType GetSpecialObject(SPECIALMEANING Meaning) + +{ + bool bVar1; + int in_stack_00000008; + char *Text; + int _TypeID; + ObjectType local_2c [7]; + + bVar1 = false; + if ((0 < in_stack_00000008) && (in_stack_00000008 < 0x32)) { + bVar1 = true; + } + if (bVar1) { + ObjectType::setTypeID(local_2c,0); + _TypeID = SpecialObjects[in_stack_00000008].TypeID; + if (_TypeID != local_2c[0].TypeID) goto LAB_08055ec3; + Text = "GetSpecialObject: Kein Objekttyp mit Bedeutung %d definiert.\n"; + } + else { + Text = &DAT_080f0cc0; + } + error(Text); + _TypeID = 0; +LAB_08055ec3: + ObjectType::setTypeID((ObjectType *)Meaning,_TypeID); + return (ObjectType)Meaning; +} + + + +ObjectType GetObjectTypeByName(char *SearchName,bool Movable) + +{ + TObjectType *pTVar1; + char *pcVar2; + int iVar3; + char *ObjectName; + int TypeID; + int _TypeID; + undefined3 in_stack_00000009; + char in_stack_0000000c; + ObjectType _TypeID_00; + char local_dc [3]; + bool Movable_local; + char Help [50]; + ObjectType local_9c [4]; + ObjectType local_8c [4]; + ObjectType local_7c; + ObjectType Type; + ObjectType local_6c; + ObjectType BestType; + char local_5c [4]; + char Pattern [50]; + + if (_Movable == (char *)0x0) { + error("GetObjectTypeByName: SearchName ist NULL.\n"); + _TypeID_00.TypeID = 0; + } + else { + snprintf(local_5c,0x32," %s ",_Movable); + ObjectType::setTypeID(&local_6c,0); + ObjectType::setTypeID(&local_7c,99); + _TypeID = local_7c.TypeID + 1; + _TypeID_00.TypeID = local_6c.TypeID; + if (_TypeID <= ObjectTypes.max) { + do { + ObjectType::setTypeID(&local_7c,_TypeID); + if ((((in_stack_0000000c == '\0') || + (pTVar1 = vector<>::operator()(&ObjectTypes,local_7c.TypeID), + (pTVar1->Flags[4] & 2) == 0)) && + (pcVar2 = ObjectType::getName(&local_7c), pcVar2 != (char *)0x0)) && + (*pcVar2 != '\0')) { + iVar3 = stricmp(pcVar2,_Movable,-1); + _TypeID_00.TypeID = local_7c.TypeID; + if (iVar3 == 0) break; + ObjectType::setTypeID(local_8c,0); + ObjectType::setTypeID(local_9c,local_8c[0].TypeID); + if (local_6c.TypeID == local_9c[0].TypeID) { + snprintf(local_dc,0x32," %s ",pcVar2); + pcVar2 = strstr(local_dc,local_5c); + if (pcVar2 != (char *)0x0) { + ObjectType::setTypeID(local_8c,local_7c.TypeID); + ObjectType::setTypeID(&local_6c,local_8c[0].TypeID); + ObjectType::setTypeID(local_9c,local_6c.TypeID); + } + } + } + _TypeID = _TypeID + 1; + _TypeID_00.TypeID = local_6c.TypeID; + } while (_TypeID <= ObjectTypes.max); + } + } + ObjectType::setTypeID((ObjectType *)SearchName,_TypeID_00.TypeID); + return (ObjectType)(int)SearchName; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitObjects(void) + +{ + // try { // try from 08056126 to 0805612f has its CatchHandler @ 08056134 + LoadObjects(); + LoadConversionList(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitObjects(void) + +{ + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (ObjectTypes.entry == (TObjectType *)0x0) { + return; + } + operator_delete__(ObjectTypes.entry); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_FlagNames(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: TObjectType * operator()(vector * this, int i) + +TObjectType * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + char **ppcVar1; + TObjectType *pTVar2; + uint uVar3; + int iVar4; + int j_1; + int j; + int iVar5; + TObjectType *pTVar6; + TObjectType *pTVar7; + int *piVar8; + int iVar9; + int extend_1; + TObjectType *help; + int extend; + uchar Help [340]; + + iVar5 = this->start; + while (i < iVar5) { + help = (TObjectType *)this->block; + if (help == (TObjectType *)0x0) { + pTVar2 = (TObjectType *)this->space; + help = pTVar2; + } + else { + pTVar2 = (TObjectType *)this->space; + } + pTVar2 = (TObjectType *) + operator_new__((int)(pTVar2->Flags + (int)(help->Flags + -0x10)) * 0x154); + iVar5 = this->min; + if (iVar5 <= this->max) { + do { + piVar8 = &extend; + uVar3 = 0x154; + pTVar6 = pTVar2 + (iVar5 - this->start) + (int)help; + if (((uint)&extend & 4) != 0) { + ppcVar1 = &pTVar6->Name; + piVar8 = (int *)Help; + pTVar6 = (TObjectType *)&pTVar6->Description; + extend = (int)*ppcVar1; + uVar3 = 0x150; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + *piVar8 = (int)pTVar6->Name; + pTVar6 = (TObjectType *)&pTVar6->Description; + piVar8 = piVar8 + 1; + } + iVar9 = iVar5 - this->start; + pTVar6 = pTVar2 + (int)help + iVar9; + pTVar7 = this->entry + iVar9; + uVar3 = 0x154; + if (((uint)pTVar6 & 4) != 0) { + ppcVar1 = &pTVar7->Name; + pTVar7 = (TObjectType *)&pTVar7->Description; + pTVar6->Name = *ppcVar1; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = pTVar7->Name; + pTVar7 = (TObjectType *)&pTVar7->Description; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + uVar3 = 0x154; + piVar8 = &extend; + pTVar6 = this->entry + (iVar5 - this->start); + if (((uint)pTVar6 & 4) != 0) { + piVar8 = (int *)Help; + pTVar6->Name = (char *)extend; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = (char *)*piVar8; + piVar8 = piVar8 + 1; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + iVar5 = iVar5 + 1; + } while (iVar5 <= this->max); + } + if (this->entry != (TObjectType *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar2; + iVar5 = this->start - (int)help; + this->start = iVar5; + this->space = (int)(help->Flags + this->space + -8); + } + iVar4 = this->space; + iVar9 = iVar4 + iVar5; + while (iVar9 <= i) { + iVar9 = iVar4; + if (this->block != 0) { + iVar9 = this->block; + } + pTVar2 = (TObjectType *)operator_new__((iVar9 + iVar4) * 0x154); + iVar5 = this->min; + if (iVar5 <= this->max) { + do { + piVar8 = &extend; + pTVar6 = pTVar2 + (iVar5 - this->start); + uVar3 = 0x154; + if (((uint)&extend & 4) != 0) { + ppcVar1 = &pTVar6->Name; + piVar8 = (int *)Help; + pTVar6 = (TObjectType *)&pTVar6->Description; + extend = (int)*ppcVar1; + uVar3 = 0x150; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + *piVar8 = (int)pTVar6->Name; + pTVar6 = (TObjectType *)&pTVar6->Description; + piVar8 = piVar8 + 1; + } + iVar4 = iVar5 - this->start; + pTVar6 = pTVar2 + iVar4; + pTVar7 = this->entry + iVar4; + uVar3 = 0x154; + if (((uint)pTVar6 & 4) != 0) { + ppcVar1 = &pTVar7->Name; + pTVar7 = (TObjectType *)&pTVar7->Description; + pTVar6->Name = *ppcVar1; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = pTVar7->Name; + pTVar7 = (TObjectType *)&pTVar7->Description; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + uVar3 = 0x154; + piVar8 = &extend; + pTVar6 = this->entry + (iVar5 - this->start); + if (((uint)pTVar6 & 4) != 0) { + piVar8 = (int *)Help; + pTVar6->Name = (char *)extend; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = (char *)*piVar8; + piVar8 = piVar8 + 1; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + iVar5 = iVar5 + 1; + } while (iVar5 <= this->max); + } + if (this->entry != (TObjectType *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar2; + iVar5 = this->start; + iVar4 = iVar9 + this->space; + this->space = iVar4; + iVar9 = iVar4 + iVar5; + } + iVar9 = this->min; + while (i < iVar9) { + this->min = iVar9 + -1; + if (this->initialized != false) { + pTVar2 = &this->init; + uVar3 = 0x154; + pTVar6 = this->entry + ((iVar9 + -1) - iVar5); + if (((uint)pTVar6 & 4) != 0) { + pTVar2 = (TObjectType *)&(this->init).Description; + pTVar6->Name = (this->init).Name; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = pTVar2->Name; + pTVar2 = (TObjectType *)&pTVar2->Description; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + iVar5 = this->start; + } + iVar9 = this->min; + } + iVar9 = this->max; + while (iVar9 < i) { + this->max = iVar9 + 1; + if (this->initialized != false) { + pTVar2 = &this->init; + pTVar6 = this->entry + ((iVar9 + 1) - iVar5); + uVar3 = 0x154; + if (((uint)pTVar6 & 4) != 0) { + pTVar2 = (TObjectType *)&(this->init).Description; + pTVar6->Name = (this->init).Name; + uVar3 = 0x150; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->Name = pTVar2->Name; + pTVar2 = (TObjectType *)&pTVar2->Description; + pTVar6 = (TObjectType *)&pTVar6->Description; + } + iVar5 = this->start; + } + iVar9 = this->max; + } + return this->entry + (i - iVar5); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + Semaphore::Semaphore(&LogfileMutex,1); + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void StartGame(void) + +{ + if (SHM == (TSharedMemory *)0x0) { + error("StartGame: SharedMemory existiert nicht.\n"); + } + else if (SHM->GameState == GAME_STARTING) { + SHM->GameState = GAME_RUNNING; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CloseGame(void) + +{ + if (SHM == (TSharedMemory *)0x0) { + error("CloseGame: SharedMemory existiert nicht.\n"); + } + else if (SHM->GameState == GAME_RUNNING) { + SHM->GameState = GAME_CLOSING; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void EndGame(void) + +{ + if (SHM == (TSharedMemory *)0x0) { + error("EndGame: SharedMemory existiert nicht.\n"); + } + else { + SHM->GameState = GAME_ENDING; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool LoginAllowed(void) + +{ + bool bVar1; + + if (SHM == (TSharedMemory *)0x0) { + error("IsLoginAllowed: SharedMemory existiert nicht.\n"); + bVar1 = false; + } + else { + bVar1 = SHM->GameState == GAME_RUNNING; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GameRunning(void) + +{ + bool bVar1; + + if (SHM == (TSharedMemory *)0x0) { + error("GameRunning: SharedMemory existiert nicht.\n"); + bVar1 = false; + } + else { + bVar1 = SHM->GameState < GAME_ENDING; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GameStarting(void) + +{ + bool bVar1; + + if (SHM == (TSharedMemory *)0x0) { + error("GameStarting: SharedMemory existiert nicht.\n"); + bVar1 = false; + } + else { + bVar1 = SHM->GameState == GAME_STARTING; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GameEnding(void) + +{ + bool bVar1; + + if (SHM == (TSharedMemory *)0x0) { + error("GameEnding: SharedMemory existiert nicht.\n"); + bVar1 = false; + } + else { + bVar1 = SHM->GameState - GAME_CLOSING < 2; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +pid_t GetGameThreadPID(void) + +{ + pid_t pVar1; + + pVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + pVar1 = SHM->GameThreadPID; + } + return pVar1; +} + + + +void ErrorHandler(char *Text) + +{ + ulong uVar1; + + if (VerboseOutput) { + printf("%s",Text); + } + if (SHM != (TSharedMemory *)0x0) { + if (SHM->Errors < 0x8000) { + Log("error",Text); + } + uVar1 = SHM->Errors + 1; + SHM->Errors = uVar1; + if (uVar1 == 0x8000) { + Log("error","Zu viele Fehler. Keine weitere Protokollierung.\n"); + } + } + return; +} + + + +void PrintHandler(int Level,char *Text) + +{ + size_t sVar1; + int iVar2; + int iVar3; + TSharedMemory *pTVar4; + + if (Level <= DebugLevel) { + if (VerboseOutput) { + printf("%s",Text); + } + if (SHM != (TSharedMemory *)0x0) { + Semaphore::down(&LogfileMutex); + strncpy(SHM->PrintBuffer[SHM->PrintBufferPosition],Text,0x7f); + SHM->PrintBuffer[SHM->PrintBufferPosition][0x7e] = '\0'; + pTVar4 = SHM; + iVar3 = SHM->PrintBufferPosition; + if (SHM->PrintBuffer[iVar3][0] != '\0') { + sVar1 = strlen(SHM->PrintBuffer[iVar3]); + if (pTVar4->PrintBuffer[iVar3 + -1][sVar1 + 0x7f] != '\n') { + strcat(pTVar4->PrintBuffer[pTVar4->PrintBufferPosition],"\n"); + pTVar4 = SHM; + } + } + iVar2 = pTVar4->PrintBufferPosition + 1; + iVar3 = 0; + if (iVar2 < 200) { + iVar3 = iVar2; + } + pTVar4->PrintBufferPosition = iVar3; + Semaphore::up(&LogfileMutex); + return; + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetPrintlogPosition(void) + +{ + int iVar1; + + iVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + iVar1 = SHM->PrintBufferPosition; + } + return iVar1; +} + + + +char * GetPrintlogLine(int Line) + +{ + char (*pacVar1) [128]; + + if ((SHM == (TSharedMemory *)0x0) || (199 < Line)) { + pacVar1 = (char (*) [128])0x0; + } + else { + pacVar1 = SHM->PrintBuffer + Line; + } + return *pacVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void IncrementObjectCounter(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->ObjectCounter = SHM->ObjectCounter + 1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DecrementObjectCounter(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->ObjectCounter = SHM->ObjectCounter - 1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ulong GetObjectCounter(void) + +{ + ulong uVar1; + + uVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + uVar1 = SHM->ObjectCounter; + } + return uVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void IncrementPlayersOnline(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->PlayersOnline = SHM->PlayersOnline + 1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DecrementPlayersOnline(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->PlayersOnline = SHM->PlayersOnline + -1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetPlayersOnline(void) + +{ + int iVar1; + + iVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + iVar1 = SHM->PlayersOnline; + } + return iVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void IncrementNewbiesOnline(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->NewbiesOnline = SHM->NewbiesOnline + 1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DecrementNewbiesOnline(void) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->NewbiesOnline = SHM->NewbiesOnline + -1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetNewbiesOnline(void) + +{ + int iVar1; + + iVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + iVar1 = SHM->NewbiesOnline; + } + return iVar1; +} + + + +void SetRoundNr(ulong RoundNr) + +{ + if (SHM != (TSharedMemory *)0x0) { + SHM->RoundNr = RoundNr; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ulong GetRoundNr(void) + +{ + ulong uVar1; + + uVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + uVar1 = SHM->RoundNr; + } + return uVar1; +} + + + +void SetCommand(int Command,char *Text) + +{ + TSharedMemory *pTVar1; + + pTVar1 = SHM; + if (SHM != (TSharedMemory *)0x0) { + SHM->Command = Command; + if (Text == (char *)0x0) { + pTVar1->CommandBuffer[0] = '\0'; + } + else { + strncpy(pTVar1->CommandBuffer,Text,0x100); + SHM->CommandBuffer[0xff] = '\0'; + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetCommand(void) + +{ + int iVar1; + + iVar1 = 0; + if (SHM != (TSharedMemory *)0x0) { + iVar1 = SHM->Command; + } + return iVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +char * GetCommandBuffer(void) + +{ + char *pcVar1; + + pcVar1 = (char *)0x0; + if (SHM != (TSharedMemory *)0x0) { + if (SHM->Command == 0) { + pcVar1 = (char *)0x0; + } + else { + pcVar1 = SHM->CommandBuffer; + } + } + return pcVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool DeleteSHM(void) + +{ + int SHMID; + int iVar1; + bool bVar2; + + iVar1 = shmget(SHMKey,0,0); + if (iVar1 == -1) { + if (VerboseOutput != false) { + puts("DeleteSHM: SharedMemory existiert nicht."); + } + bVar2 = true; + } + else { + iVar1 = shmctl(iVar1,0,(shmid_ds *)0x0); + bVar2 = true; + if (iVar1 == -1) { + if (VerboseOutput != false) { + puts(&DAT_080f1020); + } + bVar2 = false; + } + } + return bVar2; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateSHM(void) + +{ + bool bVar1; + int SHMID; + int iVar2; + int *piVar3; + undefined4 *puVar4; + int iter; + + bVar1 = false; + while( true ) { + iVar2 = shmget(SHMKey,0x6524,0x7ff); + if (iVar2 != -1) { + return; + } + piVar3 = __errno_location(); + if ((*piVar3 != 0x11) || (bVar1)) break; + bVar1 = DeleteSHM(); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "Cannot delete SharedMemory"; + goto LAB_08056d20; + } + bVar1 = true; + } + if (VerboseOutput != false) { + piVar3 = __errno_location(); + printf("CreateSHM: Kann SharedMemory nicht anlegen (Fehler %d).\n",*piVar3); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "Cannot create SharedMemory"; +LAB_08056d20: + // WARNING: Subroutine does not return + // try { // try from 08056d33 to 08056d37 has its CatchHandler @ 08056d72 + __cxa_throw(puVar4,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void AttachSHM(void) + +{ + int SHMID; + int __shmid; + undefined4 *puVar1; + + __shmid = shmget(SHMKey,0x6524,0); + if (__shmid == -1) { + if (VerboseOutput != false) { + puts("AttachSHM: Kann SharedMemory nicht fassen."); + } + SHM = (TSharedMemory *)0x0; + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot get SharedMemory"; + } + else { + SHM = (TSharedMemory *)shmat(__shmid,(void *)0x0,0); + if (SHM != (TSharedMemory *)0xffffffff) { + return; + } + if (VerboseOutput != false) { + puts("AttachSHM: Kann SharedMemory nicht anbinden."); + } + SHM = (TSharedMemory *)0x0; + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot attach SharedMemory"; + } + // WARNING: Subroutine does not return + // try { // try from 08056e1e to 08056e22 has its CatchHandler @ 08056e54 + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DetachSHM(void) + +{ + int result; + int iVar1; + + if (SHM != (TSharedMemory *)0x0) { + iVar1 = shmdt(SHM); + if ((iVar1 == -1) && (VerboseOutput != false)) { + puts(&DAT_080f1160); + } + SHM = (TSharedMemory *)0x0; + } + return; +} + + + +void InitSHM(bool Verbose) + +{ + TSharedMemory *pTVar1; + uint uVar2; + __pid_t _Var3; + TSharedMemory *pTVar4; + + IsGameServer = true; + VerboseOutput = Verbose; + // try { // try from 08056ecb to 08056eec has its CatchHandler @ 08056fe8 + CreateSHM(); + AttachSHM(); + SetErrorFunction(ErrorHandler); + SetPrintFunction(PrintHandler); + pTVar4 = SHM; + uVar2 = 0x6524; + if (((uint)SHM & 4) != 0) { + SHM->Command = 0; + uVar2 = 0x6520; + pTVar4 = (TSharedMemory *)pTVar4->CommandBuffer; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + pTVar4->Command = 0; + pTVar4 = (TSharedMemory *)pTVar4->CommandBuffer; + } + pTVar4 = SHM; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0) = 'S'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 1) = 'H'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 2) = 'M'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 3) = ' '; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 4) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 5) = 'n'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 6) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 7) = 't'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 8) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 9) = 'a'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 10) = 'l'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0xb) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0xc) = 'z'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0xd) = 'e'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0xe) = 'd'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0xf) = '.'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x10) = ' '; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x11) = 'S'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x12) = 'y'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x13) = 's'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x14) = 't'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x15) = 'e'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x16) = 'm'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x17) = ' '; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x18) = 'p'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x19) = 'r'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1a) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1b) = 'n'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1c) = 't'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1d) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1e) = 'n'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x1f) = 'g'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x20) = ' '; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x21) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x22) = 's'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x23) = ' '; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x24) = 'w'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x25) = 'o'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x26) = 'r'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x27) = 'k'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x28) = 'i'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x29) = 'n'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x2a) = 'g'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x2b) = '!'; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x2c) = '\n'; + pTVar1 = SHM; + *(char *)((int)(pTVar4->PrintBuffer + 0) + 0x2d) = '\0'; + SHM->Errors = 0; + pTVar1->RoundNr = 0; + pTVar1->PrintBufferPosition = 1; + pTVar1->ObjectCounter = 0; + pTVar1->GameState = GAME_STARTING; + _Var3 = getpid(); + pTVar1->GameThreadPID = _Var3; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitSHM(void) + +{ + int result; + int iVar1; + + SetErrorFunction((TErrorFunction *)0x0); + SetPrintFunction((TPrintFunction *)0x0); + if (SHM != (TSharedMemory *)0x0) { + iVar1 = shmdt(SHM); + if ((iVar1 == -1) && (VerboseOutput != false)) { + puts(&DAT_080f1160); + } + SHM = (TSharedMemory *)0x0; + } + DeleteSHM(); + return; +} + + + +void InitSHMExtern(bool Verbose) + +{ + VerboseOutput = Verbose; + // try { // try from 0805706e to 08057072 has its CatchHandler @ 08057077 + AttachSHM(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitSHMExtern(void) + +{ + int result; + int iVar1; + + if (SHM != (TSharedMemory *)0x0) { + iVar1 = shmdt(SHM); + if ((iVar1 == -1) && (VerboseOutput != false)) { + puts(&DAT_080f1160); + } + SHM = (TSharedMemory *)0x0; + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&LogfileMutex,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_IsGameServer(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + TCronEntry *pTVar1; + int iVar2; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + CronEntry.initialized = false; + CronEntry.init.Obj.ObjectID = 0; + CronEntry.min = 0; + CronEntry.max = 0x100; + CronEntry.start = 0; + CronEntry.space = 0x101; + CronEntry.block = 0x100; + CronEntry.entry = (TCronEntry *)operator_new__(0x1010); + iVar2 = 0x100; + pTVar1 = CronEntry.entry; + do { + (pTVar1->Obj).ObjectID = 0; + iVar2 = iVar2 + -1; + pTVar1 = pTVar1 + 1; + } while (iVar2 != -1); + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + DepotInfo.initialized = false; + DepotInfo.max = 4; + DepotInfo.space = 5; + DepotInfo.min = 0; + DepotInfo.start = 0; + DepotInfo.block = 5; + DepotInfo.entry = (TDepotInfo *)operator_new__(0x78); + __cxa_atexit(__tcf_1,0,&__dso_handle); + Mark.initialized = false; + Mark.space = 5; + Mark.min = 0; + Mark.max = 4; + Mark.start = 0; + Mark.block = 5; + Mark.entry = (TMark *)operator_new__(0xa0); + __cxa_atexit(__tcf_2,0,&__dso_handle); + TDynamicWriteBuffer::TDynamicWriteBuffer(&HelpBuffer,0x10000); + __cxa_atexit(__tcf_3,0,&__dso_handle); + } + } + return; +} + + + +TObject * AccessObject(Object *Obj) + +{ + TObject *pTVar1; + ulong Position; + uint uVar2; + + if (Obj->ObjectID == NONE.ObjectID) { + error(&DAT_080f1200); + pTVar1 = (TObject *)*HashTableData; + } + else { + uVar2 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] != '\x01') || + (pTVar1 = (TObject *)HashTableData[uVar2], pTVar1->ObjectID != Obj->ObjectID)) { + pTVar1 = (TObject *)*HashTableData; + } + } + return pTVar1; +} + + + +// DWARF original prototype: bool exists(Object * this) + +bool __thiscall Object::exists(Object *this) + +{ + bool bVar1; + ulong Position; + uint uVar2; + + bVar1 = false; + if (this->ObjectID != 0) { + uVar2 = this->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && (*(ulong *)HashTableData[uVar2] == this->ObjectID)) + { + bVar1 = true; + } + else { + bVar1 = false; + } + } + return bVar1; +} + + + +// DWARF original prototype: ObjectType getObjectType(Object * this) + +ObjectType __thiscall Object::getObjectType(Object *this) + +{ + TObject *pTVar1; + ulong *in_stack_00000008; + Object local_1c [5]; + + local_1c[0].ObjectID = *in_stack_00000008; + pTVar1 = AccessObject(local_1c); + ObjectType::setTypeID((ObjectType *)this,(pTVar1->Type).TypeID); + return (ObjectType)(int)this; +} + + + +// DWARF original prototype: ulong getAttribute(Object * this, INSTANCEATTRIBUTE Attribute) + +ulong __thiscall Object::getAttribute(Object *this,INSTANCEATTRIBUTE Attribute) + +{ + bool bVar1; + TObject *pTVar2; + int iVar3; + int Offset; + Object local_3c [4]; + Object local_2c [7]; + + local_3c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + iVar3 = ObjectType::getAttributeOffset((ObjectType *)local_2c,Attribute); + if (iVar3 == -1) { + local_2c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + error(&DAT_080f12a0,Attribute,local_3c[0].ObjectID); + } + else { + bVar1 = false; + if ((-1 < iVar3) && (iVar3 < 4)) { + bVar1 = true; + } + if (bVar1) { + local_3c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_3c); + return pTVar2->Attributes[iVar3]; + } + local_2c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + error(&DAT_080f1240,iVar3,Attribute,local_3c[0].ObjectID); + } + return 0; +} + + + +// DWARF original prototype: void setAttribute(Object * this, INSTANCEATTRIBUTE Attribute, ulong +// Value) + +void __thiscall Object::setAttribute(Object *this,INSTANCEATTRIBUTE Attribute,ulong Value) + +{ + bool bVar1; + TObject *pTVar2; + int iVar3; + int Offset; + Object local_3c [4]; + Object local_2c [7]; + + local_3c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + iVar3 = ObjectType::getAttributeOffset((ObjectType *)local_2c,Attribute); + if (iVar3 == -1) { + local_2c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + error(&DAT_080f1360,Attribute,local_3c[0].ObjectID); + } + else { + bVar1 = false; + if ((-1 < iVar3) && (iVar3 < 4)) { + bVar1 = true; + } + if (bVar1) { + if (Value == 0) { + if (((Attribute == AMOUNT) || (Attribute == POOLLIQUIDTYPE)) || + (Attribute == CHARGES)) { + Value = 1; + } + if ((Value == 0) && (Attribute == REMAININGUSES)) { + local_2c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + Value = ObjectType::getAttribute((ObjectType *)local_3c,TOTALUSES); + } + } + local_3c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_3c); + pTVar2->Attributes[iVar3] = Value; + } + else { + local_2c[0] = (Object)this->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + error(&DAT_080f1300,iVar3,Attribute,local_3c[0].ObjectID); + } + } + return; +} + + + +// DWARF original prototype: Object getNextObject(Object * this) + +Object __thiscall Object::getNextObject(Object *this) + +{ + TObject *pTVar1; + ulong *in_stack_00000008; + Object local_1c [5]; + + local_1c[0].ObjectID = *in_stack_00000008; + pTVar1 = AccessObject(local_1c); + this->ObjectID = (pTVar1->NextObject).ObjectID; + return (Object)(ulong)this; +} + + + +// DWARF original prototype: Object getContainer(Object * this) + +Object __thiscall Object::getContainer(Object *this) + +{ + TObject *pTVar1; + ulong *in_stack_00000008; + Object local_1c [5]; + + local_1c[0].ObjectID = *in_stack_00000008; + pTVar1 = AccessObject(local_1c); + this->ObjectID = (pTVar1->Container).ObjectID; + return (Object)(ulong)this; +} + + + +// DWARF original prototype: ulong getCreatureID(Object * this) + +ulong __thiscall Object::getCreatureID(Object *this) + +{ + TObject *pTVar1; + ulong uVar2; + Object local_3c [4]; + ObjectType local_2c [7]; + + local_3c[0] = (Object)this->ObjectID; + pTVar1 = AccessObject(local_3c); + ObjectType::setTypeID(local_2c,(pTVar1->Type).TypeID); + if (local_2c[0].TypeID == 99) { + local_3c[0] = (Object)this->ObjectID; + pTVar1 = AccessObject(local_3c); + uVar2 = pTVar1->Attributes[1]; + } + else { + error("Object::getCreatureID: Objekt ist keine Kreatur.\n"); + uVar2 = 0; + } + return uVar2; +} + + + +void GetObjectCoordinates(Object *Obj,int *x,int *y,int *z) + +{ + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + Object local_4c [4]; + Object local_3c [4]; + ObjectType local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + while( true ) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID); + if (local_2c[0].TypeID == 0) break; + local_4c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_4c); + local_2c[0].TypeID = (pTVar2->Container).ObjectID; + Obj->ObjectID = local_2c[0].TypeID; + } + local_4c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_4c); + *x = pTVar2->Attributes[1]; + local_4c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_4c); + *y = pTVar2->Attributes[2]; + local_4c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_4c); + *z = (uint)(byte)pTVar2->Attributes[3]; + } + else { + error(&DAT_080f1400); + *x = 0; + *y = 0; + *z = 0; + } + return; +} + + + +uchar GetMapContainerFlags(Object *Obj) + +{ + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + Object local_3c [4]; + ObjectType local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID); + if (local_2c[0].TypeID == 0) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + return *(uchar *)((int)pTVar2->Attributes + 0xd); + } + } + error("GetMapContainerFlags: Objekt ist kein MapContainer.\n"); + return '\0'; +} + + + +void CronMove(int Destination,int Source) + +{ + int iVar1; + uint uVar2; + TCronEntry *pTVar3; + TCronEntry *pTVar4; + TCronEntry *Entry; + undefined8 local_34; + int iStack_30; + + pTVar3 = vector::operator()(&CronEntry,Destination); + pTVar4 = vector::operator()(&CronEntry,Source); + (pTVar3->Obj).ObjectID = (pTVar4->Obj).ObjectID; + pTVar3->RoundNr = pTVar4->RoundNr; + iVar1 = pTVar4->Next; + pTVar3->Previous = pTVar4->Previous; + pTVar3->Next = iVar1; + pTVar3 = vector::operator()(&CronEntry,Destination); + if (pTVar3->Next != -1) { + pTVar4 = vector::operator()(&CronEntry,pTVar3->Next); + pTVar4->Previous = Destination; + } + if (pTVar3->Previous != -1) { + pTVar4 = vector::operator()(&CronEntry,pTVar3->Previous); + iVar1 = pTVar3->Previous; + pTVar4->Next = Destination; + if (iVar1 != -1) { + return; + } + } + uVar2 = (pTVar3->Obj).ObjectID; + CronHashTable + [uVar2 + ((uVar2 - (int)((ulonglong)uVar2 * 0x200401 >> 0x20) >> 1) + iStack_30 >> 10) * -0x7ff] + = Destination; + return; +} + + + +void CronHeapify(int Position) + +{ + int i; + TCronEntry *pTVar1; + TCronEntry *pTVar2; + int Father; + int iVar3; + + while (Position != 1) { + pTVar1 = vector::operator()(&CronEntry,Position); + iVar3 = Position / 2; + pTVar2 = vector::operator()(&CronEntry,iVar3); + if (pTVar2->RoundNr <= pTVar1->RoundNr) break; + CronMove(0,Position); + CronMove(Position,iVar3); + CronMove(iVar3,0); + Position = iVar3; + } + while( true ) { + iVar3 = Position * 2; + if (CronEntries < iVar3) { + return; + } + i = iVar3 + 1; + if (i <= CronEntries) { + pTVar1 = vector::operator()(&CronEntry,i); + pTVar2 = vector::operator()(&CronEntry,iVar3); + if (pTVar1->RoundNr < pTVar2->RoundNr) { + iVar3 = i; + } + } + pTVar1 = vector::operator()(&CronEntry,Position); + pTVar2 = vector::operator()(&CronEntry,iVar3); + if (pTVar1->RoundNr <= pTVar2->RoundNr) break; + CronMove(0,Position); + CronMove(Position,iVar3); + CronMove(iVar3,0); + Position = iVar3; + } + return; +} + + + +void CronSet(Object *Obj,ulong Delay) + +{ + bool bVar1; + int i; + TCronEntry *pTVar2; + ulong Position; + uint uVar3; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + CronEntries = CronEntries + 1; + pTVar2 = vector::operator()(&CronEntry,CronEntries); + (pTVar2->Obj).ObjectID = Obj->ObjectID; + pTVar2 = vector::operator()(&CronEntry,CronEntries); + pTVar2->RoundNr = Delay + RoundNr; + pTVar2 = vector::operator()(&CronEntry,CronEntries); + pTVar2->Previous = -1; + pTVar2 = vector::operator()(&CronEntry,CronEntries); + pTVar2->Next = CronHashTable[Obj->ObjectID % 0x7ff]; + i = CronEntries; + CronHashTable[Obj->ObjectID % 0x7ff] = CronEntries; + pTVar2 = vector::operator()(&CronEntry,i); + if (pTVar2->Next != -1) { + pTVar2 = vector::operator()(&CronEntry,CronEntries); + pTVar2 = vector::operator()(&CronEntry,pTVar2->Next); + pTVar2->Previous = CronEntries; + } + CronHeapify(CronEntries); + } + else { + error(&DAT_080f1480); + } + return; +} + + + +void CronDelete(int Position) + +{ + uint uVar1; + int iVar2; + bool bVar3; + TCronEntry *pTVar4; + TCronEntry *pTVar5; + TCronEntry *Entry; + undefined8 local_1c; + int iStack_18; + + bVar3 = false; + if ((0 < Position) && (Position <= CronEntries)) { + bVar3 = true; + } + if (!bVar3) { + error(&DAT_080f14c0,Position); + return; + } + pTVar4 = vector::operator()(&CronEntry,Position); + if (pTVar4->Next != -1) { + pTVar5 = vector::operator()(&CronEntry,pTVar4->Next); + pTVar5->Previous = pTVar4->Previous; + } + if (pTVar4->Previous != -1) { + pTVar5 = vector::operator()(&CronEntry,pTVar4->Previous); + iVar2 = pTVar4->Previous; + pTVar5->Next = pTVar4->Next; + if (iVar2 != -1) goto LAB_08057e24; + } + uVar1 = (pTVar4->Obj).ObjectID; + CronHashTable + [uVar1 + ((uVar1 - (int)((ulonglong)uVar1 * 0x200401 >> 0x20) >> 1) + iStack_18 >> 10) * -0x7ff] + = pTVar4->Next; +LAB_08057e24: + iVar2 = CronEntries; + CronEntries = CronEntries + -1; + if (CronEntries < Position) { + return; + } + CronMove(Position,iVar2); + CronHeapify(Position); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object CronCheck(void) + +{ + Object OVar1; + TCronEntry *pTVar2; + ulong *in_stack_00000004; + + OVar1.ObjectID = NONE.ObjectID; + if ((CronEntries != 0) && + (pTVar2 = vector::operator()(&CronEntry,1), OVar1 = NONE, + pTVar2->RoundNr <= RoundNr)) { + pTVar2 = vector::operator()(&CronEntry,1); + OVar1.ObjectID = (pTVar2->Obj).ObjectID; + } + *in_stack_00000004 = OVar1.ObjectID; + return (Object)(ulong)in_stack_00000004; +} + + + +ulong CronInfo(Object *Obj,bool Delete) + +{ + bool bVar1; + TCronEntry *pTVar2; + int Position; + uint uVar3; + int i; + ulong uVar4; + char *Text; + undefined8 local_44; + int iStack_40; + bool Delete_local; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + uVar3 = Obj->ObjectID; + i = CronHashTable + [uVar3 + ((uVar3 - (int)((ulonglong)uVar3 * 0x200401 >> 0x20) >> 1) + iStack_40 >> 10) * + -0x7ff]; + while (i != -1) { + pTVar2 = vector::operator()(&CronEntry,i); + if ((pTVar2->Obj).ObjectID == Obj->ObjectID) { + pTVar2 = vector::operator()(&CronEntry,i); + uVar4 = pTVar2->RoundNr - RoundNr; + if ((int)uVar4 < 1) { + uVar4 = 1; + } + if (!Delete) { + return uVar4; + } + CronDelete(i); + return uVar4; + } + pTVar2 = vector::operator()(&CronEntry,i); + i = pTVar2->Next; + } + Text = "CronInfo: Objekt ist nicht im Cron-System eingetragen.\n"; + } + else { + Text = &DAT_080f1540; + } + error(Text); + return 0; +} + + + +ulong CronStop(Object *Obj) + +{ + bool bVar1; + ulong uVar2; + ulong Position; + uint uVar3; + Object local_1c [4]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_1c[0] = (Object)Obj->ObjectID; + uVar2 = CronInfo(local_1c,true); + } + else { + error(&DAT_080f1580); + uVar2 = 0; + } + return uVar2; +} + + + +void CronExpire(Object *Obj,int Delay) + +{ + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,EXPIRE); + if (bVar1) { + if (Delay == -1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + Delay = ObjectType::getAttribute((ObjectType *)local_3c,TOTALEXPIRETIME); + } + local_3c[0] = (Object)Obj->ObjectID; + CronSet(local_3c,Delay); + } + } + else { + error(&DAT_080f15c0); + } + return; +} + + + +void CronChange(Object *Obj,int NewDelay) + +{ + bool bVar1; + TCronEntry *pTVar2; + int Position; + uint uVar3; + int i; + char *Text; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + i = CronHashTable[Obj->ObjectID % 0x7ff]; + while (i != -1) { + pTVar2 = vector::operator()(&CronEntry,i); + if ((pTVar2->Obj).ObjectID == Obj->ObjectID) { + pTVar2 = vector::operator()(&CronEntry,i); + pTVar2->RoundNr = NewDelay + RoundNr; + CronHeapify(i); + return; + } + pTVar2 = vector::operator()(&CronEntry,i); + i = pTVar2->Next; + } + Text = "CronChange: Objekt ist nicht im Cron-System eingetragen.\n"; + } + else { + Text = &DAT_080f1640; + } + error(Text); + return; +} + + + +Object SplitObject(Object *Obj,int Count) + +{ + bool bVar1; + TObject *pTVar2; + ulong uVar3; + ulong Position; + uint uVar4; + ulong in_stack_0000000c; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Copy; + ObjectType local_2c [7]; + + bVar1 = false; + if (*(uint *)Count != 0) { + uVar4 = *(uint *)Count & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(int *)HashTableData[uVar4] == *(int *)Count)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + error(&DAT_080f1680); + local_3c = NONE; + goto LAB_08058380; + } + local_3c.ObjectID = *(ulong *)Count; + pTVar2 = AccessObject(&local_3c); + ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag(local_2c,CUMULATIVE); + if (bVar1) { + if (0 < (int)in_stack_0000000c) { + uVar3 = Object::getAttribute((Object *)Count,AMOUNT); + if ((int)in_stack_0000000c <= (int)uVar3) { + uVar3 = Object::getAttribute((Object *)Count,AMOUNT); + if (in_stack_0000000c != uVar3) { + local_5c[0].ObjectID = *(ulong *)Count; + local_2c[0].TypeID = local_5c[0].ObjectID; + pTVar2 = AccessObject(local_5c); + local_4c[0].ObjectID = (pTVar2->Container).ObjectID; + CopyObject(&local_3c,local_4c); + uVar3 = Object::getAttribute((Object *)Count,AMOUNT); + Object::setAttribute((Object *)Count,AMOUNT,uVar3 - in_stack_0000000c); + Object::setAttribute(&local_3c,AMOUNT,in_stack_0000000c); + goto LAB_08058380; + } + goto LAB_080583fc; + } + } + error(&DAT_080f16c0,in_stack_0000000c); + } + else { + error("SplitObject: Objekt ist nicht kumulierbar.\n"); + } +LAB_080583fc: + local_3c.ObjectID = *(ulong *)Count; +LAB_08058380: + Obj->ObjectID = (ulong)local_3c; + return (Object)(ulong)Obj; +} + + + +void MergeObjects(Object *Obj,Object *Dest) + +{ + Object OVar1; + bool bVar2; + TObject *pTVar3; + ulong uVar4; + ulong uVar5; + ulong Position; + uint uVar6; + char *Text; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + ObjectType local_2c [7]; + + bVar2 = false; + if (Obj->ObjectID != 0) { + uVar6 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar6] == '\x02') { + UnswapSector(HashTableData[uVar6]); + } + if ((HashTableType[uVar6] == '\x01') && (*(ulong *)HashTableData[uVar6] == Obj->ObjectID)) { + bVar2 = true; + } + else { + bVar2 = false; + } + } + if (bVar2) { + bVar2 = false; + if (Dest->ObjectID != 0) { + uVar6 = Dest->ObjectID & HashTableMask; + if (HashTableType[uVar6] == '\x02') { + UnswapSector(HashTableData[uVar6]); + } + if ((HashTableType[uVar6] == '\x01') && + (*(ulong *)HashTableData[uVar6] == Dest->ObjectID)) { + bVar2 = true; + } + else { + bVar2 = false; + } + } + if (bVar2) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar3 = AccessObject(local_3c); + ObjectType::setTypeID(local_2c,(pTVar3->Type).TypeID); + local_4c[0] = (Object)Dest->ObjectID; + pTVar3 = AccessObject(local_4c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar3->Type).TypeID); + ObjectType::setTypeID((ObjectType *)local_4c,local_3c[0].ObjectID); + if (local_2c[0].TypeID != local_4c[0].ObjectID) { + local_5c[0] = (Object)Dest->ObjectID; + pTVar3 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar3->Type).TypeID); + OVar1.ObjectID = local_4c[0].ObjectID; + local_6c[0] = (Object)Obj->ObjectID; + pTVar3 = AccessObject(local_6c); + ObjectType::setTypeID((ObjectType *)local_5c,(pTVar3->Type).TypeID); + error("MergeObjects: Objekttypen %d und %d sind nicht identisch.\n", + local_5c[0].ObjectID,OVar1.ObjectID); + return; + } + local_5c[0] = (Object)Obj->ObjectID; + pTVar3 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)local_6c,(pTVar3->Type).TypeID); + bVar2 = ObjectType::getFlag((ObjectType *)local_6c,CUMULATIVE); + if (!bVar2) { + local_5c[0] = (Object)Obj->ObjectID; + pTVar3 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)local_6c,(pTVar3->Type).TypeID); + error("MergeObjects: Objekttyp %d/%d ist nicht kumulierbar.\n",local_6c[0].ObjectID) + ; + return; + } + uVar4 = Object::getAttribute(Obj,AMOUNT); + if (uVar4 == 0) { + error(&DAT_080f18c0); + Object::setAttribute(Obj,AMOUNT,1); + } + uVar4 = Object::getAttribute(Dest,AMOUNT); + if (uVar4 == 0) { + error(&DAT_080f1880); + Object::setAttribute(Dest,AMOUNT,1); + } + uVar4 = Object::getAttribute(Obj,AMOUNT); + uVar5 = Object::getAttribute(Dest,AMOUNT); + Object::setAttribute(Dest,AMOUNT,uVar5 + uVar4); + uVar4 = Object::getAttribute(Dest,AMOUNT); + if (100 < uVar4) { + error(&DAT_080f1840); + Object::setAttribute(Dest,AMOUNT,100); + } + local_6c[0] = (Object)Obj->ObjectID; + bVar2 = false; + if (local_6c[0].ObjectID != 0) { + uVar6 = local_6c[0].ObjectID & HashTableMask; + if (HashTableType[uVar6] == '\x02') { + UnswapSector(HashTableData[uVar6]); + } + if ((HashTableType[uVar6] == '\x01') && + (*(uint *)HashTableData[uVar6] == local_6c[0].ObjectID)) { + bVar2 = true; + } + else { + bVar2 = false; + } + } + if (bVar2) { + local_5c[0].ObjectID = local_6c[0].ObjectID; + CutObject(local_5c); + local_5c[0].ObjectID = local_6c[0].ObjectID; + DestroyObject(local_5c); + return; + } + Text = &DAT_080f1800; + } + else { + Text = &DAT_080f1740; + } + } + else { + Text = &DAT_080f1900; + } + error(Text); + return; +} + + + +void MoveObject(Object *Obj,Object *Con) + +{ + bool bVar1; + ulong Position; + uint uVar2; + char *Text; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar2 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && (*(ulong *)HashTableData[uVar2] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + bVar1 = false; + if (Con->ObjectID != 0) { + uVar2 = Con->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && + (*(ulong *)HashTableData[uVar2] == Con->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + CutObject(local_2c); + local_2c[0] = (Object)Con->ObjectID; + local_3c[0] = (Object)Obj->ObjectID; + PlaceObject(local_3c,local_2c,false); + return; + } + Text = &DAT_080f1940; + } + else { + Text = &DAT_080f1980; + } + error(Text); + return; +} + + + +void ChangeObject(Object *Obj,ObjectType *Type) + +{ + bool bVar1; + TObject *pTVar2; + ulong uVar3; + ulong Position; + uint uVar4; + ulong *puVar5; + ulong local_5c; + ulong SavedExpireTime; + int Delay; + ulong local_50; + ulong Amount; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = false; + local_5c = 0; + SavedExpireTime = 0xffffffff; + local_50 = 0; + if (Obj->ObjectID != 0) { + uVar4 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,0); + if (local_2c[0].ObjectID != local_3c[0].ObjectID) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar1) { + local_50 = Object::getAttribute(Obj,AMOUNT); + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,EXPIRE); + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + local_5c = CronStop(local_3c); + bVar1 = ObjectType::getFlag(Type,CUMULATIVE); + if (bVar1) { + local_50 = 1; + } + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,TEXT); + if (bVar1) { + bVar1 = ObjectType::getFlag(Type,TEXT); + if (!bVar1) { + uVar3 = Object::getAttribute(Obj,TEXTSTRING); + DeleteDynamicString(uVar3); + Object::setAttribute(Obj,TEXTSTRING,0); + uVar3 = Object::getAttribute(Obj,EDITOR); + DeleteDynamicString(uVar3); + Object::setAttribute(Obj,EDITOR,0); + } + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,EXPIRESTOP); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,SAVEDEXPIRETIME); + if (uVar3 != 0) { + SavedExpireTime = Object::getAttribute(Obj,SAVEDEXPIRETIME); + } + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,MAGICFIELD); + if (bVar1) { + Object::setAttribute(Obj,RESPONSIBLE,0); + } + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)&Amount,Type->TypeID); + ObjectType::setTypeID(&pTVar2->Type,Amount); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&Amount,CUMULATIVE); + if (bVar1) { + Delay = 1; + puVar5 = (ulong *)&Delay; + if (local_50 != 0) { + puVar5 = &local_50; + } + Object::setAttribute(Obj,AMOUNT,*puVar5); + } + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&Amount,RUNE); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,CHARGES); + if (uVar3 == 0) { + Object::setAttribute(Obj,CHARGES,1); + } + } + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&Amount,LIQUIDPOOL); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + if (uVar3 == 0) { + Object::setAttribute(Obj,POOLLIQUIDTYPE,1); + } + } + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&Amount,WEAROUT); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,REMAININGUSES); + if (uVar3 == 0) { + uVar3 = ObjectType::getAttribute(Type,TOTALUSES); + Object::setAttribute(Obj,REMAININGUSES,uVar3); + } + } + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&Amount,EXPIRESTOP); + if (bVar1) { + Object::setAttribute(Obj,SAVEDEXPIRETIME,local_5c); + } + Amount = Obj->ObjectID; + CronExpire((Object *)&Amount,SavedExpireTime); + } + else { + error(&DAT_080f19c0); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Attribute_local + +void ChangeObject(Object *Obj,INSTANCEATTRIBUTE Attribute,ulong Value) + +{ + bool bVar1; + ulong Position; + uint uVar2; + INSTANCEATTRIBUTE Attribute_local; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar2 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && (*(ulong *)HashTableData[uVar2] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + error(&DAT_080f19c0); + return; + } + Object::setAttribute(Obj,Attribute,Value); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TObject * GetFreeObjectSlot(void) + +{ + ulong *puVar1; + TObject *Help; + TObject *pTVar2; + + if (FirstFreeObject == (TObject *)0x0) { + SwapSector(); + } + pTVar2 = FirstFreeObject; + if (FirstFreeObject == (TObject *)0x0) { + error("GetFreeObjectSlot: Kein freier Platz mehr.\n"); + pTVar2 = (TObject *)0x0; + } + else { + puVar1 = &FirstFreeObject->ObjectID; + FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID; + *puVar1 = 0; + (pTVar2->NextObject).ObjectID = 0; + (pTVar2->Container).ObjectID = 0; + (pTVar2->Type).TypeID = 0; + pTVar2->Attributes[0] = 0; + pTVar2->Attributes[1] = 0; + pTVar2->Attributes[2] = 0; + pTVar2->Attributes[3] = 0; + } + return pTVar2; +} + + + +// WARNING: Variable defined which should be unmapped: NewMask +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ResizeHashTable(void) + +{ + uint *puVar1; + size_t __size; + ulong *puVar2; + uchar *__s; + uchar *__ptr; + int iVar3; + int i; + int iVar4; + ulong nr; + size_t __size_00; + uint uVar5; + uchar *NewType; + TObject *Entry; + ulong *NewData; + int NewMask; + + iVar4 = 1; + __size = HashTableSize * 2; + __size_00 = HashTableSize << 3; + error(&DAT_080f1a40,__size); + puVar2 = (ulong *)malloc(__size_00); + __s = (uchar *)malloc(__size); + memset(__s,0,__size); + *__s = 0xff; + iVar3 = HashTableSize; + *puVar2 = *HashTableData; + __ptr = HashTableType; + if (1 < iVar3) { + do { + if (__ptr[iVar4] != '\0') { + if (__ptr[iVar4] == '\x02') { + UnswapSector(HashTableData[iVar4]); + __ptr = HashTableType; + } + if (__ptr[iVar4] == '\x01') { + puVar1 = (uint *)HashTableData[iVar4]; + uVar5 = __size - 1 & *puVar1; + __s[uVar5] = '\x01'; + puVar2[uVar5] = (ulong)puVar1; + iVar3 = HashTableSize; + } + else { + error("ResizeHashTable: Fehler beim Reorganisieren der HashTabelle.\n"); + __ptr = HashTableType; + iVar3 = HashTableSize; + } + } + iVar4 = iVar4 + 1; + } while (iVar4 < iVar3); + } + free(__ptr); + free(HashTableData); + iVar3 = HashTableSize; + HashTableSize = __size; + HashTableType = __s; + HashTableFree = HashTableFree + iVar3; + HashTableData = puVar2; + HashTableMask = __size - 1; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object CreateObject(void) + +{ + uchar uVar1; + ulong *puVar2; + ulong uVar3; + TObject *Help; + int iVar4; + Object OVar5; + TObject *pTVar6; + ulong *in_stack_00000004; + + iVar4 = HashTableSize; + if (0x7fffffff < (uint)HashTableSize) { + iVar4 = HashTableSize + 0xf; + } + if (HashTableFree < iVar4 >> 4) { + ResizeHashTable(); + } + uVar1 = HashTableType[CreateObject::Iterator & HashTableMask]; + while (uVar1 != '\0') { + CreateObject::Iterator = CreateObject::Iterator + 1; + uVar1 = HashTableType[CreateObject::Iterator & HashTableMask]; + } + if (FirstFreeObject == (TObject *)0x0) { + SwapSector(); + } + pTVar6 = FirstFreeObject; + if (FirstFreeObject == (TObject *)0x0) { + pTVar6 = (TObject *)0x0; + error("GetFreeObjectSlot: Kein freier Platz mehr.\n"); + } + else { + puVar2 = &FirstFreeObject->ObjectID; + FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID; + *puVar2 = 0; + (pTVar6->NextObject).ObjectID = 0; + (pTVar6->Container).ObjectID = 0; + (pTVar6->Type).TypeID = 0; + pTVar6->Attributes[0] = 0; + pTVar6->Attributes[1] = 0; + pTVar6->Attributes[2] = 0; + pTVar6->Attributes[3] = 0; + } + uVar3 = HashTableMask; + iVar4 = CreateObject::Iterator; + if (pTVar6 == (TObject *)0x0) { + error("CreateObject: Kann Objekt nicht anlegen.\n"); + OVar5 = NONE; + } + else { + pTVar6->ObjectID = CreateObject::Iterator; + HashTableData[iVar4 & uVar3] = (ulong)pTVar6; + HashTableType[iVar4 & HashTableMask] = '\x01'; + HashTableFree = HashTableFree + -1; + IncrementObjectCounter(); + OVar5.ObjectID = CreateObject::Iterator; + } + *in_stack_00000004 = OVar5.ObjectID; + return (Object)(ulong)in_stack_00000004; +} + + + +int GetObjectPriority(Object *Obj) + +{ + bool bVar1; + TObject *pTVar2; + int iVar3; + ulong Position; + uint uVar4; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar4 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,BANK); + iVar3 = 0; + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CLIP); + iVar3 = 1; + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,BOTTOM); + iVar3 = 2; + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,TOP); + iVar3 = 3; + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + iVar3 = (local_3c[0].ObjectID != 99) + 4; + } + } + } + } + } + else { + error(&DAT_080f1b00); + iVar3 = 0x7fffffff; + } + return iVar3; +} + + + +void PlaceObject(Object *Obj,Object *Con,bool Append) + +{ + bool bVar1; + TObject *pTVar2; + int iVar3; + int iVar4; + int SearchPriority; + Object *pAddr; + uint uVar5; + Object *pOVar6; + int ObjPriority; + char *pcVar7; + int iStack_78; + bool Append_local; + int x; + int y; + int z; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Search; + + local_2c = 0; + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar5 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar5] == '\x02') { + UnswapSector(HashTableData[uVar5]); + } + if ((HashTableType[uVar5] == '\x01') && (*(ulong *)HashTableData[uVar5] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + pcVar7 = &DAT_080f1ca0; +LAB_080595eb: + error(pcVar7); + return; + } + bVar1 = false; + if (Con->ObjectID != 0) { + uVar5 = Con->ObjectID & HashTableMask; + if (HashTableType[uVar5] == '\x02') { + UnswapSector(HashTableData[uVar5]); + } + if ((HashTableType[uVar5] == '\x01') && (*(ulong *)HashTableData[uVar5] == Con->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + pcVar7 = &DAT_080f1b40; + goto LAB_080595eb; + } + local_4c[0] = (Object)Con->ObjectID; + pTVar2 = AccessObject(local_4c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (!bVar1) { + local_3c[0] = (Object)Con->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CHEST); + if (!bVar1) { + local_3c[0] = (Object)Con->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + error("PlaceObject: Con (%d) ist kein Container.\n",local_4c[0].ObjectID); + return; + } + } + local_3c[0] = (Object)Con->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + if (local_4c[0].ObjectID != 0) { + z = Con->ObjectID; + pTVar2 = AccessObject((Object *)&z); + pOVar6 = (Object *)pTVar2->Attributes; + local_2c = Object::getAttribute(Con,CONTENT); + z = local_2c; + if ((Append) && (z = NONE.ObjectID, local_2c != NONE.ObjectID)) { + do { + z = local_2c; + local_5c[0].ObjectID = NONE.ObjectID; + pTVar2 = AccessObject((Object *)&z); + pOVar6 = &pTVar2->NextObject; + local_4c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_4c); + local_2c = (pTVar2->NextObject).ObjectID; + z = NONE.ObjectID; + } while (local_2c != NONE.ObjectID); + } + goto LAB_08059780; + } + local_4c[0] = (Object)Obj->ObjectID; + iVar3 = GetObjectPriority(local_4c); + local_4c[0] = (Object)Con->ObjectID; + pTVar2 = AccessObject(local_4c); + pOVar6 = (Object *)pTVar2->Attributes; + local_5c[0] = (Object)Con->ObjectID; + z = NONE.ObjectID; + if (local_5c[0].ObjectID == NONE.ObjectID) { + error(&DAT_080f1b80); +LAB_080596ed: + local_3c[0].ObjectID = NONE.ObjectID; + } + else { + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,CONTAINER); + if (!bVar1) { + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,CHEST); + if (!bVar1) { + Object::getObjectType((Object *)&z); + error("GetFirstContainerObject: Con (%d) ist kein Container.\n",z); + goto LAB_080596ed; + } + } + local_3c[0].ObjectID = Object::getAttribute(local_5c,CONTENT); + } + z = NONE.ObjectID; + local_2c = local_3c[0].ObjectID; + local_4c[0].ObjectID = local_3c[0].ObjectID; + if (local_3c[0].ObjectID != NONE.ObjectID) { + do { + z = local_2c; + local_5c[0].ObjectID = NONE.ObjectID; + iVar4 = GetObjectPriority((Object *)&z); + if (iVar3 < iVar4) break; + if ((Append) || (1 < iVar4 - 4U)) { + if ((iVar4 == iVar3) && (((iVar3 == 0 || (iVar3 == 2)) || (iVar3 == 3)))) { + z = Con->ObjectID; + GetObjectCoordinates((Object *)&z,&stack0xffffff88,&x,&y); + local_5c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)&z,(pTVar2->Type).TypeID); + iVar4 = z; + local_4c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_4c); + ObjectType::setTypeID((ObjectType *)local_5c,(pTVar2->Type).TypeID); + if (iVar3 == 0) { + pcVar7 = "BANK"; + } + else { + pcVar7 = "BOTTOM"; + if (iVar3 != 2) { + pcVar7 = "TOP"; + } + } + error("PlaceObject: Zwei %s-Objekte (%d und %d) auf Feld [%d,%d,%d].\n",pcVar7, + local_5c[0].ObjectID,iVar4,iStack_78,x,y); + } + } + else if (iVar4 == iVar3) break; + z = local_2c; + pTVar2 = AccessObject((Object *)&z); + pOVar6 = &pTVar2->NextObject; + local_4c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_4c); + local_2c = (pTVar2->NextObject).ObjectID; + z = NONE.ObjectID; + } while (local_2c != NONE.ObjectID); + } +LAB_08059780: + local_5c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_5c); + local_4c[0].ObjectID = local_2c; + (pTVar2->NextObject).ObjectID = local_2c; + z = local_2c; + local_5c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_5c); + (pTVar2->Container).ObjectID = Con->ObjectID; + pOVar6->ObjectID = Obj->ObjectID; + return; +} + + + +Object AppendObject(Object *Con,ObjectType *Type) + +{ + bool bVar1; + ulong Position; + uint uVar2; + int *in_stack_0000000c; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + bVar1 = false; + if (Type->TypeID != 0) { + uVar2 = Type->TypeID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && (*(int *)HashTableData[uVar2] == Type->TypeID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + CreateObject(); + ObjectType::setTypeID((ObjectType *)local_3c,*in_stack_0000000c); + local_4c[0].ObjectID = local_2c; + ChangeObject(local_4c,(ObjectType *)local_3c); + local_4c[0].ObjectID = Type->TypeID; + local_3c[0].ObjectID = local_2c; + PlaceObject(local_3c,local_4c,true); + } + else { + error(&DAT_080f1ce0); + local_2c = NONE.ObjectID; + } + Con->ObjectID = local_2c; + return (Object)(ulong)Con; +} + + + +Object SetObject(Object *Con,ObjectType *Type,ulong CreatureID) + +{ + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + ulong in_stack_00000010; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + bVar1 = false; + if (Type->TypeID != 0) { + uVar3 = Type->TypeID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(int *)HashTableData[uVar3] == Type->TypeID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + CreateObject(); + ObjectType::setTypeID((ObjectType *)local_3c,*(int *)CreatureID); + local_4c[0].ObjectID = local_2c; + ChangeObject(local_4c,(ObjectType *)local_3c); + local_4c[0].ObjectID = Type->TypeID; + local_3c[0].ObjectID = local_2c; + PlaceObject(local_3c,local_4c,false); + local_3c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + if (local_4c[0].ObjectID == 99) { + if (in_stack_00000010 == 0) { + error(&DAT_080f1d60); + } + local_4c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_4c); + pTVar2->Attributes[1] = in_stack_00000010; + } + } + else { + error(&DAT_080f1d20); + local_2c = NONE.ObjectID; + } + Con->ObjectID = local_2c; + return (Object)(ulong)Con; +} + + + +Object CopyObject(Object *Con,Object *Source) + +{ + bool bVar1; + TObject *pTVar2; + TObject *pTVar3; + ulong uVar4; + ulong Position; + uint uVar5; + int iVar6; + uint *in_stack_0000000c; + char *pcVar7; + Object local_4c [4]; + Object local_3c; + Object Obj; + Object local_2c [7]; + + bVar1 = false; + if (*in_stack_0000000c != 0) { + uVar5 = *in_stack_0000000c & HashTableMask; + if (HashTableType[uVar5] == '\x02') { + UnswapSector(HashTableData[uVar5]); + } + if ((HashTableType[uVar5] == '\x01') && + (*(uint *)HashTableData[uVar5] == *in_stack_0000000c)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + bVar1 = false; + if (Source->ObjectID != 0) { + uVar5 = Source->ObjectID & HashTableMask; + if (HashTableType[uVar5] == '\x02') { + UnswapSector(HashTableData[uVar5]); + } + if ((HashTableType[uVar5] == '\x01') && + (*(ulong *)HashTableData[uVar5] == Source->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c.ObjectID = *in_stack_0000000c; + pTVar2 = AccessObject(&local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + if (local_2c[0].ObjectID != 99) { + local_4c[0].ObjectID = *in_stack_0000000c; + pTVar2 = AccessObject(local_4c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + local_4c[0] = (Object)Source->ObjectID; + iVar6 = 0; + SetObject(&local_3c,(ObjectType *)local_4c,(ulong)local_2c); + do { + local_4c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_4c); + local_2c[0].ObjectID = *in_stack_0000000c; + pTVar3 = AccessObject(local_2c); + pTVar2->Attributes[iVar6] = pTVar3->Attributes[iVar6]; + iVar6 = iVar6 + 1; + } while (iVar6 < 4); + local_2c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CONTAINER); + if (bVar1) { +LAB_08059ea9: + Object::setAttribute(&local_3c,CONTENT,0); + } + else { + local_2c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CHEST); + if (bVar1) goto LAB_08059ea9; + } + local_2c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,TEXT); + if ((bVar1) && (uVar4 = Object::getAttribute(&local_3c,TEXTSTRING), uVar4 != 0)) { + uVar4 = Object::getAttribute(&local_3c,TEXTSTRING); + pcVar7 = GetDynamicString(uVar4); + uVar4 = AddDynamicString(pcVar7); + Object::setAttribute(&local_3c,TEXTSTRING,uVar4); + } + local_2c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,TEXT); + if ((bVar1) && (uVar4 = Object::getAttribute(&local_3c,EDITOR), uVar4 != 0)) { + uVar4 = Object::getAttribute(&local_3c,EDITOR); + pcVar7 = GetDynamicString(uVar4); + uVar4 = AddDynamicString(pcVar7); + Object::setAttribute(&local_3c,EDITOR,uVar4); + } + goto LAB_08059d74; + } + pcVar7 = &DAT_080f1de0; + } + else { + pcVar7 = "CopyObject: Zielcontainer existiert nicht.\n"; + } + } + else { + pcVar7 = "CopyObject: Vorlage existiert nicht.\n"; + } + error(pcVar7); + local_3c = NONE; +LAB_08059d74: + Con->ObjectID = (ulong)local_3c; + return (Object)(ulong)Con; +} + + + +void PutFreeObjectSlot(TObject *Entry) + +{ + if (Entry == (TObject *)0x0) { + error("PutFreeObjectSlot: Entry ist NULL.\n"); + } + else { + (Entry->NextObject).ObjectID = (ulong)FirstFreeObject; + FirstFreeObject = Entry; + } + return; +} + + + +void CutObject(Object *Obj) + +{ + bool bVar1; + TObject *pTVar2; + TObject *pTVar3; + ulong Position; + uint uVar4; + Object local_8c [4]; + Object local_7c [4]; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Search; + Object local_2c; + Object Con; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar4 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + error(&DAT_080f1ea0); + return; + } + local_3c = (Object)Obj->ObjectID; + pTVar2 = AccessObject(&local_3c); + local_4c[0].ObjectID = (pTVar2->Container).ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + local_2c.ObjectID = local_4c[0].ObjectID; + if (local_4c[0].ObjectID == NONE.ObjectID) { + error(&DAT_080f1b80); + local_3c = NONE; + } + else { + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,CHEST); + if (!bVar1) { + Object::getObjectType(local_5c); + error("GetFirstContainerObject: Con (%d) ist kein Container.\n",local_5c[0].ObjectID + ); + local_3c = NONE; + goto LAB_0805a144; + } + } + local_3c.ObjectID = Object::getAttribute(local_4c,CONTENT); + } +LAB_0805a144: + local_5c[0] = (Object)Obj->ObjectID; + if (local_3c.ObjectID == local_5c[0].ObjectID) { + local_6c[0].ObjectID = local_5c[0].ObjectID; + pTVar2 = AccessObject(local_6c); + local_4c[0].ObjectID = (pTVar2->NextObject).ObjectID; + Object::setAttribute(&local_2c,CONTENT,local_4c[0].ObjectID); + } + else { + while( true ) { + local_4c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_4c); + local_6c[0].ObjectID = (pTVar2->NextObject).ObjectID; + local_7c[0] = (Object)Obj->ObjectID; + if (local_6c[0].ObjectID == local_7c[0].ObjectID) break; + local_4c[0].ObjectID = local_3c.ObjectID; + pTVar2 = AccessObject(local_4c); + local_3c.ObjectID = (pTVar2->NextObject).ObjectID; + local_7c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + } + local_6c[0].ObjectID = local_3c.ObjectID; + local_4c[0].ObjectID = local_7c[0].ObjectID; + pTVar2 = AccessObject(local_6c); + local_8c[0] = (Object)Obj->ObjectID; + pTVar3 = AccessObject(local_8c); + local_4c[0].ObjectID = (pTVar3->NextObject).ObjectID; + (pTVar2->NextObject).ObjectID = local_4c[0].ObjectID; + } + local_7c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_7c); + local_8c[0] = NONE; + local_6c[0].ObjectID = NONE.ObjectID; + (pTVar2->NextObject).ObjectID = NONE.ObjectID; + local_7c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_7c); + (pTVar2->Container).ObjectID = NONE.ObjectID; + return; +} + + + +void DestroyObject(Object *Obj) + +{ + bool bVar1; + TObject *pTVar2; + ulong uVar3; + ulong nr; + uint uVar4; + char *Text; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar4 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + Text = &DAT_080f1ee0; + goto LAB_0805a343; + } + local_3c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,TEXT); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,TEXTSTRING); + DeleteDynamicString(uVar3); + uVar3 = Object::getAttribute(Obj,EDITOR); + DeleteDynamicString(uVar3); + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar1) { +LAB_0805a400: + while (uVar3 = Object::getAttribute(Obj,CONTENT), uVar3 != 0) { + local_3c[0].ObjectID = Object::getAttribute(Obj,CONTENT); + bVar1 = false; + if (local_3c[0].ObjectID != 0) { + uVar4 = local_3c[0].ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && + (*(ulong *)HashTableData[uVar4] == local_3c[0].ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_2c[0].ObjectID = local_3c[0].ObjectID; + CutObject(local_2c); + local_2c[0].ObjectID = local_3c[0].ObjectID; + DestroyObject(local_2c); + } + else { + error(&DAT_080f1800); + } + } + } + else { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CHEST); + if (bVar1) goto LAB_0805a400; + } + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,EXPIRE); + if (bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + CronStop(local_3c); + } + if (Obj->ObjectID == 0) { + error(&DAT_080f1f60,0); + return; + } + uVar4 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar4] == '\x01') { + PutFreeObjectSlot((TObject *)HashTableData[uVar4]); + HashTableType[uVar4] = '\0'; + HashTableFree = HashTableFree + 1; + DecrementObjectCounter(); + return; + } + Text = "DestroyObject: Objekt steht nicht im Speicher.\n"; +LAB_0805a343: + error(Text); + return; +} + + + +void DeleteObject(Object *Obj) + +{ + bool bVar1; + ulong Position; + uint uVar2; + Object local_1c [4]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar2 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar2] == '\x02') { + UnswapSector(HashTableData[uVar2]); + } + if ((HashTableType[uVar2] == '\x01') && (*(ulong *)HashTableData[uVar2] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_1c[0] = (Object)Obj->ObjectID; + CutObject(local_1c); + local_1c[0] = (Object)Obj->ObjectID; + DestroyObject(local_1c); + } + else { + error(&DAT_080f1800); + } + return; +} + + + +Object GetMapContainer(int x,int y,int z) + +{ + int iVar1; + bool bVar2; + bool bVar3; + matrix3d *pmVar4; + int sx; + int iVar5; + Object OVar6; + TSector **ppTVar7; + int sy; + int iVar8; + int iVar9; + int iVar10; + int iVar11; + int in_stack_00000010; + + pmVar4 = Sector; + bVar3 = false; + iVar9 = y + 0x1f; + iVar11 = z + 0x1f; + iVar10 = iVar9; + if (-1 < y) { + iVar10 = y; + } + iVar5 = iVar11; + if (-1 < z) { + iVar5 = z; + } + bVar2 = false; + if ((SectorXMin <= iVar10 >> 5) && (bVar2 = true, SectorXMax < iVar10 >> 5)) { + bVar2 = false; + } + if (bVar2) { + bVar2 = false; + if (SectorYMin <= iVar5 >> 5) { + bVar2 = true; + if (SectorYMax < iVar5 >> 5) { + bVar2 = false; + } + } + if (((bVar2) && (bVar3 = false, SectorZMin <= in_stack_00000010)) && + (bVar3 = true, SectorZMax < in_stack_00000010)) { + bVar3 = false; + } + } + if (bVar3) { + iVar10 = iVar9; + if (-1 < y) { + iVar10 = y; + } + iVar5 = iVar11; + if (-1 < z) { + iVar5 = z; + } + iVar8 = (iVar5 >> 5) - Sector->ymin; + iVar5 = in_stack_00000010 - Sector->zmin; + iVar10 = (iVar10 >> 5) - Sector->xmin; + if ((((iVar10 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar10)) || + ((iVar8 < 0 || ((Sector->dy <= iVar8 || (iVar5 < 0)))))) || (Sector->dz <= iVar5)) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar10 + Sector->xmin, + iVar8 + Sector->ymin,iVar5 + Sector->zmin); + ppTVar7 = pmVar4->entry; + } + else { + ppTVar7 = Sector->entry + iVar10 + iVar8 * iVar1 + iVar5 * iVar1 * Sector->dy; + } + pmVar4 = Sector; + OVar6.ObjectID = NONE.ObjectID; + if (*ppTVar7 != (TSector *)0x0) { + iVar10 = iVar9; + if (-1 < y) { + iVar10 = y; + } + iVar5 = iVar11; + if (-1 < z) { + iVar5 = z; + } + iVar8 = (iVar5 >> 5) - Sector->ymin; + iVar5 = in_stack_00000010 - Sector->zmin; + iVar10 = (iVar10 >> 5) - Sector->xmin; + if (((((iVar10 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar10)) || (iVar8 < 0)) || + ((Sector->dy <= iVar8 || (iVar5 < 0)))) || (Sector->dz <= iVar5)) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar10 + Sector->xmin, + iVar8 + Sector->ymin,iVar5 + Sector->zmin); + ppTVar7 = pmVar4->entry; + } + else { + ppTVar7 = Sector->entry + iVar10 + iVar8 * iVar1 + iVar5 * iVar1 * Sector->dy; + } + (*ppTVar7)->TimeStamp = RoundNr; + pmVar4 = Sector; + if (-1 < y) { + iVar9 = y; + } + if (-1 < z) { + iVar11 = z; + } + iVar8 = (iVar11 >> 5) - Sector->ymin; + iVar10 = in_stack_00000010 - Sector->zmin; + iVar5 = (iVar9 >> 5) - Sector->xmin; + if (((iVar5 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar5)) || + ((iVar8 < 0 || (((Sector->dy <= iVar8 || (iVar10 < 0)) || (Sector->dz <= iVar10)))))) + { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar5 + Sector->xmin, + iVar8 + Sector->ymin,iVar10 + Sector->zmin); + ppTVar7 = pmVar4->entry; + } + else { + ppTVar7 = Sector->entry + iVar10 * iVar1 * Sector->dy + iVar8 * iVar1 + iVar5; + } + OVar6.ObjectID = + *(ulong *)((z + (iVar11 >> 5) * -0x20 + (y + (iVar9 >> 5) * -0x20) * 0x20) * 4 + + (int)*ppTVar7); + } + *(ulong *)x = OVar6.ObjectID; + } + else { + *(ulong *)x = NONE.ObjectID; + } + return (Object)x; +} + + + +Object GetMapContainer(Object *Obj) + +{ + bool bVar1; + TObject *pTVar2; + Object OVar3; + ulong Position; + uint uVar4; + uint *in_stack_00000008; + Object local_4c [4]; + Object local_3c [4]; + ObjectType local_2c [7]; + + bVar1 = false; + if (*in_stack_00000008 != 0) { + uVar4 = *in_stack_00000008 & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && + (*(uint *)HashTableData[uVar4] == *in_stack_00000008)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + while( true ) { + local_3c[0].ObjectID = *in_stack_00000008; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID); + if (local_2c[0].TypeID == 0) break; + local_4c[0].ObjectID = *in_stack_00000008; + pTVar2 = AccessObject(local_4c); + local_2c[0].TypeID = (pTVar2->Container).ObjectID; + *in_stack_00000008 = local_2c[0].TypeID; + } + OVar3.ObjectID = *in_stack_00000008; + } + else { + error(&DAT_080f1fe0); + OVar3 = NONE; + } + Obj->ObjectID = (ulong)OVar3; + return (Object)(ulong)Obj; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object GetFirstObject(void) + +{ + Object OVar1; + ulong *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + Object local_1c; + Object MapCon; + + GetMapContainer((int)&local_1c,in_stack_00000008,in_stack_0000000c); + OVar1 = NONE; + if (local_1c.ObjectID != NONE.ObjectID) { + OVar1.ObjectID = Object::getAttribute(&local_1c,CONTENT); + } + *in_stack_00000004 = OVar1.ObjectID; + return (Object)(ulong)in_stack_00000004; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object GetFirstSpecObject(void) + +{ + TObject *pTVar1; + ulong *in_stack_00000004; + int *in_stack_00000014; + Object local_5c [4]; + ObjectType local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + local_4c[0].TypeID = NONE.ObjectID; + local_3c[0].ObjectID = local_2c; + pTVar1 = AccessObject(local_3c); + ObjectType::setTypeID(local_4c,(pTVar1->Type).TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,*in_stack_00000014); + if (local_4c[0].TypeID == local_3c[0].ObjectID) { + *in_stack_00000004 = local_2c; + return (Object)(ulong)in_stack_00000004; + } + local_5c[0].ObjectID = local_2c; + pTVar1 = AccessObject(local_5c); + local_2c = (pTVar1->NextObject).ObjectID; + } while (local_2c != NONE.ObjectID); + } + *in_stack_00000004 = NONE.ObjectID; + return (Object)(ulong)in_stack_00000004; +} + + + +Object GetFirstContainerObject(Object *Con) + +{ + bool bVar1; + TObject *pTVar2; + Object OVar3; + Object *in_stack_00000008; + Object local_3c [4]; + Object local_2c [7]; + + local_2c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = in_stack_00000008->ObjectID; + if (local_3c[0].ObjectID == NONE.ObjectID) { + error(&DAT_080f1b80); + OVar3 = NONE; + } + else { + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CHEST); + if (!bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID); + error("GetFirstContainerObject: Con (%d) ist kein Container.\n",local_3c[0].ObjectID + ); + OVar3 = NONE; + goto LAB_0805abe7; + } + } + OVar3.ObjectID = Object::getAttribute(in_stack_00000008,CONTENT); + } +LAB_0805abe7: + Con->ObjectID = (ulong)OVar3; + return (Object)(ulong)Con; +} + + + +Object GetContainerObject(Object *Con,int nr) + +{ + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + int in_stack_0000000c; + Object local_5c [4]; + ulong local_4c; + ulong local_3c; + Object local_2c; + Object Obj; + + bVar1 = false; + if (*(uint *)nr != 0) { + uVar3 = *(uint *)nr & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(int *)HashTableData[uVar3] == *(int *)nr)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + if (-1 < in_stack_0000000c) { + local_3c = *(ulong *)nr; + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + if (in_stack_0000000c == 0) goto LAB_0805ad80; + in_stack_0000000c = in_stack_0000000c + -1; + local_5c[0].ObjectID = local_2c.ObjectID; + local_4c = NONE.ObjectID; + local_3c = NONE.ObjectID; + pTVar2 = AccessObject(local_5c); + local_2c.ObjectID = (pTVar2->NextObject).ObjectID; + } while (local_2c.ObjectID != NONE.ObjectID); + } + Con->ObjectID = (ulong)NONE; + return (Object)(ulong)Con; + } + error(&DAT_080f2020); + local_2c = NONE; + } + else { + error(&DAT_080f2060); + local_2c = NONE; + } +LAB_0805ad80: + Con->ObjectID = (ulong)local_2c; + return (Object)(ulong)Con; +} + + + +bool IsOnMap(int x,int y,int z) + +{ + bool bVar1; + int sx; + int iVar2; + bool bVar3; + + iVar2 = x + 0x1f; + if (-1 < x) { + iVar2 = x; + } + if (0x7fffffff < (uint)y) { + y = y + 0x1f; + } + bVar1 = false; + bVar3 = false; + if ((SectorXMin <= iVar2 >> 5) && (bVar1 = true, SectorXMax < iVar2 >> 5)) { + bVar1 = false; + } + if (bVar1) { + bVar1 = false; + if ((SectorYMin <= y >> 5) && (bVar1 = true, SectorYMax < y >> 5)) { + bVar1 = false; + } + if (bVar1) { + bVar1 = false; + if ((SectorZMin <= z) && (bVar1 = true, SectorZMax < z)) { + bVar1 = bVar3; + } + if (bVar1 != false) { + bVar3 = true; + } + } + } + return bVar3; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool CoordinateFlag(void) + +{ + bool bVar1; + TObject *pTVar2; + FLAG in_stack_00000010; + Object local_5c [4]; + ObjectType local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + local_4c[0].TypeID = NONE.ObjectID; + local_3c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_3c); + ObjectType::setTypeID(local_4c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag(local_4c,in_stack_00000010); + if (bVar1) { + return true; + } + local_5c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_5c); + local_2c = (pTVar2->NextObject).ObjectID; + } while (local_2c != NONE.ObjectID); + } + return false; +} + + + +bool IsPremiumArea(int x,int y,int param_3) + +{ + bool bVar1; + int iVar2; + int iVar3; + + iVar2 = x + 0x1f; + if (-1 < x) { + iVar2 = x; + } + iVar2 = iVar2 >> 5; + if (0x7fffffff < (uint)y) { + y = y + 0x1f; + } + bVar1 = true; + iVar3 = y >> 5; + if ((((iVar2 < 0x40c) && ((iVar2 < 0x408 || (bVar1 = true, 0x3e6 < iVar3)))) && + ((iVar2 < 0x406 || (bVar1 = true, iVar3 < 0x3f0)))) && + (((iVar2 < 0x405 || (bVar1 = true, iVar3 < 0x3f1)) && + ((iVar2 < 0x3fe || (bVar1 = true, iVar3 < 0x3f6)))))) { + bVar1 = 0x3f7 < iVar3; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool IsProtectionZone(void) + +{ + byte bVar1; + bool bVar2; + int in_stack_00000004; + int in_stack_00000008; + Object local_2c [4]; + ulong local_1c; + Object Con; + + GetMapContainer((int)&local_1c,in_stack_00000004,in_stack_00000008); + bVar2 = false; + if (local_1c != NONE.ObjectID) { + local_2c[0].ObjectID = local_1c; + bVar1 = GetMapContainerFlags(local_2c); + bVar2 = (bool)(bVar1 >> 2 & 1); + } + return bVar2; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool IsNoLogoutField(void) + +{ + byte bVar1; + bool bVar2; + int in_stack_00000004; + int in_stack_00000008; + Object local_2c [4]; + ulong local_1c; + Object Con; + + GetMapContainer((int)&local_1c,in_stack_00000004,in_stack_00000008); + bVar2 = false; + if (local_1c != NONE.ObjectID) { + local_2c[0].ObjectID = local_1c; + bVar1 = GetMapContainerFlags(local_2c); + bVar2 = (bool)(bVar1 >> 1 & 1); + } + return bVar2; +} + + + +bool IsHouse(int x,int y,int z) + +{ + bool bVar1; + short sVar2; + TObject *pTVar3; + Object local_3c [4]; + Object local_2c; + Object Con; + + GetMapContainer((int)&local_2c,x,y); + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c.ObjectID != NONE.ObjectID) { + bVar1 = Object::exists(&local_2c); + if (bVar1) { + local_3c[0].ObjectID = local_2c.ObjectID; + pTVar3 = AccessObject(local_3c); + sVar2 = *(short *)((int)pTVar3->Attributes + 0xe); + goto LAB_0805b121; + } + error(&DAT_080f20a0,x,y,z); + } + sVar2 = 0; +LAB_0805b121: + return sVar2 != 0; +} + + + +ushort GetHouseID(int x,int y,int z) + +{ + bool bVar1; + TObject *pTVar2; + ushort uVar3; + ulong Position; + uint uVar4; + Object local_3c [4]; + uint local_2c; + Object Con; + + GetMapContainer((int)&local_2c,x,y); + uVar3 = 0; + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + bVar1 = false; + if (local_2c != 0) { + uVar4 = local_2c & HashTableMask; + if (HashTableType[uVar4] == '\x02') { + UnswapSector(HashTableData[uVar4]); + } + if ((HashTableType[uVar4] == '\x01') && (*(uint *)HashTableData[uVar4] == local_2c)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (bVar1) { + local_3c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_3c); + uVar3 = *(ushort *)((int)pTVar2->Attributes + 0xe); + } + else { + error(&DAT_080f20a0,x,y,z); + uVar3 = 0; + } + } + return uVar3; +} + + + +void SetHouseID(int x,int y,int z,ushort ID) + +{ + bool bVar1; + bool bVar2; + ushort uVar3; + TObject *pTVar4; + int sy; + int iVar5; + int sx; + int iVar6; + ulong Position; + uint uVar7; + ushort ID_local; + uint local_2c; + Object Con; + + iVar6 = x; + if (0x7fffffff < (uint)x) { + iVar6 = x + 0x1f; + } + iVar5 = y; + if (0x7fffffff < (uint)y) { + iVar5 = y + 0x1f; + } + bVar1 = false; + bVar2 = false; + if ((SectorXMin <= iVar6 >> 5) && (bVar1 = true, SectorXMax < iVar6 >> 5)) { + bVar1 = false; + } + if (bVar1) { + bVar1 = false; + if ((SectorYMin <= iVar5 >> 5) && (bVar1 = true, SectorYMax < iVar5 >> 5)) { + bVar1 = false; + } + if (bVar1) { + bVar1 = false; + if ((SectorZMin <= z) && (bVar1 = true, SectorZMax < z)) { + bVar1 = bVar2; + } + if (bVar1) { + bVar2 = true; + } + } + } + if (!bVar2) { + return; + } + iVar6 = z; + GetMapContainer((int)&local_2c,x,y); + bVar1 = false; + _ID_local = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + bVar2 = false; + if (local_2c != 0) { + uVar7 = local_2c & HashTableMask; + if (HashTableType[uVar7] == '\x02') { + UnswapSector(HashTableData[uVar7]); + } + if ((HashTableType[uVar7] == '\x01') && (*(uint *)HashTableData[uVar7] == local_2c)) { + bVar2 = true; + } + else { + bVar2 = false; + } + } + if (bVar2) goto LAB_0805b36c; + } + bVar1 = true; +LAB_0805b36c: + if (bVar1) { + print(); + } + else { + uVar3 = GetHouseID(x,y,z); + if (uVar3 == 0) { + _ID_local = local_2c; + pTVar4 = AccessObject((Object *)&ID_local); + pTVar4->Attributes[3] = pTVar4->Attributes[3] + (uint)ID * 0x10000; + } + else { + error(&DAT_080f2160,y,z,iVar6); + } + } + return; +} + + + +int GetDepotNumber(char *Town) + +{ + TDepotInfo *s1; + int iVar1; + int i; + int i_00; + + if (Town == (char *)0x0) { + error("GetDepotNumber: Town ist NULL.\n"); + } + else if ((*Town != '\0') && (i_00 = DepotInfo.min, DepotInfo.min <= DepotInfo.max)) { + do { + s1 = vector::operator()(&DepotInfo,i_00); + iVar1 = stricmp(s1->Town,Town,-1); + if (iVar1 == 0) { + return i_00; + } + i_00 = i_00 + 1; + } while (i_00 <= DepotInfo.max); + } + return -1; +} + + + +char * GetDepotName(int DepotNumber) + +{ + TDepotInfo *pTVar1; + char *Text; + + if ((DepotNumber < DepotInfo.min) || (DepotInfo.max < DepotNumber)) { + Text = &DAT_080f21c0; + } + else { + pTVar1 = vector::operator()(&DepotInfo,DepotNumber); + if (pTVar1 != (TDepotInfo *)0x0) { + pTVar1 = vector::operator()(&DepotInfo,DepotNumber); + return pTVar1->Town; + } + Text = &DAT_080f2200; + } + error(Text,DepotNumber); + return "unknown"; +} + + + +// WARNING: Variable defined which should be unmapped: PremiumAccount_local + +int GetDepotSize(int DepotNumber,bool PremiumAccount) + +{ + int iVar1; + TDepotInfo *pTVar2; + bool PremiumAccount_local; + + if ((DepotNumber < DepotInfo.min) || (DepotInfo.max < DepotNumber)) { + error(&DAT_080f2240,DepotNumber); + iVar1 = 1; + } + else { + pTVar2 = vector::operator()(&DepotInfo,DepotNumber); + if (pTVar2->Size < 1) { + pTVar2 = vector::operator()(&DepotInfo,DepotNumber); + error(&DAT_080f2280,pTVar2->Size,DepotNumber); + pTVar2 = vector::operator()(&DepotInfo,DepotNumber); + pTVar2->Size = 1; + } + if (PremiumAccount) { + pTVar2 = vector::operator()(&DepotInfo,DepotNumber); + iVar1 = pTVar2->Size * 2; + } + else { + pTVar2 = vector::operator()(&DepotInfo,DepotNumber); + iVar1 = pTVar2->Size; + } + } + return iVar1; +} + + + +void GetStartPosition(int *x,int *y,int *z,bool Newbie) + +{ + int iVar1; + + if (Newbie) { + *x = NewbieStartPositionX; + *y = NewbieStartPositionY; + iVar1 = NewbieStartPositionZ; + } + else { + *x = VeteranStartPositionX; + *y = VeteranStartPositionY; + iVar1 = VeteranStartPositionZ; + } + *z = iVar1; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GetMarkPosition(void) + +{ + TMark *pTVar1; + int iVar2; + int i; + int i_00; + char *in_stack_00000004; + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + + i_00 = 0; + if (0 < Marks) { + do { + pTVar1 = vector::operator()(&Mark,i_00); + iVar2 = stricmp(pTVar1->Name,in_stack_00000004,-1); + if (iVar2 == 0) { + pTVar1 = vector::operator()(&Mark,i_00); + *in_stack_00000008 = pTVar1->x; + pTVar1 = vector::operator()(&Mark,i_00); + *in_stack_0000000c = pTVar1->y; + pTVar1 = vector::operator()(&Mark,i_00); + *in_stack_00000010 = pTVar1->z; + return true; + } + i_00 = i_00 + 1; + } while (i_00 < Marks); + } + return false; +} + + + +void InitSector(int x,int y,int z) + +{ + int iVar1; + matrix3d *pmVar2; + int iVar3; + TSector *pTVar4; + TSector **ppTVar5; + uint uVar6; + TObject *pTVar7; + int iVar8; + int iVar9; + TSector *pTVar10; + int yy; + TSector *Sec; + int local_5c; + int xx; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + pmVar2 = Sector; + iVar9 = y - Sector->ymin; + iVar3 = z - Sector->zmin; + iVar8 = x - Sector->xmin; + if ((((iVar8 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar8)) || (iVar9 < 0)) || + (((Sector->dy <= iVar9 || (iVar3 < 0)) || (Sector->dz <= iVar3)))) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar8 + Sector->xmin, + iVar9 + Sector->ymin,iVar3 + Sector->zmin); + ppTVar5 = pmVar2->entry; + } + else { + ppTVar5 = Sector->entry + iVar3 * iVar1 * Sector->dy + iVar9 * iVar1 + iVar8; + } + if (*ppTVar5 == (TSector *)0x0) { + pTVar4 = (TSector *)malloc(0x1008); + pmVar2 = Sector; + iVar9 = y - Sector->ymin; + iVar3 = z - Sector->zmin; + iVar8 = x - Sector->xmin; + if (((iVar8 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar8)) || + ((iVar9 < 0 || (((Sector->dy <= iVar9 || (iVar3 < 0)) || (Sector->dz <= iVar3)))))) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar8 + Sector->xmin, + iVar9 + Sector->ymin,iVar3 + Sector->zmin); + ppTVar5 = pmVar2->entry; + } + else { + ppTVar5 = Sector->entry + iVar3 * iVar1 * Sector->dy + iVar9 * iVar1 + iVar8; + } + *ppTVar5 = pTVar4; + uVar6 = 0x1008; + pTVar10 = pTVar4; + if (((uint)pTVar4 & 4) != 0) { + pTVar4->MapCon[0][0].ObjectID = 0; + uVar6 = 0x1004; + pTVar10 = (TSector *)(pTVar4->MapCon[0] + 1); + } + for (uVar6 = uVar6 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) { + pTVar10->MapCon[0][0].ObjectID = 0; + pTVar10 = (TSector *)(pTVar10->MapCon[0] + 1); + } + pTVar4->Status = '\0'; + pTVar4->TimeStamp = RoundNr; + local_5c = 0; + do { + iVar3 = 0; + do { + CreateObject(); + local_3c[0].ObjectID = local_2c; + pTVar7 = AccessObject(local_3c); + pTVar7->Attributes[1] = x * 0x20 + local_5c; + local_3c[0].ObjectID = local_2c; + pTVar7 = AccessObject(local_3c); + pTVar7->Attributes[2] = y * 0x20 + iVar3; + local_3c[0].ObjectID = local_2c; + pTVar7 = AccessObject(local_3c); + pTVar7->Attributes[3] = z; + iVar8 = iVar3 + 1; + pTVar4->MapCon[local_5c][iVar3].ObjectID = local_2c; + iVar3 = iVar8; + } while (iVar8 < 0x20); + local_5c = local_5c + 1; + } while (local_5c < 0x20); + pTVar4->MapFlags = '\0'; + pTVar4->Status = '\x01'; + } + else { + error("InitSector: Sektor %d/%d/%d existiert schon.\n",x,y,z); + } + return; +} + + + +void SwapObject(TWriteBinaryFile *File,Object *Obj,ulong FileNumber) + +{ + TObject *Entry_00; + bool bVar1; + TObject *pTVar2; + ulong Position; + uint uVar3; + TObject *Entry; + TObject *local_5c; + TObject *local_4c; + Object Help; + Object local_3c; + Object Search; + Object local_2c [7]; + + bVar1 = false; + if (Obj->ObjectID != 0) { + uVar3 = Obj->ObjectID & HashTableMask; + if (HashTableType[uVar3] == '\x02') { + UnswapSector(HashTableData[uVar3]); + } + if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) { + bVar1 = true; + } + else { + bVar1 = false; + } + } + if (!bVar1) { + // try { // try from 0805b9bf to 0805bb3b has its CatchHandler @ 0805bb46 + error(&DAT_080f2300); + return; + } + Entry_00 = (TObject *)HashTableData[HashTableMask & Obj->ObjectID]; + (*(File->super_TWriteStream)._vptr_TWriteStream[5])(File,Entry_00,0x20); + local_3c = (Object)Obj->ObjectID; + pTVar2 = AccessObject(&local_3c); + ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_2c); + ObjectType::setTypeID((ObjectType *)&local_3c,(pTVar2->Type).TypeID); + bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,CHEST); + if (!bVar1) goto LAB_0805bad8; + } + local_3c.ObjectID = Object::getAttribute(Obj,CONTENT); + local_2c[0].ObjectID = NONE.ObjectID; + local_4c = (TObject *)NONE.ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) { + do { + Entry = (TObject *)local_3c.ObjectID; + local_4c = (TObject *)local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + pTVar2 = AccessObject((Object *)&Entry); + local_5c = (TObject *)(pTVar2->NextObject).ObjectID; + Entry = local_4c; + local_3c.ObjectID = (ulong)local_5c; + local_2c[0].ObjectID = (ulong)local_5c; + SwapObject(File,(Object *)&Entry,FileNumber); + local_2c[0].ObjectID = NONE.ObjectID; + local_4c = (TObject *)NONE.ObjectID; + } while (local_3c.ObjectID != NONE.ObjectID); + } +LAB_0805bad8: + PutFreeObjectSlot(Entry_00); + HashTableType[HashTableMask & Obj->ObjectID] = '\x02'; + HashTableData[HashTableMask & Obj->ObjectID] = FileNumber; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SwapSector(void) + +{ + int iVar1; + TSector *pTVar2; + matrix3d *pmVar3; + bool bVar4; + TSector *Help; + int iVar5; + TSector **ppTVar6; + int iVar7; + int iVar8; + int *piVar9; + Object *Obj; + char *__oflag; + int local_206c; + int local_2068; + int yy; + int xx; + TSector *local_205c; + int z; + int y; + int x; + ulong Oldest; + TSector *Sec; + int SecZ; + int SecY; + int SecX; + undefined1 local_202c [4]; + TWriteBinaryFile File; + char local_101c [4]; + char FileName [4096]; + + Oldest = 0; + SecY = 0; + SecZ = 0; + x = RoundNr + 1; + Sec = (TSector *)0x0; + y = SectorXMin; + iVar5 = SectorYMax; + iVar7 = SectorXMax; + if (SectorXMin <= SectorXMax) { + do { + z = SectorYMin; + if (SectorYMin <= iVar5) { + local_206c = SectorZMax; + do { + local_205c = (TSector *)SectorZMin; + if (SectorZMin <= local_206c) { + do { + pmVar3 = Sector; + iVar8 = z - Sector->ymin; + iVar5 = (int)local_205c - Sector->zmin; + iVar7 = y - Sector->xmin; + if (((((iVar7 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar7)) || + (iVar8 < 0)) || ((Sector->dy <= iVar8 || (iVar5 < 0)))) || + (Sector->dz <= iVar5)) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n", + iVar7 + Sector->xmin,iVar8 + Sector->ymin,iVar5 + Sector->zmin + ); + ppTVar6 = pmVar3->entry; + local_206c = SectorZMax; + } + else { + ppTVar6 = Sector->entry + + iVar5 * iVar1 * Sector->dy + iVar8 * iVar1 + iVar7; + } + pTVar2 = *ppTVar6; + if (((pTVar2 != (TSector *)0x0) && (pTVar2->Status == '\x01')) && + (pTVar2->TimeStamp < (uint)x)) { + SecZ = z; + SecY = y; + Sec = local_205c; + x = pTVar2->TimeStamp; + Oldest = (ulong)pTVar2; + } + local_205c = (TSector *)((int)&local_205c->MapCon[0][0].ObjectID + 1); + iVar5 = SectorYMax; + } while ((int)local_205c <= local_206c); + } + z = z + 1; + iVar7 = SectorXMax; + } while (z <= iVar5); + } + y = y + 1; + } while (y <= iVar7); + } + if (Oldest == 0) { + error("FATAL ERROR in SwapSector: Es kann kein Sektor ausgelagert werden.\n"); + // WARNING: Subroutine does not return + abort(); + } + do { + SwapSector::lexical_block_2::FileNumber = SwapSector::lexical_block_2::FileNumber + 1; + if (99999999 < SwapSector::lexical_block_2::FileNumber) { + SwapSector::lexical_block_2::FileNumber = 1; + } + __oflag = SAVEPATH; + sprintf(local_101c,"%s/%08ld.swp",SAVEPATH,SwapSector::lexical_block_2::FileNumber); + bVar4 = FileExists(local_101c); + } while (bVar4); + TWriteBinaryFile::TWriteBinaryFile((TWriteBinaryFile *)local_202c); + // try { // try from 0805bd5f to 0805be46 has its CatchHandler @ 0805bee3 + TWriteBinaryFile::open((TWriteBinaryFile *)local_202c,local_101c,(int)__oflag); + print(); + TWriteStream::writeQuad((TWriteStream *)local_202c,SecY); + TWriteStream::writeQuad((TWriteStream *)local_202c,SecZ); + TWriteStream::writeQuad((TWriteStream *)local_202c,(ulong)Sec); + yy = 0; + do { + local_2068 = 0; + piVar9 = (int *)(Oldest + yy * 0x80); + do { + SecX = *piVar9; + Obj = (Object *)&SecX; + SwapObject((TWriteBinaryFile *)local_202c,Obj,SwapSector::lexical_block_2::FileNumber); + local_2068 = local_2068 + 1; + piVar9 = piVar9 + 1; + } while (local_2068 < 0x20); + yy = yy + 1; + } while (yy < 0x20); + *(undefined1 *)(Oldest + 0x1004) = 2; + TWriteBinaryFile::close((TWriteBinaryFile *)local_202c,(int)Obj); + TWriteBinaryFile::~TWriteBinaryFile((TWriteBinaryFile *)local_202c,(int)Obj); + return; +} + + + +void UnswapSector(ulong FileNumber) + +{ + int iVar1; + TSector *pTVar2; + ulong *puVar3; + matrix3d *pmVar4; + uchar *puVar5; + int iVar6; + TObject *pTVar7; + ulong uVar8; + ulong uVar9; + int iVar10; + TSector **ppTVar11; + int iVar12; + ulong nr; + int iVar13; + uint uVar14; + TSector *Sec; + char *pcVar15; + ulong uVar16; + TObject *local_204c; + int SecZ; + int SecY; + int SecX; + int FileSize; + TReadBinaryFile File; + char local_101c [4]; + char FileName [4096]; + + pcVar15 = SAVEPATH; + sprintf(local_101c,"%s/%08ld.swp",SAVEPATH,FileNumber); + TReadBinaryFile::TReadBinaryFile((TReadBinaryFile *)&FileSize); + // try { // try from 0805bf7c to 0805c0c2 has its CatchHandler @ 0805c257 + TReadBinaryFile::open((TReadBinaryFile *)&FileSize,local_101c,(int)pcVar15); + iVar6 = TReadBinaryFile::getSize((TReadBinaryFile *)&FileSize); + pTVar7 = (TObject *)TReadStream::readQuad((TReadStream *)&FileSize); + uVar8 = TReadStream::readQuad((TReadStream *)&FileSize); + uVar9 = TReadStream::readQuad((TReadStream *)&FileSize); + pcVar15 = "Lagere Sector %d/%d/%d ein...\n"; + uVar16 = uVar9; + print(); + pmVar4 = Sector; + iVar13 = uVar8 - Sector->ymin; + iVar10 = uVar9 - Sector->zmin; + iVar12 = (int)pTVar7 - Sector->xmin; + if ((((iVar12 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar12)) || (iVar13 < 0)) || + (((Sector->dy <= iVar13 || (iVar10 < 0)) || (Sector->dz <= iVar10)))) { + pcVar15 = (char *)(iVar12 + Sector->xmin); + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",pcVar15,iVar13 + Sector->ymin, + iVar10 + Sector->zmin,uVar16); + ppTVar11 = pmVar4->entry; + } + else { + ppTVar11 = Sector->entry + iVar12 + iVar13 * iVar1 + iVar10 * iVar1 * Sector->dy; + } + pTVar2 = *ppTVar11; + if (pTVar2 == (TSector *)0x0) { + pcVar15 = "UnswapSector: Sektor %d/%d/%d existiert nicht.\n"; + } + else { + if (pTVar2->Status == '\x02') { + while( true ) { + // try { // try from 0805c0db to 0805c1ee has its CatchHandler @ 0805c257 + iVar10 = TReadBinaryFile::getPosition((TReadBinaryFile *)&FileSize); + if (iVar6 <= iVar10) break; + if (FirstFreeObject == (TObject *)0x0) { + SwapSector(); + } + local_204c = FirstFreeObject; + if (FirstFreeObject == (TObject *)0x0) { + error("GetFreeObjectSlot: Kein freier Platz mehr.\n"); + local_204c = (TObject *)0x0; + } + else { + puVar3 = &FirstFreeObject->ObjectID; + FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID; + *puVar3 = 0; + (local_204c->NextObject).ObjectID = 0; + (local_204c->Container).ObjectID = 0; + (local_204c->Type).TypeID = 0; + local_204c->Attributes[0] = 0; + local_204c->Attributes[1] = 0; + local_204c->Attributes[2] = 0; + local_204c->Attributes[3] = 0; + } + pTVar7 = local_204c; + TReadBinaryFile::readBytes((TReadBinaryFile *)&FileSize,(uchar *)local_204c,0x20); + puVar5 = HashTableType; + pcVar15 = (char *)local_204c->ObjectID; + uVar14 = (uint)pcVar15 & HashTableMask; + if (HashTableType[uVar14] == '\x02') { + HashTableData[uVar14] = (ulong)local_204c; + puVar5[uVar14] = '\x01'; + pcVar15 = (char *)pTVar7; + } + else { + error("UnswapSector: Objekt %ld existiert schon.\n"); + } + } + pTVar2->Status = '\x01'; + TReadBinaryFile::close((TReadBinaryFile *)&FileSize,(int)pcVar15); + unlink(local_101c); + goto LAB_0805c0c3; + } + pcVar15 = "UnswapSector: Sektor %d/%d/%d ist nicht ausgelagert.\n"; + } + error(pcVar15,pTVar7,uVar8,uVar9,uVar16); + TReadBinaryFile::close((TReadBinaryFile *)&FileSize,(int)pTVar7); + pcVar15 = (char *)pTVar7; +LAB_0805c0c3: + TReadBinaryFile::~TReadBinaryFile((TReadBinaryFile *)&FileSize,(int)pcVar15); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DeleteSwappedSectors(void) + +{ + DIR *__dirp; + dirent *pdVar1; + size_t sVar2; + int iVar3; + dirent *DirEntry; + char *pcVar4; + char *pcVar5; + bool bVar6; + char *s; + DIR *WorkDir; + char FileName [4096]; + + __dirp = opendir(SAVEPATH); + if (__dirp == (DIR *)0x0) { + error("DeleteSwappedSectors: Unterverzeichnis %s nicht gefunden\n",SAVEPATH); + } + else { + while (pdVar1 = readdir(__dirp), pdVar1 != (dirent *)0x0) { + sVar2 = strlen(pdVar1->d_name); + bVar6 = sVar2 == 0xc; + if (bVar6) { + iVar3 = 4; + pcVar4 = pdVar1->d_name + 8; + pcVar5 = ".swp"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar6 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while (bVar6); + if (bVar6) { + sprintf((char *)&WorkDir,"%s/%s",SAVEPATH,pdVar1->d_name); + unlink((char *)&WorkDir); + } + } + } + closedir(__dirp); + } + return; +} + + + +int GetInstanceAttributeByName(char *Name) + +{ + int iVar1; + int i; + int iVar2; + char (*s1) [30]; + + iVar2 = 0; + s1 = InstanceAttributeNames; + do { + iVar1 = stricmp(*s1,Name,-1); + if (iVar1 == 0) { + return iVar2; + } + iVar2 = iVar2 + 1; + s1 = s1 + 1; + } while (iVar2 < 0x12); + return -1; +} + + + +// WARNING: Variable defined which should be unmapped: Skip_local + +void LoadObjects(TReadScriptFile *Script,TWriteStream *Stream,bool Skip) + +{ + bool bVar1; + char cVar2; + uint uVar3; + undefined4 *puVar4; + char *pcVar5; + int iVar6; + ushort TypeID; + char (*s1) [30]; + uint local_24; + int i; + int iStack_18; + bool ProcessObjects; + int Depth; + bool Skip_local; + + iStack_18 = 1; + // try { // try from 0805c41e to 0805c65e has its CatchHandler @ 0805c661 + TReadScriptFile::readSymbol(Script,'{'); + bVar1 = true; + TReadScriptFile::nextToken(Script); + do { + if (bVar1) { + if (Script->Token == SPECIAL) { + cVar2 = TReadScriptFile::getSpecial(Script); + if (cVar2 == '}') { + if (!Skip) { + (*Stream->_vptr_TWriteStream[2])(Stream,0xffff); + } + iStack_18 = iStack_18 + -1; + bVar1 = false; + if (iStack_18 < 1) { + return; + } + goto LAB_0805c45f; + } + if ((Script->Token == SPECIAL) && + (cVar2 = TReadScriptFile::getSpecial(Script), cVar2 == ',')) { + TReadScriptFile::nextToken(Script); + } + } + uVar3 = TReadScriptFile::getNumber(Script); + bVar1 = ObjectTypeExists(uVar3 & 0xffff); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "unknown object type"; +LAB_0805c49b: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char_const*::typeinfo,0); + } + if (!Skip) { + (*Stream->_vptr_TWriteStream[2])(Stream,uVar3 & 0xffff); + } + bVar1 = false; +LAB_0805c45f: + TReadScriptFile::nextToken(Script); + } + else { + if (Script->Token != SPECIAL) { + pcVar5 = TReadScriptFile::getIdentifier(Script); + s1 = InstanceAttributeNames; + local_24 = 0; + do { + iVar6 = stricmp(*s1,pcVar5,-1); + if (iVar6 == 0) goto LAB_0805c564; + local_24 = local_24 + 1; + s1 = s1 + 1; + } while ((int)local_24 < 0x12); + local_24 = 0xffffffff; +LAB_0805c564: + if (local_24 == 0xffffffff) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "unknown attribute"; + goto LAB_0805c49b; + } + TReadScriptFile::readSymbol(Script,'='); + if (!Skip) { + (*Stream->_vptr_TWriteStream[1])(Stream,local_24 & 0xff); + } + if (local_24 == 0) { + iStack_18 = iStack_18 + 1; + TReadScriptFile::readSymbol(Script,'{'); + bVar1 = true; + } + else if (local_24 - 9 < 2) { + if (Skip) { + TReadScriptFile::readString(Script); + } + else { + pcVar5 = TReadScriptFile::readString(Script); + (*Stream->_vptr_TWriteStream[4])(Stream,pcVar5); + } + } + else if (Skip) { + TReadScriptFile::readNumber(Script); + } + else { + iVar6 = TReadScriptFile::readNumber(Script); + (*Stream->_vptr_TWriteStream[3])(Stream,iVar6); + } + goto LAB_0805c45f; + } + if (!Skip) { + (*Stream->_vptr_TWriteStream[1])(Stream,0xff); + } + bVar1 = true; + } + if (iStack_18 < 1) { + return; + } + } while( true ); +} + + + +void LoadObjects(TReadStream *Stream,Object *Con) + +{ + bool bVar1; + char cVar2; + ulong Value; + uint uVar3; + TObject *pTVar4; + INSTANCEATTRIBUTE IVar5; + ulong Value_00; + int NewDelay; + ulong Value_1; + ushort TypeID; + int Depth; + int iVar6; + char local_108c [3]; + bool ProcessObjects; + char Help [4096]; + ObjectType local_7c [4]; + ulong local_6c [4]; + Object local_5c; + ObjectType Type; + Object local_3c [4]; + Object local_2c; + Object Obj; + + iVar6 = 1; + bVar1 = true; + local_2c.ObjectID = NONE.ObjectID; + do { + if (bVar1) { + // try { // try from 0805c6bb to 0805c867 has its CatchHandler @ 0805c870 + uVar3 = (*Stream->_vptr_TReadStream[2])(Stream); + if ((short)uVar3 == -1) { + iVar6 = iVar6 + -1; + local_5c = (Object)Con->ObjectID; + local_3c[0].ObjectID = local_5c.ObjectID; + local_2c.ObjectID = local_5c.ObjectID; + pTVar4 = AccessObject(&local_5c); + local_3c[0].ObjectID = (pTVar4->Container).ObjectID; + Con->ObjectID = (ulong)local_3c[0]; + } + else { + ObjectCounter = ObjectCounter + 1; + ObjectType::setTypeID((ObjectType *)&local_5c,uVar3 & 0xffff); + bVar1 = false; + if ((0 < (int)local_5c.ObjectID) && ((int)local_5c.ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) { + local_6c[0] = Con->ObjectID; + GetContainerObject(local_3c,(int)local_6c); + } + else { + ObjectType::setTypeID(local_7c,local_5c.ObjectID); + Help._4092_4_ = Con->ObjectID; + AppendObject(local_3c,(ObjectType *)(Help + 0xffc)); + } + local_2c.ObjectID = local_3c[0].ObjectID; + } + bVar1 = false; + } + else { + IVar5 = (*Stream->_vptr_TReadStream[1])(Stream); + cVar2 = (char)IVar5; + if (cVar2 != -1) { + if (cVar2 != '\0') { + if ((byte)(cVar2 - 9U) < 2) { + (*Stream->_vptr_TReadStream[4])(Stream,local_108c,0x1000); + Value_00 = AddDynamicString(local_108c); + } + else { + if (cVar2 == '\x0f') { + NewDelay = (*Stream->_vptr_TReadStream[3])(Stream); + if (NewDelay != 0) { + Help[0xffc] = (undefined1)local_2c.ObjectID; + Help[0xffd] = local_2c.ObjectID._1_1_; + Help[0xffe] = local_2c.ObjectID._2_1_; + Help[0xfff] = local_2c.ObjectID._3_1_; + CronChange((Object *)(Help + 0xffc),NewDelay); + } + goto LAB_0805c72d; + } + Value_00 = (*Stream->_vptr_TReadStream[3])(Stream); + } + Object::setAttribute(&local_2c,IVar5 & 0xff,Value_00); + goto LAB_0805c72d; + } + iVar6 = iVar6 + 1; + local_7c[0].TypeID = local_2c.ObjectID; + Con->ObjectID = (ulong)local_2c; + Help[0xffc] = (undefined1)local_2c.ObjectID; + Help[0xffd] = local_2c.ObjectID._1_1_; + Help[0xffe] = local_2c.ObjectID._2_1_; + Help[0xfff] = local_2c.ObjectID._3_1_; + } + bVar1 = true; + } +LAB_0805c72d: + if (iVar6 < 1) { + return; + } + } while( true ); +} + + + +void LoadSector(char *FileName,int x,int y,int z) + +{ + int iVar1; + TSector *pTVar2; + bool bVar3; + matrix3d *pmVar4; + char cVar5; + uchar *Help; + int iVar6; + TSector **ppTVar7; + char *pcVar8; + TObject *pTVar9; + byte *pbVar10; + int iVar11; + int iVar12; + int iVar13; + char *pcVar14; + undefined1 uVar15; + char *pcVar16; + uint local_4034; + int yy; + int xx; + TSector *Sec; + undefined1 local_400c [4]; + TReadBuffer ReadBuffer; + TReadScriptFile Script; + + bVar3 = false; + if ((SectorXMin <= x) && (x <= SectorXMax)) { + bVar3 = true; + } + if (bVar3) { + bVar3 = false; + if ((SectorYMin <= y) && (y <= SectorYMax)) { + bVar3 = true; + } + if (bVar3) { + bVar3 = false; + if ((SectorZMin <= z) && (z <= SectorZMax)) { + bVar3 = true; + } + if (bVar3) { + iVar12 = z; + // try { // try from 0805c920 to 0805c932 has its CatchHandler @ 0805cde4 + InitSector(x,y,z); + TReadScriptFile::TReadScriptFile((TReadScriptFile *)&ReadBuffer.Position); + // try { // try from 0805c943 to 0805cd14 has its CatchHandler @ 0805cd60 + TReadScriptFile::open((TReadScriptFile *)&ReadBuffer.Position,FileName,iVar12); + pcVar16 = "Lade Sektor %d/%d/%d ...\n"; + iVar12 = z; + print(); + pmVar4 = Sector; + iVar13 = y - Sector->ymin; + iVar6 = z - Sector->zmin; + iVar11 = x - Sector->xmin; + if (((((iVar11 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar11)) || (iVar13 < 0)) || + ((Sector->dy <= iVar13 || (iVar6 < 0)))) || (Sector->dz <= iVar6)) { + pcVar16 = (char *)(iVar11 + Sector->xmin); + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",pcVar16, + iVar13 + Sector->ymin,iVar6 + Sector->zmin,iVar12); + ppTVar7 = pmVar4->entry; + } + else { + ppTVar7 = Sector->entry + iVar6 * iVar1 * Sector->dy + iVar13 * iVar1 + iVar11; + } + pTVar2 = *ppTVar7; + yy = -1; + local_4034 = 0xffffffff; +LAB_0805ca1d: + do { + while( true ) { + while( true ) { + do { + TReadScriptFile::nextToken((TReadScriptFile *)&ReadBuffer.Position); + if (ReadBuffer.Position == 0) { + TReadScriptFile::close + ((TReadScriptFile *)&ReadBuffer.Position,(int)pcVar16) + ; + // try { // try from 0805cd1e to 0805cd22 has its CatchHandler @ 0805cde4 + TReadScriptFile::~TReadScriptFile + ((TReadScriptFile *)&ReadBuffer.Position,(int)pcVar16) + ; + return; + } + } while ((ReadBuffer.Position == 6) && + (cVar5 = TReadScriptFile::getSpecial + ((TReadScriptFile *)&ReadBuffer.Position), + cVar5 == ',')); + if (ReadBuffer.Position != 4) break; + pbVar10 = TReadScriptFile::getBytesequence + ((TReadScriptFile *)&ReadBuffer.Position); + yy = (int)*pbVar10; + local_4034 = (uint)pbVar10[1]; + pcVar16 = (char *)0x3a; + TReadScriptFile::readSymbol((TReadScriptFile *)&ReadBuffer.Position,':') + ; + } + if (ReadBuffer.Position == 1) break; + pcVar16 = "next map point expected"; +LAB_0805ca73: + TReadScriptFile::error((TReadScriptFile *)&ReadBuffer.Position,pcVar16); + } + uVar15 = yy == -1; + if ((bool)uVar15) { + pcVar16 = "coordinate expected"; + TReadScriptFile::error + ((TReadScriptFile *)&ReadBuffer.Position,"coordinate expected"); + } + pcVar8 = TReadScriptFile::getIdentifier((TReadScriptFile *)&ReadBuffer.Position) + ; + iVar12 = 8; + pcVar14 = "refresh"; + do { + if (iVar12 == 0) break; + iVar12 = iVar12 + -1; + uVar15 = *pcVar8 == *pcVar14; + pcVar8 = pcVar8 + 1; + pcVar14 = pcVar14 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + pcVar8 = TReadScriptFile::getIdentifier + ((TReadScriptFile *)&ReadBuffer.Position); + iVar12 = 9; + pcVar14 = "nologout"; + do { + if (iVar12 == 0) break; + iVar12 = iVar12 + -1; + uVar15 = *pcVar8 == *pcVar14; + pcVar8 = pcVar8 + 1; + pcVar14 = pcVar14 + 1; + } while ((bool)uVar15); + if ((bool)uVar15) { + pTVar2->MapFlags = pTVar2->MapFlags | 2; + local_400c = (undefined1 [4])pTVar2->MapCon[yy][local_4034].ObjectID; + pTVar9 = AccessObject((Object *)local_400c); + pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x200; + } + else { + pcVar8 = TReadScriptFile::getIdentifier + ((TReadScriptFile *)&ReadBuffer.Position); + iVar12 = 0xf; + pcVar14 = "protectionzone"; + do { + if (iVar12 == 0) break; + iVar12 = iVar12 + -1; + uVar15 = *pcVar8 == *pcVar14; + pcVar8 = pcVar8 + 1; + pcVar14 = pcVar14 + 1; + } while ((bool)uVar15); + if ((bool)uVar15) { + pTVar2->MapFlags = pTVar2->MapFlags | 4; + local_400c = (undefined1 [4]) + pTVar2->MapCon[yy][local_4034].ObjectID; + pTVar9 = AccessObject((Object *)local_400c); + pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x400; + } + else { + pcVar16 = TReadScriptFile::getIdentifier + ((TReadScriptFile *)&ReadBuffer.Position); + iVar12 = 8; + pcVar8 = "content"; + do { + if (iVar12 == 0) break; + iVar12 = iVar12 + -1; + uVar15 = *pcVar16 == *pcVar8; + pcVar16 = pcVar16 + 1; + pcVar8 = pcVar8 + 1; + } while ((bool)uVar15); + if (!(bool)uVar15) { + pcVar16 = "unknown map flag"; + goto LAB_0805ca73; + } + TReadScriptFile::readSymbol + ((TReadScriptFile *)&ReadBuffer.Position,'='); + HelpBuffer.super_TWriteBuffer.Position = 0; + LoadObjects((TReadScriptFile *)&ReadBuffer.Position, + (TWriteStream *)&HelpBuffer,false); + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_400c, + HelpBuffer.super_TWriteBuffer.Data, + HelpBuffer.super_TWriteBuffer.Position); + GetMapContainer((int)&Sec,x * 0x20 + yy,y * 0x20 + local_4034); + pcVar16 = (char *)&Sec; + LoadObjects((TReadStream *)local_400c,(Object *)pcVar16); + } + } + goto LAB_0805ca1d; + } + pTVar2->MapFlags = pTVar2->MapFlags | 1; + local_400c = (undefined1 [4])pTVar2->MapCon[yy][local_4034].ObjectID; + pTVar9 = AccessObject((Object *)local_400c); + pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x100; + } while( true ); + } + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadMap(void) + +{ + char *__s; + DIR *__dirp; + dirent *pdVar1; + size_t sVar2; + undefined4 *puVar3; + int iVar4; + dirent *DirEntry; + char *pcVar5; + char *pcVar6; + bool bVar7; + DIR *WorkDir; + int SectorCounter; + int x; + int y; + int z; + char FileName [4096]; + + __dirp = opendir(MAPPATH); + if (__dirp == (DIR *)0x0) { + error("LoadMap: Unterverzeichnis %s nicht gefunden\n",MAPPATH); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "Cannot load map"; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); + } + // try { // try from 0805ce35 to 0805cfb2 has its CatchHandler @ 0805cfb3 + print(); + ObjectCounter = 0; + do { + do { + pdVar1 = readdir(__dirp); + if (pdVar1 == (dirent *)0x0) { + closedir(__dirp); + print(); + print(); + return; + } + __s = pdVar1->d_name; + sVar2 = strlen(__s); + bVar7 = sVar2 == 8; + } while (sVar2 < 9); + iVar4 = 5; + pcVar5 = pdVar1->d_name + (sVar2 - 4); + pcVar6 = ".sec"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar7 = *pcVar5 == *pcVar6; + pcVar5 = pcVar5 + 1; + pcVar6 = pcVar6 + 1; + } while (bVar7); + if (bVar7) { + iVar4 = sscanf(__s,"%d-%d-%d.sec",&SectorCounter,&x,&y); + if (iVar4 == 3) { + sprintf((char *)&z,"%s/%s",MAPPATH,__s); + LoadSector((char *)&z,SectorCounter,x,y); + } + } + } while( true ); +} + + + +void SaveObjects(Object *Obj,TWriteStream *Stream,bool Stop) + +{ + bool bVar1; + TObject *pTVar2; + int iVar3; + ulong uVar4; + char *pcVar5; + bool ProcessObjects; + INSTANCEATTRIBUTE Attribute; + ulong Value; + int Depth; + Object OStack_6c; + bool Stop_local; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object LastObj; + + bVar1 = true; + Value = 1; + local_2c = NONE.ObjectID; + do { + if (bVar1) { + uVar4 = Obj->ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (uVar4 == NONE.ObjectID) { + (*Stream->_vptr_TWriteStream[2])(Stream,0xffff); + Value = Value - 1; + if ((int)Value < 1) { + return; + } + (*Stream->_vptr_TWriteStream[1])(Stream,0xff); + ObjectCounter = ObjectCounter + 1; + if ((Stop) && (Value == 1)) { + return; + } + local_4c[0].ObjectID = NONE.ObjectID; + if (local_2c == NONE.ObjectID) { + error("LastObj ist NONE (1)\n"); + } + OStack_6c.ObjectID = local_2c; + pTVar2 = AccessObject(&stack0xffffff94); + local_5c[0].ObjectID = (pTVar2->Container).ObjectID; + OStack_6c.ObjectID = NONE.ObjectID; + local_2c = local_5c[0].ObjectID; + if (local_5c[0].ObjectID == NONE.ObjectID) { + local_4c[0].ObjectID = local_5c[0].ObjectID; + error("LastObj ist NONE (2)\n"); + } + } + else { + OStack_6c.ObjectID = NONE.ObjectID; + if (uVar4 == NONE.ObjectID) { + error("Obj ist NONE (1)\n"); + uVar4 = Obj->ObjectID; + } + local_5c[0].ObjectID = uVar4; + // try { // try from 0805d023 to 0805d34b has its CatchHandler @ 0805d353 + pTVar2 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)&stack0xffffff94,(pTVar2->Type).TypeID); + if (OStack_6c.ObjectID != 99) { + local_5c[0] = (Object)Obj->ObjectID; + pTVar2 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)&stack0xffffff94,(pTVar2->Type).TypeID); + (*Stream->_vptr_TWriteStream[2])(Stream,OStack_6c.ObjectID & 0xffff); + bVar1 = false; + goto LAB_0805d072; + } + if ((Stop) && (Value == 1)) { + return; + } + OStack_6c = (Object)Obj->ObjectID; + local_5c[0].ObjectID = OStack_6c.ObjectID; + local_2c = OStack_6c.ObjectID; + } + local_4c[0].ObjectID = local_2c; + pTVar2 = AccessObject(local_4c); + OStack_6c.ObjectID = (pTVar2->NextObject).ObjectID; + Obj->ObjectID = (ulong)OStack_6c; + local_5c[0].ObjectID = OStack_6c.ObjectID; + } + else { + uVar4 = Obj->ObjectID; + OStack_6c.ObjectID = NONE.ObjectID; + if (uVar4 == NONE.ObjectID) { + error("Obj ist NONE (2)\n"); + uVar4 = Obj->ObjectID; + } + Attribute = CONTENT; + do { + if (Attribute != CONTENT) { + local_5c[0].ObjectID = uVar4; + pTVar2 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)&stack0xffffff94,(pTVar2->Type).TypeID); + iVar3 = ObjectType::getAttributeOffset((ObjectType *)&stack0xffffff94,Attribute) + ; + if (iVar3 != -1) { + if (Attribute == REMAININGEXPIRETIME) { + OStack_6c = (Object)Obj->ObjectID; + uVar4 = CronInfo(&stack0xffffff94,false); + } + else { + uVar4 = Object::getAttribute(Obj,Attribute); + } + if (uVar4 != 0) { + (*Stream->_vptr_TWriteStream[1])(Stream,Attribute & 0xff); + if (Attribute - TEXTSTRING < 2) { + pcVar5 = GetDynamicString(uVar4); + (*Stream->_vptr_TWriteStream[4])(Stream,pcVar5); + } + else { + (*Stream->_vptr_TWriteStream[3])(Stream,uVar4); + } + } + } + uVar4 = Obj->ObjectID; + } + Attribute = Attribute + CHESTQUESTNUMBER; + } while ((int)Attribute < 0x12); + bVar1 = false; + local_5c[0].ObjectID = uVar4; + pTVar2 = AccessObject(local_5c); + ObjectType::setTypeID((ObjectType *)&stack0xffffff94,(pTVar2->Type).TypeID); + iVar3 = ObjectType::getAttributeOffset((ObjectType *)&stack0xffffff94,CONTENT); + if ((iVar3 != -1) && (uVar4 = Object::getAttribute(Obj,CONTENT), uVar4 != 0)) { + bVar1 = true; + } + if (bVar1) { + Value = Value + 1; + local_4c[0].ObjectID = NONE.ObjectID; + local_2c = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + local_3c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject(local_4c); + Obj->ObjectID = (ulong)local_4c[0]; + local_5c[0].ObjectID = local_4c[0].ObjectID; + (*Stream->_vptr_TWriteStream[1])(Stream,0); + } + else { + (*Stream->_vptr_TWriteStream[1])(Stream,0xff); + ObjectCounter = ObjectCounter + 1; + if ((Stop) && (Value == 1)) { + return; + } + local_5c[0] = (Object)Obj->ObjectID; + local_4c[0].ObjectID = local_5c[0].ObjectID; + local_3c[0].ObjectID = local_5c[0].ObjectID; + local_2c = local_5c[0].ObjectID; + pTVar2 = AccessObject(local_3c); + local_5c[0].ObjectID = (pTVar2->NextObject).ObjectID; + Obj->ObjectID = (ulong)local_5c[0]; + local_4c[0].ObjectID = local_5c[0].ObjectID; + } + bVar1 = true; + } +LAB_0805d072: + if ((int)Value < 1) { + return; + } + } while( true ); +} + + + +void SaveObjects(TReadStream *Stream,TWriteScriptFile *Script) + +{ + bool bVar1; + bool bVar2; + char cVar3; + uint uVar4; + int Number; + ushort TypeID; + bool FirstObject; + int iStack_1020; + bool ProcessObjects; + int Depth; + char Help [4096]; + + iStack_1020 = 1; + bVar1 = true; + // try { // try from 0805d3a5 to 0805d4f1 has its CatchHandler @ 0805d513 + TWriteScriptFile::writeText(Script,"{"); + bVar2 = true; + do { + if (bVar1) { + uVar4 = (*Stream->_vptr_TReadStream[2])(Stream); + if ((short)uVar4 == -1) { + iStack_1020 = iStack_1020 + -1; + bVar1 = false; + TWriteScriptFile::writeText(Script,"}"); + } + else { + if (!bVar2) { + TWriteScriptFile::writeText(Script,", "); + } + TWriteScriptFile::writeNumber(Script,uVar4 & 0xffff); + bVar1 = false; + } + } + else { + uVar4 = (*Stream->_vptr_TReadStream[1])(Stream); + cVar3 = (char)uVar4; + if (cVar3 == -1) { + bVar1 = true; + bVar2 = false; + } + else { + TWriteScriptFile::writeText(Script," "); + TWriteScriptFile::writeText(Script,InstanceAttributeNames[uVar4 & 0xff]); + TWriteScriptFile::writeText(Script,"="); + if (cVar3 == '\0') { + iStack_1020 = iStack_1020 + 1; + bVar1 = true; + TWriteScriptFile::writeText(Script,"{"); + bVar2 = true; + } + else if ((byte)(cVar3 - 9U) < 2) { + (*Stream->_vptr_TReadStream[4])(Stream,&Depth,0x1000); + TWriteScriptFile::writeString(Script,(char *)&Depth); + } + else { + Number = (*Stream->_vptr_TReadStream[3])(Stream); + TWriteScriptFile::writeNumber(Script,Number); + } + } + } + } while (0 < iStack_1020); + return; +} + + + +void SaveSector(char *FileName,int x,int y,int z) + +{ + int iVar1; + TSector *pTVar2; + bool bVar3; + bool bVar4; + matrix3d *pmVar5; + byte bVar6; + int iVar7; + TSector **ppTVar8; + int iVar9; + int iVar10; + TSector *Sec; + int Flags; + char *__fd; + int in_stack_ffffef5c; + int local_106c; + int yy; + int xx; + bool Empty; + undefined1 local_105c [4]; + TReadBuffer ReadBuffer; + _func_int_varargs **local_103c; + Object Obj; + undefined1 local_102c [4]; + TWriteScriptFile Script; + + pmVar5 = Sector; + iVar10 = y - Sector->ymin; + iVar7 = z - Sector->zmin; + iVar9 = x - Sector->xmin; + if (((((iVar9 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar9)) || (iVar10 < 0)) || + ((Sector->dy <= iVar10 || (iVar7 < 0)))) || (Sector->dz <= iVar7)) { + in_stack_ffffef5c = iVar10 + Sector->ymin; + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar9 + Sector->xmin, + in_stack_ffffef5c,iVar7 + Sector->zmin); + ppTVar8 = pmVar5->entry; + } + else { + ppTVar8 = Sector->entry + iVar7 * iVar1 * Sector->dy + iVar10 * iVar1 + iVar9; + } + pTVar2 = *ppTVar8; + if (pTVar2 != (TSector *)0x0) { + TWriteScriptFile::TWriteScriptFile((TWriteScriptFile *)local_102c); + // try { // try from 0805d5d8 to 0805d76d has its CatchHandler @ 0805d923 + TWriteScriptFile::open((TWriteScriptFile *)local_102c,FileName,in_stack_ffffef5c); + print(); + TWriteScriptFile::writeText + ((TWriteScriptFile *)local_102c,"# Tibia - graphical Multi-User-Dungeon"); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"# Data for sector "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,x); + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"/"); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,y); + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"/"); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,z); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c); + bVar4 = true; + yy = 0; + do { + local_106c = 0; + do { + __fd = (char *)(x * 0x20 + yy); + GetFirstObject(); + ReadBuffer.Position = pTVar2->MapCon[yy][local_106c].ObjectID; + bVar6 = GetMapContainerFlags((Object *)&ReadBuffer.Position); + bVar3 = false; + ReadBuffer.Position = NONE.ObjectID; + if ((local_103c == (_func_int_varargs **)NONE.ObjectID) && (bVar6 == 0)) { + bVar3 = true; + } + if (!bVar3) { + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,yy); + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"-"); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,local_106c); + __fd = &DAT_080f2ab7; + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,": "); + if ((bVar6 & 1) != 0) { + __fd = "Refresh, "; + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"Refresh, "); + } + if ((bVar6 & 2) != 0) { + __fd = "NoLogout, "; + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"NoLogout, "); + } + if ((bVar6 & 4) != 0) { + __fd = "ProtectionZone, "; + TWriteScriptFile::writeText + ((TWriteScriptFile *)local_102c,"ProtectionZone, "); + } + ReadBuffer.Position = NONE.ObjectID; + local_105c = (undefined1 [4])NONE.ObjectID; + if (local_103c != (_func_int_varargs **)NONE.ObjectID) { + TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"Content="); + HelpBuffer.super_TWriteBuffer.Position = 0; + local_105c = (undefined1 [4])local_103c; + SaveObjects((Object *)local_105c,(TWriteStream *)&HelpBuffer,false); + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_105c,HelpBuffer.super_TWriteBuffer.Data, + HelpBuffer.super_TWriteBuffer.Position); + __fd = (char *)local_102c; + SaveObjects((TReadStream *)local_105c,(TWriteScriptFile *)local_102c); + } + TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c); + bVar4 = false; + } + local_106c = local_106c + 1; + } while (local_106c < 0x20); + yy = yy + 1; + } while (yy < 0x20); + TWriteScriptFile::close((TWriteScriptFile *)local_102c,(int)__fd); + if (bVar4) { + // try { // try from 0805d7ac to 0805d8f2 has its CatchHandler @ 0805d923 + error("SaveSector: Sektor %d/%d/%d ist leer.\n",x,y,z); + unlink(FileName); + __fd = (char *)x; + } + TWriteScriptFile::~TWriteScriptFile((TWriteScriptFile *)local_102c,(int)__fd); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SaveMap(void) + +{ + int iVar1; + int iVar2; + int iVar3; + int z; + int iVar4; + int y; + int y_00; + int x; + int x_00; + char local_101c [4]; + char FileName [4096]; + + if (SaveMap::SavingMap) { + error("SaveMap: Karte wird schon gespeichert.\n"); + } + else { + SaveMap::SavingMap = true; + print(); + ObjectCounter = 0; + iVar2 = SectorXMax; + iVar3 = SectorYMax; + x_00 = SectorXMin; + if (SectorXMin <= SectorXMax) { + do { + iVar1 = SectorZMax; + y_00 = SectorYMin; + if (SectorYMin <= iVar3) { + do { + iVar2 = SectorZMin; + if (SectorZMin <= iVar1) { + do { + sprintf(local_101c,"%s/%04u-%04u-%02u.sec",MAPPATH,x_00,y_00,iVar2); + iVar4 = iVar2 + 1; + SaveSector(local_101c,x_00,y_00,iVar2); + iVar1 = SectorZMax; + iVar3 = SectorYMax; + iVar2 = iVar4; + } while (iVar4 <= SectorZMax); + } + y_00 = y_00 + 1; + iVar2 = SectorXMax; + } while (y_00 <= iVar3); + } + x_00 = x_00 + 1; + } while (x_00 <= iVar2); + } + print(); + SaveMap::SavingMap = false; + } + return; +} + + + +void RefreshSector(int x,int y,int z,TReadStream *Stream) + +{ + int iVar1; + matrix3d *pmVar2; + TSector *Sec; + int iVar3; + TSector **ppTVar4; + uint uVar5; + uint uVar6; + TObject *pTVar7; + int iVar8; + int iVar9; + int xx; + bool bVar10; + char *Con; + int yy; + Object local_5c [4]; + ObjectType local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + pmVar2 = Sector; + iVar9 = y - Sector->ymin; + iVar3 = z - Sector->zmin; + iVar8 = x - Sector->xmin; + if (((((iVar8 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar8)) || (iVar9 < 0)) || + ((Sector->dy <= iVar9 || (iVar3 < 0)))) || (Sector->dz <= iVar3)) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar8 + Sector->xmin, + iVar9 + Sector->ymin,iVar3 + Sector->zmin); + ppTVar4 = pmVar2->entry; + } + else { + ppTVar4 = Sector->entry + iVar3 * iVar1 * Sector->dy + iVar9 * iVar1 + iVar8; + } + if ((*ppTVar4 != (TSector *)0x0) && (((*ppTVar4)->MapFlags & 1) != 0)) { + Con = "Refreshe Sektor %d/%d/%d ...\n"; + iVar3 = x; + iVar8 = y; + iVar9 = z; + print(); + // try { // try from 0805db63 to 0805dc7f has its CatchHandler @ 0805dcb4 + while (iVar3 = (*Stream->_vptr_TReadStream[6])(Stream,Con,iVar3,iVar8,iVar9), + (char)iVar3 == '\0') { + uVar5 = (*Stream->_vptr_TReadStream[1])(Stream); + uVar6 = (*Stream->_vptr_TReadStream[1])(Stream); + while( true ) { + GetFirstObject(); + while( true ) { + bVar10 = false; + local_3c[0].ObjectID = NONE.ObjectID; + local_4c[0].TypeID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + local_5c[0].ObjectID = local_2c; + pTVar7 = AccessObject(local_5c); + ObjectType::setTypeID(local_4c,(pTVar7->Type).TypeID); + bVar10 = local_4c[0].TypeID == 99; + } + if (!bVar10) break; + local_3c[0].ObjectID = local_2c; + pTVar7 = AccessObject(local_3c); + local_5c[0].ObjectID = (pTVar7->NextObject).ObjectID; + local_2c = local_5c[0].ObjectID; + } + local_5c[0].ObjectID = NONE.ObjectID; + if (local_2c == NONE.ObjectID) break; + local_5c[0].ObjectID = local_2c; + DeleteObject(local_5c); + } + iVar3 = y * 0x20 + (uVar6 & 0xff); + iVar8 = z; + GetMapContainer((int)local_5c,x * 0x20 + (uVar5 & 0xff),iVar3); + Con = (char *)local_5c; + LoadObjects(Stream,(Object *)Con); + } + } + return; +} + + + +void PatchSector(int x,int y,int z,bool FullSector,TReadScriptFile *Script,bool SaveHouses) + +{ + TWriteScriptFile *pTVar1; + int iVar2; + TSector *pTVar3; + matrix3d *pmVar4; + char cVar5; + bool bVar6; + byte bVar7; + int result; + int iVar8; + TSector **ppTVar9; + TOKEN TVar10; + TObject *pTVar11; + byte *pbVar12; + int *piVar13; + undefined4 *puVar14; + int iVar15; + int hy; + int iVar16; + int Flags; + bool *pbVar17; + int hx; + int yy_2; + char *pcVar18; + bool bVar19; + undefined1 uVar20; + bool bVar21; + char *pcVar22; + TDynamicWriteBuffer *pTVar23; + bool *local_788c; + int local_7888; + Object *local_7884; + Object *local_7880; + int local_7870; + int yy_1; + int xx_1; + uint uStack_7864; + bool House; + int yy; + int xx; + TSector *Sec; + char local_784c; + bool NewSector; + bool SaveHouses_local; + bool FullSector_local; + char FileNameBak [4096]; + char FileName [4096]; + TWriteScriptFile OUT; + undefined1 local_483c [4]; + TReadScriptFile IN; + undefined1 local_85c [4]; + TReadBuffer ReadBuffer; + undefined1 local_83c [4]; + TReadBuffer ReadBuffer_2; + Object Obj; + bool abStack_81c [4]; + bool FieldTreated [32] [32]; + bool FieldPatched [32] [32]; + + pmVar4 = Sector; + iVar16 = y - Sector->ymin; + iVar8 = z - Sector->zmin; + iVar15 = x - Sector->xmin; + if (((((iVar15 < 0) || (iVar2 = Sector->dx, iVar2 <= iVar15)) || (iVar16 < 0)) || + ((Sector->dy <= iVar16 || (iVar8 < 0)))) || (Sector->dz <= iVar8)) { + // try { // try from 0805dd7d to 0805e502 has its CatchHandler @ 0805f035 + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar15 + Sector->xmin, + iVar16 + Sector->ymin,iVar8 + Sector->zmin); + ppTVar9 = pmVar4->entry; + } + else { + ppTVar9 = Sector->entry + iVar8 * iVar2 * Sector->dy + iVar16 * iVar2 + iVar15; + } + bVar19 = *ppTVar9 == (TSector *)0x0; + if (bVar19) { + print(); + InitSector(x,y,z); + } + pmVar4 = Sector; + iVar16 = y - Sector->ymin; + iVar8 = z - Sector->zmin; + iVar15 = x - Sector->xmin; + if (((iVar15 < 0) || (iVar2 = Sector->dx, iVar2 <= iVar15)) || + ((iVar16 < 0 || (((Sector->dy <= iVar16 || (iVar8 < 0)) || (Sector->dz <= iVar8)))))) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar15 + Sector->xmin, + iVar16 + Sector->ymin,iVar8 + Sector->zmin); + ppTVar9 = pmVar4->entry; + } + else { + ppTVar9 = Sector->entry + iVar8 * iVar2 * Sector->dy + iVar16 * iVar2 + iVar15; + } + bVar21 = false; + pTVar3 = *ppTVar9; + uStack_7864 = 0xffffffff; + iVar8 = 0; + pbVar17 = FieldPatched[0x1f] + 0x1c; + yy = -1; + do { + iVar15 = 0; + do { + iVar16 = iVar15 + 1; + pbVar17[iVar15 + -0x400] = false; + pbVar17[iVar15 + -0x800] = false; + iVar15 = iVar16; + } while (iVar16 < 0x20); + iVar8 = iVar8 + 1; + pbVar17 = pbVar17 + 0x20; + } while (iVar8 < 0x20); +LAB_0805de50: + TReadScriptFile::nextToken(Script); + TVar10 = Script->Token; + if (TVar10 != ENDOFFILE) { + if (TVar10 == SPECIAL) goto code_r0x0805de6d; + goto LAB_0805de7e; + } + if (FullSector) { + yy_1 = 0; + local_7888 = 0; + do { + local_7870 = 0; + local_7884 = pTVar3->MapCon[yy_1]; + do { + if (abStack_81c[local_7870 + local_7888] == false) { + bVar21 = false; + iVar8 = local_7870 + y * 0x20; + iVar15 = yy_1 + x * 0x20; + // try { // try from 0805ecc9 to 0805efcc has its CatchHandler @ 0805f035 + bVar6 = IsHouse(iVar15,iVar8,z); + if (bVar6) { +LAB_0805ecd6: + bVar21 = true; + } + else { + bVar6 = CoordinateFlag(); + if (bVar6) { + iVar16 = iVar8 + 1; + bVar6 = IsHouse(iVar15 + -1,iVar16,z); + if (((bVar6) || (bVar6 = IsHouse(iVar15,iVar16,z), bVar6)) || + (bVar6 = IsHouse(iVar15 + 1,iVar16,z), bVar6)) goto LAB_0805ecd6; + } + bVar6 = CoordinateFlag(); + if (bVar6) { + iVar15 = iVar15 + 1; + bVar6 = IsHouse(iVar15,iVar8 + -1,z); + if (((bVar6) || (bVar6 = IsHouse(iVar15,iVar8,z), bVar6)) || + (bVar6 = IsHouse(iVar15,iVar8 + 1,z), bVar6)) goto LAB_0805ecd6; + } + } + if (bVar21) { + if (SaveHouses) goto LAB_0805e4c9; + CleanHouseField(x * 0x20 + yy_1,y * 0x20 + local_7870,z); + } + while( true ) { + GetFirstObject(); + while( true ) { + bVar21 = false; + ReadBuffer.Position = NONE.ObjectID; + local_83c = (undefined1 [4])NONE.ObjectID; + if (local_85c != (undefined1 [4])NONE.ObjectID) { + ReadBuffer_2.Position = (int)local_85c; + pTVar11 = AccessObject((Object *)&ReadBuffer_2.Position); + ObjectType::setTypeID + ((ObjectType *)local_83c,(pTVar11->Type).TypeID); + bVar21 = local_83c == (undefined1 [4])0x63; + } + if (!bVar21) break; + ReadBuffer_2.Position = (int)local_85c; + pTVar11 = AccessObject((Object *)&ReadBuffer_2.Position); + local_85c = (undefined1 [4])(pTVar11->NextObject).ObjectID; + } + ReadBuffer.Position = NONE.ObjectID; + if (local_85c == (undefined1 [4])NONE.ObjectID) break; + ReadBuffer.Position = (int)local_85c; + DeleteObject((Object *)&ReadBuffer.Position); + } + local_85c = (undefined1 [4])local_7884->ObjectID; + pTVar11 = AccessObject((Object *)local_85c); + pTVar11->Attributes[3] = pTVar11->Attributes[3] & 0xffff00ff; + FieldTreated[0x1f][local_7870 + local_7888 + 0x1c] = true; + } +LAB_0805e4c9: + local_7870 = local_7870 + 1; + local_7884 = local_7884 + 1; + } while (local_7870 < 0x20); + yy_1 = yy_1 + 1; + local_7888 = local_7888 + 0x20; + } while (yy_1 < 0x20); + } + TReadScriptFile::TReadScriptFile((TReadScriptFile *)local_483c); + // try { // try from 0805e50c to 0805e510 has its CatchHandler @ 0805f02f + TWriteScriptFile::TWriteScriptFile((TWriteScriptFile *)(FileName + 0xffc)); + sprintf(FileNameBak + 0xffc,"%s/%04u-%04u-%02u.sec",ORIGMAPPATH,x,y,z); + pcVar22 = ORIGMAPPATH; + sprintf(&local_784c,"%s/%04u-%04u-%02u.sec~",ORIGMAPPATH,x,y,z); + if (!bVar19) { + TReadScriptFile::open((TReadScriptFile *)local_483c,FileNameBak + 0xffc,(int)pcVar22); + } + pTVar1 = (TWriteScriptFile *)(FileName + 0xffc); + // try { // try from 0805e597 to 0805e9db has its CatchHandler @ 0805f004 + TWriteScriptFile::open(pTVar1,&local_784c,(int)pcVar22); + TWriteScriptFile::writeText(pTVar1,"# Tibia - graphical Multi-User-Dungeon"); + TWriteScriptFile::writeLn(pTVar1); + TWriteScriptFile::writeText(pTVar1,"# Data for sector "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)(FileName + 0xffc),x); + TWriteScriptFile::writeText((TWriteScriptFile *)(FileName + 0xffc),"/"); + pTVar1 = (TWriteScriptFile *)(FileName + 0xffc); + TWriteScriptFile::writeNumber(pTVar1,y); + TWriteScriptFile::writeText(pTVar1,"/"); + TWriteScriptFile::writeNumber(pTVar1,z); + TWriteScriptFile::writeLn(pTVar1); + TWriteScriptFile::writeLn(pTVar1); + pcVar22 = (char *)z; + if (!bVar19) { + yy = -1; + uStack_7864 = 0xffffffff; +LAB_0805e656: + do { + TReadScriptFile::nextToken((TReadScriptFile *)local_483c); + if (local_483c == (undefined1 [4])0x0) goto LAB_0805e958; + if ((local_483c != (undefined1 [4])0x6) || + (cVar5 = TReadScriptFile::getSpecial((TReadScriptFile *)local_483c), cVar5 != ',')) { + if (local_483c == (undefined1 [4])0x4) { + pbVar12 = TReadScriptFile::getBytesequence((TReadScriptFile *)local_483c); + yy = (int)*pbVar12; + uStack_7864 = (uint)pbVar12[1]; + z = 0x3a; + TReadScriptFile::readSymbol((TReadScriptFile *)local_483c,':'); + if (FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] != false) goto LAB_0805e656; + pTVar1 = (TWriteScriptFile *)(FileName + 0xffc); + TWriteScriptFile::writeNumber(pTVar1,yy); + TWriteScriptFile::writeText(pTVar1,"-"); + TWriteScriptFile::writeNumber(pTVar1,uStack_7864); + z = (int)&DAT_080f2ab7; + } + else { + if (local_483c != (undefined1 [4])0x1) { + z = (int)"next map point expected"; +LAB_0805e6ac: + TReadScriptFile::error((TReadScriptFile *)local_483c,(char *)z); + goto LAB_0805e656; + } + uVar20 = yy == -1; + if ((bool)uVar20) { + pcVar22 = "coordinate expected"; + TReadScriptFile::error((TReadScriptFile *)local_483c,"coordinate expected"); + z = (int)pcVar22; + } + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_483c); + iVar8 = 8; + pcVar18 = "refresh"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + if (FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] != false) goto LAB_0805e656; + z = (int)"Refresh, "; + } + else { + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_483c); + iVar8 = 9; + pcVar18 = "nologout"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + if (FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] != false) + goto LAB_0805e656; + z = (int)"NoLogout, "; + } + else { + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_483c); + iVar8 = 0xf; + pcVar18 = "protectionzone"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if (!(bool)uVar20) { + pcVar22 = TReadScriptFile::getIdentifier + ((TReadScriptFile *)local_483c); + iVar8 = 8; + pcVar18 = "content"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if (!(bool)uVar20) { + z = (int)"unknown map flag"; + goto LAB_0805e6ac; + } + TReadScriptFile::readSymbol((TReadScriptFile *)local_483c,'='); + HelpBuffer.super_TWriteBuffer.Position = 0; + pTVar23 = &HelpBuffer; + LoadObjects((TReadScriptFile *)local_483c, + (TWriteStream *)&HelpBuffer,false); + z = (int)pTVar23; + if (FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] == false) { + pTVar1 = (TWriteScriptFile *)(FileName + 0xffc); + TWriteScriptFile::writeText(pTVar1,"Content="); + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_85c, + HelpBuffer.super_TWriteBuffer.Data, + HelpBuffer.super_TWriteBuffer.Position); + z = (int)pTVar1; + SaveObjects((TReadStream *)local_85c,pTVar1); + TWriteScriptFile::writeLn(pTVar1); + } + goto LAB_0805e656; + } + if (FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] != false) + goto LAB_0805e656; + z = (int)"ProtectionZone, "; + } + } + } + TWriteScriptFile::writeText((TWriteScriptFile *)(FileName + 0xffc),(char *)z); + } + } while( true ); + } +LAB_0805e966: + local_788c = FieldPatched[0x1f] + 0x1c; + iVar8 = 0; + do { + iVar15 = 0; + local_7880 = pTVar3->MapCon[iVar8]; + do { + if (local_788c[iVar15 + -0x400] != false) { + pcVar22 = (char *)(x * 0x20 + iVar8); + GetFirstObject(); + ReadBuffer.Position = local_7880->ObjectID; + bVar7 = GetMapContainerFlags((Object *)&ReadBuffer.Position); + ReadBuffer.Position = NONE.ObjectID; + bVar21 = false; + if ((local_85c == (undefined1 [4])NONE.ObjectID) && (bVar7 == 0)) { + bVar21 = true; + } + if (!bVar21) { + TWriteScriptFile::writeNumber((TWriteScriptFile *)(FileName + 0xffc),iVar8); + TWriteScriptFile::writeText((TWriteScriptFile *)(FileName + 0xffc),"-"); + TWriteScriptFile::writeNumber((TWriteScriptFile *)(FileName + 0xffc),iVar15); + pcVar22 = &DAT_080f2ab7; + TWriteScriptFile::writeText((TWriteScriptFile *)(FileName + 0xffc),": "); + if ((bVar7 & 1) != 0) { + pcVar22 = "Refresh, "; + TWriteScriptFile::writeText + ((TWriteScriptFile *)(FileName + 0xffc),"Refresh, "); + } + if ((bVar7 & 2) != 0) { + pcVar22 = "NoLogout, "; + TWriteScriptFile::writeText + ((TWriteScriptFile *)(FileName + 0xffc),"NoLogout, "); + } + if ((bVar7 & 4) != 0) { + pcVar22 = "ProtectionZone, "; + TWriteScriptFile::writeText + ((TWriteScriptFile *)(FileName + 0xffc),"ProtectionZone, "); + } + ReadBuffer.Position = NONE.ObjectID; + local_83c = (undefined1 [4])NONE.ObjectID; + if (local_85c != (undefined1 [4])NONE.ObjectID) { + TWriteScriptFile::writeText + ((TWriteScriptFile *)(FileName + 0xffc),"Content="); + HelpBuffer.super_TWriteBuffer.Position = 0; + local_83c = local_85c; + SaveObjects((Object *)local_83c,(TWriteStream *)&HelpBuffer,false); + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_83c,HelpBuffer.super_TWriteBuffer.Data, + HelpBuffer.super_TWriteBuffer.Position); + pcVar22 = FileName + 0xffc; + SaveObjects((TReadStream *)local_83c,(TWriteScriptFile *)pcVar22); + } + TWriteScriptFile::writeLn((TWriteScriptFile *)(FileName + 0xffc)); + } + } + local_7880 = local_7880 + 1; + iVar15 = iVar15 + 1; + } while (iVar15 < 0x20); + local_788c = local_788c + 0x20; + iVar8 = iVar8 + 1; + } while (iVar8 < 0x20); + TWriteScriptFile::close((TWriteScriptFile *)(FileName + 0xffc),(int)pcVar22); + if (!bVar19) { + unlink(FileNameBak + 0xffc); + } + pcVar22 = FileNameBak + 0xffc; + iVar8 = rename(&local_784c,pcVar22); + if (iVar8 == 0) { + // try { // try from 0805ea0e to 0805ea12 has its CatchHandler @ 0805f02f + TWriteScriptFile::~TWriteScriptFile((TWriteScriptFile *)(FileName + 0xffc),(int)pcVar22); + // try { // try from 0805ea1c to 0805ea20 has its CatchHandler @ 0805f035 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)local_483c,(int)pcVar22); + return; + } + // try { // try from 0805ea3e to 0805ec96 has its CatchHandler @ 0805f004 + error("PatchSector: Fehler %d beim Umbenennen von %s.\n",iVar8,&local_784c); + piVar13 = __errno_location(); + pcVar22 = strerror(*piVar13); + error("# Fehler %d: %s.\n",*piVar13,pcVar22); + puVar14 = (undefined4 *)__cxa_allocate_exception(4); + *puVar14 = "cannot patch ORIGMAP"; + // WARNING: Subroutine does not return + __cxa_throw(puVar14,char_const*::typeinfo,0); +code_r0x0805de6d: + cVar5 = TReadScriptFile::getSpecial(Script); + if (cVar5 == ',') goto LAB_0805de50; + TVar10 = Script->Token; +LAB_0805de7e: + if (TVar10 != BYTES) { + if (TVar10 == IDENTIFIER) { + uVar20 = yy == -1; + if ((bool)uVar20) { + TReadScriptFile::error(Script,"coordinate expected"); + } + pcVar22 = TReadScriptFile::getIdentifier(Script); + iVar8 = 8; + pcVar18 = "refresh"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + pTVar3->MapFlags = pTVar3->MapFlags | 1; + if ((!bVar21) || (!SaveHouses)) { + local_85c = (undefined1 [4])pTVar3->MapCon[yy][uStack_7864].ObjectID; + pTVar11 = AccessObject((Object *)local_85c); + pTVar11->Attributes[3] = pTVar11->Attributes[3] | 0x100; + } + goto LAB_0805de50; + } + pcVar22 = TReadScriptFile::getIdentifier(Script); + iVar8 = 9; + pcVar18 = "nologout"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + pTVar3->MapFlags = pTVar3->MapFlags | 2; + if ((!bVar21) || (!SaveHouses)) { + local_85c = (undefined1 [4])pTVar3->MapCon[yy][uStack_7864].ObjectID; + pTVar11 = AccessObject((Object *)local_85c); + pTVar11->Attributes[3] = pTVar11->Attributes[3] | 0x200; + } + goto LAB_0805de50; + } + pcVar22 = TReadScriptFile::getIdentifier(Script); + iVar8 = 0xf; + pcVar18 = "protectionzone"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + pTVar3->MapFlags = pTVar3->MapFlags | 4; + if ((!bVar21) || (!SaveHouses)) { + local_85c = (undefined1 [4])pTVar3->MapCon[yy][uStack_7864].ObjectID; + pTVar11 = AccessObject((Object *)local_85c); + pTVar11->Attributes[3] = pTVar11->Attributes[3] | 0x400; + } + goto LAB_0805de50; + } + pcVar22 = TReadScriptFile::getIdentifier(Script); + iVar8 = 8; + pcVar18 = "content"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar20 = *pcVar22 == *pcVar18; + pcVar22 = pcVar22 + 1; + pcVar18 = pcVar18 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + TReadScriptFile::readSymbol(Script,'='); + HelpBuffer.super_TWriteBuffer.Position = 0; + if ((bVar21) && (SaveHouses)) { + LoadObjects(Script,(TWriteStream *)&HelpBuffer,true); + } + else { + LoadObjects(Script,(TWriteStream *)&HelpBuffer,false); + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_85c,HelpBuffer.super_TWriteBuffer.Data, + HelpBuffer.super_TWriteBuffer.Position); + GetMapContainer((int)&ReadBuffer.Position,x * 0x20 + yy,y * 0x20 + uStack_7864); + LoadObjects((TReadStream *)local_85c,(Object *)&ReadBuffer.Position); + } + goto LAB_0805de50; + } + pcVar22 = "unknown map flag"; + } + else { + pcVar22 = "next map point expected"; + } + TReadScriptFile::error(Script,pcVar22); + goto LAB_0805de50; + } + pbVar12 = TReadScriptFile::getBytesequence(Script); + yy = (int)*pbVar12; + uStack_7864 = (uint)pbVar12[1]; + FieldTreated[yy - 1][uStack_7864 + 0x1c] = true; + TReadScriptFile::readSymbol(Script,':'); + bVar21 = false; + iVar8 = uStack_7864 + y * 0x20; + iVar15 = yy + x * 0x20; + bVar6 = IsHouse(iVar15,iVar8,z); + if (!bVar6) { + bVar6 = CoordinateFlag(); + if (bVar6) { + iVar16 = iVar8 + 1; + bVar6 = IsHouse(iVar15 + -1,iVar16,z); + if (((bVar6) || (bVar6 = IsHouse(iVar15,iVar16,z), bVar6)) || + (bVar6 = IsHouse(iVar15 + 1,iVar16,z), bVar6)) goto LAB_0805e1c9; + } + bVar6 = CoordinateFlag(); + if (!bVar6) goto LAB_0805e1d0; + iVar15 = iVar15 + 1; + bVar6 = IsHouse(iVar15,iVar8 + -1,z); + if (((!bVar6) && (bVar6 = IsHouse(iVar15,iVar8,z), !bVar6)) && + (bVar6 = IsHouse(iVar15,iVar8 + 1,z), !bVar6)) goto LAB_0805e1d0; + } +LAB_0805e1c9: + bVar21 = true; +LAB_0805e1d0: + if (bVar21) { + if (SaveHouses) goto LAB_0805de50; + CleanHouseField(x * 0x20 + yy,y * 0x20 + uStack_7864,z); + } + while( true ) { + GetFirstObject(); + while( true ) { + bVar6 = false; + local_83c = (undefined1 [4])NONE.ObjectID; + ReadBuffer.Position = NONE.ObjectID; + if (ReadBuffer_2.Position != NONE.ObjectID) { + local_85c = (undefined1 [4])ReadBuffer_2.Position; + pTVar11 = AccessObject((Object *)local_85c); + ObjectType::setTypeID((ObjectType *)&ReadBuffer.Position,(pTVar11->Type).TypeID); + bVar6 = ReadBuffer.Position == 99; + } + if (!bVar6) break; + local_83c = (undefined1 [4])ReadBuffer_2.Position; + pTVar11 = AccessObject((Object *)local_83c); + local_85c = (undefined1 [4])(pTVar11->NextObject).ObjectID; + ReadBuffer_2.Position = (int)local_85c; + } + if (ReadBuffer_2.Position == NONE.ObjectID) break; + local_85c = (undefined1 [4])ReadBuffer_2.Position; + DeleteObject((Object *)local_85c); + } + local_85c = (undefined1 [4])pTVar3->MapCon[yy][uStack_7864].ObjectID; + pTVar11 = AccessObject((Object *)local_85c); + pTVar11->Attributes[3] = pTVar11->Attributes[3] & 0xffff00ff; + FieldTreated[yy + 0x1f][uStack_7864 + 0x1c] = true; + goto LAB_0805de50; +LAB_0805e958: + TReadScriptFile::close((TReadScriptFile *)local_483c,z); + pcVar22 = (char *)z; + goto LAB_0805e966; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ReadMapConfig(void) + +{ + TReadScriptFile *pTVar1; + char *pcVar2; + TMark *pTVar3; + size_t sVar4; + TDepotInfo *pTVar5; + undefined4 *puVar6; + int iVar7; + undefined1 uVar8; + int *__s; + char *pcVar9; + int *piVar10; + int DepotNumber; + char Ident [30]; + TReadScriptFile Script; + int local_101c; + char FileName [4096]; + + NewbieStartPositionY = 0; + SectorYMin = 1000; + SectorYMax = 0x3f7; + SectorZMax = 0xf; + RefreshedCylinders = 1; + SectorXMax = 0x3f7; + HashTableSize = 0x100000; + SectorXMin = 1000; + SectorZMin = 0; + OBCount = 0xa0000; + NewbieStartPositionX = 0; + VeteranStartPositionX = 0; + __s = &local_101c; + Marks = 0; + NewbieStartPositionZ = 0; + VeteranStartPositionY = 0; + VeteranStartPositionZ = 0; + pcVar9 = DATAPATH; + sprintf((char *)__s,"%s/map.dat"); + // try { // try from 0805f114 to 0805f118 has its CatchHandler @ 0805f850 + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 0805f126 to 0805f5e6 has its CatchHandler @ 0805f831 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),(char *)__s,(int)pcVar9); + do { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffb004 == 0) { + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)__s); + if (SectorXMin < 1) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorXMin"; + } + else if (SectorXMax < 0x7ff) { + if (SectorYMin < 1) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorYMin"; + } + else if (SectorYMax < 0x7ff) { + if (SectorZMin < 0) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorZMin"; + } + else if (SectorZMax < 0x10) { + if (SectorXMax < SectorXMin) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "SectorXMin is greater than SectorXMax"; + } + else if (SectorYMax < SectorYMin) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "SectorYMin is greater than SectorYMax"; + } + else if (SectorZMax < SectorZMin) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "SectorZMin is greater than SectorZMax"; + } + else if ((OBCount & 0x7fffU) == 0) { + if (OBCount < 1) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for CacheSize"; + } + else { + if (0x7fffffff < (uint)OBCount) { + OBCount = OBCount + 0x7fff; + } + OBCount = OBCount >> 0xf; + if (HashTableSize < 1) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for Objects"; + } + else if ((HashTableSize - 1U & HashTableSize) == 0) { + if (NewbieStartPositionX == 0) { + puVar6 = (undefined4 *) + __cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "no start position for newbies specified"; + } + else { + if (VeteranStartPositionX != 0) { + // try { // try from 0805f6c4 to 0805f6c8 has its CatchHandler @ 0805f850 + TReadScriptFile::~TReadScriptFile + ((TReadScriptFile *)(Ident + 0x1c),(int)__s); + return; + } + puVar6 = (undefined4 *) + __cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "no start position for veterans specified"; + } + } + else { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "Objects must be a power of 2"; + } + } + } + else { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "CacheSize must be a multiple of 32768"; + } + } + else { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorZMax"; + } + } + else { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorYMax"; + } + } + else { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9); + *puVar6 = "illegal value for SectorXMax"; + } + // WARNING: Subroutine does not return + // try { // try from 0805f6f9 to 0805f6fd has its CatchHandler @ 0805f831 + __cxa_throw(puVar6,char_const*::typeinfo,0); + } + uVar8 = stack0xffffb004 == 1; + if (!(bool)uVar8) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Identifier expected"); + } + pcVar2 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy((char *)&DepotNumber,pcVar2); + __s = (int *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorxmin"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorXMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorxmax"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorXMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorymin"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorYMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorymax"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorYMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorzmin"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorZMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0xb; + piVar10 = &DepotNumber; + pcVar2 = "sectorzmax"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + SectorZMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 0x13; + piVar10 = &DepotNumber; + pcVar2 = "refreshedcylinders"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + RefreshedCylinders = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 8; + piVar10 = &DepotNumber; + pcVar2 = "objects"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + HashTableSize = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 10; + piVar10 = &DepotNumber; + pcVar2 = "cachesize"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + OBCount = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + } + iVar7 = 6; + piVar10 = &DepotNumber; + pcVar2 = "depot"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + TReadScriptFile::readSymbol(pTVar1,','); + TReadScriptFile::nextToken(pTVar1); + if (stack0xffffb004 != 3) { + TReadScriptFile::error(pTVar1,"town name expected"); + } + pcVar2 = TReadScriptFile::getString((TReadScriptFile *)(Ident + 0x1c)); + sVar4 = strlen(pcVar2); + uVar8 = sVar4 == 0x13; + if (0x13 < sVar4) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"town name too long"); + } + pcVar2 = TReadScriptFile::getString((TReadScriptFile *)(Ident + 0x1c)); + pTVar5 = vector::operator()(&DepotInfo,iVar7); + strcpy(pTVar5->Town,pcVar2); + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar5 = vector::operator()(&DepotInfo,iVar7); + iVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar5->Size = iVar7; + __s = (int *)0x29; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')'); + } + iVar7 = 5; + piVar10 = &DepotNumber; + pcVar2 = "mark"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + pcVar9 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + pTVar3 = vector::operator()(&Mark,Marks); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + strcpy(pTVar3->Name,pcVar9); + TReadScriptFile::readSymbol(pTVar1,','); + vector::operator()(&Mark,Marks); + pTVar3 = vector::operator()(&Mark,Marks); + pcVar9 = (char *)&pTVar3->y; + vector::operator()(&Mark,Marks); + TReadScriptFile::readCoordinate(pTVar1); + __s = (int *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + Marks = Marks + 1; + uVar8 = Marks == 0; + } + iVar7 = 0xc; + piVar10 = &DepotNumber; + pcVar2 = "newbiestart"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + piVar10 = &NewbieStartPositionY; + __s = &NewbieStartPositionX; + TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c)); + pcVar9 = (char *)piVar10; + } + iVar7 = 0xd; + piVar10 = &DepotNumber; + pcVar2 = "veteranstart"; + do { + if (iVar7 == 0) break; + iVar7 = iVar7 + -1; + uVar8 = (char)*piVar10 == *pcVar2; + piVar10 = (int *)((int)piVar10 + 1); + pcVar2 = pcVar2 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + piVar10 = &VeteranStartPositionY; + __s = &VeteranStartPositionX; + TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c)); + pcVar9 = (char *)piVar10; + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitMap(void) + +{ + int iVar1; + ulong *puVar2; + TObjectBlock **ppTVar3; + ulong *puVar4; + int i_2; + matrix3d *this; + TObject *pTVar5; + TObjectBlock *pTVar6; + int j; + int iVar7; + int iVar8; + TObject *Help; + int i_1; + int iVar9; + int i; + int iVar10; + + // try { // try from 0805f869 to 0805f879 has its CatchHandler @ 0805fad4 + ReadMapConfig(); + this = (matrix3d *)operator_new(0x1c); + // try { // try from 0805f8bd to 0805f8c1 has its CatchHandler @ 0805fab7 + matrix3d::matrix3d + (this,SectorXMin,SectorXMax,SectorYMin,SectorYMax,SectorZMin,SectorZMax,(TSector *)0x0 + ); + Sector = this; + // try { // try from 0805f8c8 to 0805fa67 has its CatchHandler @ 0805fad4 + DeleteSwappedSectors(); + iVar10 = 0; + ObjectBlock = (TObjectBlock **)malloc(OBCount << 2); + if (0 < OBCount) { + do { + ppTVar3 = ObjectBlock; + pTVar6 = (TObjectBlock *)malloc(0x100000); + ppTVar3[iVar10] = pTVar6; + iVar10 = iVar10 + 1; + } while (iVar10 < OBCount); + } + iVar10 = OBCount; + ppTVar3 = ObjectBlock; + iVar9 = 0; + if (0 < OBCount) { + iVar1 = OBCount + -1; + do { + iVar7 = 0; + do { + iVar8 = iVar7 + 1; + ppTVar3[iVar9]->Object[iVar7].NextObject.ObjectID = + (ulong)(ppTVar3[iVar9]->Object + iVar7 + 1); + iVar7 = iVar8; + } while (iVar8 < 0x7fff); + if (iVar9 < iVar1) { + ppTVar3[iVar9]->Object[0x7fff].NextObject.ObjectID = (ulong)ppTVar3[iVar9 + 1]; + } + else { + ppTVar3[iVar9]->Object[0x7fff].NextObject.ObjectID = 0; + } + iVar9 = iVar9 + 1; + } while (iVar9 < iVar10); + } + FirstFreeObject = (*ObjectBlock)->Object; + HashTableMask = HashTableSize - 1; + HashTableData = (ulong *)malloc(HashTableSize << 2); + HashTableType = (uchar *)malloc(HashTableSize); + memset(HashTableType,0,HashTableSize); + HashTableFree = HashTableSize + -1; + *HashTableType = 0xff; + puVar4 = HashTableData; + if (FirstFreeObject == (TObject *)0x0) { + SwapSector(); + } + pTVar5 = FirstFreeObject; + if (FirstFreeObject == (TObject *)0x0) { + error("GetFreeObjectSlot: Kein freier Platz mehr.\n"); + pTVar5 = (TObject *)0x0; + } + else { + puVar2 = &FirstFreeObject->ObjectID; + FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID; + *puVar2 = 0; + (pTVar5->NextObject).ObjectID = 0; + (pTVar5->Container).ObjectID = 0; + (pTVar5->Type).TypeID = 0; + pTVar5->Attributes[0] = 0; + pTVar5->Attributes[1] = 0; + pTVar5->Attributes[2] = 0; + pTVar5->Attributes[3] = 0; + } + *puVar4 = (ulong)pTVar5; + iVar10 = 0; + do { + CronHashTable[iVar10] = -1; + iVar10 = iVar10 + 1; + } while (iVar10 < 0x7ff); + CronEntries = 0; + LoadMap(); + return; +} + + + +// WARNING: Variable defined which should be unmapped: x + +void ExitMap(bool save) + +{ + TObjectBlock **ppTVar1; + int iVar2; + TSector **ppTVar3; + int iVar4; + int iVar5; + int i; + int iVar6; + matrix3d *pmVar7; + int local_1c; + int z; + int y; + int x; + + if (save) { + SaveMap(); + } + iVar6 = 0; + free(HashTableType); + free(HashTableData); + if (0 < OBCount) { + do { + ppTVar1 = ObjectBlock + iVar6; + iVar6 = iVar6 + 1; + free(*ppTVar1); + } while (iVar6 < OBCount); + } + free(ObjectBlock); + y = SectorXMin; + iVar6 = SectorXMax; + iVar4 = SectorYMax; + pmVar7 = Sector; + if (SectorXMin <= SectorXMax) { + do { + z = SectorYMin; + iVar5 = SectorZMax; + if (SectorYMin <= iVar4) { + do { + local_1c = SectorZMin; + if (SectorZMin <= iVar5) { + do { + iVar5 = z - pmVar7->ymin; + iVar6 = local_1c - pmVar7->zmin; + iVar4 = y - pmVar7->xmin; + if ((((iVar4 < 0) || (iVar2 = pmVar7->dx, iVar2 <= iVar4)) || + (iVar5 < 0)) || + (((pmVar7->dy <= iVar5 || (iVar6 < 0)) || (pmVar7->dz <= iVar6)))) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n", + iVar4 + pmVar7->xmin,iVar5 + pmVar7->ymin,iVar6 + pmVar7->zmin + ); + ppTVar3 = pmVar7->entry; + pmVar7 = Sector; + } + else { + ppTVar3 = pmVar7->entry + + iVar6 * iVar2 * pmVar7->dy + iVar5 * iVar2 + iVar4; + } + if (*ppTVar3 != (TSector *)0x0) { + iVar5 = z - pmVar7->ymin; + iVar6 = local_1c - pmVar7->zmin; + iVar4 = y - pmVar7->xmin; + if (((iVar4 < 0) || (iVar2 = pmVar7->dx, iVar2 <= iVar4)) || + ((iVar5 < 0 || + (((pmVar7->dy <= iVar5 || (iVar6 < 0)) || (pmVar7->dz <= iVar6)) + )))) { + error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n", + iVar4 + pmVar7->xmin,iVar5 + pmVar7->ymin, + iVar6 + pmVar7->zmin); + ppTVar3 = pmVar7->entry; + } + else { + ppTVar3 = pmVar7->entry + + iVar6 * iVar2 * pmVar7->dy + iVar5 * iVar2 + iVar4; + } + free(*ppTVar3); + pmVar7 = Sector; + } + local_1c = local_1c + 1; + iVar5 = SectorZMax; + iVar4 = SectorYMax; + } while (local_1c <= SectorZMax); + } + z = z + 1; + iVar6 = SectorXMax; + } while (z <= iVar4); + } + y = y + 1; + } while (y <= iVar6); + } + if (pmVar7 != (matrix3d *)0x0) { + if (pmVar7->entry != (TSector **)0x0) { + operator_delete__(pmVar7->entry); + } + operator_delete(pmVar7); + } + DeleteSwappedSectors(); + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (CronEntry.entry == (TCronEntry *)0x0) { + return; + } + operator_delete__(CronEntry.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + if (DepotInfo.entry == (TDepotInfo *)0x0) { + return; + } + operator_delete__(DepotInfo.entry); + return; +} + + + +void __tcf_2(void *param_1) + +{ + if (Mark.entry == (TMark *)0x0) { + return; + } + operator_delete__(Mark.entry); + return; +} + + + +void __tcf_3(void *param_1) + +{ + int in_stack_00000008; + + TDynamicWriteBuffer::~TDynamicWriteBuffer(&HelpBuffer,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_InstanceAttributeNames(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: TCronEntry * operator()(vector * this, int i) + +TCronEntry * __thiscall vector::operator()(vector *this,int i) + +{ + ulong uVar1; + ulong uVar2; + TCronEntry *pTVar3; + int iVar4; + int iVar5; + int iVar6; + TCronEntry *pTVar7; + int iVar8; + int iVar9; + int j_1; + int j; + int iVar10; + int extend_1; + int local_40; + int extend; + uchar Help [16]; + + iVar8 = this->start; + while (i < iVar8) { + local_40 = this->block; + if (local_40 == 0) { + iVar8 = this->space; + local_40 = iVar8; + } + else { + iVar8 = this->space; + } + iVar8 = local_40 + iVar8; + pTVar3 = (TCronEntry *)operator_new__(iVar8 * 0x10); + pTVar7 = pTVar3; + while (iVar8 = iVar8 + -1, iVar8 != -1) { + (pTVar7->Obj).ObjectID = 0; + pTVar7 = pTVar7 + 1; + } + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar4 = (iVar8 - this->start) + local_40; + uVar1 = pTVar3[iVar4].Obj.ObjectID; + uVar2 = pTVar3[iVar4].RoundNr; + iVar6 = pTVar3[iVar4].Previous; + iVar9 = pTVar3[iVar4].Next; + iVar5 = iVar8 - this->start; + iVar4 = local_40 + iVar5; + pTVar7 = this->entry; + pTVar3[iVar4].Obj.ObjectID = pTVar7[iVar5].Obj.ObjectID; + pTVar3[iVar4].RoundNr = pTVar7[iVar5].RoundNr; + pTVar3[iVar4].Previous = pTVar7[iVar5].Previous; + iVar10 = iVar8 + 1; + pTVar3[iVar4].Next = pTVar7[iVar5].Next; + pTVar7 = this->entry; + iVar8 = iVar8 - this->start; + pTVar7[iVar8].Obj.ObjectID = uVar1; + pTVar7[iVar8].RoundNr = uVar2; + pTVar7[iVar8].Previous = iVar6; + pTVar7[iVar8].Next = iVar9; + iVar8 = iVar10; + } while (iVar10 <= this->max); + } + if (this->entry != (TCronEntry *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar3; + iVar8 = this->start - local_40; + this->start = iVar8; + this->space = this->space + local_40; + } + iVar6 = this->space; + iVar4 = iVar6 + iVar8; + while (iVar4 <= i) { + iVar4 = this->block; + if (this->block == 0) { + iVar4 = iVar6; + } + iVar6 = iVar4 + iVar6; + pTVar3 = (TCronEntry *)operator_new__(iVar6 * 0x10); + pTVar7 = pTVar3; + while (iVar6 = iVar6 + -1, iVar6 != -1) { + (pTVar7->Obj).ObjectID = 0; + pTVar7 = pTVar7 + 1; + } + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + uVar1 = pTVar3[iVar9].Obj.ObjectID; + uVar2 = pTVar3[iVar9].RoundNr; + iVar6 = pTVar3[iVar9].Previous; + iVar9 = pTVar3[iVar9].Next; + iVar5 = iVar8 - this->start; + pTVar7 = this->entry; + pTVar3[iVar5].Obj.ObjectID = pTVar7[iVar5].Obj.ObjectID; + pTVar3[iVar5].RoundNr = pTVar7[iVar5].RoundNr; + pTVar3[iVar5].Previous = pTVar7[iVar5].Previous; + pTVar3[iVar5].Next = pTVar7[iVar5].Next; + iVar5 = iVar8 + 1; + pTVar7 = this->entry; + iVar8 = iVar8 - this->start; + pTVar7[iVar8].Obj.ObjectID = uVar1; + pTVar7[iVar8].RoundNr = uVar2; + pTVar7[iVar8].Previous = iVar6; + pTVar7[iVar8].Next = iVar9; + iVar8 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (TCronEntry *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar3; + iVar8 = this->start; + iVar6 = this->space + iVar4; + this->space = iVar6; + iVar4 = iVar6 + iVar8; + } + iVar4 = this->min; + while (i < iVar4) { + this->min = iVar4 + -1; + if (this->initialized != false) { + pTVar7 = this->entry + ((iVar4 + -1) - iVar8); + (pTVar7->Obj).ObjectID = (this->init).Obj.ObjectID; + pTVar7->RoundNr = (this->init).RoundNr; + pTVar7->Previous = (this->init).Previous; + pTVar7->Next = (this->init).Next; + iVar8 = this->start; + } + iVar4 = this->min; + } + iVar4 = this->max; + while (iVar4 < i) { + this->max = iVar4 + 1; + if (this->initialized != false) { + pTVar7 = this->entry + ((iVar4 + 1) - iVar8); + (pTVar7->Obj).ObjectID = (this->init).Obj.ObjectID; + pTVar7->RoundNr = (this->init).RoundNr; + pTVar7->Previous = (this->init).Previous; + pTVar7->Next = (this->init).Next; + iVar8 = this->start; + } + iVar4 = this->max; + } + return this->entry + (i - iVar8); +} + + + +// DWARF original prototype: TDepotInfo * operator()(vector * this, int i) + +TDepotInfo * __thiscall vector::operator()(vector *this,int i) + +{ + undefined4 uVar1; + undefined4 uVar2; + undefined4 uVar3; + undefined4 uVar4; + undefined4 uVar5; + TDepotInfo *pTVar6; + TDepotInfo *pTVar7; + int iVar8; + int iVar9; + int iVar10; + TDepotInfo *help_1; + int iVar11; + TDepotInfo *help; + int j; + int local_40; + int extend; + uchar Help [24]; + + iVar9 = this->start; + while (i < iVar9) { + local_40 = this->block; + if (local_40 == 0) { + iVar9 = this->space; + local_40 = iVar9; + } + else { + iVar9 = this->space; + } + pTVar7 = (TDepotInfo *)operator_new__((local_40 + iVar9) * 0x18); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar11 = (iVar9 - this->start) + local_40; + uVar1 = *(undefined4 *)pTVar7[iVar11].Town; + uVar2 = *(undefined4 *)(pTVar7[iVar11].Town + 4); + uVar3 = *(undefined4 *)(pTVar7[iVar11].Town + 8); + uVar4 = *(undefined4 *)(pTVar7[iVar11].Town + 0xc); + uVar5 = *(undefined4 *)(pTVar7[iVar11].Town + 0x10); + iVar10 = pTVar7[iVar11].Size; + iVar8 = iVar9 - this->start; + iVar11 = local_40 + iVar8; + pTVar6 = this->entry; + *(undefined4 *)pTVar7[iVar11].Town = *(undefined4 *)pTVar6[iVar8].Town; + *(undefined4 *)(pTVar7[iVar11].Town + 4) = *(undefined4 *)(pTVar6[iVar8].Town + 4); + *(undefined4 *)(pTVar7[iVar11].Town + 8) = *(undefined4 *)(pTVar6[iVar8].Town + 8); + *(undefined4 *)(pTVar7[iVar11].Town + 0xc) = + *(undefined4 *)(pTVar6[iVar8].Town + 0xc); + *(undefined4 *)(pTVar7[iVar11].Town + 0x10) = + *(undefined4 *)(pTVar6[iVar8].Town + 0x10); + pTVar7[iVar11].Size = pTVar6[iVar8].Size; + iVar11 = iVar9 + 1; + iVar9 = iVar9 - this->start; + pTVar6 = this->entry; + *(undefined4 *)pTVar6[iVar9].Town = uVar1; + *(undefined4 *)(pTVar6[iVar9].Town + 4) = uVar2; + *(undefined4 *)(pTVar6[iVar9].Town + 8) = uVar3; + *(undefined4 *)(pTVar6[iVar9].Town + 0xc) = uVar4; + *(undefined4 *)(pTVar6[iVar9].Town + 0x10) = uVar5; + pTVar6[iVar9].Size = iVar10; + iVar9 = iVar11; + } while (iVar11 <= this->max); + } + if (this->entry != (TDepotInfo *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start - local_40; + this->start = iVar9; + this->space = this->space + local_40; + } + iVar10 = this->space; + iVar11 = iVar10 + iVar9; + while (iVar11 <= i) { + iVar11 = this->block; + if (this->block == 0) { + iVar11 = iVar10; + } + pTVar7 = (TDepotInfo *)operator_new__((iVar11 + iVar10) * 0x18); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar10 = iVar9 - this->start; + uVar1 = *(undefined4 *)pTVar7[iVar10].Town; + uVar2 = *(undefined4 *)(pTVar7[iVar10].Town + 4); + uVar3 = *(undefined4 *)(pTVar7[iVar10].Town + 8); + uVar4 = *(undefined4 *)(pTVar7[iVar10].Town + 0xc); + uVar5 = *(undefined4 *)(pTVar7[iVar10].Town + 0x10); + iVar10 = pTVar7[iVar10].Size; + pTVar6 = this->entry; + iVar8 = iVar9 - this->start; + *(undefined4 *)pTVar7[iVar8].Town = *(undefined4 *)pTVar6[iVar8].Town; + *(undefined4 *)(pTVar7[iVar8].Town + 4) = *(undefined4 *)(pTVar6[iVar8].Town + 4); + *(undefined4 *)(pTVar7[iVar8].Town + 8) = *(undefined4 *)(pTVar6[iVar8].Town + 8); + *(undefined4 *)(pTVar7[iVar8].Town + 0xc) = + *(undefined4 *)(pTVar6[iVar8].Town + 0xc); + *(undefined4 *)(pTVar7[iVar8].Town + 0x10) = + *(undefined4 *)(pTVar6[iVar8].Town + 0x10); + pTVar7[iVar8].Size = pTVar6[iVar8].Size; + iVar8 = iVar9 + 1; + pTVar6 = this->entry; + iVar9 = iVar9 - this->start; + *(undefined4 *)pTVar6[iVar9].Town = uVar1; + *(undefined4 *)(pTVar6[iVar9].Town + 4) = uVar2; + *(undefined4 *)(pTVar6[iVar9].Town + 8) = uVar3; + *(undefined4 *)(pTVar6[iVar9].Town + 0xc) = uVar4; + *(undefined4 *)(pTVar6[iVar9].Town + 0x10) = uVar5; + pTVar6[iVar9].Size = iVar10; + iVar9 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (TDepotInfo *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start; + iVar10 = this->space + iVar11; + this->space = iVar10; + iVar11 = iVar10 + iVar9; + } + iVar11 = this->min; + while (i < iVar11) { + this->min = iVar11 + -1; + if (this->initialized != false) { + iVar9 = (iVar11 + -1) - iVar9; + pTVar7 = this->entry; + *(undefined4 *)pTVar7[iVar9].Town = *(undefined4 *)(this->init).Town; + *(undefined4 *)(pTVar7[iVar9].Town + 4) = *(undefined4 *)((this->init).Town + 4); + *(undefined4 *)(pTVar7[iVar9].Town + 8) = *(undefined4 *)((this->init).Town + 8); + *(undefined4 *)(pTVar7[iVar9].Town + 0xc) = *(undefined4 *)((this->init).Town + 0xc); + *(undefined4 *)(pTVar7[iVar9].Town + 0x10) = *(undefined4 *)((this->init).Town + 0x10); + pTVar7[iVar9].Size = (this->init).Size; + iVar9 = this->start; + } + iVar11 = this->min; + } + iVar11 = this->max; + while (iVar11 < i) { + this->max = iVar11 + 1; + if (this->initialized != false) { + iVar9 = (iVar11 + 1) - iVar9; + pTVar7 = this->entry; + *(undefined4 *)pTVar7[iVar9].Town = *(undefined4 *)(this->init).Town; + *(undefined4 *)(pTVar7[iVar9].Town + 4) = *(undefined4 *)((this->init).Town + 4); + *(undefined4 *)(pTVar7[iVar9].Town + 8) = *(undefined4 *)((this->init).Town + 8); + *(undefined4 *)(pTVar7[iVar9].Town + 0xc) = *(undefined4 *)((this->init).Town + 0xc); + *(undefined4 *)(pTVar7[iVar9].Town + 0x10) = *(undefined4 *)((this->init).Town + 0x10); + pTVar7[iVar9].Size = (this->init).Size; + iVar9 = this->start; + } + iVar11 = this->max; + } + return this->entry + (i - iVar9); +} + + + +// DWARF original prototype: TMark * operator()(vector * this, int i) + +TMark * __thiscall vector::operator()(vector *this,int i) + +{ + undefined4 uVar1; + undefined4 uVar2; + undefined4 uVar3; + undefined4 uVar4; + undefined4 uVar5; + int iVar6; + TMark *pTVar7; + TMark *pTVar8; + int iVar9; + int iVar10; + int iVar11; + int iVar12; + int iVar13; + TMark *help_1; + TMark *help; + int j; + int iVar14; + int local_40; + int extend; + uchar Help [32]; + + iVar12 = this->start; + while (i < iVar12) { + local_40 = this->block; + if (local_40 == 0) { + iVar12 = this->space; + local_40 = iVar12; + } + else { + iVar12 = this->space; + } + pTVar8 = (TMark *)operator_new__((local_40 + iVar12) * 0x20); + iVar12 = this->min; + if (iVar12 <= this->max) { + do { + iVar9 = (iVar12 - this->start) + local_40; + uVar1 = *(undefined4 *)pTVar8[iVar9].Name; + uVar2 = *(undefined4 *)(pTVar8[iVar9].Name + 4); + uVar3 = *(undefined4 *)(pTVar8[iVar9].Name + 8); + uVar4 = *(undefined4 *)(pTVar8[iVar9].Name + 0xc); + uVar5 = *(undefined4 *)(pTVar8[iVar9].Name + 0x10); + iVar10 = pTVar8[iVar9].x; + iVar6 = pTVar8[iVar9].y; + iVar13 = pTVar8[iVar9].z; + iVar11 = iVar12 - this->start; + iVar9 = local_40 + iVar11; + pTVar7 = this->entry; + *(undefined4 *)pTVar8[iVar9].Name = *(undefined4 *)pTVar7[iVar11].Name; + *(undefined4 *)(pTVar8[iVar9].Name + 4) = *(undefined4 *)(pTVar7[iVar11].Name + 4); + *(undefined4 *)(pTVar8[iVar9].Name + 8) = *(undefined4 *)(pTVar7[iVar11].Name + 8); + *(undefined4 *)(pTVar8[iVar9].Name + 0xc) = + *(undefined4 *)(pTVar7[iVar11].Name + 0xc); + *(undefined4 *)(pTVar8[iVar9].Name + 0x10) = + *(undefined4 *)(pTVar7[iVar11].Name + 0x10); + pTVar8[iVar9].x = pTVar7[iVar11].x; + pTVar8[iVar9].y = pTVar7[iVar11].y; + iVar14 = iVar12 + 1; + pTVar8[iVar9].z = pTVar7[iVar11].z; + pTVar7 = this->entry; + iVar12 = iVar12 - this->start; + *(undefined4 *)pTVar7[iVar12].Name = uVar1; + *(undefined4 *)(pTVar7[iVar12].Name + 4) = uVar2; + *(undefined4 *)(pTVar7[iVar12].Name + 8) = uVar3; + *(undefined4 *)(pTVar7[iVar12].Name + 0xc) = uVar4; + *(undefined4 *)(pTVar7[iVar12].Name + 0x10) = uVar5; + pTVar7[iVar12].x = iVar10; + pTVar7[iVar12].y = iVar6; + pTVar7[iVar12].z = iVar13; + iVar12 = iVar14; + } while (iVar14 <= this->max); + } + if (this->entry != (TMark *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar8; + iVar12 = this->start - local_40; + this->start = iVar12; + this->space = this->space + local_40; + } + iVar10 = this->space; + iVar9 = iVar10 + iVar12; + while (iVar9 <= i) { + iVar9 = this->block; + if (this->block == 0) { + iVar9 = iVar10; + } + pTVar8 = (TMark *)operator_new__((iVar9 + iVar10) * 0x20); + iVar12 = this->min; + if (iVar12 <= this->max) { + do { + iVar13 = iVar12 - this->start; + uVar1 = *(undefined4 *)pTVar8[iVar13].Name; + uVar2 = *(undefined4 *)(pTVar8[iVar13].Name + 4); + uVar3 = *(undefined4 *)(pTVar8[iVar13].Name + 8); + uVar4 = *(undefined4 *)(pTVar8[iVar13].Name + 0xc); + uVar5 = *(undefined4 *)(pTVar8[iVar13].Name + 0x10); + iVar10 = pTVar8[iVar13].x; + iVar6 = pTVar8[iVar13].y; + iVar13 = pTVar8[iVar13].z; + iVar11 = iVar12 - this->start; + pTVar7 = this->entry; + *(undefined4 *)pTVar8[iVar11].Name = *(undefined4 *)pTVar7[iVar11].Name; + *(undefined4 *)(pTVar8[iVar11].Name + 4) = *(undefined4 *)(pTVar7[iVar11].Name + 4); + *(undefined4 *)(pTVar8[iVar11].Name + 8) = *(undefined4 *)(pTVar7[iVar11].Name + 8); + *(undefined4 *)(pTVar8[iVar11].Name + 0xc) = + *(undefined4 *)(pTVar7[iVar11].Name + 0xc); + *(undefined4 *)(pTVar8[iVar11].Name + 0x10) = + *(undefined4 *)(pTVar7[iVar11].Name + 0x10); + pTVar8[iVar11].x = pTVar7[iVar11].x; + pTVar8[iVar11].y = pTVar7[iVar11].y; + pTVar8[iVar11].z = pTVar7[iVar11].z; + iVar11 = iVar12 + 1; + pTVar7 = this->entry; + iVar12 = iVar12 - this->start; + *(undefined4 *)pTVar7[iVar12].Name = uVar1; + *(undefined4 *)(pTVar7[iVar12].Name + 4) = uVar2; + *(undefined4 *)(pTVar7[iVar12].Name + 8) = uVar3; + *(undefined4 *)(pTVar7[iVar12].Name + 0xc) = uVar4; + *(undefined4 *)(pTVar7[iVar12].Name + 0x10) = uVar5; + pTVar7[iVar12].x = iVar10; + pTVar7[iVar12].y = iVar6; + pTVar7[iVar12].z = iVar13; + iVar12 = iVar11; + } while (iVar11 <= this->max); + } + if (this->entry != (TMark *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar8; + iVar12 = this->start; + iVar10 = this->space + iVar9; + this->space = iVar10; + iVar9 = iVar10 + iVar12; + } + iVar9 = this->min; + while (i < iVar9) { + this->min = iVar9 + -1; + if (this->initialized != false) { + iVar12 = (iVar9 + -1) - iVar12; + pTVar8 = this->entry; + *(undefined4 *)pTVar8[iVar12].Name = *(undefined4 *)(this->init).Name; + *(undefined4 *)(pTVar8[iVar12].Name + 4) = *(undefined4 *)((this->init).Name + 4); + *(undefined4 *)(pTVar8[iVar12].Name + 8) = *(undefined4 *)((this->init).Name + 8); + *(undefined4 *)(pTVar8[iVar12].Name + 0xc) = *(undefined4 *)((this->init).Name + 0xc); + *(undefined4 *)(pTVar8[iVar12].Name + 0x10) = *(undefined4 *)((this->init).Name + 0x10); + pTVar8[iVar12].x = (this->init).x; + pTVar8[iVar12].y = (this->init).y; + pTVar8[iVar12].z = (this->init).z; + iVar12 = this->start; + } + iVar9 = this->min; + } + iVar9 = this->max; + while (iVar9 < i) { + this->max = iVar9 + 1; + if (this->initialized != false) { + iVar12 = (iVar9 + 1) - iVar12; + pTVar8 = this->entry; + *(undefined4 *)pTVar8[iVar12].Name = *(undefined4 *)(this->init).Name; + *(undefined4 *)(pTVar8[iVar12].Name + 4) = *(undefined4 *)((this->init).Name + 4); + *(undefined4 *)(pTVar8[iVar12].Name + 8) = *(undefined4 *)((this->init).Name + 8); + *(undefined4 *)(pTVar8[iVar12].Name + 0xc) = *(undefined4 *)((this->init).Name + 0xc); + *(undefined4 *)(pTVar8[iVar12].Name + 0x10) = *(undefined4 *)((this->init).Name + 0x10); + pTVar8[iVar12].x = (this->init).x; + pTVar8[iVar12].y = (this->init).y; + pTVar8[iVar12].z = (this->init).z; + iVar12 = this->start; + } + iVar9 = this->max; + } + return this->entry + (i - iVar12); +} + + + +// DWARF original prototype: void matrix3d(matrix3d * this, int xmin, int xmax, int ymin, +// int ymax, int zmin, int zmax, TSector * init) + +void __thiscall +matrix3d::matrix3d + (matrix3d *this,int xmin,int xmax,int ymin,int ymax,int zmin,int zmax, + TSector *init) + +{ + int iVar1; + TSector **ppTVar2; + int iVar3; + int i; + int iVar4; + + this->xmin = xmin; + this->ymin = ymin; + this->zmin = zmin; + iVar4 = (xmax - xmin) + 1; + this->dx = iVar4; + iVar3 = (ymax - ymin) + 1; + this->dy = iVar3; + iVar1 = (zmax - zmin) + 1; + this->dz = iVar1; + if (((iVar4 < 1) || (iVar3 < 1)) || (iVar1 < 1)) { + error("matrix3d: Ungueltige Feldgroesse %d..%d, %d..%d, %d..%d.\n",xmin,xmax,ymin,ymax,zmin, + zmax); + iVar4 = this->dx; + if (iVar4 < 1) { + this->dx = 1; + iVar4 = 1; + } + iVar3 = this->dy; + if (iVar3 < 1) { + this->dy = 1; + iVar3 = 1; + } + iVar1 = this->dz; + if (iVar1 < 1) { + this->dz = 1; + iVar1 = 1; + } + } + ppTVar2 = (TSector **)operator_new__(iVar4 * iVar3 * iVar1 * 4); + iVar4 = 0; + this->entry = ppTVar2; + if (0 < this->dy * this->dx * this->dz) { + do { + this->entry[iVar4] = init; + iVar4 = iVar4 + 1; + } while (iVar4 < this->dy * this->dx * this->dz); + } + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + THelpDepot *pTVar1; + undefined4 *puVar2; + int iVar3; + int local_20; + THouse *local_1c; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + HouseArea.initialized = false; + HouseArea.max = 99; + HouseArea.min = 0; + HouseArea.start = 0; + HouseArea.space = 100; + HouseArea.block = 0x32; + HouseArea.entry = (THouseArea *)operator_new__(0x4b0); + __cxa_atexit(__tcf_0,0,&__dso_handle); + vector<>::vector(&House.init.Subowner,0,4,5); + // try { // try from 08060b2c to 08060b30 has its CatchHandler @ 08060c98 + vector<>::vector(&House.init.Guest,0,9,10); + House.initialized = false; + House.min = 0; + House.max = 99; + House.space = 100; + House.start = 0; + House.block = 100; + // try { // try from 08060b78 to 08060b7c has its CatchHandler @ 08060d52 + puVar2 = (undefined4 *)operator_new__(0x141e4); + *puVar2 = 100; + local_20 = 99; + local_1c = (THouse *)(puVar2 + 1); + do { + // try { // try from 08060bb7 to 08060bbb has its CatchHandler @ 08060d4a + vector<>::vector(&local_1c->Subowner,0,4,5); + // try { // try from 08060bdf to 08060be3 has its CatchHandler @ 08060cb7 + vector<>::vector(&local_1c->Guest,0,9,10); + local_20 = local_20 + -1; + local_1c = local_1c + 1; + } while (local_20 != -1); + House.entry = (THouse *)(puVar2 + 1); + __cxa_atexit(__tcf_1,0,&__dso_handle); + } + if (__initialize_p == 1) { + HelpDepot.initialized = false; + HelpDepot.start = 1; + HelpDepot.init.Box.ObjectID = 0; + HelpDepot.max = 10; + HelpDepot.min = 1; + HelpDepot.space = 10; + HelpDepot.block = 10; + HelpDepot.entry = (THelpDepot *)operator_new__(0x78); + iVar3 = 9; + pTVar1 = HelpDepot.entry; + do { + (pTVar1->Box).ObjectID = 0; + iVar3 = iVar3 + -1; + pTVar1 = pTVar1 + 1; + } while (iVar3 != -1); + __cxa_atexit(__tcf_2,0,&__dso_handle); + } + } + return; +} + + + +THouseArea * GetHouseArea(ushort ID) + +{ + THouseArea *pTVar1; + int i; + int i_00; + + i_00 = 0; + if (0 < HouseAreas) { + do { + pTVar1 = vector::operator()(&HouseArea,i_00); + if (pTVar1->ID == ID) { + pTVar1 = vector::operator()(&HouseArea,i_00); + return pTVar1; + } + i_00 = i_00 + 1; + } while (i_00 < HouseAreas); + } + error("GetHouseArea: Gebiet mit ID %d nicht gefunden.\n",(uint)ID); + return (THouseArea *)0x0; +} + + + +int CheckAccessRight(char *Rule,TPlayer *pl) + +{ + char cVar1; + bool bVar2; + char *pcVar3; + bool local_ec; + bool PositiveRule; + char local_dc [4]; + char Pattern [200]; + + if (Rule == (char *)0x0) { + pcVar3 = "CheckAccessRight: Regel ist NULL.\n"; + } + else { + if (pl != (TPlayer *)0x0) { + cVar1 = *Rule; + if (cVar1 == '!') { + Rule = Rule + 1; + } + local_ec = cVar1 != '!'; + pcVar3 = strchr(Rule,0x40); + if (pcVar3 == (char *)0x0) { + pcVar3 = (pl->super_TCreature).Name; + } + else { + if (pl->Guild[0] == '\0') { + return 0; + } + if (pl->Rank[0] == '\0') { + snprintf(local_dc,200,"@%s",pl->Guild); + } + else { + snprintf(local_dc,200,"%s@%s",pl->Rank,pl->Guild); + } + pcVar3 = local_dc; + } + bVar2 = MatchString(Rule,pcVar3); + if (!bVar2) { + return 0; + } + return (uint)local_ec * 2 + -1; + } + pcVar3 = "CheckAccessRight: pl ist NULL.\n"; + } + error(pcVar3); + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: low + +THouse * GetHouse(ushort ID) + +{ + THouse *pTVar1; + int iVar2; + int test; + int i; + int high; + int iVar3; + int local_14; + int low; + + local_14 = 0; + iVar3 = Houses + -1; + if (-1 < iVar3) { + do { + i = (local_14 + iVar3) / 2; + pTVar1 = vector::operator()(&House,i); + if (pTVar1->ID == ID) { + pTVar1 = vector::operator()(&House,i); + return pTVar1; + } + pTVar1 = vector::operator()(&House,i); + iVar2 = i + 1; + if (ID <= pTVar1->ID) { + iVar2 = local_14; + } + pTVar1 = vector::operator()(&House,i); + if (ID < pTVar1->ID) { + iVar3 = i + -1; + } + local_14 = iVar2; + } while (iVar2 <= iVar3); + } + error("GetHouse: Haus mit ID %d nicht gefunden.\n",(uint)ID); + return (THouse *)0x0; +} + + + +bool IsOwner(ushort HouseID,TPlayer *pl) + +{ + THouse *pTVar1; + THouse *house; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else { + if (pl != (TPlayer *)0x0) { + return pTVar1->OwnerID == (pl->super_TCreature).ID; + } + error("IsOwner: pl ist NULL.\n"); + } + return false; +} + + + +bool IsSubowner(ushort HouseID,TPlayer *pl,int TimeStamp) + +{ + THouse *pTVar1; + THouseGuest *Rule; + int iVar2; + THouse *house; + int i; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("IsSubowner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else if (pl == (TPlayer *)0x0) { + error("IsSubowner: pl ist NULL.\n"); + } + else if ((pTVar1->LastTransition <= TimeStamp) && (i = 0, 0 < pTVar1->Subowners)) { + do { + Rule = vector<>::operator()(&pTVar1->Subowner,i); + iVar2 = CheckAccessRight(Rule->Name,pl); + if (iVar2 == -1) { + return false; + } + if (iVar2 == 1) { + return true; + } + i = i + 1; + } while (i < pTVar1->Subowners); + } + return false; +} + + + +bool IsGuest(ushort HouseID,TPlayer *pl,int TimeStamp) + +{ + THouse *pTVar1; + THouseGuest *Rule; + int iVar2; + THouse *house; + int i; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("IsGuest: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else if (pl == (TPlayer *)0x0) { + error("IsGuest: pl ist NULL.\n"); + } + else if ((pTVar1->LastTransition <= TimeStamp) && (i = 0, 0 < pTVar1->Guests)) { + do { + Rule = vector<>::operator()(&pTVar1->Guest,i); + iVar2 = CheckAccessRight(Rule->Name,pl); + if (iVar2 == -1) { + return false; + } + if (iVar2 == 1) { + return true; + } + i = i + 1; + } while (i < pTVar1->Guests); + } + return false; +} + + + +bool IsInvited(ushort HouseID,TPlayer *pl,int TimeStamp) + +{ + bool bVar1; + THouse *pTVar2; + THouse *house; + bool bVar3; + + if (pl == (TPlayer *)0x0) { + error("IsInvited: pl ist NULL.\n"); + bVar1 = false; + } + else { + bVar1 = false; + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + bVar3 = false; + } + else { + bVar3 = pTVar2->OwnerID == (pl->super_TCreature).ID; + } + if (((bVar3) || (bVar3 = IsSubowner(HouseID,pl,TimeStamp), bVar3)) || + (bVar3 = IsGuest(HouseID,pl,TimeStamp), bVar3)) { + bVar1 = true; + } + } + return bVar1; +} + + + +char * GetHouseName(ushort HouseID) + +{ + THouse *house; + THouse *pTVar1; + char *pcVar2; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("GetHouseName: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + pcVar2 = (char *)0x0; + } + else { + pcVar2 = pTVar1->Name; + } + return pcVar2; +} + + + +char * GetHouseOwner(ushort HouseID) + +{ + THouse *house; + THouse *pTVar1; + char *pcVar2; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("GetHouseOwner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + pcVar2 = (char *)0x0; + } + else { + pcVar2 = pTVar1->OwnerName; + } + return pcVar2; +} + + + +void ShowSubownerList(ushort HouseID,TPlayer *pl,char *Buffer) + +{ + THouse *pTVar1; + THouse *pTVar2; + THouseGuest *__src; + undefined4 *puVar3; + THouse *house_1; + int i; + THouse *house; + bool bVar4; + char *Text; + + // try { // try from 08061299 to 080613e6 has its CatchHandler @ 080613f0 + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("ShowSubownerList: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else { + if (pl == (TPlayer *)0x0) { + Text = "ShowSubownerList: pl ist NULL.\n"; + } + else { + if (Buffer != (char *)0x0) { + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + bVar4 = false; + } + else { + bVar4 = pTVar2->OwnerID == (pl->super_TCreature).ID; + } + if (bVar4) { + print(); + i = 0; + sprintf(Buffer,"# Subowners of %s\n",pTVar1->Name); + if (0 < pTVar1->Subowners) { + do { + __src = vector<>::operator()(&pTVar1->Subowner,i); + i = i + 1; + strcat(Buffer,__src->Name); + strcat(Buffer,"\n"); + } while (i < pTVar1->Subowners); + } + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + goto LAB_0806137f; + } + Text = "ShowSubownerList: Buffer ist NULL.\n"; + } + error(Text); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0806137f: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void ShowGuestList(ushort HouseID,TPlayer *pl,char *Buffer) + +{ + THouse *pTVar1; + THouse *pTVar2; + THouseGuest *__src; + undefined4 *puVar3; + THouse *house_1; + int i; + THouse *house; + bool bVar4; + char *Text; + + // try { // try from 08061429 to 080615b2 has its CatchHandler @ 080615b5 + pTVar1 = GetHouse(HouseID); + if (pTVar1 == (THouse *)0x0) { + error("ShowGuestList: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else { + if (pl == (TPlayer *)0x0) { + Text = "ShowGuestList: pl ist NULL.\n"; + } + else { + if (Buffer != (char *)0x0) { + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + bVar4 = false; + } + else { + bVar4 = pTVar2->OwnerID == (pl->super_TCreature).ID; + } + if (((bVar4) || (bVar4 = IsSubowner(HouseID,pl,0x7fffffff), bVar4)) && + (bVar4 = CheckRight((pl->super_TCreature).ID,PREMIUM_ACCOUNT), bVar4)) { + print(); + i = 0; + sprintf(Buffer,"# Guests of %s\n",pTVar1->Name); + if (0 < pTVar1->Guests) { + do { + __src = vector<>::operator()(&pTVar1->Guest,i); + i = i + 1; + strcat(Buffer,__src->Name); + strcat(Buffer,"\n"); + } while (i < pTVar1->Guests); + } + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + goto LAB_0806152d; + } + Text = "ShowGuestList: Buffer ist NULL.\n"; + } + error(Text); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0806152d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: house + +void ChangeSubowners(ushort HouseID,TPlayer *pl,char *Buffer) + +{ + char cVar1; + int l; + THouse *pTVar2; + THouse *pTVar3; + size_t sVar4; + char *pcVar5; + int iVar6; + THouseGuest *__dest; + undefined4 *puVar7; + THouse *house_1; + uint uVar8; + bool bVar9; + THouse *house; + + uVar8 = (uint)HouseID; + // try { // try from 080615ec to 08061790 has its CatchHandler @ 08061793 + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("ChangeSubowners: Haus mit ID %d existiert nicht.\n",uVar8); + } + else { + if (pl == (TPlayer *)0x0) { + pcVar5 = "ChangeSubowners: pl ist NULL.\n"; + } + else { + if (Buffer != (char *)0x0) { + pTVar3 = GetHouse(HouseID); + if (pTVar3 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",uVar8); + bVar9 = false; + } + else { + bVar9 = pTVar3->OwnerID == (pl->super_TCreature).ID; + } + if (bVar9) { + Log("houses",&DAT_080f3120,(pl->super_TCreature).Name,uVar8); + sVar4 = strlen(Buffer); + Buffer[sVar4] = '\n'; + Buffer[sVar4 + 1] = '\0'; + pTVar2->Subowners = 0; + cVar1 = *Buffer; + do { + if (cVar1 == '\0') { +LAB_080616f4: + KickGuests(HouseID); + return; + } + pcVar5 = strchr(Buffer,10); + if (pcVar5 == (char *)0x0) { + error("ChangeSubowners: Kein Newline am Textende.\n"); + goto LAB_080616f4; + } + if ((*Buffer != '#') && (Buffer != pcVar5)) { + iVar6 = (int)pcVar5 - (int)Buffer; + if (0x3b < iVar6) { + iVar6 = 0x3b; + } + Buffer[iVar6] = '\0'; + __dest = vector<>::operator()(&pTVar2->Subowner,pTVar2->Subowners); + strcpy(__dest->Name,Buffer); + iVar6 = pTVar2->Subowners + 1; + pTVar2->Subowners = iVar6; + if (9 < iVar6) goto LAB_080616f4; + } + cVar1 = pcVar5[1]; + Buffer = pcVar5 + 1; + } while( true ); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 1; + goto LAB_08061729; + } + pcVar5 = "ChangeSubowners: Buffer ist NULL.\n"; + } + error(pcVar5); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; +LAB_08061729: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: house + +void ChangeGuests(ushort HouseID,TPlayer *pl,char *Buffer) + +{ + char cVar1; + int l; + THouse *pTVar2; + THouse *pTVar3; + size_t sVar4; + char *pcVar5; + int iVar6; + THouseGuest *__dest; + undefined4 *puVar7; + THouse *house_1; + uint uVar8; + bool bVar9; + THouse *house; + + uVar8 = (uint)HouseID; + // try { // try from 080617cc to 080619af has its CatchHandler @ 080619b2 + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("ChangeGuests: Haus mit ID %d existiert nicht.\n",uVar8); + } + else { + if (pl == (TPlayer *)0x0) { + pcVar5 = "ChangeGuests: pl ist NULL.\n"; + } + else { + if (Buffer != (char *)0x0) { + pTVar3 = GetHouse(HouseID); + if (pTVar3 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",uVar8); + bVar9 = false; + } + else { + bVar9 = pTVar3->OwnerID == (pl->super_TCreature).ID; + } + if (((bVar9) || (bVar9 = IsSubowner(HouseID,pl,0x7fffffff), bVar9)) && + (bVar9 = CheckRight((pl->super_TCreature).ID,PREMIUM_ACCOUNT), bVar9)) { + Log("houses",&DAT_080f3240,(pl->super_TCreature).Name,uVar8); + sVar4 = strlen(Buffer); + Buffer[sVar4] = '\n'; + Buffer[sVar4 + 1] = '\0'; + pTVar2->Guests = 0; + cVar1 = *Buffer; + do { + if (cVar1 == '\0') { +LAB_080618f2: + KickGuests(HouseID); + return; + } + pcVar5 = strchr(Buffer,10); + if (pcVar5 == (char *)0x0) { + error("ChangeGuests: Kein Newline am Textende.\n"); + goto LAB_080618f2; + } + if ((*Buffer != '#') && (Buffer != pcVar5)) { + iVar6 = (int)pcVar5 - (int)Buffer; + if (0x3b < iVar6) { + iVar6 = 0x3b; + } + Buffer[iVar6] = '\0'; + __dest = vector<>::operator()(&pTVar2->Guest,pTVar2->Guests); + strcpy(__dest->Name,Buffer); + iVar6 = pTVar2->Guests + 1; + pTVar2->Guests = iVar6; + if (99 < iVar6) goto LAB_080618f2; + } + cVar1 = pcVar5[1]; + Buffer = pcVar5 + 1; + } while( true ); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 1; + goto LAB_08061927; + } + pcVar5 = "ChangeGuests: Buffer ist NULL.\n"; + } + error(pcVar5); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; +LAB_08061927: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: z_local + +void GetExitPosition(ushort HouseID,int *x,int *y,int *z) + +{ + THouse *pTVar1; + THouse *house; + int *z_local; + + pTVar1 = GetHouse(HouseID); + if (pTVar1 != (THouse *)0x0) { + *x = pTVar1->ExitX; + *y = pTVar1->ExitY; + *z = pTVar1->ExitZ; + return; + } + error("GetExitPosition: Haus mit ID %d existiert nicht.\n"); + return; +} + + + +void KickGuest(ushort HouseID,TPlayer *Guest) + +{ + ulong uVar1; + bool bVar2; + bool bVar3; + RESULT r; + THouse *pTVar4; + ulong uVar5; + undefined4 *puVar6; + THouse *house; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Bed; + Object Obj; + + // try { // try from 08061a5c to 08061bbc has its CatchHandler @ 08061cc7 + pTVar4 = GetHouse(HouseID); + if (pTVar4 == (THouse *)0x0) { + error("KickGuest(houses 1): Haus mit ID %d existiert nicht.\n",(uint)HouseID); + } + else { + if (Guest != (TPlayer *)0x0) { + uVar1 = (Guest->super_TCreature).CrObject.ObjectID; + local_3c.ObjectID = uVar1; + GraphicalEffect(&local_3c,3); + GetFirstObject(); + while( true ) { + bVar2 = false; + local_4c[0].ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) { + Object::getObjectType(local_5c); + bVar3 = ObjectType::getFlag((ObjectType *)local_5c,BED); + if (!bVar3) { + bVar2 = true; + } + } + if (!bVar2) break; + Object::getNextObject(local_4c); + local_3c.ObjectID = local_4c[0].ObjectID; + } + bVar2 = false; + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) { + // try { // try from 08061bf0 to 08061c81 has its CatchHandler @ 08061cc7 + uVar5 = Object::getAttribute(&local_3c,TEXTSTRING); + if (uVar5 != 0) { + bVar2 = true; + } + } + if (bVar2) { + print(); + local_4c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + // try { // try from 08061bdb to 08061bdf has its CatchHandler @ 08061c84 + UseObjects(0,local_6c,local_4c); + } + local_6c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_5c,pTVar4->ExitX,pTVar4->ExitY); + local_4c[0].ObjectID = uVar1; + Move(0,local_4c,local_5c,-1,false,local_6c); + local_6c[0].ObjectID = uVar1; + GraphicalEffect(local_6c,0xb); + return; + } + error("KickGuest(houses 1): Guest ist NULL.\n"); + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: SelfKick + +void KickGuest(ushort HouseID,TPlayer *Host,TPlayer *Guest) + +{ + ushort uVar1; + THouse *house; + THouse *pTVar2; + undefined4 *puVar3; + THouse *house_1; + uint uVar4; + bool bVar5; + bool bVar6; + char *Text; + bool SelfKick; + + uVar4 = (uint)HouseID; + // try { // try from 08061cfc to 08061eaa has its CatchHandler @ 08061eb0 + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("KickGuest(houses 2): Haus mit ID %d existiert nicht.\n",uVar4); + } + else { + if (Host == (TPlayer *)0x0) { + Text = "KickGuest(houses 2): Host ist NULL.\n"; + } + else { + if (Guest != (TPlayer *)0x0) { + bVar5 = Host == Guest; + uVar1 = GetHouseID((Guest->super_TCreature).posx,(Guest->super_TCreature).posy, + (Guest->super_TCreature).posz); + if (uVar1 == HouseID) { + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",uVar4); + bVar6 = false; + } + else { + bVar6 = pTVar2->OwnerID == (Host->super_TCreature).ID; + } + if ((((bVar6) || (bVar6 = IsSubowner(HouseID,Host,0x7fffffff), bVar6)) || + (bVar5)) && + ((bVar6 = CheckRight((Guest->super_TCreature).ID,ENTER_HOUSES), !bVar6 || + (bVar5)))) { + pTVar2 = GetHouse(HouseID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",uVar4); +LAB_08061e13: + bVar6 = false; + } + else { + if (Guest == (TPlayer *)0x0) { + error("IsOwner: pl ist NULL.\n"); + goto LAB_08061e13; + } + bVar6 = pTVar2->OwnerID == (Guest->super_TCreature).ID; + } + if ((!bVar6) || (bVar5)) { + KickGuest(HouseID,Guest); + return; + } + } + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + goto LAB_08061def; + } + Text = "KickGuest(houses 2): Guest ist NULL.\n"; + } + error(Text); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08061def: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void KickGuests(ushort HouseID) + +{ + bool bVar1; + ushort uVar2; + THouse *pTVar3; + ulong CharacterID; + TPlayer *pl; + undefined4 *puVar4; + THouse *house; + ulong ID; + TPlayer *Guest; + undefined1 local_4c [4]; + TFindCreatures Search; + + // try { // try from 08061ee6 to 08061ff6 has its CatchHandler @ 08061ff7 + pTVar3 = GetHouse(HouseID); + if (pTVar3 != (THouse *)0x0) { + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_4c,MaxHouseX,MaxHouseY,pTVar3->CenterX,pTVar3->CenterY,1) + ; + while( true ) { + CharacterID = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (CharacterID == 0) break; + pl = GetPlayer(CharacterID); + uVar2 = GetHouseID((pl->super_TCreature).posx,(pl->super_TCreature).posy, + (pl->super_TCreature).posz); + if (uVar2 == HouseID) { + bVar1 = IsInvited(HouseID,pl,0x7fffffff); + if (!bVar1) { + bVar1 = CheckRight(CharacterID,ENTER_HOUSES); + if (!bVar1) { + KickGuest(HouseID,pl); + } + } + } + } + return; + } + error("KickGuests: Haus mit ID %d existiert nicht.\n",(uint)HouseID); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +bool MayOpenDoor(Object *Door,TPlayer *pl) + +{ + char cVar1; + int iVar2; + bool bVar3; + ulong Number; + size_t sVar4; + char *pcVar5; + int iVar6; + char *Text; + undefined4 local_50; + char *pcVar7; + char acStack_44 [20]; + undefined1 *local_30; + Object local_2c [7]; + + local_30 = &stack0xffffffb4; + local_50 = 0x806202d; + bVar3 = Object::exists(Door); + if (bVar3) { + if (pl == (TPlayer *)0x0) { + pcVar7 = "MayOpenDoor: pl ist NULL.\n"; + } + else { + local_50 = 0x806204f; + Object::getObjectType(local_2c); + local_50 = 0x8062062; + bVar3 = ObjectType::getFlag((ObjectType *)local_2c,NAMEDOOR); + if (bVar3) { + local_50 = 0x8062072; + Object::getObjectType(local_2c); + local_50 = 0x8062085; + bVar3 = ObjectType::getFlag((ObjectType *)local_2c,TEXT); + if (bVar3) { + local_50 = 0x80620b4; + Number = Object::getAttribute(Door,TEXTSTRING); + local_50 = 0x80620bc; + pcVar7 = GetDynamicString(Number); + if (pcVar7 == (char *)0x0) { + return false; + } + local_50 = 0x80620cc; + sVar4 = strlen(pcVar7); + iVar2 = -(sVar4 + 0x11 & 0xfffffff0); + *(char **)((int)local_2c + iVar2 + -0x1c) = pcVar7; + pcVar7 = acStack_44 + iVar2; + *(char **)((int)local_2c + iVar2 + -0x20) = pcVar7; + *(undefined4 *)((int)&local_50 + iVar2) = 0x80620e6; + strcpy(*(char **)((int)local_2c + iVar2 + -0x20), + *(char **)((int)local_2c + iVar2 + -0x1c)); + acStack_44[sVar4 + iVar2] = '\n'; + acStack_44[sVar4 + iVar2 + 1] = '\0'; + cVar1 = acStack_44[iVar2]; + do { + if (cVar1 == '\0') { + return false; + } + *(undefined4 *)((int)local_2c + iVar2 + -0x1c) = 10; + *(char **)((int)local_2c + iVar2 + -0x20) = pcVar7; + *(undefined4 *)((int)&local_50 + iVar2) = 0x8062110; + pcVar5 = strchr(*(char **)((int)local_2c + iVar2 + -0x20), + *(int *)((int)local_2c + iVar2 + -0x1c)); + if (pcVar5 == (char *)0x0) { + *(char **)((int)local_2c + iVar2 + -0x20) = + "MayOpenDoor: Kein Newline am Textende.\n"; + *(undefined4 *)((int)&local_50 + iVar2) = 0x806215d; + error(*(char **)((int)local_2c + iVar2 + -0x20)); + return false; + } + if ((*pcVar7 != '#') && (pcVar7 != pcVar5)) { + *pcVar5 = '\0'; + *(char **)((int)local_2c + iVar2 + -0x20) = pcVar7; + *(TPlayer **)((int)local_2c + iVar2 + -0x1c) = pl; + *(undefined4 *)((int)&local_50 + iVar2) = 0x8062131; + iVar6 = CheckAccessRight(*(char **)((int)local_2c + iVar2 + -0x20), + *(TPlayer **)((int)local_2c + iVar2 + -0x1c)); + if (iVar6 == -1) { + return false; + } + if (iVar6 == 1) { + return true; + } + } + cVar1 = pcVar5[1]; + pcVar7 = pcVar5 + 1; + } while( true ); + } + } + pcVar7 = &DAT_080f3580; + } + } + else { + pcVar7 = &DAT_080f3600; + } + local_50 = 0x8062095; + error(pcVar7); + return false; +} + + + +void ShowNameDoor(Object *Door,TPlayer *pl,char *Buffer) + +{ + bool bVar1; + ushort ID; + char *Text; + THouse *pTVar2; + ulong Number; + char *pcVar3; + undefined4 *puVar4; + THouse *house; + ushort HouseID; + uint uVar5; + char *pcVar6; + int local_38; + int x; + int y; + int z; + + // try { // try from 08062198 to 080623b3 has its CatchHandler @ 080623d0 + bVar1 = Object::exists(Door); + if (bVar1) { + if (pl == (TPlayer *)0x0) { + pcVar3 = "ShowNameDoor: pl ist NULL.\n"; + goto LAB_080623af; + } + if (Buffer == (char *)0x0) { + pcVar3 = "ShowNameDoor: Buffer ist NULL.\n"; + goto LAB_080623af; + } + z = Door->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + ID = GetHouseID(local_38,x,y); + uVar5 = (uint)ID; + if (ID == 0) { + pcVar3 = &DAT_080f36e0; + } + else { + pTVar2 = GetHouse(ID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",uVar5); + bVar1 = false; + } + else { + bVar1 = pTVar2->OwnerID == (pl->super_TCreature).ID; + } + if (!bVar1) { + pcVar3 = (pl->super_TCreature).Name; + pcVar6 = "Spieler %s ist nicht Mieter des Hauses %d.\n"; + print(); + puVar4 = (undefined4 *)__cxa_allocate_exception(4,pcVar6,pcVar3,uVar5); + *puVar4 = 1; + goto LAB_0806231d; + } + print(); + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,TEXT); + if (bVar1) { + Number = Object::getAttribute(Door,TEXTSTRING); + pcVar3 = GetDynamicString(Number); + if (pcVar3 == (char *)0x0) { + Buffer[0] = '#'; + Buffer[1] = ' '; + Buffer[2] = 'P'; + Buffer[3] = 'l'; + Buffer[4] = 'a'; + Buffer[5] = 'y'; + Buffer[6] = 'e'; + Buffer[7] = 'r'; + Buffer[8] = 's'; + Buffer[9] = ' '; + Buffer[10] = 'a'; + Buffer[0xb] = 'l'; + Buffer[0xc] = 'l'; + Buffer[0xd] = 'o'; + Buffer[0xe] = 'w'; + Buffer[0xf] = 'e'; + Buffer[0x10] = 'd'; + Buffer[0x11] = ' '; + Buffer[0x12] = 't'; + Buffer[0x13] = 'o'; + Buffer[0x14] = ' '; + Buffer[0x15] = 'o'; + Buffer[0x16] = 'p'; + Buffer[0x17] = 'e'; + Buffer[0x18] = 'n'; + Buffer[0x19] = ' '; + Buffer[0x1a] = 't'; + Buffer[0x1b] = 'h'; + Buffer[0x1c] = 'i'; + Buffer[0x1d] = 's'; + Buffer[0x1e] = ' '; + Buffer[0x1f] = 'd'; + *(uchar **)(Buffer + 0x20) = CommunicationThreadStacks + 0xa750f; + Buffer[0x24] = '\0'; + } + else { + strcpy(Buffer,pcVar3); + } + return; + } + pcVar3 = &DAT_080f3640; + } + error(pcVar3,local_38,x,y); + } + else { + pcVar3 = &DAT_080f3760; +LAB_080623af: + error(pcVar3); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0806231d: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void ChangeNameDoor(Object *Door,TPlayer *pl,char *Buffer) + +{ + bool bVar1; + ushort ID; + THouse *pTVar2; + ulong uVar3; + undefined4 *puVar4; + THouse *house; + ushort HouseID; + char *pcVar5; + int local_38; + int x; + int y; + int z; + + // try { // try from 08062408 to 080625ed has its CatchHandler @ 08062605 + bVar1 = Object::exists(Door); + if (bVar1) { + if (pl == (TPlayer *)0x0) { + pcVar5 = "ChangeNameDoor: pl ist NULL.\n"; + goto LAB_080625e9; + } + if (Buffer == (char *)0x0) { + pcVar5 = "ChangeNameDoor: Buffer ist NULL.\n"; + goto LAB_080625e9; + } + z = Door->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + ID = GetHouseID(local_38,x,y); + if (ID == 0) { + pcVar5 = &DAT_080f3840; + } + else { + pTVar2 = GetHouse(ID); + if (pTVar2 == (THouse *)0x0) { + error("IsOwner: Haus mit ID %d existiert nicht.\n",(uint)ID); + bVar1 = false; + } + else { + bVar1 = pTVar2->OwnerID == (pl->super_TCreature).ID; + } + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + goto LAB_08062581; + } + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,TEXT); + if (bVar1) { + Log("houses",&DAT_080f37a0,(pl->super_TCreature).Name,(uint)ID,local_38,x,y); + uVar3 = Object::getAttribute(Door,TEXTSTRING); + DeleteDynamicString(uVar3); + z = Door->ObjectID; + uVar3 = AddDynamicString(Buffer); + Change((Object *)&z,TEXTSTRING,uVar3); + return; + } + pcVar5 = &DAT_080f37e0; + } + error(pcVar5,local_38,x,y); + } + else { + pcVar5 = &DAT_080f38e0; +LAB_080625e9: + error(pcVar5); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08062581: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +int DeleteCoins(Object *Con,ObjectType *Type,int Amount) + +{ + bool bVar1; + ulong uVar2; + Object local_5c [4]; + Object local_4c [4]; + ObjectType local_3c [4]; + Object local_2c; + Object Obj; + + do { + if (Amount == 0) { + return 0; + } + local_3c[0].TypeID = Con->ObjectID; + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID == NONE.ObjectID) { + return Amount; + } + while( true ) { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + Object::getObjectType(local_4c); + ObjectType::setTypeID(local_3c,Type->TypeID); + if (local_4c[0].ObjectID == local_3c[0].TypeID) break; + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,CONTAINER); + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_5c,Type->TypeID); + local_4c[0].ObjectID = local_2c.ObjectID; + Amount = DeleteCoins(local_4c,(ObjectType *)local_5c,Amount); + if (Amount == 0) { + return 0; + } + } + Object::getNextObject(local_4c); + local_5c[0].ObjectID = local_4c[0].ObjectID; + local_2c.ObjectID = local_5c[0].ObjectID; + if (local_4c[0].ObjectID == NONE.ObjectID) { + return Amount; + } + } + uVar2 = Object::getAttribute(&local_2c,AMOUNT); + if (Amount < (int)uVar2) { + local_5c[0].ObjectID = local_2c.ObjectID; + uVar2 = Object::getAttribute(&local_2c,AMOUNT); + Change(local_5c,AMOUNT,uVar2 - Amount); + return 0; + } + uVar2 = Object::getAttribute(&local_2c,AMOUNT); + Amount = Amount - uVar2; + local_5c[0].ObjectID = local_2c.ObjectID; + DeleteObject(local_5c); + } while( true ); +} + + + +void DeleteMoney(Object *Con,int Amount) + +{ + int local_58; + int Gold; + int Platinum; + int Crystal; + Object local_3c [4]; + ObjectType local_2c [7]; + + GetSpecialObject((SPECIALMEANING)local_2c); + Crystal = Con->ObjectID; + GetFirstContainerObject(local_3c); + Platinum = CountObjects(local_3c,local_2c,0); + GetSpecialObject((SPECIALMEANING)&Crystal); + local_2c[0].TypeID = Con->ObjectID; + GetFirstContainerObject(local_3c); + Gold = CountObjects(local_3c,(ObjectType *)&Crystal,0); + GetSpecialObject((SPECIALMEANING)&Crystal); + local_2c[0].TypeID = Con->ObjectID; + GetFirstContainerObject(local_3c); + local_58 = CountObjects(local_3c,(ObjectType *)&Crystal,0); + CalculateChange(Amount,&local_58,&Gold,&Platinum); + if (0 < local_58) { + GetSpecialObject((SPECIALMEANING)&Crystal); + local_3c[0] = (Object)Con->ObjectID; + DeleteCoins(local_3c,(ObjectType *)&Crystal,local_58); + } + if (local_58 < 0) { + GetSpecialObject((SPECIALMEANING)local_3c); + local_2c[0].TypeID = Con->ObjectID; + SetObject((Object *)&Crystal,local_2c,(ulong)local_3c); + ChangeObject((Object *)&Crystal,AMOUNT,-local_58); + } + if (0 < Gold) { + GetSpecialObject((SPECIALMEANING)&Crystal); + local_3c[0] = (Object)Con->ObjectID; + DeleteCoins(local_3c,(ObjectType *)&Crystal,Gold); + } + if (Gold < 0) { + GetSpecialObject((SPECIALMEANING)local_3c); + local_2c[0].TypeID = Con->ObjectID; + SetObject((Object *)&Crystal,local_2c,(ulong)local_3c); + ChangeObject((Object *)&Crystal,AMOUNT,-Gold); + } + if (0 < Platinum) { + GetSpecialObject((SPECIALMEANING)&Crystal); + local_3c[0] = (Object)Con->ObjectID; + DeleteCoins(local_3c,(ObjectType *)&Crystal,Platinum); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CleanField(void) + +{ + bool bVar1; + ulong uVar2; + ulong *in_stack_00000010; + Object local_6c; + Object Help; + Object local_5c; + Object Content; + Object local_4c; + Object Help_1; + Object local_3c [4]; + Object local_2c; + Object Obj; + + local_2c.ObjectID = NONE.ObjectID; + if (*in_stack_00000010 == NONE.ObjectID) { + error("CleanField: Depot-Box existiert nicht.\n"); + } + else { + GetFirstObject(); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + local_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(&local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_4c,NAMEDOOR); + if (bVar1) { + uVar2 = Object::getAttribute(&local_2c,TEXTSTRING); + DeleteDynamicString(uVar2); + local_4c.ObjectID = local_2c.ObjectID; + Change(&local_4c,TEXTSTRING,0); + uVar2 = Object::getAttribute(&local_2c,EDITOR); + DeleteDynamicString(uVar2); + local_4c.ObjectID = local_2c.ObjectID; + Change(&local_4c,EDITOR,0); + } + Object::getObjectType(&local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_4c,UNMOVE); + if (bVar1) { +LAB_08062ae1: + Object::getObjectType(&local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_5c,CONTAINER); + if (bVar1) { + local_4c.ObjectID = local_2c.ObjectID; + GetFirstContainerObject(&local_5c); + local_4c = (Object)NONE.ObjectID; + local_3c[0].ObjectID = local_4c.ObjectID; + if (local_5c.ObjectID != NONE.ObjectID) { + do { + local_4c.ObjectID = local_5c.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getNextObject(&local_6c); + local_5c.ObjectID = local_6c.ObjectID; + local_6c.ObjectID = *in_stack_00000010; + local_3c[0].ObjectID = local_4c.ObjectID; + MoveObject(local_3c,&local_6c); + local_4c = (Object)NONE.ObjectID; + local_3c[0].ObjectID = local_4c.ObjectID; + } while (local_5c.ObjectID != NONE.ObjectID); + } + } + Object::getObjectType(&local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_6c,UNMOVE); + if (bVar1) { + Object::getNextObject(&local_5c); + local_6c.ObjectID = local_5c.ObjectID; + local_2c.ObjectID = local_6c.ObjectID; + } + else { + local_6c.ObjectID = local_2c.ObjectID; + Object::getNextObject(&local_4c); + local_2c.ObjectID = local_4c.ObjectID; + local_5c.ObjectID = local_6c.ObjectID; + DeleteObject(&local_5c); + } + } + else { + Object::getObjectType(&local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_4c,TAKE); + if (!bVar1) goto LAB_08062ae1; + local_4c.ObjectID = local_2c.ObjectID; + Object::getNextObject(&local_5c); + local_2c.ObjectID = local_5c.ObjectID; + local_5c.ObjectID = *in_stack_00000010; + local_3c[0].ObjectID = local_4c.ObjectID; + MoveObject(local_3c,&local_5c); + } + } while (local_2c.ObjectID != NONE.ObjectID); + } + } + return; +} + + + +void CleanHouse(THouse *house,TPlayerData *PlayerData) + +{ + int x_00; + bool bVar1; + ushort uVar2; + int iVar3; + int iVar4; + int y_1; + int y_00; + int x_1; + int x_01; + bool bVar5; + char *Text; + int local_70; + int local_68; + int local_60; + int z_1; + int iStack_58; + bool PlayerDataAssigned; + int x; + int y; + int z; + undefined1 local_3c [16]; + Object local_2c; + Object Box; + + if (house == (THouse *)0x0) { + Text = "CleanHouse: house ist NULL.\n"; + } + else { + if (house->OwnerID == 0) { + error("CleanHouse: Haus %d hat keinen Besitzer.\n",(uint)house->ID); + return; + } + bVar5 = PlayerData != (TPlayerData *)0x0; + if ((bVar5) || + (PlayerData = AssignPlayerPoolSlot(house->OwnerID,false), + PlayerData != (TPlayerData *)0x0)) { + GetStartPosition(&stack0xffffffa8,&x,&y,true); + GetSpecialObject((SPECIALMEANING)local_3c); + GetMapContainer((int)&z,iStack_58,x); + SetObject(&local_2c,(ObjectType *)&z,(ulong)local_3c); + z = local_2c.ObjectID; + LoadDepot(PlayerData,house->DepotNr,(Object *)&z); + local_60 = 0; + local_68 = house->CenterX; + local_70 = MaxHouseX; + do { + x_01 = (local_68 - local_70) + -1; + if (x_01 <= local_68 + local_70) { + iVar3 = house->CenterY; + iVar4 = MaxHouseY; + do { + y_00 = (iVar3 - iVar4) + -1; + x_00 = x_01 + 1; + if (y_00 <= iVar4 + iVar3) { + do { + uVar2 = GetHouseID(x_01,y_00,local_60); + if (uVar2 == house->ID) { +LAB_08062f90: + z = local_2c.ObjectID; + CleanField(); + } + else { + bVar1 = CoordinateFlag(); + if (bVar1) { + iVar3 = y_00 + 1; + uVar2 = GetHouseID(x_01 + -1,iVar3,local_60); + if (((uVar2 == house->ID) || + (uVar2 = GetHouseID(x_01,iVar3,local_60), + uVar2 == house->ID)) || + (uVar2 = GetHouseID(x_00,iVar3,local_60), + uVar2 == house->ID)) goto LAB_08062f90; + } + bVar1 = CoordinateFlag(); + if ((bVar1) && + (((uVar2 = GetHouseID(x_00,y_00 + -1,local_60), + uVar2 == house->ID || + (uVar2 = GetHouseID(x_00,y_00,local_60), uVar2 == house->ID + )) || (uVar2 = GetHouseID(x_00,y_00 + 1,local_60), + uVar2 == house->ID)))) goto LAB_08062f90; + } + y_00 = y_00 + 1; + iVar3 = house->CenterY; + } while (y_00 <= MaxHouseY + iVar3); + local_68 = house->CenterX; + local_70 = MaxHouseX; + iVar4 = MaxHouseY; + } + x_01 = x_00; + } while (x_00 <= local_68 + local_70); + } + local_60 = local_60 + 1; + if (0xf < local_60) { + z = local_2c.ObjectID; + SaveDepot(PlayerData,house->DepotNr,(Object *)&z); + z = local_2c.ObjectID; + DeleteObject((Object *)&z); + if (bVar5) { + return; + } + ReleasePlayerPoolSlot(PlayerData); + return; + } + } while( true ); + } + Text = &DAT_080f3960; + } + error(Text); + return; +} + + + +void ClearHouse(THouse *house) + +{ + house->OwnerID = 0; + house->OwnerName[0] = '\0'; + house->Subowners = 0; + house->Guests = 0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void FinishAuctions(void) + +{ + ushort uVar1; + int iVar2; + int_0_ *piVar3; + TPlayerData *pTVar4; + time_t tVar5; + ulong_0_ *puVar6; + int iVar7; + THouse *pTVar8; + int iVar9; + ulong uVar10; + uint uVar11; + int iVar12; + char_0__30_ *CharacterNames; + undefined4 local_310; + int aiStack_2fc [2]; + int_0_ aiStack_2f4 [8]; + int_0_ *local_2ec; + TPlayerData *local_2e8; + TPlayerData *PlayerData; + THouse *house; + int i; + time_t TimeStamp; + int_0_ *Bids; + ulong_0_ *CharacterIDs; + ushort_0_ *HouseIDs; + int NumberOfAuctions; + int x; + int y; + int z; + ulong local_2ac [4]; + undefined1 local_29c [4]; + char Welcome [500]; + ulong local_9c [4]; + undefined1 local_8c [4]; + char HelpWorld [60]; + ObjectType local_4c [4]; + ulong local_3c [4]; + Object local_2c; + Object Con; + + // try { // try from 080630d9 to 08063742 has its CatchHandler @ 08063748 + local_310 = 0x80630de; + GetStartPosition(&NumberOfAuctions,&x,&y,true); + local_310 = 0x80630f4; + GetSpecialObject((SPECIALMEANING)local_3c); + local_310 = 0x8063120; + GetMapContainer((int)local_4c,NumberOfAuctions,x); + local_310 = 0x806313e; + SetObject(&local_2c,local_4c,(ulong)local_3c); + local_310 = 0x8063155; + Log("houses","Bearbeite beendete Auktionen...\n"); + HouseIDs = (ushort_0_ *)Houses; + iVar12 = Houses + -1; + iVar2 = -(Houses + 0x10 + iVar12 & 0xfffffff0U); + uVar11 = iVar12 * 4 + 0x13U & 0xfffffff0; + CharacterIDs = aiStack_2f4 + iVar2; + Bids = aiStack_2f4 + -uVar11 + iVar2; + iVar12 = -(iVar12 * 0x1e + 0x2dU & 0xfffffff0); + TimeStamp = (time_t)(aiStack_2f4 + iVar12 + uVar11 * -2 + iVar2); + *(int_0_ **)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2 + 4) = + aiStack_2f4 + iVar12 + uVar11 * -2 + iVar2; + *(int_0_ **)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2) = + aiStack_2f4 + iVar12 + -uVar11 + iVar2; + *(int_0_ **)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2) = Bids; + puVar6 = CharacterIDs; + *(ushort_0_ ***)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = &HouseIDs; + *(ulong_0_ **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = puVar6; + *(TQueryManagerConnection **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + QueryManagerConnection; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80631de; + iVar7 = TQueryManagerConnection::finishAuctions + (*(TQueryManagerConnection **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(ushort **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2), + *(ulong **)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2), + *(char (**) [30])((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2), + *(int **)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2 + 4)); + if (iVar7 == 0) { + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = WorldName; + *(undefined1 **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_8c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063224; + AddSlashes(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + *(undefined4 *)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = 0; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063230; + i = time(*(time_t **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + house = (THouse *)0x0; + if (0 < (int)HouseIDs) { + local_2ec = aiStack_2f4 + iVar12 + -uVar11 + iVar2; + do { + tVar5 = TimeStamp; + pTVar8 = house; + *(undefined4 *)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2) = + *(undefined4 *)(TimeStamp + (int)house * 4); + *(int_0_ **)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2) = local_2ec; + uVar1 = *(ushort *)(CharacterIDs + (int)pTVar8 * 2); + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = "houses"; + *(undefined **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = &DAT_080f3a60; + *(uint *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = (uint)uVar1; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063291; + Log(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + pTVar8 = house; + *(undefined4 *)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2 + 4) = + *(undefined4 *)(tVar5 + (int)house * 4); + *(undefined4 *)((int)aiStack_2fc + iVar12 + uVar11 * -2 + iVar2) = + *(undefined4 *)(Bids + (int)pTVar8 * 4); + uVar1 = *(ushort *)(CharacterIDs + (int)pTVar8 * 2); + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = "houses"; + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + "bei Reset: INSERT INTO HouseAssignments VALUES (\'%s\',%d,%d,%d);\n"; + *(uint *)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2) = (uint)uVar1; + *(undefined1 **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = local_8c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80632d7; + Log(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + pTVar8 = house; + *(uint *)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + (uint)*(ushort *)(CharacterIDs + (int)house * 2); + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80632ef; + PlayerData = (TPlayerData *) + GetHouse(*(ushort *)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + if (PlayerData == (TPlayerData *)0x0) { + uVar1 = *(ushort *)(CharacterIDs + (int)pTVar8 * 2); + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + "FinishAuctions: Haus mit Nummer %d existiert nicht.\n"; + *(uint *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = (uint)uVar1; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063743; + error(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + else if (PlayerData->Cycle[4] == 0) { + *(undefined4 *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = 0; + *(undefined4 *)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + *(undefined4 *)(Bids + (int)house * 4); + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x806344f; + local_2e8 = AssignPlayerPoolSlot + (*(ulong *)(&stack0xfffffcf4 + + iVar12 + uVar11 * -2 + iVar2), + (bool)(&stack0xfffffcf8)[iVar12 + uVar11 * -2 + iVar2]); + if (local_2e8 == (TPlayerData *)0x0) { + *(undefined **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + &DAT_080f3cc0; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063724; + error(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + else { + local_4c[0].TypeID = local_2c.ObjectID; + *(ObjectType **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = local_4c + ; + pTVar4 = PlayerData; + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + PlayerData->MagicDeltaAct[0x15]; + *(TPlayerData **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + local_2e8; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063488; + LoadDepot(*(TPlayerData **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) + ,*(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(Object **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2)); + local_3c[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = local_3c; + *(ObjectType **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_4c + ; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x806349d; + GetFirstContainerObject + (*(Object **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + *(ObjectType **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_4c + ; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80634ab; + iVar7 = CountMoney(*(Object **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + if (iVar7 < pTVar4->MagicDeltaAct[0x14] + + *(int *)(TimeStamp + (int)house * 4)) { + *(undefined **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + &DAT_080f3c80; + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = "houses"; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x80636d0; + Log(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + piVar3 = local_2ec; + PlayerData->Cycle[4] = *(int *)(Bids + (int)house * 4); + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + PlayerData->Cycle + 5; + *(int_0_ **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = piVar3; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063705; + strcpy(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + PlayerData->Cycle[0xe] = 0; + } + else { + *(undefined **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + &DAT_080f3b80; + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = "houses"; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x80634dc; + Log(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + local_9c[0] = local_2c.ObjectID; + iVar7 = PlayerData->MagicDeltaAct[0x14]; + iVar9 = *(int *)(TimeStamp + (int)house * 4); + *(ulong **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_9c; + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + iVar7 + iVar9; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063514; + DeleteMoney(*(Object **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + pTVar4 = PlayerData; + *(char **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = + "Welcome!\n\nCongratulations on your choice\nfor house \"%s\".\nThe rent for the first month\nhas already been debited to your\ndepot. The next rent will be\npayable in thirty days.\nHave a good time in your new home!" + ; + *(undefined1 **)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2) = + (undefined1 *)((int)&pTVar4->CharacterID + 2); + *(undefined4 *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = 500; + *(undefined1 **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + local_29c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x806353f; + snprintf(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(size_t *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2)); + *(undefined1 **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + local_29c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063547; + uVar10 = AddDynamicString(*(char **)(&stack0xfffffcf4 + + iVar12 + uVar11 * -2 + iVar2)); + *(undefined4 *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = 0x1a; + *(ulong **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_2ac + ; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x806355f; + GetSpecialObject(*(SPECIALMEANING *) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + z = local_2c.ObjectID; + *(undefined4 *)(&stack0xfffffd00 + iVar12 + uVar11 * -2 + iVar2) = 0; + *(ulong **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = local_2ac + ; + *(int **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = &z; + *(ulong **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_9c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063595; + SetObject(*(Object **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(ObjectType **) + (&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(ulong *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2)); + *(ulong *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = uVar10; + *(undefined4 *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = 9; + *(ulong **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_9c; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x80635b2; + ChangeObject(*(Object **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(ulong *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) + ); + z = local_2c.ObjectID; + *(int **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = &z; + pTVar4 = PlayerData; + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + PlayerData->MagicDeltaAct[0x15]; + *(TPlayerData **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + local_2e8; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x80635e3; + SaveDepot(*(TPlayerData **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2), + *(Object **)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2)) + ; + pTVar4->Cycle[4] = *(int *)(Bids + (int)house * 4); + *(int_0_ **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + local_2ec; + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + PlayerData->Cycle + 5; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063615; + strcpy(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(char **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + PlayerData->Cycle[0xd] = i; + PlayerData->Cycle[0xe] = i + 0x278d00; + } + while( true ) { + local_2ac[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = local_2ac + ; + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &z; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x806365c; + GetFirstContainerObject + (*(Object **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) + ); + local_9c[0] = NONE.ObjectID; + local_4c[0].TypeID = NONE.ObjectID; + if (z == NONE.ObjectID) break; + local_2ac[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = local_2ac + ; + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &z; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x8063696; + GetFirstContainerObject + (*(Object **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) + ); + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &z; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x80636a7; + DeleteObject(*(Object **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + *(TPlayerData **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + local_2e8; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80636b7; + ReleasePlayerPoolSlot + (*(TPlayerData **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + } + else { + *(int *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = PlayerData->Cycle[4] + ; + uVar1 = *(ushort *)(CharacterIDs + (int)house * 2); + *(undefined **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &DAT_080f3b00 + ; + *(uint *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = (uint)uVar1; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063335; + error(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + house = (THouse *)((int)&house->ID + 1); + local_2ec = local_2ec + 0x1e; + } while ((int)house < (int)HouseIDs); + } + iVar7 = 0; + if (0 < Houses) { + do { + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = iVar7; + *(vector **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &House; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x8063385; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + if (pTVar8->PaidUntil == 0) { + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = iVar7; + *(vector **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &House; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80633b0; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2)); + if (pTVar8->OwnerID != 0) { + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = iVar7; + *(vector **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + &House; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80633ca; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2 + )); + *(undefined4 *)(&stack0xfffffcfc + iVar12 + uVar11 * -2 + iVar2) = 1; + *(ulong *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = + pTVar8->OwnerID; + *(TQueryManagerConnection **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = QueryManagerConnection; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80633e9; + iVar9 = TQueryManagerConnection::excludeFromAuctions + (*(TQueryManagerConnection **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(ulong *)(&stack0xfffffcf8 + + iVar12 + uVar11 * -2 + iVar2), + (bool)(&stack0xfffffcfc)[iVar12 + uVar11 * -2 + iVar2]); + if (iVar9 != 0) { + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + "FinishAuctions: Kann Ersteigerer nicht verbannen.\n"; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = + 0x806342d; + error(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + } + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2) = iVar7; + *(vector **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + &House; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80633fd; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2), + *(int *)(&stack0xfffffcf8 + iVar12 + uVar11 * -2 + iVar2 + )); + pTVar8->OwnerName[0] = '\0'; + pTVar8->OwnerID = 0; + pTVar8->Subowners = 0; + pTVar8->Guests = 0; + } + } + iVar7 = iVar7 + 1; + } while (iVar7 < Houses); + } + z = local_2c.ObjectID; + *(int **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = &z; + } + else { + *(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = + "FinishAuctions: Kann Versteigerungen nicht ermitteln.\n"; + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80631ee; + error(*(char **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + local_4c[0].TypeID = local_2c.ObjectID; + *(ObjectType **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2) = local_4c; + } + *(undefined4 *)((int)&local_310 + iVar12 + uVar11 * -2 + iVar2) = 0x80631ff; + DeleteObject(*(Object **)(&stack0xfffffcf4 + iVar12 + uVar11 * -2 + iVar2)); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CollectRents(void) + +{ + TPlayerData *pTVar1; + ushort uVar2; + undefined4 uVar3; + int_0_ *piVar4; + ulong_0_ *puVar5; + int iVar6; + ulong uVar7; + int iVar8; + THouse *pTVar9; + THouse *pTVar10; + uint uVar11; + char *pcVar12; + int *piVar13; + ObjectType *pOVar14; + char_0__30_ *NewOwnerNames; + int iVar15; + int iVar16; + ushort_0_ **ppuVar17; + int *piVar18; + int NumberOfGuildhouses; + int iVar19; + undefined4 local_350; + uint auStack_33c [3]; + int_0_ aiStack_330 [8]; + int_0_ *local_328; + int *local_324; + ushort *local_320; + char *local_31c; + TPlayerData *local_318; + TPlayerData *PlayerData_1; + time_t Deadline; + ulong_0_ *OwnerIDs; + int Crystal; + TPlayerData *PlayerData; + THouse *house; + int i_1; + time_t TimeStamp; + int_0_ *Prices; + ulong_0_ *NewOwnerIDs; + ushort_0_ *HouseIDs; + int local_2e8; + int NumberOfEvictions; + int local_2e0; + int local_2dc; + int NumberOfTransfers; + int x; + int y; + int z; + ulong local_2bc [4]; + ulong local_2ac [4]; + ulong local_29c [4]; + undefined1 local_28c [4]; + char Warning [500]; + undefined1 local_8c [4]; + char HelpWorld [60]; + ObjectType local_4c [4]; + ulong local_3c [4]; + Object local_2c; + Object Con; + + // try { // try from 08063799 to 08064aff has its CatchHandler @ 08064b16 + local_350 = 0x806379e; + GetStartPosition(&NumberOfTransfers,&x,&y,true); + local_350 = 0x80637b4; + GetSpecialObject((SPECIALMEANING)local_3c); + local_350 = 0x80637e0; + GetMapContainer((int)local_4c,NumberOfTransfers,x); + local_350 = 0x80637fe; + SetObject(&local_2c,local_4c,(ulong)local_3c); + iVar15 = 0; + if (0 < Houses) { + do { + local_350 = 0x8064b00; + pTVar9 = vector::operator()(&House,iVar15); + iVar16 = Houses; + iVar15 = iVar15 + 1; + pTVar9->Help = 0; + } while (iVar15 < iVar16); + } + local_350 = 0x8063823; + Log("houses",&DAT_080f3d40); + local_2dc = Houses; + iVar16 = Houses + -1; + iVar15 = -(Houses + 0x10 + iVar16 & 0xfffffff0U); + uVar11 = iVar16 * 4 + 0x13U & 0xfffffff0; + NewOwnerIDs = aiStack_330 + iVar15; + iVar16 = -(iVar16 * 0x1e + 0x2dU & 0xfffffff0); + piVar18 = (int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c); + Prices = aiStack_330 + -uVar11 + iVar15; + TimeStamp = (time_t)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15); + *(int_0_ **)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15 + 4) = + aiStack_330 + iVar16 + uVar11 * -2 + iVar15; + *(int_0_ **)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15) = + aiStack_330 + iVar16 + -uVar11 + iVar15; + *(int_0_ **)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = Prices; + puVar5 = NewOwnerIDs; + *(int **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = &local_2dc; + *(ulong_0_ **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = puVar5; + *(TQueryManagerConnection **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80638ac; + iVar6 = TQueryManagerConnection::transferHouses + (*(TQueryManagerConnection **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ushort **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15), + *(ulong **)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15), + *(char (**) [30])((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15), + *(int **)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15 + 4)); + if (iVar6 != 0) { + *(undefined **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &DAT_080f3d80; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80638bc; + error(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + pOVar14 = local_4c; + local_4c[0].TypeID = local_2c.ObjectID; + goto LAB_080638c5; + } + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = WorldName; + *(undefined1 **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_8c; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80638f2; + AddSlashes(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = 0; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80638fe; + i_1 = time(*(time_t **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + house = (THouse *)0x0; + if (0 < local_2dc) { + local_328 = aiStack_330 + iVar16 + -uVar11 + iVar15; + local_320 = (ushort *)NewOwnerIDs; + local_324 = (int *)Prices; + do { + *(uint *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = (uint)*local_320; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063949; + PlayerData = (TPlayerData *) + GetHouse(*(ushort *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + if (PlayerData == (TPlayerData *)0x0) { + uVar2 = *local_320; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Haus mit Nummer %d existiert nicht.\n"; + *(uint *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064ae9; + error(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + else if ((*local_324 == 0) || (iVar6 = *(int *)(TimeStamp + (int)house * 4), iVar6 < 1)) + { +LAB_0806489a: + *(int *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = PlayerData->Cycle[4]; + uVar2 = *local_320; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = &DAT_080f4e1a; + *(uint *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80648cb; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + if (*local_324 == 0) { + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(TPlayerData **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + PlayerData; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064a2b; + CleanHouse(*(THouse **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(TPlayerData **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + } + PlayerData->Cycle[4] = 0; + *(undefined1 *)(PlayerData->Cycle + 5) = 0; + PlayerData->MaxCycle[0xc] = 0; + PlayerData->Count[10] = 0; + PlayerData->Count[0xb] = 1; + if (*local_324 != 0) { + *(int *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = *local_324; + uVar2 = *local_320; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f4e32; + *(uint *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x806493c; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + piVar4 = local_328; + PlayerData->Cycle[4] = *local_324; + PlayerData->Cycle[0xd] = i_1; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + PlayerData->Cycle + 5; + *(int_0_ **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = piVar4; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064976; + strcpy(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + if (*local_324 != 0) { + uVar2 = *local_320; + *(undefined1 **)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15 + 4) = + local_8c; + *(uint *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -4) = (uint)uVar2; + *(undefined4 *)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15) = + *(undefined4 *)(TimeStamp + (int)house * 4); + *(int *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = *local_324; + iVar6 = i_1; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + "bei Reset: UPDATE HouseOwners SET Termination=%d,NewOwner=%ld,Accepted=1,Price=%d WHERE World=\'%s\' AND HouseID=%d;\n" + ; + *(int *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = iVar6; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064a10 + ; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + goto LAB_08063bd9; + } + } + uVar2 = *local_320; + *(undefined1 **)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = local_8c; + *(uint *)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + iVar6 = i_1; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + "bei Reset: UPDATE HouseOwners SET Termination=%d,NewOwner=null,Accepted=0,Price=0 WHERE World=\'%s\' AND HouseID=%d;\n" + ; + *(int *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = iVar6; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80649b7; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + } + else { + *(int *)((int)auStack_33c + iVar16 + uVar11 * -2 + iVar15) = iVar6; + *(int *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = *local_324; + uVar2 = *local_320; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = &DAT_080f3dc0; + *(uint *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80639af; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = *local_324; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80639c7; + Crystal = (int)AssignPlayerPoolSlot + (*(ulong *)(aiStack_330 + + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + (bool)(&stack0xfffffcb8)[iVar16 + uVar11 * -2 + iVar15]); + if ((TPlayerData *)Crystal == (TPlayerData *)0x0) { + *(undefined **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &DAT_080f4420; + } + else { + local_4c[0].TypeID = local_2c.ObjectID; + *(ObjectType **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = local_4c; + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + PlayerData->MagicDeltaAct[0x15]; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a00; + LoadDepot(*(TPlayerData **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ,*(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(Object **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + local_3c[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = local_3c; + *(ObjectType **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_4c + ; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a15; + GetFirstContainerObject + (*(Object **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(ObjectType **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_4c + ; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a23; + iVar6 = CountMoney(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + if (iVar6 < *(int *)(TimeStamp + (int)house * 4)) { + *(undefined **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f3e00; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a4c + ; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + pTVar1 = PlayerData; + *(char **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + "Warning!\n\nYou have not enough gold to pay\nthe price for house \"%s\".\nTherefore the transfer is cancelled." + ; + *(undefined1 **)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = + (undefined1 *)((int)&pTVar1->CharacterID + 2); + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 500; + *(undefined1 **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_28c; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a77 + ; + snprintf(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(size_t *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(char **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + *(undefined1 **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_28c; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a7f + ; + uVar7 = AddDynamicString(*(char **)(aiStack_330 + + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 0x1a; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_2ac + ; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063a97 + ; + GetSpecialObject(*(SPECIALMEANING *) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = local_2ac; + *(undefined4 *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = local_2bc; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_29c + ; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063acd + ; + SetObject(*(Object **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ObjectType **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) + ,*(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = uVar7; + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 9; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = local_29c + ; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063aea + ; + ChangeObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = local_2bc; + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + PlayerData->MagicDeltaAct[0x15]; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063b1b + ; + SaveDepot(*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(Object **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + while( true ) { + local_2ac[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2bc; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063b42; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + local_29c[0] = NONE.ObjectID; + z = NONE.ObjectID; + if (local_2bc[0] == NONE.ObjectID) break; + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063b79; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063b84; + DeleteObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063b94 + ; + ReleasePlayerPoolSlot + (*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + uVar2 = *local_320; + *(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined1 **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + local_8c; + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + "bei Reset: UPDATE HouseOwners SET Termination=null,NewOwner=null,Accepted=0,Price=null WHERE World=\'%s\' AND HouseID=%d;\n" + ; + *(uint *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063bbf + ; + Log(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + *(uint *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + (uint)*local_320; + *(TQueryManagerConnection **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8063bd9 + ; + TQueryManagerConnection::cancelHouseTransfer + (*(TQueryManagerConnection **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ushort *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + goto LAB_08063bd9; + } + z = local_2c.ObjectID; + uVar3 = *(undefined4 *)(TimeStamp + (int)house * 4); + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = uVar3; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x806456d; + DeleteMoney(*(Object **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15)); + z = local_2c.ObjectID; + *(int **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = &z; + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + PlayerData->MagicDeltaAct[0x15]; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064598; + SaveDepot(*(TPlayerData **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ,*(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(Object **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + while( true ) { + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80645b9 + ; + GetFirstContainerObject + (*(Object **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ); + local_2ac[0] = NONE.ObjectID; + local_29c[0] = NONE.ObjectID; + if (z == NONE.ObjectID) break; + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x80645f6 + ; + GetFirstContainerObject + (*(Object **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ); + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064607 + ; + DeleteObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064617; + ReleasePlayerPoolSlot + (*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + PlayerData->Cycle[4]; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064633; + Crystal = (int)AssignPlayerPoolSlot + (*(ulong *)(aiStack_330 + + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + (bool)(&stack0xfffffcb8) + [iVar16 + uVar11 * -2 + iVar15]); + if ((TPlayerData *)Crystal != (TPlayerData *)0x0) { + z = local_2c.ObjectID; + *(int **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = &z; + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + PlayerData->MagicDeltaAct[0x15]; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064672 + ; + LoadDepot(*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(Object **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + for (iVar6 = *(int *)(TimeStamp + (int)house * 4); 9999 < iVar6; + iVar6 = iVar6 + (int)OwnerIDs * -10000) { + NumberOfEvictions = 100; + local_2e0 = iVar6 / 10000; + piVar13 = &NumberOfEvictions; + if (iVar6 / 10000 < 0x65) { + piVar13 = &local_2e0; + } + OwnerIDs = (ulong_0_ *)*piVar13; + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 3; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2bc; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x80646e3; + GetSpecialObject(*(SPECIALMEANING *) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)) + ; + local_2ac[0] = local_2c.ObjectID; + *(undefined4 *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ulong **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064719; + SetObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ObjectType **) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + puVar5 = OwnerIDs; + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 2; + *(ulong_0_ **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + puVar5; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x806473c; + ChangeObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15 + )); + } + if (99 < iVar6) { + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 2; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2bc; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064a46; + GetSpecialObject(*(SPECIALMEANING *) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)) + ; + local_2ac[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(undefined4 *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ulong **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064a7c; + SetObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ObjectType **) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 2; + *(int *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = iVar6 / 100 + ; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064aac; + ChangeObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15 + )); + } + if (0 < iVar6 % 100) { + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 1; + *(ulong **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2bc; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064797; + GetSpecialObject(*(SPECIALMEANING *) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)) + ; + local_2ac[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(undefined4 *)(&stack0xfffffcc0 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ulong **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x80647cd; + SetObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ObjectType **) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = iVar6 % 100 + ; + *(undefined4 *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = 2; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x80647ea; + ChangeObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15 + )); + } + z = local_2c.ObjectID; + *(int **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15) = &z; + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + PlayerData->MagicDeltaAct[0x15]; + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x806481b + ; + SaveDepot(*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15), + *(Object **)(&stack0xfffffcbc + iVar16 + uVar11 * -2 + iVar15)); + while( true ) { + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x806483c; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + local_2ac[0] = NONE.ObjectID; + local_29c[0] = NONE.ObjectID; + if (z == NONE.ObjectID) break; + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064879; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(int **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = + 0x806488a; + DeleteObject(*(Object **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + *(int *)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = Crystal; + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x806489a + ; + ReleasePlayerPoolSlot + (*(TPlayerData **) + (aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + goto LAB_0806489a; + } + *(undefined **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &DAT_080f43e0; + } + *(undefined4 *)((int)&local_350 + iVar16 + uVar11 * -2 + iVar15) = 0x8064abd; + error(*(char **)(aiStack_330 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } +LAB_08063bd9: + house = (THouse *)((int)&house->ID + 1); + local_320 = local_320 + 1; + local_324 = local_324 + 1; + local_328 = local_328 + 0x1e; + } while ((int)house < local_2dc); + } + local_2e8 = Houses; + iVar6 = -(Houses * 4 + 0xfU & 0xfffffff0); + piVar18 = (int *)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c); + Deadline = (time_t)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15); + *(int_0_ **)(&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15; + puVar5 = NewOwnerIDs; + *(int **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = &local_2e8; + *(ulong_0_ **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = puVar5; + *(TQueryManagerConnection **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8063c4c; + iVar8 = TQueryManagerConnection::evictFreeAccounts + (*(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ushort **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ulong **)(&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (iVar8 == 0) { + iVar8 = 0; + if (0 < local_2e8) { + do { + *(uint *)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + (uint)*(ushort *)(NewOwnerIDs + iVar8 * 2); + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8064480 + ; + pTVar9 = GetHouse(*(ushort *) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + if (pTVar9 == (THouse *)0x0) { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Haus mit Nummer %d existiert nicht.\n"; + *(uint *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064535; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + else { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + "Account von Haus %d ist nicht mehr bezahlt.\n"; + *(uint *)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80644ac; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (*(ulong *)(Deadline + iVar8 * 4) == pTVar9->OwnerID) { + *(undefined4 *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0; + *(THouse **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + pTVar9; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80644ef; + CleanHouse(*(THouse **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(TPlayerData **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + pTVar9->OwnerName[0] = '\0'; + pTVar9->OwnerID = 0; + pTVar9->Subowners = 0; + pTVar9->Guests = 0; + pTVar9->Help = 1; + } + else { + *(undefined **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f4260; + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80644d1; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + } + } + iVar8 = iVar8 + 1; + } while (iVar8 < local_2e8); + } + local_2e8 = Houses; + *(ulong_0_ **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = NewOwnerIDs; + *(int **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = &local_2e8; + *(TQueryManagerConnection **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8063c8e; + iVar8 = TQueryManagerConnection::evictDeletedCharacters + (*(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ushort **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (iVar8 != 0) { + *(undefined **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &DAT_080f41e0; + goto LAB_08064464; + } + iVar8 = 0; + if (0 < local_2e8) { + do { + *(uint *)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + (uint)*(ushort *)(NewOwnerIDs + iVar8 * 2); + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x80643d1 + ; + pTVar9 = GetHouse(*(ushort *) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + if (pTVar9 == (THouse *)0x0) { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Haus mit Nummer %d existiert nicht.\n"; + *(uint *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x806445b; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + else { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f41a0; + *(uint *)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80643f9; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(THouse **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + pTVar9; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064409; + CleanHouse(*(THouse **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(TPlayerData **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + pTVar9->OwnerName[0] = '\0'; + pTVar9->OwnerID = 0; + pTVar9->Subowners = 0; + pTVar9->Guests = 0; + pTVar9->Help = 1; + } + iVar8 = iVar8 + 1; + } while (iVar8 < local_2e8); + } + iVar19 = 0; + iVar8 = 0; + if (0 < Houses) { + do { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x806434e + ; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (pTVar9->GuildHouse != false) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064376; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (pTVar9->OwnerID != 0) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064390; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(ushort *)(NewOwnerIDs + iVar19 * 2) = pTVar9->ID; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80643ad; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(ulong *)(Deadline + iVar19 * 4) = pTVar9->OwnerID; + iVar19 = iVar19 + 1; + } + } + iVar8 = iVar8 + 1; + } while (iVar8 < Houses); + } + if (0 < iVar19) { + *(time_t *)((int)auStack_33c + iVar6 + iVar16 + uVar11 * -2 + iVar15) = Deadline; + puVar5 = NewOwnerIDs; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar19; + *(int **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = &local_2e8; + *(ulong_0_ **)(&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = puVar5; + *(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8063ce8; + iVar8 = TQueryManagerConnection::evictExGuildleaders + (*(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(int **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ushort **) + (&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ulong **)((int)auStack_33c + iVar6 + iVar16 + uVar11 * -2 + iVar15) + ); + if (iVar8 != 0) { + *(undefined **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &DAT_080f4160; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8064331 + ; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + local_2e8 = 0; + } + iVar8 = 0; + if (0 < local_2e8) { + do { + *(uint *)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + (uint)*(ushort *)(NewOwnerIDs + iVar8 * 2); + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064299; + pTVar9 = GetHouse(*(ushort *) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ); + if (pTVar9 == (THouse *)0x0) { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Haus mit Nummer %d existiert nicht.\n"; + *(uint *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064323; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c + )); + } + else { + uVar2 = *(ushort *)(NewOwnerIDs + iVar8 * 2); + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f40e0; + *(uint *)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80642c1; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0; + *(THouse **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + pTVar9; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80642d1; + CleanHouse(*(THouse **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(TPlayerData **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + pTVar9->OwnerName[0] = '\0'; + pTVar9->OwnerID = 0; + pTVar9->Subowners = 0; + pTVar9->Guests = 0; + pTVar9->Help = 1; + } + iVar8 = iVar8 + 1; + } while (iVar8 < local_2e8); + } + } + iVar8 = 0; + if (0 < Houses) { + do { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8064223 + ; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (pTVar9->Help == 1) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x806424a; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(uint *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)pTVar9->ID; + *(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x806425e; + iVar19 = TQueryManagerConnection::deleteHouseOwner + (*(TQueryManagerConnection **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ushort *) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)) + ; + if (iVar19 != 0) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064272; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + uVar2 = pTVar9->ID; + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Kann Haus %d nicht aus HouseOwners austragen.\n"; + *(uint *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064285; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c + )); + } + } + iVar8 = iVar8 + 1; + } while (iVar8 < Houses); + } + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + "Treibe Mieten ein...\n"; + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8063d21; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + iVar8 = 0; + if (0 < Houses) { + do { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8063d3b + ; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (pTVar9->OwnerID != 0) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063d72; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (pTVar9->PaidUntil <= i_1) { + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063d90; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063da2; + pTVar10 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + uVar2 = pTVar10->ID; + uVar7 = pTVar9->OwnerID; + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f3f40; + *(ulong *)(&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = uVar7 + ; + *(uint *)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + (uint)uVar2; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063dc7; + Log(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063dd7; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + HouseIDs = (ushort_0_ *)(pTVar9->PaidUntil + 0x93a80); + ppuVar17 = (ushort_0_ **)&PaymentExtension; + if (PaymentExtension <= (int)HouseIDs) { + ppuVar17 = &HouseIDs; + } + PlayerData_1 = (TPlayerData *)*ppuVar17; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063e14; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined4 *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0; + *(ulong *)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + pTVar9->OwnerID; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063e2a; + local_318 = AssignPlayerPoolSlot + (*(ulong *)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c), + (bool)(&stack0xfffffcb8) + [iVar6 + iVar16 + uVar11 * -2 + iVar15]); + if (local_318 == (TPlayerData *)0x0) { + *(undefined **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &DAT_080f4060; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x806420e; + error(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + else { + z = local_2c.ObjectID; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x8063e51; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int **)(&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = &z + ; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + pTVar9->DepotNr; + *(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_318; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x8063e73; + LoadDepot(*(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ,*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(Object **) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + local_2bc[0] = local_2c.ObjectID; + *(ulong **)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &z; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x8063e94; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c + )); + *(int **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &z; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x8063ea5; + iVar19 = CountMoney(*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &House; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x8063eb7; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + if (iVar19 < (int)pTVar9->Rent) { + if (i_1 < (int)PlayerData_1) { + *(undefined **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f4dca; + *(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063ee9; + Log(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + pTVar1 = (TPlayerData *)((int)PlayerData_1 - i_1); + PlayerData_1 = pTVar1; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + iVar19 = (int)(pTVar1[-1].Title + 0x18) / 0x15180 + 1; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063f29; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + local_31c = pTVar9->Name; + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063f42; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + *(int *)((int)auStack_33c + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + 4) = iVar19; + pcVar12 = ""; + if (iVar19 != 1) { + pcVar12 = "s"; + } + *(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -4) = pcVar12; + *(char **)((int)auStack_33c + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = local_31c; + uVar7 = pTVar9->Rent; + *(undefined1 **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_28c; + *(char **)(&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + "Warning!\n\nThe monthly rent of %ld gold\nfor your house \"%s\"\nis payable. Have it available\nwithin %d day%s, or you will\nlose this house." + ; + *(undefined4 *) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 500; + *(ulong *)(&stack0xfffffcc0 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = uVar7; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063f8c; + snprintf(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c + ), + *(size_t *) + (&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(char **)(&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(undefined1 **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_28c; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063f94; + uVar7 = AddDynamicString(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15 + + -0x1c)); + *(undefined4 *) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x1a; + *(ulong **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_29c; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063fac; + GetSpecialObject(*(SPECIALMEANING *) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) + ); + local_4c[0].TypeID = local_2c.ObjectID; + *(ulong **) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_29c; + *(undefined4 *) + (&stack0xfffffcc0 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ObjectType **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_4c; + *(ulong **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2ac; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063fdc; + SetObject(*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(ObjectType **) + (&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(ulong *)(&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = uVar7; + *(undefined4 *) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 9; + *(ulong **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2ac; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8063ff9; + ChangeObject(*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(INSTANCEATTRIBUTE *) + (&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(ulong *)(&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + local_2ac[0] = local_2c.ObjectID; + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064012; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + *(ulong **) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = pTVar9->DepotNr + ; + *(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_318; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064034; + SaveDepot(*(TPlayerData **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(Object **) + (&stack0xfffffcbc + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + } + else { + *(char **)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + "Mieter wird hinausgeworfen.\n"; + *(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "houses"; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80640cc; + Log(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80640dc; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + *(undefined4 *) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0; + *(ulong *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + pTVar9->OwnerID; + *(TQueryManagerConnection **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + QueryManagerConnection; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80640fb; + iVar19 = TQueryManagerConnection::excludeFromAuctions + (*(TQueryManagerConnection **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(ulong *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * + -2 + iVar15), + (bool)(&stack0xfffffcbc) + [iVar6 + iVar16 + uVar11 * -2 + iVar15]); + if (iVar19 != 0) { + *(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Kann Mieter nicht verbannen.\n"; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064161; + error(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c)); + } + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x806410f; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + pTVar1 = local_318; + *(THouse **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + pTVar9; + *(TPlayerData **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + pTVar1; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064121; + CleanHouse(*(THouse **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(TPlayerData **) + (&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15) = iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064131; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + + -0x1c),*(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + + iVar15)); + pTVar9->OwnerName[0] = '\0'; + pTVar9->OwnerID = 0; + pTVar9->Subowners = 0; + pTVar9->Guests = 0; + } + } + else { + *(undefined **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + &DAT_080f4dff; + *(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = "houses"; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064177; + Log(*(char **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(char **)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064187; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + local_2ac[0] = local_2c.ObjectID; + uVar7 = pTVar9->Rent; + *(ulong **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_2ac; + *(ulong *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = uVar7; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80641a8; + DeleteMoney(*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + local_2ac[0] = local_2c.ObjectID; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80641c1; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + *(ulong **) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_2ac; + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + pTVar9->DepotNr; + *(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_318; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80641e3; + SaveDepot(*(TPlayerData **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15), + *(Object **) + (&stack0xfffffcbc + iVar6 + iVar16 + uVar11 * -2 + iVar15 + )); + *(int *)(&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + iVar8; + *(vector **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + &House; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80641f3; + pTVar9 = vector::operator() + (*(vector **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c), + *(int *)(&stack0xfffffcb8 + + iVar6 + iVar16 + uVar11 * -2 + iVar15)); + pTVar9->PaidUntil = pTVar9->PaidUntil + 0x278d00; + } + while( true ) { + local_2bc[0] = local_2c.ObjectID; + *(ulong **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064055; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + local_2ac[0] = NONE.ObjectID; + local_29c[0] = NONE.ObjectID; + if (z == NONE.ObjectID) break; + local_2bc[0] = local_2c.ObjectID; + *(ulong **) + (&stack0xfffffcb8 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + local_2bc; + *(int **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x8064092; + GetFirstContainerObject + (*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + *(int **)(aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = &z; + *(undefined4 *) + ((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = + 0x80640a3; + DeleteObject(*(Object **) + (aiStack_330 + + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + *(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + local_318; + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) + = 0x80640b3; + ReleasePlayerPoolSlot + (*(TPlayerData **) + (aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c + )); + } + } + } + iVar8 = iVar8 + 1; + } while (iVar8 < Houses); + } + } + else { + *(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c) = + "CollectRents: Kann Zahlungsdaten nicht ermitteln.\n"; +LAB_08064464: + *(undefined4 *)((int)&local_350 + iVar6 + iVar16 + uVar11 * -2 + iVar15) = 0x8064469; + error(*(char **)(aiStack_330 + iVar6 + iVar16 + uVar11 * -2 + iVar15 + -0x1c)); + } + pOVar14 = (ObjectType *)&z; + z = local_2c.ObjectID; +LAB_080638c5: + *piVar18 = (int)pOVar14; + piVar18[-1] = 0x80638cd; + DeleteObject((Object *)*piVar18); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void StartAuctions(void) + +{ + ushort uVar1; + ulong uVar2; + int iVar3; + int iVar4; + char_0__30_ *OwnerNames; + int iVar5; + THouse *pTVar6; + THouse *pTVar7; + THouse *pTVar8; + int iVar9; + int iVar10; + THouse *house; + int i; + undefined4 *puVar11; + ushort_0_ *HouseIDs; + int_0_ *PaidUntils; + uint uVar12; + int iVar13; + uint uStack_90; + int iStack_78; + ushort auStack_74 [4]; + int local_6c; + ulong_0_ *OwnerIDs; + int local_64; + int NumberOfHouses; + int NumberOfAuctions; + char HelpWorld [60]; + + OwnerIDs = &stack0xffffff74; + uStack_90 = 0x8064b52; + Log("houses","Starte neue Versteigerungen...\n"); + iVar13 = 0; + if (0 < Houses) { + do { + iVar9 = iVar13 + 1; + uStack_90 = 0x8065101; + pTVar6 = vector::operator()(&House,iVar13); + pTVar6->Help = 0; + iVar13 = iVar9; + } while (iVar9 < Houses); + } + NumberOfHouses = Houses; + iVar9 = -(Houses * 2 + 0xfU & 0xfffffff0); + puVar11 = (undefined4 *)(&stack0xffffff74 + iVar9); + iVar13 = (int)auStack_74 + iVar9; + *(int *)(&stack0xffffff7c + iVar9) = iVar13; + *(int **)(&stack0xffffff78 + iVar9) = &NumberOfHouses; + *(TQueryManagerConnection **)(&stack0xffffff74 + iVar9) = QueryManagerConnection; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064b87; + iVar5 = TQueryManagerConnection::getAuctions + (*(TQueryManagerConnection **)(&stack0xffffff74 + iVar9), + *(int **)(&stack0xffffff78 + iVar9),*(ushort **)(&stack0xffffff7c + iVar9)); + if (iVar5 == 0) { + iVar5 = 0; + if (0 < NumberOfHouses) { + do { + *(uint *)(&stack0xffffff74 + iVar9) = (uint)*(ushort *)(iVar13 + iVar5 * 2); + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x80650ad; + pTVar6 = GetHouse(*(ushort *)(&stack0xffffff74 + iVar9)); + if (pTVar6 == (THouse *)0x0) { + uVar1 = *(ushort *)(iVar13 + iVar5 * 2); + *(char **)(&stack0xffffff74 + iVar9) = + "StartAuctions: Haus mit Nummer %d existiert nicht (1).\n"; + *(uint *)(&stack0xffffff78 + iVar9) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x80650db; + error(*(char **)(&stack0xffffff74 + iVar9)); + } + else { + pTVar6->Help = 1; + } + iVar5 = iVar5 + 1; + } while (iVar5 < NumberOfHouses); + } + *(char **)(&stack0xffffff78 + iVar9) = WorldName; + iVar5 = 0; + *(int **)(&stack0xffffff74 + iVar9) = &NumberOfAuctions; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064baf; + AddSlashes(*(char **)(&stack0xffffff74 + iVar9),*(char **)(&stack0xffffff78 + iVar9)); + if (0 < Houses) { + do { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064fa7; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + if (pTVar6->OwnerID == 0) { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064fd0; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + if (pTVar6->Help == 0) { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064fea; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + if (pTVar6->NoAuction == false) { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8065003; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar9) = "houses"; + *(char **)(&stack0xffffff78 + iVar9) = + "Trage Haus %d zur Versteigerung ein.\n"; + *(uint *)(&stack0xffffff7c + iVar9) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x806501e; + Log(*(char **)(&stack0xffffff74 + iVar9), + *(char **)(&stack0xffffff78 + iVar9)); + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x806502e; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar9) = "houses"; + *(int **)(&stack0xffffff7c + iVar9) = &NumberOfAuctions; + *(char **)(&stack0xffffff78 + iVar9) = + "bei Reset: DELETE FROM Auctions WHERE World=\'%s\' AND HouseID=%d;\n" + ; + *(uint *)(&stack0xffffff80 + iVar9) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x806504d; + Log(*(char **)(&stack0xffffff74 + iVar9), + *(char **)(&stack0xffffff78 + iVar9)); + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x806505d; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + *(uint *)(&stack0xffffff78 + iVar9) = (uint)pTVar6->ID; + *(TQueryManagerConnection **)(&stack0xffffff74 + iVar9) = + QueryManagerConnection; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8065071; + iVar10 = TQueryManagerConnection::startAuction + (*(TQueryManagerConnection **) + (&stack0xffffff74 + iVar9), + *(ushort *)(&stack0xffffff78 + iVar9)); + if (iVar10 != 0) { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8065089; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar9) = + "StartAuctions: Kann Haus %d nicht zur Versteigerung eintragen.\n" + ; + *(uint *)(&stack0xffffff78 + iVar9) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x806509c; + error(*(char **)(&stack0xffffff74 + iVar9)); + } + } + } + } + iVar5 = iVar5 + 1; + } while (iVar5 < Houses); + } + iVar5 = 0; + if (0 < Houses) { + do { + *(int *)(&stack0xffffff78 + iVar9) = iVar5; + iVar5 = iVar5 + 1; + *(vector **)(&stack0xffffff74 + iVar9) = &House; + *(undefined4 *)((int)&uStack_90 + iVar9) = 0x8064f83; + pTVar6 = vector::operator() + (*(vector **)(&stack0xffffff74 + iVar9), + *(int *)(&stack0xffffff78 + iVar9)); + pTVar6->Help = 0; + } while (iVar5 < Houses); + } + local_64 = Houses; + uVar12 = (Houses + -1) * 4 + 0x13U & 0xfffffff0; + iVar5 = -uVar12; + iVar4 = iVar5 + iVar9 + -0x8c; + iVar10 = -((Houses + -1) * 0x1e + 0x2dU & 0xfffffff0); + local_6c = (int)auStack_74 + iVar5 + iVar9; + iVar3 = -uVar12; + puVar11 = (undefined4 *)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c); + *(int *)(&stack0xffffff84 + iVar3 + iVar10 + iVar4 + 0x8c) = + (int)auStack_74 + iVar10 + iVar5 + iVar9 + -0x8c + 0x8c; + iVar9 = (int)auStack_74 + iVar3 + iVar10 + iVar4 + 0x8c; + *(int *)(HelpWorld + iVar3 + iVar10 + iVar4 + 0x6c) = iVar9; + iVar5 = local_6c; + *(int **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = &local_64; + *(int *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(int *)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar5; + *(TQueryManagerConnection **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + QueryManagerConnection; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064c20; + iVar5 = TQueryManagerConnection::getHouseOwners + (*(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c), + *(ushort **)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c), + *(ulong **)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c), + *(char (**) [30])(&stack0xffffff84 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int **)(HelpWorld + iVar3 + iVar10 + iVar4 + 0x6c)); + if (iVar5 == 0) { + iVar5 = 0; + if (0 < local_64) { + do { + *(uint *)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + (uint)*(ushort *)(iVar13 + iVar5 * 2); + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064efc; + pTVar6 = GetHouse(*(ushort *)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c)) + ; + if (pTVar6 == (THouse *)0x0) { + uVar1 = *(ushort *)(iVar13 + iVar5 * 2); + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + "StartAuctions: Haus mit Nummer %d existiert nicht (2).\n"; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064f5b + ; + error(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c)); + } + else { + pTVar6->Help = 1; + if (pTVar6->OwnerID != *(ulong *)(local_6c + iVar5 * 4)) { + pTVar6->Help = 2; + } + if (pTVar6->PaidUntil != *(int *)(iVar9 + iVar5 * 4)) { + pTVar6->Help = 2; + } + } + iVar5 = iVar5 + 1; + } while (iVar5 < local_64); + } + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + "Aktualisiere Liste der Mieter...\n"; + iVar13 = 0; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = "houses"; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064c49; + Log(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (Houses < 1) { + return; + } + do { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064c70; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (pTVar6->OwnerID == 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064e60; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (pTVar6->Help != 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064e7e + ; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = "houses"; + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + "Trage nicht mehr vermietetes Haus %d aus.\n"; + *(uint *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064e99 + ; + Log(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064ea9 + ; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + (uint)pTVar6->ID; + *(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = QueryManagerConnection + ; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064ebd + ; + iVar9 = TQueryManagerConnection::deleteHouseOwner + (*(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(ushort *) + (&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (iVar9 != 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = + 0x8064ed5; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + "StartAuctions: Kann nicht mehr vermietetes Haus %d nicht austragen.\n" + ; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = + 0x8064ee8; + error(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c)); + } + } + } + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064c8e; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (pTVar6->OwnerID != 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d87; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (pTVar6->Help == 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064da5 + ; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = "houses"; + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + "Trage vermietetes Haus %d ein.\n"; + *(uint *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064dc0 + ; + Log(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064dd0 + ; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064de2 + ; + pTVar7 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064df4 + ; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar8->ID; + *(int *)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c) = + pTVar6->PaidUntil; + uVar2 = pTVar7->OwnerID; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(ulong *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = uVar2; + *(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = QueryManagerConnection + ; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064e1c + ; + iVar9 = TQueryManagerConnection::insertHouseOwner + (*(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(ushort *) + (&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c), + *(ulong *)(&stack0xffffff7c + + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c + )); + if (iVar9 != 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = + 0x8064e34; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + "StartAuctions: Kann vermietetes Haus %d nicht eintragen.\n"; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = + 0x8064e47; + error(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c)); + } + } + } + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064cac; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (pTVar6->Help == 2) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064cd0; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = "houses"; + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = + "Aktualisiere vermietetes Haus %d.\n"; + *(uint *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064ceb; + Log(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(char **)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064cfb; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d0d; + pTVar7 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &House; + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d1f; + pTVar8 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar8->ID; + *(int *)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c) = pTVar6->PaidUntil; + uVar2 = pTVar7->OwnerID; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(ulong *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) = uVar2; + *(TQueryManagerConnection **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) + = QueryManagerConnection; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d47; + iVar9 = TQueryManagerConnection::updateHouseOwner + (*(TQueryManagerConnection **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(ushort *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) + ,*(ulong *)(&stack0xffffff7c + iVar3 + iVar10 + iVar4 + 0x8c) + ,*(int *)(&stack0xffffff80 + iVar3 + iVar10 + iVar4 + 0x8c)); + if (iVar9 != 0) { + *(int *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = iVar13; + *(vector **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + &House; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d5f + ; + pTVar6 = vector::operator() + (*(vector **) + (&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c), + *(int *)(&stack0xffffff78 + + iVar3 + iVar10 + iVar4 + 0x8c)); + uVar1 = pTVar6->ID; + *(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = + "StartAuctions: Kann Daten des vermieteten Hauses %d nicht aktualisieren.\n" + ; + *(uint *)(&stack0xffffff78 + iVar3 + iVar10 + iVar4 + 0x8c) = (uint)uVar1; + *(undefined4 *)((int)&uStack_90 + iVar3 + iVar10 + iVar4 + 0x8c) = 0x8064d72 + ; + error(*(char **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c)); + } + } + iVar13 = iVar13 + 1; + } while (iVar13 < Houses); + return; + } + *(undefined **)(&stack0xffffff74 + iVar3 + iVar10 + iVar4 + 0x8c) = &DAT_080f46a0; + } + else { + *(char **)(&stack0xffffff74 + iVar9) = + "StartAuctions: Kann laufende Versteigerungen nicht ermitteln.\n"; + } + puVar11[-1] = 0x8064f69; + error((char *)*puVar11); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void PrepareHouseCleanup(void) + +{ + HelpDepots = 0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void FinishHouseCleanup(void) + +{ + THelpDepot *pTVar1; + TPlayerData *PlayerData_00; + TPlayerData *PlayerData; + int i; + int i_00; + int iVar2; + Object local_2c [7]; + + if (0 < HelpDepots) { + i_00 = 1; + do { + pTVar1 = vector::operator()(&HelpDepot,i_00); + PlayerData_00 = AssignPlayerPoolSlot(pTVar1->CharacterID,false); + if (PlayerData_00 == (TPlayerData *)0x0) { + error(&DAT_080f4860); + return; + } + pTVar1 = vector::operator()(&HelpDepot,i_00); + local_2c[0].ObjectID = (pTVar1->Box).ObjectID; + pTVar1 = vector::operator()(&HelpDepot,i_00); + SaveDepot(PlayerData_00,pTVar1->DepotNr,local_2c); + iVar2 = i_00 + 1; + pTVar1 = vector::operator()(&HelpDepot,i_00); + local_2c[0].ObjectID = (pTVar1->Box).ObjectID; + DeleteObject(local_2c); + ReleasePlayerPoolSlot(PlayerData_00); + i_00 = iVar2; + } while (iVar2 <= HelpDepots); + } + HelpDepots = 0; + return; +} + + + +void CleanHouseField(int x,int y,int z) + +{ + bool bVar1; + ushort ID; + THouse *pTVar2; + THelpDepot *pTVar3; + TPlayerData *PlayerData_00; + ushort HouseID; + int i; + int DepotLoaded; + int iVar4; + THouse *house; + TPlayerData *PlayerData; + int sx; + int sy; + int sz; + undefined1 local_4c [16]; + Object local_3c [4]; + ulong local_2c; + + ID = GetHouseID(x,y,z); + if (ID == 0) { + bVar1 = CoordinateFlag(); + if (bVar1) { + iVar4 = y + 1; + ID = GetHouseID(x,iVar4,z); + if ((ID != 0) || (ID = GetHouseID(x + -1,iVar4,z), ID != 0)) goto LAB_0806526c; + ID = GetHouseID(x + 1,iVar4,z); + } + if (ID == 0) { + bVar1 = CoordinateFlag(); + if (bVar1) { + iVar4 = x + 1; + ID = GetHouseID(iVar4,y,z); + if ((ID != 0) || (ID = GetHouseID(iVar4,y + -1,z), ID != 0)) goto LAB_0806526c; + ID = GetHouseID(iVar4,y + 1,z); + } + if (ID == 0) { + error("CleanHouseField: Kein Haus zu Feld [%d,%d,%d] gefunden.\n",x,y,z); + return; + } + } + } +LAB_0806526c: + pTVar2 = GetHouse(ID); + if ((pTVar2 != (THouse *)0x0) && (pTVar2->OwnerID != 0)) { + i = 1; + iVar4 = -1; + if (0 < HelpDepots) { + do { + pTVar3 = vector::operator()(&HelpDepot,i); + if ((pTVar3->CharacterID == pTVar2->OwnerID) && + (pTVar3 = vector::operator()(&HelpDepot,i), + pTVar3->DepotNr == pTVar2->DepotNr)) { + iVar4 = i; + } + i = i + 1; + } while (i <= HelpDepots); + } + if (iVar4 == -1) { + PlayerData_00 = AssignPlayerPoolSlot(pTVar2->OwnerID,false); + if (PlayerData_00 == (TPlayerData *)0x0) { + error(&DAT_080f48c0); + return; + } + HelpDepots = HelpDepots + 1; + pTVar3 = vector::operator()(&HelpDepot,HelpDepots); + pTVar3->CharacterID = pTVar2->OwnerID; + pTVar3 = vector::operator()(&HelpDepot,HelpDepots); + pTVar3->DepotNr = pTVar2->DepotNr; + GetStartPosition((int *)&PlayerData,&sx,&sy,true); + pTVar3 = vector::operator()(&HelpDepot,HelpDepots); + GetSpecialObject((SPECIALMEANING)local_4c); + GetMapContainer((int)&sz,(int)PlayerData,sx); + SetObject(local_3c,(ObjectType *)&sz,(ulong)local_4c); + (pTVar3->Box).ObjectID = local_3c[0].ObjectID; + local_2c = local_3c[0].ObjectID; + pTVar3 = vector::operator()(&HelpDepot,HelpDepots); + sz = (pTVar3->Box).ObjectID; + LoadDepot(PlayerData_00,pTVar2->DepotNr,(Object *)&sz); + iVar4 = HelpDepots; + ReleasePlayerPoolSlot(PlayerData_00); + } + pTVar3 = vector::operator()(&HelpDepot,iVar4); + sz = (pTVar3->Box).ObjectID; + CleanField(); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadHouseAreas(void) + +{ + bool bVar1; + THouseArea *pTVar2; + int iVar3; + char *__s; + char *__oflag; + undefined1 local_4ffc [4]; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + // try { // try from 080655d1 to 0806562e has its CatchHandler @ 08065780 + Log("houses",&DAT_080f4940); + __oflag = DATAPATH; + __s = local_101c; + sprintf(__s,"%s/houseareas.dat"); + bVar1 = FileExists(__s); + if (bVar1) { + TReadScriptFile::TReadScriptFile((TReadScriptFile *)local_4ffc); + // try { // try from 08065636 to 08065747 has its CatchHandler @ 08065755 + TReadScriptFile::open((TReadScriptFile *)local_4ffc,__s,(int)__oflag); + while( true ) { + TReadScriptFile::nextToken((TReadScriptFile *)local_4ffc); + if (local_4ffc == (undefined1 [4])0x0) break; + if (local_4ffc != (undefined1 [4])0x1) { + TReadScriptFile::error((TReadScriptFile *)local_4ffc,"Identifier expected"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'('); + pTVar2 = vector::operator()(&HouseArea,HouseAreas); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar2->ID = (ushort)iVar3; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,','); + TReadScriptFile::readString((TReadScriptFile *)local_4ffc); + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,','); + pTVar2 = vector::operator()(&HouseArea,HouseAreas); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar2->SQMPrice = iVar3; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,','); + pTVar2 = vector::operator()(&HouseArea,HouseAreas); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar2->DepotNr = iVar3; + __s = (char *)0x29; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,')'); + HouseAreas = HouseAreas + 1; + } + TReadScriptFile::close((TReadScriptFile *)local_4ffc,(int)__s); + // try { // try from 0806574b to 0806574f has its CatchHandler @ 08065780 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)local_4ffc,(int)__s); + } + else { + Log("houses",&DAT_080f4980); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadHouses(void) + +{ + int iVar1; + bool bVar2; + char cVar3; + THouse *pTVar4; + int iVar5; + THouse *pTVar6; + char *pcVar7; + THouseArea *pTVar8; + undefined4 *puVar9; + int *piVar10; + int i; + int iVar11; + uint uVar12; + int_0_ *piVar13; + int i_1; + int iVar14; + undefined1 uVar15; + undefined4 uStack_5080; + char *pcVar16; + int local_506c [8]; + int_0_ local_504c [4]; + int_0_ *local_5048; + bool_0_ *Guildhouses; + int_0_ *Sizes; + int_0_ *Rents; + char_0__30_ *Towns; + char___0_ *Descriptions; + char___0_ *Names; + int_0_ *PositionsZ; + int_0_ *PositionsY; + int_0_ *PositionsX; + ushort_0_ *HouseIDs; + TQueryManagerConnection *local_501c; + THouseArea *local_5018; + int local_5014; + int RentOffset; + int local_500c; + int local_5008; + int x; + int y; + int z; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + HouseIDs = &stack0xffffaf84; + // try { // try from 080657b7 to 0806582d has its CatchHandler @ 080663c1 + uStack_5080 = 0x80657bc; + Log("houses",&DAT_080f4e5f); + pcVar7 = local_101c; + MaxHouseX = 0; + Houses = 0; + MaxHouseY = 0; + pcVar16 = DATAPATH; + uStack_5080 = 0x80657f2; + sprintf(pcVar7,"%s/houses.dat"); + uStack_5080 = 0x80657fa; + bVar2 = FileExists(pcVar7); + if (bVar2) { + uStack_5080 = 0x806582e; + TReadScriptFile::TReadScriptFile((TReadScriptFile *)&z); + // try { // try from 0806583b to 08066090 has its CatchHandler @ 080663bb + uStack_5080 = 0x8065840; + TReadScriptFile::open((TReadScriptFile *)&z,pcVar7,(int)pcVar16); + while( true ) { + uStack_5080 = 0x806584e; + TReadScriptFile::nextToken((TReadScriptFile *)&z); + if (z == 0) break; + if (z != 1) { + uStack_5080 = 0x8065875; + TReadScriptFile::error((TReadScriptFile *)&z,"Identifier expected"); + } + uStack_5080 = 0x806588b; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x80658a0; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x80658b0; + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)&z); + pTVar4->ID = (ushort)iVar5; + uStack_5080 = 0x80658c8; + pTVar4 = vector::operator()(&House,Houses); + if (pTVar4->ID == 0) { + uStack_5080 = 0x8066056; + pTVar4 = vector::operator()(&House,Houses); + uVar12 = (uint)pTVar4->ID; + uStack_5080 = 0x8066069; + error(&DAT_080f4eb7); +LAB_08065fc4: + uStack_5080 = 0x8065fc9; + TReadScriptFile::close((TReadScriptFile *)&z,uVar12); + uStack_5080 = 0x8065fd5; + puVar9 = (undefined4 *)__cxa_allocate_exception(); + *puVar9 = "Cannot load houses"; + // WARNING: Subroutine does not return + uStack_5080 = 0x8065ff3; + __cxa_throw(); + } + if (0 < Houses) { + uStack_5080 = 0x80658eb; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x8065903; + pTVar6 = vector::operator()(&House,Houses + -1); + if (pTVar4->ID <= pTVar6->ID) { + uStack_5080 = 0x8066023; + pTVar4 = vector::operator()(&House,Houses); + uVar12 = (uint)pTVar4->ID; + uStack_5080 = 0x8066036; + error("LoadHouses: IDs nicht aufsteigend sortiert (ID=%d).\n"); + goto LAB_08065fc4; + } + } + uStack_5080 = 0x806591d; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065933; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x8065941; + pcVar7 = TReadScriptFile::readString((TReadScriptFile *)&z); + uStack_5080 = 0x8065958; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x806596d; + strcpy(pTVar4->Name,pcVar7); + uStack_5080 = 0x8065975; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065985; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x806598d; + pcVar7 = TReadScriptFile::readString((TReadScriptFile *)&z); + uStack_5080 = 0x80659a4; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x80659b3; + strcpy(pTVar4->Description,pcVar7); + uStack_5080 = 0x80659bb; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x80659cb; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x80659d3; + local_5014 = TReadScriptFile::readNumber((TReadScriptFile *)&z); + uStack_5080 = 0x80659e1; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x80659f1; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x80659f9; + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)&z); + iVar11 = 0; + if (0 < HouseAreas) { + do { + uStack_5080 = 0x8065a16; + pTVar8 = vector::operator()(&HouseArea,iVar11); + if (pTVar8->ID == (ushort)iVar5) { + uStack_5080 = 0x8066003; + local_5018 = vector::operator()(&HouseArea,iVar11); + goto LAB_08065a40; + } + iVar11 = iVar11 + 1; + } while (iVar11 < HouseAreas); + } + uStack_5080 = 0x8065a38; + error("GetHouseArea: Gebiet mit ID %d nicht gefunden.\n"); + local_5018 = (THouseArea *)0x0; +LAB_08065a40: + uVar15 = local_5018 == (THouseArea *)0x0; + if ((bool)uVar15) { + uStack_5080 = 0x8065fa8; + pTVar4 = vector::operator()(&House,Houses); + uVar12 = (uint)pTVar4->ID; + uStack_5080 = 0x8065fbb; + error(&DAT_080f4a00); + goto LAB_08065fc4; + } + uStack_5080 = 0x8065a63; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->DepotNr = local_5018->DepotNr; + uStack_5080 = 0x8065a80; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065a90; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x8065aa5; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x8065aaf; + pcVar7 = TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + iVar5 = 5; + pcVar16 = "true"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar15 = *pcVar7 == *pcVar16; + pcVar7 = pcVar7 + 1; + pcVar16 = pcVar16 + 1; + } while ((bool)uVar15); + pTVar4->GuildHouse = (bool)uVar15; + uStack_5080 = 0x8065adc; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->NoAuction = false; + uStack_5080 = 0x8065af1; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065b07; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x8065b1c; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065b37; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065b52; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065b71; + TReadScriptFile::readCoordinate((TReadScriptFile *)&z); + uStack_5080 = 0x8065b86; + pTVar4 = vector::operator()(&House,Houses); + if (pTVar4->ExitX == 0) { + uStack_5080 = 0x8065f7b; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065f8e; + error(&DAT_080f49c0); + } + uStack_5080 = 0x8065ba2; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065bb2; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x8065bc7; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065be2; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065bfd; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065c16; + TReadScriptFile::readCoordinate((TReadScriptFile *)&z); + uStack_5080 = 0x8065c2b; + pTVar4 = vector::operator()(&House,Houses); + if (pTVar4->CenterX == 0) { + uStack_5080 = 0x8065f4e; + vector::operator()(&House,Houses); + uStack_5080 = 0x8065f61; + error(&DAT_080f49c0); + } + uStack_5080 = 0x8065c47; + TReadScriptFile::readIdentifier((TReadScriptFile *)&z); + uStack_5080 = 0x8065c5d; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'='); + uStack_5080 = 0x8065c6d; + TReadScriptFile::readSymbol((TReadScriptFile *)&z,'{'); + uStack_5080 = 0x8065c82; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->Size = 0; + while( true ) { + uStack_5080 = 0x8065c98; + TReadScriptFile::nextToken((TReadScriptFile *)&z); + if (z != 6) goto LAB_08065cd2; + uStack_5080 = 0x8065caf; + cVar3 = TReadScriptFile::getSpecial((TReadScriptFile *)&z); + if (cVar3 == '}') break; + if (z != 6) goto LAB_08065cd2; + uStack_5080 = 0x8065cce; + cVar3 = TReadScriptFile::getSpecial((TReadScriptFile *)&z); + if (cVar3 != ',') { +LAB_08065cd2: + uStack_5080 = 0x8065cfe; + TReadScriptFile::getCoordinate((TReadScriptFile *)&z); + uStack_5080 = 0x8065d13; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x8065d3c; + SetHouseID(local_5008,x,y,pTVar4->ID); + uStack_5080 = 0x8065d51; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->Size = pTVar4->Size + 1; + uStack_5080 = 0x8065d6c; + pTVar4 = vector::operator()(&House,Houses); + uVar12 = local_5008 - pTVar4->CenterX; + if (0x7fffffff < uVar12) { + uVar12 = -uVar12; + } + if (MaxHouseX < (int)uVar12) { + uStack_5080 = 0x8065e12; + pTVar4 = vector::operator()(&House,Houses); + MaxHouseX = local_5008 - pTVar4->CenterX; + if (0x7fffffff < (uint)MaxHouseX) { + MaxHouseX = -MaxHouseX; + } + } + uStack_5080 = 0x8065da1; + pTVar4 = vector::operator()(&House,Houses); + uVar12 = x - pTVar4->CenterY; + if (0x7fffffff < uVar12) { + uVar12 = -uVar12; + } + if (MaxHouseY < (int)uVar12) { + uStack_5080 = 0x8065dda; + pTVar4 = vector::operator()(&House,Houses); + MaxHouseY = x - pTVar4->CenterY; + if (0x7fffffff < (uint)MaxHouseY) { + MaxHouseY = -MaxHouseY; + } + } + } + } + uStack_5080 = 0x8065e4a; + pTVar4 = vector::operator()(&House,Houses); + uStack_5080 = 0x8065e61; + pTVar6 = vector::operator()(&House,Houses); + iVar5 = Houses; + pTVar4->Rent = local_5018->SQMPrice * pTVar6->Size + local_5014; + uStack_5080 = 0x8065e96; + pTVar4 = vector::operator()(&House,iVar5); + pTVar4->OwnerID = 0; + uStack_5080 = 0x8065eb3; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->OwnerName[0] = '\0'; + uStack_5080 = 0x8065ecf; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->LastTransition = 0; + uStack_5080 = 0x8065eec; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->PaidUntil = 0; + uStack_5080 = 0x8065f09; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->Subowners = 0; + uStack_5080 = 0x8065f26; + pcVar7 = (char *)Houses; + pTVar4 = vector::operator()(&House,Houses); + pTVar4->Guests = 0; + Houses = Houses + 1; + } + uStack_5080 = 0x8066085; + TReadScriptFile::close((TReadScriptFile *)&z,(int)pcVar7); + uStack_5080 = 0x8066091; + local_501c = (TQueryManagerConnection *)operator_new(0x30); + local_500c = 0x4000; + RentOffset = Houses * 600; + piVar10 = &RentOffset; + if (Houses * 600 < 0x4001) { + piVar10 = &local_500c; + } + // try { // try from 080660d6 to 080660da has its CatchHandler @ 08066388 + uStack_5080 = 0x80660db; + TQueryManagerConnection::TQueryManagerConnection(local_501c,*piVar10); + QueryManagerConnection = local_501c; + iVar5 = Houses + -1; + iVar11 = -(Houses + 0x10 + iVar5 & 0xfffffff0U); + PositionsX = local_504c + iVar11; + uVar12 = iVar5 * 4 + 0x13U & 0xfffffff0; + PositionsY = local_504c + (iVar11 - uVar12); + PositionsZ = local_504c + uVar12 * -2 + iVar11; + Names = local_504c + uVar12 * -3 + iVar11; + Descriptions = local_504c + uVar12 * -4 + iVar11; + iVar5 = -(iVar5 * 0x1e + 0x2dU & 0xfffffff0); + Towns = local_504c + uVar12 * -5 + iVar11; + piVar13 = local_504c + iVar5 + uVar12 * -5 + iVar11; + Rents = piVar13; + Sizes = local_504c + iVar5 + uVar12 * -6 + iVar11; + iVar1 = -(Houses + 0xfU & 0xfffffff0); + local_5048 = local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11; + iVar14 = 0; + Guildhouses = local_504c + iVar5 + uVar12 * -7 + iVar11; + if (0 < Houses) { + do { + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + // try { // try from 080661a4 to 0806635c has its CatchHandler @ 080663bb + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80661a9; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(ushort *)(PositionsX + iVar14 * 2) = pTVar4->ID; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80661c6; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(char **)(Descriptions + iVar14 * 4) = pTVar4->Name; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80661e2; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(ulong *)(Sizes + iVar14 * 4) = pTVar4->Rent; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x8066201; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(char **)(Towns + iVar14 * 4) = pTVar4->Description; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x806621d; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(int *)(Guildhouses + iVar14 * 4) = pTVar4->Size; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x806623c; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(int *)(PositionsY + iVar14 * 4) = pTVar4->CenterX; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x806625b; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(int *)(PositionsZ + iVar14 * 4) = pTVar4->CenterY; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x806627a; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(int *)(Names + iVar14 * 4) = pTVar4->CenterZ; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x8066299; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) = + pTVar4->DepotNr; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80662a7; + pcVar7 = GetDepotName(*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10)); + *(char **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = pcVar7; + *(int_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) = + piVar13; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80662b3; + strcpy(*(char **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10), + *(char **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + *(vector **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) + = &House; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = iVar14; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = + 0x80662c3; + pTVar4 = vector::operator() + (*(vector **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10 + ),*(int *)((int)local_506c + + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + piVar13 = piVar13 + 0x1e; + local_5048[iVar14] = pTVar4->GuildHouse; + iVar14 = iVar14 + 1; + } while (iVar14 < Houses); + } + *(int_0_ **)(local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -4) = local_5048; + *(int_0_ **)(local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -8) = Rents; + *(char___0_ **)(local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = Names; + *(int_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 0x10) = PositionsZ; + *(int_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 0xc) = PositionsY; + *(bool_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 8) = Guildhouses; + *(char_0__30_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 4) = Towns; + *(int_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11) = Sizes; + *(char___0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -4) = Descriptions; + *(int_0_ **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -8) = PositionsX; + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc) = Houses; + *(TQueryManagerConnection **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) = QueryManagerConnection; + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = 0x806635d; + iVar14 = TQueryManagerConnection::insertHouses + (*(TQueryManagerConnection **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10), + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc), + *(ushort **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -8), + *(char ***)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -4) + ,*(int **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11), + *(char ***)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 4), + *(int **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 8), + *(int **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 0xc), + *(int **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + 0x10) + ,*(int **)(local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc), + *(char (**) [30]) + (local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -8), + *(bool **)(local_504c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -4)); + if (iVar14 != 0) { + *(undefined **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) = + &DAT_080f4a80; + // try { // try from 08066381 to 08066385 has its CatchHandler @ 080663bb + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = 0x8066386; + error(*(char **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10)); + } + *(int **)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10) = &z; + // try { // try from 0806636a to 0806636e has its CatchHandler @ 080663c1 + *(undefined4 *)((int)&uStack_5080 + iVar1 + iVar5 + uVar12 * -7 + iVar11) = 0x806636f; + TReadScriptFile::~TReadScriptFile + (*(TReadScriptFile **) + ((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0x10), + *(int *)((int)local_506c + iVar1 + iVar5 + uVar12 * -7 + iVar11 + -0xc)); + } + else { + uStack_5080 = 0x8065812; + Log("houses",&DAT_080f4e82); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadOwners(void) + +{ + ushort uVar1; + char_0__30_ *pcVar2; + bool bVar3; + char cVar4; + bool bVar5; + int_0_ *PaidUntils; + THouse *pTVar6; + ulong uVar7; + THouseGuest *pTVar8; + undefined4 *puVar9; + int iVar10; + int iVar11; + int iVar12; + int iVar13; + int iVar14; + ulong_0_ *OwnerIDs; + uint uVar15; + int iVar16; + undefined4 *puVar17; + THouse *house; + int iVar18; + char *pcVar19; + undefined1 uVar20; + undefined4 uStack_5080; + char *pcVar21; + char *pcVar22; + int aiStack_5070 [3]; + undefined1 auStack_5064 [16]; + int local_5054; + int z; + int y; + int x; + THouse *house_2; + int i_1; + char_0__30_ *OwnerNames; + ushort_0_ *HouseIDs; + char local_5032; + char local_5031; + bool ClearBeds; + int iStack_5030; + bool ClearGuests; + int NumberOfHouses; + ulong local_501c [4]; + ulong local_500c; + Object Bed; + undefined1 local_4ffc [4]; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + HouseIDs = &stack0xffffaf84; + puVar17 = (undefined4 *)&stack0xffffaf84; + // try { // try from 080663f7 to 0806646d has its CatchHandler @ 08066c00 + uStack_5080 = 0x80663fc; + Log("houses","Lade Mieterdaten...\n"); + local_5031 = '\0'; + pcVar21 = local_101c; + PaymentExtension = 0; + local_5032 = '\0'; + pcVar22 = DATAPATH; + uStack_5080 = 0x806642f; + sprintf(pcVar21,"%s/owners.dat"); + uStack_5080 = 0x8066437; + bVar3 = FileExists(pcVar21); + if (bVar3) { + uStack_5080 = 0x806646e; + TReadScriptFile::TReadScriptFile((TReadScriptFile *)local_4ffc); + // try { // try from 0806647b to 080668c5 has its CatchHandler @ 08066bf6 + uStack_5080 = 0x8066480; + TReadScriptFile::open((TReadScriptFile *)local_4ffc,pcVar21,(int)pcVar22); + while( true ) { + uStack_5080 = 0x806648e; + TReadScriptFile::nextToken((TReadScriptFile *)local_4ffc); + if (local_4ffc == (undefined1 [4])0x0) break; + uVar20 = local_4ffc == (undefined1 [4])0x1; + if (!(bool)uVar20) { + pcVar21 = "Identifier expected"; + uStack_5080 = 0x80664af; + TReadScriptFile::error((TReadScriptFile *)local_4ffc,"Identifier expected"); + } + uStack_5080 = 0x80664bd; + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_4ffc); + iVar11 = 10; + pcVar19 = "extension"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar20 = *pcVar22 == *pcVar19; + pcVar22 = pcVar22 + 1; + pcVar19 = pcVar19 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + pcVar21 = (char *)0x3d; + uStack_5080 = 0x80667f9; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x8066807; + PaymentExtension = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + } + else { + uStack_5080 = 0x80664e2; + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_4ffc); + iVar11 = 0xc; + pcVar19 = "clearguests"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar20 = *pcVar22 == *pcVar19; + pcVar22 = pcVar22 + 1; + pcVar19 = pcVar19 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + local_5031 = '\x01'; + } + else { + uStack_5080 = 0x8066507; + pcVar22 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_4ffc); + iVar11 = 10; + pcVar19 = "clearbeds"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar20 = *pcVar22 == *pcVar19; + pcVar22 = pcVar22 + 1; + pcVar19 = pcVar19 + 1; + } while ((bool)uVar20); + if ((bool)uVar20) { + local_5032 = '\x01'; + } + else { + uStack_5080 = 0x806652c; + pcVar21 = TReadScriptFile::getIdentifier((TReadScriptFile *)local_4ffc); + iVar11 = 3; + pcVar22 = "id"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar20 = *pcVar21 == *pcVar22; + pcVar21 = pcVar21 + 1; + pcVar22 = pcVar22 + 1; + } while ((bool)uVar20); + if (!(bool)uVar20) { + uStack_5080 = 0x80667c6; + TReadScriptFile::error + ((TReadScriptFile *)local_4ffc,"Unknown identifier"); + } + uStack_5080 = 0x8066559; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x8066567; + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x8066572; + pTVar6 = GetHouse((ushort)iVar11); + if (pTVar6 == (THouse *)0x0) { + uStack_5080 = 0x8066780; + error("LoadOwners: Haus zu ID %d existiert nicht."); + goto LAB_08066780; + } + uStack_5080 = 0x806658a; + TReadScriptFile::readIdentifier((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x80665a0; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x80665ae; + uVar7 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar6->OwnerID = uVar7; + uStack_5080 = 0x80665bc; + TReadScriptFile::readIdentifier((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x80665cc; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x80665d4; + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar6->LastTransition = iVar11; + uStack_5080 = 0x80665e2; + TReadScriptFile::readIdentifier((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x80665f2; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x80665fa; + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar6->PaidUntil = iVar11; + uStack_5080 = 0x8066608; + TReadScriptFile::readIdentifier((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x8066618; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + uStack_5080 = 0x8066628; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'{'); + while( true ) { + uStack_5080 = 0x8066636; + TReadScriptFile::nextToken((TReadScriptFile *)local_4ffc); + if (local_4ffc != (undefined1 [4])0x6) goto LAB_0806666c; + uStack_5080 = 0x806664d; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)local_4ffc); + if (cVar4 == '}') break; + if (local_4ffc != (undefined1 [4])0x6) goto LAB_0806666c; + uStack_5080 = 0x8066668; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)local_4ffc); + if (cVar4 != ',') { +LAB_0806666c: + uStack_5080 = 0x806667a; + pcVar21 = TReadScriptFile::getString((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x8066694; + pTVar8 = vector<>::operator()(&pTVar6->Guest,pTVar6->Guests); + uStack_5080 = 0x80666a0; + strcpy(pTVar8->Name,pcVar21); + pTVar6->Guests = pTVar6->Guests + 1; + } + } + uStack_5080 = 0x80666b6; + TReadScriptFile::readIdentifier((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x80666cc; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'='); + pcVar21 = (char *)0x7b; + uStack_5080 = 0x80666dc; + TReadScriptFile::readSymbol((TReadScriptFile *)local_4ffc,'{'); + while( true ) { + uStack_5080 = 0x80666ea; + TReadScriptFile::nextToken((TReadScriptFile *)local_4ffc); + if (local_4ffc != (undefined1 [4])0x6) goto LAB_0806671a; + uStack_5080 = 0x8066701; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)local_4ffc); + if (cVar4 == '}') break; + if (local_4ffc != (undefined1 [4])0x6) goto LAB_0806671a; + uStack_5080 = 0x8066716; + cVar4 = TReadScriptFile::getSpecial((TReadScriptFile *)local_4ffc); + if (cVar4 != ',') { +LAB_0806671a: + uStack_5080 = 0x8066728; + pcVar21 = TReadScriptFile::getString((TReadScriptFile *)local_4ffc); + uStack_5080 = 0x8066742; + pTVar8 = vector<>::operator()(&pTVar6->Subowner,pTVar6->Subowners); + uStack_5080 = 0x806674e; + strcpy(pTVar8->Name,pcVar21); + pTVar6->Subowners = pTVar6->Subowners + 1; + } + } + if (local_5031 != '\0') { + pTVar6->Guests = 0; + } + } + } + } + } + uStack_5080 = 0x806681f; + TReadScriptFile::close((TReadScriptFile *)local_4ffc,(int)pcVar21); + iStack_5030 = Houses; + iVar12 = Houses + -1; + iVar11 = -(Houses + 0x10 + iVar12 & 0xfffffff0U); + uVar15 = iVar12 * 4 + 0x13U & 0xfffffff0; + OwnerNames = auStack_5064 + iVar11; + iVar12 = -(iVar12 * 0x1e + 0x2dU & 0xfffffff0); + puVar17 = (undefined4 *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18); + i_1 = (int)(auStack_5064 + iVar12 + -uVar15 + iVar11); + *(undefined1 **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -4) = + auStack_5064 + iVar12 + uVar15 * -2 + iVar11; + *(undefined1 **)((int)aiStack_5070 + iVar12 + uVar15 * -2 + iVar11 + 4) = + auStack_5064 + iVar12 + -uVar15 + iVar11; + *(undefined1 **)((int)aiStack_5070 + iVar12 + uVar15 * -2 + iVar11) = + auStack_5064 + -uVar15 + iVar11; + pcVar2 = OwnerNames; + *(int **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14) = &stack0xffffafd0; + *(char_0__30_ **)(&stack0xffffaf8c + iVar12 + uVar15 * -2 + iVar11) = pcVar2; + *(TQueryManagerConnection **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + QueryManagerConnection; + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x806689c; + iVar10 = TQueryManagerConnection::getHouseOwners + (*(TQueryManagerConnection **) + (auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18), + *(int **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14), + *(ushort **)(&stack0xffffaf8c + iVar12 + uVar15 * -2 + iVar11), + *(ulong **)((int)aiStack_5070 + iVar12 + uVar15 * -2 + iVar11), + *(char (**) [30])((int)aiStack_5070 + iVar12 + uVar15 * -2 + iVar11 + 4) + ,*(int **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -4)); + if (iVar10 != 0) { + *(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + "LoadOwners: Kann Namen der Mieter nicht ermitteln.\n"; + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x8066ba3; + error(*(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18)); +LAB_08066780: + *puVar17 = 4; + puVar17[-1] = 0x806678c; + puVar9 = (undefined4 *)__cxa_allocate_exception(); + *puVar9 = "Cannot load owners"; + puVar17[2] = 0; + puVar17[1] = char_const*::typeinfo; + *puVar17 = puVar9; + // WARNING: Subroutine does not return + puVar17[-1] = &UNK_080667aa; + __cxa_throw(); + } + iVar18 = 0; + iVar10 = i_1; + if (0 < iStack_5030) { + do { + *(uint *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + (uint)*(ushort *)(OwnerNames + iVar18 * 2); + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x80668c6; + pTVar6 = GetHouse(*(ushort *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18)) + ; + if (pTVar6 == (THouse *)0x0) { + uVar1 = *(ushort *)(OwnerNames + iVar18 * 2); + *(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + "LoadOwners: Haus %d existiert nicht.\n"; + *(uint *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14) = (uint)uVar1; + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x8066b92; + error(*(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18)); + } + else if (pTVar6->OwnerID != 0) { + *(int *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14) = iVar10; + *(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + pTVar6->OwnerName; + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x8066b73; + strcpy(*(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18), + *(char **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14)); + } + iVar18 = iVar18 + 1; + iVar10 = iVar10 + 0x1e; + } while (iVar18 < iStack_5030); + } + if (local_5032 != '\0') { + *(undefined **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14) = &DAT_080f4f5b; + *(undefined4 *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = 1; + // try { // try from 08066919 to 08066a1c has its CatchHandler @ 08066bf6 + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x806691e; + print(); + house_2 = (THouse *)0x0; + if (0 < Houses) { + do { + pTVar6 = house_2; + *(vector **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + &House; + *(THouse **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14) = pTVar6; + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x8066946; + x = (int)vector::operator() + (*(vector **) + (auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18), + *(int *)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14)); + iVar10 = ((THouse *)x)->CenterX; + y = iVar10 - MaxHouseX; + if (iVar10 - MaxHouseX <= MaxHouseX + iVar10) { + iVar18 = ((THouse *)x)->CenterY; + iVar14 = MaxHouseX; + iVar16 = MaxHouseY; + do { + z = iVar18 - iVar16; + iVar13 = SectorZMax; + if (iVar18 - iVar16 <= iVar16 + iVar18) { + do { + local_5054 = SectorZMin; + if (SectorZMin <= iVar13) { + do { + *(int *)((int)aiStack_5070 + + iVar12 + uVar15 * -2 + iVar11) = local_5054; + *(int *)(&stack0xffffaf8c + + iVar12 + uVar15 * -2 + iVar11) = z; + iVar10 = y; + *(ulong **) + (auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) + = &local_500c; + *(int *)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = iVar10; + *(undefined4 *) + ((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = + 0x80669d9; + GetFirstObject(); + while( true ) { + bVar3 = false; + local_501c[0] = NONE.ObjectID; + NumberOfHouses = NONE.ObjectID; + if (local_500c != NONE.ObjectID) { + *(int **)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18) + = &NumberOfHouses; + *(ulong **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = + &local_500c; + *(undefined4 *) + ((int)&uStack_5080 + + iVar12 + uVar15 * -2 + iVar11) = 0x8066b40; + Object::getObjectType + (*(Object **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + + -0x18)); + *(undefined4 *) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = 0x14; + *(int **)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18) + = &NumberOfHouses; + *(undefined4 *) + ((int)&uStack_5080 + + iVar12 + uVar15 * -2 + iVar11) = 0x8066b53; + bVar5 = ObjectType::getFlag(*(ObjectType **) + (auStack_5064 + + iVar12 + uVar15 * + -2 + iVar11 + -0x18), + *(FLAG *)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14)); + if (!bVar5) { + bVar3 = true; + } + } + if (!bVar3) break; + *(ulong **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = + &local_500c; + *(ulong **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18) = local_501c + ; + *(undefined4 *) + ((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) + = 0x8066a1d; + Object::getNextObject + (*(Object **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18)); + local_500c = local_501c[0]; + } + bVar3 = false; + NumberOfHouses = NONE.ObjectID; + if (local_500c == NONE.ObjectID) { +LAB_08066a4d: + bVar3 = true; + } + else { + *(undefined4 *) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = 9; + *(ulong **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18) = + &local_500c; + // try { // try from 08066b1c to 08066ba2 has its CatchHandler @ 08066bf6 + *(undefined4 *) + ((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) + = 0x8066b21; + uVar7 = Object::getAttribute + (*(Object **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + + -0x18),*(INSTANCEATTRIBUTE *) + (auStack_5064 + + iVar12 + uVar15 * -2 + + iVar11 + -0x14) + ); + if (uVar7 == 0) goto LAB_08066a4d; + } + if (!bVar3) { + NumberOfHouses = local_500c; + local_501c[0] = local_500c; + *(int **)(&stack0xffffaf8c + + iVar12 + uVar15 * -2 + iVar11) = + &NumberOfHouses; + *(ulong **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14) = local_501c + ; + *(undefined4 *) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x18) = 0; + // try { // try from 08066b01 to 08066b05 has its CatchHandler @ 08066ba8 + *(undefined4 *) + ((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) + = 0x8066b06; + UseObjects(*(ulong *)(auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + + -0x18), + *(Object **) + (auStack_5064 + + iVar12 + uVar15 * -2 + iVar11 + -0x14), + *(Object **) + (&stack0xffffaf8c + + iVar12 + uVar15 * -2 + iVar11)); + } + local_5054 = local_5054 + 1; + } while (local_5054 <= SectorZMax); + iVar18 = *(int *)(x + 0x248); + iVar13 = SectorZMax; + iVar16 = MaxHouseY; + } + z = z + 1; + } while (z <= iVar16 + iVar18); + iVar10 = *(int *)(x + 0x244); + iVar14 = MaxHouseX; + } + y = y + 1; + } while (y <= iVar14 + iVar10); + } + house_2 = (THouse *)((int)&house_2->ID + 1); + } while ((int)house_2 < Houses); + } + } + *(undefined1 **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18) = local_4ffc; + // try { // try from 080668fa to 080668fe has its CatchHandler @ 08066c00 + *(undefined4 *)((int)&uStack_5080 + iVar12 + uVar15 * -2 + iVar11) = 0x80668ff; + TReadScriptFile::~TReadScriptFile + (*(TReadScriptFile **)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x18), + *(int *)(auStack_5064 + iVar12 + uVar15 * -2 + iVar11 + -0x14)); + } + else { + uStack_5080 = 0x806644f; + Log("houses","Keine Mieterdaten gefunden.\n"); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SaveOwners(void) + +{ + time_t tVar1; + THouse *pTVar2; + THouseGuest *pTVar3; + int i; + int j; + int iVar4; + char *__s; + char *pcVar5; + undefined1 local_202c [4]; + TWriteScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + // try { // try from 08066c31 to 08066c61 has its CatchHandler @ 08066f20 + Log("houses","Speichere Mieterdaten...\n"); + pcVar5 = DATAPATH; + __s = local_101c; + sprintf(__s,"%s/owners.dat"); + TWriteScriptFile::TWriteScriptFile((TWriteScriptFile *)local_202c); + // try { // try from 08066c69 to 08066c97 has its CatchHandler @ 08066f06 + TWriteScriptFile::open((TWriteScriptFile *)local_202c,__s,(int)pcVar5); + tVar1 = time((time_t *)0x0); + if (tVar1 < PaymentExtension) { + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"Extension = "); + __s = (char *)PaymentExtension; + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_202c,PaymentExtension); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + } + pcVar5 = (char *)0x0; + if (0 < Houses) { + do { + __s = pcVar5; + // try { // try from 08066cb8 to 08066f00 has its CatchHandler @ 08066f06 + pTVar2 = vector::operator()(&House,(int)pcVar5); + if (pTVar2->OwnerID != 0) { + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"ID = "); + pTVar2 = vector::operator()(&House,(int)pcVar5); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_202c,(uint)pTVar2->ID); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"Owner = "); + pTVar2 = vector::operator()(&House,(int)pcVar5); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_202c,pTVar2->OwnerID); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"LastTransition = "); + pTVar2 = vector::operator()(&House,(int)pcVar5); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_202c,pTVar2->LastTransition) + ; + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"PaidUntil = "); + pTVar2 = vector::operator()(&House,(int)pcVar5); + TWriteScriptFile::writeNumber((TWriteScriptFile *)local_202c,pTVar2->PaidUntil); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"Guests = {"); + for (iVar4 = 0; pTVar2 = vector::operator()(&House,(int)pcVar5), + iVar4 < pTVar2->Guests; iVar4 = iVar4 + 1) { + if (0 < iVar4) { + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,","); + } + pTVar2 = vector::operator()(&House,(int)pcVar5); + pTVar3 = vector<>::operator()(&pTVar2->Guest,iVar4); + TWriteScriptFile::writeString((TWriteScriptFile *)local_202c,pTVar3->Name); + } + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"Subowners = {"); + for (iVar4 = 0; pTVar2 = vector::operator()(&House,(int)pcVar5), + iVar4 < pTVar2->Subowners; iVar4 = iVar4 + 1) { + if (0 < iVar4) { + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,","); + } + pTVar2 = vector::operator()(&House,(int)pcVar5); + pTVar3 = vector<>::operator()(&pTVar2->Subowner,iVar4); + TWriteScriptFile::writeString((TWriteScriptFile *)local_202c,pTVar3->Name); + } + __s = "}"; + TWriteScriptFile::writeText((TWriteScriptFile *)local_202c,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + TWriteScriptFile::writeLn((TWriteScriptFile *)local_202c); + } + pcVar5 = pcVar5 + 1; + } while ((int)pcVar5 < Houses); + } + TWriteScriptFile::close((TWriteScriptFile *)local_202c,(int)__s); + // try { // try from 08066c9b to 08066c9f has its CatchHandler @ 08066f20 + TWriteScriptFile::~TWriteScriptFile((TWriteScriptFile *)local_202c,(int)__s); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitHouses(void) + +{ + TQueryManagerConnection *pTVar1; + RESULT r; + int in_stack_ffffffe8; + + // try { // try from 08066f43 to 08066f81 has its CatchHandler @ 08066f90 + InitLog("houses"); + LoadHouseAreas(); + LoadHouses(); + LoadOwners(); + FinishAuctions(); + CollectRents(); + StartAuctions(); + pTVar1 = QueryManagerConnection; + if (QueryManagerConnection != (TQueryManagerConnection *)0x0) { + TQueryManagerConnection::~TQueryManagerConnection(QueryManagerConnection,in_stack_ffffffe8); + operator_delete(pTVar1); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitHouses(void) + +{ + // try { // try from 08067009 to 0806700d has its CatchHandler @ 08067015 + SaveOwners(); + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (HouseArea.entry == (THouseArea *)0x0) { + return; + } + operator_delete__(HouseArea.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + THouseGuest *pTVar1; + THouse *pTVar2; + THouse *pTVar3; + + if (House.entry != (THouse *)0x0) { + pTVar2 = House.entry + House.entry[-1].Help; + while (House.entry != pTVar2) { + pTVar3 = pTVar2 + -1; + pTVar1 = pTVar2[-1].Guest.entry; + if (pTVar1 != (THouseGuest *)0x0) { + operator_delete__(pTVar1); + } + pTVar1 = pTVar2[-1].Subowner.entry; + pTVar2 = pTVar3; + if (pTVar1 != (THouseGuest *)0x0) { + operator_delete__(pTVar1); + } + } + operator_delete__(&House.entry[-1].Help); + } + if (House.init.Guest.entry != (THouseGuest *)0x0) { + operator_delete__(House.init.Guest.entry); + } + if (House.init.Subowner.entry != (THouseGuest *)0x0) { + operator_delete__(House.init.Subowner.entry); + return; + } + return; +} + + + +void __tcf_2(void *param_1) + +{ + if (HelpDepot.entry == (THelpDepot *)0x0) { + return; + } + operator_delete__(HelpDepot.entry); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_HouseArea(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector<>::vector(vector<> *this,int min,int max,int block) + +{ + THouseGuest *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (THouseGuest *)operator_new__(this->space * 0x3c); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: THouseArea * operator()(vector * this, int i) + +THouseArea * __thiscall vector::operator()(vector *this,int i) + +{ + THouseArea *pTVar1; + undefined2 uVar2; + ushort uVar3; + undefined2 uVar4; + THouseArea *pTVar5; + int iVar6; + int iVar7; + int iVar8; + int iVar9; + int j_1; + int iVar10; + int j; + THouseArea *help; + int local_30; + int extend; + uchar Help [12]; + + iVar7 = this->start; + while (i < iVar7) { + local_30 = this->block; + if (local_30 == 0) { + iVar7 = this->space; + local_30 = iVar7; + } + else { + iVar7 = this->space; + } + pTVar5 = (THouseArea *)operator_new__((local_30 + iVar7) * 0xc); + iVar7 = this->min; + if (iVar7 <= this->max) { + do { + iVar10 = (iVar7 - this->start) + local_30; + uVar3 = pTVar5[iVar10].ID; + uVar4 = *(undefined2 *)&pTVar5[iVar10].field_0x2; + iVar9 = pTVar5[iVar10].SQMPrice; + iVar8 = pTVar5[iVar10].DepotNr; + iVar6 = iVar7 - this->start; + iVar10 = local_30 + iVar6; + pTVar1 = this->entry; + uVar2 = *(undefined2 *)&pTVar1[iVar6].field_0x2; + pTVar5[iVar10].ID = pTVar1[iVar6].ID; + *(undefined2 *)&pTVar5[iVar10].field_0x2 = uVar2; + pTVar5[iVar10].SQMPrice = pTVar1[iVar6].SQMPrice; + pTVar5[iVar10].DepotNr = pTVar1[iVar6].DepotNr; + iVar10 = iVar7 + 1; + iVar7 = iVar7 - this->start; + pTVar1 = this->entry; + pTVar1[iVar7].ID = uVar3; + *(undefined2 *)&pTVar1[iVar7].field_0x2 = uVar4; + pTVar1[iVar7].SQMPrice = iVar9; + pTVar1[iVar7].DepotNr = iVar8; + iVar7 = iVar10; + } while (iVar10 <= this->max); + } + if (this->entry != (THouseArea *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar5; + iVar7 = this->start - local_30; + this->start = iVar7; + this->space = this->space + local_30; + } + iVar9 = this->space; + iVar10 = iVar9 + iVar7; + while (iVar10 <= i) { + iVar10 = this->block; + if (this->block == 0) { + iVar10 = iVar9; + } + pTVar5 = (THouseArea *)operator_new__((iVar10 + iVar9) * 0xc); + iVar7 = this->min; + if (iVar7 <= this->max) { + do { + iVar8 = iVar7 - this->start; + uVar3 = pTVar5[iVar8].ID; + uVar4 = *(undefined2 *)&pTVar5[iVar8].field_0x2; + iVar9 = pTVar5[iVar8].SQMPrice; + iVar8 = pTVar5[iVar8].DepotNr; + pTVar1 = this->entry; + iVar6 = iVar7 - this->start; + uVar2 = *(undefined2 *)&pTVar1[iVar6].field_0x2; + pTVar5[iVar6].ID = pTVar1[iVar6].ID; + *(undefined2 *)&pTVar5[iVar6].field_0x2 = uVar2; + pTVar5[iVar6].SQMPrice = pTVar1[iVar6].SQMPrice; + pTVar5[iVar6].DepotNr = pTVar1[iVar6].DepotNr; + iVar6 = iVar7 + 1; + pTVar1 = this->entry; + iVar7 = iVar7 - this->start; + pTVar1[iVar7].ID = uVar3; + *(undefined2 *)&pTVar1[iVar7].field_0x2 = uVar4; + pTVar1[iVar7].SQMPrice = iVar9; + pTVar1[iVar7].DepotNr = iVar8; + iVar7 = iVar6; + } while (iVar6 <= this->max); + } + if (this->entry != (THouseArea *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar5; + iVar7 = this->start; + iVar9 = this->space + iVar10; + this->space = iVar9; + iVar10 = iVar9 + iVar7; + } + iVar10 = this->min; + while (i < iVar10) { + this->min = iVar10 + -1; + if (this->initialized != false) { + iVar7 = (iVar10 + -1) - iVar7; + pTVar5 = this->entry; + uVar2 = *(undefined2 *)&(this->init).field_0x2; + pTVar5[iVar7].ID = (this->init).ID; + *(undefined2 *)&pTVar5[iVar7].field_0x2 = uVar2; + pTVar5[iVar7].SQMPrice = (this->init).SQMPrice; + pTVar5[iVar7].DepotNr = (this->init).DepotNr; + iVar7 = this->start; + } + iVar10 = this->min; + } + iVar10 = this->max; + while (iVar10 < i) { + this->max = iVar10 + 1; + if (this->initialized != false) { + iVar7 = (iVar10 + 1) - iVar7; + pTVar5 = this->entry; + uVar2 = *(undefined2 *)&(this->init).field_0x2; + pTVar5[iVar7].ID = (this->init).ID; + *(undefined2 *)&pTVar5[iVar7].field_0x2 = uVar2; + pTVar5[iVar7].SQMPrice = (this->init).SQMPrice; + pTVar5[iVar7].DepotNr = (this->init).DepotNr; + iVar7 = this->start; + } + iVar10 = this->max; + } + return this->entry + (i - iVar7); +} + + + +// DWARF original prototype: THouse * operator()(vector * this, int i) + +THouse * __thiscall vector::operator()(vector *this,int i) + +{ + THouseGuest *pTVar1; + ushort *puVar2; + char *pcVar3; + char *pcVar4; + char cVar5; + char cVar6; + int *piVar7; + uint uVar8; + int iVar9; + int j_1; + THouse *pTVar10; + int j; + int iVar11; + THouse *pTVar12; + THouse *pTVar13; + int iVar14; + int extend_1; + int local_360; + int extend; + uchar Help [824]; + + iVar11 = this->start; + while (i < iVar11) { + local_360 = this->block; + if (local_360 == 0) { + iVar11 = this->space; + local_360 = iVar11; + } + else { + iVar11 = this->space; + } + iVar11 = local_360 + iVar11; + piVar7 = (int *)operator_new__(iVar11 * 0x338 + 4); + *piVar7 = iVar11; + pTVar13 = (THouse *)(piVar7 + 1); + pTVar10 = pTVar13; + while (iVar11 = iVar11 + -1, iVar11 != -1) { + // try { // try from 08067573 to 08067577 has its CatchHandler @ 08067b65 + vector<>::vector(&pTVar10->Subowner,0,4,5); + // try { // try from 08067599 to 0806759d has its CatchHandler @ 08067acc + vector<>::vector(&pTVar10->Guest,0,9,10); + pTVar10 = pTVar10 + 1; + } + iVar11 = this->min; + if (iVar11 <= this->max) { + do { + piVar7 = &extend; + uVar8 = 0x338; + pTVar10 = pTVar13 + (iVar11 - this->start) + local_360; + if (((uint)&extend & 4) != 0) { + puVar2 = &pTVar10->ID; + pcVar3 = pTVar10->Name; + pcVar4 = pTVar10->Name; + piVar7 = (int *)Help; + pTVar10 = (THouse *)(pTVar10->Name + 2); + extend._0_2_ = *puVar2; + extend._2_1_ = pcVar3[0]; + extend._3_1_ = pcVar4[1]; + uVar8 = 0x334; + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + *piVar7 = *(int *)pTVar10; + pTVar10 = (THouse *)(pTVar10->Name + 2); + piVar7 = piVar7 + 1; + } + iVar14 = iVar11 - this->start; + pTVar10 = pTVar13 + local_360 + iVar14; + pTVar12 = this->entry + iVar14; + uVar8 = 0x338; + if (((uint)pTVar10 & 4) != 0) { + puVar2 = &pTVar12->ID; + cVar5 = pTVar12->Name[0]; + cVar6 = pTVar12->Name[1]; + pTVar12 = (THouse *)(pTVar12->Name + 2); + pTVar10->ID = *puVar2; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + cVar5 = pTVar12->Name[0]; + cVar6 = pTVar12->Name[1]; + pTVar10->ID = pTVar12->ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + pTVar12 = (THouse *)(pTVar12->Name + 2); + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + uVar8 = 0x338; + pTVar10 = this->entry + (iVar11 - this->start); + piVar7 = &extend; + if (((uint)pTVar10 & 4) != 0) { + piVar7 = (int *)Help; + pTVar10->ID = (undefined2)extend; + pTVar10->Name[0] = extend._2_1_; + pTVar10->Name[1] = extend._3_1_; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + iVar14 = *piVar7; + pTVar10->ID = (short)iVar14; + pTVar10->Name[0] = (char)((uint)iVar14 >> 0x10); + pTVar10->Name[1] = (char)((uint)iVar14 >> 0x18); + piVar7 = piVar7 + 1; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + iVar11 = iVar11 + 1; + } while (iVar11 <= this->max); + } + pTVar10 = this->entry; + if (pTVar10 != (THouse *)0x0) { + pTVar12 = pTVar10 + pTVar10[-1].Help; + while (pTVar10 != pTVar12) { + pTVar1 = pTVar12[-1].Guest.entry; + if (pTVar1 != (THouseGuest *)0x0) { + operator_delete__(pTVar1); + } + pTVar1 = pTVar12[-1].Subowner.entry; + if (pTVar1 == (THouseGuest *)0x0) { + pTVar10 = this->entry; + pTVar12 = pTVar12 + -1; + } + else { + operator_delete__(pTVar1); + pTVar10 = this->entry; + pTVar12 = pTVar12 + -1; + } + } + operator_delete__(&pTVar10[-1].Help); + } + this->entry = pTVar13; + iVar11 = this->start - local_360; + this->start = iVar11; + this->space = this->space + local_360; + } + iVar9 = this->space; + iVar14 = iVar9 + iVar11; + while (iVar14 <= i) { + iVar11 = iVar9; + if (this->block != 0) { + iVar11 = this->block; + } + iVar9 = iVar11 + iVar9; + piVar7 = (int *)operator_new__(iVar9 * 0x338 + 4); + pTVar13 = (THouse *)(piVar7 + 1); + *piVar7 = iVar9; + pTVar10 = pTVar13; + while (iVar9 = iVar9 + -1, iVar9 != -1) { + // try { // try from 080677ef to 080677f3 has its CatchHandler @ 08067c08 + vector<>::vector(&pTVar10->Subowner,0,4,5); + // try { // try from 08067815 to 08067819 has its CatchHandler @ 08067b6c + vector<>::vector(&pTVar10->Guest,0,9,10); + pTVar10 = pTVar10 + 1; + } + iVar14 = this->min; + if (iVar14 <= this->max) { + do { + piVar7 = &extend; + pTVar10 = pTVar13 + (iVar14 - this->start); + uVar8 = 0x338; + if (((uint)&extend & 4) != 0) { + puVar2 = &pTVar10->ID; + pcVar3 = pTVar10->Name; + pcVar4 = pTVar10->Name; + piVar7 = (int *)Help; + pTVar10 = (THouse *)(pTVar10->Name + 2); + extend._0_2_ = *puVar2; + extend._2_1_ = pcVar3[0]; + extend._3_1_ = pcVar4[1]; + uVar8 = 0x334; + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + *piVar7 = *(int *)pTVar10; + pTVar10 = (THouse *)(pTVar10->Name + 2); + piVar7 = piVar7 + 1; + } + iVar9 = iVar14 - this->start; + pTVar10 = pTVar13 + iVar9; + pTVar12 = this->entry + iVar9; + uVar8 = 0x338; + if (((uint)pTVar10 & 4) != 0) { + puVar2 = &pTVar12->ID; + cVar5 = pTVar12->Name[0]; + cVar6 = pTVar12->Name[1]; + pTVar12 = (THouse *)(pTVar12->Name + 2); + pTVar10->ID = *puVar2; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + cVar5 = pTVar12->Name[0]; + cVar6 = pTVar12->Name[1]; + pTVar10->ID = pTVar12->ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + pTVar12 = (THouse *)(pTVar12->Name + 2); + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + uVar8 = 0x338; + pTVar10 = this->entry + (iVar14 - this->start); + piVar7 = &extend; + if (((uint)pTVar10 & 4) != 0) { + piVar7 = (int *)Help; + pTVar10->ID = (undefined2)extend; + pTVar10->Name[0] = extend._2_1_; + pTVar10->Name[1] = extend._3_1_; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + iVar9 = *piVar7; + pTVar10->ID = (short)iVar9; + pTVar10->Name[0] = (char)((uint)iVar9 >> 0x10); + pTVar10->Name[1] = (char)((uint)iVar9 >> 0x18); + piVar7 = piVar7 + 1; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + iVar14 = iVar14 + 1; + } while (iVar14 <= this->max); + } + pTVar10 = this->entry; + if (pTVar10 != (THouse *)0x0) { + pTVar12 = pTVar10 + pTVar10[-1].Help; + while (pTVar10 != pTVar12) { + pTVar1 = pTVar12[-1].Guest.entry; + if (pTVar1 != (THouseGuest *)0x0) { + operator_delete__(pTVar1); + } + pTVar1 = pTVar12[-1].Subowner.entry; + if (pTVar1 == (THouseGuest *)0x0) { + pTVar10 = this->entry; + pTVar12 = pTVar12 + -1; + } + else { + operator_delete__(pTVar1); + pTVar10 = this->entry; + pTVar12 = pTVar12 + -1; + } + } + operator_delete__(&pTVar10[-1].Help); + } + this->entry = pTVar13; + iVar9 = iVar11 + this->space; + iVar11 = this->start; + this->space = iVar9; + iVar14 = iVar9 + iVar11; + } + iVar14 = this->min; + while (i < iVar14) { + this->min = iVar14 + -1; + if (this->initialized != false) { + pTVar13 = &this->init; + uVar8 = 0x338; + pTVar10 = this->entry + ((iVar14 + -1) - iVar11); + if (((uint)pTVar10 & 4) != 0) { + cVar5 = (this->init).Name[0]; + cVar6 = (this->init).Name[1]; + pTVar13 = (THouse *)((this->init).Name + 2); + pTVar10->ID = (this->init).ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + cVar5 = pTVar13->Name[0]; + cVar6 = pTVar13->Name[1]; + pTVar10->ID = pTVar13->ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + pTVar13 = (THouse *)(pTVar13->Name + 2); + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + iVar11 = this->start; + } + iVar14 = this->min; + } + iVar14 = this->max; + while (iVar14 < i) { + this->max = iVar14 + 1; + if (this->initialized != false) { + pTVar13 = &this->init; + pTVar10 = this->entry + ((iVar14 + 1) - iVar11); + uVar8 = 0x338; + if (((uint)pTVar10 & 4) != 0) { + cVar5 = (this->init).Name[0]; + cVar6 = (this->init).Name[1]; + pTVar13 = (THouse *)((this->init).Name + 2); + pTVar10->ID = (this->init).ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + uVar8 = 0x334; + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + for (uVar8 = uVar8 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) { + cVar5 = pTVar13->Name[0]; + cVar6 = pTVar13->Name[1]; + pTVar10->ID = pTVar13->ID; + pTVar10->Name[0] = cVar5; + pTVar10->Name[1] = cVar6; + pTVar13 = (THouse *)(pTVar13->Name + 2); + pTVar10 = (THouse *)(pTVar10->Name + 2); + } + iVar11 = this->start; + } + iVar14 = this->max; + } + return this->entry + (i - iVar11); +} + + + +// DWARF original prototype: THouseGuest * operator()(vector * this, int i) + +THouseGuest * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + undefined4 uVar1; + undefined4 uVar2; + undefined4 uVar3; + undefined4 uVar4; + undefined4 uVar5; + undefined4 uVar6; + undefined4 uVar7; + undefined4 uVar8; + undefined4 uVar9; + undefined4 uVar10; + undefined4 uVar11; + undefined4 uVar12; + undefined4 uVar13; + undefined4 uVar14; + undefined4 uVar15; + THouseGuest *pTVar16; + THouseGuest *pTVar17; + int iVar18; + int iVar19; + THouseGuest *help_1; + int iVar20; + THouseGuest *help; + int iVar21; + int j; + int local_60; + int extend; + uchar Help [60]; + + iVar19 = this->start; + while (i < iVar19) { + local_60 = this->block; + if (local_60 == 0) { + iVar19 = this->space; + local_60 = iVar19; + } + else { + iVar19 = this->space; + } + pTVar17 = (THouseGuest *)operator_new__((iVar19 + local_60) * 0x3c); + iVar19 = this->min; + if (iVar19 <= this->max) { + do { + iVar18 = (iVar19 - this->start) + local_60; + uVar1 = *(undefined4 *)pTVar17[iVar18].Name; + uVar2 = *(undefined4 *)(pTVar17[iVar18].Name + 4); + uVar3 = *(undefined4 *)(pTVar17[iVar18].Name + 8); + uVar4 = *(undefined4 *)(pTVar17[iVar18].Name + 0xc); + uVar5 = *(undefined4 *)(pTVar17[iVar18].Name + 0x10); + uVar6 = *(undefined4 *)(pTVar17[iVar18].Name + 0x14); + uVar7 = *(undefined4 *)(pTVar17[iVar18].Name + 0x18); + uVar8 = *(undefined4 *)(pTVar17[iVar18].Name + 0x1c); + uVar9 = *(undefined4 *)(pTVar17[iVar18].Name + 0x20); + uVar10 = *(undefined4 *)(pTVar17[iVar18].Name + 0x24); + uVar11 = *(undefined4 *)(pTVar17[iVar18].Name + 0x28); + uVar12 = *(undefined4 *)(pTVar17[iVar18].Name + 0x2c); + uVar13 = *(undefined4 *)(pTVar17[iVar18].Name + 0x30); + uVar14 = *(undefined4 *)(pTVar17[iVar18].Name + 0x34); + uVar15 = *(undefined4 *)(pTVar17[iVar18].Name + 0x38); + pTVar16 = this->entry; + iVar20 = iVar19 - this->start; + iVar18 = local_60 + iVar20; + *(undefined4 *)pTVar17[iVar18].Name = *(undefined4 *)pTVar16[iVar20].Name; + *(undefined4 *)(pTVar17[iVar18].Name + 4) = + *(undefined4 *)(pTVar16[iVar20].Name + 4); + *(undefined4 *)(pTVar17[iVar18].Name + 8) = + *(undefined4 *)(pTVar16[iVar20].Name + 8); + *(undefined4 *)(pTVar17[iVar18].Name + 0xc) = + *(undefined4 *)(pTVar16[iVar20].Name + 0xc); + *(undefined4 *)(pTVar17[iVar18].Name + 0x10) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x10); + *(undefined4 *)(pTVar17[iVar18].Name + 0x14) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x14); + *(undefined4 *)(pTVar17[iVar18].Name + 0x18) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x18); + *(undefined4 *)(pTVar17[iVar18].Name + 0x1c) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x1c); + *(undefined4 *)(pTVar17[iVar18].Name + 0x20) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x20); + *(undefined4 *)(pTVar17[iVar18].Name + 0x24) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x24); + *(undefined4 *)(pTVar17[iVar18].Name + 0x28) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x28); + *(undefined4 *)(pTVar17[iVar18].Name + 0x2c) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x2c); + *(undefined4 *)(pTVar17[iVar18].Name + 0x30) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x30); + *(undefined4 *)(pTVar17[iVar18].Name + 0x34) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x34); + *(undefined4 *)(pTVar17[iVar18].Name + 0x38) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x38); + iVar18 = iVar19 + 1; + iVar19 = iVar19 - this->start; + pTVar16 = this->entry; + *(undefined4 *)pTVar16[iVar19].Name = uVar1; + *(undefined4 *)(pTVar16[iVar19].Name + 4) = uVar2; + *(undefined4 *)(pTVar16[iVar19].Name + 8) = uVar3; + *(undefined4 *)(pTVar16[iVar19].Name + 0xc) = uVar4; + *(undefined4 *)(pTVar16[iVar19].Name + 0x10) = uVar5; + *(undefined4 *)(pTVar16[iVar19].Name + 0x14) = uVar6; + *(undefined4 *)(pTVar16[iVar19].Name + 0x18) = uVar7; + *(undefined4 *)(pTVar16[iVar19].Name + 0x1c) = uVar8; + *(undefined4 *)(pTVar16[iVar19].Name + 0x20) = uVar9; + *(undefined4 *)(pTVar16[iVar19].Name + 0x24) = uVar10; + *(undefined4 *)(pTVar16[iVar19].Name + 0x28) = uVar11; + *(undefined4 *)(pTVar16[iVar19].Name + 0x2c) = uVar12; + *(undefined4 *)(pTVar16[iVar19].Name + 0x30) = uVar13; + *(undefined4 *)(pTVar16[iVar19].Name + 0x34) = uVar14; + *(undefined4 *)(pTVar16[iVar19].Name + 0x38) = uVar15; + iVar19 = iVar18; + } while (iVar18 <= this->max); + } + if (this->entry != (THouseGuest *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar17; + iVar19 = this->start - local_60; + this->start = iVar19; + this->space = this->space + local_60; + } + iVar20 = this->space; + iVar18 = iVar20 + iVar19; + while (iVar18 <= i) { + iVar18 = this->block; + if (this->block == 0) { + iVar18 = iVar20; + } + pTVar17 = (THouseGuest *)operator_new__((iVar20 + iVar18) * 0x3c); + iVar19 = this->min; + if (this->min <= this->max) { + do { + iVar20 = iVar19 - this->start; + uVar1 = *(undefined4 *)pTVar17[iVar20].Name; + uVar2 = *(undefined4 *)(pTVar17[iVar20].Name + 4); + uVar3 = *(undefined4 *)(pTVar17[iVar20].Name + 8); + uVar4 = *(undefined4 *)(pTVar17[iVar20].Name + 0xc); + uVar5 = *(undefined4 *)(pTVar17[iVar20].Name + 0x10); + uVar6 = *(undefined4 *)(pTVar17[iVar20].Name + 0x14); + uVar7 = *(undefined4 *)(pTVar17[iVar20].Name + 0x18); + uVar8 = *(undefined4 *)(pTVar17[iVar20].Name + 0x1c); + uVar9 = *(undefined4 *)(pTVar17[iVar20].Name + 0x20); + uVar10 = *(undefined4 *)(pTVar17[iVar20].Name + 0x24); + uVar11 = *(undefined4 *)(pTVar17[iVar20].Name + 0x28); + uVar12 = *(undefined4 *)(pTVar17[iVar20].Name + 0x2c); + uVar13 = *(undefined4 *)(pTVar17[iVar20].Name + 0x30); + uVar14 = *(undefined4 *)(pTVar17[iVar20].Name + 0x34); + uVar15 = *(undefined4 *)(pTVar17[iVar20].Name + 0x38); + iVar20 = iVar19 - this->start; + pTVar16 = this->entry; + *(undefined4 *)pTVar17[iVar20].Name = *(undefined4 *)pTVar16[iVar20].Name; + *(undefined4 *)(pTVar17[iVar20].Name + 4) = + *(undefined4 *)(pTVar16[iVar20].Name + 4); + *(undefined4 *)(pTVar17[iVar20].Name + 8) = + *(undefined4 *)(pTVar16[iVar20].Name + 8); + *(undefined4 *)(pTVar17[iVar20].Name + 0xc) = + *(undefined4 *)(pTVar16[iVar20].Name + 0xc); + *(undefined4 *)(pTVar17[iVar20].Name + 0x10) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x10); + *(undefined4 *)(pTVar17[iVar20].Name + 0x14) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x14); + *(undefined4 *)(pTVar17[iVar20].Name + 0x18) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x18); + *(undefined4 *)(pTVar17[iVar20].Name + 0x1c) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x1c); + *(undefined4 *)(pTVar17[iVar20].Name + 0x20) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x20); + *(undefined4 *)(pTVar17[iVar20].Name + 0x24) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x24); + *(undefined4 *)(pTVar17[iVar20].Name + 0x28) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x28); + *(undefined4 *)(pTVar17[iVar20].Name + 0x2c) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x2c); + *(undefined4 *)(pTVar17[iVar20].Name + 0x30) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x30); + *(undefined4 *)(pTVar17[iVar20].Name + 0x34) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x34); + iVar21 = iVar19 + 1; + *(undefined4 *)(pTVar17[iVar20].Name + 0x38) = + *(undefined4 *)(pTVar16[iVar20].Name + 0x38); + iVar19 = iVar19 - this->start; + pTVar16 = this->entry; + *(undefined4 *)pTVar16[iVar19].Name = uVar1; + *(undefined4 *)(pTVar16[iVar19].Name + 4) = uVar2; + *(undefined4 *)(pTVar16[iVar19].Name + 8) = uVar3; + *(undefined4 *)(pTVar16[iVar19].Name + 0xc) = uVar4; + *(undefined4 *)(pTVar16[iVar19].Name + 0x10) = uVar5; + *(undefined4 *)(pTVar16[iVar19].Name + 0x14) = uVar6; + *(undefined4 *)(pTVar16[iVar19].Name + 0x18) = uVar7; + *(undefined4 *)(pTVar16[iVar19].Name + 0x1c) = uVar8; + *(undefined4 *)(pTVar16[iVar19].Name + 0x20) = uVar9; + *(undefined4 *)(pTVar16[iVar19].Name + 0x24) = uVar10; + *(undefined4 *)(pTVar16[iVar19].Name + 0x28) = uVar11; + *(undefined4 *)(pTVar16[iVar19].Name + 0x2c) = uVar12; + *(undefined4 *)(pTVar16[iVar19].Name + 0x30) = uVar13; + *(undefined4 *)(pTVar16[iVar19].Name + 0x34) = uVar14; + *(undefined4 *)(pTVar16[iVar19].Name + 0x38) = uVar15; + iVar19 = iVar21; + } while (iVar21 <= this->max); + } + if (this->entry != (THouseGuest *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar17; + iVar19 = this->start; + iVar20 = this->space + iVar18; + this->space = iVar20; + iVar18 = iVar20 + iVar19; + } + iVar18 = this->min; + while (i < iVar18) { + this->min = iVar18 + -1; + if (this->initialized != false) { + iVar19 = (iVar18 + -1) - iVar19; + pTVar17 = this->entry; + *(undefined4 *)pTVar17[iVar19].Name = *(undefined4 *)(this->init).Name; + *(undefined4 *)(pTVar17[iVar19].Name + 4) = *(undefined4 *)((this->init).Name + 4); + *(undefined4 *)(pTVar17[iVar19].Name + 8) = *(undefined4 *)((this->init).Name + 8); + *(undefined4 *)(pTVar17[iVar19].Name + 0xc) = *(undefined4 *)((this->init).Name + 0xc); + *(undefined4 *)(pTVar17[iVar19].Name + 0x10) = *(undefined4 *)((this->init).Name + 0x10) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x14) = *(undefined4 *)((this->init).Name + 0x14) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x18) = *(undefined4 *)((this->init).Name + 0x18) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x1c) = *(undefined4 *)((this->init).Name + 0x1c) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x20) = *(undefined4 *)((this->init).Name + 0x20) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x24) = *(undefined4 *)((this->init).Name + 0x24) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x28) = *(undefined4 *)((this->init).Name + 0x28) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x2c) = *(undefined4 *)((this->init).Name + 0x2c) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x30) = *(undefined4 *)((this->init).Name + 0x30) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x34) = *(undefined4 *)((this->init).Name + 0x34) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x38) = *(undefined4 *)((this->init).Name + 0x38) + ; + iVar19 = this->start; + } + iVar18 = this->min; + } + iVar18 = this->max; + while (iVar18 < i) { + this->max = iVar18 + 1; + if (this->initialized != false) { + iVar19 = (iVar18 + 1) - iVar19; + pTVar17 = this->entry; + *(undefined4 *)pTVar17[iVar19].Name = *(undefined4 *)(this->init).Name; + *(undefined4 *)(pTVar17[iVar19].Name + 4) = *(undefined4 *)((this->init).Name + 4); + *(undefined4 *)(pTVar17[iVar19].Name + 8) = *(undefined4 *)((this->init).Name + 8); + *(undefined4 *)(pTVar17[iVar19].Name + 0xc) = *(undefined4 *)((this->init).Name + 0xc); + *(undefined4 *)(pTVar17[iVar19].Name + 0x10) = *(undefined4 *)((this->init).Name + 0x10) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x14) = *(undefined4 *)((this->init).Name + 0x14) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x18) = *(undefined4 *)((this->init).Name + 0x18) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x1c) = *(undefined4 *)((this->init).Name + 0x1c) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x20) = *(undefined4 *)((this->init).Name + 0x20) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x24) = *(undefined4 *)((this->init).Name + 0x24) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x28) = *(undefined4 *)((this->init).Name + 0x28) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x2c) = *(undefined4 *)((this->init).Name + 0x2c) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x30) = *(undefined4 *)((this->init).Name + 0x30) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x34) = *(undefined4 *)((this->init).Name + 0x34) + ; + *(undefined4 *)(pTVar17[iVar19].Name + 0x38) = *(undefined4 *)((this->init).Name + 0x38) + ; + iVar19 = this->start; + } + iVar18 = this->max; + } + return this->entry + (i - iVar19); +} + + + +// DWARF original prototype: THelpDepot * operator()(vector * this, int i) + +THelpDepot * __thiscall vector::operator()(vector *this,int i) + +{ + ulong uVar1; + ulong uVar2; + THelpDepot *pTVar3; + int iVar4; + int iVar5; + int iVar6; + int iVar7; + THelpDepot *pTVar8; + int j_1; + int j; + int extend_1; + int local_40; + int extend; + uchar Help [12]; + + iVar6 = this->start; + while (i < iVar6) { + local_40 = this->block; + if (local_40 == 0) { + iVar6 = this->space; + local_40 = iVar6; + } + else { + iVar6 = this->space; + } + iVar6 = local_40 + iVar6; + pTVar3 = (THelpDepot *)operator_new__(iVar6 * 0xc); + pTVar8 = pTVar3; + while (iVar6 = iVar6 + -1, iVar6 != -1) { + (pTVar8->Box).ObjectID = 0; + pTVar8 = pTVar8 + 1; + } + iVar6 = this->min; + if (iVar6 <= this->max) { + do { + iVar4 = (iVar6 - this->start) + local_40; + uVar1 = pTVar3[iVar4].CharacterID; + uVar2 = pTVar3[iVar4].Box.ObjectID; + iVar7 = pTVar3[iVar4].DepotNr; + iVar5 = iVar6 - this->start; + iVar4 = local_40 + iVar5; + pTVar8 = this->entry; + pTVar3[iVar4].CharacterID = pTVar8[iVar5].CharacterID; + pTVar3[iVar4].Box.ObjectID = pTVar8[iVar5].Box.ObjectID; + pTVar3[iVar4].DepotNr = pTVar8[iVar5].DepotNr; + iVar4 = iVar6 + 1; + iVar6 = iVar6 - this->start; + pTVar8 = this->entry; + pTVar8[iVar6].CharacterID = uVar1; + pTVar8[iVar6].Box.ObjectID = uVar2; + pTVar8[iVar6].DepotNr = iVar7; + iVar6 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (THelpDepot *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar3; + iVar6 = this->start - local_40; + this->start = iVar6; + this->space = this->space + local_40; + } + iVar7 = this->space; + iVar4 = iVar7 + iVar6; + while (iVar4 <= i) { + iVar4 = this->block; + if (this->block == 0) { + iVar4 = iVar7; + } + iVar7 = iVar4 + iVar7; + pTVar3 = (THelpDepot *)operator_new__(iVar7 * 0xc); + pTVar8 = pTVar3; + while (iVar7 = iVar7 + -1, iVar7 != -1) { + (pTVar8->Box).ObjectID = 0; + pTVar8 = pTVar8 + 1; + } + iVar6 = this->min; + if (iVar6 <= this->max) { + do { + iVar7 = iVar6 - this->start; + uVar1 = pTVar3[iVar7].CharacterID; + uVar2 = pTVar3[iVar7].Box.ObjectID; + iVar7 = pTVar3[iVar7].DepotNr; + pTVar8 = this->entry; + iVar5 = iVar6 - this->start; + pTVar3[iVar5].CharacterID = pTVar8[iVar5].CharacterID; + pTVar3[iVar5].Box.ObjectID = pTVar8[iVar5].Box.ObjectID; + pTVar3[iVar5].DepotNr = pTVar8[iVar5].DepotNr; + iVar5 = iVar6 + 1; + pTVar8 = this->entry; + iVar6 = iVar6 - this->start; + pTVar8[iVar6].CharacterID = uVar1; + pTVar8[iVar6].Box.ObjectID = uVar2; + pTVar8[iVar6].DepotNr = iVar7; + iVar6 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (THelpDepot *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar3; + iVar6 = this->start; + iVar7 = this->space + iVar4; + this->space = iVar7; + iVar4 = iVar7 + iVar6; + } + iVar4 = this->min; + while (i < iVar4) { + this->min = iVar4 + -1; + if (this->initialized != false) { + pTVar8 = this->entry + ((iVar4 + -1) - iVar6); + pTVar8->CharacterID = (this->init).CharacterID; + (pTVar8->Box).ObjectID = (this->init).Box.ObjectID; + pTVar8->DepotNr = (this->init).DepotNr; + iVar6 = this->start; + } + iVar4 = this->min; + } + iVar4 = this->max; + while (iVar4 < i) { + this->max = iVar4 + 1; + if (this->initialized != false) { + pTVar8 = this->entry + ((iVar4 + 1) - iVar6); + pTVar8->CharacterID = (this->init).CharacterID; + (pTVar8->Box).ObjectID = (this->init).Box.ObjectID; + pTVar8->DepotNr = (this->init).DepotNr; + iVar6 = this->start; + } + iVar4 = this->max; + } + return this->entry + (i - iVar6); +} + + + +void * ThreadStarter(void *Pointer) + +{ + char cVar1; + code *pcVar2; + undefined4 *__retval; + undefined4 uVar3; + bool Detach; + void *Argument; + undefined1 *Function; + + // WARNING: Load size is inaccurate + pcVar2 = *Pointer; + uVar3 = *(undefined4 *)((int)Pointer + 4); + cVar1 = *(char *)((int)Pointer + 8); + operator_delete(Pointer); + if (cVar1 == '\0') { + __retval = (undefined4 *)operator_new(4); + uVar3 = (*pcVar2)(uVar3); + *__retval = uVar3; + } + else { + (*pcVar2)(uVar3); + __retval = (undefined4 *)0x0; + } + // WARNING: Subroutine does not return + pthread_exit(__retval); +} + + + +// WARNING: Variable defined which should be unmapped: thread + +Thread StartThread(undefined1 *Function,void *Argument,bool Detach) + +{ + TThreadStarter *Starter; + undefined4 *__arg; + int iVar1; + Thread TStack_c; + bool Detach_local; + pthread_t thread; + + __arg = (undefined4 *)operator_new(0xc); + *__arg = Function; + *(bool *)(__arg + 2) = Detach; + __arg[1] = Argument; + iVar1 = pthread_create(&stack0xfffffff4,(pthread_attr_t *)0x0,ThreadStarter,__arg); + if (iVar1 == 0) { + if (Detach) { + pthread_detach(TStack_c); + } + } + else { + error("StartThread: Kann Thread nicht anlegen; Fehlercode %d.\n",iVar1); + TStack_c = 0; + } + return TStack_c; +} + + + +Thread StartThread(undefined1 *Function,void *Argument,size_t StackSize,bool Detach) + +{ + undefined4 *__arg; + int iVar1; + TThreadStarter *Starter; + Thread TStack_40; + bool Detach_local; + pthread_t thread; + pthread_attr_t Attributes; + + __arg = (undefined4 *)operator_new(0xc); + *__arg = Function; + *(bool *)(__arg + 2) = Detach; + __arg[1] = Argument; + pthread_attr_init((pthread_attr_t *)&thread); + pthread_attr_setstacksize((pthread_attr_t *)&thread,StackSize); + iVar1 = pthread_create(&stack0xffffffc0,(pthread_attr_t *)&thread,ThreadStarter,__arg); + pthread_attr_destroy((pthread_attr_t *)&thread); + if (iVar1 == 0) { + if (Detach) { + pthread_detach(TStack_40); + } + } + else { + error("StartThread: Kann Thread nicht anlegen; Fehlercode %d.\n",iVar1); + TStack_40 = 0; + } + return TStack_40; +} + + + +Thread StartThread(undefined1 *Function,void *Argument,void *Stack,size_t StackSize,bool Detach) + +{ + undefined4 *__arg; + int iVar1; + TThreadStarter *Starter; + Thread TStack_40; + bool Detach_local; + pthread_t thread; + pthread_attr_t Attributes; + + __arg = (undefined4 *)operator_new(0xc); + *__arg = Function; + *(bool *)(__arg + 2) = Detach; + __arg[1] = Argument; + pthread_attr_init((pthread_attr_t *)&thread); + pthread_attr_setstack((pthread_attr_t *)&thread,Stack,StackSize); + iVar1 = pthread_create(&stack0xffffffc0,(pthread_attr_t *)&thread,ThreadStarter,__arg); + pthread_attr_destroy((pthread_attr_t *)&thread); + if (iVar1 == 0) { + if (Detach) { + pthread_detach(TStack_40); + } + } + else { + error("StartThread: Kann Thread nicht anlegen; Fehlercode %d.\n",iVar1); + TStack_40 = 0; + } + return TStack_40; +} + + + +void DelayThread(int Seconds,int MicroSeconds) + +{ + if (Seconds == 0) { + if (MicroSeconds == 0) { + sched_yield(); + return; + } + } + else if (MicroSeconds == 0) { + sleep(Seconds); + return; + } + usleep(MicroSeconds + Seconds * 1000000); + return; +} + + + +// WARNING: Variable defined which should be unmapped: result + +int JoinThread(Thread OtherThread) + +{ + int iVar1; + int value; + int *local_c; + int *result; + + local_c = (int *)0x0; + pthread_join(OtherThread,&local_c); + iVar1 = 0; + if (local_c != (int *)0x0) { + iVar1 = *local_c; + operator_delete(local_c); + } + return iVar1; +} + + + +// DWARF original prototype: void Semaphore(Semaphore * this, int initValue) + +void __thiscall Semaphore::Semaphore(Semaphore *this,int initValue) + +{ + int iVar1; + + this->value = initValue; + iVar1 = pthread_mutex_init((pthread_mutex_t *)&this->mutex,(pthread_mutexattr_t *)0x0); + if (iVar1 == -1) { + this = (Semaphore *)s_Semaphore__Semaphore__Kann_Mutex_080f50a0; + } + else { + iVar1 = pthread_cond_init((pthread_cond_t *)&this->condition,(pthread_condattr_t *)0x0); + if (iVar1 != -1) { + return; + } + this = (Semaphore *)s_Semaphore__Semaphore__Kann_Warte_080f5060; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: void Semaphore(Semaphore * this, int initValue) + +void __thiscall Semaphore::Semaphore(Semaphore *this,int initValue) + +{ + int iVar1; + + this->value = initValue; + iVar1 = pthread_mutex_init((pthread_mutex_t *)&this->mutex,(pthread_mutexattr_t *)0x0); + if (iVar1 == -1) { + this = (Semaphore *)s_Semaphore__Semaphore__Kann_Mutex_080f50a0; + } + else { + iVar1 = pthread_cond_init((pthread_cond_t *)&this->condition,(pthread_condattr_t *)0x0); + if (iVar1 != -1) { + return; + } + this = (Semaphore *)s_Semaphore__Semaphore__Kann_Warte_080f5060; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: void ~Semaphore(Semaphore * this, int __in_chrg) + +void __thiscall Semaphore::~Semaphore(Semaphore *this,int __in_chrg) + +{ + int iVar1; + + iVar1 = pthread_mutex_destroy((pthread_mutex_t *)&this->mutex); + if (iVar1 == -1) { + this = (Semaphore *)s_Semaphore___Semaphore__Kann_Mute_080f5120; + } + else { + iVar1 = pthread_cond_destroy((pthread_cond_t *)&this->condition); + if (iVar1 != -1) { + return; + } + this = (Semaphore *)s_Semaphore___Semaphore__Kann_Wart_080f50e0; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: void ~Semaphore(Semaphore * this, int __in_chrg) + +void __thiscall Semaphore::~Semaphore(Semaphore *this,int __in_chrg) + +{ + int iVar1; + + iVar1 = pthread_mutex_destroy((pthread_mutex_t *)&this->mutex); + if (iVar1 == -1) { + this = (Semaphore *)s_Semaphore___Semaphore__Kann_Mute_080f5120; + } + else { + iVar1 = pthread_cond_destroy((pthread_cond_t *)&this->condition); + if (iVar1 != -1) { + return; + } + this = (Semaphore *)s_Semaphore___Semaphore__Kann_Wart_080f50e0; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: void down(Semaphore * this) + +void __thiscall Semaphore::down(Semaphore *this) + +{ + pthread_mutex_t *__mutex; + int iVar1; + + __mutex = &this->mutex; + pthread_mutex_lock((pthread_mutex_t *)__mutex); + iVar1 = this->value; + if (iVar1 < 1) { + do { + pthread_cond_wait((pthread_cond_t *)&this->condition,(pthread_mutex_t *)__mutex); + iVar1 = this->value; + } while (iVar1 < 1); + } + this->value = iVar1 + -1; + pthread_mutex_unlock((pthread_mutex_t *)__mutex); + return; +} + + + +// DWARF original prototype: void up(Semaphore * this) + +void __thiscall Semaphore::up(Semaphore *this) + +{ + pthread_mutex_lock((pthread_mutex_t *)&this->mutex); + this->value = this->value + 1; + pthread_mutex_unlock((pthread_mutex_t *)&this->mutex); + pthread_cond_signal((pthread_cond_t *)&this->condition); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + Semaphore::Semaphore(&ProtocolMutex,1); + __cxa_atexit(__tcf_0,0,&__dso_handle); + Semaphore::Semaphore(&ProtocolBufferEmpty,1000); + __cxa_atexit(__tcf_1,0,&__dso_handle); + Semaphore::Semaphore(&ProtocolBufferFull,0); + __cxa_atexit(__tcf_2,0,&__dso_handle); + Semaphore::Semaphore(&OrderBufferEmpty,2000); + __cxa_atexit(__tcf_3,0,&__dso_handle); + Semaphore::Semaphore(&OrderBufferFull,0); + __cxa_atexit(__tcf_4,0,&__dso_handle); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitProtocol(void) + +{ + ProtocolPointerWrite = 0; + ProtocolPointerRead = 0; + return; +} + + + +// WARNING: Variable defined which should be unmapped: Text_local + +void InsertProtocolOrder(char *ProtocolName,char *Text) + +{ + int iVar1; + char *pcVar2; + char *pcVar3; + bool bVar4; + char *Text_local; + + if (ProtocolName == (char *)0x0) { + ProtocolName = "InsertProtocolOrder: Protokoll-Name nicht angegeben.\n"; + } + else { + if (Text != (char *)0x0) { + bVar4 = ProtocolPointerWrite - ProtocolPointerRead == 999; + if (999 < ProtocolPointerWrite - ProtocolPointerRead) { + iVar1 = 6; + pcVar2 = ProtocolName; + pcVar3 = "error"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = *pcVar2 == *pcVar3; + pcVar2 = pcVar2 + 1; + pcVar3 = pcVar3 + 1; + } while (bVar4); + if (!bVar4) { + error(&DAT_080f5260); + } + } + Semaphore::down(&ProtocolMutex); + Semaphore::down(&ProtocolBufferEmpty); + strcpy(ProtocolBuffer[ProtocolPointerWrite % 1000].ProtocolName,ProtocolName); + strcpy(ProtocolBuffer[ProtocolPointerWrite % 1000].Text,Text); + ProtocolPointerWrite = ProtocolPointerWrite + 1; + Semaphore::up(&ProtocolBufferFull); + Semaphore::up(&ProtocolMutex); + return; + } + ProtocolName = "InsertProtocolOrder: Text nicht angegeben.\n"; + } + error(ProtocolName); + return; +} + + + +void GetProtocolOrder(char *ProtocolName,char *Text) + +{ + Semaphore::down(&ProtocolBufferFull); + strcpy(ProtocolName,ProtocolBuffer[ProtocolPointerRead % 1000].ProtocolName); + strcpy(Text,ProtocolBuffer[ProtocolPointerRead % 1000].Text); + ProtocolPointerRead = ProtocolPointerRead + 1; + Semaphore::up(&ProtocolBufferEmpty); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void WriteProtocol(void) + +{ + FILE *__stream; + int iVar1; + int *piVar2; + FILE *f; + undefined4 in_stack_00000008; + char local_100c [4]; + char FileName [4096]; + + sprintf(local_100c,"%s/%s.log",LOGPATH); + __stream = fopen(local_100c,"at"); + if (__stream != (FILE *)0x0) { + fprintf(__stream,"%s",in_stack_00000008); + iVar1 = fclose(__stream); + if (iVar1 != 0) { + piVar2 = __errno_location(); + error(&DAT_080f5320,*piVar2); + } + } + return; +} + + + +int ProtocolThreadLoop(void *param_1) + +{ + FILE *__stream; + int iVar1; + int *piVar2; + int iVar3; + FILE *f; + undefined8 local_1144; + char local_113c [4]; + char FileName [4096]; + char Text [256]; + char ProtocolName [20]; + + while( true ) { + Semaphore::down(&ProtocolBufferFull); + iVar1 = ProtocolPointerRead; + iVar3 = ProtocolPointerRead >> 0x1f; + strcpy(Text + 0xfc, + ProtocolBuffer[ProtocolPointerRead + ((local_1144._4_4_ >> 6) - iVar3) * -1000]. + ProtocolName); + local_1144 = (longlong)ProtocolPointerRead * 0x10624dd3; + strcpy(FileName + 0xffc, + ProtocolBuffer + [ProtocolPointerRead + + ((iVar1 / 1000 + iVar3) - (ProtocolPointerRead >> 0x1f)) * -1000].Text); + ProtocolPointerRead = ProtocolPointerRead + 1; + Semaphore::up(&ProtocolBufferEmpty); + if (Text[0xfc] == '\0') break; + sprintf(local_113c,"%s/%s.log",LOGPATH,Text + 0xfc); + __stream = fopen(local_113c,"at"); + if (__stream != (FILE *)0x0) { + fprintf(__stream,"%s",FileName + 0xffc); + iVar1 = fclose(__stream); + if (iVar1 != 0) { + piVar2 = __errno_location(); + error(&DAT_080f5320,*piVar2); + } + } + } + return 0; +} + + + +void InitLog(char *ProtocolName) + +{ + FILE *__stream; + char *pcVar1; + FILE *f; + time_t local_1020; + time_t Time; + char FileName [4096]; + + if (ProtocolName == (char *)0x0) { + error("InitLog: Protokoll-Name nicht angegeben.\n"); + } + else { + sprintf((char *)&Time,"%s/%s.log",LOGPATH,ProtocolName); + __stream = fopen((char *)&Time,"at"); + if (__stream == (FILE *)0x0) { + error("InitLog: Kann Protokoll %s nicht anlegen.\n",ProtocolName); + } + else { + time(&local_1020); + fprintf(__stream, + "-------------------------------------------------------------------------------\n" + ); + fprintf(__stream,"Tibia - Graphical Multi-User-Dungeon\n"); + pcVar1 = ctime(&local_1020); + fprintf(__stream,"%s.log - gestartet %s",ProtocolName,pcVar1); + fclose(__stream); + } + } + return; +} + + + +void Log(char *ProtocolName,char *Text,...) + +{ + uint *__dest; + tm *ptVar1; + FILE *__stream; + int *piVar2; + int iVar3; + uint *puVar4; + uint *puVar5; + uint uVar6; + uint uVar7; + bool WriteDate; + char *pcVar8; + char *pcVar9; + bool bVar10; + bool bVar11; + time_t local_1220; + time_t Time; + char FileName [4096]; + char Line [256]; + char Output [256]; + + if ((ProtocolName == (char *)0x0) || (*ProtocolName == '\0')) { + error("Log: Protokoll-Name nicht angegeben.\n"); + } + else { + iVar3 = 10; + bVar11 = false; + bVar10 = true; + pcVar8 = ProtocolName; + pcVar9 = "bugreport"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar10 = *pcVar8 == *pcVar9; + pcVar8 = pcVar8 + 1; + pcVar9 = pcVar9 + 1; + } while (bVar10); + if (!bVar10) { + iVar3 = 0xd; + pcVar8 = ProtocolName; + pcVar9 = "client-error"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar10 = *pcVar8 == *pcVar9; + pcVar8 = pcVar8 + 1; + pcVar9 = pcVar9 + 1; + } while (bVar10); + if (!bVar10) { + iVar3 = 5; + pcVar8 = ProtocolName; + pcVar9 = "load"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar10 = *pcVar8 == *pcVar9; + pcVar8 = pcVar8 + 1; + pcVar9 = pcVar9 + 1; + } while (bVar10); + if (!bVar10) { + bVar11 = true; + } + } + } + pcVar8 = Line + 0xfc; + vsnprintf(pcVar8,0x100,Text,&stack0x0000000c); + if (bVar11) { + print(); + time(&local_1220); + ptVar1 = localtime(&local_1220); + snprintf(FileName + 0xffc,0x100,"%02d.%02d.%04d %02d:%02d:%02d (%ld): %s", + ptVar1->tm_mday,ptVar1->tm_mon + 1,ptVar1->tm_year + 0x76c,ptVar1->tm_hour, + ptVar1->tm_min,ptVar1->tm_sec,RoundNr,pcVar8); + } + else { + strcpy(FileName + 0xffc,pcVar8); + } + __dest = (uint *)(FileName + 0xffc); + Line[0xfa] = '\0'; + puVar5 = __dest; + if (FileName[0xffc] != '\0') { + do { + puVar4 = puVar5; + uVar6 = *puVar4 + 0xfefefeff & ~*puVar4; + uVar7 = uVar6 & 0x80808080; + puVar5 = puVar4 + 1; + } while (uVar7 == 0); + bVar11 = (uVar6 & 0x8080) == 0; + if (bVar11) { + uVar7 = uVar7 >> 0x10; + } + if (bVar11) { + puVar5 = (uint *)((int)puVar4 + 6); + } + if (*(char *)((int)puVar5 + + (int)(FileName + + (-(int)__dest - (uint)CARRY1((byte)uVar7,(byte)uVar7)) + 0xff8)) != + '\n') { + strcat((char *)__dest,"\n"); + } + } + if (ProtocolThread == 0) { + sprintf((char *)&Time,"%s/%s.log",LOGPATH,ProtocolName); + __stream = fopen((char *)&Time,"at"); + if (__stream != (FILE *)0x0) { + fprintf(__stream,"%s",__dest); + iVar3 = fclose(__stream); + if (iVar3 != 0) { + piVar2 = __errno_location(); + error(&DAT_080f5320,*piVar2); + } + } + } + else { + InsertProtocolOrder(ProtocolName,(char *)__dest); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitWriterBuffers(void) + +{ + OrderPointerWrite = 0; + ReplyPointerWrite = 0; + OrderPointerRead = 0; + ReplyPointerRead = 0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetOrderBufferSpace(void) + +{ + int iVar1; + + if (WriterThread == 0) { + iVar1 = 0x7fffffff; + } + else { + iVar1 = 2000 - (OrderPointerWrite - OrderPointerRead); + } + return iVar1; +} + + + +void InsertOrder(TWriterThreadOrderType OrderType,void *Data) + +{ + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = OrderType; + OrderBuffer[OrderPointerWrite % 2000].Data = Data; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; +} + + + +void GetOrder(TWriterThreadOrderType *OrderType,void **Data) + +{ + int iVar1; + + Semaphore::down(&OrderBufferFull); + iVar1 = OrderPointerRead % 2000; + *OrderType = OrderBuffer[iVar1].OrderType; + OrderPointerRead = OrderPointerRead + 1; + *Data = OrderBuffer[iVar1].Data; + Semaphore::up(&OrderBufferEmpty); + return; +} + + + +void InsertReply(TWriterThreadReplyType ReplyType,void *Data) + +{ + if (ReplyPointerWrite - ReplyPointerRead < 100) { + ReplyBuffer[ReplyPointerWrite % 100].ReplyType = ReplyType; + ReplyBuffer[ReplyPointerWrite % 100].Data = Data; + ReplyPointerWrite = ReplyPointerWrite + 1; + return; + } + error(&DAT_080f5540); + return; +} + + + +void DirectReply(ulong CharacterID,char *Text,...) + +{ + ulong *puVar1; + TDirectReplyData *Data; + char *Text_00; + + if (CharacterID != 0) { + if (Text == (char *)0x0) { + Text_00 = "SendDirectReply: Kein Text angegeben.\n"; + } + else { + puVar1 = (ulong *)operator_new(0x68); + *puVar1 = CharacterID; + vsnprintf((char *)(puVar1 + 1),100,Text,&stack0x0000000c); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + ReplyBuffer[ReplyPointerWrite % 100].Data = puVar1; + ReplyBuffer[ReplyPointerWrite % 100].ReplyType = REPLY_DIRECT; + ReplyPointerWrite = ReplyPointerWrite + 1; + return; + } + Text_00 = &DAT_080f5540; + } + error(Text_00); + } + return; +} + + + +void LogoutReply(char *PlayerName) + +{ + int Length; + size_t sVar1; + char *__dest; + char *Buffer; + + sVar1 = strlen(PlayerName); + __dest = (char *)operator_new__(sVar1 + 1); + strcpy(__dest,PlayerName); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + ReplyBuffer[ReplyPointerWrite % 100].ReplyType = REPLY_LOGOUT; + ReplyBuffer[ReplyPointerWrite % 100].Data = __dest; + ReplyPointerWrite = ReplyPointerWrite + 1; + return; + } + error(&DAT_080f5540); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GetReply(void) + +{ + bool bVar1; + TWriterThreadReplyType *in_stack_00000004; + undefined4 *in_stack_00000008; + + bVar1 = ReplyPointerRead != ReplyPointerWrite; + if (bVar1) { + *in_stack_00000004 = ReplyBuffer[ReplyPointerRead % 100].ReplyType; + *in_stack_00000008 = ReplyBuffer[ReplyPointerRead % 100].Data; + ReplyPointerRead = ReplyPointerRead + 1; + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void TerminateWriterOrder(void) + +{ + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_TERMINATE; + OrderBuffer[OrderPointerWrite % 2000].Data = (void *)0x0; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + } + return; +} + + + +void LogoutOrder(TPlayer *Player) + +{ + int iVar1; + byte bVar2; + ulong *puVar3; + ulong uVar4; + TLogoutOrderData *Data; + + if (Player == (TPlayer *)0x0) { + error(&DAT_080f5680); + return; + } + puVar3 = (ulong *)operator_new(0x34); + *puVar3 = (Player->super_TCreature).ID; + uVar4 = TSkill::Get((Player->super_TCreature).super_TSkillBase.Skills[0]); + puVar3[1] = uVar4; + bVar2 = TPlayer::GetActiveProfession(Player); + puVar3[2] = (uint)bVar2; + if (Player->PlayerData == (TPlayerData *)0x0) { + error("LogoutOrder: PlayerData ist NULL.\n"); + puVar3[3] = 0; + } + else { + puVar3[3] = Player->PlayerData->LastLoginTime; + } + puVar3[4] = Player->TutorActivities; + iVar1 = (Player->super_TCreature).startx; + if (iVar1 == 0x7f89) { + puVar3[5] = 0x6f7a614b; + puVar3[6] = 0x6f6f6472; +LAB_080699b2: + *(undefined2 *)(puVar3 + 7) = 0x6e; + } + else { + if (iVar1 < 0x7f8a) { + if (iVar1 == 0x7e68) { + puVar3[5] = 0x6c726143; + *(undefined2 *)(puVar3 + 6) = 0x6e69; +LAB_0806990d: + *(undefined1 *)((int)puVar3 + 0x1a) = 0; + goto LAB_08069820; + } + if (iVar1 < 0x7e69) { + if (iVar1 == 0x7d61) { + puVar3[5] = 0x6b6f6f52; + puVar3[6] = 0x72616167; + *(undefined2 *)(puVar3 + 7) = 100; + goto LAB_08069820; + } + } + else { + if (iVar1 == 0x7e71) { + puVar3[5] = 0x69616854; + *(undefined2 *)(puVar3 + 6) = 0x73; + goto LAB_08069820; + } + if (iVar1 == 0x7f53) { + puVar3[5] = 0x74726f50; + puVar3[6] = 0x706f4820; + *(undefined2 *)(puVar3 + 7) = 0x65; + goto LAB_08069820; + } + } + } + else { + if (iVar1 == 0x81aa) { + puVar3[5] = 0x726b6e41; + puVar3[6] = 0x756d6861; + goto LAB_080699b2; + } + if (iVar1 < 0x81ab) { + if (iVar1 == 0x7fdc) { + puVar3[5] = 0x44276241; + puVar3[6] = 0x72646e65; + puVar3[7] = 0x6c6569; + goto LAB_08069820; + } + if (iVar1 == 0x80bd) { + puVar3[5] = 0x6f6e6556; + *(undefined2 *)(puVar3 + 6) = 0x6572; + goto LAB_0806990d; + } + } + else { + if (iVar1 == 0x81bd) { + puVar3[5] = 0x61726144; + puVar3[6] = 0x61696873; + *(undefined1 *)(puVar3 + 7) = 0; + goto LAB_08069820; + } + if (iVar1 == 0x81c1) { + puVar3[5] = 0x6f726445; + *(undefined2 *)(puVar3 + 6) = 0x6e; + goto LAB_08069820; + } + } + } + error("LogoutOrder: Unbekannte Startkoordinate [%d,%d,%d] bei Spieler %s.\n",iVar1, + (Player->super_TCreature).starty,(Player->super_TCreature).startz, + (Player->super_TCreature).Name); + puVar3[5] = 0x6e6b6e55; + puVar3[6] = 0x6e776f; + } +LAB_08069820: + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_LOGOUT; + OrderBuffer[OrderPointerWrite % 2000].Data = puVar3; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: NumberOfPlayers_local + +void PlayerlistOrder(int NumberOfPlayers,char *PlayerNames,int *PlayerLevels,int *PlayerProfessions) + +{ + int *piVar1; + TPlayerlistOrderData *Data; + int *PlayerProfessions_local; + int NumberOfPlayers_local; + + if (PlayerNames == (char *)0x0) { + NumberOfPlayers = (int)s_PlayerlistOrder__PlayerNames_ist_080f5740; + } + else if (PlayerLevels == (int *)0x0) { + NumberOfPlayers = (int)s_PlayerlistOrder__PlayerLevels_is_080f5700; + } + else { + if (PlayerProfessions != (int *)0x0) { + piVar1 = (int *)operator_new(0x10); + piVar1[1] = (int)PlayerNames; + piVar1[2] = (int)PlayerLevels; + *piVar1 = NumberOfPlayers; + piVar1[3] = (int)PlayerProfessions; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_PLAYERLIST; + OrderBuffer[OrderPointerWrite % 2000].Data = piVar1; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + NumberOfPlayers = (int)s_PlayerlistOrder__PlayerProfessio_080f56c0; + } + error((char *)NumberOfPlayers); + return; +} + + + +// WARNING: Variable defined which should be unmapped: NumberOfRaces_local + +void KillStatisticsOrder(int NumberOfRaces,char *RaceNames,int *KilledPlayers,int *KilledCreatures) + +{ + int *piVar1; + TKillStatisticsOrderData *Data; + int *KilledCreatures_local; + int NumberOfRaces_local; + + if (RaceNames == (char *)0x0) { + NumberOfRaces = (int)s_KillStatisticsOrder__RaceNames_i_080f5800; + } + else if (KilledPlayers == (int *)0x0) { + NumberOfRaces = (int)s_KillStatisticsOrder__KilledPlaye_080f57c0; + } + else { + if (KilledCreatures != (int *)0x0) { + piVar1 = (int *)operator_new(0x10); + piVar1[1] = (int)RaceNames; + piVar1[2] = (int)KilledPlayers; + *piVar1 = NumberOfRaces; + piVar1[3] = (int)KilledCreatures; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_KILLSTATISTICS; + OrderBuffer[OrderPointerWrite % 2000].Data = piVar1; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + NumberOfRaces = (int)s_KillStatisticsOrder__KilledCreat_080f5780; + } + error((char *)NumberOfRaces); + return; +} + + + +// WARNING: Variable defined which should be unmapped: IPAddress_local + +void PunishmentOrder(TCreature *cr,char *Name,char *IPAddress,int Reason,int Action,char *Comment, + int NumberOfStatements,vector<> *ReportedStatements,ulong StatementID, + bool IPBanishment) + +{ + ulong *puVar1; + ulong uVar2; + char *__src; + TPunishmentOrderData *Data; + bool IPBanishment_local; + ulong StatementID_local; + vector<> *ReportedStatements_local; + int NumberOfStatements_local; + char *Comment_local; + int Action_local; + int Reason_local; + char *IPAddress_local; + + if (Name == (char *)0x0) { + cr = (TCreature *)s_PunishmentOrder__Name_ist_NULL__080f5880; + } + else { + if (Comment != (char *)0x0) { + puVar1 = (ulong *)operator_new(0x130); + uVar2 = 0; + if (cr != (TCreature *)0x0) { + uVar2 = cr->ID; + } + *puVar1 = uVar2; + __src = "automatic"; + if (cr != (TCreature *)0x0) { + __src = cr->Name; + } + strcpy((char *)(puVar1 + 1),__src); + strcpy((char *)((int)puVar1 + 0x22),Name); + if (IPAddress == (char *)0x0) { + *(undefined1 *)(puVar1 + 0x10) = 0; + } + else { + strcpy((char *)(puVar1 + 0x10),IPAddress); + } + puVar1[0x14] = Reason; + puVar1[0x15] = Action; + strcpy((char *)(puVar1 + 0x16),Comment); + puVar1[0x48] = NumberOfStatements; + puVar1[0x49] = (ulong)ReportedStatements; + puVar1[0x4a] = StatementID; + *(bool *)(puVar1 + 0x4b) = IPBanishment; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_PUNISHMENT; + OrderBuffer[OrderPointerWrite % 2000].Data = puVar1; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + cr = (TCreature *)s_PunishmentOrder__Comment_ist_NUL_080f5840; + } + error((char *)cr); + return; +} + + + +// WARNING: Variable defined which should be unmapped: OldLevel_local + +void CharacterDeathOrder(TCreature *cr,int OldLevel,ulong Offender,char *Remark,bool Unjustified) + +{ + ulong *puVar1; + ulong uVar2; + TCharacterDeathOrderData *Data; + ulong Offender_local; + int OldLevel_local; + + if (cr == (TCreature *)0x0) { + cr = (TCreature *)s_CharacterDeathOrder__cr_ist_NULL_080f5900; + } + else { + if (Remark != (char *)0x0) { + puVar1 = (ulong *)operator_new(0x30); + *puVar1 = cr->ID; + puVar1[1] = OldLevel; + puVar1[2] = Offender; + strcpy((char *)(puVar1 + 3),Remark); + *(bool *)((int)puVar1 + 0x2a) = Unjustified; + uVar2 = time((time_t *)0x0); + puVar1[0xb] = uVar2; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_CHARACTERDEATH; + OrderBuffer[OrderPointerWrite % 2000].Data = puVar1; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + cr = (TCreature *)s_CharacterDeathOrder__Remark_ist_N_080f58c0; + } + error((char *)cr); + return; +} + + + +void AddBuddyOrder(TCreature *cr,ulong Buddy) + +{ + _func_int_varargs **pp_Var1; + undefined4 *puVar2; + TBuddyOrderData *Data; + + if (cr == (TCreature *)0x0) { + cr = (TCreature *)s_AddBuddyOrder__cr_ist_NULL__080f51a0; + } + else { + if (cr->Type == PLAYER) { + puVar2 = (undefined4 *)operator_new(8); + pp_Var1 = cr[1]._vptr_TCreature; + puVar2[1] = Buddy; + *puVar2 = pp_Var1; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_ADDBUDDY; + OrderBuffer[OrderPointerWrite % 2000].Data = puVar2; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + cr = (TCreature *)s_AddBuddyOrder__Kreatur_ist_kein_S_080f5940; + } + error((char *)cr); + return; +} + + + +void RemoveBuddyOrder(TCreature *cr,ulong Buddy) + +{ + _func_int_varargs **pp_Var1; + undefined4 *puVar2; + TBuddyOrderData *Data; + + if (cr == (TCreature *)0x0) { + cr = (TCreature *)s_RemoveBuddyOrder__cr_ist_NULL__080f59c0; + } + else { + if (cr->Type == PLAYER) { + puVar2 = (undefined4 *)operator_new(8); + pp_Var1 = cr[1]._vptr_TCreature; + puVar2[1] = Buddy; + *puVar2 = pp_Var1; + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_REMOVEBUDDY; + OrderBuffer[OrderPointerWrite % 2000].Data = puVar2; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; + } + cr = (TCreature *)s_RemoveBuddyOrder__Kreatur_ist_ke_080f5980; + } + error((char *)cr); + return; +} + + + +void DecrementIsOnlineOrder(ulong CharacterID) + +{ + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_DECREMENTISONLINE; + OrderBuffer[OrderPointerWrite % 2000].Data = (void *)CharacterID; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SavePlayerDataOrder(void) + +{ + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_SAVEPLAYERDATA; + OrderBuffer[OrderPointerWrite % 2000].Data = (void *)0x0; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: HelpProfession + +void ProcessLogoutOrder(void *RawData) + +{ + int iVar1; + undefined4 uVar2; + char *Buffer; + int iVar3; + undefined4 uVar4; + undefined4 uVar5; + char local_2c [4]; + char HelpProfession [30]; + + if (RawData == (void *)0x0) { + error(&DAT_080f5a60); + } + else { + Buffer = local_2c; + GetProfessionName(Buffer,*(int *)((int)RawData + 8),false,true); + if (0 < *(int *)((int)RawData + 0x10)) { + print(); + } + uVar5 = *(undefined4 *)((int)RawData + 0x10); + iVar3 = (int)RawData + 0x14; + uVar4 = *(undefined4 *)((int)RawData + 0xc); + uVar2 = *(undefined4 *)((int)RawData + 4); + iVar1 = TQueryManagerConnection::logoutGame(QueryManagerConnection); + if (iVar1 != 0) { + // WARNING: Load size is inaccurate + error(&DAT_080f5a20,*RawData,uVar2,Buffer,iVar3,uVar4,uVar5); + } + operator_delete(RawData); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: NewRecord + +void ProcessPlayerlistOrder(void *RawData) + +{ + bool *pbVar1; + int iVar2; + int iVar3; + int iVar4; + void *pvVar5; + uint uVar6; + int i; + int iVar7; + uint *puVar8; + int iVar9; + undefined4 uStack_40; + char *Text; + int local_24; + char_0__30_ *Professions; + int_0_ *Levels; + char___0_ *Names; + bool local_11 [4]; + bool NewRecord; + + if (RawData == (void *)0x0) { + Text = &DAT_080f5b60; +LAB_0806a54b: + uStack_40 = 0x806a550; + error(Text); + } + else { + // WARNING: Load size is inaccurate + iVar9 = *RawData; + if (iVar9 < 1) { + // WARNING: Load size is inaccurate + uStack_40 = 0x806a53c; + iVar9 = TQueryManagerConnection::createPlayerlist + (QueryManagerConnection,*RawData,(char **)0x0,(int *)0x0, + (char (*) [30])0x0,local_11); + puVar8 = (uint *)&stack0xffffffc4; + if (iVar9 != 0) { + Text = "ProcessPlayerlistOrder: Anfrage fehlgeschlagen (1).\n"; + goto LAB_0806a54b; + } + } + else { + Names = &stack0xffffffc4; + uVar6 = (iVar9 + -1) * 4 + 0x13U & 0xfffffff0; + iVar3 = uVar6 * -2; + Levels = (int_0_ *)((int)&local_24 - uVar6); + Professions = (char_0__30_ *)((int)&local_24 + iVar3); + iVar7 = 0; + iVar2 = -((iVar9 + -1) * 0x1e + 0x2dU & 0xfffffff0); + local_24 = (int)&local_24 + iVar2 + iVar3; + if (0 < iVar9) { + iVar9 = 0; + do { + *(int *)(Levels + iVar7 * 4) = *(int *)((int)RawData + 4) + iVar9; + *(undefined4 *)(Professions + iVar7 * 4) = + *(undefined4 *)(*(int *)((int)RawData + 8) + iVar7 * 4); + pbVar1 = local_11 + iVar2 + iVar3 + -0x1f; + pbVar1[0] = true; + pbVar1[1] = false; + pbVar1[2] = false; + pbVar1[3] = false; + *(undefined4 *)(&stack0xffffffcc + iVar2 + iVar3) = 0; + iVar4 = iVar7 * 4; + iVar7 = iVar7 + 1; + *(undefined4 *)(&stack0xffffffc8 + iVar2 + iVar3) = + *(undefined4 *)(*(int *)((int)RawData + 0xc) + iVar4); + iVar4 = local_24 + iVar9; + iVar9 = iVar9 + 0x1e; + *(int *)(&stack0xffffffc4 + iVar2 + iVar3) = iVar4; + *(undefined4 *)((int)&uStack_40 + iVar2 + iVar3) = 0x806a3e2; + GetProfessionName(*(char **)(&stack0xffffffc4 + iVar2 + iVar3), + *(int *)(&stack0xffffffc8 + iVar2 + iVar3), + (bool)(&stack0xffffffcc)[iVar2 + iVar3], + local_11[iVar2 + iVar3 + -0x1f]); + // WARNING: Load size is inaccurate + } while (iVar7 < *RawData); + } + *(bool **)(&stack0xffffffd8 + iVar2 + iVar3) = local_11; + *(int *)(&stack0xffffffd4 + iVar2 + iVar3) = local_24; + *(char_0__30_ **)(local_11 + iVar2 + iVar3 + -0x1f) = Professions; + *(int_0_ **)(&stack0xffffffcc + iVar2 + iVar3) = Levels; + // WARNING: Load size is inaccurate + *(undefined4 *)(&stack0xffffffc8 + iVar2 + iVar3) = *RawData; + *(TQueryManagerConnection **)(&stack0xffffffc4 + iVar2 + iVar3) = QueryManagerConnection + ; + *(undefined4 *)((int)&uStack_40 + iVar2 + iVar3) = 0x806a415; + iVar9 = TQueryManagerConnection::createPlayerlist + (*(TQueryManagerConnection **)(&stack0xffffffc4 + iVar2 + iVar3), + *(int *)(&stack0xffffffc8 + iVar2 + iVar3), + *(char ***)(&stack0xffffffcc + iVar2 + iVar3), + *(int **)(local_11 + iVar2 + iVar3 + -0x1f), + *(char (**) [30])(&stack0xffffffd4 + iVar2 + iVar3), + *(bool **)(&stack0xffffffd8 + iVar2 + iVar3)); + puVar8 = (uint *)Names; + if (iVar9 != 0) { + *(char **)(&stack0xffffffc4 + iVar2 + iVar3) = + "ProcessPlayerlistOrder: Anfrage fehlgeschlagen (2).\n"; + *(undefined4 *)((int)&uStack_40 + iVar2 + iVar3) = 0x806a502; + error(*(char **)(&stack0xffffffc4 + iVar2 + iVar3)); + return; + } + } + if (local_11[0] != false) { + *puVar8 = 100; + puVar8[-1] = 0x806a475; + pvVar5 = operator_new__(*puVar8); + // WARNING: Load size is inaccurate + uVar6 = *RawData; + puVar8[1] = 100; + puVar8[2] = (uint)"New record: %d players are logged in."; + *puVar8 = (uint)pvVar5; + puVar8[3] = uVar6; + puVar8[-1] = 0x806a495; + snprintf((char *)*puVar8,puVar8[1],(char *)puVar8[2]); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + iVar9 = ReplyPointerWrite % 100; + ReplyBuffer[iVar9].Data = pvVar5; + ReplyPointerWrite = ReplyPointerWrite + 1; + ReplyBuffer[iVar9].ReplyType = REPLY_BROADCAST; + } + else { + *puVar8 = (uint)&DAT_080f5540; + puVar8[-1] = 0x806a4f1; + error((char *)*puVar8); + } + } + if (*(int *)((int)RawData + 4) != 0) { + *puVar8 = *(int *)((int)RawData + 4); + puVar8[-1] = 0x806a467; + operator_delete__((void *)*puVar8); + } + if (*(int *)((int)RawData + 8) != 0) { + *puVar8 = *(int *)((int)RawData + 8); + puVar8[-1] = 0x806a45d; + operator_delete__((void *)*puVar8); + } + if (*(int *)((int)RawData + 0xc) != 0) { + *puVar8 = *(int *)((int)RawData + 0xc); + puVar8[-1] = 0x806a453; + operator_delete__((void *)*puVar8); + } + *puVar8 = (uint)RawData; + puVar8[-1] = 0x806a443; + operator_delete((void *)*puVar8); + } + return; +} + + + +void ProcessKillStatisticsOrder(void *RawData) + +{ + int iVar1; + int iVar2; + int iVar3; + int i; + int iVar4; + int iVar5; + uint uVar6; + int_0_ *KilledPlayers; + int iStack_40; + int aiStack_28 [4]; + int_0_ *KilledCreatures; + char___0_ *RaceNames; + + RaceNames = &stack0xffffffc4; + if (RawData == (void *)0x0) { + iStack_40 = 0x806a661; + error(&DAT_080f5be0); + } + else { + // WARNING: Load size is inaccurate + iVar4 = 0; + uVar6 = *RawData * 4 + 0xfU & 0xfffffff0; + iVar1 = uVar6 * -3; + iVar3 = (int)aiStack_28 + uVar6 * -2; + KilledCreatures = (int_0_ *)((int)aiStack_28 - uVar6); + aiStack_28[3] = (int)aiStack_28 + iVar1; + if (0 < *RawData) { + iVar5 = 0; + do { + iVar2 = *(int *)((int)RawData + 4) + iVar5; + iVar5 = iVar5 + 0x1e; + *(int *)(KilledCreatures + iVar4 * 4) = iVar2; + *(undefined4 *)(iVar3 + iVar4 * 4) = + *(undefined4 *)(*(int *)((int)RawData + 8) + iVar4 * 4); + *(undefined4 *)(aiStack_28[3] + iVar4 * 4) = + *(undefined4 *)(*(int *)((int)RawData + 0xc) + iVar4 * 4); + iVar4 = iVar4 + 1; + // WARNING: Load size is inaccurate + } while (iVar4 < *RawData); + } + iVar4 = aiStack_28[3]; + *(int *)(&stack0xffffffd0 + iVar1) = iVar3; + *(int *)(&stack0xffffffd4 + iVar1) = iVar4; + *(int_0_ **)(&stack0xffffffcc + iVar1) = KilledCreatures; + // WARNING: Load size is inaccurate + *(undefined4 *)(&stack0xffffffc8 + iVar1) = *RawData; + *(TQueryManagerConnection **)(&stack0xffffffc4 + iVar1) = QueryManagerConnection; + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a5fd; + iVar3 = TQueryManagerConnection::logKilledCreatures + (*(TQueryManagerConnection **)(&stack0xffffffc4 + iVar1), + *(int *)(&stack0xffffffc8 + iVar1),*(char ***)(&stack0xffffffcc + iVar1), + *(int **)(&stack0xffffffd0 + iVar1),*(int **)(&stack0xffffffd4 + iVar1)); + if (iVar3 == 0) { + if (*(int *)((int)RawData + 4) != 0) { + *(int *)(&stack0xffffffc4 + iVar1) = *(int *)((int)RawData + 4); + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a645; + operator_delete__(*(void **)(&stack0xffffffc4 + iVar1)); + } + if (*(int *)((int)RawData + 8) != 0) { + *(int *)(&stack0xffffffc4 + iVar1) = *(int *)((int)RawData + 8); + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a63b; + operator_delete__(*(void **)(&stack0xffffffc4 + iVar1)); + } + if (*(int *)((int)RawData + 0xc) != 0) { + *(int *)(&stack0xffffffc4 + iVar1) = *(int *)((int)RawData + 0xc); + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a631; + operator_delete__(*(void **)(&stack0xffffffc4 + iVar1)); + } + *(void **)(&stack0xffffffc4 + iVar1) = RawData; + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a61e; + operator_delete(*(void **)(&stack0xffffffc4 + iVar1)); + } + else { + *(char **)(&stack0xffffffc4 + iVar1) = + "ProcessKillStatisticsOrder: Anfrage fehlgeschlagen.\n"; + *(undefined4 *)((int)&iStack_40 + iVar1) = 0x806a653; + error(*(char **)(&stack0xffffffc4 + iVar1)); + } + } + return; +} + + + +void ProcessPunishmentOrder(void *RawData) + +{ + ulong uVar1; + int iVar2; + int iVar3; + int Length; + char *pcVar4; + int iVar5; + size_t sVar6; + void *pvVar7; + TReportedStatement *pTVar8; + char *pcVar9; + uint uVar10; + int iVar11; + int i; + int iVar12; + int iVar13; + ulong *puVar14; + char_0__30_ *Channels; + char *pcStack_80; + char *local_74; + char *local_70; + char *local_6c; + char *local_68; + int *local_64 [5]; + int aiStack_50 [2]; + undefined4 uStack_48; + undefined8 local_44; + int local_3c; + undefined4 local_38; + char_0__256_ *Texts; + ulong_0_ *CharacterIDs; + ulong_0_ *TimeStamps; + ulong_0_ *StatementIDs; + int local_24; + char local_1e; + char local_1d; + bool ok; + char *pcStack_1c; + bool FinalWarning; + int Days; + ulong BanishmentID; + + if (RawData == (void *)0x0) { + pcStack_80 = (char *)0x806b148; + error(&DAT_080f60e0); + return; + } + local_1e = '\x01'; + Days = 0; + if (*(int *)((int)RawData + 0x54) == 0) { + pcVar4 = (char *)((int)RawData + 0x22); + pcStack_80 = (char *)0x806b091; + local_6c = GetBanishmentReason(*(int *)((int)RawData + 0x50)); + local_70 = (char *)((int)RawData + 0x40); + local_64[0] = &Days; + pcStack_80 = (char *)0x806b0be; + local_74 = pcVar4; + local_68 = (char *)((int)RawData + 0x58); + iVar5 = TQueryManagerConnection::setNotation(QueryManagerConnection); + if (iVar5 == 1) { + pcVar4 = "A player with this name does not exist. Perhaps he/she has been renamed?"; +LAB_0806b0d9: + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806b0e3; + DirectReply(*RawData,pcVar4); + local_1e = '\0'; + } + else if (iVar5 < 2) { + if (iVar5 == 0) { + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806b10a; + local_74 = pcVar4; + DirectReply(*RawData,"Notation for player %s inserted."); + local_74 = (char *)((int)RawData + 4); + pcStack_80 = (char *)0x806b12d; + local_70 = pcVar4; + local_6c = (char *)((int)RawData + 0x58); + Log("banish","%s notiert zu %s: %s.\n"); + } + } + else if (iVar5 == 2) { + pcVar4 = "You may not report a god or gamemaster."; + goto LAB_0806b0d9; + } + } + puVar14 = (ulong *)&stack0xffffff84; + if (local_1e == '\0') goto LAB_0806a710; + iVar5 = *(int *)((int)RawData + 0x54); + if (((iVar5 != 1) && (iVar5 != 3)) && (iVar5 != 5)) goto switchD_0806b000_default; + pcVar4 = (char *)((int)RawData + 0x22); + pcStack_80 = (char *)0x806afd1; + local_6c = GetBanishmentReason(*(int *)((int)RawData + 0x50)); + local_68 = (char *)((int)RawData + 0x58); + pcStack_80 = (char *)0x806aff7; + local_74 = pcVar4; + local_70 = (char *)((int)RawData + 0x40); + iVar5 = TQueryManagerConnection::setNamelock(QueryManagerConnection); + switch(iVar5) { + case 0: + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806b01d; + local_74 = pcVar4; + DirectReply(*RawData,"Player %s reported for renaming."); + local_74 = (char *)((int)RawData + 4); + pcStack_80 = (char *)0x806b03c; + local_70 = pcVar4; + Log("banish",&DAT_080f5f80); + break; + case 1: + pcVar4 = "A player with this name does not exist. Perhaps he/she has already been renamed?"; + goto LAB_0806b049; + case 2: + case 4: + pcVar4 = "This name has already been approved."; +LAB_0806b049: + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806b053; + DirectReply(*RawData,pcVar4); + local_1e = '\0'; + break; + case 3: + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806b06e; + DirectReply(*RawData,"This player has already been reported."); + } +switchD_0806b000_default: + puVar14 = (ulong *)&stack0xffffff84; + if (local_1e == '\0') goto LAB_0806a710; + if (*(int *)((int)RawData + 0x54) - 2U < 4) { + local_1d = *(int *)((int)RawData + 0x54) - 4U < 2; + pcStack_80 = (char *)0x806ad8c; + local_6c = GetBanishmentReason(*(int *)((int)RawData + 0x50)); + local_64[2] = &Days; + local_70 = (char *)((int)RawData + 0x40); + local_68 = (char *)((int)RawData + 0x58); + pcVar4 = (char *)((int)RawData + 0x22); + pcStack_80 = (char *)0x806adc9; + local_74 = pcVar4; + local_64[0] = (int *)&local_1d; + local_64[1] = (int *)&stack0xffffffe4; + iVar5 = TQueryManagerConnection::banishAccount(QueryManagerConnection); + if (iVar5 == 1) { + pcVar4 = "A player with this name does not exist. Perhaps he/she has been renamed?"; +LAB_0806ae8b: + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806ae95; + DirectReply(*RawData,pcVar4); + local_1e = '\0'; + } + else if (iVar5 < 2) { + if (iVar5 == 0) { + if (pcStack_1c == (char *)0xffffffff) { + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806afa9; + local_74 = pcVar4; + DirectReply(*RawData,"Account of player %s banished infinitely."); + } + else { + if (local_1d == '\0') { + pcVar9 = "Account of player %s banished for %d days."; + } + else { + pcVar9 = "Account of player %s banished for %d days with final warning."; + } + local_70 = pcStack_1c; + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806aed6; + local_74 = pcVar4; + DirectReply(*RawData,pcVar9); + } + pcStack_80 = (char *)0x806aede; + sVar6 = strlen(pcVar4); + pcStack_80 = (char *)0x806aee7; + pcVar9 = (char *)operator_new__(sVar6 + 1); + pcStack_80 = (char *)0x806aef5; + strcpy(pcVar9,pcVar4); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + local_44 = (longlong)ReplyPointerWrite * 0x51eb851f; + local_3c = ReplyPointerWrite / 100; + ReplyBuffer[ReplyPointerWrite % 100].ReplyType = REPLY_LOGOUT; + ReplyBuffer[ReplyPointerWrite % 100].Data = pcVar9; + ReplyPointerWrite = ReplyPointerWrite + 1; + } + else { + pcStack_80 = (char *)0x806af7c; + error(&DAT_080f5540); + } + local_74 = (char *)((int)RawData + 4); + pcStack_80 = (char *)0x806af6b; + local_70 = pcVar4; + Log("banish","%s verbannt Account von Spieler %s.\n"); + } + } + else { + if (iVar5 == 2) { + pcVar4 = "You may not report a god or gamemaster."; + goto LAB_0806ae8b; + } + if (iVar5 == 3) { + // WARNING: Load size is inaccurate + pcStack_80 = (char *)0x806ae03; + local_74 = pcVar4; + DirectReply(*RawData,"Player %s has already been banished."); + pcStack_80 = (char *)0x806ae0b; + sVar6 = strlen(pcVar4); + pcStack_80 = (char *)0x806ae14; + pcVar9 = (char *)operator_new__(sVar6 + 1); + pcStack_80 = (char *)0x806ae22; + strcpy(pcVar9,pcVar4); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + iVar5 = ReplyPointerWrite % 100; + ReplyPointerWrite = ReplyPointerWrite + 1; + ReplyBuffer[iVar5].ReplyType = REPLY_LOGOUT; + ReplyBuffer[iVar5].Data = pcVar9; + } + else { + pcStack_80 = (char *)0x806ae7e; + error(&DAT_080f5540); + } + } + } + } + puVar14 = (ulong *)&stack0xffffff84; + if (local_1e == '\0') goto LAB_0806a710; + puVar14 = (ulong *)&stack0xffffff84; + if (*(int *)((int)RawData + 0x128) == 0) goto LAB_0806a800; + StatementIDs = &stack0xffffff84; + local_24 = *(int *)((int)RawData + 0x120); + if ((local_24 == 0) || (*(int *)((int)RawData + 0x124) == 0)) { + pcStack_80 = (char *)0x806a70d; + error("ProcessPunishmentOrder: Statements existieren nicht.\n"); + puVar14 = (ulong *)&stack0xffffff84; + goto LAB_0806a710; + } + iVar12 = local_24 + -1; + uVar10 = iVar12 * 4 + 0x13U & 0xfffffff0; + iVar3 = uVar10 * -3; + TimeStamps = (ulong_0_ *)((int)&uStack_48 - uVar10); + CharacterIDs = (ulong_0_ *)((int)&uStack_48 + uVar10 * -2); + Texts = (char_0__256_ *)((int)&uStack_48 + iVar3); + iVar2 = -(iVar12 * 0x1e + 0x2dU & 0xfffffff0); + iVar5 = (int)&uStack_48 + iVar2 + iVar3; + iVar12 = -(iVar12 * 0x100 + 0x100); + local_38 = (int)&uStack_48 + iVar12 + iVar2 + iVar3; + iVar13 = 0; + if (0 < local_24) { + do { + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a9e2; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + *(ulong *)(TimeStamps + iVar13 * 4) = pTVar8->StatementID; + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a9fc; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + *(ulong *)(CharacterIDs + iVar13 * 4) = pTVar8->TimeStamp; + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aa17; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + *(ulong *)(Texts + iVar13 * 4) = pTVar8->CharacterID; + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aa32; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + switch(pTVar8->Mode) { + default: + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aa9c; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + iVar11 = pTVar8->Mode; + *(undefined **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = &DAT_080f5dc0; + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar11; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aaaf; + error(*(char **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3)); + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x6e6b6e55; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x6e776f; + break; + case 1: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x796153; + break; + case 2: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x73696857; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x726570; + break; + case 3: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x6c6c6559; + *(undefined1 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0; + break; + case 4: + case 0xb: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x20657461; + *(undefined4 *)(iVar5 + iVar11) = 0x76697250; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x7373654d; + *(undefined4 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x656761; + break; + case 5: + case 10: + case 0xc: + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806ac0a; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + switch(pTVar8->Channel) { + case 0: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x6c697547; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x68432064; + goto LAB_0806ac36; + case 1: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x7473616d; + *(undefined4 *)(iVar5 + iVar11) = 0x656d6147; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x43207265; + *(undefined4 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x6e6e6168; + *(undefined2 *)((int)&local_38 + iVar11 + iVar2 + iVar3) = 0x6c65; + goto LAB_0806ab34; + case 2: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x6f747554; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x68432072; + goto LAB_0806ac36; + default: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x20657461; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x74616843; + *(undefined4 *)(iVar5 + iVar11) = 0x76697250; + *(undefined4 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x61684320; + *(undefined4 *)((int)&local_38 + iVar11 + iVar2 + iVar3) = 0x6c656e6e; + *(undefined1 *)((int)&Texts + iVar11 + iVar2 + iVar3) = 0; + break; + case 4: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x656d6147; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x61684320; + goto LAB_0806abbc; + case 5: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x64617254; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x68432065; +LAB_0806ac36: + *(undefined2 *)((int)&local_3c + iVar13 * 0x1e + iVar2 + iVar3) = 0x6c; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3 + 4) = 0x656e6e61 + ; + break; + case 6: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)(iVar5 + iVar11) = 0x6c616552; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x6566696c; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x61684320; + *(undefined2 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x74; + break; + case 7: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)(iVar5 + iVar11) = 0x706c6548; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x61684320; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x6c656e6e; + *(undefined1 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0; + } + break; + case 6: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x7473616d; + *(undefined4 *)(iVar5 + iVar11) = 0x656d6147; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x52207265; + *(undefined4 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x65757165; + *(undefined2 *)((int)&local_38 + iVar11 + iVar2 + iVar3) = 0x7473; +LAB_0806ab34: + *(undefined1 *)((int)&local_38 + iVar13 * 0x1e + iVar2 + iVar3 + 2) = 0; + break; + case 7: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x7473616d; + *(undefined4 *)(iVar5 + iVar11) = 0x656d6147; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x41207265; + *(undefined4 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x6577736e; + *(undefined2 *)((int)&local_38 + iVar11 + iVar2 + iVar3) = 0x72; + break; + case 8: + iVar11 = iVar13 * 0x1e; + *(undefined4 *)(iVar5 + iVar11) = 0x79616c50; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3) = 0x41207265; + *(undefined4 *)((int)&local_44 + iVar11 + iVar2 + iVar3 + 4) = 0x6577736e; + *(undefined2 *)((int)&local_3c + iVar11 + iVar2 + iVar3) = 0x72; + break; + case 9: + *(undefined4 *)(iVar5 + iVar13 * 0x1e) = 0x616f7242; + *(undefined4 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3) = 0x73616364; +LAB_0806abbc: + *(undefined2 *)((int)&local_44 + iVar13 * 0x1e + iVar2 + iVar3 + 4) = 0x74; + } + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = iVar13; + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x124); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aa62; + pTVar8 = vector<>::operator() + (*(vector<> **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + iVar11 = iVar13 * 0x100; + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = pTVar8->Text; + iVar13 = iVar13 + 1; + *(int *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = iVar11 + local_38; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806aa7c; + strcpy(*(char **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + } while (iVar13 < local_24); + } + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + *(undefined4 *)((int)RawData + 0x50); + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a785; + pcVar4 = GetBanishmentReason(*(int *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3)); + iVar13 = local_38; + *(int *)((int)aiStack_50 + iVar12 + iVar2 + iVar3) = iVar5; + *(int *)((int)aiStack_50 + iVar12 + iVar2 + iVar3 + 4) = iVar13; + *(char_0__256_ **)((int)aiStack_50 + iVar12 + iVar2 + iVar3 + -4) = Texts; + *(ulong_0_ **)((int)aiStack_50 + iVar12 + iVar2 + iVar3 + -8) = CharacterIDs; + *(ulong_0_ **)((int)local_64 + iVar12 + iVar2 + iVar3 + 8) = TimeStamps; + *(int *)((int)local_64 + iVar12 + iVar2 + iVar3 + 4) = local_24; + *(undefined4 *)((int)local_64 + iVar12 + iVar2 + iVar3) = *(undefined4 *)((int)RawData + 0x128); + iVar13 = Days; + *(char **)((int)&stack0xffffff90 + iVar12 + iVar2 + iVar3) = pcVar4; + *(int *)((int)&stack0xffffff94 + iVar12 + iVar2 + iVar3) = (int)RawData + 0x58; + iVar5 = (int)RawData + 0x22; + *(int *)((int)&stack0xffffff8c + iVar12 + iVar2 + iVar3) = iVar5; + *(int *)((int)&stack0xffffff98 + iVar12 + iVar2 + iVar3) = iVar13; + // WARNING: Load size is inaccurate + *(undefined4 *)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = *RawData; + *(TQueryManagerConnection **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = + QueryManagerConnection; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a7e2; + iVar13 = TQueryManagerConnection::reportStatement + (*(TQueryManagerConnection **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3)); + if (iVar13 == 1) { + if (*(int *)((int)RawData + 0x54) == 6) { + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = + "A player with this name does not exist. Perhaps he/she has been renamed?"; +LAB_0806a966: + // WARNING: Load size is inaccurate + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = *RawData; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a970; + DirectReply(*(ulong *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + } +LAB_0806a955: + local_1e = '\0'; + puVar14 = (ulong *)StatementIDs; + } + else { + puVar14 = (ulong *)StatementIDs; + if (iVar13 < 2) { + if (iVar13 == 0) { + if (*(int *)((int)RawData + 0x54) == 6) { + *(int *)((int)&stack0xffffff8c + iVar12 + iVar2 + iVar3) = iVar5; + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = + "Statement of %s reported."; + // WARNING: Load size is inaccurate + *(undefined4 *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = *RawData; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a9ba; + DirectReply(*(ulong *)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + } + *(int *)((int)&stack0xffffff90 + iVar12 + iVar2 + iVar3) = iVar5; + *(int *)((int)&stack0xffffff8c + iVar12 + iVar2 + iVar3) = (int)RawData + 4; + *(undefined **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = &DAT_080f5d80; + *(char **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3) = "banish"; + *(undefined4 *)((int)&pcStack_80 + iVar12 + iVar2 + iVar3) = 0x806a99f; + Log(*(char **)(&stack0xffffff84 + iVar12 + iVar2 + iVar3), + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14)); + puVar14 = (ulong *)StatementIDs; + } + } + else if (iVar13 == 2) { + if (*(int *)((int)RawData + 0x54) == 6) { + *(char **)((int)local_64 + iVar12 + iVar2 + iVar3 + -0x14) = + "Statement has already been reported."; + goto LAB_0806a966; + } + goto LAB_0806a955; + } + } +LAB_0806a800: + if ((local_1e == '\0') || (*(char *)((int)RawData + 300) == '\0')) goto LAB_0806a710; + *puVar14 = *(undefined4 *)((int)RawData + 0x50); + puVar14[-1] = 0x806a828; + pcVar4 = GetBanishmentReason(*puVar14); + puVar14[3] = (int)RawData + 0x40; + puVar14[5] = (int)RawData + 0x58; + uVar1 = (int)RawData + 0x22; + puVar14[4] = (ulong)pcVar4; + puVar14[2] = uVar1; + // WARNING: Load size is inaccurate + puVar14[1] = *RawData; + *puVar14 = (ulong)QueryManagerConnection; + puVar14[-1] = 0x806a84e; + iVar5 = TQueryManagerConnection::banishIPAddress((TQueryManagerConnection *)*puVar14); + if (iVar5 == 1) { + puVar14[1] = (ulong) + "A player with this name does not exist. Perhaps he/she has been renamed?"; + } + else { + if (iVar5 < 2) { + if (iVar5 == 0) { + puVar14[2] = uVar1; + puVar14[1] = (ulong)"IP address of %s banished."; + // WARNING: Load size is inaccurate + *puVar14 = *RawData; + puVar14[-1] = 0x806a89a; + DirectReply(*puVar14,(char *)puVar14[1]); + *puVar14 = uVar1; + puVar14[-1] = 0x806a8a2; + sVar6 = strlen((char *)*puVar14); + *puVar14 = sVar6 + 1; + puVar14[-1] = 0x806a8ab; + pvVar7 = operator_new__(*puVar14); + puVar14[1] = uVar1; + *puVar14 = (ulong)pvVar7; + puVar14[-1] = 0x806a8b9; + strcpy((char *)*puVar14,(char *)puVar14[1]); + if (ReplyPointerWrite - ReplyPointerRead < 100) { + local_44 = (longlong)ReplyPointerWrite * 0x51eb851f; + local_3c = ReplyPointerWrite / 100; + ReplyBuffer[ReplyPointerWrite % 100].ReplyType = REPLY_LOGOUT; + ReplyBuffer[ReplyPointerWrite % 100].Data = pvVar7; + ReplyPointerWrite = ReplyPointerWrite + 1; + } + else { + *puVar14 = (ulong)&DAT_080f5540; + puVar14[-1] = 0x806a940; + error((char *)*puVar14); + } + puVar14[3] = uVar1; + puVar14[2] = (int)RawData + 4; + puVar14[1] = (ulong)"%s sperrt die IP-Adresse von %s.\n"; + *puVar14 = (ulong)"banish"; + puVar14[-1] = 0x806a92f; + Log((char *)*puVar14,(char *)puVar14[1]); + } + goto LAB_0806a710; + } + if (iVar5 != 2) goto LAB_0806a710; + puVar14[1] = (ulong)"You may not report a god or gamemaster."; + } + // WARNING: Load size is inaccurate + *puVar14 = *RawData; + puVar14[-1] = 0x806a877; + DirectReply(*puVar14,(char *)puVar14[1]); +LAB_0806a710: + *puVar14 = (ulong)RawData; + puVar14[-1] = 0x806a718; + operator_delete((void *)*puVar14); + return; +} + + + +void ProcessCharacterDeathOrder(void *RawData) + +{ + int iVar1; + + if (RawData != (void *)0x0) { + // WARNING: Load size is inaccurate + iVar1 = TQueryManagerConnection::logCharacterDeath + (QueryManagerConnection,*RawData,*(int *)((int)RawData + 4), + *(ulong *)((int)RawData + 8),(char *)((int)RawData + 0xc), + *(bool *)((int)RawData + 0x2a),*(time_t *)((int)RawData + 0x2c)); + if (iVar1 != 0) { + error("ProcessCharacterDeathOrder: Protokollierung fehlgeschlagen.\n"); + } + operator_delete(RawData); + return; + } + error(&DAT_080f6160); + return; +} + + + +void ProcessAddBuddyOrder(void *RawData) + +{ + int iVar1; + undefined4 uVar2; + undefined4 uVar3; + + if (RawData != (void *)0x0) { + uVar3 = *(undefined4 *)((int)RawData + 4); + // WARNING: Load size is inaccurate + uVar2 = *RawData; + iVar1 = TQueryManagerConnection::addBuddy(QueryManagerConnection); + if (iVar1 != 0) { + error("ProcessAddBuddyOrder: Aufnahme fehlgeschlagen.\n",uVar2,uVar3); + } + operator_delete(RawData); + return; + } + error(&DAT_080f61e0); + return; +} + + + +void ProcessRemoveBuddyOrder(void *RawData) + +{ + int iVar1; + undefined4 uVar2; + undefined4 uVar3; + + if (RawData != (void *)0x0) { + uVar3 = *(undefined4 *)((int)RawData + 4); + // WARNING: Load size is inaccurate + uVar2 = *RawData; + iVar1 = TQueryManagerConnection::removeBuddy(QueryManagerConnection); + if (iVar1 != 0) { + error("ProcessRemoveBuddyOrder: Entfernen fehlgeschlagen.\n",uVar2,uVar3); + } + operator_delete(RawData); + return; + } + error(&DAT_080f6260); + return; +} + + + +void ProcessDecrementIsOnlineOrder(void *RawData) + +{ + int iVar1; + + iVar1 = TQueryManagerConnection::decrementIsOnline(QueryManagerConnection,(ulong)RawData); + if (iVar1 == 0) { + return; + } + error("ProcessDecrementIsOnlineOrder: Verringerung fehlgeschlagen.\n"); + return; +} + + + +// WARNING: Variable defined which should be unmapped: HelpProfession + +int WriterThreadLoop(void *param_1) + +{ + TWriterThreadOrderType TVar1; + ulong *RawData; + int iVar2; + char *pcVar3; + ulong uVar4; + ulong uVar5; + ulong uVar6; + ulong *puVar7; + char local_2c [4]; + char HelpProfession [30]; + +LAB_0806b310: + Semaphore::down(&OrderBufferFull); + TVar1 = OrderBuffer[OrderPointerRead % 2000].OrderType; + RawData = (ulong *)OrderBuffer[OrderPointerRead % 2000].Data; + OrderPointerRead = OrderPointerRead + 1; + Semaphore::up(&OrderBufferEmpty); + switch(TVar1) { + case ORDER_TERMINATE: + return 0; + case ORDER_LOGOUT: + if (RawData != (ulong *)0x0) { + pcVar3 = local_2c; + GetProfessionName(pcVar3,RawData[2],false,true); + if (0 < (int)RawData[4]) { + print(); + } + uVar6 = RawData[4]; + puVar7 = RawData + 5; + uVar4 = RawData[3]; + uVar5 = RawData[1]; + iVar2 = TQueryManagerConnection::logoutGame(QueryManagerConnection); + if (iVar2 != 0) { + error(&DAT_080f5a20,*RawData,uVar5,pcVar3,puVar7,uVar4,uVar6); + } +LAB_0806b403: + operator_delete(RawData); + goto LAB_0806b310; + } + pcVar3 = &DAT_080f5a60; + break; + case ORDER_PLAYERLIST: + ProcessPlayerlistOrder(RawData); + goto LAB_0806b310; + case ORDER_KILLSTATISTICS: + ProcessKillStatisticsOrder(RawData); + goto LAB_0806b310; + case ORDER_PUNISHMENT: + ProcessPunishmentOrder(RawData); + goto LAB_0806b310; + case ORDER_CHARACTERDEATH: + if (RawData != (ulong *)0x0) { + uVar6 = RawData[1]; + uVar4 = *RawData; + iVar2 = TQueryManagerConnection::logCharacterDeath + (QueryManagerConnection,uVar4,uVar6,RawData[2],(char *)(RawData + 3), + *(bool *)((int)RawData + 0x2a),RawData[0xb]); + if (iVar2 != 0) { + pcVar3 = "ProcessCharacterDeathOrder: Protokollierung fehlgeschlagen.\n"; +LAB_0806b4af: + error(pcVar3,uVar4,uVar6); + } + goto LAB_0806b403; + } + pcVar3 = &DAT_080f6160; + break; + case ORDER_ADDBUDDY: + if (RawData != (ulong *)0x0) { + uVar6 = RawData[1]; + uVar4 = *RawData; + iVar2 = TQueryManagerConnection::addBuddy(QueryManagerConnection); + if (iVar2 != 0) { + pcVar3 = "ProcessAddBuddyOrder: Aufnahme fehlgeschlagen.\n"; + goto LAB_0806b4af; + } + goto LAB_0806b403; + } + pcVar3 = &DAT_080f61e0; + break; + case ORDER_REMOVEBUDDY: + if (RawData != (ulong *)0x0) { + uVar6 = RawData[1]; + uVar4 = *RawData; + iVar2 = TQueryManagerConnection::removeBuddy(QueryManagerConnection); + if (iVar2 != 0) { + pcVar3 = "ProcessRemoveBuddyOrder: Entfernen fehlgeschlagen.\n"; + goto LAB_0806b4af; + } + goto LAB_0806b403; + } + pcVar3 = &DAT_080f6260; + break; + case ORDER_DECREMENTISONLINE: + iVar2 = TQueryManagerConnection::decrementIsOnline(QueryManagerConnection,(ulong)RawData); + if (iVar2 == 0) goto LAB_0806b310; + pcVar3 = "ProcessDecrementIsOnlineOrder: Verringerung fehlgeschlagen.\n"; + break; + case ORDER_SAVEPLAYERDATA: + SavePlayerPoolSlots(); + goto LAB_0806b310; + default: + goto switchD_0806b373_default; + } + error(pcVar3); + goto LAB_0806b310; +switchD_0806b373_default: + error("WriterThreadLoop: Unbekanntes Kommando %d.\n",TVar1); + goto LAB_0806b310; +} + + + +void ProcessBroadcastReply(void *RawData) + +{ + if (RawData != (void *)0x0) { + BroadcastMessage(0x15,(char *)RawData); + operator_delete__(RawData); + return; + } + error(&DAT_080f6320); + return; +} + + + +void ProcessDirectReply(void *RawData) + +{ + TPlayer *pl; + TPlayer *pTVar1; + + if (RawData != (void *)0x0) { + // WARNING: Load size is inaccurate + pTVar1 = GetPlayer(*RawData); + if (pTVar1 != (TPlayer *)0x0) { + SendMessage((pTVar1->super_TCreature).Connection,0x16,"%s",(int)RawData + 4); + } + operator_delete(RawData); + return; + } + error(&DAT_080f6360); + return; +} + + + +void ProcessLogoutReply(void *RawData) + +{ + TPlayer *this; + TPlayer *pl; + Object local_1c [4]; + + if (RawData == (void *)0x0) { + error(&DAT_080f63a0); + } + else { + this = GetPlayer((char *)RawData); + if (this != (TPlayer *)0x0) { + local_1c[0].ObjectID = (this->super_TCreature).CrObject.ObjectID; + GraphicalEffect(local_1c,0xf); + TCreature::StartLogout(&this->super_TCreature,true,true); + } + operator_delete__(RawData); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessWriterThreadReplies(void) + +{ + TWriterThreadReplyType TVar1; + ulong *Text; + TPlayer *pl; + TPlayer *pTVar2; + void *Data; + TWriterThreadReplyType ReplyType; + char *Text_00; + +LAB_0806b6c0: + do { + while( true ) { + if (ReplyPointerRead == ReplyPointerWrite) { + return; + } + TVar1 = ReplyBuffer[ReplyPointerRead % 100].ReplyType; + Text = (ulong *)ReplyBuffer[ReplyPointerRead % 100].Data; + ReplyPointerRead = ReplyPointerRead + 1; + if (TVar1 != REPLY_DIRECT) break; + if (Text == (ulong *)0x0) { + Text_00 = &DAT_080f6360; +LAB_0806b762: + error(Text_00); + } + else { + pTVar2 = GetPlayer(*Text); + if (pTVar2 != (TPlayer *)0x0) { + SendMessage((pTVar2->super_TCreature).Connection,0x16,"%s",Text + 1); + } + operator_delete(Text); + } + } + if ((int)TVar1 < 2) { + if (TVar1 == REPLY_BROADCAST) { + if (Text == (ulong *)0x0) { + Text_00 = &DAT_080f6320; + goto LAB_0806b762; + } + BroadcastMessage(0x15,(char *)Text); + operator_delete__(Text); + } + else { +LAB_0806b783: + error(&DAT_080f63e0,TVar1); + } + goto LAB_0806b6c0; + } + if (TVar1 != REPLY_LOGOUT) goto LAB_0806b783; + ProcessLogoutReply(Text); + } while( true ); +} + + + +// WARNING: Variable defined which should be unmapped: NumberOfAffectedPlayers +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ClearPlayers(void) + +{ + int iVar1; + int local_8; + int NumberOfAffectedPlayers; + + iVar1 = TQueryManagerConnection::clearIsOnline(QueryManagerConnection,&local_8); + if (iVar1 == 0) { + if (local_8 != 0) { + error("ClearPlayers: %d Spieler waren als eingeloggt markiert.\n",local_8); + } + } + else { + error(&DAT_080f6460); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitWriter(void) + +{ + TQueryManagerConnection *this; + int iVar1; + undefined4 *puVar2; + int *piVar3; + int local_1c; + int NumberOfAffectedPlayers; + int local_14; + + // try { // try from 0806b846 to 0806b84a has its CatchHandler @ 0806b9f0 + this = (TQueryManagerConnection *)operator_new(0x30); + local_14 = 0x4000; + NumberOfAffectedPlayers = MaxPlayers * 0x42 + 2; + piVar3 = &NumberOfAffectedPlayers; + if (NumberOfAffectedPlayers < 0x4001) { + piVar3 = &local_14; + } + // try { // try from 0806b87f to 0806b883 has its CatchHandler @ 0806b9c0 + TQueryManagerConnection::TQueryManagerConnection(this,*piVar3); + QueryManagerConnection = this; + if (this->Socket < 0) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "cannot connect to query manager"; + } + else { + // try { // try from 0806b8a4 to 0806b9a1 has its CatchHandler @ 0806b9f0 + iVar1 = TQueryManagerConnection::clearIsOnline(this,&local_1c); + if (iVar1 == 0) { + if (local_1c != 0) { + error("ClearPlayers: %d Spieler waren als eingeloggt markiert.\n",local_1c); + } + } + else { + error(&DAT_080f6460); + } + ProtocolPointerWrite = 0; + ProtocolPointerRead = 0; + ProtocolThread = StartThread(ProtocolThreadLoop,(void *)0x0,false); + if (ProtocolThread == 0) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "cannot start protocol thread"; + } + else { + OrderPointerWrite = 0; + OrderPointerRead = 0; + ReplyPointerWrite = 0; + ReplyPointerRead = 0; + WriterThread = StartThread(WriterThreadLoop,(void *)0x0,false); + if (WriterThread != 0) { + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "cannot start writer thread"; + } + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void AbortWriter(void) + +{ + if (WriterThread != 0) { + WriterThread = 0; + pthread_cancel(0); + Semaphore::up(&OrderBufferEmpty); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitWriter(void) + +{ + TQueryManagerConnection *pTVar1; + undefined *in_stack_ffffffe8; + + if (ProtocolThread != 0) { + in_stack_ffffffe8 = &DAT_080ef15d; + InsertProtocolOrder("",""); + JoinThread(ProtocolThread); + ProtocolThread = 0; + } + if (WriterThread != 0) { + if (1999 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_080f5500); + } + Semaphore::down(&OrderBufferEmpty); + OrderBuffer[OrderPointerWrite % 2000].OrderType = ORDER_TERMINATE; + OrderBuffer[OrderPointerWrite % 2000].Data = (void *)0x0; + OrderPointerWrite = OrderPointerWrite + 1; + Semaphore::up(&OrderBufferFull); + JoinThread(WriterThread); + WriterThread = 0; + } + pTVar1 = QueryManagerConnection; + if (QueryManagerConnection != (TQueryManagerConnection *)0x0) { + TQueryManagerConnection::~TQueryManagerConnection + (QueryManagerConnection,(int)in_stack_ffffffe8); + operator_delete(pTVar1); + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&ProtocolMutex,in_stack_00000008); + return; +} + + + +void __tcf_1(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&ProtocolBufferEmpty,in_stack_00000008); + return; +} + + + +void __tcf_2(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&ProtocolBufferFull,in_stack_00000008); + return; +} + + + +void __tcf_3(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&OrderBufferEmpty,in_stack_00000008); + return; +} + + + +void __tcf_4(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&OrderBufferFull,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z12InitProtocolv(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: TReportedStatement * operator()(vector * this, int +// i) + +TReportedStatement * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ulong *puVar1; + TReportedStatement *pTVar2; + uint uVar3; + int iVar4; + int j_1; + int j; + int iVar5; + TReportedStatement *pTVar6; + TReportedStatement *pTVar7; + ulong *puVar8; + int iVar9; + int extend_1; + TReportedStatement *help; + int extend; + uchar Help [276]; + + iVar5 = this->start; + while (i < iVar5) { + help = (TReportedStatement *)this->block; + if (help == (TReportedStatement *)0x0) { + pTVar2 = (TReportedStatement *)this->space; + help = pTVar2; + } + else { + pTVar2 = (TReportedStatement *)this->space; + } + pTVar2 = (TReportedStatement *) + operator_new__((int)(pTVar2->Text + (int)(help->Text + -0x28)) * 0x114); + iVar5 = this->min; + if (iVar5 <= this->max) { + do { + puVar8 = (ulong *)&extend; + uVar3 = 0x114; + pTVar6 = pTVar2 + (iVar5 - this->start) + (int)help; + if (((uint)&extend & 4) != 0) { + puVar1 = &pTVar6->StatementID; + puVar8 = (ulong *)Help; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + extend = *puVar1; + uVar3 = 0x110; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + *puVar8 = pTVar6->StatementID; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + puVar8 = puVar8 + 1; + } + iVar9 = iVar5 - this->start; + pTVar6 = pTVar2 + (int)help + iVar9; + pTVar7 = this->entry + iVar9; + uVar3 = 0x114; + if (((uint)pTVar6 & 4) != 0) { + puVar8 = &pTVar7->StatementID; + pTVar7 = (TReportedStatement *)&pTVar7->TimeStamp; + pTVar6->StatementID = *puVar8; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = pTVar7->StatementID; + pTVar7 = (TReportedStatement *)&pTVar7->TimeStamp; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + uVar3 = 0x114; + puVar8 = (ulong *)&extend; + pTVar6 = this->entry + (iVar5 - this->start); + if (((uint)pTVar6 & 4) != 0) { + puVar8 = (ulong *)Help; + pTVar6->StatementID = extend; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = *puVar8; + puVar8 = puVar8 + 1; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + iVar5 = iVar5 + 1; + } while (iVar5 <= this->max); + } + if (this->entry != (TReportedStatement *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar2; + iVar5 = this->start - (int)help; + this->start = iVar5; + this->space = (int)(help->Text + this->space + -0x14); + } + iVar4 = this->space; + iVar9 = iVar4 + iVar5; + while (iVar9 <= i) { + iVar9 = iVar4; + if (this->block != 0) { + iVar9 = this->block; + } + pTVar2 = (TReportedStatement *)operator_new__((iVar9 + iVar4) * 0x114); + iVar5 = this->min; + if (iVar5 <= this->max) { + do { + puVar8 = (ulong *)&extend; + pTVar6 = pTVar2 + (iVar5 - this->start); + uVar3 = 0x114; + if (((uint)&extend & 4) != 0) { + puVar1 = &pTVar6->StatementID; + puVar8 = (ulong *)Help; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + extend = *puVar1; + uVar3 = 0x110; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + *puVar8 = pTVar6->StatementID; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + puVar8 = puVar8 + 1; + } + iVar4 = iVar5 - this->start; + pTVar6 = pTVar2 + iVar4; + pTVar7 = this->entry + iVar4; + uVar3 = 0x114; + if (((uint)pTVar6 & 4) != 0) { + puVar8 = &pTVar7->StatementID; + pTVar7 = (TReportedStatement *)&pTVar7->TimeStamp; + pTVar6->StatementID = *puVar8; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = pTVar7->StatementID; + pTVar7 = (TReportedStatement *)&pTVar7->TimeStamp; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + uVar3 = 0x114; + pTVar6 = this->entry + (iVar5 - this->start); + puVar8 = (ulong *)&extend; + if (((uint)pTVar6 & 4) != 0) { + puVar8 = (ulong *)Help; + pTVar6->StatementID = extend; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = *puVar8; + puVar8 = puVar8 + 1; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + iVar5 = iVar5 + 1; + } while (iVar5 <= this->max); + } + if (this->entry != (TReportedStatement *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar2; + iVar5 = this->start; + iVar4 = iVar9 + this->space; + this->space = iVar4; + iVar9 = iVar4 + iVar5; + } + iVar9 = this->min; + while (i < iVar9) { + this->min = iVar9 + -1; + if (this->initialized != false) { + pTVar2 = &this->init; + pTVar6 = this->entry + ((iVar9 + -1) - iVar5); + uVar3 = 0x114; + if (((uint)pTVar6 & 4) != 0) { + pTVar2 = (TReportedStatement *)&(this->init).TimeStamp; + pTVar6->StatementID = (this->init).StatementID; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = pTVar2->StatementID; + pTVar2 = (TReportedStatement *)&pTVar2->TimeStamp; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + iVar5 = this->start; + } + iVar9 = this->min; + } + iVar9 = this->max; + while (iVar9 < i) { + this->max = iVar9 + 1; + if (this->initialized != false) { + pTVar2 = &this->init; + pTVar6 = this->entry + ((iVar9 + 1) - iVar5); + uVar3 = 0x114; + if (((uint)pTVar6 & 4) != 0) { + pTVar2 = (TReportedStatement *)&(this->init).TimeStamp; + pTVar6->StatementID = (this->init).StatementID; + uVar3 = 0x110; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + pTVar6->StatementID = pTVar2->StatementID; + pTVar2 = (TReportedStatement *)&pTVar2->TimeStamp; + pTVar6 = (TReportedStatement *)&pTVar6->TimeStamp; + } + iVar5 = this->start; + } + iVar9 = this->max; + } + return this->entry + (i - iVar5); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +// DWARF original prototype: void load(TOutfit * this, TReadScriptFile * Script) + +void __thiscall TOutfit::load(TOutfit *this,TReadScriptFile *Script) + +{ + int iVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 *paVar2; + + // try { // try from 0806c05d to 0806c0af has its CatchHandler @ 0806c0b7 + TReadScriptFile::readSymbol(Script,'('); + iVar1 = TReadScriptFile::readNumber(Script); + this->OutfitID = iVar1; + TReadScriptFile::readSymbol(Script,','); + if (this->OutfitID == 0) { + iVar1 = TReadScriptFile::readNumber(Script); + (this->field_1).ObjectType = (ushort)iVar1; + } + else { + paVar2 = (anon_union_4_2_730cd3ca_for_TOutfit_2 *)TReadScriptFile::readBytesequence(Script); + this->field_1 = *paVar2; + } + TReadScriptFile::readSymbol(Script,')'); + return; +} + + + +// DWARF original prototype: void save(TOutfit * this, TWriteScriptFile * Script) + +void __thiscall TOutfit::save(TOutfit *this,TWriteScriptFile *Script) + +{ + // try { // try from 0806c0ed to 0806c156 has its CatchHandler @ 0806c160 + TWriteScriptFile::writeText(Script,"("); + TWriteScriptFile::writeNumber(Script,this->OutfitID); + TWriteScriptFile::writeText(Script,","); + if (this->OutfitID == 0) { + TWriteScriptFile::writeNumber(Script,(uint)(this->field_1).ObjectType); + } + else { + TWriteScriptFile::writeBytesequence(Script,(this->field_1).Colors,4); + } + TWriteScriptFile::writeText(Script,")"); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void PlayerDataPath(void) + +{ + uint in_stack_00000004; + char *in_stack_0000000c; + + sprintf(in_stack_0000000c,"%s/%02ld/%ld.%s",USERPATH,in_stack_00000004 % 100); + return; +} + + + +bool PlayerDataExists(ulong CharacterID) + +{ + bool bVar1; + char local_100c [4]; + char FileName [4096]; + + sprintf(local_100c,"%s/%02ld/%ld.%s",USERPATH,CharacterID % 100,CharacterID,&DAT_080f6560); + bVar1 = FileExists(local_100c); + return bVar1; +} + + + +// WARNING: Removing unreachable block (ram,0x0806d081) +// WARNING: Removing unreachable block (ram,0x0806d0da) +// WARNING: Removing unreachable block (ram,0x0806d08b) +// WARNING: Removing unreachable block (ram,0x0806d095) +// WARNING: Removing unreachable block (ram,0x0806d0c7) +// WARNING: Removing unreachable block (ram,0x0806d0a0) + +bool LoadPlayerData(TPlayerData *Slot) + +{ + bool bVar1; + char cVar2; + int SkillNr; + int iVar3; + uint uVar4; + int iVar5; + uchar *puVar6; + anon_union_4_2_730cd3ca_for_TOutfit_2 *paVar7; + int DepotNr; + int SkillNr_2; + int *piVar8; + char *pcVar9; + undefined1 uVar10; + char *pcVar11; + undefined1 auStack_500c [3]; + bool FileOk; + TReadScriptFile Script; + undefined1 local_102c [4]; + TDynamicWriteBuffer HelpBuffer; + char FileName [4096]; + + if (Slot == (TPlayerData *)0x0) { + pcVar11 = "LoadPlayerData: Slot ist NULL.\n"; + } + else { + uVar4 = Slot->CharacterID; + if (uVar4 != 0) { + piVar8 = &HelpBuffer.super_TWriteBuffer.Position; + pcVar11 = USERPATH; + sprintf((char *)piVar8,"%s/%02ld/%ld.%s",USERPATH,uVar4 % 100,uVar4,&DAT_080f6560); + bVar1 = FileExists((char *)piVar8); + if (!bVar1) { + Slot->Race = 1; + iVar3 = 0; + Slot->Profession = 0; + (Slot->OriginalOutfit).OutfitID = 0; + (Slot->OriginalOutfit).field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + (Slot->CurrentOutfit).OutfitID = 0; + (Slot->CurrentOutfit).field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + Slot->LastLoginTime = 0; + Slot->LastLogoutTime = 0; + Slot->startx = 0; + Slot->starty = 0; + Slot->startz = 0; + Slot->posx = 0; + Slot->posy = 0; + Slot->posz = 0; + Slot->PlayerkillerEnd = 0; + do { + Slot->Minimum[iVar3] = -0x80000000; + iVar3 = iVar3 + 1; + } while (iVar3 < 0x19); + puVar6 = Slot->SpellList; + for (iVar3 = 0x40; iVar3 != 0; iVar3 = iVar3 + -1) { + puVar6[0] = '\0'; + puVar6[1] = '\0'; + puVar6[2] = '\0'; + puVar6[3] = '\0'; + puVar6 = puVar6 + 4; + } + uVar4 = 2000; + piVar8 = Slot->QuestValues; + if (((uint)piVar8 & 4) != 0) { + piVar8 = Slot->QuestValues + 1; + uVar4 = 0x7cc; + Slot->QuestValues[0] = 0; + } + for (uVar4 = uVar4 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) { + *piVar8 = 0; + piVar8 = piVar8 + 1; + } + Slot->MurderTimestamps[0] = 0; + Slot->MurderTimestamps[1] = 0; + Slot->MurderTimestamps[2] = 0; + Slot->MurderTimestamps[3] = 0; + Slot->MurderTimestamps[4] = 0; + Slot->MurderTimestamps[5] = 0; + Slot->MurderTimestamps[6] = 0; + Slot->MurderTimestamps[8] = 0; + Slot->MurderTimestamps[9] = 0; + Slot->MurderTimestamps[10] = 0; + Slot->MurderTimestamps[0xb] = 0; + Slot->MurderTimestamps[0xc] = 0; + Slot->MurderTimestamps[7] = 0; + Slot->MurderTimestamps[0xd] = 0; + Slot->MurderTimestamps[0xe] = 0; + Slot->MurderTimestamps[0xf] = 0; + Slot->MurderTimestamps[0x10] = 0; + Slot->InventorySize = 0; + iVar3 = 0; + Slot->MurderTimestamps[0x11] = 0; + Slot->MurderTimestamps[0x12] = 0; + Slot->MurderTimestamps[0x13] = 0; + Slot->Inventory = (uchar *)0x0; + do { + Slot->Depot[iVar3] = (uchar *)0x0; + Slot->DepotSize[iVar3] = 0; + iVar3 = iVar3 + 1; + } while (iVar3 < 9); + return true; + } + TDynamicWriteBuffer::TDynamicWriteBuffer((TDynamicWriteBuffer *)local_102c,0x4000); + // try { // try from 0806c499 to 0806c49d has its CatchHandler @ 0806d1cf + TReadScriptFile::TReadScriptFile((TReadScriptFile *)auStack_500c); + // try { // try from 0806c4ab to 0806c5b3 has its CatchHandler @ 0806d1c6 + TReadScriptFile::open((TReadScriptFile *)auStack_500c,(char *)piVar8,(int)pcVar11); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + pcVar11 = TReadScriptFile::readString((TReadScriptFile *)auStack_500c); + strcpy(Slot->Name,pcVar11); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Race = iVar3; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Profession = iVar3; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + // try { // try from 0806c5c8 to 0806c626 has its CatchHandler @ 0806d12c + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'('); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + (Slot->OriginalOutfit).OutfitID = iVar3; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + if ((Slot->OriginalOutfit).OutfitID == 0) { + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + (Slot->OriginalOutfit).field_1.ObjectType = (ushort)iVar3; + } + else { + // try { // try from 0806d10d to 0806d111 has its CatchHandler @ 0806d12c + paVar7 = (anon_union_4_2_730cd3ca_for_TOutfit_2 *) + TReadScriptFile::readBytesequence((TReadScriptFile *)auStack_500c); + (Slot->OriginalOutfit).field_1 = *paVar7; + } + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,')'); + // try { // try from 0806c630 to 0806c64a has its CatchHandler @ 0806d1c6 + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + // try { // try from 0806c65f to 0806c6bd has its CatchHandler @ 0806d12c + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'('); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + (Slot->CurrentOutfit).OutfitID = iVar3; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + if ((Slot->CurrentOutfit).OutfitID == 0) { + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + (Slot->CurrentOutfit).field_1.ObjectType = (ushort)iVar3; + } + else { + // try { // try from 0806d0f5 to 0806d0f9 has its CatchHandler @ 0806d12c + paVar7 = (anon_union_4_2_730cd3ca_for_TOutfit_2 *) + TReadScriptFile::readBytesequence((TReadScriptFile *)auStack_500c); + (Slot->CurrentOutfit).field_1 = *paVar7; + } + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,')'); + // try { // try from 0806c6c7 to 0806d062 has its CatchHandler @ 0806d1c6 + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->LastLoginTime = iVar3; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->LastLogoutTime = iVar3; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readCoordinate((TReadScriptFile *)auStack_500c); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readCoordinate((TReadScriptFile *)auStack_500c); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->PlayerkillerEnd = iVar3; + iVar3 = 0; + do { + Slot->Minimum[iVar3] = -0x80000000; + iVar3 = iVar3 + 1; + uVar10 = iVar3 == 0x18; + } while (iVar3 < 0x19); + do { + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + pcVar11 = TReadScriptFile::getIdentifier((TReadScriptFile *)auStack_500c); + iVar3 = 6; + pcVar9 = "skill"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar10 = *pcVar11 == *pcVar9; + pcVar11 = pcVar11 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar10); + if (!(bool)uVar10) goto LAB_0806cb0a; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'('); + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + bVar1 = false; + if ((-1 < iVar3) && (iVar3 < 0x19)) { + bVar1 = true; + } + uVar10 = !bVar1; + if ((bool)uVar10) { + TReadScriptFile::error((TReadScriptFile *)auStack_500c,"illegal skill number"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Actual[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Maximum[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Minimum[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->DeltaAct[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->MagicDeltaAct[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Cycle[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->MaxCycle[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Count[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->MaxCount[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->AddLevel[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Experience[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->FactorPercent[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->NextLevel[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->Delta[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,')'); + } while( true ); + } + pcVar11 = &DAT_080f6720; + } + error(pcVar11); + return false; +LAB_0806cb0a: + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'{'); +LAB_0806cb3b: + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c != SPECIAL) goto LAB_0806cb7f; + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 != '}') goto code_r0x0806cb64; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'{'); + while( true ) { + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c != SPECIAL) goto LAB_0806cc5a; + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 == '}') break; + if (_auStack_500c != SPECIAL) goto LAB_0806cc5a; + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 != ',') { + if ((_auStack_500c != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c), cVar2 != '(')) + { +LAB_0806cc5a: + TReadScriptFile::error((TReadScriptFile *)auStack_500c,"\'(\' expected"); + } + iVar3 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + bVar1 = false; + if ((-1 < iVar3) && (iVar3 < 500)) { + bVar1 = true; + } + if (!bVar1) { + TReadScriptFile::error((TReadScriptFile *)auStack_500c,"illegal quest number"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,','); + iVar5 = TReadScriptFile::readNumber((TReadScriptFile *)auStack_500c); + Slot->QuestValues[iVar3] = iVar5; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,')'); + } + } + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'{'); +LAB_0806cd45: + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c != SPECIAL) goto LAB_0806cd89; + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 != '}') goto code_r0x0806cd6e; + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'{'); + HelpBuffer.super_TWriteBuffer.Size = 0; +LAB_0806cdfa: + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c != SPECIAL) goto LAB_0806ce42; + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 != '}') goto code_r0x0806ce27; + TDynamicWriteBuffer::writeByte((TDynamicWriteBuffer *)local_102c,0xff); + Slot->InventorySize = HelpBuffer.super_TWriteBuffer.Size; + puVar6 = (uchar *)operator_new__(HelpBuffer.super_TWriteBuffer.Size); + Slot->Inventory = puVar6; + memcpy(puVar6,HelpBuffer.super_TWriteBuffer.super_TWriteStream._vptr_TWriteStream, + Slot->InventorySize); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + pcVar11 = (char *)0x7b; + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'{'); + iVar3 = 0; + do { + Slot->Depot[iVar3] = (uchar *)0x0; + iVar3 = iVar3 + 1; + } while (iVar3 < 9); +LAB_0806cf45: + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c == SPECIAL) goto code_r0x0806cf5c; + goto LAB_0806cf8d; +code_r0x0806cb64: + if ((_auStack_500c != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c), cVar2 != ',')) { +LAB_0806cb7f: + iVar3 = TReadScriptFile::getNumber((TReadScriptFile *)auStack_500c); + bVar1 = false; + if ((-1 < iVar3) && (iVar3 < 0x100)) { + bVar1 = true; + } + if (!bVar1) { + TReadScriptFile::error((TReadScriptFile *)auStack_500c,"illegal spell number"); + } + Slot->SpellList[iVar3] = '\x01'; + } + goto LAB_0806cb3b; +code_r0x0806cd6e: + if ((_auStack_500c != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c), cVar2 != ',')) { +LAB_0806cd89: + iVar3 = 1; + do { + Slot->MurderTimestamps[iVar3 + -1] = Slot->MurderTimestamps[iVar3]; + iVar3 = iVar3 + 1; + } while (iVar3 < 0x14); + iVar3 = TReadScriptFile::getNumber((TReadScriptFile *)auStack_500c); + Slot->MurderTimestamps[0x13] = iVar3; + } + goto LAB_0806cd45; +code_r0x0806ce27: + if ((_auStack_500c != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c), cVar2 != ',')) { +LAB_0806ce42: + iVar3 = TReadScriptFile::getNumber((TReadScriptFile *)auStack_500c); + TDynamicWriteBuffer::writeByte((TDynamicWriteBuffer *)local_102c,(uchar)iVar3); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + LoadObjects((TReadScriptFile *)auStack_500c,(TWriteStream *)local_102c,false); + } + goto LAB_0806cdfa; +code_r0x0806cf5c: + cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c); + if (cVar2 == '}') { + TReadScriptFile::nextToken((TReadScriptFile *)auStack_500c); + if (_auStack_500c != ENDOFFILE) { + pcVar11 = "end of file expected"; + TReadScriptFile::error((TReadScriptFile *)auStack_500c,"end of file expected"); + } + TReadScriptFile::close((TReadScriptFile *)auStack_500c,(int)pcVar11); + // try { // try from 0806d073 to 0806d077 has its CatchHandler @ 0806d1cf + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)auStack_500c,(int)pcVar11); + TDynamicWriteBuffer::~TDynamicWriteBuffer((TDynamicWriteBuffer *)local_102c,(int)pcVar11); + return true; + } + if ((_auStack_500c != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)auStack_500c), cVar2 != ',')) { +LAB_0806cf8d: + iVar3 = TReadScriptFile::getNumber((TReadScriptFile *)auStack_500c); + TReadScriptFile::readIdentifier((TReadScriptFile *)auStack_500c); + TReadScriptFile::readSymbol((TReadScriptFile *)auStack_500c,'='); + HelpBuffer.super_TWriteBuffer.Size = 0; + LoadObjects((TReadScriptFile *)auStack_500c,(TWriteStream *)local_102c,false); + Slot->DepotSize[iVar3] = HelpBuffer.super_TWriteBuffer.Size; + puVar6 = (uchar *)operator_new__(HelpBuffer.super_TWriteBuffer.Size); + Slot->Depot[iVar3] = puVar6; + pcVar11 = (char *)HelpBuffer.super_TWriteBuffer.super_TWriteStream; + memcpy(puVar6,HelpBuffer.super_TWriteBuffer.super_TWriteStream._vptr_TWriteStream, + Slot->DepotSize[iVar3]); + } + goto LAB_0806cf45; +} + + + +void SavePlayerData(TPlayerData *Slot) + +{ + uint uVar1; + bool bVar2; + bool FirstSpell; + byte bVar3; + time_t tVar4; + int Number; + int SpellNr; + int *piVar5; + int Limitation; + int iVar6; + char *pcVar7; + undefined *__fd; + undefined1 local_203c; + bool FirstDepot; + bool FirstPosition; + bool FirstMurder; + TReadBuffer Buffer; + TWriteScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + if (Slot == (TPlayerData *)0x0) { + pcVar7 = "SavePlayerData: Slot ist NULL.\n"; + } + else { + uVar1 = Slot->CharacterID; + if (uVar1 != 0) { + pcVar7 = USERPATH; + sprintf(local_101c,"%s/%02ld/%ld.%s",USERPATH,uVar1 % 100,uVar1,&DAT_080f6560); + // try { // try from 0806d29e to 0806d2a2 has its CatchHandler @ 0806de36 + TWriteScriptFile::TWriteScriptFile((TWriteScriptFile *)&Buffer.Position); + // try { // try from 0806d2b6 to 0806d3b6 has its CatchHandler @ 0806de30 + TWriteScriptFile::open((TWriteScriptFile *)&Buffer.Position,local_101c,(int)pcVar7); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"ID = "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Slot->CharacterID); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Name = "); + TWriteScriptFile::writeString((TWriteScriptFile *)&Buffer.Position,Slot->Name); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Race = "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Slot->Race); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Profession = "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Slot->Profession); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"OriginalOutfit = "); + // try { // try from 0806d3cb to 0806d431 has its CatchHandler @ 0806ddc3 + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"("); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,(Slot->OriginalOutfit).OutfitID); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + if ((Slot->OriginalOutfit).OutfitID == 0) { + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position, + (uint)(Slot->OriginalOutfit).field_1.ObjectType); + } + else { + // try { // try from 0806ddad to 0806ddb1 has its CatchHandler @ 0806ddc3 + TWriteScriptFile::writeBytesequence + ((TWriteScriptFile *)&Buffer.Position, + (Slot->OriginalOutfit).field_1.Colors,4); + } + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,")"); + // try { // try from 0806d43b to 0806d455 has its CatchHandler @ 0806de30 + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"CurrentOutfit = "); + // try { // try from 0806d46a to 0806d4d0 has its CatchHandler @ 0806ddc3 + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"("); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,(Slot->CurrentOutfit).OutfitID); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + if ((Slot->CurrentOutfit).OutfitID == 0) { + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position, + (uint)(Slot->CurrentOutfit).field_1.ObjectType); + } + else { + // try { // try from 0806dd8b to 0806dd8f has its CatchHandler @ 0806ddc3 + TWriteScriptFile::writeBytesequence + ((TWriteScriptFile *)&Buffer.Position,(Slot->CurrentOutfit).field_1.Colors + ,4); + } + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,")"); + // try { // try from 0806d4da to 0806dd20 has its CatchHandler @ 0806de30 + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"LastLogin = "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Slot->LastLoginTime); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"LastLogout = "); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Slot->LastLogoutTime) + ; + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"StartPosition = "); + TWriteScriptFile::writeCoordinate + ((TWriteScriptFile *)&Buffer.Position,Slot->startx,Slot->starty,Slot->startz); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"CurrentPosition = "); + TWriteScriptFile::writeCoordinate + ((TWriteScriptFile *)&Buffer.Position,Slot->posx,Slot->posy,Slot->posz); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"PlayerkillerEnd = "); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,Slot->PlayerkillerEnd); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + iVar6 = 0; + piVar5 = Slot->Delta; + do { + if (piVar5[-0x113] != -0x80000000) { + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Skill = ("); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,iVar6); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x145]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,piVar5[-300]) + ; + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x113]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0xfa]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0xe1]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,piVar5[-200]) + ; + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0xaf]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x96]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x7d]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,piVar5[-100]) + ; + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x4b]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x32]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,piVar5[-0x19]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,*piVar5); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,")"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + } + iVar6 = iVar6 + 1; + piVar5 = piVar5 + 1; + } while (iVar6 < 0x19); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Spells = {"); + bVar2 = true; + iVar6 = 0; + do { + if (Slot->SpellList[iVar6] != '\0') { + if (!bVar2) { + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + } + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,iVar6); + bVar2 = false; + } + iVar6 = iVar6 + 1; + } while (iVar6 < 0x100); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"QuestValues = {"); + bVar2 = true; + iVar6 = 0; + do { + if (Slot->QuestValues[iVar6] != 0) { + if (!bVar2) { + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + } + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"("); + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,iVar6); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeNumber + ((TWriteScriptFile *)&Buffer.Position,Slot->QuestValues[iVar6]); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,")"); + bVar2 = false; + } + iVar6 = iVar6 + 1; + } while (iVar6 < 500); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Murders = {"); + bVar2 = true; + iVar6 = 0; + tVar4 = time((time_t *)0x0); + do { + Number = Slot->MurderTimestamps[iVar6]; + if (tVar4 + -0x278d00 < Number) { + if (!bVar2) { + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + Number = Slot->MurderTimestamps[iVar6]; + } + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,Number); + bVar2 = false; + } + iVar6 = iVar6 + 1; + } while (iVar6 < 0x14); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Inventory = {"); + if (Slot->Inventory != (uchar *)0x0) { + TReadBuffer::TReadBuffer + ((TReadBuffer *)&local_203c,Slot->Inventory,Slot->InventorySize); + bVar2 = true; + while (bVar3 = TReadBuffer::readByte((TReadBuffer *)&local_203c), bVar3 != 0xff) { + if (bVar2) { + bVar2 = false; + } + else { + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,","); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText + ((TWriteScriptFile *)&Buffer.Position," "); + } + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,(uint)bVar3); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position," Content="); + SaveObjects((TReadStream *)&local_203c,(TWriteScriptFile *)&Buffer.Position); + } + } + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"Depots = {"); + bVar2 = true; + iVar6 = 0; + do { + if (Slot->Depot[iVar6] != (uchar *)0x0) { + if (bVar2) { + bVar2 = false; + } + else { + // try { // try from 0806dd45 to 0806dd6d has its CatchHandler @ 0806de30 + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,", "); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::writeText + ((TWriteScriptFile *)&Buffer.Position," "); + } + TWriteScriptFile::writeNumber((TWriteScriptFile *)&Buffer.Position,iVar6); + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position," Content="); + TReadBuffer::TReadBuffer + ((TReadBuffer *)&local_203c,Slot->Depot[iVar6],Slot->DepotSize[iVar6]) + ; + SaveObjects((TReadStream *)&local_203c,(TWriteScriptFile *)&Buffer.Position); + } + iVar6 = iVar6 + 1; + } while (iVar6 < 9); + __fd = &DAT_080f2aa0; + TWriteScriptFile::writeText((TWriteScriptFile *)&Buffer.Position,"}"); + TWriteScriptFile::writeLn((TWriteScriptFile *)&Buffer.Position); + TWriteScriptFile::close((TWriteScriptFile *)&Buffer.Position,(int)__fd); + // try { // try from 0806dd2a to 0806dd2e has its CatchHandler @ 0806de36 + TWriteScriptFile::~TWriteScriptFile((TWriteScriptFile *)&Buffer.Position,(int)__fd); + return; + } + pcVar7 = &DAT_080f6800; + } + error(pcVar7); + return; +} + + + +void UnlinkPlayerData(ulong CharacterID) + +{ + char local_100c [4]; + char FileName [4096]; + + sprintf(local_100c,"%s/%02ld/%ld.%s",USERPATH,CharacterID % 100,CharacterID,&DAT_080f6560); + unlink(local_100c); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__ZN7TOutfit4loadER15TReadScriptFile(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +char * GetName(Object *Obj) + +{ + bool bVar1; + char *Help; + TCreature *pTVar2; + ulong uVar3; + char *pcVar4; + Object local_6c [4]; + char local_5c [4]; + char ObjectName [50]; + + local_5c[0] = '\0'; + Object::getObjectType(local_6c); + if (local_6c[0].ObjectID == 99) { + local_6c[0] = (Object)Obj->ObjectID; + pTVar2 = GetCreature(local_6c); + if (pTVar2 == (TCreature *)0x0) { + uVar3 = Object::getCreatureID(Obj); + error("GetName: Kreatur %d existiert nicht.\n",uVar3); + } + else { + snprintf(local_5c,0x32,"%s",pTVar2->Name); + } + } + else { + Object::getObjectType(local_6c); + pcVar4 = ObjectType::getName((ObjectType *)local_6c); + if (pcVar4 != (char *)0x0) { + strcpy(local_5c,pcVar4); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,LIQUIDCONTAINER); + if ((bVar1) && (uVar3 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE), uVar3 != 0)) { + strcat(local_5c," of "); + uVar3 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + pcVar4 = GetLiquidName(uVar3); + strcat(local_5c,pcVar4); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,LIQUIDPOOL); + if ((bVar1) && (uVar3 = Object::getAttribute(Obj,POOLLIQUIDTYPE), uVar3 != 0)) { + strcat(local_5c," of "); + uVar3 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + pcVar4 = GetLiquidName(uVar3); + strcat(local_5c,pcVar4); + } + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,CUMULATIVE); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,AMOUNT); + } + else { + uVar3 = 1; + } + pcVar4 = Plural(local_5c,uVar3); + return pcVar4; +} + + + +char * GetInfo(Object *Obj) + +{ + bool bVar1; + char *pcVar2; + Object local_1c [4]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_1c); + pcVar2 = ObjectType::getDescription((ObjectType *)local_1c); + } + else { + error(&DAT_080f6c00); + pcVar2 = (char *)0x0; + } + return pcVar2; +} + + + +int GetWeight(Object *Obj,int Count) + +{ + bool bVar1; + ulong uVar2; + int Weight; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,TAKE); + if (bVar1) { + Object::getObjectType(local_2c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_2c,WEIGHT); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CUMULATIVE); + if (!bVar1) { + return uVar2; + } + if (Count == -1) { + Count = Object::getAttribute(Obj,AMOUNT); + } + return uVar2 * Count; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0xb58) { + return 0x4c2c; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0xd82) { + return 50000; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0xdb6) { + return 0x5910; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0x10d7) { + return 80000; + } + Object::getObjectType(local_2c); + error("GetWeight: Objekttyp %d ist nicht nehmbar.\n",local_2c[0].ObjectID); + } + else { + error(&DAT_080f6c40); + } + return 0; +} + + + +int GetRowWeight(Object *Obj) + +{ + bool bVar1; + int iVar2; + int iVar3; + int Weight_1; + int local_50; + int Weight; + Object local_3c [4]; + Object local_2c [7]; + + local_3c[0] = (Object)Obj->ObjectID; + local_50 = 0; + if (local_3c[0].ObjectID != NONE.ObjectID) { + local_50 = 0; + if (local_3c[0].ObjectID != NONE.ObjectID) { + do { + local_2c[0].ObjectID = local_3c[0].ObjectID; + iVar2 = GetWeight(local_2c,-1); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { +LAB_0806e37e: + GetFirstContainerObject(local_2c); + iVar3 = GetRowWeight(local_2c); + iVar2 = iVar2 + iVar3; + } + else { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (bVar1) goto LAB_0806e37e; + } + local_50 = local_50 + iVar2; + Object::getNextObject(local_3c); + Obj->ObjectID = (ulong)local_3c[0]; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + return local_50; +} + + + +int GetCompleteWeight(Object *Obj) + +{ + bool bVar1; + int iVar2; + int iVar3; + int Weight; + Object local_2c [7]; + + local_2c[0] = (Object)Obj->ObjectID; + iVar2 = GetWeight(local_2c,-1); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) { + return iVar2; + } + } + GetFirstContainerObject(local_2c); + iVar3 = GetRowWeight(local_2c); + return iVar2 + iVar3; +} + + + +ulong GetObjectCreatureID(Object *Obj) + +{ + bool bVar1; + ulong uVar2; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + while( true ) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 99) break; + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0) goto LAB_0806e4f4; + Object::getContainer(local_3c); + local_2c[0].ObjectID = local_3c[0].ObjectID; + Obj->ObjectID = (ulong)local_3c[0]; + } + uVar2 = Object::getCreatureID(Obj); + } + else { + error(&DAT_080f6cc0); +LAB_0806e4f4: + uVar2 = 0; + } + return uVar2; +} + + + +int GetObjectBodyPosition(Object *Obj) + +{ + bool bVar1; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + while( true ) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0) break; + Object::getObjectType(local_2c); + bVar1 = false; + if ((0 < (int)local_2c[0].ObjectID) && ((int)local_2c[0].ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) break; + Object::getContainer(local_3c); + local_2c[0].ObjectID = local_3c[0].ObjectID; + Obj->ObjectID = (ulong)local_3c[0]; + } + Object::getObjectType(local_3c); + } + else { + error(&DAT_080f6d00); + local_3c[0].ObjectID = 0; + } + return local_3c[0].ObjectID; +} + + + +int GetObjectRNum(Object *Obj) + +{ + bool bVar1; + int Count; + int iVar2; + char *Text; + Object local_3c [4]; + Object local_2c; + Object Search; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(&local_2c); + if (local_2c.ObjectID == 0) { + Text = "GetObjectRNum: Objekt ist MapContainer.\n"; + } + else { + iVar2 = 0; + Object::getContainer(local_3c); + GetFirstContainerObject(&local_2c); + local_3c[0] = (Object)Obj->ObjectID; + if (local_2c.ObjectID == local_3c[0].ObjectID) { + return 0; + } + while (local_2c.ObjectID != NONE.ObjectID) { + iVar2 = iVar2 + 1; + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + bVar1 = local_3c[0].ObjectID == Obj->ObjectID; + local_3c[0].ObjectID = Obj->ObjectID; + if (bVar1) { + return iVar2; + } + } + Text = "GetObjectRNum: Objekt liegt nicht in Container\n"; + } + } + else { + Text = &DAT_080f6d40; + } + error(Text); + return 0; +} + + + +bool ObjectInRange(ulong CreatureID,Object *Obj,int Range) + +{ + bool bVar1; + TCreature *pTVar2; + uint uVar3; + TCreature *cr; + int local_38; + int x; + int y; + int z; + + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + error(&DAT_080f6e40,CreatureID); + } + else { + bVar1 = Object::exists(Obj); + if (bVar1) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + uVar3 = pTVar2->posx - local_38; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if (Range < (int)uVar3) { + return false; + } + uVar3 = pTVar2->posy - x; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if (Range < (int)uVar3) { + return false; + } + if (pTVar2->posz != y) { + return false; + } + return true; + } + error(&DAT_080f6e00); + } + return false; +} + + + +// WARNING: Type propagation algorithm not settling + +bool ObjectAccessible(ulong CreatureID,Object *Obj,int Range) + +{ + bool bVar1; + bool bVar2; + TCreature *pTVar3; + ulong uVar4; + char *Text; + TCreature *cr; + int local_38; + int x; + int y; + int z; + + bVar1 = Object::exists(Obj); + if (!bVar1) { + Text = &DAT_080f6e80; +LAB_0806e7be: + error(Text); + return false; + } + Object::getObjectType((Object *)&z); + if (z == 99) { + uVar4 = 0; + } + else { + z = Obj->ObjectID; + uVar4 = GetObjectCreatureID((Object *)&z); + } + if (uVar4 == CreatureID) { + return true; + } + if (uVar4 != 0) { + return false; + } + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,HANG); + if (bVar1) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + bVar1 = false; + bVar2 = CoordinateFlag(); + if ((bVar2) || (bVar2 = CoordinateFlag(), bVar2)) { + bVar1 = true; + } + if (bVar1) { + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + Text = "ObjectAccessible: Kreatur existiert nicht.\n"; + goto LAB_0806e7be; + } + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar1 = false; + if ((x <= pTVar3->posy) && (pTVar3->posy <= Range + x)) { + bVar1 = true; + } + if (!bVar1) { + return false; + } + if (pTVar3->posx < local_38 - Range || Range + local_38 < pTVar3->posx) { + return false; + } + } + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar1 = false; + if ((local_38 <= pTVar3->posx) && (pTVar3->posx <= Range + local_38)) { + bVar1 = true; + } + if (!bVar1) { + return false; + } + bVar1 = false; + if ((x - Range <= pTVar3->posy) && (pTVar3->posy <= x + Range)) { + bVar1 = true; + } + if (!bVar1) { + return false; + } + } + } + } + z = Obj->ObjectID; + bVar1 = ObjectInRange(CreatureID,(Object *)&z,Range); + return bVar1; +} + + + +char * GetLiquidName(ulong nr) + +{ + char *pcVar1; + + switch(nr) { + case 0: + pcVar1 = "nothing"; + break; + case 1: + pcVar1 = "water"; + break; + case 2: + pcVar1 = "wine"; + break; + case 3: + pcVar1 = "beer"; + break; + case 4: + pcVar1 = "mud"; + break; + case 5: + pcVar1 = "blood"; + break; + case 6: + pcVar1 = "slime"; + break; + case 7: + pcVar1 = "oil"; + break; + case 8: + pcVar1 = "urine"; + break; + case 9: + pcVar1 = "milk"; + break; + case 10: + pcVar1 = "manafluid"; + break; + case 0xb: + pcVar1 = "lifefluid"; + break; + case 0xc: + pcVar1 = "lemonade"; + break; + default: + error(&DAT_080f6f00,nr); + pcVar1 = "unknown"; + } + return pcVar1; +} + + + +uchar GetLiquidColor(ulong nr) + +{ + uchar uVar1; + + switch(nr) { + case 1: + uVar1 = '\x01'; + break; + case 2: + case 10: + uVar1 = '\a'; + break; + case 3: + case 4: + case 7: + uVar1 = '\x03'; + break; + case 5: + case 0xb: + uVar1 = '\x02'; + break; + case 6: + uVar1 = '\x04'; + break; + case 8: + case 0xc: + uVar1 = '\x05'; + break; + case 9: + uVar1 = '\x06'; + break; + default: + error(&DAT_080f6f40,nr); + case 0: + uVar1 = '\0'; + } + return uVar1; +} + + + +int ObjectDistance(Object *Obj1,Object *Obj2) + +{ + bool bVar1; + int iVar2; + int *piVar3; + int local_4c; + int local_48; + int local_44; + int x2; + int y2; + int z2; + int x1; + int y1; + int z1; + + bVar1 = Object::exists(Obj1); + if ((bVar1) && (bVar1 = Object::exists(Obj2), bVar1)) { + z1 = Obj1->ObjectID; + GetObjectCoordinates((Object *)&z1,&z2,&x1,&y1); + z1 = Obj2->ObjectID; + GetObjectCoordinates((Object *)&z1,&local_44,&x2,&y2); + if (y1 == y2) { + local_44 = z2 - local_44; + local_48 = -local_44; + if (-1 < local_44) { + local_48 = local_44; + } + iVar2 = x1 - x2; + local_4c = -iVar2; + if (-1 < iVar2) { + local_4c = iVar2; + } + piVar3 = &local_4c; + if (local_4c <= local_48) { + piVar3 = &local_48; + } + return *piVar3; + } + } + else { + error(&DAT_080f6f80); + } + return 0x7fffffff; +} + + + +Object GetBodyContainer(ulong CreatureID,int Position) + +{ + bool bVar1; + TCreature *Window; + TCreature *cr; + int in_stack_0000000c; + char *Text; + Object local_3c [4]; + ulong local_2c; + + if (((in_stack_0000000c < 1) || (in_stack_0000000c - 0xbU < 0x35)) || (0x4f < in_stack_0000000c) + ) { + Text = &DAT_080f6fc0; + } + else { + Window = GetCreature(Position); + if (Window != (TCreature *)0x0) { + local_2c = (Window->CrObject).ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c == NONE.ObjectID) { + *(ulong *)CreatureID = NONE.ObjectID; + return (Object)CreatureID; + } + if (in_stack_0000000c < 0x40) { + local_3c[0].ObjectID = (Window->CrObject).ObjectID; + bVar1 = Object::exists(local_3c); + if (!bVar1) { + error("GetBodyContainer: Kreatur-Objekt von %s existiert nicht (Pos %d).\n", + Window->Name); + } + local_3c[0].ObjectID = (Window->CrObject).ObjectID; + GetContainerObject((Object *)CreatureID,(int)local_3c); + return (Object)CreatureID; + } + if (Window->Type == PLAYER) { + TPlayer::GetOpenContainer((TPlayer *)CreatureID,(int)Window); + return (Object)CreatureID; + } + error("GetBodyContainer: Nur Spieler haben offene Container.\n"); + goto LAB_0806ec66; + } + Text = "GetBodyContainer: Kreatur %d existiert nicht.\n"; + } + error(Text); +LAB_0806ec66: + *(ulong *)CreatureID = NONE.ObjectID; + return (Object)CreatureID; +} + + + +Object GetBodyObject(ulong CreatureID,int Position) + +{ + int in_stack_0000000c; + ulong local_1c; + Object BodyCon; + + if (in_stack_0000000c - 1U < 10) { + GetBodyContainer((ulong)&local_1c,Position); + if (local_1c != NONE.ObjectID) { + GetFirstContainerObject((Object *)CreatureID); + return (Object)CreatureID; + } + } + else { + error(&DAT_080f70e0); + } + *(ulong *)CreatureID = NONE.ObjectID; + return (Object)CreatureID; +} + + + +Object GetTopObject(int x,int y,int z,bool Move) + +{ + bool bVar1; + char in_stack_00000014; + Object OStack_4c; + bool Move_local; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + OStack_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getNextObject(&stack0xffffffb4); + local_3c[0].ObjectID = NONE.ObjectID; + if (OStack_4c.ObjectID == NONE.ObjectID) { +LAB_0806ef27: + *(ulong *)x = local_2c; + return (Object)x; + } + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,BANK); + if (!bVar1) { + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,CLIP); + if (!bVar1) { + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,BOTTOM); + if (!bVar1) { + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,TOP); + if ((!bVar1) && + ((in_stack_00000014 == '\0' || + (Object::getObjectType(&stack0xffffffb4), OStack_4c.ObjectID != 99)))) + goto LAB_0806ef27; + } + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + *(ulong *)x = NONE.ObjectID; + return (Object)x; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object GetContainer(void) + +{ + ulong in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + if (in_stack_0000000c == 0xffff) { + GetBodyContainer(in_stack_00000004,in_stack_00000008); + } + else { + GetMapContainer(in_stack_00000004,in_stack_0000000c,in_stack_00000010); + } + return (Object)in_stack_00000004; +} + + + +Object GetObject(ulong CreatureID,int x,int y,int z,int RNum,ObjectType *Type) + +{ + ulong uVar1; + Object OVar2; + TCreature *Window; + TCreature *cr; + Object *pOVar3; + bool bVar4; + ulong *in_stack_0000001c; + Object local_6c; + ObjectType Disguise; + Object local_5c [4]; + ulong local_4c; + _func_int_varargs **local_3c; + Object Con; + Object local_2c; + Object Obj; + + local_2c.ObjectID = 0; + if (y == 0xffff) { + OVar2.ObjectID = NONE.ObjectID; + if (z == 0) goto LAB_0806f160; + if ((z - 0xbU < 0x35) || (0x4f < z)) { + error(&DAT_080f7120,0xffff,z,RNum,Type,*in_stack_0000001c); + OVar2 = NONE; + goto LAB_0806f160; + } + if (z < 0x40) { + GetBodyObject((ulong)local_5c,x); + goto LAB_0806f1ca; + } + Window = GetCreature(x); + if (Window == (TCreature *)0x0) { + error("GetObject: Kreatur %d existiert nicht.\n",x); + OVar2 = NONE; + goto LAB_0806f0e4; + } + if (Window->Type != PLAYER) { + error("GetObject: Nur Spieler haben offene Container.\n"); + OVar2 = NONE; + goto LAB_0806f160; + } + TPlayer::GetOpenContainer((TPlayer *)&local_3c,(int)Window); + local_4c = NONE.ObjectID; + OVar2 = NONE; + if (local_3c == (_func_int_varargs **)NONE.ObjectID) goto LAB_0806f0e4; + local_6c.ObjectID = (ulong)local_3c; + GetContainerObject(local_5c,(int)&local_6c); + local_2c.ObjectID = local_5c[0].ObjectID; + } + else if (Type == (ObjectType *)0xffffffff) { + GetTopObject((int)local_5c,y,z,SUB41(RNum,0)); +LAB_0806f1ca: + local_2c.ObjectID = local_5c[0].ObjectID; + } + else { + GetFirstObject(); + bVar4 = local_5c[0].ObjectID != NONE.ObjectID; + local_2c.ObjectID = local_5c[0].ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + if (bVar4) { + do { + local_6c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(&local_6c); + bVar4 = ObjectType::getFlag((ObjectType *)&local_6c,DISGUISE); + if (bVar4) { + Object::getObjectType(local_5c); + uVar1 = ObjectType::getAttribute((ObjectType *)local_5c,DISGUISETARGET); + ObjectType::setTypeID((ObjectType *)&local_6c,uVar1); + uVar1 = *in_stack_0000001c; + } + else { + Object::getObjectType(&local_6c); + uVar1 = *in_stack_0000001c; + } + ObjectType::setTypeID((ObjectType *)local_5c,uVar1); + if (local_6c.ObjectID == local_5c[0].ObjectID) break; + Object::getNextObject(local_5c); + local_2c.ObjectID = local_5c[0].ObjectID; + bVar4 = local_5c[0].ObjectID != NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + } while (bVar4); + } + } + if (local_2c.ObjectID == NONE.ObjectID) { + *(ulong *)CreatureID = NONE.ObjectID; + return (Object)CreatureID; + } + local_6c.ObjectID = NONE.ObjectID; + ObjectType::setTypeID((ObjectType *)&local_6c,0); + OVar2.ObjectID = local_2c.ObjectID; + if (*in_stack_0000001c == local_6c.ObjectID) { +LAB_0806f0e4: + *(ulong *)CreatureID = OVar2.ObjectID; + return (Object)CreatureID; + } + Object::getObjectType(&local_6c); + bVar4 = ObjectType::getFlag((ObjectType *)&local_6c,DISGUISE); + if (bVar4) { + Object::getObjectType(local_5c); + uVar1 = ObjectType::getAttribute((ObjectType *)local_5c,DISGUISETARGET); + ObjectType::setTypeID((ObjectType *)&local_6c,uVar1); + } + else { + Object::getObjectType(&local_6c); + } + ObjectType::setTypeID((ObjectType *)local_5c,*in_stack_0000001c); + pOVar3 = &NONE; + if (local_6c.ObjectID == local_5c[0].ObjectID) { + pOVar3 = &local_2c; + } + OVar2.ObjectID = pOVar3->ObjectID; +LAB_0806f160: + *(ulong *)CreatureID = OVar2.ObjectID; + return (Object)CreatureID; +} + + + +Object __regparm1 GetRowObject(Object *Obj,ObjectType *Type,ulong Value,bool Recurse) + +{ + bool bVar1; + ulong uVar2; + undefined3 in_stack_0000000d; + ulong in_stack_00000010; + char in_stack_00000014; + Object OStack_5c; + bool Recurse_local; + Object local_4c [4]; + Object local_3c; + Object Help; + Object local_2c [7]; + + local_2c[0].ObjectID = NONE.ObjectID; + local_3c.ObjectID = NONE.ObjectID; + if (*(ulong *)Value != NONE.ObjectID) { + do { + NONE.ObjectID = local_2c[0].ObjectID; + local_3c.ObjectID = local_2c[0].ObjectID; + if (in_stack_00000014 != '\0') { + Object::getObjectType(&local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER); + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_2c,_Recurse->TypeID); + // WARNING: Load size is inaccurate + OStack_5c.ObjectID = *Value; + GetFirstContainerObject(local_4c); + GetRowObject(local_2c,(ObjectType *)&local_3c,(ulong)local_4c,SUB41(local_2c,0)) + ; + OStack_5c = (Object)NONE.ObjectID; + local_4c[0].ObjectID = OStack_5c.ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) break; + } + } + Object::getObjectType(&stack0xffffffa4); + ObjectType::setTypeID((ObjectType *)local_4c,_Recurse->TypeID); + ObjectType::setTypeID((ObjectType *)&local_3c,local_4c[0].ObjectID); + if (((OStack_5c.ObjectID == local_3c.ObjectID) && + ((bVar1 = ObjectType::getFlag(_Recurse,LIQUIDCONTAINER), !bVar1 || + (uVar2 = Object::getAttribute((Object *)Value,CONTAINERLIQUIDTYPE), + uVar2 == in_stack_00000010)))) && + ((bVar1 = ObjectType::getFlag(_Recurse,KEY), !bVar1 || + (uVar2 = Object::getAttribute((Object *)Value,KEYNUMBER), uVar2 == in_stack_00000010 + )))) { + Type->TypeID = *(int *)Value; + return (Object)(ulong)Type; + } + Object::getNextObject(local_4c); + OStack_5c.ObjectID = local_4c[0].ObjectID; + *(ulong *)Value = local_4c[0].ObjectID; + local_2c[0] = (Object)NONE.ObjectID; + local_3c = NONE; + } while (local_4c[0].ObjectID != NONE.ObjectID); + } + Type->TypeID = local_3c.ObjectID; + return (Object)(ulong)Type; +} + + + +Object GetInventoryObject(ulong CreatureID,ObjectType *Type,ulong Value) + +{ + bool bVar1; + bool bVar2; + TCreature *pTVar3; + Object OVar4; + TCreature *cr; + Object *in_stack_00000010; + Object local_8c; + Object BodyCon_1; + Object local_7c; + Object Obj_1; + Object local_6c [4]; + Object local_5c; + Object Obj; + Object local_4c; + Object BodyObj; + Object local_2c; + Object BodyCon; + + pTVar3 = GetCreature((ulong)Type); + if (pTVar3 == (TCreature *)0x0) { + error("GetInventoryObject: Kreatur %d existiert nicht.\n",Type); + *(ulong *)CreatureID = NONE.ObjectID; + } + else { + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + local_4c.ObjectID = NONE.ObjectID; + GetFirstContainerObject(&local_4c); + bVar1 = false; + local_5c.ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + Object::getObjectType(&local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_5c,CONTAINER); + if (bVar2) { + bVar1 = true; + } + } + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_6c,*(int *)Value); + local_8c.ObjectID = local_4c.ObjectID; + GetFirstContainerObject(&local_7c); + GetRowObject(&local_7c,(ObjectType *)&local_5c,(ulong)&local_7c, + SUB41(local_6c,0)); + local_8c.ObjectID = NONE.ObjectID; + local_7c.ObjectID = NONE.ObjectID; + OVar4.ObjectID = local_5c.ObjectID; + if (local_5c.ObjectID != NONE.ObjectID) goto LAB_0806f6c8; + } + Object::getNextObject(&local_7c); + local_8c.ObjectID = local_7c.ObjectID; + local_2c.ObjectID = local_7c.ObjectID; + } while (local_7c.ObjectID != NONE.ObjectID); + } + local_7c.ObjectID = (pTVar3->CrObject).ObjectID; + local_4c.ObjectID = NONE.ObjectID; + GetFirstContainerObject(&local_8c); + OVar4 = NONE; + if (local_8c.ObjectID != NONE.ObjectID) { + do { + local_7c.ObjectID = NONE.ObjectID; + local_6c[0].ObjectID = NONE.ObjectID; + ObjectType::setTypeID((ObjectType *)local_6c,*(int *)Value); + local_4c.ObjectID = local_8c.ObjectID; + GetFirstContainerObject(&local_5c); + GetRowObject(in_stack_00000010,(ObjectType *)&local_7c,(ulong)&local_5c, + SUB41(local_6c,0)); + local_6c[0].ObjectID = NONE.ObjectID; + local_5c.ObjectID = NONE.ObjectID; + OVar4.ObjectID = local_7c.ObjectID; + if (local_7c.ObjectID != NONE.ObjectID) break; + Object::getNextObject(local_6c); + local_8c.ObjectID = local_6c[0].ObjectID; + OVar4 = NONE; + } while (local_6c[0].ObjectID != NONE.ObjectID); + } +LAB_0806f6c8: + *(ulong *)CreatureID = OVar4.ObjectID; + } + return (Object)CreatureID; +} + + + +int CountObjectsInContainer(Object *Con) + +{ + bool bVar1; + int iVar2; + int Count; + Object local_3c [4]; + Object local_2c; + Object Search; + + bVar1 = Object::exists(Con); + if (bVar1) { + local_3c[0] = (Object)Con->ObjectID; + iVar2 = 0; + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + iVar2 = iVar2 + 1; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + else { + error("CountObjectsInContainer: Container existiert nicht.\n"); + iVar2 = 0; + } + return iVar2; +} + + + +int CountObjects(Object *Obj) + +{ + bool bVar1; + int iVar2; + int iVar3; + int count; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + iVar3 = 0; + if (bVar1) { + iVar3 = 1; + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + local_4c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject(local_3c); + Obj->ObjectID = (ulong)local_3c[0]; + local_2c[0].ObjectID = local_3c[0].ObjectID; + if (local_3c[0].ObjectID != NONE.ObjectID) { + do { + local_4c[0] = (Object)Obj->ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + iVar2 = CountObjects(local_4c); + iVar3 = iVar3 + iVar2; + Object::getNextObject(local_3c); + Obj->ObjectID = (ulong)local_3c[0]; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + } + return iVar3; +} + + + +int CountObjects(Object *Obj,ObjectType *Type,ulong Value) + +{ + bool bVar1; + ulong uVar2; + int iVar3; + int local_50; + int count; + Object local_3c [4]; + Object local_2c [7]; + + local_50 = 0; + bVar1 = Object::exists(Obj); + iVar3 = 0; + if ((bVar1) && (iVar3 = local_50, Obj->ObjectID != NONE.ObjectID)) { + do { + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_3c,Type->TypeID); + count = Obj->ObjectID; + GetFirstContainerObject(local_2c); + iVar3 = CountObjects(local_2c,(ObjectType *)local_3c,0); + local_50 = local_50 + iVar3; + } + Object::getObjectType((Object *)&count); + ObjectType::setTypeID((ObjectType *)local_3c,Type->TypeID); + ObjectType::setTypeID((ObjectType *)local_2c,local_3c[0].ObjectID); + if (((count == local_2c[0].ObjectID) && + ((bVar1 = ObjectType::getFlag(Type,LIQUIDCONTAINER), !bVar1 || + (uVar2 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE), uVar2 == Value)))) && + ((bVar1 = ObjectType::getFlag(Type,KEY), !bVar1 || + (uVar2 = Object::getAttribute(Obj,KEYNUMBER), uVar2 == Value)))) { + Object::getObjectType((Object *)&count); + bVar1 = ObjectType::getFlag((ObjectType *)&count,CUMULATIVE); + if (bVar1) { + uVar2 = Object::getAttribute(Obj,AMOUNT); + local_50 = uVar2 + local_50; + } + else { + local_50 = local_50 + 1; + } + } + Object::getNextObject(local_3c); + count = local_3c[0].ObjectID; + Obj->ObjectID = (ulong)local_3c[0]; + iVar3 = local_50; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + return iVar3; +} + + + +int CountInventoryObjects(ulong CreatureID,ObjectType *Type,ulong Value) + +{ + TCreature *pTVar1; + int iVar2; + TCreature *cr; + ObjectType local_3c [4]; + Object local_2c [7]; + + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + error("CountInventoryObjects: Kreatur %d existiert nicht; Objekttyp %d.\n",CreatureID, + Type->TypeID); + } + else { + local_2c[0].ObjectID = (pTVar1->CrObject).ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + if (local_2c[0].ObjectID != NONE.ObjectID) { + ObjectType::setTypeID(local_3c,Type->TypeID); + GetFirstContainerObject(local_2c); + iVar2 = CountObjects(local_2c,local_3c,Value); + return iVar2; + } + error("CountInventoryObjects: Kreatur %s hat kein Kreatur-Objekt.\n",pTVar1->Name); + } + return 0; +} + + + +int CountMoney(Object *Obj) + +{ + bool bVar1; + int iVar2; + ulong uVar3; + int local_40; + int count; + Object local_2c [7]; + + local_40 = 0; + bVar1 = Object::exists(Obj); + iVar2 = 0; + if ((bVar1) && (iVar2 = local_40, Obj->ObjectID != NONE.ObjectID)) { + do { + count = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getObjectType((Object *)&count); + GetSpecialObject((SPECIALMEANING)local_2c); + if (count == local_2c[0].ObjectID) { + uVar3 = Object::getAttribute(Obj,AMOUNT); + local_40 = local_40 + uVar3; + } + Object::getObjectType((Object *)&count); + GetSpecialObject((SPECIALMEANING)local_2c); + if (count == local_2c[0].ObjectID) { + uVar3 = Object::getAttribute(Obj,AMOUNT); + local_40 = local_40 + uVar3 * 100; + } + Object::getObjectType((Object *)&count); + GetSpecialObject((SPECIALMEANING)local_2c); + if (count == local_2c[0].ObjectID) { + uVar3 = Object::getAttribute(Obj,AMOUNT); + local_40 = local_40 + uVar3 * 10000; + } + Object::getObjectType((Object *)&count); + bVar1 = ObjectType::getFlag((ObjectType *)&count,CONTAINER); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject((Object *)&count); + iVar2 = CountMoney((Object *)&count); + local_40 = local_40 + iVar2; + } + Object::getNextObject(local_2c); + Obj->ObjectID = (ulong)local_2c[0]; + iVar2 = local_40; + } while (local_2c[0].ObjectID != NONE.ObjectID); + } + return iVar2; +} + + + +int CountInventoryMoney(ulong CreatureID) + +{ + TCreature *pTVar1; + int iVar2; + TCreature *cr; + char *Text; + Object local_2c [4]; + ulong local_1c; + + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + Text = "CountInventoryMoney: Kreatur %d existiert nicht.\n"; + } + else { + local_1c = (pTVar1->CrObject).ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if (local_1c != NONE.ObjectID) { + local_1c = (pTVar1->CrObject).ObjectID; + GetFirstContainerObject(local_2c); + iVar2 = CountMoney(local_2c); + return iVar2; + } + Text = "CountInventoryMoney: Kreatur %s hat kein Kreatur-Objekt.\n"; + CreatureID = (ulong)pTVar1->Name; + } + error(Text,CreatureID); + return 0; +} + + + +void CalculateChange(int Amount,int *Gold,int *Platinum,int *Crystal) + +{ + int iVar1; + int Rest; + int iVar2; + int iVar3; + int iVar4; + char *Text; + int iVar5; + int iVar6; + + iVar6 = *Crystal; + print(); + iVar5 = *Platinum; + iVar3 = *Crystal; + iVar4 = *Gold; + if (iVar3 * 10000 + iVar5 * 100 + iVar4 < Amount) { + Text = &DAT_080f7440; + } + else { + iVar1 = Amount / 10000; + iVar2 = Amount % 10000; + if (iVar5 * 100 + iVar4 < iVar2) { + *Crystal = iVar1 + 1; + *Platinum = (iVar2 + -10000) / 100; + *Gold = (iVar2 + -10000) % 100; + } + else { + if (iVar3 < iVar1) { + iVar2 = Amount + iVar3 * -10000; + } + else { + *Crystal = iVar1; + iVar4 = *Gold; + } + iVar5 = iVar2 / 100; + iVar3 = iVar2 % 100; + if (iVar4 < iVar3) { + *Platinum = iVar5 + 1; + *Gold = iVar3 + -100; + } + else if (*Platinum < iVar5) { + *Gold = iVar2 + *Platinum * -100; + } + else { + *Platinum = iVar5; + *Gold = iVar3; + } + } + print(); + iVar5 = *Platinum; + iVar3 = *Crystal; + iVar4 = *Gold; + if (iVar3 * 10000 + iVar5 * 100 + iVar4 == Amount) { + return; + } + Text = &DAT_080f73e0; + } + error(Text,iVar4,iVar5,iVar3,Amount,iVar6); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetHeight(void) + +{ + bool bVar1; + ulong uVar2; + int Height; + int iVar3; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + iVar3 = 0; + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,HEIGHT); + if (bVar1) { + Object::getObjectType(local_4c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_4c,ELEVATION); + iVar3 = iVar3 + uVar2; + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + return iVar3; +} + + + +bool JumpPossible(int x,int y,int z,bool AvoidPlayers) + +{ + bool bVar1; + TCreature *pTVar2; + bool local_4e; + bool BankThere; + Object OStack_4c; + bool AvoidPlayers_local; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + local_4e = false; + if (local_2c != NONE.ObjectID) { + local_4e = false; + if (local_2c != NONE.ObjectID) { + do { + OStack_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,BANK); + if (bVar1) { + local_4e = true; + } + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNPASS); + if (bVar1) { + Object::getObjectType(&stack0xffffffb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNMOVE); + if (bVar1) { + return false; + } + } + if ((AvoidPlayers) && + (Object::getObjectType(&stack0xffffffb4), OStack_4c.ObjectID == 99)) { + OStack_4c.ObjectID = local_2c; + pTVar2 = GetCreature(&stack0xffffffb4); + if ((pTVar2 != (TCreature *)0x0) && (pTVar2->Type == PLAYER)) { + return false; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + return local_4e; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool FieldPossible(void) + +{ + bool bVar1; + bool bVar2; + int in_stack_00000010; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,BANK); + if (bVar2) goto LAB_080701d5; + } + bVar1 = true; +LAB_080701d5: + bVar2 = false; + if (!bVar1) { + if (local_2c != NONE.ObjectID) { + do { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_4c); + if (local_4c[0].ObjectID != 99) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,UNPASS); + if (bVar1) { + return false; + } + } + Object::getObjectType(local_4c); + if (local_4c[0].ObjectID != 99) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,UNLAY); + if (bVar1) { + return false; + } + } + if (in_stack_00000010 - 4U < 2) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,UNPASS); + if (bVar1) { + return false; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + bVar2 = true; + } + return bVar2; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local + +bool SearchFreeField(int *x,int *y,int *z,int Distance,ushort HouseID,bool Jump) + +{ + bool bVar1; + bool bVar2; + ushort uVar3; + int local_28; + int dy; + int dx; + int Dist; + int Direction; + bool Jump_local; + ushort HouseID_local; + + local_28 = 0; + Dist = 4; + dx = 0; + dy = 0; + do { + if (Jump) { + bVar2 = JumpPossible(dy + *x,local_28 + *y,*z,true); +LAB_08070550: + if (bVar2 != false) { +LAB_080703ed: + if (((HouseID == 0xffff) || (bVar2 = IsHouse(dy + *x,local_28 + *y,*z), !bVar2)) || + ((HouseID != 0 && + (uVar3 = GetHouseID(dy + *x,local_28 + *y,*z), uVar3 == HouseID)))) { + *x = *x + dy; + *y = *y + local_28; + return true; + } + } + } + else { + bVar2 = false; + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar2 = CoordinateFlag(); + bVar2 = !bVar2; + } + if (bVar2) { + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar2 = CoordinateFlag(); + goto LAB_08070550; + } + goto LAB_080703ed; + } + } + if (Dist == 2) { + dy = dy + -1; + if (dy + dx == 0) { + Dist = 3; + } + } + else if ((uint)Dist < 3) { + if ((Dist == 1) && (local_28 = local_28 + -1, local_28 + dx == 0)) { + Dist = 2; + } + } + else if (Dist == 3) { + local_28 = local_28 + 1; + if (local_28 == dx) { + Dist = 4; + } + } + else if ((Dist == 4) && (dy = dy + 1, dy == dx + 1)) { + Dist = 1; + dx = dy; + } + if (Distance < dx) { + return false; + } + } while( true ); +} + + + +bool SearchLoginField(int *x,int *y,int *z,int Distance,bool Player) + +{ + bool bVar1; + bool bVar2; + ushort HouseID_00; + ushort uVar3; + int Direction; + uint uVar4; + int iStack_60; + bool BankThere; + int dy; + int dx; + int Dist; + ushort HouseID; + Object OStack_4c; + bool Player_local; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + HouseID_00 = GetHouseID(*x,*y,*z); + bVar1 = SearchFreeField(x,y,z,Distance,HouseID_00,false); + if ((!bVar1) || ((Player && (bVar1 = IsNoLogoutField(), bVar1)))) { + dx = 0; + uVar4 = 4; + dy = 0; + iStack_60 = 0; + do { + GetFirstObject(); + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + if (((local_2c != NONE.ObjectID) && ((!Player || (bVar2 = IsNoLogoutField(), !bVar2)))) + && ((bVar2 = IsHouse(dy + *x,iStack_60 + *y,*z), !bVar2 || + ((HouseID_00 != 0 && + (uVar3 = GetHouseID(dy + *x,iStack_60 + *y,*z), uVar3 == HouseID_00)))))) { + if (local_2c != NONE.ObjectID) { + do { + OStack_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(&stack0xffffffb4); + bVar2 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,BANK); + if (bVar2) { + bVar1 = true; + } + Object::getObjectType(&stack0xffffffb4); + if (OStack_4c.ObjectID == 99) goto LAB_08070740; + Object::getObjectType(&stack0xffffffb4); + bVar2 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNPASS); + if (bVar2) { + Object::getObjectType(&stack0xffffffb4); + bVar2 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNMOVE); + if (bVar2) goto LAB_08070740; + } + if (!Player) { + Object::getObjectType(&stack0xffffffb4); + bVar2 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,AVOID); + if (bVar2) { + Object::getObjectType(&stack0xffffffb4); + bVar2 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNMOVE); + if (bVar2) goto LAB_08070740; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + OStack_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (bVar1) { + *x = *x + dy; + *y = *y + iStack_60; + goto LAB_0807063b; + } + } +LAB_08070740: + if (uVar4 == 2) { + dy = dy + -1; + if (dy + dx == 0) { + uVar4 = 3; + } + } + else if (uVar4 < 3) { + if ((uVar4 == 1) && (iStack_60 = iStack_60 + -1, iStack_60 + dx == 0)) { + uVar4 = 2; + } + } + else if (uVar4 == 3) { + iStack_60 = iStack_60 + 1; + if (iStack_60 == dx) { + uVar4 = 4; + } + } + else if ((uVar4 == 4) && (dy = dy + 1, dy == dx + 1)) { + uVar4 = 1; + dx = dy; + } + bVar1 = false; + } while (dx <= Distance); + } + else { +LAB_0807063b: + bVar1 = true; + } + return bVar1; +} + + + +bool SearchSpawnField(int *x,int *y,int *z,int Distance,bool Player) + +{ + bool bVar1; + bool bVar2; + bool bVar3; + bool bVar4; + bool bVar5; + bool bVar6; + ushort uVar7; + ushort uVar8; + int iVar9; + undefined4 *puVar10; + int iVar11; + int *piVar12; + long lVar13; + int NewTieBreaker; + int iVar14; + int iVar15; + int dy; + int iVar16; + int iVar17; + int dx; + int xmax; + int iVar18; + int local_b0; + int ddy; + int ddx; + bool LoginBad; + bool LoginPossible; + bool ExpansionPossible; + bool Found; + bool Expanded; + int Pass; + int TieBreaker; + int BestY; + int BestX; + ushort HouseID; + bool Minimize; + Object OStack_6c; + bool Player_local; + Object local_5c [4]; + ulong local_4c; + Object Obj; + undefined1 local_3c [4]; + matrix Map; + + xmax = Distance; + if (0x7fffffff < (uint)Distance) { + xmax = -Distance; + } + iVar16 = -xmax; + uVar7 = GetHouseID(*x,*y,*z); + iVar18 = iVar16; + matrix::matrix((matrix *)local_3c,iVar16,xmax,iVar16,xmax); + if (-xmax == xmax || iVar16 < xmax) { + do { + iVar17 = -xmax; + if (-xmax == xmax || iVar17 < xmax) { + do { + iVar9 = iVar17 - Map.xmin; + iVar14 = iVar16 - (int)local_3c; + if ((((iVar14 < 0) || (Map.ymin <= iVar14)) || (iVar9 < 0)) || (Map.dx <= iVar9) + ) { + // try { // try from 08070a0d to 08071018 has its CatchHandler @ 08071071 + error("matrix::operator(): Ungueltiger Index %d/%d.\n", + iVar14 + (int)local_3c,iVar9 + Map.xmin); + puVar10 = (undefined4 *)Map.dy; + } + else { + puVar10 = (undefined4 *)(Map.dy + (iVar14 + iVar9 * Map.ymin) * 4); + } + *puVar10 = 0x7fffffff; + iVar17 = iVar17 + 1; + } while (iVar17 <= xmax); + } + iVar16 = iVar16 + 1; + } while (iVar16 <= xmax); + } + if ((((int)local_3c < 1) && (-(int)local_3c < Map.ymin)) && + ((Map.xmin < 1 && (-Map.xmin < Map.dx)))) { + puVar10 = (undefined4 *)(Map.dy + (-Map.xmin * Map.ymin + -(int)local_3c) * 4); + } + else { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",0,0); + puVar10 = (undefined4 *)Map.dy; + } + *puVar10 = 0; + BestY = 0; + TieBreaker = 0; + Pass = -1; + _LoginPossible = 0; + while( true ) { + bVar1 = false; + iVar16 = -xmax; + bVar4 = false; + if (-xmax == xmax || iVar16 < xmax) { + do { + iVar17 = -xmax; + if (-xmax == xmax || iVar17 < xmax) { + do { + iVar9 = iVar17 - Map.xmin; + iVar14 = iVar16 - (int)local_3c; + if (((iVar14 < 0) || (Map.ymin <= iVar14)) || + ((iVar9 < 0 || (Map.dx <= iVar9)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n", + iVar14 + (int)local_3c,iVar9 + Map.xmin,iVar18); + piVar12 = (int *)Map.dy; + } + else { + piVar12 = (int *)(Map.dy + (iVar14 + iVar9 * Map.ymin) * 4); + } + if (((*piVar12 == _LoginPossible) && + ((bVar5 = IsHouse(*x + iVar16,*y + iVar17,*z), !bVar5 || + ((uVar7 != 0 && + (uVar8 = GetHouseID(*x + iVar16,*y + iVar17,*z), uVar8 == uVar7)))))) + && ((Player || (bVar5 = IsProtectionZone(), !bVar5)))) { + iVar18 = *z; + GetFirstObject(); + local_5c[0] = (Object)NONE.ObjectID; + if (local_4c != NONE.ObjectID) { + bVar5 = true; + bVar2 = true; + bVar3 = false; + if (local_4c != NONE.ObjectID) { + do { + OStack_6c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(&stack0xffffff94); + if (OStack_6c.ObjectID == 99) { + bVar2 = false; + } + Object::getObjectType(&stack0xffffff94); + bVar6 = ObjectType::getFlag((ObjectType *)&stack0xffffff94, + UNPASS); + if (bVar6) { + Object::getObjectType(&stack0xffffff94); + bVar6 = ObjectType::getFlag((ObjectType *) + &stack0xffffff94,UNMOVE); + if (bVar6) { + bVar5 = false; + bVar2 = false; + } + else { + bVar3 = true; + } + } + Object::getObjectType(&stack0xffffff94); + bVar6 = ObjectType::getFlag((ObjectType *)&stack0xffffff94, + AVOID); + if (bVar6) { + Object::getObjectType(&stack0xffffff94); + bVar6 = ObjectType::getFlag((ObjectType *) + &stack0xffffff94,UNMOVE); + bVar3 = bVar2; + if (bVar6) { + bVar5 = false; + bVar3 = false; + if ((bVar2) && (!Player)) { + bVar3 = true; + } + } + bVar2 = bVar3; + bVar3 = true; + } + Object::getNextObject(local_5c); + local_4c = local_5c[0].ObjectID; + } while (local_5c[0].ObjectID != NONE.ObjectID); + } + OStack_6c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + if ((bVar5) || (_LoginPossible == 0)) { + ddy = -1; + do { + local_b0 = -1; + iVar9 = ddy + iVar16; + do { + bVar1 = false; + if ((-xmax <= iVar9) && (iVar9 <= xmax)) { + bVar1 = true; + } + if (bVar1) { + bVar1 = false; + iVar14 = local_b0 + iVar17; + if ((-xmax <= iVar14) && (iVar14 <= xmax)) { + bVar1 = true; + } + if (bVar1) { + iVar11 = iVar14 - Map.xmin; + iVar15 = iVar9 - (int)local_3c; + if ((((iVar15 < 0) || (Map.ymin <= iVar15)) || + (iVar11 < 0)) || (Map.dx <= iVar11)) { + error( + "matrix::operator(): Ungueltiger Index %d/%d.\n", + iVar15 + (int)local_3c,iVar11 + Map.xmin,iVar18); + piVar12 = (int *)Map.dy; + } + else { + piVar12 = (int *)(Map.dy + (iVar15 + iVar11 * + Map.ymin) * 4); + } + if (_LoginPossible < *piVar12) { + iVar14 = iVar14 - Map.xmin; + iVar11 = iVar9 - (int)local_3c; + if (((iVar11 < 0) || (Map.ymin <= iVar11)) || + ((iVar14 < 0 || (Map.dx <= iVar14)))) { + error( + "matrix::operator(): Ungueltiger Index %d/%d.\n", + iVar11 + (int)local_3c,iVar14 + Map.xmin); + piVar12 = (int *)Map.dy; + } + else { + piVar12 = (int *)(Map.dy + (iVar11 + iVar14 * + Map.ymin) * 4); + } + iVar14 = -ddy; + if (-1 < ddy) { + iVar14 = ddy; + } + iVar11 = -local_b0; + if (-1 < local_b0) { + iVar11 = local_b0; + } + *piVar12 = iVar14 + _LoginPossible + iVar11; + } + } + } + local_b0 = local_b0 + 1; + } while (local_b0 < 2); + ddy = ddy + 1; + } while (ddy < 2); + bVar1 = true; + } + if ((bVar2) && ((bVar5 = IsNoLogoutField(), !bVar5 || (!Player)))) { + lVar13 = random(); + if (!bVar3) { + lVar13 = lVar13 + 100; + } + if (Pass < lVar13) { + bVar4 = true; + Pass = lVar13; + TieBreaker = iVar17; + BestY = iVar16; + } + } + } + } + iVar17 = iVar17 + 1; + } while (iVar17 <= xmax); + } + iVar16 = iVar16 + 1; + } while (iVar16 <= xmax); + } + if (((bVar4) && (-1 < Distance)) || (!bVar1)) break; + _LoginPossible = _LoginPossible + 1; + } + if (Pass < 0) { + if (Map.dy != 0) { + operator_delete__((void *)Map.dy); + } + bVar4 = false; + } + else { + *x = *x + BestY; + *y = *y + TieBreaker; + if (Map.dy != 0) { + operator_delete__((void *)Map.dy); + } + bVar4 = true; + } + return bVar4; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool SearchFlightField(void) + +{ + TCreature *pTVar1; + TCreature *pTVar2; + int iVar3; + TCreature *Pursuer; + int dy; + int dx; + int iVar4; + TCreature *Fugitive; + ulong in_stack_00000004; + ulong in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + int *in_stack_00000014; + char *Text; + int local_4c; + int Try [9]; + + pTVar1 = GetCreature(in_stack_00000004); + if (pTVar1 == (TCreature *)0x0) { + Text = &DAT_080f75c0; + } + else { + pTVar2 = GetCreature(in_stack_00000008); + if (pTVar2 == (TCreature *)0x0) { + Text = "SearchFlightField: Verfolger existiert nicht.\n"; + } + else { + if (pTVar1->posz == pTVar2->posz) { + iVar3 = 0; + do { + Try[iVar3 + -1] = 0; + iVar3 = iVar3 + 1; + } while (iVar3 < 9); + iVar3 = pTVar1->posy - pTVar2->posy; + iVar4 = pTVar1->posx - pTVar2->posx; + if (-1 < iVar4) { + Try[0] = 1; + } + if (iVar3 < 1) { + Try[1] = 3; + } + if (iVar4 < 1) { + Try[2] = 5; + } + if (-1 < iVar3) { + Try[3] = 7; + } + RandomShuffle(Try,4); + if (iVar3 <= iVar4) { + Try[4] = 2; + } + if (iVar4 <= -iVar3) { + Try[5] = 4; + } + if (iVar4 <= iVar3) { + Try[6] = 6; + } + if (SBORROW4(iVar4,-iVar3) == iVar4 + iVar3 < 0) { + Try[7] = 8; + } + RandomShuffle(Try + 4,4); + *in_stack_00000014 = pTVar1->posz; + iVar3 = 0; + do { + iVar4 = Try[iVar3 + -1]; + if (iVar4 == 0) goto LAB_08071259; + switch(iVar4) { + case 1: + iVar4 = pTVar1->posx + 1; + goto LAB_08071212; + case 2: + iVar4 = pTVar1->posx + 1; + break; + case 3: + iVar4 = pTVar1->posx; + break; + case 4: + iVar4 = pTVar1->posx + -1; + break; + case 5: + iVar4 = pTVar1->posx + -1; +LAB_08071212: + *in_stack_0000000c = iVar4; + iVar4 = pTVar1->posy; + goto LAB_0807121d; + case 6: + iVar4 = pTVar1->posx + -1; + goto LAB_080712bc; + case 7: + iVar4 = pTVar1->posx; + goto LAB_080712bc; + case 8: + iVar4 = pTVar1->posx + 1; +LAB_080712bc: + *in_stack_0000000c = iVar4; + iVar4 = pTVar1->posy + 1; + goto LAB_0807121d; + default: + error(&DAT_080f7540,iVar4); + return false; + } + *in_stack_0000000c = iVar4; + iVar4 = pTVar1->posy + -1; +LAB_0807121d: + *in_stack_00000010 = iVar4; + iVar4 = (*pTVar1->_vptr_TCreature[3]) + (pTVar1,*in_stack_0000000c,*in_stack_00000010, + *in_stack_00000014,0,0); + if ((char)iVar4 != '\0') { + return true; + } +LAB_08071259: + iVar3 = iVar3 + 1; + if (8 < iVar3) { + return false; + } + } while( true ); + } + Text = &DAT_080f74e0; + } + } + error(Text); + return false; +} + + + +// WARNING: Variable defined which should be unmapped: TieBreaker + +bool SearchSummonField(int *x,int *y,int *z,int Distance) + +{ + bool bVar1; + bool bVar2; + long lVar3; + int dy; + int iVar4; + int NewTieBreaker; + int dx; + int BestY; + int BestX; + int TieBreaker; + + dx = 0; + BestX = -1; + BestY = 0; + NewTieBreaker = -Distance; + if (-Distance == Distance || NewTieBreaker < Distance) { + do { + iVar4 = -Distance; + if (-Distance == Distance || iVar4 < Distance) { + do { + lVar3 = random(); + if (BestX < lVar3) { + bVar2 = false; + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar2 = CoordinateFlag(); + bVar2 = !bVar2; + } + if ((((bVar2) && (bVar2 = CoordinateFlag(), !bVar2)) && + (bVar2 = IsProtectionZone(), !bVar2)) && + ((bVar2 = IsHouse(NewTieBreaker + *x,*y + iVar4,*z), !bVar2 && + (bVar2 = ThrowPossible(*x,*y,*z,NewTieBreaker + *x,*y + iVar4,*z,0), + bVar2)))) { + BestY = NewTieBreaker + *x; + dx = *y + iVar4; + BestX = lVar3; + } + } + iVar4 = iVar4 + 1; + } while (iVar4 <= Distance); + } + NewTieBreaker = NewTieBreaker + 1; + } while (NewTieBreaker <= Distance); + } + if (BestX != -1) { + *x = BestY; + *y = dx; + } + return BestX != -1; +} + + + +bool ThrowPossible(int sx,int sy,int sz,int zx,int zy,int zz,int Power) + +{ + uint uVar1; + bool bVar2; + bool bVar3; + int iVar4; + int newz; + int z; + int iVar5; + int iVar6; + int *piVar7; + int iVar8; + int zmin; + int iVar9; + int newy; + int iVar10; + uint local_68; + int i; + int local_5c; + int z_1; + int local_54; + int local_50; + Object local_4c; + Object Obj_1; + Object local_2c; + Object Obj; + + iVar5 = sz + -1; + local_5c = sz - Power; + if (local_5c < 0) { + local_5c = 0; + } + do { + if (iVar5 < local_5c) { +LAB_08071587: + if (local_5c <= zz) { + iVar4 = zx - sx; + iVar6 = zy - sy; + iVar5 = zz; + while( true ) { + piVar7 = &zz; + if (sz <= iVar5) { + piVar7 = &sz; + } + if (*piVar7 < local_5c) break; + if ((zx != sx) || (iVar9 = zx, iVar10 = zy, zy != sy)) { + local_68 = 1; + local_50 = -iVar4; + if (-1 < iVar4) { + local_50 = iVar4; + } + local_54 = -iVar6; + if (-1 < iVar6) { + local_54 = iVar6; + } + piVar7 = &local_54; + if (local_54 <= local_50) { + piVar7 = &local_50; + } + iVar10 = *piVar7; + bVar2 = CoordinateFlag(); + if (bVar2) { + local_68 = (uint)(sx <= zx); + } + bVar2 = CoordinateFlag(); + uVar1 = local_68; + if ((bVar2) && (uVar1 = 0, sy <= zy)) { + uVar1 = local_68; + } + while (((int)uVar1 <= iVar10 && (bVar2 = CoordinateFlag(), !bVar2))) { + uVar1 = uVar1 + 1; + } + iVar8 = (iVar10 - uVar1) + 1; + iVar5 = zz; + iVar9 = (int)(zx * (uVar1 - 1) + sx * iVar8) / iVar10; + iVar10 = (int)((uVar1 - 1) * zy + sy * iVar8) / iVar10; + } + iVar8 = local_5c; + if ((local_5c < 0xf) && (local_5c < iVar5)) { + do { + GetFirstObject(); + bVar2 = false; + local_2c.ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + Object::getObjectType(&local_2c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_2c,BANK); + if (bVar3) { + bVar2 = true; + } + } + iVar5 = zz; + } while ((!bVar2) && (iVar8 = iVar8 + 1, iVar8 < zz)); + } + if ((iVar9 == zx) && ((iVar10 == zy && (iVar8 == iVar5)))) { + return true; + } + local_5c = local_5c + 1; + } + } + return false; + } + GetFirstObject(); + bVar2 = false; + local_4c.ObjectID = NONE.ObjectID; + if (local_2c.ObjectID != NONE.ObjectID) { + Object::getObjectType(&local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_4c,BANK); + if (bVar3) { + bVar2 = true; + } + } + if (bVar2) { + local_5c = iVar5 + 1; + goto LAB_08071587; + } + iVar5 = iVar5 + -1; + } while( true ); +} + + + +void GetCreatureLight(ulong CreatureID,int *Brightness,int *Color) + +{ + TSkill *pTVar1; + bool bVar2; + bool bVar3; + TPlayer *pl; + TCreature *pTVar4; + ulong uVar5; + TPlayer *pTVar6; + int *piVar7; + byte bVar8; + TCreature *cr; + int i; + int iVar9; + int local_6c; + int b; + int Blue; + int g; + int Green; + int r; + int Red; + int B; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + Object Obj; + + pTVar4 = GetCreature(CreatureID); + if (pTVar4 == (TCreature *)0x0) { + error("GetCreatureLight: Kreatur existiert nicht.\n"); + *Brightness = 0; + *Color = 0; + } + else { + *Brightness = 0; + pTVar1 = (pTVar4->super_TSkillBase).Skills[0xf]; + if (pTVar1 != (TSkill *)0x0) { + iVar9 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + *Brightness = iVar9; + } + if (pTVar4->Type == PLAYER) { + pTVar6 = GetPlayer(CreatureID); + if (pTVar6 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",0x48); + bVar8 = 0; + } + else { + bVar8 = pTVar6->Rights[9] & 1; + } + if (bVar8 != 0) { + B = 7; + piVar7 = &B; + if (6 < *Brightness) { + piVar7 = Brightness; + } + *Brightness = *piVar7; + } + } + iVar9 = 1; + r = *Brightness * 5; + g = *Brightness * 5; + b = *Brightness * 5; + do { + bVar2 = false; + GetBodyObject((ulong)&local_2c,CreatureID); + local_3c = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,LIGHT); + if (bVar3) { + bVar2 = true; + } + } + if (bVar2) { + Object::getObjectType(local_4c); + Red = ObjectType::getAttribute((ObjectType *)local_4c,BRIGHTNESS); + Object::getObjectType(local_4c); + uVar5 = ObjectType::getAttribute((ObjectType *)local_4c,LIGHTCOLOR); + Green = ((int)uVar5 / 0x24) * Red; + Blue = ((int)uVar5 / 6 + ((int)uVar5 / 0x24) * -6) * Red; + local_6c = ((int)uVar5 % 6) * Red; + piVar7 = &Red; + if (Red <= *Brightness) { + piVar7 = Brightness; + } + *Brightness = *piVar7; + piVar7 = &Green; + if (Green <= r) { + piVar7 = &r; + } + r = *piVar7; + piVar7 = &Blue; + if (Blue <= g) { + piVar7 = &g; + } + g = *piVar7; + piVar7 = &local_6c; + if (local_6c <= b) { + piVar7 = &b; + } + b = *piVar7; + } + iVar9 = iVar9 + 1; + } while (iVar9 < 0xb); + iVar9 = *Brightness; + if (iVar9 == 0) { + *Color = 0; + } + else { + *Color = b / iVar9 + (g / iVar9) * 6 + (r / iVar9) * 0x24; + } + } + return; +} + + + +int GetInventoryWeight(ulong CreatureID) + +{ + TCreature *cr; + TCreature *pTVar1; + int iVar2; + Object local_1c [5]; + + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + error("GetInventoryWeight: Kreatur %d existiert nicht.\n",CreatureID); + iVar2 = 0; + } + else { + GetFirstContainerObject(local_1c); + iVar2 = GetRowWeight(local_1c); + } + return iVar2; +} + + + +bool CheckRight(ulong CharacterID,RIGHT Right) + +{ + TPlayer *pTVar1; + int iVar2; + TPlayer *pl; + char *Text; + RIGHT RVar3; + + pTVar1 = GetPlayer(CharacterID); + if (pTVar1 == (TPlayer *)0x0) { + Text = "CheckRight: Spieler existiert nicht; Right=%d.\n"; + } + else { + if (-1 < (int)Right) { + RVar3 = Right + KICK; + if (-1 < (int)Right) { + RVar3 = Right; + } + iVar2 = (int)RVar3 >> 3; + if (iVar2 < 0xc) { + return (bool)((byte)((int)(uint)pTVar1->Rights[iVar2] >> + ((char)Right - (char)(iVar2 << 3) & 0x1fU)) & 1); + } + } + Text = &DAT_080f76c0; + } + error(Text,Right); + return false; +} + + + +bool CheckBanishmentRight(ulong CharacterID,int Reason,int Action) + +{ + uint uVar1; + bool bVar2; + byte bVar3; + TPlayer *pl; + TPlayer *pTVar4; + TPlayer *pl_1; + int iVar5; + bool bVar7; + char *pcVar8; + undefined4 uVar9; + uint uVar6; + + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckBanishmentRight: Spieler existiert nicht.\n"); + return false; + } + bVar7 = false; + if ((-1 < Reason) && (Reason < 0x20)) { + bVar7 = true; + } + if (!bVar7) { + pcVar8 = &DAT_080f7740; + Action = Reason; +LAB_08071c14: + error(pcVar8,Action,CharacterID); + return false; + } + bVar7 = false; + if ((-1 < Action) && (Action < 7)) { + bVar7 = true; + } + if (!bVar7) { + pcVar8 = &DAT_080f7700; + goto LAB_08071c14; + } + uVar1 = Reason + 0x12; + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + pcVar8 = "CheckRight: Spieler existiert nicht; Right=%d.\n"; +LAB_08071c63: + error(pcVar8,uVar1); + bVar3 = 0; + } + else { + if ((int)uVar1 < 0) { +LAB_08071c58: + pcVar8 = &DAT_080f76c0; + goto LAB_08071c63; + } + uVar6 = uVar1; + if (0x7fffffff < uVar1) { + uVar6 = Reason + 0x19; + } + iVar5 = (int)uVar6 >> 3; + if (0xb < iVar5) goto LAB_08071c58; + bVar3 = (byte)((int)(uint)pTVar4->Rights[iVar5] >> + ((char)uVar1 - (char)(iVar5 << 3) & 0x1fU)) & 1; + } + if (bVar3 == 0) { + return false; + } + bVar7 = false; + switch(Action) { + case 0: + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",1); + bVar7 = false; + } + else { + bVar7 = (bool)((byte)((int)(uint)pTVar4->Rights[0] >> 1) & 1); + } + break; + case 1: + bVar7 = false; + if ((0x11 < (int)uVar1) && (bVar7 = true, 0x1a < (int)uVar1)) { + bVar7 = false; + } + if (!bVar7) { + return false; + } + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 != (TPlayer *)0x0) { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 2); + goto LAB_08071cf8; + } + uVar9 = 2; + goto LAB_08071d12; + case 2: + bVar7 = false; + if ((0x11 < (int)uVar1) && (bVar7 = true, 0x1a < (int)uVar1)) { + bVar7 = false; + } + if (bVar7) { + return false; + } + goto LAB_08071d3a; + case 3: + bVar7 = false; + if ((0x11 < (int)uVar1) && (bVar7 = true, 0x1a < (int)uVar1)) { + bVar7 = false; + } + if (!bVar7) { + return false; + } + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",2); + bVar3 = 0; + } + else { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 2) & 1; + } + if (bVar3 == 0) { + return false; + } +LAB_08071d3a: + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + uVar9 = 4; +LAB_08071d12: + error("CheckRight: Spieler existiert nicht; Right=%d.\n",uVar9); + bVar3 = 0; + } + else { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 4); +LAB_08071cf8: + bVar3 = bVar3 & 1; + } + bVar7 = bVar3 != 0; + break; + case 4: + bVar7 = false; + if ((0x11 < (int)uVar1) && (bVar7 = true, 0x1a < (int)uVar1)) { + bVar7 = false; + } + if (bVar7) { + return false; + } + goto LAB_08071ddc; + case 5: + bVar7 = false; + if ((0x11 < (int)uVar1) && (bVar7 = true, 0x1a < (int)uVar1)) { + bVar7 = false; + } + if (!bVar7) { + return false; + } + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",2); + bVar3 = 0; + } + else { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 2) & 1; + } + if (bVar3 == 0) { + return false; + } +LAB_08071ddc: + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",4); + bVar3 = 0; + } + else { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 4) & 1; + } + if (bVar3 == 0) { + return false; + } + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 != (TPlayer *)0x0) { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 5); + goto LAB_08071cf8; + } + uVar9 = 5; + goto LAB_08071d12; + case 6: + bVar7 = false; + bVar2 = false; + if ((0x1a < (int)uVar1) && (bVar2 = true, 0x2d < (int)uVar1)) { + bVar2 = false; + } + if ((bVar2) || (Reason == 0x1d)) { + pTVar4 = GetPlayer(CharacterID); + if (pTVar4 == (TPlayer *)0x0) { + error("CheckRight: Spieler existiert nicht; Right=%d.\n",3); + bVar3 = 0; + } + else { + bVar3 = (byte)((int)(uint)pTVar4->Rights[0] >> 3) & 1; + } + bVar7 = bVar3 != 0; + } + } + return bVar7; +} + + + +char * GetBanishmentReason(int Reason) + +{ + char *pcVar1; + + switch(Reason) { + case 0: + pcVar1 = "NAME_INSULTING"; + break; + case 1: + pcVar1 = "NAME_SENTENCE"; + break; + case 2: + pcVar1 = "NAME_NONSENSICAL_LETTERS"; + break; + case 3: + pcVar1 = "NAME_BADLY_FORMATTED"; + break; + case 4: + pcVar1 = "NAME_NO_PERSON"; + break; + case 5: + pcVar1 = "NAME_CELEBRITY"; + break; + case 6: + pcVar1 = "NAME_COUNTRY"; + break; + case 7: + pcVar1 = "NAME_FAKE_IDENTITY"; + break; + case 8: + pcVar1 = "NAME_FAKE_POSITION"; + break; + case 9: + pcVar1 = "STATEMENT_INSULTING"; + break; + case 10: + pcVar1 = "STATEMENT_SPAMMING"; + break; + case 0xb: + pcVar1 = "STATEMENT_ADVERT_OFFTOPIC"; + break; + case 0xc: + pcVar1 = "STATEMENT_ADVERT_MONEY"; + break; + case 0xd: + pcVar1 = "STATEMENT_NON_ENGLISH"; + break; + case 0xe: + pcVar1 = "STATEMENT_CHANNEL_OFFTOPIC"; + break; + case 0xf: + pcVar1 = "STATEMENT_VIOLATION_INCITING"; + break; + case 0x10: + pcVar1 = "CHEATING_BUG_ABUSE"; + break; + case 0x11: + pcVar1 = "CHEATING_GAME_WEAKNESS"; + break; + case 0x12: + pcVar1 = "CHEATING_MACRO_USE"; + break; + case 0x13: + pcVar1 = "CHEATING_MODIFIED_CLIENT"; + break; + case 0x14: + pcVar1 = "CHEATING_HACKING"; + break; + case 0x15: + pcVar1 = "CHEATING_MULTI_CLIENT"; + break; + case 0x16: + pcVar1 = "CHEATING_ACCOUNT_TRADING"; + break; + case 0x17: + pcVar1 = "CHEATING_ACCOUNT_SHARING"; + break; + case 0x18: + pcVar1 = "GAMEMASTER_THREATENING"; + break; + case 0x19: + pcVar1 = "GAMEMASTER_PRETENDING"; + break; + case 0x1a: + pcVar1 = "GAMEMASTER_INFLUENCE"; + break; + case 0x1b: + pcVar1 = "GAMEMASTER_FALSE_REPORTS"; + break; + case 0x1c: + pcVar1 = "KILLING_EXCESSIVE_UNJUSTIFIED"; + break; + case 0x1d: + pcVar1 = "DESTRUCTIVE_BEHAVIOUR"; + break; + case 0x1e: + pcVar1 = "SPOILING_AUCTION"; + break; + case 0x1f: + pcVar1 = "INVALID_PAYMENT"; + break; + default: + error(&DAT_080f77c0,Reason); + pcVar1 = ""; + } + return pcVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitInfo(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitInfo(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z7GetName6Object(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void matrix(matrix * this, int xmin, int xmax, int ymin, int ymax) + +void __thiscall matrix::matrix(matrix *this,int xmin,int xmax,int ymin,int ymax) + +{ + int iVar1; + int *piVar2; + int iVar3; + + iVar3 = (xmax - xmin) + 1; + this->xmin = xmin; + iVar1 = (ymax - ymin) + 1; + this->ymin = ymin; + this->dx = iVar3; + this->dy = iVar1; + if ((iVar3 < 1) || (iVar1 < 1)) { + error("matrix: Ungueltige Feldgroesse %d..%d, %d..%d.\n",xmin,xmax,ymin,ymax); + iVar3 = this->dx; + if (iVar3 < 1) { + this->dx = 1; + iVar3 = 1; + } + iVar1 = this->dy; + if (iVar1 < 1) { + this->dy = 1; + iVar1 = 1; + } + } + piVar2 = (int *)operator_new__(iVar3 * iVar1 * 4); + this->entry = piVar2; + return; +} + + + +void RandomShuffle(int *Buffer,int Size) + +{ + int iVar1; + long lVar2; + int Exchange; + int Help; + int Position; + int iVar3; + + if (Buffer == (int *)0x0) { + error("RandomShuffle: Buffer ist NULL.\n"); + return; + } + iVar3 = 0; + if (0 < Size + -1) { + do { + lVar2 = random(); + if (lVar2 != iVar3) { + iVar1 = Buffer[iVar3]; + Buffer[iVar3] = Buffer[lVar2]; + Buffer[lVar2] = iVar1; + } + iVar3 = iVar3 + 1; + } while (iVar3 < Size + -1); + } + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + TMoveUseDatabase *this; + int local_14; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + MoveUseConditions.initialized = false; + MoveUseConditions.min = 1; + MoveUseConditions.max = 1000; + MoveUseConditions.start = 1; + MoveUseConditions.space = 1000; + MoveUseConditions.block = 1000; + MoveUseConditions.entry = (TMoveUseCondition *)operator_new__(28000); + __cxa_atexit(__tcf_0,0,&__dso_handle); + MoveUseActions.initialized = false; + MoveUseActions.min = 1; + MoveUseActions.start = 1; + MoveUseActions.max = 1000; + MoveUseActions.space = 1000; + MoveUseActions.block = 1000; + MoveUseActions.entry = (TMoveUseAction *)operator_new__(24000); + __cxa_atexit(__tcf_1,0,&__dso_handle); + local_14 = 4; + this = MoveUseDatabases; + do { + // try { // try from 080722f5 to 080722f9 has its CatchHandler @ 08072413 + vector<>::vector(&this->Rules,1,100,100); + this->NumberOfRules = 0; + this = this + 1; + local_14 = local_14 + -1; + } while (local_14 != -1); + __cxa_atexit(__tcf_2,0,&__dso_handle); + } + if (__initialize_p == 1) { + DelayedMail.initialized = false; + DelayedMail.max = 10; + DelayedMail.min = 0; + DelayedMail.start = 0; + DelayedMail.space = 0xb; + DelayedMail.block = 10; + DelayedMail.entry = (TDelayedMail *)operator_new__(0xb0); + __cxa_atexit(__tcf_3,0,&__dso_handle); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +Object GetEventObject(void) + +{ + Object OVar1; + ulong *in_stack_00000004; + undefined4 in_stack_00000008; + ulong *in_stack_0000000c; + ulong *in_stack_00000010; + ulong *in_stack_00000014; + ulong *in_stack_00000018; + + switch(in_stack_00000008) { + case 1: + in_stack_00000018 = in_stack_00000010; + break; + case 2: + in_stack_00000018 = in_stack_00000014; + break; + case 3: + in_stack_00000018 = in_stack_0000000c; + break; + case 4: + break; + default: + error("GetEventObject: Unbekannte Nummer %d.\n"); + case 0: + OVar1.ObjectID = NONE.ObjectID; + goto LAB_08072475; + } + OVar1.ObjectID = *in_stack_00000018; +LAB_08072475: + *in_stack_00000004 = OVar1.ObjectID; + return (Object)(ulong)in_stack_00000004; +} + + + +bool Compare(int Value1,int Operator,int Value2) + +{ + bool bVar1; + + switch(Operator) { + case 0x3c: + bVar1 = Value1 < Value2; + break; + case 0x3d: + bVar1 = Value1 == Value2; + break; + case 0x3e: + bVar1 = Value2 < Value1; + break; + default: + error(&DAT_080f79e0,Operator); + bVar1 = false; + break; + case 0x47: + bVar1 = Value2 <= Value1; + break; + case 0x4c: + bVar1 = Value1 <= Value2; + break; + case 0x4e: + bVar1 = Value1 != Value2; + } + return bVar1; +} + + + +bool CheckCondition(EventType param_1,TMoveUseCondition *Condition,Object *User,Object *Obj1, + Object *Obj2,Object *Temp) + +{ + ModifierType MVar1; + FLAG Flag; + TYPEATTRIBUTE Attribute; + byte bVar2; + char cVar3; + bool bVar4; + ushort HouseID; + TCreature *pTVar5; + char *__s2; + char *__s1; + int iVar6; + int iVar7; + ObjectType *pOVar8; + TPlayer *pTVar9; + ulong uVar10; + ulong uVar11; + long lVar12; + Object *pOVar13; + undefined4 uVar14; + ulong *puVar15; + ulong *puVar16; + ulong *puVar17; + bool local_a7; + bool local_a6; + bool local_a5; + int iStack_a4; + bool fulfilled; + int x2; + int y2; + int z2; + int x1; + int y1; + int z1; + Object local_7c [4]; + ObjectType local_6c [4]; + ulong local_5c [4]; + ulong local_4c [4]; + ulong local_3c [4]; + Object local_2c; + Object Obj; + + local_a5 = false; + local_2c.ObjectID = 0; + switch(Condition->Condition) { + case CONDITION_ISPOSITION: + local_5c[0] = Temp->ObjectID; + local_6c[0].TypeID = Obj2->ObjectID; + local_7c[0] = (Object)Obj1->ObjectID; + z1 = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_4c[0]; + local_3c[0] = local_4c[0]; + UnpackAbsoluteCoordinate(); + z1 = local_2c.ObjectID; + GetObjectCoordinates((Object *)&z1,&stack0xffffff5c,&x2,&y2); + local_a5 = false; + if ((z2 == iStack_a4) && (x1 == x2)) { + bVar4 = y1 == y2; +LAB_08072693: + local_a5 = false; + if (bVar4) { +LAB_08072695: + local_a5 = true; + } + } + break; + case CONDITION_ISTYPE: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + local_a5 = z1 == Condition->Parameters[1]; + break; + case CONDITION_ISCREATURE: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + local_a5 = z1 == 99; + break; + case CONDITION_ISPLAYER: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; +LAB_08072828: + pTVar5 = GetCreature((Object *)&z1); + local_a5 = false; + if (pTVar5 != (TCreature *)0x0) { + bVar4 = pTVar5->Type == PLAYER; + goto LAB_08072693; + } + } + break; + case CONDITION_HASFLAG: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Flag = Condition->Parameters[1]; + Object::getObjectType((Object *)&z1); + local_a5 = ObjectType::getFlag((ObjectType *)&z1,Flag); + break; + case CONDITION_HASTYPEATTRIBUTE: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Attribute = Condition->Parameters[1]; + Object::getObjectType((Object *)&z1); + uVar11 = ObjectType::getAttribute((ObjectType *)&z1,Attribute); + iVar7 = Condition->Parameters[2]; + uVar10 = Condition->Parameters[3]; + switch(iVar7) { + case 0x3c: +switchD_0807323b_caseD_3c: + local_a5 = (int)uVar11 < (int)uVar10; + break; + case 0x3d: +switchD_0807323b_caseD_3d: + local_a5 = uVar11 == uVar10; + break; + case 0x3e: +switchD_0807323b_caseD_3e: + local_a5 = (int)uVar10 < (int)uVar11; + break; + default: +switchD_0807323b_caseD_3f: + error(&DAT_080f79e0,iVar7,puVar16,puVar17); + local_a5 = false; + break; + case 0x47: +switchD_0807323b_caseD_47: + local_a5 = (int)uVar10 <= (int)uVar11; + break; + case 0x4c: +switchD_0807323b_caseD_4c: + local_a5 = (int)uVar11 <= (int)uVar10; + break; + case 0x4e: +switchD_0807323b_caseD_4e: + local_a5 = uVar11 != uVar10; + } + break; + case CONDITION_HASINSTANCEATTRIBUTE: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + uVar11 = Object::getAttribute(&local_2c,Condition->Parameters[1]); + iVar7 = Condition->Parameters[2]; + uVar10 = Condition->Parameters[3]; + switch(iVar7) { + case 0x3c: + goto switchD_0807323b_caseD_3c; + case 0x3d: + goto switchD_0807323b_caseD_3d; + case 0x3e: + goto switchD_0807323b_caseD_3e; + default: + goto switchD_0807323b_caseD_3f; + case 0x47: + goto switchD_0807323b_caseD_47; + case 0x4c: + goto switchD_0807323b_caseD_4c; + case 0x4e: + goto switchD_0807323b_caseD_4e; + } + case CONDITION_HASTEXT: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + __s2 = GetDynamicString(Condition->Parameters[1]); + uVar10 = Object::getAttribute(&local_2c,TEXTSTRING); + __s1 = GetDynamicString(uVar10); + iVar7 = strcmp(__s1,__s2); + local_a5 = iVar7 == 0; + break; + case CONDITION_ISPEACEFUL: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + pOVar8 = local_6c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + puVar15 = local_5c; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + pOVar13 = &local_2c; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar5 = GetCreature((Object *)&z1); + local_a5 = false; + if (pTVar5 != (TCreature *)0x0) { + iVar7 = (*pTVar5->_vptr_TCreature[4])(pTVar5,pOVar13,puVar16,puVar17,puVar15,pOVar8) + ; + cVar3 = (char)iVar7; +LAB_08072b84: + local_a5 = false; + if (cVar3 != '\0') goto LAB_08072695; + } + } + break; + case CONDITION_MAYLOGOUT: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar5 = GetCreature((Object *)&z1); + local_a5 = false; + if ((pTVar5 != (TCreature *)0x0) && (pTVar5->Type == PLAYER)) { + iVar7 = TCreature::LogoutPossible(pTVar5); + bVar4 = iVar7 == 0; + goto LAB_08072693; + } + } + break; + case CONDITION_HASPROFESSION: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar9 = (TPlayer *)GetCreature((Object *)&z1); + local_a5 = false; + if ((pTVar9 != (TPlayer *)0x0) && ((pTVar9->super_TCreature).Type == PLAYER)) { + bVar2 = TPlayer::GetEffectiveProfession(pTVar9); + bVar4 = (uint)bVar2 == Condition->Parameters[1]; + goto LAB_08072693; + } + } + break; + case CONDITION_HASLEVEL: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + puVar15 = local_5c; + local_3c[0] = User->ObjectID; + pOVar8 = local_6c; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar5 = GetCreature((Object *)&z1); + local_a6 = false; + if (pTVar5 != (TCreature *)0x0) { + iVar6 = TSkill::Get((pTVar5->super_TSkillBase).Skills[0]); + iVar7 = Condition->Parameters[2]; + switch(Condition->Parameters[1]) { + case 0x3c: + bVar4 = iVar6 < iVar7; + break; + case 0x3d: + bVar4 = iVar6 == iVar7; + break; + case 0x3e: + bVar4 = iVar7 < iVar6; + break; + default: + error(&DAT_080f79e0,Condition->Parameters[1],puVar16,puVar17,puVar15,pOVar8); + bVar4 = false; + break; + case 0x47: + bVar4 = iVar7 <= iVar6; + break; + case 0x4c: + bVar4 = iVar6 <= iVar7; + break; + case 0x4e: + bVar4 = iVar6 != iVar7; + } + if (bVar4) { + local_a6 = true; + } + } + local_a5 = local_a6; + } + break; + case CONDITION_HASRIGHT: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar5 = GetCreature((Object *)&z1); + local_a5 = false; + if ((pTVar5 != (TCreature *)0x0) && (pTVar5->Type == PLAYER)) { + cVar3 = CheckRight(pTVar5->ID,Condition->Parameters[1]); + goto LAB_08072b84; + } + } + break; + case CONDITION_HASQUESTVALUE: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + puVar16 = local_5c; + local_5c[0] = Obj2->ObjectID; + puVar15 = local_3c; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + pOVar8 = local_6c; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar9 = (TPlayer *)GetCreature((Object *)&z1); + local_a7 = false; + if ((pTVar9 != (TPlayer *)0x0) && ((pTVar9->super_TCreature).Type == PLAYER)) { + iVar6 = TPlayer::GetQuestValue(pTVar9,Condition->Parameters[1]); + iVar7 = Condition->Parameters[3]; + switch(Condition->Parameters[2]) { + case 0x3c: + bVar4 = iVar6 < iVar7; + break; + case 0x3d: + bVar4 = iVar6 == iVar7; + break; + case 0x3e: + bVar4 = iVar7 < iVar6; + break; + default: + error(&DAT_080f79e0,Condition->Parameters[2],puVar15,puVar17,puVar16,pOVar8); + bVar4 = false; + break; + case 0x47: + bVar4 = iVar7 <= iVar6; + break; + case 0x4c: + bVar4 = iVar6 <= iVar7; + break; + case 0x4e: + bVar4 = iVar6 != iVar7; + } + if (bVar4) { + local_a7 = true; + } + } + local_a5 = local_a7; + } + break; + case CONDITION_TESTSKILL: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + pOVar8 = local_6c; + puVar16 = local_5c; + local_5c[0] = Obj2->ObjectID; + puVar15 = local_3c; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar5 = GetCreature((Object *)&z1); + bVar4 = false; + iVar7 = Condition->Parameters[1]; + if ((-1 < iVar7) && (iVar7 < 0x19)) { + bVar4 = true; + } + if (bVar4) { + local_a5 = false; + if (pTVar5 != (TCreature *)0x0) { + iVar7 = (*(pTVar5->super_TSkillBase).Skills[iVar7]->_vptr_TSkill[9]) + ((pTVar5->super_TSkillBase).Skills[iVar7], + Condition->Parameters[2],Condition->Parameters[3],1); + cVar3 = (char)iVar7; + goto LAB_08072b84; + } + } + else { + error(&DAT_080f7a20,iVar7,puVar15,puVar17,puVar16,pOVar8); + } + } + break; + case CONDITION_COUNTOBJECTS: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + GetMapContainer((Object *)&z1); + uVar11 = CountObjectsInContainer((Object *)&z1); + iVar7 = Condition->Parameters[1]; + uVar10 = Condition->Parameters[2]; + switch(iVar7) { + case 0x3c: + goto switchD_0807323b_caseD_3c; + case 0x3d: + goto switchD_0807323b_caseD_3d; + case 0x3e: + goto switchD_0807323b_caseD_3e; + default: + goto switchD_0807323b_caseD_3f; + case 0x47: + goto switchD_0807323b_caseD_47; + case 0x4c: + goto switchD_0807323b_caseD_4c; + case 0x4e: + goto switchD_0807323b_caseD_4e; + } + case CONDITION_COUNTOBJECTSONMAP: + UnpackAbsoluteCoordinate(); + GetMapContainer((int)&z1,z2,x1); + uVar11 = CountObjectsInContainer((Object *)&z1); + iVar7 = Condition->Parameters[1]; + uVar10 = Condition->Parameters[2]; + puVar16 = (ulong *)x1; + puVar17 = (ulong *)y1; + switch(iVar7) { + case 0x3c: + goto switchD_0807323b_caseD_3c; + case 0x3d: + goto switchD_0807323b_caseD_3d; + case 0x3e: + goto switchD_0807323b_caseD_3e; + default: + goto switchD_0807323b_caseD_3f; + case 0x47: + goto switchD_0807323b_caseD_47; + case 0x4c: + goto switchD_0807323b_caseD_4c; + case 0x4e: + goto switchD_0807323b_caseD_4e; + } + case CONDITION_ISOBJECTTHERE: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID(local_6c,Condition->Parameters[1]); + goto LAB_080732ab; + case CONDITION_ISCREATURETHERE: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID(local_6c,99); +LAB_080732ab: + GetFirstSpecObject(); +LAB_080732b0: + Temp->ObjectID = (ulong)local_7c[0]; + local_a5 = Temp->ObjectID != NONE.ObjectID; + break; + case CONDITION_ISPLAYERTHERE: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID(local_6c,99); + GetFirstSpecObject(); + Temp->ObjectID = (ulong)local_7c[0]; + z1 = Temp->ObjectID; + if (z1 != NONE.ObjectID) goto LAB_08072828; + break; + case CONDITION_ISOBJECTININVENTORY: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 != 99) break; + ObjectType::setTypeID(local_6c,Condition->Parameters[1]); + pOVar8 = (ObjectType *)Object::getCreatureID(&local_2c); + GetInventoryObject((ulong)local_7c,pOVar8,(ulong)local_6c); + goto LAB_080732b0; + case CONDITION_ISPROTECTIONZONE: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + GetObjectCoordinates((Object *)&z1,&z2,&x1,&y1); + local_a5 = IsProtectionZone(); + break; + case CONDITION_ISHOUSE: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + GetObjectCoordinates((Object *)&z1,&z2,&x1,&y1); + local_a5 = IsHouse(z2,x1,y1); + break; + case CONDITION_ISHOUSEOWNER: + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + GetObjectCoordinates((Object *)&z1,&z2,&x1,&y1); + local_6c[0].TypeID = Temp->ObjectID; + local_5c[0] = Obj2->ObjectID; + local_4c[0] = Obj1->ObjectID; + local_3c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + if (z1 == 99) { + z1 = local_2c.ObjectID; + pTVar9 = (TPlayer *)GetCreature((Object *)&z1); + local_a5 = false; + if ((pTVar9 != (TPlayer *)0x0) && ((pTVar9->super_TCreature).Type == PLAYER)) { + HouseID = GetHouseID(z2,x1,y1); + cVar3 = IsOwner(HouseID,pTVar9); + goto LAB_08072b84; + } + } + break; + case CONDITION_ISDRESSED: + local_6c[0].TypeID = Temp->ObjectID; + puVar17 = local_4c; + local_5c[0] = Obj2->ObjectID; + puVar16 = local_3c; + local_4c[0] = Obj1->ObjectID; + puVar15 = local_5c; + local_3c[0] = User->ObjectID; + pOVar8 = local_6c; + GetEventObject(); + local_2c.ObjectID = local_7c[0].ObjectID; + z1 = local_7c[0].ObjectID; + Object::getObjectType((Object *)&z1); + uVar14 = 0x2e; + bVar4 = ObjectType::getFlag((ObjectType *)&z1,CLOTHES); + if (bVar4) { + z1 = local_2c.ObjectID; + uVar10 = GetObjectBodyPosition((Object *)&z1); + Object::getObjectType(local_7c); + uVar11 = ObjectType::getAttribute((ObjectType *)local_7c,BODYPOSITION); + local_a5 = uVar10 == uVar11; + } + else { + error(&DAT_080f7a60,uVar14,puVar16,puVar17,puVar15,pOVar8); + } + break; + case CONDITION_RANDOM: + lVar12 = random(); + local_a5 = lVar12 <= Condition->Parameters[0]; + break; + default: + error("CheckCondition: Unbekannte Bedingung %d.\n",Condition->Condition); + goto LAB_08072659; + } + MVar1 = Condition->Modifier; + if (MVar1 == MODIFIER_INVERT) { + local_a5 = (bool)(local_a5 ^ 1); + } + else { + if ((int)MVar1 < 2) { + if (MVar1 == MODIFIER_NORMAL) { + return local_a5; + } + } + else if (MVar1 == MODIFIER_TRUE) { + return true; + } +LAB_08072659: + local_a5 = false; + } + return local_a5; +} + + + +Object CreateObject(Object *Con,ObjectType *Type,ulong Value) + +{ + bool bVar1; + ObjectType *Type_00; + RESULT r; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08073896 to 08073934 has its CatchHandler @ 08073937 + Object::getObjectType(local_2c); + bVar1 = false; + if ((0 < (int)local_2c[0].ObjectID) && ((int)local_2c[0].ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_2c,*(int *)Value); + local_3c[0].ObjectID = Type->TypeID; + Type_00 = (ObjectType *)GetObjectCreatureID(local_3c); + CreateAtCreature((ulong)Con,Type_00,(ulong)local_2c); + } + else { + ObjectType::setTypeID((ObjectType *)local_3c,*(int *)Value); + local_2c[0].ObjectID = Type->TypeID; + Create(Con,(ObjectType *)local_2c,(ulong)local_3c); + } + return (Object)(ulong)Con; +} + + + +void ChangeObject(Object *Obj,ObjectType *NewType,ulong Value) + +{ + bool bVar1; + ulong uVar2; + RESULT r; + char *Text; + int iVar3; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Con; + + // try { // try from 08073a18 to 08073a5c has its CatchHandler @ 08073ce0 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getContainer(&local_2c); + bVar1 = Object::exists(Obj); + if (bVar1) { + // try { // try from 08073a6f to 08073b27 has its CatchHandler @ 08073b42 + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if ((bVar1) && (uVar2 = Object::getAttribute(Obj,AMOUNT), 1 < uVar2)) { + local_3c[0].ObjectID = NONE.ObjectID; + uVar2 = Object::getAttribute(Obj,AMOUNT); + local_4c[0].ObjectID = local_2c.ObjectID; + local_5c[0] = (Object)Obj->ObjectID; + Move(0,local_5c,local_4c,uVar2 - 1,true,local_3c); + } + ObjectType::setTypeID((ObjectType *)local_5c,NewType->TypeID); + local_4c[0] = (Object)Obj->ObjectID; + Change(local_4c,(ObjectType *)local_5c,Value); + return; + } + iVar3 = NewType->TypeID; + Text = &DAT_080f7ba0; + } + else { + iVar3 = NewType->TypeID; + Text = &DAT_080f7b40; + } + error(Text,iVar3); + return; +} + + + +void MoveOneObject(Object *Obj,Object *Con) + +{ + bool bVar1; + RESULT r; + char *Text; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + Object::getObjectType(local_2c); + if ((local_2c[0].ObjectID != 99) || + (Object::getObjectType(local_2c), local_2c[0].ObjectID == 0)) { + // try { // try from 08073da1 to 08073e39 has its CatchHandler @ 08073e4c + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LIQUIDPOOL); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,MAGICFIELD); + if (!bVar1) { + local_2c[0].ObjectID = NONE.ObjectID; + local_3c[0] = (Object)Con->ObjectID; + z = Obj->ObjectID; + Move(0,(Object *)&z,local_3c,-1,true,local_2c); + return; + } + } + local_2c[0] = (Object)Obj->ObjectID; + Delete(local_2c,-1); + return; + } + Text = "MoveOneObject: \"Con\" ist kein MapContainer.\n"; + goto LAB_08073d18; + } + } + Text = "MoveOneObject: \"Con\" ist kein Container.\n"; + } + else { + Text = &DAT_080f7c60; + } +LAB_08073d18: + error(Text); + return; +} + + + +void MoveAllObjects(Object *Obj,Object *Dest,Object *Exclude,bool MoveUnmovable) + +{ + bool bVar1; + Object *pOVar2; + bool MoveUnmovable_local; + int x; + int y; + int z; + Object local_4c; + ObjectType Type; + Object local_3c [4]; + Object local_2c [7]; + + local_2c[0].ObjectID = NONE.ObjectID; + if (Obj->ObjectID != NONE.ObjectID) { + pOVar2 = Dest; + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0) { + local_2c[0] = (Object)Exclude->ObjectID; + local_3c[0] = (Object)Dest->ObjectID; + Object::getNextObject(&local_4c); + MoveAllObjects(&local_4c,local_3c,local_2c,MoveUnmovable); + local_4c = (Object)Exclude->ObjectID; + if (Obj->ObjectID != local_4c.ObjectID) { + Object::getObjectType(&local_4c); + // try { // try from 08073fb1 to 0807408e has its CatchHandler @ 08074094 + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDPOOL); + if (!bVar1) { + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,MAGICFIELD); + if (!bVar1) { + if (!MoveUnmovable) { + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,UNMOVE); + if (bVar1) { + return; + } + } + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0] = (Object)Dest->ObjectID; + z = Obj->ObjectID; + Move(0,(Object *)&z,local_2c,-1,true,local_3c); + return; + } + } + local_3c[0] = (Object)Obj->ObjectID; + Delete(local_3c,-1); + } + } + else { + error("MoveAllObjects: \"Dest\" ist kein Mapcontainer.\n",pOVar2); + } + } + return; +} + + + +void DeleteAllObjects(Object *Obj,Object *Exclude,bool DeleteUnmovable) + +{ + bool bVar1; + RESULT r; + int iStack_48; + bool DeleteUnmovable_local; + int x; + int y; + int z; + Object local_2c [7]; + + if (Obj->ObjectID != NONE.ObjectID) { + local_2c[0] = (Object)Exclude->ObjectID; + Object::getNextObject((Object *)&z); + DeleteAllObjects((Object *)&z,local_2c,DeleteUnmovable); + z = Exclude->ObjectID; + if (Obj->ObjectID != z) { + Object::getObjectType((Object *)&z); + if (z == 99) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&stack0xffffffb8,&x,&y); + error(&DAT_080f7e00,iStack_48,x,y); + } + else { + if (!DeleteUnmovable) { + // try { // try from 080741bb to 08074244 has its CatchHandler @ 0807429b + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,UNMOVE); + if (bVar1) { + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,LIQUIDPOOL); + if (!bVar1) { + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,MAGICFIELD); + if (!bVar1) { + return; + } + } + } + } + z = Obj->ObjectID; + Delete((Object *)&z,-1); + } + } + } + return; +} + + + +void ClearField(Object *Obj,Object *Exclude) + +{ + bool bVar1; + bool bVar2; + Object *this; + Object *Exclude_00; + int local_58; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (!bVar1) { + error("ClearField: Objekt existiert nicht.\n"); + return; + } + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&local_58,&x,&y); + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + this = (Object *)&z; + local_2c[0] = (Object)Exclude->ObjectID; + GetMapContainer((int)local_3c,local_58 + 1,x); + Object::getNextObject(this); + Exclude_00 = local_2c; + goto LAB_080743c6; + } + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { +LAB_08074550: + z = Exclude->ObjectID; + x = x + 1; +LAB_0807449d: + GetMapContainer((int)local_3c,local_58,x); + Object::getNextObject(local_2c); + } + else { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { +LAB_08074594: + z = Exclude->ObjectID; + local_58 = local_58 + -1; + goto LAB_0807449d; + } + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + z = Exclude->ObjectID; + x = x + -1; + goto LAB_0807449d; + } + bVar1 = JumpPossible(local_58 + 1,x,y,false); + if (bVar1) { + z = Exclude->ObjectID; + local_58 = local_58 + 1; + goto LAB_0807449d; + } + bVar1 = JumpPossible(local_58,x + 1,y,false); + if (bVar1) goto LAB_08074550; + bVar1 = JumpPossible(local_58 + -1,x,y,false); + if (bVar1) goto LAB_08074594; + bVar1 = JumpPossible(local_58,x + -1,y,false); + if (!bVar1) { + return; + } + z = Exclude->ObjectID; + GetMapContainer((int)local_3c,local_58,x + -1); + Object::getNextObject(local_2c); + } + Exclude_00 = (Object *)&z; + this = local_2c; +LAB_080743c6: + MoveAllObjects(this,local_3c,Exclude_00,true); + return; +} + + + +void LoadDepotBox(ulong CreatureID,int Nr,Object *Con) + +{ + bool bVar1; + TCreature *pTVar2; + int iVar3; + int iVar4; + TCreature *cr; + char *pcVar5; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 0807470b to 08074872 has its CatchHandler @ 08074890 + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + pcVar5 = "moveuse::LoadDepotBox: Kreatur nicht gefunden.\n"; + } + else { + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + if (pTVar2->Type == PLAYER) { + local_2c[0] = (Object)Con->ObjectID; + LoadDepot((TPlayerData *)pTVar2[1].super_TSkillBase.TimerList[10],Nr,local_2c); + local_2c[0] = (Object)Con->ObjectID; + pTVar2[1].super_TSkillBase.TimerList[6] = (TSkill *)local_2c[0].ObjectID; + pTVar2[1].super_TSkillBase.TimerList[7] = (TSkill *)Nr; + local_3c[0] = (Object)Con->ObjectID; + iVar3 = CountObjects(local_3c); + iVar3 = iVar3 + -1; + bVar1 = CheckRight(pTVar2->ID,PREMIUM_ACCOUNT); + iVar4 = GetDepotSize(Nr,bVar1); + pTVar2[1].super_TSkillBase.TimerList[8] = (TSkill *)(iVar4 - iVar3); + print(); + pcVar5 = "s"; + if (iVar3 == 1) { + pcVar5 = ""; + } + SendMessage(pTVar2->Connection,0x15,"Your depot contains %d item%s.",iVar3, + pcVar5); + if (-1 < (int)pTVar2[1].super_TSkillBase.TimerList[8]) { + return; + } + SendMessage(pTVar2->Connection,0x16, + "Your depot is full. Remove surplus items before storing new ones.", + iVar3,pcVar5); + return; + } + pcVar5 = "moveuse::LoadDepotBox: Kreatur ist kein Spieler.\n"; + } + else { + pcVar5 = &DAT_080f8020; + } + } + else { + pcVar5 = &DAT_080f7ee0; + } + } + error(pcVar5); + return; +} + + + +void SaveDepotBox(ulong CreatureID,int Nr,Object *Con) + +{ + bool bVar1; + TCreature *pTVar2; + int iVar3; + TCreature *cr; + char *Text; + int Count; + Object Obj; + Object local_2c [7]; + + // try { // try from 080748cb to 08074a1a has its CatchHandler @ 08074a40 + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + Text = "moveuse::SaveDepotBox: Kreatur nicht gefunden.\n"; + } + else { + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + if (pTVar2->Type == PLAYER) { + local_2c[0] = (Object)Con->ObjectID; + iVar3 = CountObjects(local_2c); + Log("game",&DAT_080f8120,Nr,pTVar2->Name,iVar3 + -1); + print(); + local_2c[0] = (Object)Con->ObjectID; + SaveDepot((TPlayerData *)pTVar2[1].super_TSkillBase.TimerList[10],Nr,local_2c); + Count = NONE.ObjectID; + pTVar2[1].super_TSkillBase.TimerList[6] = (TSkill *)NONE.ObjectID; + while( true ) { + local_2c[0] = (Object)Con->ObjectID; + GetFirstContainerObject((Object *)&Count); + if (Count == NONE.ObjectID) break; + local_2c[0].ObjectID = Count; + Delete(local_2c,-1); + } + return; + } + Text = "moveuse::SaveDepotBox: Kreatur ist kein Spieler.\n"; + } + else { + Text = &DAT_080f81c0; + } + } + else { + Text = &DAT_080f80a0; + } + } + error(Text); + return; +} + + + +void SendMail(Object *Obj) + +{ + uint *Text_00; + TPlayer *pTVar1; + ulong uVar2; + bool bVar3; + RESULT r_1; + ulong uVar4; + char *pcVar5; + int iVar6; + TDelayedMail *pTVar7; + uchar *__dest; + char *Text; + uint *puVar8; + uint *puVar9; + char cVar10; + uint uVar11; + uint uVar12; + int pos; + int iVar13; + int pos2; + int iVar14; + int *this; + bool PlayerOnline; + int DepotNumber; + TPlayer *local_280; + TPlayer *Player; + char Town [256]; + char Addressee [256]; + undefined1 local_6c [4]; + TDynamicWriteBuffer Buffer; + Object Label; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08074a78 to 08074d69 has its CatchHandler @ 08075210 + bVar3 = Object::exists(Obj); + if (bVar3) { + bVar3 = false; + Object::getObjectType(local_2c); + GetSpecialObject((SPECIALMEANING)local_3c); + ObjectType::setTypeID((ObjectType *)local_4c,local_3c[0].ObjectID); + if (local_2c[0].ObjectID != local_4c[0].ObjectID) { + Object::getObjectType(local_4c); + GetSpecialObject((SPECIALMEANING)&Buffer.super_TWriteBuffer.Position); + ObjectType::setTypeID((ObjectType *)local_6c,Buffer.super_TWriteBuffer.Position); + if ((undefined1 [4])local_4c[0].ObjectID != local_6c) { + bVar3 = true; + } + } + if (!bVar3) { + print(); + Object::getObjectType((Object *)local_6c); + GetSpecialObject((SPECIALMEANING)&Buffer.super_TWriteBuffer.Position); + this = (int *)Obj; + if (local_6c != (undefined1 [4])Buffer.super_TWriteBuffer.Position) { + local_4c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject((Object *)&Buffer.super_TWriteBuffer.Position); + while( true ) { + bVar3 = false; + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (Buffer.super_TWriteBuffer.Position != NONE.ObjectID) { + Object::getObjectType(local_3c); + GetSpecialObject((SPECIALMEANING)local_2c); + ObjectType::setTypeID((ObjectType *)(Addressee + 0xfc),local_2c[0].ObjectID) + ; + if (local_3c[0].ObjectID != Addressee._252_4_) { + bVar3 = true; + } + } + if (!bVar3) break; + Object::getNextObject(local_4c); + Addressee._252_4_ = local_4c[0].ObjectID; + Buffer.super_TWriteBuffer.Position = Addressee._252_4_; + } + Addressee._252_4_ = NONE.ObjectID; + if (Buffer.super_TWriteBuffer.Position == NONE.ObjectID) { + return; + } + this = &Buffer.super_TWriteBuffer.Position; + } + uVar4 = Object::getAttribute((Object *)this,TEXTSTRING); + pcVar5 = GetDynamicString(uVar4); + if (pcVar5 != (char *)0x0) { + cVar10 = *pcVar5; + iVar13 = 0; + if ((cVar10 != '\n') && (cVar10 != '\0')) { + while( true ) { + Town[iVar13 + 0xfc] = cVar10; + iVar13 = iVar13 + 1; + cVar10 = pcVar5[iVar13]; + if (cVar10 == '\n') break; + if ((cVar10 == '\0') || (0xff < iVar13)) break; + } + } + iVar14 = 0; + Town[iVar13 + 0xfc] = '\0'; + if ((pcVar5[iVar13 + 1] != '\n') && (iVar6 = iVar13, pcVar5[iVar13 + 1] != '\0')) { + do { + Town[iVar14 + -4] = pcVar5[iVar6 + 1]; + iVar14 = iVar14 + 1; + if ((pcVar5[iVar14 + iVar13 + 1] == '\n') || + (pcVar5[iVar14 + iVar13 + 1] == '\0')) break; + iVar6 = iVar14 + iVar13; + } while (iVar14 < 0x100); + } + Town[iVar14 + -4] = '\0'; + Text_00 = (uint *)(Town + 0xfc); + Trim((char *)Text_00); + Trim((char *)&Player); + puVar9 = Text_00; + if (Town[0xfc] != '\0') { + do { + puVar8 = puVar9; + uVar11 = *puVar8 + 0xfefefeff & ~*puVar8; + uVar12 = uVar11 & 0x80808080; + puVar9 = puVar8 + 1; + } while (uVar12 == 0); + bVar3 = (uVar11 & 0x8080) == 0; + if (bVar3) { + uVar12 = uVar12 >> 0x10; + } + if (bVar3) { + puVar9 = (uint *)((int)puVar8 + 6); + } + if (((char *)((int)puVar9 + + ((-3 - (uint)CARRY1((byte)uVar12,(byte)uVar12)) - (int)Text_00)) < + (char *)0x1e) && ((char)Player != '\0')) { + Log("game","Post an %s in %s.\n",Text_00,&Player); + iVar13 = GetDepotNumber((char *)&Player); + if (iVar13 != -1) { + iVar14 = IdentifyPlayer((char *)Text_00,true,true,&local_280); + bVar3 = iVar14 == 0; + if (bVar3) { + uVar4 = (local_280->super_TCreature).ID; + } + else { + // try { // try from 08075019 to 08075139 has its CatchHandler @ 08075210 + uVar4 = GetCharacterID((char *)Text_00); + if (uVar4 == 0) { + return; + } + } + uVar2 = Addressee._252_4_; + if ((bVar3) && (local_280->DepotNr == iVar13)) { + local_6c = (undefined1 [4])NONE.ObjectID; + Addressee[0xfc] = (undefined1)NONE.ObjectID; + Addressee[0xfd] = NONE.ObjectID._1_1_; + Addressee[0xfe] = NONE.ObjectID._2_1_; + Addressee[0xff] = NONE.ObjectID._3_1_; + uVar2 = (ulong)local_6c; + if ((local_280->Depot).ObjectID != NONE.ObjectID) { + print(); + local_6c = (undefined1 [4])NONE.ObjectID; + Buffer.super_TWriteBuffer.Position = (local_280->Depot).ObjectID + ; + local_4c[0] = (Object)Obj->ObjectID; + // try { // try from 08074ef3 to 08075003 has its CatchHandler @ 08075152 + Move(0,local_4c,(Object *)&Buffer.super_TWriteBuffer.Position,-1 + ,true,(Object *)local_6c); + Object::getObjectType((Object *)local_6c); + GetSpecialObject((SPECIALMEANING) + &Buffer.super_TWriteBuffer.Position); + GetSpecialObject((SPECIALMEANING) + &Buffer.super_TWriteBuffer.Position); + local_4c[0] = (Object)Obj->ObjectID; + Change(local_4c,(ObjectType *) + &Buffer.super_TWriteBuffer.Position,0); + Log("game","Post an %s in %s versandt.\n",Text_00,&Player); + pTVar1 = local_280; + local_6c = (undefined1 [4])Obj->ObjectID; + iVar13 = CountObjects((Object *)local_6c); + pTVar1->DepotSpace = pTVar1->DepotSpace - iVar13; + iVar13 = local_280->DepotSpace; + print(); + SendMessage((local_280->super_TCreature).Connection,0x16, + "New mail has arrived.",iVar13); + print(); + return; + } + } + Addressee._252_4_ = uVar2; + print(); + Object::getObjectType((Object *)local_6c); + GetSpecialObject((SPECIALMEANING)&Buffer.super_TWriteBuffer.Position); + GetSpecialObject((SPECIALMEANING)&Buffer.super_TWriteBuffer.Position); + local_4c[0] = (Object)Obj->ObjectID; + Change(local_4c,(ObjectType *)&Buffer.super_TWriteBuffer.Position,0); + // try { // try from 08074d78 to 08074d7c has its CatchHandler @ 08075205 + TDynamicWriteBuffer::TDynamicWriteBuffer + ((TDynamicWriteBuffer *)local_6c,0x400); + Buffer.super_TWriteBuffer.Position = Obj->ObjectID; + // try { // try from 08074d97 to 08074de3 has its CatchHandler @ 080751b6 + SaveObjects((Object *)&Buffer.super_TWriteBuffer.Position, + (TWriteStream *)local_6c,true); + Buffer.super_TWriteBuffer.Position = Obj->ObjectID; + Delete((Object *)&Buffer.super_TWriteBuffer.Position,-1); + pTVar7 = vector<>::operator()(&DelayedMail,DelayedMails); + pTVar7->CharacterID = uVar4; + pTVar7->DepotNumber = iVar13; + pTVar7->PacketSize = Buffer.super_TWriteBuffer.Size; + __dest = (uchar *)operator_new__(Buffer.super_TWriteBuffer.Size); + pTVar7->Packet = __dest; + memcpy(__dest,Buffer.super_TWriteBuffer.super_TWriteStream. + _vptr_TWriteStream,pTVar7->PacketSize); + // try { // try from 08074e03 to 08074e07 has its CatchHandler @ 08075205 + TDynamicWriteBuffer::~TDynamicWriteBuffer + ((TDynamicWriteBuffer *)local_6c, + (int)Buffer.super_TWriteBuffer.super_TWriteStream. + _vptr_TWriteStream); + DelayedMails = DelayedMails + 1; + // try { // try from 08074e2b to 08074eaa has its CatchHandler @ 08075210 + Log("game",&DAT_080f82c0,Text_00,&Player); + print(); + if (bVar3) { + SendMails(local_280->PlayerData); + } + else { + LoadCharacterOrder(uVar4); + } + } + } + } + } + } + } + else { + error(&DAT_080f8240); + } + return; +} + + + +void SendMails(TPlayerData *PlayerData) + +{ + __pid_t _Var1; + TDelayedMail *pTVar2; + uint uVar3; + uchar *__dest; + TDelayedMail *pTVar4; + int iVar5; + TDelayedMail *D; + int i; + int i_00; + bool bVar6; + char *Text; + uchar *NewDepot; + int NewDepotSize; + ushort local_3c; + bool DepotEmpty; + undefined1 local_2c [4]; + TWriteBuffer Buffer; + + if (PlayerData == (TPlayerData *)0x0) { + Text = "SendMails: PlayerData ist NULL.\n"; + } + else if (PlayerData->CharacterID == 0) { + Text = "SendMails: Slot ist nicht belegt.\n"; + } + else { + _Var1 = getpid(); + if (PlayerData->Locked == _Var1) { + if (DelayedMails < 1) { + return; + } + i_00 = 0; + do { + pTVar2 = vector<>::operator()(&DelayedMail,i_00); + if (pTVar2->CharacterID == PlayerData->CharacterID) { + iVar5 = pTVar2->DepotNumber; + bVar6 = false; + if ((-1 < iVar5) && (iVar5 < 9)) { + bVar6 = true; + } + if (!bVar6) { + error(&DAT_080f84e0,iVar5); + iVar5 = 0; + pTVar2->DepotNumber = 0; + } + bVar6 = PlayerData->Depot[iVar5] != (uchar *)0x0; + if (bVar6) { + uVar3 = pTVar2->PacketSize + PlayerData->DepotSize[iVar5]; + } + else { + uVar3 = pTVar2->PacketSize + 5; + } + __dest = (uchar *)operator_new__(uVar3); + memcpy(__dest,pTVar2->Packet,pTVar2->PacketSize); + if (pTVar2->Packet != (uchar *)0x0) { + operator_delete__(pTVar2->Packet); + } + if (bVar6) { + memcpy(__dest + pTVar2->PacketSize,PlayerData->Depot[pTVar2->DepotNumber], + PlayerData->DepotSize[pTVar2->DepotNumber]); + iVar5 = pTVar2->DepotNumber; + if (PlayerData->Depot[iVar5] != (uchar *)0x0) { + operator_delete__(PlayerData->Depot[iVar5]); + goto LAB_0807537c; + } + } + else { + TWriteBuffer::TWriteBuffer + ((TWriteBuffer *)local_2c,__dest + pTVar2->PacketSize,5); + GetSpecialObject((SPECIALMEANING)&local_3c); + TWriteBuffer::writeWord((TWriteBuffer *)local_2c,local_3c); + TWriteBuffer::writeByte((TWriteBuffer *)local_2c,0xff); + TWriteBuffer::writeWord((TWriteBuffer *)local_2c,0xffff); +LAB_0807537c: + iVar5 = pTVar2->DepotNumber; + } + PlayerData->Depot[iVar5] = __dest; + iVar5 = pTVar2->DepotNumber; + PlayerData->Dirty = true; + PlayerData->DepotSize[iVar5] = uVar3; + Log("game","Post an %s zugestellt.\n",PlayerData->Name); + if (i_00 != DelayedMails + -1) { + pTVar2 = vector<>::operator()(&DelayedMail,i_00); + pTVar4 = vector<>::operator()(&DelayedMail,DelayedMails + -1); + pTVar2->CharacterID = pTVar4->CharacterID; + pTVar2->DepotNumber = pTVar4->DepotNumber; + pTVar2->Packet = pTVar4->Packet; + pTVar2->PacketSize = pTVar4->PacketSize; + } + DelayedMails = DelayedMails + -1; + i_00 = i_00 + -1; + } + i_00 = i_00 + 1; + if (DelayedMails <= i_00) { + return; + } + } while( true ); + } + Text = "SendMails: Slot ist nicht vom GameThread gesperrt.\n"; + } + error(Text); + return; +} + + + +void TextEffect(char *Text,int x,int y,int z,int Radius) + +{ + TConnection *this; + ulong ID; + ulong CharacterID; + TPlayer *pTVar1; + TConnection *Connection; + int local_58; + int destX; + int destY; + int destZ; + TFindCreatures Search; + + if (Text == (char *)0x0) { + error("TextEffect: Text existiert nicht.\n"); + } + else { + TFindCreatures::TFindCreatures((TFindCreatures *)&destZ,Radius,Radius,x,y,1); + while( true ) { + CharacterID = TFindCreatures::getNext((TFindCreatures *)&destZ); + if (CharacterID == 0) break; + pTVar1 = GetPlayer(CharacterID); + if ((pTVar1 != (TPlayer *)0x0) && + (this = (pTVar1->super_TCreature).Connection, this != (TConnection *)0x0)) { + TConnection::GetPosition(this,&local_58,&destX,&destY); + if (((7 < Radius) || (z == destY)) && + (((0x1e < Radius || (z == destY)) || ((z < 8 && (destY < 8)))))) { + SendTalk(this,0,"",0x10,x,y,z,Text); + } + } + } + } + return; +} + + + +void ExecuteAction(EventType Event,TMoveUseAction *Action,Object *User,Object *Obj1,Object *Obj2, + Object *Temp) + +{ + bool bVar1; + ulong uVar2; + TPlayer *pTVar3; + undefined4 *puVar4; + char *__s; + size_t sVar5; + TCreature *pTVar6; + ulong uVar7; + int iVar8; + uint *puVar9; + uint *puVar10; + RESULT r; + uint uVar11; + uint uVar12; + TCreature *cr; + bool bVar13; + char *pcVar14; + ActionType AVar15; + Object *pOVar16; + INSTANCEATTRIBUTE Attribute; + ulong *puVar17; + Object *pOVar18; + Object *pOVar19; + Object *pOVar20; + int local_1c4; + int pos; + char *Text2; + TCreature *cr2; + int dx; + int dy; + int dz; + int x; + int y; + int z; + Object local_18c [4]; + Object local_17c [4]; + Object local_16c [4]; + Object local_15c [4]; + ulong local_14c [4]; + uint local_13c; + char Text [256]; + Object Con; + Object local_2c; + Object Obj; + + Text[0xfc] = '\0'; + Text[0xfd] = '\0'; + Text[0xfe] = '\0'; + Text[0xff] = '\0'; + local_2c.ObjectID = 0; + switch(Action->Action) { + case ACTION_CREATEONMAP: + // try { // try from 08075619 to 08077e1c has its CatchHandler @ 08077e32 + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_16c,Action->Parameters[1]); + GetMapContainer((int)local_17c,dz,x); + CreateObject(local_15c,(ObjectType *)local_17c,(ulong)local_16c); + Temp->ObjectID = (ulong)local_15c[0]; + break; + case ACTION_CREATE: + local_15c[0] = (Object)Temp->ObjectID; + local_14c[0] = Obj2->ObjectID; + local_18c[0] = (Object)Obj1->ObjectID; + z = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_16c[0].ObjectID; + local_17c[0].ObjectID = local_16c[0].ObjectID; + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + Object::getContainer(local_16c); + CreateObject(local_18c,(ObjectType *)local_16c,(ulong)local_17c); + Temp->ObjectID = (ulong)local_18c[0]; + break; + case ACTION_MONSTERONMAP: + UnpackAbsoluteCoordinate(); + iVar8 = Action->Parameters[1]; + goto LAB_080757f5; + case ACTION_MONSTER: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + iVar8 = Action->Parameters[1]; +LAB_080757f5: + CreateMonster(iVar8,dz,x,y,0,0,true); + break; + case ACTION_EFFECTONMAP: + UnpackAbsoluteCoordinate(); + GetMapContainer((int)&z,dz,x); + goto LAB_08075945; + case ACTION_EFFECT: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetMapContainer((Object *)&z); +LAB_08075945: + GraphicalEffect((Object *)&z,Action->Parameters[1]); + break; + case ACTION_TEXTONMAP: + UnpackAbsoluteCoordinate(); + pcVar14 = GetDynamicString(Action->Parameters[1]); + goto LAB_08075a34; + case ACTION_TEXT: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + pcVar14 = GetDynamicString(Action->Parameters[1]); +LAB_08075a34: + TextEffect(pcVar14,dz,x,y,Action->Parameters[2]); + break; + case ACTION_CHANGEONMAP: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + GetFirstSpecObject(); + Temp->ObjectID = (ulong)local_18c[0]; + z = NONE.ObjectID; + if (Temp->ObjectID == NONE.ObjectID) { + iVar8 = Action->Parameters[1]; + pcVar14 = "ExecuteAction (CHANGEONMAP): Kein Objekt %d auf [%d,%d,%d].\n"; +LAB_08075be0: + NONE.ObjectID = z; + error(pcVar14,iVar8,dz,x,y); + return; + } + ObjectType::setTypeID((ObjectType *)&z,Action->Parameters[2]); + local_18c[0] = (Object)Temp->ObjectID; + uVar7 = Action->Parameters[3]; + goto LAB_08075c18; + case ACTION_CHANGE: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + ObjectType::setTypeID((ObjectType *)&z,Action->Parameters[1]); + local_18c[0].ObjectID = local_2c.ObjectID; + uVar7 = Action->Parameters[2]; + goto LAB_08075c18; + case ACTION_CHANGEREL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + UnpackRelativeCoordinate(); + dz = (int)(cr2->super_TSkillBase).Skills + dz + -4; + x = x + dx; + y = y + dy; + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[2]); + GetFirstSpecObject(); + Temp->ObjectID = (ulong)local_18c[0]; + z = NONE.ObjectID; + if (Temp->ObjectID == NONE.ObjectID) { + iVar8 = Action->Parameters[2]; + pcVar14 = "ExecuteAction (CHANGEREL): Kein Objekt %d auf [%d,%d,%d].\n"; + goto LAB_08075be0; + } + ObjectType::setTypeID((ObjectType *)&z,Action->Parameters[3]); + local_18c[0] = (Object)Temp->ObjectID; + uVar7 = Action->Parameters[4]; +LAB_08075c18: + ChangeObject(local_18c,(ObjectType *)&z,uVar7); + break; + case ACTION_SETATTRIBUTE: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + uVar7 = Action->Parameters[2]; + Attribute = Action->Parameters[1]; + goto LAB_08075f26; + case ACTION_CHANGEATTRIBUTE: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + uVar7 = Object::getAttribute(&local_2c,Action->Parameters[1]); + uVar7 = uVar7 + Action->Parameters[2]; + if ((int)uVar7 < 1) { + dz = uVar7; + uVar7 = Object::getAttribute(&local_2c,Action->Parameters[1]); + uVar7 = (ulong)(uVar7 != 0); + } + Attribute = Action->Parameters[1]; + dz = uVar7; + goto LAB_08075f26; + case ACTION_SETQUESTVALUE: + pOVar18 = local_15c; + local_17c[0] = (Object)Temp->ObjectID; + pOVar19 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pOVar20 = local_17c; + GetEventObject(); + pOVar16 = &local_2c; + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getObjectType((Object *)&z); + if (z == 99) { + z = local_2c.ObjectID; + pTVar3 = (TPlayer *)GetCreature((Object *)&z); + if ((pTVar3 != (TPlayer *)0x0) && ((pTVar3->super_TCreature).Type == PLAYER)) { + TPlayer::SetQuestValue(pTVar3,Action->Parameters[1],Action->Parameters[2]); + return; + } + pcVar14 = + "ExecuteAction (SETQUESTVALUE): Kreatur existiert nicht oder ist kein Spieler.\n"; +LAB_08076102: + error(pcVar14,pOVar16,puVar17,pOVar18,pOVar19,pOVar20); + return; + } + Object::getObjectType((Object *)&z); + pcVar14 = "ExecuteAction (SETQUESTVALUE): Objekt ist keine Kreatur, sondern Typ %ld.\n"; + AVar15 = z; + goto switchD_080755eb_default; + case ACTION_DAMAGE: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + Text2 = (char *)0x0; + local_2c.ObjectID = local_18c[0].ObjectID; + bVar13 = local_18c[0].ObjectID != NONE.ObjectID; + z = NONE.ObjectID; + local_18c[0].ObjectID = NONE.ObjectID; + if (bVar13) { + Object::getObjectType(local_18c); + if (local_18c[0].ObjectID == 99) { + local_18c[0].ObjectID = local_2c.ObjectID; + Text2 = (char *)GetCreature(local_18c); + } + Object::getObjectType(local_18c); + bVar13 = ObjectType::getFlag((ObjectType *)local_18c,MAGICFIELD); + if ((bVar13) && (uVar7 = Object::getAttribute(&local_2c,RESPONSIBLE), uVar7 != 0)) { + local_18c[0].ObjectID = local_2c.ObjectID; + uVar7 = CronInfo(local_18c,false); + Object::getObjectType(local_17c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_17c,TOTALEXPIRETIME); + if (uVar2 < uVar7 + 5) { + uVar7 = Object::getAttribute(&local_2c,RESPONSIBLE); + Text2 = (char *)GetCreature(uVar7); + } + } + } + pOVar20 = local_17c; + pOVar19 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pOVar18 = local_15c; + GetEventObject(); + pOVar16 = &local_2c; + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getObjectType((Object *)&z); + if (z == 99) { + z = local_2c.ObjectID; + pTVar6 = GetCreature((Object *)&z); + if (pTVar6 != (TCreature *)0x0) { + TCreature::Damage(pTVar6,(TCreature *)Text2,Action->Parameters[3], + Action->Parameters[2]); + return; + } + pcVar14 = "ExecuteAction (DAMAGE): Kreatur existiert nicht.\n"; + goto LAB_08076102; + } + Object::getObjectType((Object *)&z); + pcVar14 = "ExecuteAction (DAMAGE): Objekt ist keine Kreatur, sondern Typ %d.\n"; + AVar15 = z; + goto switchD_080755eb_default; + case ACTION_SETSTART: + pOVar20 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + puVar17 = local_14c; + local_16c[0] = (Object)Obj2->ObjectID; + pOVar16 = local_15c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pOVar19 = local_17c; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = (char *)&local_2c; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z == 99) { + z = local_2c.ObjectID; + pTVar3 = (TPlayer *)GetCreature((Object *)&z); + uVar7 = Text._252_4_; + if ((pTVar3 != (TPlayer *)0x0) && ((pTVar3->super_TCreature).Type == PLAYER)) { + Log("game",&DAT_080f8780,(pTVar3->super_TCreature).Name,pOVar16,pOVar20,pOVar19); + UnpackAbsoluteCoordinate(); + TPlayer::SaveData(pTVar3); + return; + } + } + goto LAB_08076474; + case ACTION_WRITENAME: + local_17c[0] = (Object)Temp->ObjectID; + pOVar20 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + pOVar16 = local_15c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + puVar17 = local_14c; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = (char *)&local_2c; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z != 99) goto LAB_08076474; + z = local_2c.ObjectID; + pTVar6 = GetCreature((Object *)&z); + uVar7 = Text._252_4_; + if (pTVar6 == (TCreature *)0x0) goto LAB_08076474; + puVar10 = &local_13c; + for (iVar8 = 0x40; iVar8 != 0; iVar8 = iVar8 + -1) { + *puVar10 = 0; + puVar10 = puVar10 + 1; + } + __s = GetDynamicString(Action->Parameters[1]); + for (local_1c4 = 0; sVar5 = strlen(__s), local_1c4 < (int)sVar5; local_1c4 = local_1c4 + 1) + { + if ((__s[local_1c4] == '%') && (__s[local_1c4 + 1] == 'N')) { + pcVar14 = pTVar6->Name; + local_1c4 = local_1c4 + 1; + strcat((char *)&local_13c,pcVar14); + } + else { + puVar10 = &local_13c; + do { + puVar9 = puVar10; + uVar11 = *puVar9 + 0xfefefeff & ~*puVar9; + uVar12 = uVar11 & 0x80808080; + puVar10 = puVar9 + 1; + } while (uVar12 == 0); + bVar13 = (uVar11 & 0x8080) == 0; + if (bVar13) { + uVar12 = uVar12 >> 0x10; + } + if (bVar13) { + puVar10 = (uint *)((int)puVar9 + 6); + } + *(char *)((int)puVar10 + (-3 - (uint)CARRY1((byte)uVar12,(byte)uVar12))) = + __s[local_1c4]; + } + uVar7 = Text._252_4_; + if (Text[0xc4] != '\0') goto LAB_08076474; + } + pOVar20 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + puVar17 = local_14c; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pOVar16 = local_15c; + pcVar14 = (char *)Action->Parameters[2]; + GetEventObject(); + bVar13 = false; + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + if (local_18c[0].ObjectID == NONE.ObjectID) { +LAB_08076725: + bVar13 = true; + } + else { + Object::getObjectType(local_18c); + pcVar14 = (char *)0x18; + bVar1 = ObjectType::getFlag((ObjectType *)local_18c,TEXT); + if (!bVar1) goto LAB_08076725; + } + uVar7 = Text._252_4_; + if (bVar13) goto LAB_08076474; + uVar7 = Object::getAttribute(&local_2c,TEXTSTRING); + DeleteDynamicString(uVar7); + z = local_2c.ObjectID; + uVar7 = AddDynamicString((char *)&local_13c); + Change((Object *)&z,TEXTSTRING,uVar7); + uVar7 = 0; + Attribute = EDITOR; + goto LAB_08075f26; + case ACTION_WRITETEXT: + pOVar20 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + pOVar16 = local_15c; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pcVar14 = (char *)Action->Parameters[1]; + GetEventObject(); + bVar13 = false; + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + if (local_18c[0].ObjectID == NONE.ObjectID) { +LAB_08076857: + bVar13 = true; + } + else { + Object::getObjectType(local_18c); + pcVar14 = (char *)0x18; + bVar1 = ObjectType::getFlag((ObjectType *)local_18c,TEXT); + if (!bVar1) goto LAB_08076857; + } + uVar7 = Text._252_4_; + if (bVar13) goto LAB_08076474; + uVar7 = Object::getAttribute(&local_2c,TEXTSTRING); + DeleteDynamicString(uVar7); + z = local_2c.ObjectID; + pcVar14 = GetDynamicString(Action->Parameters[0]); + uVar7 = AddDynamicString(pcVar14); + Change((Object *)&z,TEXTSTRING,uVar7); + uVar7 = 0; + Attribute = EDITOR; +LAB_08075f26: + z = local_2c.ObjectID; + Change((Object *)&z,Attribute,uVar7); + break; + case ACTION_LOGOUT: + pOVar20 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + puVar17 = local_14c; + local_16c[0] = (Object)Obj2->ObjectID; + pOVar16 = local_15c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = (char *)&local_2c; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z == 99) { + z = local_2c.ObjectID; + pTVar6 = GetCreature((Object *)&z); + uVar7 = Text._252_4_; + if (pTVar6 != (TCreature *)0x0) { + TCreature::StartLogout(pTVar6,true,true); + return; + } + } + goto LAB_08076474; + case ACTION_MOVEALLONMAP: + UnpackAbsoluteCoordinate(); + GetFirstObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + UnpackAbsoluteCoordinate(); + GetMapContainer((int)local_18c,dz,x); + bVar13 = false; + z = NONE.ObjectID; + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + local_17c[0].ObjectID = local_2c.ObjectID; + goto LAB_08076acf; + case ACTION_MOVEALL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getContainer(local_17c); + GetFirstContainerObject(local_18c); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + UnpackAbsoluteCoordinate(); + goto LAB_08076bd6; + case ACTION_MOVEALLREL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getContainer(local_17c); + GetFirstContainerObject(local_18c); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + UnpackRelativeCoordinate(); + x = dx + x; + dz = (int)(cr2->super_TSkillBase).Skills + dz + -4; +LAB_08076bd6: + GetMapContainer((int)local_18c,dz,x); + bVar13 = false; + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + z = local_2c.ObjectID; + local_17c[0].ObjectID = local_2c.ObjectID; + goto LAB_08076acf; + case ACTION_MOVETOPONMAP: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + GetFirstSpecObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + if (local_18c[0].ObjectID == NONE.ObjectID) { + iVar8 = Action->Parameters[1]; + pcVar14 = "ExecuteAction (MOVETOPONMAP): Kein Objekt %d auf [%d,%d,%d].\n"; + goto LAB_08075be0; + } + UnpackAbsoluteCoordinate(); + GetMapContainer((int)local_18c,dz,x); + z = NONE.ObjectID; + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + Object::getNextObject(local_17c); + bVar13 = true; + goto LAB_08076acf; + case ACTION_MOVETOP: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + UnpackAbsoluteCoordinate(); + goto LAB_08076f87; + case ACTION_MOVETOPREL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + UnpackRelativeCoordinate(); + x = dx + x; + dz = (int)(cr2->super_TSkillBase).Skills + dz + -4; +LAB_08076f87: + GetMapContainer((int)local_18c,dz,x); + z = NONE.ObjectID; + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + Object::getNextObject(local_17c); + bVar13 = true; +LAB_08076acf: + MoveAllObjects(local_17c,local_18c,(Object *)&z,bVar13); + break; + case ACTION_MOVE: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + UnpackAbsoluteCoordinate(); + GetMapContainer((int)local_18c,dz,x); + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + goto LAB_080771eb; + case ACTION_MOVEREL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + local_18c[0] = (Object)Temp->ObjectID; + local_17c[0] = (Object)Obj2->ObjectID; + local_16c[0] = (Object)Obj1->ObjectID; + local_15c[0] = (Object)User->ObjectID; + GetEventObject(); + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + UnpackRelativeCoordinate(); + GetMapContainer((int)local_18c,(int)(cr2->super_TSkillBase).Skills + dz + -4,dx + x); + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + goto LAB_080771eb; + case ACTION_RETRIEVE: + local_18c[0] = (Object)Temp->ObjectID; + local_17c[0] = (Object)Obj2->ObjectID; + local_16c[0] = (Object)Obj1->ObjectID; + local_15c[0] = (Object)User->ObjectID; + GetEventObject(); + GetObjectCoordinates((Object *)&z,&dz,&x,&y); + UnpackRelativeCoordinate(); + GetTopObject((int)local_18c,(int)(cr2->super_TSkillBase).Skills + dz + -4,dx + x, + (bool)((char)dy + (char)y)); + bVar13 = false; + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + if (local_18c[0].ObjectID == NONE.ObjectID) { +LAB_080774d6: + bVar13 = true; + } + else { + Object::getObjectType(local_18c); + bVar1 = ObjectType::getFlag((ObjectType *)local_18c,UNMOVE); + if (bVar1) goto LAB_080774d6; + } + if (bVar13) { + return; + } + UnpackRelativeCoordinate(); + GetMapContainer((int)local_18c,(int)(cr2->super_TSkillBase).Skills + dz + -4,dx + x); + Text._252_4_ = local_18c[0].ObjectID; +LAB_080771eb: + z = Text._252_4_; + local_18c[0].ObjectID = local_2c.ObjectID; + MoveOneObject(local_18c,(Object *)&z); + break; + case ACTION_DELETEALLONMAP: + UnpackAbsoluteCoordinate(); + GetFirstObject(); + bVar13 = false; + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + goto LAB_0807762f; + case ACTION_DELETETOPONMAP: + UnpackAbsoluteCoordinate(); + pOVar20 = local_17c; + ObjectType::setTypeID((ObjectType *)pOVar20,Action->Parameters[1]); + GetFirstSpecObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + pcVar14 = (char *)dz; + puVar17 = (ulong *)x; + pOVar16 = (Object *)y; + uVar7 = Text._252_4_; + if (local_18c[0].ObjectID == NONE.ObjectID) goto LAB_08076474; + z = local_18c[0].ObjectID; + Object::getNextObject(local_18c); + bVar13 = true; +LAB_0807762f: + DeleteAllObjects(local_18c,(Object *)&z,bVar13); + break; + case ACTION_DELETEONMAP: + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + GetFirstSpecObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + if (local_18c[0].ObjectID == NONE.ObjectID) { + iVar8 = Action->Parameters[1]; + pcVar14 = "ExecuteAction (DELETEONMAP): Kein Objekt %d auf [%d,%d,%d].\n"; + goto LAB_08075be0; + } + goto LAB_080777c6; + case ACTION_DELETE: + pOVar16 = local_15c; + local_17c[0] = (Object)Temp->ObjectID; + pOVar20 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + pcVar14 = (char *)Action->Parameters[0]; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = NONE.ObjectID; + uVar7 = Text._252_4_; + if (local_18c[0].ObjectID == NONE.ObjectID) goto LAB_08076474; +LAB_080777c6: + Delete((Object *)&z,(-(uint)(Event < EVENT_MOVEMENT) & 2) - 1); + break; + case ACTION_DELETEININVENTORY: + pOVar20 = local_16c; + local_17c[0] = (Object)Temp->ObjectID; + puVar17 = local_14c; + local_16c[0] = (Object)Obj2->ObjectID; + pOVar16 = local_15c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = (char *)&local_2c; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z != 99) goto LAB_08076474; + ObjectType::setTypeID((ObjectType *)&z,Action->Parameters[1]); + uVar7 = Object::getCreatureID(&local_2c); + DeleteAtCreature(uVar7,(ObjectType *)&z,1,Action->Parameters[2]); + break; + case ACTION_DESCRIPTION: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getObjectType((Object *)&z); + if (z == 99) { + z = local_2c.ObjectID; + pTVar6 = GetCreature((Object *)&z); + if ((pTVar6 != (TCreature *)0x0) && (pTVar6->Type == PLAYER)) { + local_17c[0] = (Object)Temp->ObjectID; + pOVar16 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + pOVar20 = local_17c; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = GetInfo((Object *)&z); + SendMessage(pTVar6->Connection,0x16,"%s.",pcVar14,pOVar16,pOVar20); + } + } + break; + case ACTION_LOADDEPOT: + pOVar16 = local_15c; + local_17c[0] = (Object)Temp->ObjectID; + pOVar20 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + pcVar14 = (char *)&local_2c; + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z == 99) { + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + pOVar20 = local_17c; + GetFirstSpecObject(); + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + z = NONE.ObjectID; + pcVar14 = (char *)dz; + puVar17 = (ulong *)x; + pOVar16 = (Object *)y; + uVar7 = Text._252_4_; + if (local_18c[0].ObjectID != NONE.ObjectID) { + z = local_18c[0].ObjectID; + uVar7 = Object::getCreatureID(&local_2c); + LoadDepotBox(uVar7,Action->Parameters[3],(Object *)&z); + return; + } + } + goto LAB_08076474; + case ACTION_SAVEDEPOT: + pOVar16 = local_15c; + local_17c[0] = (Object)Temp->ObjectID; + pOVar20 = local_16c; + local_16c[0] = (Object)Obj2->ObjectID; + puVar17 = local_14c; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + pcVar14 = (char *)&local_2c; + Object::getObjectType((Object *)&z); + uVar7 = Text._252_4_; + if (z == 99) { + UnpackAbsoluteCoordinate(); + ObjectType::setTypeID((ObjectType *)local_17c,Action->Parameters[1]); + pOVar20 = local_17c; + GetFirstSpecObject(); + z = NONE.ObjectID; + Text[0xfc] = (undefined1)local_18c[0].ObjectID; + Text[0xfd] = local_18c[0].ObjectID._1_1_; + Text[0xfe] = local_18c[0].ObjectID._2_1_; + Text[0xff] = local_18c[0].ObjectID._3_1_; + pcVar14 = (char *)dz; + puVar17 = (ulong *)x; + pOVar16 = (Object *)y; + uVar7 = local_18c[0].ObjectID; + if (local_18c[0].ObjectID != NONE.ObjectID) { + z = local_18c[0].ObjectID; + uVar7 = Object::getCreatureID(&local_2c); + SaveDepotBox(uVar7,Action->Parameters[3],(Object *)&z); + return; + } + } +LAB_08076474: + Text._252_4_ = uVar7; + puVar4 = (undefined4 *)__cxa_allocate_exception(4,pcVar14,puVar17,pOVar16,pOVar20); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); + case ACTION_SENDMAIL: + local_17c[0] = (Object)Temp->ObjectID; + local_16c[0] = (Object)Obj2->ObjectID; + local_15c[0] = (Object)Obj1->ObjectID; + local_14c[0] = User->ObjectID; + GetEventObject(); + local_2c.ObjectID = local_18c[0].ObjectID; + z = local_18c[0].ObjectID; + SendMail((Object *)&z); + break; + case ACTION_NOP: + break; + default: + pcVar14 = "ExecuteAction: Unbekannte Aktion %d.\n"; + AVar15 = Action->Action; +switchD_080755eb_default: + error(pcVar14,AVar15); + } + return; +} + + + +bool HandleEvent(EventType Event,Object *User,Object *Obj1,Object *Obj2) + +{ + bool bVar1; + bool bVar2; + TMoveUseCondition *Condition; + TMoveUseRule *pTVar3; + TMoveUseCondition *Condition_00; + TMoveUseAction *Action; + int condition; + int iVar4; + int iVar5; + TMoveUseRule *Rule; + TMoveUseDatabase *DB; + int iStack_60; + bool fulfilled; + int rule; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Temp; + + if (HandleEvent::RecursionDepth < 0xb) { + iStack_60 = 1; + HandleEvent::RecursionDepth = HandleEvent::RecursionDepth + 1; + if (0 < MoveUseDatabases[Event].NumberOfRules) { + do { + pTVar3 = vector<>::operator()(&MoveUseDatabases[Event].Rules,iStack_60); + bVar1 = true; + local_2c.ObjectID = NONE.ObjectID; + iVar4 = pTVar3->FirstCondition; + if (iVar4 <= pTVar3->LastCondition) { + do { + Condition_00 = vector<>::operator()(&MoveUseConditions,iVar4); + local_3c[0] = (Object)Obj2->ObjectID; + local_4c[0] = (Object)Obj1->ObjectID; + rule = User->ObjectID; + bVar2 = CheckCondition(Event,Condition_00,(Object *)&rule,local_4c,local_3c, + &local_2c); + if (!bVar2) { + bVar1 = false; + } + iVar4 = iVar4 + 1; + if (!bVar1) goto LAB_08077f6d; + } while (iVar4 <= pTVar3->LastCondition); + } + if (bVar1) { + iVar4 = pTVar3->FirstAction; + if (pTVar3->FirstAction <= pTVar3->LastAction) { + do { + iVar5 = iVar4 + 1; + Action = vector<>::operator()(&MoveUseActions,iVar4); + rule = Obj2->ObjectID; + local_4c[0] = (Object)Obj1->ObjectID; + local_3c[0] = (Object)User->ObjectID; + ExecuteAction(Event,Action,local_3c,local_4c,(Object *)&rule,&local_2c); + iVar4 = iVar5; + } while (iVar5 <= pTVar3->LastAction); + } + HandleEvent::RecursionDepth = HandleEvent::RecursionDepth + -1; + return true; + } +LAB_08077f6d: + iStack_60 = iStack_60 + 1; + } while (iStack_60 <= MoveUseDatabases[Event].NumberOfRules); + } + HandleEvent::RecursionDepth = HandleEvent::RecursionDepth + -1; + } + else { + error("HandleEvent: Endlosschleife im Move/Use-System vermutet.\n"); + } + return false; +} + + + +void UseContainer(ulong CreatureID,Object *Con,uchar Window) + +{ + bool bVar1; + TPlayer *this; + undefined4 *puVar2; + int Window_00; + char *pcVar3; + Object *pOVar4; + TPlayer *pl; + Object OStack_4c; + uchar Window_local; + _func_int_varargs **local_3c; + _func_int_varargs **local_2c; + + // try { // try from 0807802f to 080781a2 has its CatchHandler @ 080781b0 + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType((Object *)&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CONTAINER); + if (!bVar1) { + pcVar3 = &DAT_080f8980; + goto LAB_0807819e; + } + if (Window < 0x10) { + pOVar4 = Con; + Object::getObjectType((Object *)&local_2c); + if (local_2c == (_func_int_varargs **)0x63) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,pOVar4); + *puVar2 = 0x1d; + goto LAB_0807815a; + } + this = GetPlayer(CreatureID); + if (this != (TPlayer *)0x0) { + Window_00 = 0; + do { + TPlayer::GetOpenContainer((TPlayer *)&local_2c,(int)this); + local_3c = (_func_int_varargs **)Con->ObjectID; + if (local_2c == local_3c) { + OStack_4c.ObjectID = NONE.ObjectID; + TPlayer::SetOpenContainer(this,Window_00,&stack0xffffffb4); + SendCloseContainer((this->super_TCreature).Connection,Window_00); + return; + } + Window_00 = Window_00 + 1; + } while (Window_00 < 0x10); + OStack_4c.ObjectID = (ulong)local_3c; + TPlayer::SetOpenContainer(this,(uint)Window,&stack0xffffffb4); + SendContainer((this->super_TCreature).Connection,(uint)Window); + return; + } + pcVar3 = "UseContainer: Spieler %d existiert nicht.\n"; + } + else { + CreatureID = (ulong)Window; + pcVar3 = &DAT_080f8940; + } + error(pcVar3,CreatureID); + } + else { + pcVar3 = &DAT_080f89c0; +LAB_0807819e: + error(pcVar3); + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0807815a: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void UseChest(ulong CreatureID,Object *Chest) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + int iVar4; + TPlayer *this; + char *pcVar5; + int iVar6; + int iVar7; + char *pcVar8; + undefined4 *puVar9; + int Weight; + ulong uVar10; + undefined4 uVar11; + undefined8 local_bc; + int iStack_b8; + bool invert; + bool first; + int pos; + TPlayer *pl; + int Number; + int x; + int y; + int z; + Object local_7c [4]; + Object local_6c; + Object Obj; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Treasure; + + // try { // try from 080781e8 to 08078562 has its CatchHandler @ 08078948 + bVar2 = Object::exists(Chest); + if (bVar2) { + Object::getObjectType(&local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,CHEST); + if (bVar2) { + local_2c = (Object)Chest->ObjectID; + GetObjectCoordinates(&local_2c,&Number,&x,&y); + uVar3 = Object::getAttribute(Chest,CHESTQUESTNUMBER); + bVar2 = false; + if ((0 < (int)uVar3) && ((int)uVar3 < 500)) { + bVar2 = true; + } + if (!bVar2) { + error(&DAT_080f8b40,uVar3,Number,x,y); + goto LAB_0807875e; + } + local_2c = (Object)Chest->ObjectID; + iVar4 = CountObjectsInContainer(&local_2c); + if (iVar4 != 1) { + error(&DAT_080f8ae0,Number,x,y); + goto LAB_0807875e; + } + local_3c[0] = (Object)Chest->ObjectID; + GetFirstContainerObject(&local_2c); + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,UNMOVE); + if (!bVar2) { + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,TAKE); + if (bVar2) { + this = GetPlayer(CreatureID); + if (this == (TPlayer *)0x0) { + // try { // try from 08078759 to 080787f5 has its CatchHandler @ 08078948 + error("UseChest: Spieler %d existiert nicht.\n",CreatureID); + goto LAB_0807875e; + } + iVar4 = TPlayer::GetQuestValue(this,uVar3); + if (iVar4 != 0) { + print(); + Object::getObjectType(local_3c); + pcVar5 = ObjectType::getName((ObjectType *)local_3c); + SendMessage((this->super_TCreature).Connection,0x16,"The %s is empty.", + pcVar5); + return; + } + bVar2 = CheckRight(CreatureID,UNLIMITED_CAPACITY); + if (bVar2) { +LAB_080784f2: + Object::getContainer(&local_6c); + Copy(local_4c,&local_6c); + local_2c.ObjectID = local_4c[0].ObjectID; + local_3c[0].ObjectID = local_4c[0].ObjectID; + Object::getObjectType(&local_6c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_6c,MOVEMENTEVENT); + uVar11 = 1; + uVar10 = CreatureID; + // try { // try from 08078586 to 08078614 has its CatchHandler @ 0807880d + GetBodyObject((ulong)&local_6c,CreatureID); + if ((bVar2) || (local_6c.ObjectID != NONE.ObjectID)) { + bVar1 = false; + if (bVar2) { + local_7c[0] = (Object)NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (local_6c.ObjectID != NONE.ObjectID) { + Object::getObjectType(local_4c); + uVar10 = 4; + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,CONTAINER); + if (bVar2) { + bVar1 = true; + } + } + } + if (!bVar1) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4,uVar10,uVar11); + *puVar9 = 4; + // WARNING: Subroutine does not return + // try { // try from 08078698 to 0807873f has its CatchHandler @ 0807880d + __cxa_throw(puVar9,&RESULT::typeinfo,0); + } + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = local_6c.ObjectID; + z = local_2c.ObjectID; + Move(CreatureID,(Object *)&z,local_3c,-1,true,local_4c); + } + else { + local_4c[0].ObjectID = NONE.ObjectID; + GetBodyContainer((ulong)local_3c,CreatureID); + local_7c[0].ObjectID = local_2c.ObjectID; + Move(CreatureID,local_7c,local_3c,-1,true,local_4c); + } + z = local_2c.ObjectID; + // try { // try from 08078621 to 0807866d has its CatchHandler @ 08078948 + pcVar5 = GetName((Object *)&z); + SendMessage((this->super_TCreature).Connection,0x16,"You have found %s.\n", + pcVar5); + TPlayer::SetQuestValue(this,uVar3,1); + return; + } + local_3c[0].ObjectID = local_2c.ObjectID; + iVar4 = GetCompleteWeight(local_3c); + iVar6 = GetInventoryWeight(CreatureID); + iVar7 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[5]); + if ((iVar4 + iVar6 <= iVar7 * 100) && + (bVar2 = CheckRight(CreatureID,ZERO_CAPACITY), !bVar2)) goto LAB_080784f2; + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar2) { + uVar3 = Object::getAttribute(&local_2c,AMOUNT); + pcVar5 = "they are"; + if (1 < uVar3) goto LAB_0807844b; + } + pcVar5 = "it is"; +LAB_0807844b: + local_3c[0].ObjectID = local_2c.ObjectID; + pcVar8 = GetName(local_3c); + iVar6 = (iStack_b8 >> 5) - (iVar4 >> 0x1f); + SendMessage((this->super_TCreature).Connection,0x16, + "You have found %s. Weighing %d.%02d oz %s too heavy.",pcVar8,iVar6, + iVar4 + iVar6 * -100,pcVar5); + return; + } + } + pcVar5 = "UseChest: Schatz auf Position [%d,%d,%d] ist nicht nehmbar.\n"; + } + else { + pcVar5 = &DAT_080f8ba0; + } + } + else { + pcVar5 = &DAT_080f8be0; + } + error(pcVar5); +LAB_0807875e: + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar9,&RESULT::typeinfo,0); +} + + + +void UseLiquidContainer(ulong CreatureID,Object *Obj,Object *Dest) + +{ + TSkill *pTVar1; + bool bVar2; + bool bVar3; + ulong uVar4; + undefined4 *puVar5; + TPlayer *this; + int iVar6; + char *pcVar7; + int iVar8; + undefined4 uVar9; + int LiquidType; + int local_58; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c; + Object Help; + + // try { // try from 0807897b to 08078f23 has its CatchHandler @ 08078f43 + bVar2 = Object::exists(Obj); + if (bVar2) { + bVar2 = Object::exists(Dest); + if (bVar2) { + Object::getObjectType(&local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,LIQUIDCONTAINER); + if (!bVar2) { + pcVar7 = &DAT_080f8ce0; + goto LAB_08078f0b; + } + Object::getObjectType(&local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,LIQUIDSOURCE); + if ((bVar2) && (uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE), uVar4 == 0)) { + Object::getObjectType(&local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)&local_2c,SOURCELIQUIDTYPE); + local_2c = (Object)Obj->ObjectID; +LAB_08078ec5: + Change(&local_2c,CONTAINERLIQUIDTYPE,uVar4); + return; + } + Object::getObjectType(&local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,LIQUIDCONTAINER); + if ((bVar2) && + ((uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE), uVar4 != 0 && + (uVar4 = Object::getAttribute(Dest,CONTAINERLIQUIDTYPE), uVar4 == 0)))) { + local_2c = (Object)Dest->ObjectID; + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + Change(&local_2c,CONTAINERLIQUIDTYPE,uVar4); + local_2c = (Object)Obj->ObjectID; + uVar4 = 0; + goto LAB_08078ec5; + } + Object::getObjectType(&local_2c); + if (local_2c.ObjectID != 99) { + Object::getContainer(local_3c); + GetFirstContainerObject(&local_2c); + z = NONE.ObjectID; + local_3c[0].ObjectID = z; + if (local_2c.ObjectID != NONE.ObjectID) { + do { + z = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType((Object *)&z); + if ((z == 99) && + (uVar4 = Object::getCreatureID(&local_2c), uVar4 == CreatureID)) { + local_3c[0].ObjectID = local_2c.ObjectID; + Dest->ObjectID = (ulong)local_2c; + z = local_2c.ObjectID; + break; + } + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + bVar2 = local_3c[0].ObjectID != NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + z = NONE.ObjectID; + } while (bVar2); + } + } + Object::getObjectType((Object *)&z); + if ((z != 99) || (uVar4 = Object::getCreatureID(Dest), uVar4 != CreatureID)) { + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + if (uVar4 == 0) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x1d; + } + else { + z = Dest->ObjectID; + GetObjectCoordinates((Object *)&z,&local_58,&x,&y); + bVar2 = false; + uVar9 = 0; + iVar6 = x; + iVar8 = y; + bVar3 = CoordinateFlag(); + if (bVar3) { + uVar9 = 0x23; + bVar2 = CoordinateFlag(); + bVar2 = !bVar2; + iVar6 = x; + iVar8 = y; + } + if (bVar2) { + Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + local_3c[0] = (Object)Dest->ObjectID; + GetMapContainer((Object *)&z); + GetSpecialObject((SPECIALMEANING)&local_2c); + CreatePool(); + return; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4,iVar6,iVar8,uVar9); + *puVar5 = 4; + } + goto LAB_08078b95; + } + this = GetPlayer(CreatureID); + if (this != (TPlayer *)0x0) { + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + switch(uVar4) { + case 0: + return; + default: + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + pcVar7 = "Gulp."; + break; + case 2: + case 3: + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x14]; + pcVar7 = "Aah..."; + iVar6 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if (iVar6 < 5) { + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x14]; + (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + TSkillBase::SetTimer(&(this->super_TCreature).super_TSkillBase); + } + break; + case 6: + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + pcVar7 = "Urgh!"; + TCreature::Damage(&this->super_TCreature,(TCreature *)0x0,200,0x20); + break; + case 8: + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + pcVar7 = "Urgh!"; + break; + case 10: + case 0xb: + z = Obj->ObjectID; + DrinkPotion(CreatureID,(Object *)&z); + pcVar7 = "Aaaah..."; + break; + case 0xc: + z = Obj->ObjectID; + Change((Object *)&z,CONTAINERLIQUIDTYPE,0); + pcVar7 = "Mmmh."; + } + Talk(CreatureID,1,(char *)0x0,pcVar7,false); + return; + } + pcVar7 = "UseLiquidContainer: Spieler %d existiert nicht.\n"; + } + else { + Object::getObjectType(&local_2c); + pcVar7 = &DAT_080f8d40; + CreatureID = local_2c.ObjectID; + } + error(pcVar7,CreatureID); + } + else { + pcVar7 = &DAT_080f8da0; +LAB_08078f0b: + error(pcVar7); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; +LAB_08078b95: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void UseFood(ulong CreatureID,Object *Obj) + +{ + TSkill *pTVar1; + int iVar2; + bool bVar3; + TPlayer *pTVar4; + int iVar5; + ulong uVar6; + undefined4 *puVar7; + char *Text; + TPlayer *pl; + + // try { // try from 08078f78 to 080790e9 has its CatchHandler @ 080790f5 + bVar3 = Object::exists(Obj); + if (bVar3) { + Object::getObjectType((Object *)&pl); + bVar3 = ObjectType::getFlag((ObjectType *)&pl,FOOD); + if (!bVar3) { + Text = &DAT_080f8e20; + goto LAB_080790e5; + } + pTVar4 = GetPlayer(CreatureID); + if (pTVar4 != (TPlayer *)0x0) { + pTVar1 = (pTVar4->super_TCreature).super_TSkillBase.Skills[0xe]; + iVar5 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + iVar2 = pTVar1->Max; + Object::getObjectType((Object *)&pl); + uVar6 = ObjectType::getAttribute((ObjectType *)&pl,NUTRITION); + if (iVar5 <= (int)(iVar2 + uVar6 * -0xc)) { + (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + Object::getObjectType((Object *)&pl); + ObjectType::getAttribute((ObjectType *)&pl,NUTRITION); + TSkillBase::SetTimer(&(pTVar4->super_TCreature).super_TSkillBase); + pl = (TPlayer *)Obj->ObjectID; + Delete((Object *)&pl,1); + return; + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x1e; + goto LAB_080790a2; + } + error("UseFood: Kreatur %d existiert nicht.\n",CreatureID); + } + else { + Text = &DAT_080f8e60; +LAB_080790e5: + error(Text); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; +LAB_080790a2: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +void UseTextObject(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + TPlayer *pTVar2; + undefined4 *puVar3; + TPlayer *pl; + char *Text; + Object local_2c [7]; + + // try { // try from 08079128 to 080791d2 has its CatchHandler @ 080791e0 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,TEXT); + if (bVar1) { + pTVar2 = GetPlayer(CreatureID); + if (pTVar2 != (TPlayer *)0x0) { + local_2c[0] = (Object)Obj->ObjectID; + SendEditText((pTVar2->super_TCreature).Connection,local_2c); + return; + } + error("UseTextObject: Kreatur %d existiert nicht.\n",CreatureID); + goto LAB_0807919d; + } + Text = &DAT_080f8ee0; + } + else { + Text = &DAT_080f8f20; + } + error(Text); +LAB_0807919d: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void UseAnnouncer(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + TPlayer *this; + ulong uVar2; + int iVar3; + undefined4 *puVar4; + char cVar5; + char *Text; + TPlayer *pl; + int Hour; + int Minute; + int Year; + int Cycle; + int Day; + char Help [200]; + Object local_2c [7]; + + // try { // try from 0807921b to 080795fa has its CatchHandler @ 08079606 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,INFORMATION); + if (bVar1) { + this = GetPlayer(CreatureID); + if (this != (TPlayer *)0x0) { + Object::getObjectType(local_2c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_2c,INFORMATIONTYPE); + if (uVar2 == 2) { + GetTime((int *)&pl,&Hour); + SendMessage((this->super_TCreature).Connection,0x16,"The time is %d:%.2d.",pl, + Hour); + return; + } + if (uVar2 < 3) { + if (uVar2 == 1) { + GetDate(&Minute,&Year,&Cycle); + GetTime((int *)&pl,&Hour); + SendMessage((this->super_TCreature).Connection,0x16, + "It is the %dth day of the %dth cycle in the year %d. The time is %d:%.2d." + ,Cycle,Year,Minute,pl,Hour); + return; + } + } + else { + if (uVar2 == 3) { + Day = 0x65636552; + builtin_strncpy(Help,"ived blessings:",0x10); + iVar3 = TPlayer::GetQuestValue(this,0x65); + cVar5 = iVar3 != 0; + if ((bool)cVar5) { + strcat((char *)&Day,"\nWisdom of Solitude"); + } + iVar3 = TPlayer::GetQuestValue(this,0x66); + if (iVar3 != 0) { + cVar5 = cVar5 + '\x01'; + strcat((char *)&Day,"\nSpark of the Phoenix"); + } + iVar3 = TPlayer::GetQuestValue(this,0x67); + if (iVar3 != 0) { + cVar5 = cVar5 + '\x01'; + strcat((char *)&Day,"\nFire of the Suns"); + } + iVar3 = TPlayer::GetQuestValue(this,0x68); + if (iVar3 != 0) { + cVar5 = cVar5 + '\x01'; + strcat((char *)&Day,"\nSpiritual Shielding"); + } + iVar3 = TPlayer::GetQuestValue(this,0x69); + if (iVar3 != 0) { + cVar5 = cVar5 + '\x01'; + strcat((char *)&Day,"\nEmbrace of Tibia"); + } + if (cVar5 == '\0') { + builtin_strncpy(Help,"lessings received.",0x13); + Day = 0x62206f4e; + } + SendMessage((this->super_TCreature).Connection,0x16,"%s",&Day); + return; + } + if (uVar2 == 4) { + local_2c[0] = (Object)Obj->ObjectID; + SendEditText((this->super_TCreature).Connection,local_2c); + return; + } + } + Object::getObjectType(local_2c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_2c,INFORMATIONTYPE); + error(&DAT_080f8f60,uVar2); + return; + } + error("UseAnnouncer: Kreatur %d existiert nicht.\n",CreatureID); + goto LAB_080795c5; + } + Text = &DAT_080f9040; + } + else { + Text = &DAT_080f9080; + } + error(Text); +LAB_080795c5: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void UseKeyDoor(ulong param_1,Object *Key,Object *Door) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + undefined4 *puVar4; + char *Text; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + ObjectType Target; + + // try { // try from 08079638 to 08079834 has its CatchHandler @ 08079850 + bVar1 = Object::exists(Key); + if (bVar1) { + bVar1 = Object::exists(Door); + if (!bVar1) { + Text = &DAT_080f9140; + goto LAB_08079830; + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,KEY); + if (!bVar1) { + Text = &DAT_080f9100; + goto LAB_08079830; + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,KEYDOOR); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1d; + goto LAB_080797e9; + } + uVar2 = Object::getAttribute(Door,KEYHOLENUMBER); + if ((uVar2 == 0) || (uVar2 = Object::getAttribute(Key,KEYNUMBER), uVar2 == 0)) { +LAB_08079801: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x16; + goto LAB_080797e9; + } + uVar2 = Object::getAttribute(Door,KEYHOLENUMBER); + uVar3 = Object::getAttribute(Key,KEYNUMBER); + if (uVar2 != uVar3) goto LAB_08079801; + Object::getObjectType(local_3c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_3c,KEYDOORTARGET); + ObjectType::setTypeID((ObjectType *)&local_2c,uVar2); + ObjectType::setTypeID((ObjectType *)local_3c,0); + if (local_2c.ObjectID != local_3c[0].ObjectID) { + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,UNPASS); + if (bVar1) { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0] = (Object)Door->ObjectID; + ClearField(local_3c,local_4c); + } + ObjectType::setTypeID((ObjectType *)local_4c,local_2c.ObjectID); + local_3c[0] = (Object)Door->ObjectID; + Change(local_3c,(ObjectType *)local_4c,0); + return; + } + Object::getObjectType(local_4c); + error(&DAT_080f90c0,local_4c[0].ObjectID); + } + else { + Text = &DAT_080f9180; +LAB_08079830: + error(Text); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_080797e9: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void UseNameDoor(ulong CreatureID,Object *Door) + +{ + bool bVar1; + ushort HouseID; + TPlayer *pl_00; + ulong _TypeID; + undefined4 *puVar2; + TPlayer *pl; + char *Text; + int local_58; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c; + ObjectType Target; + + // try { // try from 08079885 to 08079ace has its CatchHandler @ 08079af0 + bVar1 = Object::exists(Door); + if (bVar1) { + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,NAMEDOOR); + if (!bVar1) { + Text = &DAT_080f92c0; + goto LAB_08079aca; + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,TEXT); + if (!bVar1) { + Text = &DAT_080f9280; + goto LAB_08079aca; + } + pl_00 = GetPlayer(CreatureID); + if (pl_00 == (TPlayer *)0x0) { + Text = "UseNameDoor: Spieler existiert nicht.\n"; + goto LAB_08079aca; + } + local_2c = (Object)Door->ObjectID; + GetObjectCoordinates(&local_2c,&local_58,&x,&y); + HouseID = GetHouseID(local_58,x,y); + if (HouseID == 0) { + error(&DAT_080f9200,local_58,x,y); + } + else { + bVar1 = IsOwner(HouseID,pl_00); + if ((!bVar1) && (bVar1 = CheckRight((pl_00->super_TCreature).ID,OPEN_NAMEDOORS), !bVar1) + ) { + local_2c = (Object)Door->ObjectID; + bVar1 = MayOpenDoor(&local_2c,pl_00); + if (!bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 1; + goto LAB_08079a3a; + } + } + Object::getObjectType(local_3c); + _TypeID = ObjectType::getAttribute((ObjectType *)local_3c,NAMEDOORTARGET); + ObjectType::setTypeID((ObjectType *)&local_2c,_TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,0); + if (local_2c.ObjectID != local_3c[0].ObjectID) { + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,UNPASS); + if (bVar1) { + z = NONE.ObjectID; + local_3c[0] = (Object)Door->ObjectID; + ClearField(local_3c,(Object *)&z); + } + ObjectType::setTypeID((ObjectType *)&z,local_2c.ObjectID); + local_3c[0] = (Object)Door->ObjectID; + Change(local_3c,(ObjectType *)&z,0); + return; + } + Object::getObjectType((Object *)&z); + error(&DAT_080f91c0,z); + } + } + else { + Text = &DAT_080f9320; +LAB_08079aca: + error(Text); + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08079a3a: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void UseLevelDoor(ulong CreatureID,Object *Door) + +{ + bool bVar1; + bool bVar2; + TPlayer *pTVar3; + int iVar4; + ulong uVar5; + char *pcVar6; + undefined4 *puVar7; + TPlayer *pl; + Object local_4c [4]; + Object local_3c; + ObjectType Target; + Object local_2c [7]; + + // try { // try from 08079b28 to 08079d8b has its CatchHandler @ 08079d97 + bVar1 = Object::exists(Door); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LEVELDOOR); + if (!bVar1) goto LAB_08079d8e; + Object::getContainer(local_2c); + Object::getObjectType(&local_3c); + if (local_3c.ObjectID != 0) goto LAB_08079d8e; + pTVar3 = GetPlayer(CreatureID); + if (pTVar3 == (TPlayer *)0x0) { + pcVar6 = "UseLevelDoor: Spieler existiert nicht.\n"; + goto LAB_08079d87; + } + Object::getObjectType(&local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,UNPASS); + if (!bVar1) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x1d; + goto LAB_08079d37; + } + iVar4 = TSkill::Get((pTVar3->super_TCreature).super_TSkillBase.Skills[0]); + uVar5 = Object::getAttribute(Door,DOORLEVEL); + if (iVar4 < (int)uVar5) { + local_3c = (Object)Door->ObjectID; + pcVar6 = GetInfo(&local_3c); + SendMessage((pTVar3->super_TCreature).Connection,0x16,"%s.",pcVar6); + return; + } + Object::getObjectType(local_2c); + uVar5 = ObjectType::getAttribute((ObjectType *)local_2c,LEVELDOORTARGET); + ObjectType::setTypeID((ObjectType *)&local_3c,uVar5); + bVar1 = false; + ObjectType::setTypeID((ObjectType *)local_2c,0); + if ((local_3c.ObjectID == local_2c[0].ObjectID) || + (bVar2 = ObjectType::getFlag((ObjectType *)&local_3c,UNPASS), bVar2)) { + bVar1 = true; + } + if (!bVar1) { + ObjectType::setTypeID((ObjectType *)local_4c,local_3c.ObjectID); + local_2c[0] = (Object)Door->ObjectID; + Change(local_2c,(ObjectType *)local_4c,0); + local_4c[0].ObjectID = NONE.ObjectID; + Object::getContainer(local_2c); + pl = (TPlayer *)(pTVar3->super_TCreature).CrObject.ObjectID; + Move(0,(Object *)&pl,local_2c,-1,false,local_4c); + return; + } + Object::getObjectType(local_4c); + error(&DAT_080f9360,local_4c[0].ObjectID); + } + else { +LAB_08079d8e: + pcVar6 = &DAT_080f9400; +LAB_08079d87: + error(pcVar6); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; +LAB_08079d37: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +void UseQuestDoor(ulong CreatureID,Object *Door) + +{ + bool bVar1; + bool bVar2; + TPlayer *this; + ulong uVar3; + ulong uVar4; + char *pcVar5; + undefined4 *puVar6; + TPlayer *pl; + Object local_4c [4]; + Object local_3c; + ObjectType Target; + Object local_2c [7]; + + // try { // try from 08079dc8 to 0807a03c has its CatchHandler @ 0807a048 + bVar1 = Object::exists(Door); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,QUESTDOOR); + if (!bVar1) goto LAB_0807a03f; + Object::getContainer(local_2c); + Object::getObjectType(&local_3c); + if (local_3c.ObjectID != 0) goto LAB_0807a03f; + this = GetPlayer(CreatureID); + if (this == (TPlayer *)0x0) { + pcVar5 = "UseQuestDoor: Spieler existiert nicht.\n"; + goto LAB_0807a038; + } + Object::getObjectType(&local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,UNPASS); + if (!bVar1) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x1d; + goto LAB_08079fe8; + } + uVar3 = Object::getAttribute(Door,DOORQUESTNUMBER); + uVar3 = TPlayer::GetQuestValue(this,uVar3); + uVar4 = Object::getAttribute(Door,DOORQUESTVALUE); + if (uVar3 != uVar4) { + local_3c = (Object)Door->ObjectID; + pcVar5 = GetInfo(&local_3c); + SendMessage((this->super_TCreature).Connection,0x16,"%s.",pcVar5); + return; + } + Object::getObjectType(local_2c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_2c,QUESTDOORTARGET); + ObjectType::setTypeID((ObjectType *)&local_3c,uVar3); + bVar1 = false; + ObjectType::setTypeID((ObjectType *)local_2c,0); + if ((local_3c.ObjectID == local_2c[0].ObjectID) || + (bVar2 = ObjectType::getFlag((ObjectType *)&local_3c,UNPASS), bVar2)) { + bVar1 = true; + } + if (!bVar1) { + ObjectType::setTypeID((ObjectType *)local_4c,local_3c.ObjectID); + local_2c[0] = (Object)Door->ObjectID; + Change(local_2c,(ObjectType *)local_4c,0); + local_4c[0].ObjectID = NONE.ObjectID; + Object::getContainer(local_2c); + pl = (TPlayer *)(this->super_TCreature).CrObject.ObjectID; + Move(0,(Object *)&pl,local_2c,-1,false,local_4c); + return; + } + Object::getObjectType(local_4c); + error(&DAT_080f9440,local_4c[0].ObjectID); + } + else { +LAB_0807a03f: + pcVar5 = &DAT_080f94e0; +LAB_0807a038: + error(pcVar5); + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xffffffff; +LAB_08079fe8: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +void UseWeapon(ulong CreatureID,Object *Weapon,Object *Target) + +{ + bool bVar1; + TPlayer *pl; + ulong uVar2; + TPlayer *pTVar3; + long lVar4; + undefined4 *puVar5; + char *Text; + Object *pOVar6; + Object local_4c [4]; + Object local_3c; + ObjectType Dest; + Object local_2c [7]; + + // try { // try from 0807a078 to 0807a2c9 has its CatchHandler @ 0807a2d5 + bVar1 = Object::exists(Weapon); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,WEAPON); + if (!bVar1) goto LAB_0807a2cc; + Object::getObjectType(local_2c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_2c,WEAPONTYPE); + bVar1 = false; + if ((0 < (int)uVar2) && ((int)uVar2 < 4)) { + bVar1 = true; + } + if (!bVar1) goto LAB_0807a2cc; + bVar1 = Object::exists(Target); + if (!bVar1) { +LAB_0807a2be: + Text = &DAT_080f9560; + goto LAB_0807a2c5; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,DESTROY); + if (!bVar1) goto LAB_0807a2be; + pTVar3 = GetPlayer(CreatureID); + if (pTVar3 != (TPlayer *)0x0) { + Object::getContainer(local_2c); + pOVar6 = local_2c; + Object::getObjectType(&local_3c); + if (local_3c.ObjectID == 0) { + local_3c = (Object)Target->ObjectID; + GraphicalEffect(&local_3c,3); + lVar4 = random(); + if (lVar4 == 1) { + Object::getObjectType(local_2c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_2c,DESTROYTARGET); + ObjectType::setTypeID((ObjectType *)&local_3c,uVar2); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_2c,0); + if ((local_3c.ObjectID == local_2c[0].ObjectID) || + (bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER), !bVar1)) + { + uVar2 = 0; + } + else { + uVar2 = ObjectType::getAttribute((ObjectType *)&local_3c,CAPACITY); + } + local_4c[0] = (Object)Target->ObjectID; + Empty(local_4c,uVar2); + } + ObjectType::setTypeID((ObjectType *)local_4c,local_3c.ObjectID); + local_2c[0] = (Object)Target->ObjectID; + Change(local_2c,(ObjectType *)local_4c,0); + } + return; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4,pOVar6); + *puVar5 = 1; + goto LAB_0807a27f; + } + error("UseWeapon: Spieler %d existiert nicht.\n",CreatureID); + } + else { +LAB_0807a2cc: + Text = &DAT_080f95c0; +LAB_0807a2c5: + error(Text); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; +LAB_0807a27f: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void UseChangeObject(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + bool bVar2; + TPlayer *pl; + TPlayer *pTVar3; + ulong _TypeID; + undefined4 *puVar4; + Object *this; + Object *Exclude; + int local_88; + int x; + int y; + int z; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + ObjectType NewType; + + // try { // try from 0807a30b to 0807a849 has its CatchHandler @ 0807a850 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CHANGEUSE); + if (bVar1) { + pTVar3 = GetPlayer(CreatureID); + if (pTVar3 != (TPlayer *)0x0) { + Object::getObjectType(local_3c); + _TypeID = ObjectType::getAttribute((ObjectType *)local_3c,CHANGETARGET); + ObjectType::setTypeID((ObjectType *)&local_2c,_TypeID); + bVar1 = false; + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,UNPASS); + if (!bVar2) { + ObjectType::setTypeID((ObjectType *)local_3c,0); + ObjectType::setTypeID((ObjectType *)local_4c,local_3c[0].ObjectID); + if ((local_2c.ObjectID != local_4c[0].ObjectID) && + (bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,UNPASS), bVar2)) { + bVar1 = true; + } + } + if (bVar1) { + local_5c[0] = (Object)Obj->ObjectID; + local_4c[0].ObjectID = local_5c[0].ObjectID; + ClearField(local_5c,local_4c); + } + else { + bVar1 = false; + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,UNLAY); + if (!bVar2) { + ObjectType::setTypeID((ObjectType *)local_5c,0); + ObjectType::setTypeID((ObjectType *)local_4c,local_5c[0].ObjectID); + if ((local_2c.ObjectID != local_4c[0].ObjectID) && + (bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,UNLAY), bVar2)) { + bVar1 = true; + } + } + if (bVar1) { + local_4c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_4c,&local_88,&x,&y); + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + local_4c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_6c,local_88 + 1,x); + this = (Object *)&z; + Object::getNextObject(this); + Exclude = local_4c; + } + else { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + x = x + 1; + z = NONE.ObjectID; + } + else { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + z = NONE.ObjectID; + local_88 = local_88 + -1; + } + else { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (!bVar1) goto LAB_0807a3d4; + x = x + -1; + z = NONE.ObjectID; + } + } + Exclude = (Object *)&z; + NONE.ObjectID = z; + GetMapContainer((int)local_6c,local_88,x); + Object::getNextObject(local_4c); + this = local_4c; + } + MoveAllObjects(this,local_6c,Exclude,true); + } + } +LAB_0807a3d4: + ObjectType::setTypeID((ObjectType *)&z,local_2c.ObjectID); + local_6c[0] = (Object)Obj->ObjectID; + Change(local_6c,(ObjectType *)&z,0); + return; + } + error("UseChangeObject: Spieler %d existiert nicht.\n",CreatureID); + goto LAB_0807a814; + } + } + error("UseChangeObject: Objekt existiert nicht oder ist kein CHANGEUSE-Objekt.\n"); +LAB_0807a814: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void UseObject(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + TCreature *cr; + TCreature *pTVar2; + undefined4 *puVar3; + char *Text; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object User; + + // try { // try from 0807a888 to 0807a967 has its CatchHandler @ 0807a985 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,USEEVENT); + if (bVar1) { + if (CreatureID == 0) { + pTVar2 = (TCreature *)0x0; + } + else { + pTVar2 = GetCreature(CreatureID); + } + if (pTVar2 == (TCreature *)0x0) { + local_2c.ObjectID = NONE.ObjectID; + } + else { + local_2c.ObjectID = (pTVar2->CrObject).ObjectID; + } + local_3c[0] = (Object)NONE.ObjectID; + local_4c[0] = (Object)Obj->ObjectID; + local_5c[0].ObjectID = local_2c.ObjectID; + bVar1 = HandleEvent(EVENT_USE,local_5c,local_4c,local_3c); + if (bVar1) { + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1d; + goto LAB_0807a92d; + } + Text = &DAT_080f96c0; + } + else { + Text = &DAT_080f9700; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0807a92d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void UseObjects(ulong CreatureID,Object *Obj1,Object *Obj2) + +{ + bool bVar1; + TCreature *cr; + TCreature *pTVar2; + undefined4 *puVar3; + char *Text; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object User; + + // try { // try from 0807a9b8 to 0807aaa7 has its CatchHandler @ 0807aad0 + bVar1 = Object::exists(Obj1); + if (bVar1) { + bVar1 = Object::exists(Obj2); + if (bVar1) { + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,USEEVENT); + if (bVar1) { + if (CreatureID == 0) { + pTVar2 = (TCreature *)0x0; + } + else { + pTVar2 = GetCreature(CreatureID); + } + local_5c[0].ObjectID = NONE.ObjectID; + if (pTVar2 != (TCreature *)0x0) { + local_5c[0].ObjectID = (pTVar2->CrObject).ObjectID; + } + local_3c[0] = (Object)Obj2->ObjectID; + local_4c[0] = (Object)Obj1->ObjectID; + local_2c.ObjectID = local_5c[0].ObjectID; + bVar1 = HandleEvent(EVENT_MULTIUSE,local_5c,local_4c,local_3c); + if (bVar1) { + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1d; + goto LAB_0807aa6d; + } + Text = &DAT_080f9740; + } + else { + Text = &DAT_080f9780; + } + } + else { + Text = &DAT_080f97c0; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0807aa6d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void MovementEvent(Object *Obj,Object *Start,Object *Dest) + +{ + bool bVar1; + undefined4 *puVar2; + char *Text; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 0807ab0b to 0807aca1 has its CatchHandler @ 0807acc0 + bVar1 = Object::exists(Obj); + if (bVar1) { + bVar1 = Object::exists(Start); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) goto LAB_0807acaa; + } + bVar1 = Object::exists(Dest); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) goto LAB_0807ac5d; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,MOVEMENTEVENT); + if (!bVar1) { + return; + } + local_2c[0].ObjectID = NONE.ObjectID; + local_3c[0] = (Object)Obj->ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + HandleEvent(EVENT_MOVEMENT,local_4c,local_3c,local_2c); + bVar1 = Object::exists(Obj); + if (bVar1) { + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x1f; + goto LAB_0807ac18; + } +LAB_0807ac5d: + Text = "MovementEvent: \"Dest\" ist kein Container.\n"; + } + else { +LAB_0807acaa: + Text = "MovementEvent: \"Start\" ist kein Container.\n"; + } + } + else { + Text = &DAT_080f9880; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0807ac18: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void SeparationEvent(Object *Obj,Object *Start) + +{ + Object OVar1; + bool bVar2; + bool bVar3; + undefined4 *puVar4; + ulong uVar5; + char *Text; + Object local_6c; + Object Obj2; + Object local_5c; + Object Help; + Object local_4c; + ObjectType Target; + Object local_3c [4]; + Object local_2c; + Object Obj2_1; + + // try { // try from 0807acfb to 0807b14b has its CatchHandler @ 0807b160 + bVar2 = Object::exists(Obj); + if (bVar2) { + bVar2 = Object::exists(Start); + if (bVar2) { + Object::getObjectType(&local_2c); + if (local_2c.ObjectID != 0) { + return; + } + Object::getObjectType(&local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_2c,SEPARATIONEVENT); + if (bVar2) { + local_3c[0] = (Object)Start->ObjectID; + GetFirstContainerObject(&local_2c); + OVar1.ObjectID = local_5c.ObjectID; + do { + do { + local_5c.ObjectID = OVar1.ObjectID; + bVar2 = false; + local_3c[0].ObjectID = NONE.ObjectID; + local_4c.ObjectID = NONE.ObjectID; + if ((local_2c.ObjectID != NONE.ObjectID) && + (bVar3 = Object::exists(&local_2c), bVar3)) { + bVar2 = true; + } + if (!bVar2) goto LAB_0807ad65; + local_4c.ObjectID = local_2c.ObjectID; + Object::getNextObject(&local_5c); + local_2c.ObjectID = local_5c.ObjectID; + local_3c[0].ObjectID = local_5c.ObjectID; + uVar5 = Obj->ObjectID; + OVar1.ObjectID = local_4c.ObjectID; + } while (uVar5 == local_4c.ObjectID); + if (uVar5 == local_5c.ObjectID) { + Object::getNextObject(&local_6c); + local_2c.ObjectID = local_6c.ObjectID; + uVar5 = Obj->ObjectID; + } + local_6c.ObjectID = local_4c.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + local_5c.ObjectID = uVar5; + HandleEvent(EVENT_SEPARATION,local_3c,&local_5c,&local_6c); + bVar2 = Object::exists(Obj); + OVar1.ObjectID = local_5c.ObjectID; + } while (bVar2); + } + else { +LAB_0807ad65: + local_5c = (Object)Start->ObjectID; + GetFirstContainerObject(&local_6c); + do { + do { + bVar2 = false; + local_5c.ObjectID = NONE.ObjectID; + local_4c.ObjectID = NONE.ObjectID; + if ((local_6c.ObjectID != NONE.ObjectID) && + (bVar3 = Object::exists(&local_6c), bVar3)) { + bVar2 = true; + } + if (!bVar2) { + return; + } + local_5c.ObjectID = local_6c.ObjectID; + Object::getNextObject(local_3c); + local_6c.ObjectID = local_3c[0].ObjectID; + local_4c = (Object)Obj->ObjectID; + } while (local_5c.ObjectID == local_4c.ObjectID); + if (local_3c[0].ObjectID == local_4c.ObjectID) { + Object::getNextObject(&local_2c); + local_3c[0].ObjectID = local_2c.ObjectID; + } + local_6c.ObjectID = local_3c[0].ObjectID; + Object::getObjectType(&local_4c); + if (local_4c.ObjectID == 99) { + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,LEVELDOOR); + if (!bVar2) { + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,QUESTDOOR); + if (!bVar2) goto LAB_0807ae44; + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LEVELDOOR); + Object::getObjectType(local_3c); + uVar5 = ObjectType::getAttribute + ((ObjectType *)local_3c,!bVar2 + LEVELDOORTARGET); + ObjectType::setTypeID((ObjectType *)&local_4c,uVar5); + bVar2 = false; + ObjectType::setTypeID((ObjectType *)local_3c,0); + if ((local_4c.ObjectID == local_3c[0].ObjectID) || + (bVar3 = ObjectType::getFlag((ObjectType *)&local_4c,UNPASS), !bVar3)) { + bVar2 = true; + } + if (!bVar2) { + local_3c[0] = (Object)Obj->ObjectID; + local_2c.ObjectID = local_5c.ObjectID; + ClearField(&local_2c,local_3c); + ObjectType::setTypeID((ObjectType *)local_3c,local_4c.ObjectID); + local_2c.ObjectID = local_5c.ObjectID; + Change(&local_2c,(ObjectType *)local_3c,0); + return; + } + Object::getObjectType(&local_2c); + error(&DAT_080f98c0,local_2c.ObjectID); + goto LAB_0807afdc; + } +LAB_0807ae44: + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,SEPARATIONEVENT); + if (bVar2) { + local_4c = (Object)Obj->ObjectID; + local_3c[0].ObjectID = local_5c.ObjectID; + local_2c.ObjectID = NONE.ObjectID; + HandleEvent(EVENT_SEPARATION,&local_2c,local_3c,&local_4c); + } + bVar2 = Object::exists(Obj); + } while (bVar2); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1f; + goto LAB_0807ae92; + } + Text = &DAT_080f9920; + } + else { + Text = &DAT_080f9960; + } + error(Text); +LAB_0807afdc: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0807ae92: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void CollisionEvent(Object *Obj,Object *Dest) + +{ + Object OVar1; + bool bVar2; + bool bVar3; + undefined4 *puVar4; + ulong uVar5; + char *Text; + Object *pOVar6; + int local_9c; + int dx_1; + int dy_1; + int dz_1; + int x_1; + int y_1; + int z_1; + int dx; + int dy; + int dz; + int x; + int y; + int z; + Object Obj2; + Object local_5c; + Object Help; + Object local_4c; + Object Obj2_1; + Object local_3c; + Object Help_1; + Object local_2c [7]; + + // try { // try from 0807b19b to 0807b86b has its CatchHandler @ 0807b890 + bVar2 = Object::exists(Obj); + if (bVar2) { + bVar2 = Object::exists(Dest); + if (bVar2) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 0) { + return; + } + Object::getObjectType(local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,TELEPORTABSOLUTE); + if (bVar2) { +LAB_0807b228: + Object::getObjectType(local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,TELEPORTABSOLUTE); + if (bVar2) { + Object::getAttribute(Obj,ABSTELEPORTDESTINATION); + UnpackAbsoluteCoordinate(); + } + else { + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&dz,&x,&y); + Object::getObjectType(local_2c); + ObjectType::getAttribute((ObjectType *)local_2c,RELTELEPORTDISPLACEMENT); + UnpackRelativeCoordinate(); + dz = dz + z_1; + x = x + dx; + y = y + dy; + } + local_2c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)&local_3c,dz,x); + Object::getNextObject(&local_4c); + MoveAllObjects(&local_4c,&local_3c,local_2c,true); + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,TELEPORTABSOLUTE); + Object::getObjectType(&local_4c); + ObjectType::getAttribute + ((ObjectType *)&local_4c,(uint)!bVar2 * 2 + ABSTELEPORTEFFECT); + pOVar6 = (Object *)x; + GraphicalEffect(); + bVar2 = Object::exists(Obj); + if (bVar2) { + return; + } + } + else { + Object::getObjectType(local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,TELEPORTRELATIVE); + if (bVar2) goto LAB_0807b228; + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,COLLISIONEVENT); + if (bVar2) { + local_3c = (Object)Dest->ObjectID; + GetFirstContainerObject(&local_4c); + OVar1.ObjectID = local_5c.ObjectID; + do { + do { + local_5c.ObjectID = OVar1.ObjectID; + bVar2 = false; + local_3c.ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if ((local_4c.ObjectID != NONE.ObjectID) && + (bVar3 = Object::exists(&local_4c), bVar3)) { + bVar2 = true; + } + if (!bVar2) goto LAB_0807b41e; + local_3c.ObjectID = local_4c.ObjectID; + Object::getNextObject(&local_5c); + local_4c.ObjectID = local_5c.ObjectID; + local_2c[0].ObjectID = local_5c.ObjectID; + uVar5 = Obj->ObjectID; + OVar1.ObjectID = local_3c.ObjectID; + } while (uVar5 == local_3c.ObjectID); + if (uVar5 == local_5c.ObjectID) { + Object::getNextObject((Object *)&z); + local_4c.ObjectID = z; + uVar5 = Obj->ObjectID; + } + z = local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + pOVar6 = local_2c; + local_5c.ObjectID = uVar5; + HandleEvent(EVENT_COLLISION,local_2c,&local_5c,(Object *)&z); + bVar2 = Object::exists(Obj); + OVar1.ObjectID = local_5c.ObjectID; + } while (bVar2); + } + else { +LAB_0807b41e: + local_5c = (Object)Dest->ObjectID; + GetFirstContainerObject((Object *)&z); + do { + do { + bVar2 = false; + local_5c.ObjectID = NONE.ObjectID; + local_4c.ObjectID = NONE.ObjectID; + if ((z != NONE.ObjectID) && + (bVar3 = Object::exists((Object *)&z), bVar3)) { + bVar2 = true; + } + if (!bVar2) { + return; + } + local_5c.ObjectID = z; + Object::getNextObject(&local_3c); + z = local_3c.ObjectID; + local_4c = (Object)Obj->ObjectID; + } while (local_5c.ObjectID == local_4c.ObjectID); + if (local_3c.ObjectID == local_4c.ObjectID) { + Object::getNextObject(local_2c); + local_3c.ObjectID = local_2c[0].ObjectID; + } + z = local_3c.ObjectID; + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,TELEPORTABSOLUTE); + if (bVar2) { +LAB_0807b4e5: + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,TELEPORTABSOLUTE); + if (bVar2) { + Object::getAttribute(&local_5c,ABSTELEPORTDESTINATION); + UnpackAbsoluteCoordinate(); + } + else { + local_4c.ObjectID = local_5c.ObjectID; + GetObjectCoordinates(&local_4c,&dz_1,&x_1,&y_1); + Object::getObjectType(&local_4c); + ObjectType::getAttribute + ((ObjectType *)&local_4c,RELTELEPORTDISPLACEMENT); + UnpackRelativeCoordinate(); + dz_1 = dz_1 + local_9c; + x_1 = x_1 + dx_1; + y_1 = y_1 + dy_1; + } + local_4c = (Object)Obj->ObjectID; + GetMapContainer((int)&local_3c,dz_1,x_1); + MoveOneObject(&local_4c,&local_3c); + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,TELEPORTABSOLUTE); + Object::getObjectType(&local_4c); + ObjectType::getAttribute + ((ObjectType *)&local_4c,(uint)!bVar2 * 2 + ABSTELEPORTEFFECT) + ; + pOVar6 = (Object *)x_1; + GraphicalEffect(); + } + else { + Object::getObjectType(&local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,TELEPORTRELATIVE); + if (bVar2) goto LAB_0807b4e5; + Object::getObjectType(&local_4c); + pOVar6 = (Object *)0xd; + bVar2 = ObjectType::getFlag((ObjectType *)&local_4c,COLLISIONEVENT); + if (bVar2) { + local_4c = (Object)Obj->ObjectID; + local_3c.ObjectID = local_5c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + pOVar6 = local_2c; + HandleEvent(EVENT_COLLISION,local_2c,&local_3c,&local_4c); + } + } + bVar2 = Object::exists(Obj); + } while (bVar2); + } + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4,pOVar6); + *puVar4 = 0x1f; + goto LAB_0807b364; + } + Text = &DAT_080f99a0; + } + else { + Text = &DAT_080f99e0; + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0807b364: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: z + +void LoadParameters(TReadScriptFile *Script,int *Parameters,int NumberOfParameters,...) + +{ + bool bVar1; + char cVar2; + int iVar3; + ulong uVar4; + char *pcVar5; + char *pcVar6; + char *pcVar7; + undefined1 uVar8; + char *Ident; + int local_24; + int i; + va_list va; + int x; + int y; + int z; + + if (5 < NumberOfParameters) { + error("LoadParameters: Zu viele Parameter (%d).\n",NumberOfParameters); + TReadScriptFile::error(Script,"too many parameters"); + } + if (NumberOfParameters != 0) { + if ((Script->Token != SPECIAL) || + (cVar2 = TReadScriptFile::getSpecial(Script), cVar2 != '(')) { + // try { // try from 0807b8eb to 0807bcc7 has its CatchHandler @ 0807bcd0 + TReadScriptFile::error(Script,"\'(\' expected"); + } + local_24 = 0; + i = (int)&stack0x00000010; + if (0 < NumberOfParameters) { + do { + if (0 < local_24) { + TReadScriptFile::readSymbol(Script,','); + } + uVar8 = *(int *)i == 0xb; + switch(*(int *)i) { + case 0: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = 5; + pcVar6 = pcVar5; + pcVar7 = "null"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar6 == *pcVar7; + pcVar6 = pcVar6 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { +LAB_0807ba55: + Parameters[local_24] = 0; + } + else { + iVar3 = 5; + pcVar6 = pcVar5; + pcVar7 = "obj1"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar6 == *pcVar7; + pcVar6 = pcVar6 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + Parameters[local_24] = 1; + } + else { + iVar3 = 5; + pcVar6 = pcVar5; + pcVar7 = "obj2"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar6 == *pcVar7; + pcVar6 = pcVar6 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + Parameters[local_24] = 2; + } + else { + iVar3 = 5; + pcVar6 = pcVar5; + pcVar7 = "user"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar6 == *pcVar7; + pcVar6 = pcVar6 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + Parameters[local_24] = 3; + } + else { + iVar3 = 5; + pcVar6 = "temp"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar5 == *pcVar6; + pcVar5 = pcVar5 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar8); + if (!(bool)uVar8) { + pcVar5 = "Object expected"; + goto LAB_0807ba48; + } + Parameters[local_24] = 4; + } + } + } + } + break; + case 1: + iVar3 = TReadScriptFile::readNumber(Script); + Parameters[local_24] = iVar3; + bVar1 = ObjectTypeExists(iVar3); + if (!bVar1) { + pcVar5 = "Unknown object type"; +LAB_0807ba48: + TReadScriptFile::error(Script,pcVar5); + } + break; + case 2: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = GetFlagByName(pcVar5); + Parameters[local_24] = iVar3; + if (iVar3 == -1) { + pcVar5 = "Unknown flag"; + goto LAB_0807ba48; + } + break; + case 3: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = GetTypeAttributeByName(pcVar5); + Parameters[local_24] = iVar3; + if (iVar3 == -1) { + pcVar5 = "Unknown type attribute"; + goto LAB_0807ba48; + } + break; + case 4: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = GetInstanceAttributeByName(pcVar5); + Parameters[local_24] = iVar3; + if (iVar3 == -1) { + pcVar5 = "Unknown instance attribute"; + goto LAB_0807ba48; + } + break; + case 5: + TReadScriptFile::readCoordinate(Script); + uVar4 = PackAbsoluteCoordinate((int)va,x,y); + goto LAB_0807bb56; + case 6: + TReadScriptFile::readCoordinate(Script); + uVar4 = PackRelativeCoordinate((int)va,x,y); + goto LAB_0807bb9a; + case 7: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = 0x10; + pcVar6 = pcVar5; + pcVar7 = "premium_account"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar6 == *pcVar7; + pcVar6 = pcVar6 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) goto LAB_0807ba55; + iVar3 = 0x10; + pcVar6 = "special_moveuse"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar8 = *pcVar5 == *pcVar6; + pcVar5 = pcVar5 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar8); + if (!(bool)uVar8) { + pcVar5 = "Unknown right"; + goto LAB_0807ba48; + } + Parameters[local_24] = 0x37; + break; + case 8: + pcVar5 = TReadScriptFile::readIdentifier(Script); + iVar3 = GetSkillByName(pcVar5); + Parameters[local_24] = iVar3; + if (iVar3 == -1) { + pcVar5 = "Unknown skill"; + goto LAB_0807ba48; + } + break; + case 9: + uVar4 = TReadScriptFile::readNumber(Script); +LAB_0807bb9a: + Parameters[local_24] = uVar4; + break; + case 10: + pcVar5 = TReadScriptFile::readString(Script); + uVar4 = AddDynamicString(pcVar5); +LAB_0807bb56: + Parameters[local_24] = uVar4; + break; + case 0xb: + cVar2 = TReadScriptFile::readSpecial(Script); + Parameters[local_24] = (int)cVar2; + pcVar5 = strchr("N",(int)cVar2); + if (pcVar5 == (char *)0x0) { + pcVar5 = "Unknown comparison operator"; + goto LAB_0807ba48; + } + } + local_24 = local_24 + 1; + i = i + 4; + } while (local_24 < NumberOfParameters); + } + TReadScriptFile::readSymbol(Script,')'); + TReadScriptFile::nextToken(Script); + } + return; +} + + + +void LoadCondition(TReadScriptFile *Script,TMoveUseCondition *Condition) + +{ + char *pcVar1; + int iVar2; + char *pcVar3; + undefined1 uVar4; + char local_3c [4]; + char Ident [30]; + + uVar4 = &stack0x00000000 == (undefined1 *)0x5c; + // try { // try from 0807bd05 to 0807c4e2 has its CatchHandler @ 0807c4e8 + pcVar1 = TReadScriptFile::getIdentifier(Script); + strcpy(local_3c,pcVar1); + TReadScriptFile::nextToken(Script); + iVar2 = 0xb; + pcVar1 = local_3c; + pcVar3 = "isposition"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISPOSITION; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "istype"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISTYPE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 0xb; + pcVar1 = local_3c; + pcVar3 = "iscreature"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISCREATURE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "isplayer"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISPLAYER; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "hasflag"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASFLAG; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 0x11; + pcVar1 = local_3c; + pcVar3 = "hastypeattribute"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASTYPEATTRIBUTE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,4); + } + iVar2 = 0x15; + pcVar1 = local_3c; + pcVar3 = "hasinstanceattribute"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASINSTANCEATTRIBUTE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,4); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "hastext"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASTEXT; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 0xb; + pcVar1 = local_3c; + pcVar3 = "ispeaceful"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISPEACEFUL; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "maylogout"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_MAYLOGOUT; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 0xe; + pcVar1 = local_3c; + pcVar3 = "hasprofession"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASPROFESSION; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "haslevel"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASLEVEL; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,3); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "hasright"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASRIGHT; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 0xe; + pcVar1 = local_3c; + pcVar3 = "hasquestvalue"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_HASQUESTVALUE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,4); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "testskill"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_TESTSKILL; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,4); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "countobjects"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_COUNTOBJECTS; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,3); + } + iVar2 = 0x12; + pcVar1 = local_3c; + pcVar3 = "countobjectsonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_COUNTOBJECTSONMAP; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,3); + } + iVar2 = 0xe; + pcVar1 = local_3c; + pcVar3 = "isobjectthere"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISOBJECTTHERE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 0x10; + pcVar1 = local_3c; + pcVar3 = "iscreaturethere"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISCREATURETHERE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 0xe; + pcVar1 = local_3c; + pcVar3 = "isplayerthere"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISPLAYERTHERE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 0x14; + pcVar1 = local_3c; + pcVar3 = "isobjectininventory"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISOBJECTININVENTORY; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,3); + } + iVar2 = 0x11; + pcVar1 = local_3c; + pcVar3 = "isprotectionzone"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISPROTECTIONZONE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "ishouse"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISHOUSE; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "ishouseowner"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISHOUSEOWNER; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,2); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "isdressed"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_ISDRESSED; + uVar4 = Condition->Parameters == (int *)0x0; + LoadParameters(Script,Condition->Parameters,1); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "random"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Condition->Condition = CONDITION_RANDOM; + LoadParameters(Script,Condition->Parameters,1); + } + return; +} + + + +void LoadAction(TReadScriptFile *Script,TMoveUseAction *Action) + +{ + char *pcVar1; + int iVar2; + char *pcVar3; + undefined1 uVar4; + char local_3c [4]; + char Ident [30]; + + uVar4 = &stack0x00000000 == (undefined1 *)0x5c; + // try { // try from 0807c515 to 0807d0d8 has its CatchHandler @ 0807d0e0 + pcVar1 = TReadScriptFile::getIdentifier(Script); + strcpy(local_3c,pcVar1); + TReadScriptFile::nextToken(Script); + iVar2 = 0xc; + pcVar1 = local_3c; + pcVar3 = "createonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CREATEONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "create"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CREATE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "monsteronmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MONSTERONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "monster"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MONSTER; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 0xc; + pcVar1 = local_3c; + pcVar3 = "effectonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_EFFECTONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "effect"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_EFFECT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "textonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_TEXTONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 5; + pcVar1 = local_3c; + pcVar3 = "text"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_TEXT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0xc; + pcVar1 = local_3c; + pcVar3 = "changeonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CHANGEONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,4); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "change"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CHANGE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "changerel"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CHANGEREL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,5); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "setattribute"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_SETATTRIBUTE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0x10; + pcVar1 = local_3c; + pcVar3 = "changeattribute"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_CHANGEATTRIBUTE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0xe; + pcVar1 = local_3c; + pcVar3 = "setquestvalue"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_SETQUESTVALUE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "damage"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DAMAGE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,4); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "setstart"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_SETSTART; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "writename"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_WRITENAME; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "writetext"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_WRITETEXT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "logout"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_LOGOUT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,1); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "moveallonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVEALLONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "moveall"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVEALL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 0xb; + pcVar1 = local_3c; + pcVar3 = "moveallrel"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVEALLREL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 0xd; + pcVar1 = local_3c; + pcVar3 = "movetoponmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVETOPONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "movetop"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVETOP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 0xb; + pcVar1 = local_3c; + pcVar3 = "movetoprel"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVETOPREL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 5; + pcVar1 = local_3c; + pcVar3 = "move"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 8; + pcVar1 = local_3c; + pcVar3 = "moverel"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_MOVEREL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "retrieve"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_RETRIEVE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0xf; + pcVar1 = local_3c; + pcVar3 = "deleteallonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DELETEALLONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,1); + } + iVar2 = 0xf; + pcVar1 = local_3c; + pcVar3 = "deletetoponmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DELETETOPONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 0xc; + pcVar1 = local_3c; + pcVar3 = "deleteonmap"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DELETEONMAP; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 7; + pcVar1 = local_3c; + pcVar3 = "delete"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DELETE; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,1); + } + iVar2 = 0x12; + pcVar1 = local_3c; + pcVar3 = "deleteininventory"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DELETEININVENTORY; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,3); + } + iVar2 = 0xc; + pcVar1 = local_3c; + pcVar3 = "description"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_DESCRIPTION; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,2); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "loaddepot"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_LOADDEPOT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,4); + } + iVar2 = 10; + pcVar1 = local_3c; + pcVar3 = "savedepot"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_SAVEDEPOT; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,4); + } + iVar2 = 9; + pcVar1 = local_3c; + pcVar3 = "sendmail"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_SENDMAIL; + uVar4 = Action->Parameters == (int *)0x0; + LoadParameters(Script,Action->Parameters,1); + } + iVar2 = 4; + pcVar1 = local_3c; + pcVar3 = "nop"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar4 = *pcVar1 == *pcVar3; + pcVar1 = pcVar1 + 1; + pcVar3 = pcVar3 + 1; + } while ((bool)uVar4); + if ((bool)uVar4) { + Action->Action = ACTION_NOP; + LoadParameters(Script,Action->Parameters,0); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadDataBase(void) + +{ + TReadScriptFile *Script_00; + char cVar1; + int i; + int iVar2; + TMoveUseAction *Action; + TMoveUseRule *pTVar3; + TMoveUseCondition *Condition_00; + int *piVar4; + int EventType; + int iVar5; + TMoveUseCondition *Condition; + char *pcVar6; + undefined1 uVar7; + char *pcVar8; + char local_501c [4]; + char Ident [30]; + TReadScriptFile Script; + undefined1 local_101c [4]; + char FileName [4096]; + + // try { // try from 0807d121 to 0807d151 has its CatchHandler @ 0807d510 + print(); + pcVar8 = DATAPATH; + Action = (TMoveUseAction *)local_101c; + sprintf((char *)Action,"%s/moveuse.dat"); + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 0807d15f to 0807d4d5 has its CatchHandler @ 0807d4f1 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),(char *)Action,(int)pcVar8); + piVar4 = &MoveUseDatabases[0].NumberOfRules; + iVar2 = 4; + do { + *piVar4 = 0; + piVar4 = piVar4 + 0xc; + iVar2 = iVar2 + -1; + } while (-1 < iVar2); +LAB_0807d183: + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + do { + uVar7 = stack0xffffb004 == 0; + if ((bool)uVar7) { + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)Action); + pcVar8 = "Move/Use-Datenbank mit %d/%d/%d/%d/%d Regeln gelesen.\n"; + print(); + // try { // try from 0807d4df to 0807d4e3 has its CatchHandler @ 0807d510 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)pcVar8); + return; + } + Action = (TMoveUseAction *)TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)) + ; + strcpy(local_501c,(char *)Action); + iVar2 = 6; + pcVar8 = local_501c; + pcVar6 = "begin"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + goto LAB_0807d183; + } + iVar2 = 4; + pcVar8 = local_501c; + pcVar6 = "end"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) goto LAB_0807d183; + iVar2 = 4; + pcVar8 = local_501c; + pcVar6 = "use"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + iVar5 = -1; + iVar2 = 9; + if ((bool)uVar7) { + iVar5 = 0; + } + pcVar8 = local_501c; + pcVar6 = "multiuse"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + iVar2 = 9; + if ((bool)uVar7) { + iVar5 = 1; + } + pcVar8 = local_501c; + pcVar6 = "movement"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + iVar2 = 10; + if ((bool)uVar7) { + iVar5 = 2; + } + pcVar8 = local_501c; + pcVar6 = "collision"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + iVar2 = 0xb; + if ((bool)uVar7) { + iVar5 = 3; + } + pcVar8 = local_501c; + pcVar6 = "separation"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + iVar5 = 4; + } + if (iVar5 == -1) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Unknown event type"); + } + iVar2 = MoveUseDatabases[iVar5].NumberOfRules + 1; + MoveUseDatabases[iVar5].NumberOfRules = iVar2; + pTVar3 = vector<>::operator()(&MoveUseDatabases[iVar5].Rules,iVar2); + pTVar3->FirstCondition = NumberOfMoveUseConditions + 1; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + do { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + NumberOfMoveUseConditions = NumberOfMoveUseConditions + 1; + Condition_00 = vector<>::operator()(&MoveUseConditions,NumberOfMoveUseConditions); + Condition_00->Modifier = MODIFIER_NORMAL; + if (stack0xffffb004 == 6) { + cVar1 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)); + if (cVar1 == '!') { + Condition_00->Modifier = MODIFIER_INVERT; + } + else { + if ((stack0xffffb004 != 6) || + (cVar1 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)), + cVar1 != '~')) goto LAB_0807d301; + Condition_00->Modifier = MODIFIER_TRUE; + } + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + } +LAB_0807d301: + LoadCondition((TReadScriptFile *)(Ident + 0x1c),Condition_00); + if (stack0xffffb004 != 6) goto LAB_0807d33a; + cVar1 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)); + } while (cVar1 == ','); + if ((stack0xffffb004 != 6) || + (cVar1 = TReadScriptFile::getSpecial((TReadScriptFile *)(Ident + 0x1c)), cVar1 != 'I')) { +LAB_0807d33a: + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"\'->\' expected"); + } + pTVar3->LastCondition = NumberOfMoveUseConditions; + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + pTVar3->FirstAction = NumberOfMoveUseActions + 1; + while( true ) { + NumberOfMoveUseActions = NumberOfMoveUseActions + 1; + Action = vector<>::operator()(&MoveUseActions,NumberOfMoveUseActions); + Script_00 = (TReadScriptFile *)(Ident + 0x1c); + LoadAction(Script_00,Action); + if ((stack0xffffb004 != 6) || + (cVar1 = TReadScriptFile::getSpecial(Script_00), cVar1 != ',')) break; + TReadScriptFile::nextToken(Script_00); + } + if (stack0xffffb004 == 3) { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + } + pTVar3->LastAction = NumberOfMoveUseActions; + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitMoveUse(void) + +{ + NumberOfMoveUseConditions = 0; + NumberOfMoveUseActions = 0; + // try { // try from 0807d534 to 0807d538 has its CatchHandler @ 0807d545 + LoadDataBase(); + DelayedMails = 0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitMoveUse(void) + +{ + TDelayedMail *pTVar1; + int i; + int i_00; + int iVar2; + + if ((0 < DelayedMails) && (i_00 = 0, 0 < DelayedMails)) { + do { + iVar2 = i_00 + 1; + pTVar1 = vector<>::operator()(&DelayedMail,i_00); + error("ExitMoveUse: Paket an %ld wurde nicht zugestellt.\n",pTVar1->CharacterID); + i_00 = iVar2; + } while (iVar2 < DelayedMails); + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (MoveUseConditions.entry == (TMoveUseCondition *)0x0) { + return; + } + operator_delete__(MoveUseConditions.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + if (MoveUseActions.entry == (TMoveUseAction *)0x0) { + return; + } + operator_delete__(MoveUseActions.entry); + return; +} + + + +void __tcf_2(void *param_1) + +{ + TMoveUseRule *pTVar1; + TMoveUseDatabase *pTVar2; + TMoveUseDatabase *pTVar3; + + pTVar2 = (TMoveUseDatabase *)&DAT_081c0710; + while (pTVar2 != MoveUseDatabases) { + pTVar3 = pTVar2 + -1; + pTVar1 = pTVar2[-1].Rules.entry; + pTVar2 = pTVar3; + if (pTVar1 != (TMoveUseRule *)0x0) { + operator_delete__(pTVar1); + } + } + return; +} + + + +void __tcf_3(void *param_1) + +{ + if (DelayedMail.entry == (TDelayedMail *)0x0) { + return; + } + operator_delete__(DelayedMail.entry); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_MoveUseConditions(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector<>::vector(vector<> *this,int min,int max,int block) + +{ + TMoveUseRule *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (TMoveUseRule *)operator_new__(this->space << 4); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: TDelayedMail * operator()(vector * this, int i) + +TDelayedMail * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ulong uVar1; + uchar *puVar2; + TDelayedMail *pTVar3; + TDelayedMail *pTVar4; + int iVar5; + int iVar6; + int iVar7; + int iVar8; + int iVar9; + TDelayedMail *help_1; + TDelayedMail *help; + int j; + int iVar10; + int local_30; + int extend; + uchar Help [16]; + + iVar8 = this->start; + while (i < iVar8) { + local_30 = this->block; + if (local_30 == 0) { + iVar8 = this->space; + local_30 = iVar8; + } + else { + iVar8 = this->space; + } + pTVar4 = (TDelayedMail *)operator_new__((local_30 + iVar8) * 0x10); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar5 = (iVar8 - this->start) + local_30; + uVar1 = pTVar4[iVar5].CharacterID; + iVar7 = pTVar4[iVar5].DepotNumber; + puVar2 = pTVar4[iVar5].Packet; + iVar9 = pTVar4[iVar5].PacketSize; + iVar6 = iVar8 - this->start; + iVar5 = local_30 + iVar6; + pTVar3 = this->entry; + pTVar4[iVar5].CharacterID = pTVar3[iVar6].CharacterID; + pTVar4[iVar5].DepotNumber = pTVar3[iVar6].DepotNumber; + pTVar4[iVar5].Packet = pTVar3[iVar6].Packet; + iVar10 = iVar8 + 1; + pTVar4[iVar5].PacketSize = pTVar3[iVar6].PacketSize; + pTVar3 = this->entry; + iVar8 = iVar8 - this->start; + pTVar3[iVar8].CharacterID = uVar1; + pTVar3[iVar8].DepotNumber = iVar7; + pTVar3[iVar8].Packet = puVar2; + pTVar3[iVar8].PacketSize = iVar9; + iVar8 = iVar10; + } while (iVar10 <= this->max); + } + if (this->entry != (TDelayedMail *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start - local_30; + this->start = iVar8; + this->space = this->space + local_30; + } + iVar7 = this->space; + iVar5 = iVar7 + iVar8; + while (iVar5 <= i) { + iVar5 = this->block; + if (this->block == 0) { + iVar5 = iVar7; + } + pTVar4 = (TDelayedMail *)operator_new__((iVar5 + iVar7) * 0x10); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + uVar1 = pTVar4[iVar9].CharacterID; + iVar7 = pTVar4[iVar9].DepotNumber; + puVar2 = pTVar4[iVar9].Packet; + iVar9 = pTVar4[iVar9].PacketSize; + iVar6 = iVar8 - this->start; + pTVar3 = this->entry; + pTVar4[iVar6].CharacterID = pTVar3[iVar6].CharacterID; + pTVar4[iVar6].DepotNumber = pTVar3[iVar6].DepotNumber; + pTVar4[iVar6].Packet = pTVar3[iVar6].Packet; + pTVar4[iVar6].PacketSize = pTVar3[iVar6].PacketSize; + iVar6 = iVar8 + 1; + pTVar3 = this->entry; + iVar8 = iVar8 - this->start; + pTVar3[iVar8].CharacterID = uVar1; + pTVar3[iVar8].DepotNumber = iVar7; + pTVar3[iVar8].Packet = puVar2; + pTVar3[iVar8].PacketSize = iVar9; + iVar8 = iVar6; + } while (iVar6 <= this->max); + } + if (this->entry != (TDelayedMail *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start; + iVar7 = this->space + iVar5; + this->space = iVar7; + iVar5 = iVar7 + iVar8; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + iVar8 = (iVar5 + -1) - iVar8; + pTVar4 = this->entry; + pTVar4[iVar8].CharacterID = (this->init).CharacterID; + pTVar4[iVar8].DepotNumber = (this->init).DepotNumber; + pTVar4[iVar8].Packet = (this->init).Packet; + pTVar4[iVar8].PacketSize = (this->init).PacketSize; + iVar8 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + iVar8 = (iVar5 + 1) - iVar8; + pTVar4 = this->entry; + pTVar4[iVar8].CharacterID = (this->init).CharacterID; + pTVar4[iVar8].DepotNumber = (this->init).DepotNumber; + pTVar4[iVar8].Packet = (this->init).Packet; + pTVar4[iVar8].PacketSize = (this->init).PacketSize; + iVar8 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar8); +} + + + +// DWARF original prototype: TMoveUseRule * operator()(vector * this, int i) + +TMoveUseRule * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + int iVar1; + int iVar2; + TMoveUseRule *pTVar3; + TMoveUseRule *pTVar4; + int iVar5; + int iVar6; + int iVar7; + int iVar8; + int iVar9; + TMoveUseRule *help_1; + TMoveUseRule *help; + int j; + int iVar10; + int local_30; + int extend; + uchar Help [16]; + + iVar8 = this->start; + while (i < iVar8) { + local_30 = this->block; + if (local_30 == 0) { + iVar8 = this->space; + local_30 = iVar8; + } + else { + iVar8 = this->space; + } + pTVar4 = (TMoveUseRule *)operator_new__((local_30 + iVar8) * 0x10); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar5 = (iVar8 - this->start) + local_30; + iVar7 = pTVar4[iVar5].FirstCondition; + iVar1 = pTVar4[iVar5].LastCondition; + iVar2 = pTVar4[iVar5].FirstAction; + iVar9 = pTVar4[iVar5].LastAction; + iVar6 = iVar8 - this->start; + iVar5 = local_30 + iVar6; + pTVar3 = this->entry; + pTVar4[iVar5].FirstCondition = pTVar3[iVar6].FirstCondition; + pTVar4[iVar5].LastCondition = pTVar3[iVar6].LastCondition; + pTVar4[iVar5].FirstAction = pTVar3[iVar6].FirstAction; + iVar10 = iVar8 + 1; + pTVar4[iVar5].LastAction = pTVar3[iVar6].LastAction; + pTVar3 = this->entry; + iVar8 = iVar8 - this->start; + pTVar3[iVar8].FirstCondition = iVar7; + pTVar3[iVar8].LastCondition = iVar1; + pTVar3[iVar8].FirstAction = iVar2; + pTVar3[iVar8].LastAction = iVar9; + iVar8 = iVar10; + } while (iVar10 <= this->max); + } + if (this->entry != (TMoveUseRule *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start - local_30; + this->start = iVar8; + this->space = this->space + local_30; + } + iVar7 = this->space; + iVar5 = iVar7 + iVar8; + while (iVar5 <= i) { + iVar5 = this->block; + if (this->block == 0) { + iVar5 = iVar7; + } + pTVar4 = (TMoveUseRule *)operator_new__((iVar5 + iVar7) * 0x10); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + iVar7 = pTVar4[iVar9].FirstCondition; + iVar1 = pTVar4[iVar9].LastCondition; + iVar2 = pTVar4[iVar9].FirstAction; + iVar9 = pTVar4[iVar9].LastAction; + iVar6 = iVar8 - this->start; + pTVar3 = this->entry; + pTVar4[iVar6].FirstCondition = pTVar3[iVar6].FirstCondition; + pTVar4[iVar6].LastCondition = pTVar3[iVar6].LastCondition; + pTVar4[iVar6].FirstAction = pTVar3[iVar6].FirstAction; + pTVar4[iVar6].LastAction = pTVar3[iVar6].LastAction; + iVar6 = iVar8 + 1; + pTVar3 = this->entry; + iVar8 = iVar8 - this->start; + pTVar3[iVar8].FirstCondition = iVar7; + pTVar3[iVar8].LastCondition = iVar1; + pTVar3[iVar8].FirstAction = iVar2; + pTVar3[iVar8].LastAction = iVar9; + iVar8 = iVar6; + } while (iVar6 <= this->max); + } + if (this->entry != (TMoveUseRule *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start; + iVar7 = this->space + iVar5; + this->space = iVar7; + iVar5 = iVar7 + iVar8; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + iVar8 = (iVar5 + -1) - iVar8; + pTVar4 = this->entry; + pTVar4[iVar8].FirstCondition = (this->init).FirstCondition; + pTVar4[iVar8].LastCondition = (this->init).LastCondition; + pTVar4[iVar8].FirstAction = (this->init).FirstAction; + pTVar4[iVar8].LastAction = (this->init).LastAction; + iVar8 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + iVar8 = (iVar5 + 1) - iVar8; + pTVar4 = this->entry; + pTVar4[iVar8].FirstCondition = (this->init).FirstCondition; + pTVar4[iVar8].LastCondition = (this->init).LastCondition; + pTVar4[iVar8].FirstAction = (this->init).FirstAction; + pTVar4[iVar8].LastAction = (this->init).LastAction; + iVar8 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar8); +} + + + +// DWARF original prototype: TMoveUseCondition * operator()(vector * this, int i) + +TMoveUseCondition * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ModifierType MVar1; + ConditionType CVar2; + int iVar3; + int iVar4; + int iVar5; + TMoveUseCondition *pTVar6; + TMoveUseCondition *pTVar7; + int iVar8; + int iVar9; + int iVar10; + int iVar11; + TMoveUseCondition *help_1; + int iVar12; + TMoveUseCondition *help; + int j; + int iVar13; + int local_40; + int extend; + uchar Help [28]; + + iVar9 = this->start; + while (i < iVar9) { + local_40 = this->block; + if (local_40 == 0) { + iVar9 = this->space; + local_40 = iVar9; + } + else { + iVar9 = this->space; + } + pTVar7 = (TMoveUseCondition *)operator_new__((iVar9 + local_40) * 0x1c); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar12 = (iVar9 - this->start) + local_40; + MVar1 = pTVar7[iVar12].Modifier; + CVar2 = pTVar7[iVar12].Condition; + iVar11 = pTVar7[iVar12].Parameters[0]; + iVar3 = pTVar7[iVar12].Parameters[1]; + iVar4 = pTVar7[iVar12].Parameters[2]; + iVar5 = pTVar7[iVar12].Parameters[3]; + iVar10 = pTVar7[iVar12].Parameters[4]; + iVar8 = iVar9 - this->start; + iVar12 = local_40 + iVar8; + pTVar6 = this->entry; + pTVar7[iVar12].Modifier = pTVar6[iVar8].Modifier; + pTVar7[iVar12].Condition = pTVar6[iVar8].Condition; + pTVar7[iVar12].Parameters[0] = pTVar6[iVar8].Parameters[0]; + pTVar7[iVar12].Parameters[1] = pTVar6[iVar8].Parameters[1]; + pTVar7[iVar12].Parameters[2] = pTVar6[iVar8].Parameters[2]; + pTVar7[iVar12].Parameters[3] = pTVar6[iVar8].Parameters[3]; + iVar13 = iVar9 + 1; + pTVar7[iVar12].Parameters[4] = pTVar6[iVar8].Parameters[4]; + iVar9 = iVar9 - this->start; + pTVar6 = this->entry; + pTVar6[iVar9].Modifier = MVar1; + pTVar6[iVar9].Condition = CVar2; + pTVar6[iVar9].Parameters[0] = iVar11; + pTVar6[iVar9].Parameters[1] = iVar3; + pTVar6[iVar9].Parameters[2] = iVar4; + pTVar6[iVar9].Parameters[3] = iVar5; + pTVar6[iVar9].Parameters[4] = iVar10; + iVar9 = iVar13; + } while (iVar13 <= this->max); + } + if (this->entry != (TMoveUseCondition *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start - local_40; + this->start = iVar9; + this->space = this->space + local_40; + } + iVar11 = this->space; + iVar12 = iVar11 + iVar9; + while (iVar12 <= i) { + iVar12 = this->block; + if (this->block == 0) { + iVar12 = iVar11; + } + pTVar7 = (TMoveUseCondition *)operator_new__((iVar11 + iVar12) * 0x1c); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar10 = iVar9 - this->start; + MVar1 = pTVar7[iVar10].Modifier; + CVar2 = pTVar7[iVar10].Condition; + iVar11 = pTVar7[iVar10].Parameters[0]; + iVar3 = pTVar7[iVar10].Parameters[1]; + iVar4 = pTVar7[iVar10].Parameters[2]; + iVar5 = pTVar7[iVar10].Parameters[3]; + iVar10 = pTVar7[iVar10].Parameters[4]; + pTVar6 = this->entry; + iVar8 = iVar9 - this->start; + pTVar7[iVar8].Modifier = pTVar6[iVar8].Modifier; + pTVar7[iVar8].Condition = pTVar6[iVar8].Condition; + pTVar7[iVar8].Parameters[0] = pTVar6[iVar8].Parameters[0]; + pTVar7[iVar8].Parameters[1] = pTVar6[iVar8].Parameters[1]; + pTVar7[iVar8].Parameters[2] = pTVar6[iVar8].Parameters[2]; + pTVar7[iVar8].Parameters[3] = pTVar6[iVar8].Parameters[3]; + pTVar7[iVar8].Parameters[4] = pTVar6[iVar8].Parameters[4]; + iVar8 = iVar9 + 1; + pTVar6 = this->entry; + iVar9 = iVar9 - this->start; + pTVar6[iVar9].Modifier = MVar1; + pTVar6[iVar9].Condition = CVar2; + pTVar6[iVar9].Parameters[0] = iVar11; + pTVar6[iVar9].Parameters[1] = iVar3; + pTVar6[iVar9].Parameters[2] = iVar4; + pTVar6[iVar9].Parameters[3] = iVar5; + pTVar6[iVar9].Parameters[4] = iVar10; + iVar9 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (TMoveUseCondition *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start; + iVar11 = this->space + iVar12; + this->space = iVar11; + iVar12 = iVar11 + iVar9; + } + iVar12 = this->min; + while (i < iVar12) { + this->min = iVar12 + -1; + if (this->initialized != false) { + iVar9 = (iVar12 + -1) - iVar9; + pTVar7 = this->entry; + pTVar7[iVar9].Modifier = (this->init).Modifier; + pTVar7[iVar9].Condition = (this->init).Condition; + pTVar7[iVar9].Parameters[0] = (this->init).Parameters[0]; + pTVar7[iVar9].Parameters[1] = (this->init).Parameters[1]; + pTVar7[iVar9].Parameters[2] = (this->init).Parameters[2]; + pTVar7[iVar9].Parameters[3] = (this->init).Parameters[3]; + pTVar7[iVar9].Parameters[4] = (this->init).Parameters[4]; + iVar9 = this->start; + } + iVar12 = this->min; + } + iVar12 = this->max; + while (iVar12 < i) { + this->max = iVar12 + 1; + if (this->initialized != false) { + iVar9 = (iVar12 + 1) - iVar9; + pTVar7 = this->entry; + pTVar7[iVar9].Modifier = (this->init).Modifier; + pTVar7[iVar9].Condition = (this->init).Condition; + pTVar7[iVar9].Parameters[0] = (this->init).Parameters[0]; + pTVar7[iVar9].Parameters[1] = (this->init).Parameters[1]; + pTVar7[iVar9].Parameters[2] = (this->init).Parameters[2]; + pTVar7[iVar9].Parameters[3] = (this->init).Parameters[3]; + pTVar7[iVar9].Parameters[4] = (this->init).Parameters[4]; + iVar9 = this->start; + } + iVar12 = this->max; + } + return this->entry + (i - iVar9); +} + + + +// DWARF original prototype: TMoveUseAction * operator()(vector * this, int i) + +TMoveUseAction * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ActionType AVar1; + int iVar2; + int iVar3; + int iVar4; + TMoveUseAction *pTVar5; + TMoveUseAction *pTVar6; + int iVar7; + int iVar8; + int iVar9; + int iVar10; + TMoveUseAction *help_1; + int iVar11; + TMoveUseAction *help; + int j; + int local_40; + int extend; + uchar Help [24]; + + iVar8 = this->start; + while (i < iVar8) { + local_40 = this->block; + if (local_40 == 0) { + iVar8 = this->space; + local_40 = iVar8; + } + else { + iVar8 = this->space; + } + pTVar6 = (TMoveUseAction *)operator_new__((local_40 + iVar8) * 0x18); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar11 = (iVar8 - this->start) + local_40; + AVar1 = pTVar6[iVar11].Action; + iVar10 = pTVar6[iVar11].Parameters[0]; + iVar2 = pTVar6[iVar11].Parameters[1]; + iVar3 = pTVar6[iVar11].Parameters[2]; + iVar4 = pTVar6[iVar11].Parameters[3]; + iVar9 = pTVar6[iVar11].Parameters[4]; + iVar7 = iVar8 - this->start; + iVar11 = local_40 + iVar7; + pTVar5 = this->entry; + pTVar6[iVar11].Action = pTVar5[iVar7].Action; + pTVar6[iVar11].Parameters[0] = pTVar5[iVar7].Parameters[0]; + pTVar6[iVar11].Parameters[1] = pTVar5[iVar7].Parameters[1]; + pTVar6[iVar11].Parameters[2] = pTVar5[iVar7].Parameters[2]; + pTVar6[iVar11].Parameters[3] = pTVar5[iVar7].Parameters[3]; + pTVar6[iVar11].Parameters[4] = pTVar5[iVar7].Parameters[4]; + iVar11 = iVar8 + 1; + iVar8 = iVar8 - this->start; + pTVar5 = this->entry; + pTVar5[iVar8].Action = AVar1; + pTVar5[iVar8].Parameters[0] = iVar10; + pTVar5[iVar8].Parameters[1] = iVar2; + pTVar5[iVar8].Parameters[2] = iVar3; + pTVar5[iVar8].Parameters[3] = iVar4; + pTVar5[iVar8].Parameters[4] = iVar9; + iVar8 = iVar11; + } while (iVar11 <= this->max); + } + if (this->entry != (TMoveUseAction *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar8 = this->start - local_40; + this->start = iVar8; + this->space = this->space + local_40; + } + iVar10 = this->space; + iVar11 = iVar10 + iVar8; + while (iVar11 <= i) { + iVar11 = this->block; + if (this->block == 0) { + iVar11 = iVar10; + } + pTVar6 = (TMoveUseAction *)operator_new__((iVar11 + iVar10) * 0x18); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + AVar1 = pTVar6[iVar9].Action; + iVar10 = pTVar6[iVar9].Parameters[0]; + iVar2 = pTVar6[iVar9].Parameters[1]; + iVar3 = pTVar6[iVar9].Parameters[2]; + iVar4 = pTVar6[iVar9].Parameters[3]; + iVar9 = pTVar6[iVar9].Parameters[4]; + pTVar5 = this->entry; + iVar7 = iVar8 - this->start; + pTVar6[iVar7].Action = pTVar5[iVar7].Action; + pTVar6[iVar7].Parameters[0] = pTVar5[iVar7].Parameters[0]; + pTVar6[iVar7].Parameters[1] = pTVar5[iVar7].Parameters[1]; + pTVar6[iVar7].Parameters[2] = pTVar5[iVar7].Parameters[2]; + pTVar6[iVar7].Parameters[3] = pTVar5[iVar7].Parameters[3]; + pTVar6[iVar7].Parameters[4] = pTVar5[iVar7].Parameters[4]; + iVar7 = iVar8 + 1; + pTVar5 = this->entry; + iVar8 = iVar8 - this->start; + pTVar5[iVar8].Action = AVar1; + pTVar5[iVar8].Parameters[0] = iVar10; + pTVar5[iVar8].Parameters[1] = iVar2; + pTVar5[iVar8].Parameters[2] = iVar3; + pTVar5[iVar8].Parameters[3] = iVar4; + pTVar5[iVar8].Parameters[4] = iVar9; + iVar8 = iVar7; + } while (iVar7 <= this->max); + } + if (this->entry != (TMoveUseAction *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar8 = this->start; + iVar10 = this->space + iVar11; + this->space = iVar10; + iVar11 = iVar10 + iVar8; + } + iVar11 = this->min; + while (i < iVar11) { + this->min = iVar11 + -1; + if (this->initialized != false) { + iVar8 = (iVar11 + -1) - iVar8; + pTVar6 = this->entry; + pTVar6[iVar8].Action = (this->init).Action; + pTVar6[iVar8].Parameters[0] = (this->init).Parameters[0]; + pTVar6[iVar8].Parameters[1] = (this->init).Parameters[1]; + pTVar6[iVar8].Parameters[2] = (this->init).Parameters[2]; + pTVar6[iVar8].Parameters[3] = (this->init).Parameters[3]; + pTVar6[iVar8].Parameters[4] = (this->init).Parameters[4]; + iVar8 = this->start; + } + iVar11 = this->min; + } + iVar11 = this->max; + while (iVar11 < i) { + this->max = iVar11 + 1; + if (this->initialized != false) { + iVar8 = (iVar11 + 1) - iVar8; + pTVar6 = this->entry; + pTVar6[iVar8].Action = (this->init).Action; + pTVar6[iVar8].Parameters[0] = (this->init).Parameters[0]; + pTVar6[iVar8].Parameters[1] = (this->init).Parameters[1]; + pTVar6[iVar8].Parameters[2] = (this->init).Parameters[2]; + pTVar6[iVar8].Parameters[3] = (this->init).Parameters[3]; + pTVar6[iVar8].Parameters[4] = (this->init).Parameters[4]; + iVar8 = this->start; + } + iVar11 = this->max; + } + return this->entry + (i - iVar8); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +int Direction(int dx,int dy) + +{ + int iVar1; + int r; + uint uVar2; + + if ((dx != 0) || (((uVar2 = 0, dy != 0 && (uVar2 = 7, dy < 1)) && (uVar2 = 3, -1 < dy)))) { + iVar1 = (dy << 8) / dx; + uVar2 = 7; + if (iVar1 < -0x26a) { + uVar2 = 3; + } + else if (iVar1 < -0x6a) { + uVar2 = 2; + } + else if (iVar1 < 0x6a) { + uVar2 = 1; + } + else if (iVar1 < 0x26a) { + uVar2 = 8; + } + if (dx == -1 || SCARRY4(dx,1) != dx + 1 < 0) { + uVar2 = uVar2 + 4; + } + if (8 < uVar2) { + uVar2 = uVar2 - 8; + } + } + return uVar2; +} + + + +void CheckSpellbook(TCreature *cr,int SpellNr) + +{ + bool bVar1; + undefined4 *puVar2; + + if (cr == (TCreature *)0x0) { + error(&DAT_080fa3e0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0807e620: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + if (cr->Type == PLAYER) { + // try { // try from 0807e5f2 to 0807e643 has its CatchHandler @ 0807e658 + bVar1 = CheckRight(cr->ID,ALL_SPELLS); + if (!bVar1) { + bVar1 = TPlayer::SpellKnown((TPlayer *)cr,SpellNr); + if (!bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x20; + goto LAB_0807e620; + } + } + } + return; +} + + + +void CheckAccount(TCreature *cr,int SpellNr) + +{ + bool bVar1; + undefined4 *puVar2; + + if (cr == (TCreature *)0x0) { + error(&DAT_080fa460); + } + else { + if (SpellNr - 1U < 0xff) { + if ((cr->Type != PLAYER) || ((SpellList[SpellNr].Flags & 2) == 0)) { + return; + } + // try { // try from 0807e6c1 to 0807e723 has its CatchHandler @ 0807e726 + bVar1 = CheckRight(cr->ID,PREMIUM_ACCOUNT); + if (bVar1) { + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x33; + goto LAB_0807e6dc; + } + error(&DAT_080fa420,SpellNr); + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0807e6dc: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void CheckLevel(TCreature *cr,int SpellNr) + +{ + ushort uVar1; + TSkill *this; + bool bVar2; + TSkill *sk; + int iVar3; + undefined4 *puVar4; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fa4c0; + } + else { + if (cr->Type != PLAYER) { + return; + } + // try { // try from 0807e781 to 0807e7dd has its CatchHandler @ 0807e800 + bVar2 = CheckRight(cr->ID,ALL_SPELLS); + if (bVar2) { + return; + } + this = (cr->super_TSkillBase).Skills[0]; + uVar1 = SpellList[SpellNr].Level; + if (this != (TSkill *)0x0) { + iVar3 = TSkill::Get(this); + if ((int)(uint)uVar1 <= iVar3) { + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x3c; + goto LAB_0807e7ba; + } + Text = "CheckLevel: Kein Skill LEVEL.\n"; + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0807e7ba: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void CheckRuneLevel(TCreature *cr,int SpellNr) + +{ + ushort uVar1; + TSkill *this; + bool bVar2; + TSkill *sk; + int iVar3; + undefined4 *puVar4; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fa540; + } + else { + if (cr->Type != PLAYER) { + return; + } + // try { // try from 0807e861 to 0807e8bd has its CatchHandler @ 0807e8e0 + bVar2 = CheckRight(cr->ID,ALL_SPELLS); + if (bVar2) { + return; + } + this = (cr->super_TSkillBase).Skills[1]; + uVar1 = SpellList[SpellNr].RuneLevel; + if (this != (TSkill *)0x0) { + iVar3 = TSkill::Get(this); + if ((int)(uint)uVar1 <= iVar3) { + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x21; + goto LAB_0807e89a; + } + Text = "CheckLevel: Kein Skill MAGLEVEL.\n"; + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0807e89a: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void CheckMagicItem(TCreature *cr,ObjectType *Type) + +{ + bool bVar1; + int iVar2; + undefined4 *puVar3; + ObjectType local_1c [4]; + + if (cr == (TCreature *)0x0) { + error(&DAT_080fa580); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0807e98e: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if (cr->Type == PLAYER) { + // try { // try from 0807e941 to 0807e9b1 has its CatchHandler @ 0807e9c6 + bVar1 = CheckRight(cr->ID,ALL_SPELLS); + if (!bVar1) { + ObjectType::setTypeID(local_1c,Type->TypeID); + iVar2 = CountInventoryObjects(cr->ID,local_1c,0); + if (iVar2 == 0) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x22; + goto LAB_0807e98e; + } + } + } + return; +} + + + +void CheckRing(TCreature *cr,int param_2) + +{ + undefined4 *puVar1; + + if (cr != (TCreature *)0x0) { + if (cr->Type == PLAYER) { + // try { // try from 0807ea11 to 0807ea4d has its CatchHandler @ 0807ea50 + CheckRight(cr->ID,ALL_SPELLS); + } + return; + } + error(&DAT_080fa5c0); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CheckAffectedPlayers(void) + +{ + bool bVar1; + ulong uVar2; + undefined4 *puVar3; + TPlayer *in_stack_00000004; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Obj; + + if (in_stack_00000004 == (TPlayer *)0x0) { + error(&DAT_080fa600); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0807eb78: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if ((((in_stack_00000004->super_TCreature).Type == PLAYER) && + ((in_stack_00000004->super_TCreature).Combat.SecureMode != '\0')) && (WorldType == NORMAL)) + { + // try { // try from 0807eace to 0807eb9b has its CatchHandler @ 0807ebb0 + GetFirstObject(); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_4c); + if (local_4c[0].ObjectID == 99) { + uVar2 = Object::getCreatureID(&local_2c); + bVar1 = IsCreaturePlayer(uVar2); + if ((bVar1) && + (uVar2 = Object::getCreatureID(&local_2c), + uVar2 != (in_stack_00000004->super_TCreature).ID)) { + uVar2 = Object::getCreatureID(&local_2c); + bVar1 = TPlayer::IsAttackJustified(in_stack_00000004,uVar2); + if (!bVar1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x3a; + goto LAB_0807eb78; + } + } + } + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + return; +} + + + +void CheckMana(TCreature *cr,int Mana,int SoulPoints,int Delay) + +{ + TSkill *pTVar1; + TSkill *this; + bool bVar2; + int iVar3; + undefined4 *puVar4; + TSkill *mana; + ulong *puVar5; + TSkill *soulpoints; + char *Text; + uint local_14; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fa680; + } + else { + if ((cr->Type != PLAYER) || (Mana < 0)) { + return; + } + pTVar1 = (cr->super_TSkillBase).Skills[3]; + this = (cr->super_TSkillBase).Skills[0x16]; + if (pTVar1 == (TSkill *)0x0) { + Text = "CheckMana: Kein Skill MANA!\n"; + } + else { + if (this != (TSkill *)0x0) { + // try { // try from 0807ec22 to 0807ed0b has its CatchHandler @ 0807ed32 + bVar2 = CheckRight(cr->ID,UNLIMITED_MANA); + if (bVar2) { +LAB_0807ec2b: + if (0 < Mana) { + pTVar1 = (cr->super_TSkillBase).Skills[1]; + (*pTVar1->_vptr_TSkill[3])(pTVar1,Mana); + } + local_14 = Delay + ServerMilliseconds; + puVar5 = &local_14; + if (Delay + ServerMilliseconds <= cr->EarliestSpellTime) { + puVar5 = &cr->EarliestSpellTime; + } + cr->EarliestSpellTime = *puVar5; + return; + } + iVar3 = TSkill::Get(pTVar1); + if (iVar3 < Mana) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x23; + } + else { + iVar3 = TSkill::Get(this); + if (SoulPoints <= iVar3) { + TSkill::Change(pTVar1,-Mana); + TSkill::Change(this,-SoulPoints); + goto LAB_0807ec2b; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x3b; + } + goto LAB_0807ecd1; + } + Text = "CheckMana: Kein Skill SOULPOINTS!\n"; + } + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0807ecd1: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +int ComputeDamage(TCreature *cr,int SpellNr,int Damage,int Variation) + +{ + int iVar1; + int iVar2; + long lVar3; + int proz; + + if (Variation != 0) { + lVar3 = random(); + Damage = Damage + lVar3; + } + if ((cr != (TCreature *)0x0) && (cr->Type == PLAYER)) { + iVar1 = TSkill::Get((cr->super_TSkillBase).Skills[0]); + iVar2 = TSkill::Get((cr->super_TSkillBase).Skills[1]); + iVar1 = iVar2 * 3 + iVar1 * 2; + if (SpellNr != 0) { + if (((SpellList[SpellNr].Flags & 4) != 0) && (100 < iVar1)) { + iVar1 = 100; + } + if (((SpellList[SpellNr].Flags & 8) != 0) && (iVar1 < 100)) { + iVar1 = 100; + } + } + Damage = (Damage * iVar1) / 100; + } + return Damage; +} + + + +bool IsAggressiveSpell(int SpellNr) + +{ + bool bVar1; + + if (SpellNr - 1U < 0xff) { + bVar1 = (bool)((byte)SpellList[SpellNr].Flags & 1); + } + else { + error(&DAT_080fa6c0,SpellNr); + bVar1 = false; + } + return bVar1; +} + + + +// DWARF original prototype: void TDamageImpact(TDamageImpact * this, TCreature * _Actor, int +// _DamageType, int _Power, bool _AllowDefense) + +void __thiscall +TDamageImpact::TDamageImpact + (TDamageImpact *this,TCreature *_Actor,int _DamageType,int _Power,bool _AllowDefense) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b48; + if (_Actor == (TCreature *)0x0) { + error("TDamageImpact::TDamageImpact: Actor ist NULL.\n"); + } + this->Actor = _Actor; + this->DamageType = _DamageType; + this->AllowDefense = _AllowDefense; + this->Power = _Power; + return; +} + + + +// DWARF original prototype: void TDamageImpact(TDamageImpact * this, TCreature * _Actor, int +// _DamageType, int _Power, bool _AllowDefense) + +void __thiscall +TDamageImpact::TDamageImpact + (TDamageImpact *this,TCreature *_Actor,int _DamageType,int _Power,bool _AllowDefense) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b48; + if (_Actor == (TCreature *)0x0) { + error("TDamageImpact::TDamageImpact: Actor ist NULL.\n"); + } + this->Actor = _Actor; + this->DamageType = _DamageType; + this->AllowDefense = _AllowDefense; + this->Power = _Power; + return; +} + + + +// DWARF original prototype: void handleCreature(TDamageImpact * this, TCreature * Victim) + +void __thiscall TDamageImpact::handleCreature(TDamageImpact *this,TCreature *Victim) + +{ + TCreature *pTVar1; + short sVar2; + int iVar3; + int Help; + int Damage; + + if (Victim != (TCreature *)0x0) { + pTVar1 = this->Actor; + if (((pTVar1 != (TCreature *)0x0) && (Victim != pTVar1)) && + ((WorldType != NON_PVP || + ((iVar3 = (*pTVar1->_vptr_TCreature[4])(pTVar1), (char)iVar3 == '\0' || + (iVar3 = (*Victim->_vptr_TCreature[4])(Victim), (char)iVar3 == '\0')))))) { + iVar3 = this->DamageType; + Damage = this->Power; + if ((iVar3 == 1) && (this->AllowDefense != false)) { + sVar2 = TCombat::GetDefendDamage(&Victim->Combat); + Damage = Damage - sVar2; + iVar3 = this->DamageType; + } + TCreature::Damage(Victim,this->Actor,Damage,iVar3); + } + return; + } + error("TDamageImpact::handleCreature: Opfer existiert nicht.\n"); + return; +} + + + +// DWARF original prototype: void TFieldImpact(TFieldImpact * this, TCreature * _Actor, int +// _FieldType) + +void __thiscall TFieldImpact::TFieldImpact(TFieldImpact *this,TCreature *_Actor,int _FieldType) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b30; + if (_Actor == (TCreature *)0x0) { + error("TFieldImpact::TFieldImpact: Actor ist NULL.\n"); + } + this->Actor = _Actor; + this->FieldType = _FieldType; + return; +} + + + +// DWARF original prototype: void TFieldImpact(TFieldImpact * this, TCreature * _Actor, int +// _FieldType) + +void __thiscall TFieldImpact::TFieldImpact(TFieldImpact *this,TCreature *_Actor,int _FieldType) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b30; + if (_Actor == (TCreature *)0x0) { + error("TFieldImpact::TFieldImpact: Actor ist NULL.\n"); + } + this->Actor = _Actor; + this->FieldType = _FieldType; + return; +} + + + +// DWARF original prototype: void handleField(TFieldImpact * this, int x, int y, int z) + +void __thiscall TFieldImpact::handleField(TFieldImpact *this) + +{ + int iVar1; + TCreature *pTVar2; + bool Peaceful; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + pTVar2 = this->Actor; + if (pTVar2 != (TCreature *)0x0) { + Peaceful = false; + if (WorldType == NON_PVP) { + iVar1 = (*pTVar2->_vptr_TCreature[4])(pTVar2); + pTVar2 = this->Actor; + Peaceful = (char)iVar1 != '\0'; + } + // try { // try from 0807f0bf to 0807f0d8 has its CatchHandler @ 0807f0e3 + CreateField(in_stack_00000008,in_stack_0000000c,in_stack_00000010,this->FieldType,pTVar2->ID + ,Peaceful); + } + return; +} + + + +// DWARF original prototype: void THealingImpact(THealingImpact * this, TCreature * _Actor, int +// _Power) + +void __thiscall THealingImpact::THealingImpact(THealingImpact *this,TCreature *_Actor,int _Power) + +{ + char *pcVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b18; + if (_Actor == (TCreature *)0x0) { + error("THealingImpact::THealingImpact: Actor ist NULL.\n"); + } + if (_Power < 0) { + pcVar1 = "(unknown)"; + if (_Actor != (TCreature *)0x0) { + pcVar1 = _Actor->Name; + } + error("THealingImpact::THealingImpact: Power ist negativ (Actor: %s).\n",pcVar1); + } + this->Actor = _Actor; + this->Power = _Power; + return; +} + + + +// DWARF original prototype: void THealingImpact(THealingImpact * this, TCreature * _Actor, int +// _Power) + +void __thiscall THealingImpact::THealingImpact(THealingImpact *this,TCreature *_Actor,int _Power) + +{ + char *pcVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b18; + if (_Actor == (TCreature *)0x0) { + error("THealingImpact::THealingImpact: Actor ist NULL.\n"); + } + if (_Power < 0) { + pcVar1 = "(unknown)"; + if (_Actor != (TCreature *)0x0) { + pcVar1 = _Actor->Name; + } + error("THealingImpact::THealingImpact: Power ist negativ (Actor: %s).\n",pcVar1); + } + this->Actor = _Actor; + this->Power = _Power; + return; +} + + + +// DWARF original prototype: void handleCreature(THealingImpact * this, TCreature * Victim) + +void __thiscall THealingImpact::handleCreature(THealingImpact *this,TCreature *Victim) + +{ + int iVar1; + + if (Victim != (TCreature *)0x0) { + if ((this->Actor != (TCreature *)0x0) && (-1 < this->Power)) { + iVar1 = TSkill::Get((Victim->super_TSkillBase).Skills[2]); + if (0 < iVar1) { + TSkill::Change((Victim->super_TSkillBase).Skills[2],this->Power); + if ((Victim->super_TSkillBase).Skills[4]->MDAct < 0) { + TSkillBase::SetTimer(&Victim->super_TSkillBase); + } + } + } + return; + } + error("THealingImpact::handleCreature: Opfer existiert nicht.\n"); + return; +} + + + +// DWARF original prototype: void TSpeedImpact(TSpeedImpact * this, TCreature * _Actor, int +// _Percent, int _Duration) + +void __thiscall TSpeedImpact::TSpeedImpact(TSpeedImpact *this) + +{ + TCreature *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b00; + if (in_stack_00000008 == (TCreature *)0x0) { + error("TSpeedImpact::TSpeedImpact: Actor ist NULL.\n"); + } + this->Actor = in_stack_00000008; + this->Percent = in_stack_0000000c; + this->Duration = in_stack_00000010; + return; +} + + + +// DWARF original prototype: void TSpeedImpact(TSpeedImpact * this, TCreature * _Actor, int +// _Percent, int _Duration) + +void __thiscall TSpeedImpact::TSpeedImpact(TSpeedImpact *this) + +{ + TCreature *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b00; + if (in_stack_00000008 == (TCreature *)0x0) { + error("TSpeedImpact::TSpeedImpact: Actor ist NULL.\n"); + } + this->Actor = in_stack_00000008; + this->Percent = in_stack_0000000c; + this->Duration = in_stack_00000010; + return; +} + + + +// DWARF original prototype: void handleCreature(TSpeedImpact * this, TCreature * Victim) + +void __thiscall TSpeedImpact::handleCreature(TSpeedImpact *this,TCreature *Victim) + +{ + TCreature *pTVar1; + TSkill *this_00; + bool bVar2; + TSkill *sk; + int Modification; + int iVar3; + + if (Victim == (TCreature *)0x0) { + error("TSpeedImpact::handleCreature: Opfer existiert nicht.\n"); + return; + } + pTVar1 = this->Actor; + if (pTVar1 != (TCreature *)0x0) { + iVar3 = this->Percent; + if (iVar3 < 0) { + if (pTVar1 == Victim) { + return; + } + if (WorldType == NON_PVP) { + iVar3 = (*pTVar1->_vptr_TCreature[4])(pTVar1); + if (((char)iVar3 != '\0') && + (iVar3 = (*Victim->_vptr_TCreature[4])(Victim), (char)iVar3 != '\0')) { + return; + } + iVar3 = this->Percent; + } + if (iVar3 < 0) { + bVar2 = GetRaceNoParalyze(Victim->Race); + if (bVar2) { + return; + } + iVar3 = this->Percent; + if ((iVar3 < 0) && (Victim->Type == PLAYER)) { + bVar2 = CheckRight(Victim->ID,INVULNERABLE); + if (bVar2) { + return; + } + iVar3 = this->Percent; + } + } + } + this_00 = (Victim->super_TSkillBase).Skills[4]; + if (iVar3 < -100) { + iVar3 = -0x14 - this_00->Act; + } + else { + iVar3 = (iVar3 * this_00->Act) / 100; + } + TSkill::SetMDAct(this_00,iVar3); + TSkillBase::SetTimer(&Victim->super_TSkillBase); + } + return; +} + + + +// DWARF original prototype: void TDrunkenImpact(TDrunkenImpact * this, TCreature * _Actor, int +// _Power, int _Duration) + +void __thiscall +TDrunkenImpact::TDrunkenImpact(TDrunkenImpact *this,TCreature *_Actor,int _Power,int _Duration) + +{ + int iVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ae8; + if (_Actor == (TCreature *)0x0) { + error("TDrunkenImpact::TDrunkenImpact: Actor ist NULL.\n"); + } + iVar1 = _Power; + if (6 < _Power) { + iVar1 = 6; + error(&DAT_080fa900,_Power); + } + this->Actor = _Actor; + this->Power = iVar1; + this->Duration = _Duration; + return; +} + + + +// DWARF original prototype: void TDrunkenImpact(TDrunkenImpact * this, TCreature * _Actor, int +// _Power, int _Duration) + +void __thiscall +TDrunkenImpact::TDrunkenImpact(TDrunkenImpact *this,TCreature *_Actor,int _Power,int _Duration) + +{ + int iVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ae8; + if (_Actor == (TCreature *)0x0) { + error("TDrunkenImpact::TDrunkenImpact: Actor ist NULL.\n"); + } + iVar1 = _Power; + if (6 < _Power) { + iVar1 = 6; + error(&DAT_080fa900,_Power); + } + this->Actor = _Actor; + this->Power = iVar1; + this->Duration = _Duration; + return; +} + + + +// DWARF original prototype: void handleCreature(TDrunkenImpact * this, TCreature * Victim) + +void __thiscall TDrunkenImpact::handleCreature(TDrunkenImpact *this,TCreature *Victim) + +{ + TCreature *pTVar1; + TSkill *pTVar2; + bool bVar3; + int iVar4; + + if (Victim != (TCreature *)0x0) { + pTVar1 = this->Actor; + if (((((pTVar1 != (TCreature *)0x0) && (pTVar1 != Victim)) && + ((WorldType != NON_PVP || + ((iVar4 = (*pTVar1->_vptr_TCreature[4])(pTVar1), (char)iVar4 == '\0' || + (iVar4 = (*Victim->_vptr_TCreature[4])(Victim), (char)iVar4 == '\0')))))) && + (bVar3 = GetRaceNoParalyze(Victim->Race), !bVar3)) && + (((Victim->Type != PLAYER || (bVar3 = CheckRight(Victim->ID,INVULNERABLE), !bVar3)) && + (pTVar2 = (Victim->super_TSkillBase).Skills[0x14], + iVar4 = (*pTVar2->_vptr_TSkill[0xd])(pTVar2), iVar4 <= this->Power)))) { + TSkillBase::SetTimer(&Victim->super_TSkillBase); + } + return; + } + error("TDrunkenImpact::handleCreature: Opfer existiert nicht.\n"); + return; +} + + + +// DWARF original prototype: void TStrengthImpact(TStrengthImpact * this, TCreature * _Actor, int +// _Skills, int _Percent, int _Duration) + +void __thiscall TStrengthImpact::TStrengthImpact(TStrengthImpact *this) + +{ + TCreature *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ad0; + if (in_stack_00000008 == (TCreature *)0x0) { + error("TStrengthImpact::TStrengthImpact: Actor ist NULL.\n"); + } + this->Actor = in_stack_00000008; + this->Skills = in_stack_0000000c; + this->Percent = in_stack_00000010; + this->Duration = in_stack_00000014; + return; +} + + + +// DWARF original prototype: void TStrengthImpact(TStrengthImpact * this, TCreature * _Actor, int +// _Skills, int _Percent, int _Duration) + +void __thiscall TStrengthImpact::TStrengthImpact(TStrengthImpact *this) + +{ + TCreature *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ad0; + if (in_stack_00000008 == (TCreature *)0x0) { + error("TStrengthImpact::TStrengthImpact: Actor ist NULL.\n"); + } + this->Actor = in_stack_00000008; + this->Skills = in_stack_0000000c; + this->Percent = in_stack_00000010; + this->Duration = in_stack_00000014; + return; +} + + + +// DWARF original prototype: void handleCreature(TStrengthImpact * this, TCreature * Victim) + +void __thiscall TStrengthImpact::handleCreature(TStrengthImpact *this,TCreature *Victim) + +{ + TCreature *pTVar1; + uint uVar2; + TSkill *this_00; + bool bVar3; + TSkill *sk; + int Modification; + int value; + int Skill; + int iVar4; + + if (Victim == (TCreature *)0x0) { + error("TStrengthImpact::handleCreature: Opfer existiert nicht.\n"); + return; + } + pTVar1 = this->Actor; + if (pTVar1 == (TCreature *)0x0) { + return; + } + iVar4 = this->Percent; + if (iVar4 < 0) { + if (pTVar1 == Victim) { + return; + } + if (WorldType == NON_PVP) { + iVar4 = (*pTVar1->_vptr_TCreature[4])(pTVar1); + if (((char)iVar4 != '\0') && + (iVar4 = (*Victim->_vptr_TCreature[4])(Victim), (char)iVar4 != '\0')) { + return; + } + iVar4 = this->Percent; + } + if (iVar4 < 0) { + bVar3 = GetRaceNoParalyze(Victim->Race); + if (bVar3) { + return; + } + if (((this->Percent < 0) && (Victim->Type == PLAYER)) && + (bVar3 = CheckRight(Victim->ID,INVULNERABLE), bVar3)) { + return; + } + } + } + iVar4 = 6; + do { + uVar2 = this->Skills; + if ((uVar2 & 1) == 0) { + bVar3 = false; + if ((7 < iVar4) && (iVar4 < 0xc)) { + bVar3 = true; + } + if (!bVar3) goto LAB_0807f750; + } + else { +LAB_0807f750: + if ((((uVar2 & 2) != 0) || (iVar4 != 7)) && (((uVar2 & 4) != 0 || (iVar4 != 6)))) { + this_00 = (Victim->super_TSkillBase).Skills[iVar4]; + if (this->Percent < -100) { + value = -0x14 - this_00->Act; + } + else { + value = (this->Percent * this_00->Act) / 100; + } + TSkill::SetMDAct(this_00,value); + TSkillBase::SetTimer(&Victim->super_TSkillBase); + } + } + iVar4 = iVar4 + 1; + if (0xb < iVar4) { + return; + } + } while( true ); +} + + + +// DWARF original prototype: void TOutfitImpact(TOutfitImpact * this, TCreature * _Actor, TOutfit +// _Outfit, int _Duration) + +void __thiscall +TOutfitImpact::TOutfitImpact(TOutfitImpact *this,TCreature *_Actor,TOutfit _Outfit,int _Duration) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ab8; + if (_Actor == (TCreature *)0x0) { + error("TOutfitImpact::TOutfitImpact: Actor ist NULL.\n"); + } + (this->Outfit).field_1 = _Outfit.field_1; + (this->Outfit).OutfitID = _Outfit.OutfitID; + this->Actor = _Actor; + this->Duration = _Duration; + return; +} + + + +// DWARF original prototype: void TOutfitImpact(TOutfitImpact * this, TCreature * _Actor, TOutfit +// _Outfit, int _Duration) + +void __thiscall +TOutfitImpact::TOutfitImpact(TOutfitImpact *this,TCreature *_Actor,TOutfit _Outfit,int _Duration) + +{ + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127ab8; + if (_Actor == (TCreature *)0x0) { + error("TOutfitImpact::TOutfitImpact: Actor ist NULL.\n"); + } + (this->Outfit).field_1 = _Outfit.field_1; + (this->Outfit).OutfitID = _Outfit.OutfitID; + this->Actor = _Actor; + this->Duration = _Duration; + return; +} + + + +// DWARF original prototype: void handleCreature(TOutfitImpact * this, TCreature * Victim) + +void __thiscall TOutfitImpact::handleCreature(TOutfitImpact *this,TCreature *Victim) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + + if (Victim != (TCreature *)0x0) { + aVar1 = (this->Outfit).field_1; + (Victim->Outfit).OutfitID = (this->Outfit).OutfitID; + (Victim->Outfit).field_1 = aVar1; + TSkillBase::SetTimer(&Victim->super_TSkillBase); + return; + } + error("TOutfitImpact::handleCreature: Opfer existiert nicht.\n"); + return; +} + + + +// DWARF original prototype: void TSummonImpact(TSummonImpact * this, TCreature * _Actor, int _Race, +// int _Maximum) + +void __thiscall +TSummonImpact::TSummonImpact(TSummonImpact *this,TCreature *_Actor,int _Race,int _Maximum) + +{ + bool bVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127aa0; + if (_Actor == (TCreature *)0x0) { + error("TSummonImpact::TSummonImpact: Actor ist NULL.\n"); + } + bVar1 = false; + if ((0 < _Race) && (_Race < 0x200)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080faac0,_Race); + } + this->Actor = _Actor; + this->Race = _Race; + this->Maximum = _Maximum; + return; +} + + + +// DWARF original prototype: void TSummonImpact(TSummonImpact * this, TCreature * _Actor, int _Race, +// int _Maximum) + +void __thiscall +TSummonImpact::TSummonImpact(TSummonImpact *this,TCreature *_Actor,int _Race,int _Maximum) + +{ + bool bVar1; + + (this->super_TImpact)._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127aa0; + if (_Actor == (TCreature *)0x0) { + error("TSummonImpact::TSummonImpact: Actor ist NULL.\n"); + } + bVar1 = false; + if ((0 < _Race) && (_Race < 0x200)) { + bVar1 = true; + } + if (!bVar1) { + error(&DAT_080faac0,_Race); + } + this->Actor = _Actor; + this->Race = _Race; + this->Maximum = _Maximum; + return; +} + + + +// DWARF original prototype: void handleField(TSummonImpact * this, int x, int y, int z) + +void __thiscall TSummonImpact::handleField(TSummonImpact *this,int x,int y,int z) + +{ + bool bVar1; + + if (this->Actor != (TCreature *)0x0) { + bVar1 = false; + if ((0 < this->Race) && (this->Race < 0x200)) { + bVar1 = true; + } + if ((bVar1) && (this->Actor->SummonedCreatures < this->Maximum)) { + bVar1 = SearchSummonField(&x,&y,&z,2); + if (bVar1) { + CreateMonster(this->Race,x,y,z,0,this->Actor->ID,true); + } + } + } + return; +} + + + +void ActorShapeSpell(TCreature *Actor,TImpact *Impact,int Effect) + +{ + bool bVar1; + int iVar2; + + if (Actor == (TCreature *)0x0) { + error("ActorShapeSpell: Sprecher existiert nicht.\n"); + return; + } + iVar2 = (*Impact->_vptr_TImpact[2])(Impact); + if (((char)iVar2 != '\0') && (bVar1 = IsProtectionZone(), bVar1)) { + return; + } + (*Impact->_vptr_TImpact[1])(Impact,Actor); + if (Effect != 0) { + GraphicalEffect(); + } + return; +} + + + +void VictimShapeSpell(TCreature *Actor,TCreature *Victim,int Range,int Animation,TImpact *Impact, + int Effect) + +{ + bool bVar1; + int iVar2; + int *piVar3; + int local_44; + int local_40; + Object local_3c [4]; + Object local_2c [7]; + + if (Actor == (TCreature *)0x0) { + error("VictimShapeSpell: Sprecher existiert nicht.\n"); + } + else if ((Victim != (TCreature *)0x0) && (Actor->posz == Victim->posz)) { + iVar2 = Actor->posx - Victim->posx; + local_40 = -iVar2; + if (-1 < iVar2) { + local_40 = iVar2; + } + iVar2 = Actor->posy - Victim->posy; + local_44 = -iVar2; + if (-1 < iVar2) { + local_44 = iVar2; + } + piVar3 = &local_44; + if (local_44 <= local_40) { + piVar3 = &local_40; + } + if ((*piVar3 <= Range) && + (((iVar2 = (*Impact->_vptr_TImpact[2])(Impact), (char)iVar2 == '\0' || + (bVar1 = IsProtectionZone(), !bVar1)) && + (bVar1 = ThrowPossible(Actor->posx,Actor->posy,Actor->posz,Victim->posx,Victim->posy, + Victim->posz,0), bVar1)))) { + if ((Animation != 0) && ((Actor->posx != Victim->posx || (Actor->posy != Victim->posy))) + ) { + local_2c[0].ObjectID = (Victim->CrObject).ObjectID; + local_3c[0].ObjectID = (Actor->CrObject).ObjectID; + Missile(local_3c,local_2c,Animation); + } + (*Impact->_vptr_TImpact[1])(Impact,Victim); + if (Effect != 0) { + GraphicalEffect(); + } + } + } + return; +} + + + +void OriginShapeSpell(TCreature *Actor,int Radius,TImpact *Impact,int Effect) + +{ + bool bVar1; + int iVar2; + int zy; + int iVar3; + TCreature *pTVar4; + TCreature *dest; + int zx; + int z; + int local_78; + int *local_74; + int y; + int x; + int local_64; + int j; + int i; + ulong local_4c; + Object Help; + ulong local_2c; + Object Obj; + + if (Actor == (TCreature *)0x0) { + error(&DAT_080fabc0); + } + else { + j = 0; + if (-1 < Radius) { + local_74 = &Circle[0].Count; + local_78 = 0; + do { + local_64 = 0; + iVar2 = local_78; + if (0 < *local_74) { + do { + zx = Circle[0].x[iVar2 + local_64] + Actor->posx; + zy = Circle[0].y[iVar2 + local_64] + Actor->posy; + iVar2 = Actor->posz; + bVar1 = ThrowPossible(Actor->posx,Actor->posy,iVar2,zx,zy,iVar2,0); + if ((bVar1) && + ((iVar3 = (*Impact->_vptr_TImpact[2])(Impact), (char)iVar3 == '\0' || + (bVar1 = IsProtectionZone(), !bVar1)))) { + (**Impact->_vptr_TImpact)(Impact,zx,zy,iVar2); + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + local_4c = local_2c; + Object::getNextObject((Object *)&i); + iVar2 = i; + local_2c = i; + Object::getObjectType((Object *)&i); + if (i == 99) { + i = local_4c; + pTVar4 = GetCreature((Object *)&i); + if (pTVar4 != (TCreature *)0x0) { + (*Impact->_vptr_TImpact[1])(Impact,pTVar4); + } + } + } while (iVar2 != NONE.ObjectID); + } + local_4c = NONE.ObjectID; + if (Effect != 0) { + GraphicalEffect(); + } + } + local_64 = local_64 + 1; + iVar2 = j * 0x41; + } while (local_64 < *local_74); + } + j = j + 1; + local_74 = local_74 + 0x41; + local_78 = local_78 + 0x41; + } while (j <= Radius); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Actor_local + +void DestinationShapeSpell + (TCreature *Actor,TCreature *Victim,int Range,int Animation,int Radius, + TImpact *Impact,int Effect) + +{ + TCreature *Actor_local; + + if (Actor != (TCreature *)0x0) { + if (Victim != (TCreature *)0x0) { + CircleShapeSpell(Actor,Victim->posx,Victim->posy,Victim->posz,Range,Animation,Radius, + Impact,Effect); + } + return; + } + error("DestinationShapeSpell: Sprecher existiert nicht.\n"); + return; +} + + + +void CircleShapeSpell(TCreature *Actor,int DestX,int DestY,int DestZ,int Range,int Animation, + int Radius,TImpact *Impact,int Effect) + +{ + bool bVar1; + int iVar2; + TCreature *pTVar3; + int *piVar4; + TCreature *dest; + int zx; + int y; + int iVar5; + int local_80; + int *local_7c; + int x; + int local_70; + int j; + int i; + int local_64; + int local_60; + Object local_5c [4]; + ulong local_4c; + Object Help; + Object local_3c; + Object Obj; + Object local_2c [7]; + + if (Actor == (TCreature *)0x0) { + error("CircleShapeSpell: Sprecher existiert nicht.\n"); + } + else if (Actor->posz == DestZ) { + iVar5 = Actor->posx - DestX; + local_60 = -iVar5; + if (-1 < iVar5) { + local_60 = iVar5; + } + iVar5 = Actor->posy - DestY; + local_64 = -iVar5; + if (-1 < iVar5) { + local_64 = iVar5; + } + piVar4 = &local_64; + if (local_64 <= local_60) { + piVar4 = &local_60; + } + if ((*piVar4 <= Range) && + (bVar1 = ThrowPossible(Actor->posx,Actor->posy,DestZ,DestX,DestY,DestZ,0), bVar1)) { + if ((Animation != 0) && ((Actor->posx != DestX || (Actor->posy != DestY)))) { + local_2c[0].ObjectID = (Actor->CrObject).ObjectID; + GetMapContainer((int)&local_3c,DestX,DestY); + Missile(local_2c,&local_3c,Animation); + } + j = 0; + if (-1 < Radius) { + local_7c = &Circle[0].Count; + local_80 = 0; + do { + local_70 = 0; + iVar5 = local_80; + if (0 < *local_7c) { + do { + zx = DestX + Circle[0].x[iVar5 + local_70]; + iVar5 = DestY + Circle[0].y[iVar5 + local_70]; + bVar1 = ThrowPossible(DestX,DestY,DestZ,zx,iVar5,DestZ,0); + if ((bVar1) && + ((iVar2 = (*Impact->_vptr_TImpact[2])(Impact), (char)iVar2 == '\0' || + (bVar1 = IsProtectionZone(), !bVar1)))) { + (**Impact->_vptr_TImpact)(Impact,zx,iVar5,DestZ); + GetFirstObject(); + if (local_3c.ObjectID != NONE.ObjectID) { + do { + local_4c = local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject(local_5c); + local_3c.ObjectID = local_5c[0].ObjectID; + local_2c[0].ObjectID = local_5c[0].ObjectID; + Object::getObjectType(local_5c); + if (local_5c[0].ObjectID == 99) { + local_5c[0].ObjectID = local_4c; + pTVar3 = GetCreature(local_5c); + if (pTVar3 != (TCreature *)0x0) { + (*Impact->_vptr_TImpact[1])(Impact,pTVar3); + } + } + } while (local_3c.ObjectID != NONE.ObjectID); + } + local_4c = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if (Effect != 0) { + GraphicalEffect(); + } + } + local_70 = local_70 + 1; + iVar5 = j * 0x41; + } while (local_70 < *local_7c); + } + j = j + 1; + local_7c = local_7c + 0x41; + local_80 = local_80 + 0x41; + } while (j <= Radius); + } + } + } + return; +} + + + +void AngleShapeSpell(TCreature *Actor,int Angle,int Range,TImpact *Impact,int Effect) + +{ + int sy; + int sz; + bool bVar1; + int iVar2; + TCreature *pTVar3; + TCreature *dest; + int y; + int iVar4; + int x; + int iVar5; + int j; + int iVar6; + int local_78; + int local_74; + int z; + int local_60; + int i; + ulong local_4c; + Object Help; + ulong local_2c; + Object Obj; + + if (Actor == (TCreature *)0x0) { + error(&DAT_080facc0); + } + else { + local_60 = 1; + if (0 < Range) { + local_78 = -Angle; + local_74 = Angle; + do { + iVar6 = local_78 / 0x5a; + if (iVar6 <= local_74 / 0x5a) { + do { + iVar2 = Actor->posx; + sy = Actor->posy; + sz = Actor->posz; + iVar4 = Actor->Direction; + iVar5 = local_60; + if (iVar4 == 1) { +LAB_080804bf: + iVar5 = iVar2 + iVar5; + iVar4 = sy + iVar6; + } + else if (iVar4 < 2) { + if (iVar4 != 0) { +LAB_08080658: + error(&DAT_080fac80,iVar4); + return; + } + iVar5 = iVar2 + iVar6; + iVar4 = sy - local_60; + } + else { + if (iVar4 != 2) { + if (iVar4 != 3) goto LAB_08080658; + iVar5 = -local_60; + goto LAB_080804bf; + } + iVar5 = iVar2 + iVar6; + iVar4 = sy + local_60; + } + bVar1 = ThrowPossible(iVar2,sy,sz,iVar5,iVar4,sz,0); + if ((bVar1) && + ((iVar2 = (*Impact->_vptr_TImpact[2])(Impact), (char)iVar2 == '\0' || + (bVar1 = IsProtectionZone(), !bVar1)))) { + (**Impact->_vptr_TImpact)(Impact,iVar5,iVar4,sz); + GetFirstObject(); + if (local_2c != NONE.ObjectID) { + do { + local_4c = local_2c; + Object::getNextObject((Object *)&i); + iVar2 = i; + local_2c = i; + Object::getObjectType((Object *)&i); + if (i == 99) { + i = local_4c; + pTVar3 = GetCreature((Object *)&i); + if (pTVar3 != (TCreature *)0x0) { + (*Impact->_vptr_TImpact[1])(Impact,pTVar3); + } + } + } while (iVar2 != NONE.ObjectID); + } + local_4c = NONE.ObjectID; + if (Effect != 0) { + GraphicalEffect(); + } + } + iVar6 = iVar6 + 1; + } while (iVar6 <= local_74 / 0x5a); + } + local_60 = local_60 + 1; + local_74 = local_74 + Angle; + local_78 = local_78 - Angle; + } while (local_60 <= Range); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MassCombat(void) + +{ + bool bVar1; + undefined4 *puVar2; + int Delay; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000018; + int in_stack_0000001c; + ushort in_stack_00000020; + int in_stack_00000024; + char *Text; + int local_58; + int x; + int y; + int z; + TDamageImpact Impact; + Object local_2c [7]; + + // try { // try from 080806cf to 08080835 has its CatchHandler @ 08080853 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + if (in_stack_00000004 != (TCreature *)0x0) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&local_58,&x,&y); + CheckAffectedPlayers(); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,local_58,x,y,0); + if (bVar1) { + Delay = 1000; + if (WorldType != PVP_ENFORCED) { + Delay = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,Delay); + z = (int)&PTR_handleField_08127b48; + Impact.Power._0_1_ = 0; + Impact.Actor = (TCreature *)(uint)in_stack_00000020; + CircleShapeSpell(in_stack_00000004,local_58,x,y,0x7fffffff,in_stack_00000024, + in_stack_0000001c,(TImpact *)&z,in_stack_00000018); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 7; + goto LAB_08080812; + } + Text = &DAT_080fad00; + } + else { + Text = &DAT_080fad40; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08080812: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void AngleCombat(void) + +{ + int Delay; + undefined4 *puVar1; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000014; + int in_stack_00000018; + int in_stack_0000001c; + ushort in_stack_00000020; + TImpact local_3c; + TDamageImpact Impact; + + if (in_stack_00000004 != (TCreature *)0x0) { + if (((in_stack_00000018 == 1) && (in_stack_0000001c == 0)) || (WorldType == PVP_ENFORCED)) { + Delay = 1000; + } + else { + Delay = 2000; + } + // try { // try from 080808bb to 08080971 has its CatchHandler @ 08080972 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,Delay); + local_3c._vptr_TImpact = (_func_int_varargs **)&PTR_handleField_08127b48; + if (in_stack_00000004 == (TCreature *)0x0) { + error("TDamageImpact::TDamageImpact: Actor ist NULL.\n"); + } + Impact.Power._0_1_ = 0; + Impact.Actor = (TCreature *)(uint)in_stack_00000020; + AngleShapeSpell(in_stack_00000004,in_stack_0000001c,in_stack_00000018,&local_3c, + in_stack_00000014); + return; + } + error(&DAT_080fad80); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void Combat(TCreature *cr,Object *Target,int Mana,int SoulPoints,int Damage,int EffectNr, + int AnimationNr,ushort DmgType) + +{ + bool bVar1; + undefined4 *puVar2; + int Delay; + char *Text; + Object *pOVar3; + int *y_00; + int *z_00; + ushort DmgType_local; + int x; + int y; + int z; + TDamageImpact Impact; + ObjectType local_4c [4]; + ulong local_3c; + Object local_2c [7]; + + // try { // try from 080809b2 to 08080ba2 has its CatchHandler @ 08080bc3 + bVar1 = Object::exists(Target); + if (bVar1) { + if (cr != (TCreature *)0x0) { + local_2c[0] = (Object)Target->ObjectID; + z_00 = &y; + y_00 = &x; + GetObjectCoordinates(local_2c,(int *)&DmgType_local,y_00,z_00); + pOVar3 = Target; + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 99) { + ObjectType::setTypeID(local_4c,99); + pOVar3 = _DmgType_local; + y_00 = (int *)x; + z_00 = (int *)y; + GetFirstSpecObject(); + local_2c[0].ObjectID = local_3c; + Target->ObjectID = local_3c; + } + local_4c[0].TypeID = NONE.ObjectID; + if (Target->ObjectID == NONE.ObjectID) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,pOVar3,y_00,z_00); + *puVar2 = 0x27; + } + else { + CheckAffectedPlayers(); + bVar1 = ThrowPossible(cr->posx,cr->posy,cr->posz,(int)_DmgType_local,x,y,0); + if (bVar1) { + Delay = 1000; + if (WorldType != PVP_ENFORCED) { + Delay = 2000; + } + CheckMana(cr,Mana,SoulPoints,Delay); + z = (int)&PTR_handleField_08127b48; + Impact.super_TImpact._vptr_TImpact = (_func_int_varargs **)cr; + Impact.Power._0_1_ = 0; + Impact.DamageType = Damage; + Impact.Actor = (TCreature *)(uint)DmgType; + CircleShapeSpell(cr,(int)_DmgType_local,x,y,0x7fffffff,AnimationNr,0, + (TImpact *)&z,EffectNr); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 7; + } + goto LAB_08080b22; + } + Text = &DAT_080fadc0; + } + else { + Text = &DAT_080fae00; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08080b22: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void KillAllMonsters(TCreature *cr,int EffectNr,int Radius) + +{ + bool bVar1; + int iVar2; + TCreature *pTVar3; + undefined4 *puVar4; + char *pcVar5; + int dy; + int local_78; + int *local_74; + TCreature *dest; + int dx; + int j; + int i; + TSkill *local_4c; + Object Help; + TSkill *local_2c; + Object Obj; + + if (cr != (TCreature *)0x0) { + if (((cr->Type != PLAYER) || (bVar1 = CheckRight(cr->ID,CREATE_MONSTERS), bVar1)) && + (j = 0, -1 < Radius)) { + local_74 = &Circle[0].Count; + local_78 = 0; + do { + dx = 0; + iVar2 = local_78; + if (0 < *local_74) { + do { + // try { // try from 08080c93 to 08080e80 has its CatchHandler @ 08080e81 + bVar1 = ThrowPossible(cr->posx,cr->posy,cr->posz, + Circle[0].x[iVar2 + dx] + cr->posx, + Circle[0].y[iVar2 + dx] + cr->posy,cr->posz,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + GetFirstObject(); + if (local_2c != (TSkill *)NONE.ObjectID) { + do { + dest = (TCreature *)&local_4c; + local_4c = local_2c; + Object::getNextObject((Object *)&i); + iVar2 = i; + local_2c = (TSkill *)i; + Object::getObjectType((Object *)&i); + if (i == 99) { + i = (int)local_4c; + pTVar3 = GetCreature((Object *)&i); + if (pTVar3 == (TCreature *)0x0) { + error(&DAT_080fae40,dest); + } + else if ((cr != pTVar3) && (pTVar3->Type == MONSTER)) { + pcVar5 = pTVar3->Name; + print(); + (*(pTVar3->super_TSkillBase).Skills[2]->_vptr_TSkill[2]) + ((pTVar3->super_TSkillBase).Skills[2],0,pcVar5 + ); + (*pTVar3->_vptr_TCreature[2])(pTVar3); + } + } + } while (iVar2 != NONE.ObjectID); + } + local_4c = (TSkill *)NONE.ObjectID; + GraphicalEffect(); + } + dx = dx + 1; + iVar2 = j * 0x41; + } while (dx < *local_74); + } + j = j + 1; + local_74 = local_74 + 0x41; + local_78 = local_78 + 0x41; + } while (j <= Radius); + } + return; + } + error(&DAT_080fae80); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateField(void) + +{ + bool bVar1; + undefined4 *puVar2; + int iVar3; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + char *Text; + int iVar4; + bool local_4c; + int local_48; + int x; + int y; + int z; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080faf00; + } + else { + // try { // try from 08080ec3 to 080810b4 has its CatchHandler @ 080810d2 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&local_48,&x,&y); + iVar3 = x; + iVar4 = y; + bVar1 = FieldPossible(); + if (bVar1) { + CheckAffectedPlayers(); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,local_48,x,y,0); + if (bVar1) { + iVar3 = 1000; + if (WorldType != PVP_ENFORCED) { + iVar3 = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,iVar3); + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + z = (in_stack_00000004->CrObject).ObjectID; + Missile((Object *)&z,local_2c,(in_stack_00000014 != 1) + 4); + local_4c = false; + if (WorldType == NON_PVP) { + iVar3 = (*in_stack_00000004->_vptr_TCreature[4])(); + local_4c = (char)iVar3 != '\0'; + } + CreateField(local_48,x,y,in_stack_00000014,in_stack_00000004->ID,local_4c); + bVar1 = false; + if ((0 < in_stack_00000014) && (in_stack_00000014 < 4)) { + bVar1 = true; + } + if (bVar1) { + TCreature::BlockLogout(in_stack_00000004,0x3c,true); + } + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 7; + } + else { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,iVar3,iVar4); + *puVar2 = 4; + } + goto LAB_0808107d; + } + Text = &DAT_080faec0; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0808107d: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateField(void) + +{ + bool bVar1; + undefined4 *puVar2; + int x; + int y_00; + int y; + int z_00; + int in_stack_00000004; + int iVar3; + undefined4 uVar4; + int z; + + if (in_stack_00000004 == 0) { + error(&DAT_080faf00); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_080811d9: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + uVar4 = *(undefined4 *)(in_stack_00000004 + 0x278); + y_00 = *(int *)(in_stack_00000004 + 0x270); + z_00 = *(int *)(in_stack_00000004 + 0x274); + iVar3 = *(int *)(in_stack_00000004 + 0x284); + if (iVar3 == 1) { + y_00 = y_00 + 1; + } + else if (iVar3 < 2) { + if (iVar3 == 0) { + z_00 = z_00 + -1; + } + } + else if (iVar3 == 2) { + z_00 = z_00 + 1; + } + else if (iVar3 == 3) { + y_00 = y_00 + -1; + } + if (*(int *)(in_stack_00000004 + 0x28c) == 0) { + bVar1 = CheckRight(*(ulong *)(in_stack_00000004 + 0x208),ATTACK_EVERYWHERE); + if (!bVar1) { + iVar3 = z_00; + bVar1 = IsProtectionZone(); + if (bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,iVar3,uVar4); + *puVar2 = 0x2f; + goto LAB_080811d9; + } + } + } + // try { // try from 08081162 to 08081221 has its CatchHandler @ 08081236 + GetMapContainer((int)&z,y_00,z_00); + CreateField(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MassCreateField(void) + +{ + bool bVar1; + int iVar2; + undefined4 *puVar3; + int iVar4; + int dx; + int zx; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + char *Text; + int local_64; + int *local_60; + bool local_58; + int local_50; + int j; + int i; + int x; + int y; + int z; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080faf80; + } + else { + // try { // try from 08081273 to 08081538 has its CatchHandler @ 08081556 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&i,&x,&y); + CheckAffectedPlayers(); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,i,x,y,0); + if (bVar1) { + iVar4 = 1000; + if (WorldType != PVP_ENFORCED) { + iVar4 = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,iVar4); + if (((in_stack_00000004->posx != i) || (in_stack_00000004->posy != x)) || + (in_stack_00000004->posz != y)) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + z = (in_stack_00000004->CrObject).ObjectID; + Missile((Object *)&z,local_2c,(in_stack_00000014 != 1) + 4); + } + j = 0; + if (0 < in_stack_00000018) { + local_60 = &Circle[0].Count; + local_64 = 0; + do { + local_50 = 0; + iVar4 = local_64; + if (0 < *local_60) { + do { + zx = i + Circle[0].x[iVar4 + local_50]; + iVar4 = x + Circle[0].y[iVar4 + local_50]; + bVar1 = ThrowPossible(i,x,y,zx,iVar4,y,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + local_58 = false; + if (WorldType == NON_PVP) { + iVar2 = (*in_stack_00000004->_vptr_TCreature[4])(); + local_58 = (char)iVar2 != '\0'; + } + CreateField(zx,iVar4,y,in_stack_00000014,in_stack_00000004->ID, + local_58); + } + local_50 = local_50 + 1; + iVar4 = j * 0x41; + } while (local_50 < *local_60); + } + j = j + 1; + local_60 = local_60 + 0x41; + local_64 = local_64 + 0x41; + } while (j < in_stack_00000018); + } + bVar1 = false; + if ((0 < in_stack_00000014) && (in_stack_00000014 < 4)) { + bVar1 = true; + } + if (bVar1) { + TCreature::BlockLogout(in_stack_00000004,0x3c,true); + } + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 7; + goto LAB_08081515; + } + Text = &DAT_080faf40; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08081515: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateFieldWall(void) + +{ + bool bVar1; + uint uVar2; + undefined4 *puVar3; + int iVar4; + int dx; + int iVar5; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + char *Text; + int local_80; + int local_7c; + int local_78; + int local_74; + int local_70; + int local_6c; + int local_68; + int local_5c; + int i; + bool Peaceful; + int Dir; + int StepY; + int StepX; + int x; + int y; + int z; + Object local_2c [7]; + + if (in_stack_00000004 != (TCreature *)0x0) { + // try { // try from 08081593 to 08081b48 has its CatchHandler @ 08081b54 + bVar1 = Object::exists(in_stack_00000008); + if (!bVar1) { + Text = &DAT_080fb000; + goto LAB_08081b44; + } + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&StepX,&x,&y); + CheckAffectedPlayers(); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,StepX,x,y,0); + if (!bVar1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 7; + goto LAB_080816e6; + } + iVar4 = 1000; + if (WorldType != PVP_ENFORCED) { + iVar4 = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,iVar4); + iVar4 = in_stack_00000004->posx; + if (((iVar4 != StepX) || (iVar5 = in_stack_00000004->posy, iVar5 != x)) || + (in_stack_00000004->posz != y)) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + z = (in_stack_00000004->CrObject).ObjectID; + Missile((Object *)&z,local_2c,(in_stack_00000014 != 1) + 4); + iVar5 = in_stack_00000004->posy; + iVar4 = in_stack_00000004->posx; + } + uVar2 = Direction(StepX - iVar4,x - iVar5); + switch(uVar2) { + case 0: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 4; + goto LAB_080816e6; + case 1: + case 5: + StepY = 0; + break; + case 2: + case 6: + StepY = 1; + break; + case 3: + case 7: + StepY = 1; + Dir = 0; + goto LAB_0808170c; + case 4: + case 8: + StepY = -1; + break; + default: + error(&DAT_080fafc0,uVar2); + goto LAB_08081ae7; + } + Dir = 1; +LAB_0808170c: + i._3_1_ = false; + if ((WorldType == NON_PVP) && + (iVar4 = (*in_stack_00000004->_vptr_TCreature[4])(), (char)iVar4 != '\0')) { + i._3_1_ = true; + } + CreateField(StepX,x,y,in_stack_00000014,in_stack_00000004->ID,i._3_1_); + local_5c = 1; + if (0 < in_stack_00000018) { + local_6c = 0; + local_68 = StepY; + local_70 = StepY; + local_74 = Dir; + local_78 = StepY; + local_7c = Dir; + local_80 = StepY; + do { + iVar5 = local_80 + StepX; + iVar4 = local_7c + x; + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,iVar5,iVar4,y,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + CreateField(iVar5,iVar4,y,in_stack_00000014,in_stack_00000004->ID,i._3_1_); + } + iVar5 = StepX - local_78; + iVar4 = x - local_74; + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,iVar5,iVar4,y,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + CreateField(iVar5,iVar4,y,in_stack_00000014,in_stack_00000004->ID,i._3_1_); + } + if ((uVar2 & 1) == 0) { + iVar5 = local_70 + StepX; + iVar4 = local_6c + x; + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,iVar5,iVar4,y,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + CreateField(iVar5,iVar4,y,in_stack_00000014,in_stack_00000004->ID,i._3_1_); + } + iVar5 = StepX - local_68; + iVar4 = x - (local_5c + -1) * Dir; + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,iVar5,iVar4,y,0); + if ((bVar1) && (bVar1 = IsProtectionZone(), !bVar1)) { + CreateField(iVar5,iVar4,y,in_stack_00000014,in_stack_00000004->ID,i._3_1_); + } + } + local_5c = local_5c + 1; + local_68 = local_68 + StepY; + local_6c = local_6c + Dir; + local_70 = local_70 + StepY; + local_74 = local_74 + Dir; + local_78 = local_78 + StepY; + local_7c = local_7c + Dir; + local_80 = local_80 + StepY; + } while (local_5c <= in_stack_00000018); + } + bVar1 = false; + if ((0 < in_stack_00000014) && (in_stack_00000014 < 4)) { + bVar1 = true; + } + if (bVar1) { + TCreature::BlockLogout(in_stack_00000004,0x3c,true); + } + return; + } + Text = &DAT_080fb040; +LAB_08081b44: + error(Text); +LAB_08081ae7: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080816e6: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DeleteField(void) + +{ + bool bVar1; + undefined4 *puVar2; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + undefined4 uVar3; + int local_58; + int x; + int y; + int z; + ulong local_3c; + Object Help; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fb0c0; + } + else { + // try { // try from 08081b90 to 08081d0f has its CatchHandler @ 08081d30 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&local_58,&x,&y); + uVar3 = 0; + bVar1 = FieldPossible(); + if (bVar1) { + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); + GetFirstObject(); + in_stack_00000008->ObjectID = local_3c; + if (local_3c != NONE.ObjectID) { + do { + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject((Object *)&z); + in_stack_00000008->ObjectID = z; + local_2c[0].ObjectID = z; + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,MAGICFIELD); + if (bVar1) { + z = local_3c; + Delete((Object *)&z,-1); + } + local_3c = in_stack_00000008->ObjectID; + } while (local_3c != NONE.ObjectID); + } + local_3c = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + GraphicalEffect(); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4,x,y,uVar3); + *puVar2 = 4; + goto LAB_08081cec; + } + Text = &DAT_080fb080; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08081cec: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CleanupField(void) + +{ + bool bVar1; + uint uVar2; + ulong uVar3; + undefined4 *puVar4; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + int local_58; + int x; + int y; + int z; + ulong local_3c; + Object Help; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fb140; + } + else { + // try { // try from 08081d70 to 08081fa5 has its CatchHandler @ 08081fc3 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&local_58,&x,&y); + if (y == in_stack_00000004->posz) { + uVar2 = local_58 - in_stack_00000004->posx; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 2) { + uVar2 = x - in_stack_00000004->posy; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 2) { + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); + GetFirstObject(); + in_stack_00000008->ObjectID = local_3c; + if (local_3c != NONE.ObjectID) { + do { + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject((Object *)&z); + in_stack_00000008->ObjectID = z; + local_2c[0].ObjectID = z; + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,UNMOVE); + if ((!bVar1) && (Object::getObjectType((Object *)&z), z != 99)) { + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,CORPSE); + if (bVar1) { + Object::getObjectType((Object *)&z); + uVar3 = ObjectType::getAttribute + ((ObjectType *)&z,CORPSETYPE); + if (uVar3 == 0) goto LAB_08081e86; + } + z = local_3c; + Delete((Object *)&z,-1); + } +LAB_08081e86: + local_3c = in_stack_00000008->ObjectID; + } while (local_3c != NONE.ObjectID); + } + local_3c = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + GraphicalEffect(); + TCreature::BlockLogout(in_stack_00000004,0x3c,true); + return; + } + } + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 5; + goto LAB_08081f82; + } + Text = &DAT_080fb100; + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08081f82: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void CleanupField(TCreature *cr) + +{ + bool bVar1; + int y; + int iVar2; + undefined4 *puVar3; + char *Text; + undefined1 local_1c [16]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fb140; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08082016 to 08082124 has its CatchHandler @ 08082130 + bVar1 = CheckRight(cr->ID,CLEANUP_FIELDS); + if (!bVar1) { + return; + } + iVar2 = cr->Direction; + if (iVar2 == 1) { + iVar2 = cr->posy; + y = cr->posx + 1; + } + else { + if (iVar2 < 2) { + if (iVar2 != 0) { + return; + } + iVar2 = cr->posy + -1; + } + else { + if (iVar2 != 2) { + if (iVar2 != 3) { + return; + } + iVar2 = cr->posy; + y = cr->posx + -1; + goto LAB_08082065; + } + iVar2 = cr->posy + 1; + } + y = cr->posx; + } +LAB_08082065: + GetMapContainer((int)local_1c,y,iVar2); + CleanupField(); + return; + } + Text = "CleanupField: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void Teleport(TCreature *cr,char *Param) + +{ + bool bVar1; + ushort HouseID; + int iVar2; + undefined4 *puVar3; + TConnection *Connection; + Object *Obj_00; + char *pcVar4; + int *piVar5; + Object *Ignore; + int local_68; + int x; + int y; + int z; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + if (cr == (TCreature *)0x0) { + pcVar4 = &DAT_080fb260; + } + else if (Param == (char *)0x0) { + pcVar4 = "Teleport: Param ist NULL.\n"; + } + else { + if (cr->Type == PLAYER) { + local_3c[0].ObjectID = (cr->CrObject).ObjectID; + local_2c = local_3c[0].ObjectID; + // try { // try from 080821ad to 0808270f has its CatchHandler @ 08082740 + GetObjectCoordinates(local_3c,&local_68,&x,&y); + iVar2 = stricmp(Param,"up",-1); + if (iVar2 != 0) { + iVar2 = stricmp(Param,"down",-1); + if (iVar2 == 0) { + bVar1 = CheckRight(cr->ID,TELEPORT_VERTICAL); + if (!bVar1) { + return; + } + y = y + 1; + bVar1 = SearchFreeField(&local_68,&x,&y,1,0xffff,true); + if (!bVar1) goto LAB_080822b7; + z = NONE.ObjectID; + GetMapContainer((int)local_4c,local_68,x); + } + else { + iVar2 = stricmp(Param,"fast",-1); + if (iVar2 == 0) { + bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); + if (!bVar1) { + return; + } + iVar2 = 100; +LAB_080823f2: + TSkill::SetMDAct((cr->super_TSkillBase).Skills[4],iVar2); + AnnounceChangedCreature(cr->ID,4); + z = local_2c; + GraphicalEffect((Object *)&z,0xd); + return; + } + iVar2 = stricmp(Param,"fastest",-1); + if (iVar2 == 0) { + bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); + if (!bVar1) { + return; + } + iVar2 = 200; + goto LAB_080823f2; + } + iVar2 = stricmp(Param,"slow",-1); + if ((iVar2 == 0) || (iVar2 = stricmp(Param,"normal",-1), iVar2 == 0)) { + bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); + if (!bVar1) { + return; + } + iVar2 = 0; + goto LAB_080823f2; + } + piVar5 = &x; + iVar2 = sscanf(Param,"%d,%d,%d",&local_68,piVar5,&y); + if (iVar2 == 3) { +LAB_08082630: + bVar1 = CheckRight(cr->ID,TELEPORT_TO_COORDINATE); + if (!bVar1) { + return; + } + if ((((local_68 < 1) || (x < 1)) || (y < 1)) || + (bVar1 = IsOnMap(local_68,x,y), !bVar1)) { + bVar1 = IsOnMap(local_68 + cr->posx,x + cr->posy,y + cr->posz); + if (!bVar1) { + Connection = cr->Connection; + pcVar4 = "Invalid coordinates."; +LAB_0808257b: + SendMessage(Connection,0x17,pcVar4,piVar5); + return; + } + x = x + cr->posy; + local_68 = local_68 + cr->posx; + y = y + cr->posz; + } + HouseID = 0xffff; + } + else { + piVar5 = &x; + iVar2 = sscanf(Param,"[%d,%d,%d]",&local_68,piVar5,&y); + if (iVar2 == 3) goto LAB_08082630; + bVar1 = CheckRight(cr->ID,TELEPORT_TO_MARK); + if (!bVar1) { + return; + } + piVar5 = &y; + bVar1 = GetMarkPosition(); + if (!bVar1) { + Connection = cr->Connection; + pcVar4 = "There is no mark of this name."; + goto LAB_0808257b; + } + HouseID = GetHouseID(local_68,x,y); + } + bVar1 = SearchFreeField(&local_68,&x,&y,1,HouseID,true); + if (!bVar1) goto LAB_080822b7; + z = NONE.ObjectID; + GetMapContainer((int)local_4c,local_68,x); + } + Ignore = (Object *)&z; + Obj_00 = local_3c; + local_3c[0].ObjectID = local_2c; +LAB_08082285: + Move(0,Obj_00,local_4c,-1,false,Ignore); + GraphicalEffect(); + return; + } + bVar1 = CheckRight(cr->ID,TELEPORT_VERTICAL); + if (!bVar1) { + return; + } + y = y + -1; + bVar1 = SearchFreeField(&local_68,&x,&y,1,0xffff,true); + if (bVar1) { + local_3c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_4c,local_68,x); + Obj_00 = (Object *)&z; + Ignore = local_3c; + z = local_2c; + goto LAB_08082285; + } +LAB_080822b7: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 4; + goto LAB_080822c9; + } + pcVar4 = "Teleport: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(pcVar4); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080822c9: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void TeleportToCreature(TCreature *cr,char *Name) + +{ + bool bVar1; + ushort HouseID; + int Result; + int iVar2; + undefined4 *puVar3; + char *Text; + int iVar4; + int local_6c; + int x; + int y; + int z; + TPlayer *dest; + Object local_4c [4]; + Object local_3c [4]; + TPlayer *local_2c; + Object Obj; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fb360; + } + else if (cr->Type == PLAYER) { + // try { // try from 0808279f to 080829de has its CatchHandler @ 08082a36 + bVar1 = CheckRight(cr->ID,TELEPORT_TO_CHARACTER); + if (!bVar1) { + return; + } + if ((Name == (char *)0x0) || (*Name == '\0')) { + SendMessage(cr->Connection,0x17,"You must enter a name."); + return; + } + local_2c = (TPlayer *)0x0; + bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); + iVar2 = IdentifyPlayer(Name,false,!bVar1,(TPlayer **)&z); + if (iVar2 == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + goto LAB_080829a6; + } + if (iVar2 < 0) { + if (iVar2 == -2) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + goto LAB_080829a6; + } + } + else if (iVar2 == 0) { + local_4c[0].ObjectID = (cr->CrObject).ObjectID; + local_3c[0].ObjectID = local_4c[0].ObjectID; + local_2c = (TPlayer *)local_4c[0].ObjectID; + if (cr == (TCreature *)z) { + GraphicalEffect(local_4c,0xb); + return; + } + GraphicalEffect(local_4c,3); + local_6c = *(int *)(z + 0x270); + x = *(int *)(z + 0x274); + y = *(int *)(z + 0x278); + HouseID = GetHouseID(local_6c,x,y); + bVar1 = SearchFreeField(&local_6c,&x,&y,1,HouseID,true); + if ((bVar1) || (iVar2 = x, iVar4 = y, bVar1 = IsProtectionZone(), !bVar1)) { + local_4c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_3c,local_6c,x); + dest = local_2c; + Move(0,(Object *)&dest,local_3c,-1,false,local_4c); + GraphicalEffect(); + Log("banish","%s teleportiert sich zu %s.\n",cr->Name,z + 0x214); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4,iVar2,iVar4); + *puVar3 = 4; + goto LAB_080829a6; + } + Text = &DAT_080fb2a0; + } + else { + Text = "TeleportToCreature: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080829a6: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void TeleportPlayerToMe(TCreature *cr,char *Name) + +{ + bool bVar1; + ushort HouseID; + int Result; + int iVar2; + undefined4 *puVar3; + char *Text; + int local_6c; + int x; + int y; + int z; + TPlayer *dest; + Object local_4c [4]; + Object local_3c [4]; + TPlayer *local_2c; + Object Obj; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fb460; + } + else if (cr->Type == PLAYER) { + // try { // try from 08082a8f to 08082c5e has its CatchHandler @ 08082cb6 + bVar1 = CheckRight(cr->ID,RETRIEVE); + if (!bVar1) { + return; + } + if ((Name == (char *)0x0) || (*Name == '\0')) { + SendMessage(cr->Connection,0x17,"You must enter a name."); + return; + } + local_2c = (TPlayer *)0x0; + bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); + iVar2 = IdentifyPlayer(Name,false,!bVar1,(TPlayer **)&z); + if (iVar2 == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + goto LAB_08082c3b; + } + if (iVar2 < 0) { + if (iVar2 == -2) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + goto LAB_08082c3b; + } + } + else if (iVar2 == 0) { + local_4c[0].ObjectID = *(undefined4 *)(z + 0x2d0); + local_3c[0].ObjectID = local_4c[0].ObjectID; + local_2c = (TPlayer *)local_4c[0].ObjectID; + GraphicalEffect(local_4c,3); + local_6c = cr->posx; + x = cr->posy; + y = cr->posz; + HouseID = GetHouseID(local_6c,x,y); + bVar1 = SearchFreeField(&local_6c,&x,&y,1,HouseID,false); + if (bVar1) { + local_4c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_3c,local_6c,x); + dest = local_2c; + Move(0,(Object *)&dest,local_3c,-1,false,local_4c); + GraphicalEffect(); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 4; + goto LAB_08082c3b; + } + Text = &DAT_080fb3a0; + } + else { + Text = "TeleportPlayerToMe: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08082c3b: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MagicRope(void) + +{ + bool bVar1; + undefined4 *puVar2; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int iVar3; + undefined4 uVar4; + int local_58; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c [4]; + ulong local_1c; + Object Obj; + + if (in_stack_00000004 == (TCreature *)0x0) { + error(&DAT_080fb4a0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + } + else { + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + local_1c = local_2c[0].ObjectID; + // try { // try from 08082d0e to 08082e18 has its CatchHandler @ 08082e30 + GetObjectCoordinates(local_2c,&local_58,&x,&y); + uVar4 = 0x32; + iVar3 = x; + bVar1 = CoordinateFlag(); + if (bVar1) { + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + local_2c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_3c,local_58,x + 1); + z = local_1c; + Move(0,(Object *)&z,local_3c,-1,false,local_2c); + GraphicalEffect(); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4,iVar3,y,uVar4); + *puVar2 = 1; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MagicClimbing(void) + +{ + bool bVar1; + int iVar2; + undefined4 *puVar3; + int dz; + int iVar4; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + char *in_stack_00000010; + char *Text; + int *x_00; + int *y_00; + int *z_00; + int *local_70; + int dy; + int dx; + int x; + int y; + int z; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fb520; + } + else { + if (in_stack_00000010 != (char *)0x0) { + local_3c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + x_00 = &dx; + z_00 = &y; + y_00 = &x; + local_2c = local_3c[0].ObjectID; + // try { // try from 08082e99 to 08083153 has its CatchHandler @ 08083174 + GetObjectCoordinates(local_3c,x_00,y_00,z_00); + iVar4 = y; + dy = dx; + local_70 = (int *)x; + iVar2 = in_stack_00000004->Direction; + if (iVar2 == 1) { + dy = dx + 1; + } + else if (iVar2 < 2) { + if (iVar2 == 0) { + local_70 = (int *)(x + -1); + } + } + else if (iVar2 == 2) { + local_70 = (int *)(x + 1); + } + else if (iVar2 == 3) { + dy = dx + -1; + } + if (y < 1) { +LAB_08082f00: + if (y < 0xf) { + y_00 = (int *)0xffffffff; + x_00 = (int *)&DAT_080fdfc1; + iVar2 = stricmp(in_stack_00000010,"down",-1); + if (iVar2 == 0) { + z_00 = (int *)0x0; + x_00 = local_70; + y_00 = (int *)y; + bVar1 = CoordinateFlag(); + if (!bVar1) { + z_00 = (int *)0x20; + x_00 = local_70; + y_00 = (int *)y; + bVar1 = CoordinateFlag(); + if (!bVar1) { + z_00 = (int *)(y + 1); + x_00 = (int *)dy; + y_00 = local_70; + iVar2 = (*in_stack_00000004->_vptr_TCreature[3])(); + if ((char)iVar2 != '\0') { + iVar4 = iVar4 + 1; + goto LAB_08082f09; + } + } + } + goto LAB_08082fb4; + } + } +LAB_08082f09: + if (y != iVar4) { + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + local_3c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_4c,dy,(int)local_70); + z = local_2c; + Move(0,(Object *)&z,local_4c,-1,false,local_3c); + GraphicalEffect(); + return; + } + } + else { + y_00 = (int *)0xffffffff; + x_00 = (int *)&DAT_080fdfbe; + iVar2 = stricmp(in_stack_00000010,"up",-1); + if (iVar2 != 0) goto LAB_08082f00; + z_00 = (int *)0x0; + y_00 = (int *)(y + -1); + x_00 = (int *)x; + bVar1 = CoordinateFlag(); + if (!bVar1) { + z_00 = (int *)0x20; + y_00 = (int *)(y + -1); + bVar1 = CoordinateFlag(); + x_00 = (int *)x; + if (!bVar1) { + z_00 = (int *)(y + -1); + x_00 = (int *)dy; + y_00 = local_70; + iVar2 = (*in_stack_00000004->_vptr_TCreature[3])(); + if ((char)iVar2 != '\0') { + iVar4 = iVar4 + -1; + goto LAB_08082f00; + } + } + } + } +LAB_08082fb4: + puVar3 = (undefined4 *)__cxa_allocate_exception(4,x_00,y_00,z_00); + *puVar3 = 1; + goto LAB_08082fc6; + } + Text = &DAT_080fb4e0; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08082fc6: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void MagicClimbing(TCreature *cr,char *Direction) + +{ + bool bVar1; + undefined4 *puVar2; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fb520; + } + else if (Direction == (char *)0x0) { + Text = &DAT_080fb4e0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080831cd to 08083233 has its CatchHandler @ 08083246 + bVar1 = CheckRight(cr->ID,LEVITATE); + if (bVar1) { + MagicClimbing(); + } + return; + } + Text = "MagicClimbing: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void CreateThing(TCreature *cr,char *Param1,char *Param2) + +{ + bool bVar1; + bool bVar2; + int iVar3; + TConnection *Connection; + undefined4 *puVar4; + char *pcVar5; + int local_60; + int Count; + Object Con; + Object local_4c [4]; + ObjectType local_3c [4]; + ObjectType local_2c; + ObjectType Type; + + if (cr == (TCreature *)0x0) { + pcVar5 = &DAT_080fb720; +LAB_08083596: + error(pcVar5); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); + } + if (Param1 == (char *)0x0) { + pcVar5 = &DAT_080fb6e0; + goto LAB_08083596; + } + if (cr->Type != PLAYER) { + pcVar5 = "CreateThing: Zauberspruch kann nur von Spielern angewendet werden.\n"; + goto LAB_08083596; + } + // try { // try from 080832a7 to 080835c4 has its CatchHandler @ 080835d7 + bVar1 = CheckRight(cr->ID,CREATE_OBJECTS); + if (!bVar1) { + return; + } + ObjectType::setTypeID(&local_2c,0); + local_60 = 1; + iVar3 = __strtol_internal(Param1,0,10,0); + if (iVar3 == 0) { + GetObjectTypeByName((char *)local_4c,SUB41(Param1,0)); + } + else { + iVar3 = __strtol_internal(Param1,0,10,0); + bVar1 = false; + ObjectType::setTypeID(local_3c,99); + if ((local_3c[0].TypeID < iVar3) && (bVar2 = ObjectTypeExists(iVar3), bVar2)) { + bVar1 = true; + } + if (bVar1) { + ObjectType::setTypeID((ObjectType *)&Count,iVar3); + ObjectType::setTypeID(&local_2c,Count); + ObjectType::setTypeID((ObjectType *)local_4c,local_2c.TypeID); + } + bVar1 = ObjectType::getFlag(&local_2c,UNMOVE); + if (!bVar1) goto LAB_08083369; + ObjectType::setTypeID((ObjectType *)local_4c,0); + } + ObjectType::setTypeID(&local_2c,local_4c[0].ObjectID); + ObjectType::setTypeID((ObjectType *)&Count,local_2c.TypeID); +LAB_08083369: + ObjectType::setTypeID((ObjectType *)&Count,0); + if (local_2c.TypeID == Count) { + Connection = cr->Connection; + pcVar5 = "There is no such takeable object."; + } + else { + if (Param2 != (char *)0x0) { + local_60 = __strtol_internal(Param2,0,10,0); + } + if (local_60 - 1U < 100) { + bVar1 = ObjectType::getFlag(&local_2c,TAKE); + if ((bVar1) || (local_60 == 1)) { + local_4c[0].ObjectID = (cr->CrObject).ObjectID; + GetMapContainer((Object *)&Count); + bVar1 = ObjectType::getFlag(&local_2c,CUMULATIVE); + if (bVar1) { + ObjectType::setTypeID(local_3c,local_2c.TypeID); + CreateAtCreature((ulong)local_4c,(ObjectType *)cr->ID,(ulong)local_3c); + } + else { + iVar3 = 0; + if (0 < local_60) { + do { + ObjectType::setTypeID(local_3c,local_2c.TypeID); + CreateAtCreature((ulong)local_4c,(ObjectType *)cr->ID,(ulong)local_3c); + iVar3 = iVar3 + 1; + } while (iVar3 < local_60); + } + } + local_4c[0].ObjectID = Count; + GraphicalEffect(local_4c,0xf); + return; + } + Connection = cr->Connection; + pcVar5 = "You may only create one untakeable object."; + } + else { + Connection = cr->Connection; + pcVar5 = "You may only create 1 to 100 objects."; + } + } + SendMessage(Connection,0x17,pcVar5); + return; +} + + + +void CreateMoney(TCreature *cr,char *Param) + +{ + bool bVar1; + int iVar2; + undefined4 *puVar3; + char *Text; + Object local_4c [4]; + ulong local_3c [4]; + Object local_2c; + Object Con; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fb840; + } + else if (Param == (char *)0x0) { + Text = &DAT_080fb800; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08083634 to 08083816 has its CatchHandler @ 08083830 + bVar1 = CheckRight(cr->ID,CREATE_MONEY); + if (bVar1) { + iVar2 = __strtol_internal(Param,0,10,0); + if (iVar2 - 1U < 1000000) { + local_3c[0] = (cr->CrObject).ObjectID; + GetMapContainer(&local_2c); + if (0 < iVar2 / 10000) { + GetSpecialObject((SPECIALMEANING)local_4c); + CreateAtCreature((ulong)local_3c,(ObjectType *)cr->ID,(ulong)local_4c); + } + if (0 < (iVar2 % 10000) / 100) { + GetSpecialObject((SPECIALMEANING)local_3c); + CreateAtCreature((ulong)local_4c,(ObjectType *)cr->ID,(ulong)local_3c); + } + if (0 < iVar2 % 100) { + GetSpecialObject((SPECIALMEANING)local_3c); + CreateAtCreature((ulong)local_4c,(ObjectType *)cr->ID,(ulong)local_3c); + } + local_4c[0].ObjectID = local_2c.ObjectID; + GraphicalEffect(local_4c,0xf); + } + else { + SendMessage(cr->Connection,0x17,"You may only create 1 to 1,000,000 gold."); + } + } + return; + } + Text = "CreateMoney: Zauberspruch kann nur von Spieler angewendet werden.\n"; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateFood(void) + +{ + int iVar1; + int iVar2; + ObjectType *this; + undefined4 *puVar3; + int i; + int iVar4; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + uchar Number; + int max; + ObjectType local_3c [4]; + ObjectType local_2c; + ObjectType Type; + + if (in_stack_00000004 == (TCreature *)0x0) { + error(&DAT_080fb880); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + // try { // try from 08083883 to 08083a64 has its CatchHandler @ 08083a65 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + iVar1 = rand(); + iVar1 = iVar1 % 2 + 1; + iVar4 = 0; + if (0 < iVar1) { + do { + ObjectType::setTypeID(&local_2c,0); + iVar2 = rand(); + switch(iVar2 % 7) { + case 0: + GetNewObjectType((uchar)&max,0x86); + ObjectType::setTypeID(&local_2c,max); + this = local_3c; + goto LAB_0808392c; + case 1: + goto LAB_080839b1; + case 2: + Number = 0x88; + break; + case 3: +LAB_080839b1: + Number = 0x82; + break; + case 4: + goto LAB_08083a09; + case 5: +LAB_08083a09: + Number = 0x83; + break; + case 6: + Number = 0x86; + break; + default: + goto switchD_080838ee_default; + } + GetNewObjectType((uchar)local_3c,Number); + ObjectType::setTypeID(&local_2c,local_3c[0].TypeID); + this = (ObjectType *)&max; +LAB_0808392c: + ObjectType::setTypeID(this,local_2c.TypeID); +switchD_080838ee_default: + ObjectType::setTypeID(local_3c,local_2c.TypeID); + CreateAtCreature((ulong)&max,(ObjectType *)in_stack_00000004->ID,(ulong)local_3c); + iVar4 = iVar4 + 1; + } while (iVar4 < iVar1); + } + max = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect((Object *)&max,0xf); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreateArrows(void) + +{ + undefined4 *puVar1; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + undefined4 in_stack_00000010; + Object *this; + Object local_4c [4]; + Object local_3c [4]; + ObjectType local_2c; + ObjectType Type; + + if (in_stack_00000004 == (TCreature *)0x0) { + error(&DAT_080fb900); +LAB_08083bee: + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); + } + // try { // try from 08083ab6 to 08083c23 has its CatchHandler @ 08083c26 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + ObjectType::setTypeID(&local_2c,0); + switch(in_stack_00000010) { + case 0: + GetNewObjectType((uchar)local_4c,'^'); + ObjectType::setTypeID(&local_2c,local_4c[0].ObjectID); + this = local_3c; + goto LAB_08083b18; + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + default: + error(&DAT_080fb8c0); + goto LAB_08083bee; + } + GetNewObjectType((uchar)local_3c,'^'); + ObjectType::setTypeID(&local_2c,local_3c[0].ObjectID); + this = local_4c; +LAB_08083b18: + ObjectType::setTypeID((ObjectType *)this,local_2c.TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,local_2c.TypeID); + CreateAtCreature((ulong)local_4c,(ObjectType *)in_stack_00000004->ID,(ulong)local_3c); + local_4c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_4c,0xd); + return; +} + + + +void SummonCreature(TCreature *cr,int Mana,int Race,bool God) + +{ + bool bVar1; + ulong Father; + int iVar2; + undefined4 *puVar3; + int Delay; + int iStack_28; + bool God_local; + int posx; + int posy; + int posz; + + if (cr == (TCreature *)0x0) { + error(&DAT_080fb980); + } + else { + if (Race - 1U < 0x1ff) { + if (God) { + bVar1 = CheckRight(cr->ID,CREATE_MONSTERS); + if (!bVar1) { + return; + } + } + else { + if (((cr->Type == PLAYER) && (bVar1 = CheckRight(cr->ID,CREATE_MONSTERS), !bVar1)) + && (bVar1 = GetRaceNoSummon(Race), bVar1)) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + goto LAB_08083d9d; + } + if (((!God) && (cr->Type == PLAYER)) && (1 < cr->SummonedCreatures)) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x38; + goto LAB_08083d9d; + } + } + iStack_28 = cr->posx; + posx = cr->posy; + posy = cr->posz; + // try { // try from 08083cd8 to 08083e67 has its CatchHandler @ 08083e70 + bVar1 = SearchSummonField(&stack0xffffffd8,&posx,&posy,2); + if (bVar1) { + if (!God) { + iVar2 = GetRaceSummonCost(Race); + Delay = 1000; + if (WorldType != PVP_ENFORCED) { + Delay = 2000; + } + CheckMana(cr,iVar2 + Mana,0,Delay); + } + Father = 0; + if (!God) { + Father = cr->ID; + } + CreateMonster(Race,iStack_28,posx,posy,0,Father,true); + posz = (cr->CrObject).ObjectID; + GraphicalEffect((Object *)&posz,0xd); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 4; + goto LAB_08083d9d; + } + error(&DAT_080fb940,Race); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08083d9d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: God_local + +void SummonCreature(TCreature *cr,int Mana,char *RaceName,bool God) + +{ + char *pcVar1; + int iVar2; + undefined4 *puVar3; + int i; + int Race_00; + int Race; + int Race_01; + bool God_local; + + if (cr == (TCreature *)0x0) { + pcVar1 = &DAT_080fb980; + } + else { + if (RaceName != (char *)0x0) { + Race_00 = 1; + do { + // try { // try from 08083ec6 to 08083f54 has its CatchHandler @ 08083f72 + pcVar1 = GetRaceName(Race_00); + iVar2 = stricmp(RaceName,pcVar1,-1); + Race_01 = Race_00; + if (iVar2 == 0) break; + Race_00 = Race_00 + 1; + Race_01 = 0; + } while (Race_00 < 0x200); + if (Race_01 != 0) { + SummonCreature(cr,Mana,Race_01,God); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x19; + goto LAB_08083f2d; + } + pcVar1 = &DAT_080fb9c0; + } + error(pcVar1); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08083f2d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void StartMonsterraid(TCreature *cr,char *RaidName) + +{ + bool bVar1; + undefined4 *puVar2; + char *Text; + Object local_102c [4]; + char local_101c [4]; + char FileName [4096]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fba40; + } + else { + if (RaidName != (char *)0x0) { + // try { // try from 08083fc9 to 0808403f has its CatchHandler @ 08084130 + bVar1 = CheckRight(cr->ID,CREATE_MONSTERS); + if (bVar1) { + strLower(RaidName); + snprintf(local_101c,0x1000,"%s/%s.evt",MONSTERPATH,RaidName); + bVar1 = FileExists(local_101c); + if (bVar1) { + // try { // try from 0808406e to 08084094 has its CatchHandler @ 080840d9 + LoadMonsterRaid(local_101c,RoundNr,(bool *)0x0,(int *)0x0,(int *)0x0,(int *)0x0) + ; + local_102c[0].ObjectID = (cr->CrObject).ObjectID; + GraphicalEffect(local_102c,0xd); + } + else { + local_102c[0].ObjectID = (cr->CrObject).ObjectID; + GraphicalEffect(local_102c,3); + } + } + return; + } + Text = &DAT_080fba00; + } + // try { // try from 080840a1 to 080840cf has its CatchHandler @ 08084130 + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RaiseDead(void) + +{ + bool bVar1; + uint uVar2; + undefined4 *puVar3; + ulong uVar4; + int Delay; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + int *y_00; + int *z_00; + int local_48; + int x; + int y; + int z; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbac0; + } + else { + // try { // try from 08084160 to 080843fa has its CatchHandler @ 08084420 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&local_48,&x,&y); + if (y == in_stack_00000004->posz) { + uVar2 = local_48 - in_stack_00000004->posx; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 2) { + uVar2 = x - in_stack_00000004->posy; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 2) { + GetFirstObject(); + in_stack_00000008->ObjectID = z; + local_2c[0].ObjectID = NONE.ObjectID; + if (z != NONE.ObjectID) { + do { + z = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,CORPSE); + if (bVar1) { + Object::getObjectType((Object *)&z); + uVar4 = ObjectType::getAttribute((ObjectType *)&z,CORPSETYPE); + if (uVar4 == 1) break; + } + Object::getNextObject(local_2c); + in_stack_00000008->ObjectID = local_2c[0].ObjectID; + bVar1 = local_2c[0].ObjectID != NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + } while (bVar1); + } + z = NONE.ObjectID; + if (in_stack_00000008->ObjectID == NONE.ObjectID) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1d; + } + else { + z_00 = &y; + y_00 = &x; + bVar1 = SearchFreeField(&local_48,y_00,z_00,1,0,false); + if ((bVar1) && + (y_00 = (int *)x, z_00 = (int *)y, bVar1 = IsProtectionZone(), !bVar1 + )) { + Delay = 1000; + if (WorldType != PVP_ENFORCED) { + Delay = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010, + Delay); + z = in_stack_00000008->ObjectID; + Delete((Object *)&z,-1); + CreateMonster(0x21,local_48,x,y,0,in_stack_00000004->ID,true); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4,y_00,z_00); + *puVar3 = 4; + } + goto LAB_08084322; + } + } + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 5; + goto LAB_08084322; + } + Text = &DAT_080fba80; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08084322: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MassRaiseDead(void) + +{ + bool bVar1; + ulong uVar2; + undefined4 *puVar3; + int zx; + int iVar4; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + char *Text; + int dx; + int *local_88; + int dy; + int j; + int i; + int sx; + int sy; + int sz; + int x; + int y; + int z; + ulong local_4c; + Object Help; + Object local_3c; + Object Obj; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbb40; + } + else { + // try { // try from 08084463 to 08084842 has its CatchHandler @ 08084860 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&sz,&x,&y); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,sz,x,y,0); + if (bVar1) { + iVar4 = 1000; + if (WorldType != PVP_ENFORCED) { + iVar4 = 2000; + } + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,iVar4); + if (((in_stack_00000004->posx != sz) || (in_stack_00000004->posy != x)) || + (in_stack_00000004->posz != y)) { + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GetMapContainer((int)&local_3c,sz,x); + Missile(local_2c,&local_3c,5); + } + j = 0; + if (-1 < in_stack_00000014) { + local_88 = &Circle[0].Count; + dx = 0; + do { + dy = 0; + iVar4 = dx; + if (0 < *local_88) { + do { + zx = Circle[0].x[iVar4 + dy] + sz; + iVar4 = Circle[0].y[iVar4 + dy] + x; + bVar1 = ThrowPossible(sz,x,y,zx,iVar4,y,0); + if (bVar1) { + GraphicalEffect(); + GetFirstObject(); + local_4c = NONE.ObjectID; + local_2c[0].ObjectID = local_4c; + if (local_3c.ObjectID != NONE.ObjectID) { + do { + local_4c = local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject((Object *)&z); + local_3c.ObjectID = z; + local_2c[0].ObjectID = z; + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,CORPSE); + if (bVar1) { + Object::getObjectType((Object *)&z); + uVar2 = ObjectType::getAttribute + ((ObjectType *)&z,CORPSETYPE); + if (uVar2 == 1) { + sy = y; + i = zx; + sx = iVar4; + bVar1 = SearchFreeField(&i,&sx,&sy,1,0,false); + if ((bVar1) && + (bVar1 = IsProtectionZone(), !bVar1)) { + z = local_4c; + Delete((Object *)&z,-1); + CreateMonster(0x21,i,sx,sy,0, + in_stack_00000004->ID,false); + } + } + } + local_2c[0].ObjectID = NONE.ObjectID; + local_4c = NONE.ObjectID; + } while (local_3c.ObjectID != NONE.ObjectID); + } + } + dy = dy + 1; + iVar4 = j * 0x41; + } while (dy < *local_88); + } + j = j + 1; + local_88 = local_88 + 0x41; + dx = dx + 0x41; + } while (j <= in_stack_00000014); + } + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 7; + goto LAB_0808481f; + } + Text = &DAT_080fbb00; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0808481f: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void Heal(void) + +{ + TSkill *this; + int iVar1; + undefined4 *puVar2; + TSkill *sk; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + Object local_1c [4]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbbc0; + } + else { + if (WorldType == NON_PVP) { + iVar1 = (*in_stack_00000004->_vptr_TCreature[4])(); + if ((char)iVar1 == '\0') { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 1; + goto LAB_0808496b; + } + } + // try { // try from 080848bd to 0808498a has its CatchHandler @ 080849b0 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + this = (in_stack_00000004->super_TSkillBase).Skills[2]; + if (this != (TSkill *)0x0) { + iVar1 = TSkill::Get(this); + if (0 < iVar1) { + TSkill::Change(this,in_stack_00000010); + if ((in_stack_00000004->super_TSkillBase).Skills[4]->MDAct < 0) { + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + } + local_1c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + } + return; + } + Text = "Heal: Skill HITPOINTS existiert nicht.\n"; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0808496b: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MassHeal(void) + +{ + TSkill *this; + bool bVar1; + TCreature *pTVar2; + int iVar3; + undefined4 *puVar4; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + char *Text; + ulong *puVar5; + int local_78; + int *local_74; + int local_70; + int j; + int i; + int x; + int y; + int z; + ulong local_4c; + Object Help; + Object local_3c; + Object Obj; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbc80; + } + else { + // try { // try from 080849f3 to 08084d1a has its CatchHandler @ 08084d73 + bVar1 = Object::exists(in_stack_00000008); + if (bVar1) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&i,&x,&y); + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,i,x,y,0); + if (bVar1) { + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); + if (((in_stack_00000004->posx != i) || (in_stack_00000004->posy != x)) || + (in_stack_00000004->posz != y)) { + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GetMapContainer((int)&local_3c,i,x); + Missile(local_2c,&local_3c,5); + } + j = 0; + if (-1 < in_stack_00000018) { + local_74 = &Circle[0].Count; + local_78 = 0; + do { + local_70 = 0; + iVar3 = local_78; + if (0 < *local_74) { + do { + bVar1 = ThrowPossible(i,x,y,i + Circle[0].x[iVar3 + local_70], + x + Circle[0].y[iVar3 + local_70],y,0); + if (bVar1) { + GraphicalEffect(); + GetFirstObject(); + local_4c = NONE.ObjectID; + local_2c[0].ObjectID = local_4c; + if (local_3c.ObjectID != NONE.ObjectID) { + do { + puVar5 = &local_4c; + local_4c = local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject((Object *)&z); + local_3c.ObjectID = z; + local_2c[0].ObjectID = z; + Object::getObjectType((Object *)&z); + if (z == 99) { + z = local_4c; + pTVar2 = GetCreature((Object *)&z); + if (pTVar2 == (TCreature *)0x0) { + error(&DAT_080fe061,puVar5); + } + else if ((WorldType != NON_PVP) || + (iVar3 = (*pTVar2->_vptr_TCreature[4]) + (pTVar2), + (char)iVar3 != '\0')) { + this = (pTVar2->super_TSkillBase).Skills[2]; + if (this == (TSkill *)0x0) { + Text = + "MassHeal: Skill HITPOINTS existiert nicht.\n"; + goto LAB_08084ccb; + } + iVar3 = TSkill::Get(this); + if ((0 < iVar3) && + (TSkill::Change(this,in_stack_00000014), + (pTVar2->super_TSkillBase).Skills[4]->MDAct < 0 + )) { + TSkillBase::SetTimer + (&pTVar2->super_TSkillBase); + } + } + } + local_2c[0].ObjectID = NONE.ObjectID; + local_4c = NONE.ObjectID; + } while (local_3c.ObjectID != NONE.ObjectID); + } + } + local_70 = local_70 + 1; + iVar3 = j * 0x41; + } while (local_70 < *local_74); + } + j = j + 1; + local_74 = local_74 + 0x41; + local_78 = local_78 + 0x41; + } while (j <= in_stack_00000018); + } + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 7; + goto LAB_08084ce2; + } + Text = &DAT_080fbc40; + } +LAB_08084ccb: + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08084ce2: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void HealFriend(void) + +{ + TSkill *this; + int iVar1; + uint uVar2; + undefined4 *puVar3; + TSkill *sk; + TCreature *in_stack_00000004; + char *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + char *Text; + TPlayer *local_20; + TPlayer *pl; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbd40; + } + else { + if (in_stack_00000008 != (char *)0x0) { + // try { // try from 08084dc8 to 08084f34 has its CatchHandler @ 08084f83 + iVar1 = IdentifyPlayer(in_stack_00000008,false,true,&local_20); + if (iVar1 == -1) { +LAB_08084eff: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + } + else { + if (iVar1 == -2) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + goto LAB_08084f11; + } + if (in_stack_00000004->posz == (local_20->super_TCreature).posz) { + uVar2 = in_stack_00000004->posx - (local_20->super_TCreature).posx; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 8) { + uVar2 = in_stack_00000004->posy - (local_20->super_TCreature).posy; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + if ((int)uVar2 < 6) { + this = (local_20->super_TCreature).super_TSkillBase.Skills[2]; + if (this == (TSkill *)0x0) { + Text = "HealFriend: Skill HITPOINTS existiert nicht.\n"; + goto LAB_08084f30; + } + iVar1 = TSkill::Get(this); + if (0 < iVar1) { + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000 + ); + TSkill::Change(this,in_stack_00000014); + if ((local_20->super_TCreature).super_TSkillBase.Skills[4]->MDAct < + 0) { + TSkillBase::SetTimer + (&(local_20->super_TCreature).super_TSkillBase); + } + pl = (TPlayer *)(in_stack_00000004->CrObject).ObjectID; + GraphicalEffect((Object *)&pl,0xd); + pl = (TPlayer *)(local_20->super_TCreature).CrObject.ObjectID; + GraphicalEffect((Object *)&pl,0xf); + return; + } + goto LAB_08084eff; + } + } + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 5; + } + goto LAB_08084f11; + } + Text = &DAT_080fbd00; + } +LAB_08084f30: + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08084f11: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RefreshMana(void) + +{ + TSkill *this; + undefined4 *puVar1; + TSkill *sk; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + Object local_1c [5]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbdc0; + } + else { + // try { // try from 08084fcd to 08085040 has its CatchHandler @ 08085050 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + this = (in_stack_00000004->super_TSkillBase).Skills[3]; + if (this != (TSkill *)0x0) { + TSkill::Change(this,in_stack_00000010); + local_1c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + return; + } + Text = "RefreshMana: Skill MANA existiert nicht.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void MagicGoStrength(void) + +{ + TSkill *this; + bool bVar1; + char cVar2; + undefined4 *puVar3; + TSkill *sk; + int mdact; + int iVar4; + TCreature *in_stack_00000004; + int *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + char *Text; + Object local_2c [7]; + + if (in_stack_00000008 == (int *)0x0) { + Text = &DAT_080fbe40; + } + else { + if (in_stack_00000004 != (TCreature *)0x0) { + if (-1 < in_stack_00000014) { +LAB_080850a0: + // try { // try from 080850b9 to 0808522b has its CatchHandler @ 08085250 + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); + this = (TSkill *)in_stack_00000008[5]; + if (in_stack_00000014 < -100) { + iVar4 = -0x14 - this->Act; + } + else { + iVar4 = (this->Act * in_stack_00000014) / 100; + } + TSkill::SetMDAct(this,iVar4); + TSkillBase::SetTimer((TSkillBase *)(in_stack_00000008 + 1)); + if (in_stack_00000014 < 0) { + TCreature::BlockLogout(in_stack_00000004,0x3c,in_stack_00000008[0xa3] == 0); + } + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_2c,0xf); + local_2c[0].ObjectID = in_stack_00000008[0xb4]; + GraphicalEffect(local_2c,0xe); + return; + } + bVar1 = GetRaceNoParalyze(in_stack_00000008[0xa0]); + if (!bVar1) { + if (WorldType == NON_PVP) { + iVar4 = (*in_stack_00000004->_vptr_TCreature[4])(); + if ((char)iVar4 != '\0') { + cVar2 = (**(code **)(*in_stack_00000008 + 0x10))(); + if (cVar2 != '\0') { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x2b; + goto LAB_080851f1; + } + } + } + goto LAB_080850a0; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + goto LAB_080851f1; + } + Text = &DAT_080fbe00; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080851f1: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void Shielding(void) + +{ + undefined4 *puVar1; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + Object local_1c [4]; + + if (in_stack_00000004 != (TCreature *)0x0) { + // try { // try from 0808529f to 0808532a has its CatchHandler @ 08085330 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + local_1c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + return; + } + error(&DAT_080fbe80); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void NegatePoison(void) + +{ + undefined4 *puVar1; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char *Text; + Object local_1c [5]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fbf00; + } + else { + if (in_stack_00000010 != 0) { + // try { // try from 08085384 to 08085414 has its CatchHandler @ 08085420 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + TSkillBase::SetTimer((TSkillBase *)(in_stack_00000010 + 4)); + local_1c[0].ObjectID = *(ulong *)(in_stack_00000010 + 0x2d0); + GraphicalEffect(local_1c,0xd); + return; + } + Text = "NegatePoison: Zielkreatur existiert nicht.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void Enlight(void) + +{ + TSkill *pTVar1; + int iVar2; + undefined4 *puVar3; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + Object local_1c [4]; + + if (in_stack_00000004 != (TCreature *)0x0) { + // try { // try from 08085473 to 08085511 has its CatchHandler @ 08085512 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + pTVar1 = (in_stack_00000004->super_TSkillBase).Skills[0xf]; + iVar2 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if (iVar2 <= in_stack_00000010) { + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + } + local_1c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + return; + } + error(&DAT_080fbf40); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void Invisibility(void) + +{ + undefined4 *puVar1; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + Object local_1c [4]; + + if (in_stack_00000004 != (TCreature *)0x0) { + // try { // try from 08085563 to 080855ff has its CatchHandler @ 08085600 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + (in_stack_00000004->Outfit).field_1.ObjectType = 0; + (in_stack_00000004->Outfit).OutfitID = 0; + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + local_1c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + return; + } + error(&DAT_080fbf80); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CancelInvisibility(void) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + bool bVar2; + bool bVar3; + bool bVar4; + TCreature *pTVar5; + int iVar6; + long lVar7; + ulong uVar8; + undefined4 *puVar9; + TCreature *in_stack_00000004; + Object *in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + char *Text; + int dx; + int local_a0; + int *local_9c; + ulong local_94; + int b; + TCreature *dest; + bool EffectShown; + int dy; + int j; + int i; + int x; + int y; + int z; + Object local_5c; + Object Item; + _func_int_varargs **local_4c; + Object Help; + Object local_3c; + Object Obj; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fc040; + } + else { + // try { // try from 08085643 to 08085bec has its CatchHandler @ 08085c10 + bVar3 = Object::exists(in_stack_00000008); + if (bVar3) { + local_2c[0].ObjectID = in_stack_00000008->ObjectID; + GetObjectCoordinates(local_2c,&i,&x,&y); + bVar3 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,i,x,y,0); + if (bVar3) { + CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); + if (((in_stack_00000004->posx != i) || (in_stack_00000004->posy != x)) || + (in_stack_00000004->posz != y)) { + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GetMapContainer((int)&local_3c,i,x); + Missile(local_2c,&local_3c,5); + } + j = 1; + if (0 < in_stack_00000014) { + local_9c = &Circle[1].Count; + local_a0 = 0x41; + do { + dy = 0; + iVar6 = local_a0; + if (0 < *local_9c) { + do { + bVar3 = ThrowPossible(i,x,y,Circle[0].x[iVar6 + dy] + i, + Circle[0].y[iVar6 + dy] + x,y,0); + if ((bVar3) && (bVar3 = IsProtectionZone(), !bVar3)) { + bVar3 = false; + GetFirstObject(); + if (local_3c.ObjectID != NONE.ObjectID) { + do { + dest = (TCreature *)&local_4c; + local_4c = (_func_int_varargs **)local_3c.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + Object::getNextObject(&local_5c); + local_3c.ObjectID = local_5c.ObjectID; + local_2c[0].ObjectID = local_5c.ObjectID; + Object::getObjectType(&local_5c); + if ((_func_int_varargs **)local_5c.ObjectID == + (_func_int_varargs **)0x63) { + local_5c.ObjectID = (ulong)local_4c; + pTVar5 = GetCreature(&local_5c); + if (pTVar5 == (TCreature *)0x0) { + error(&DAT_080fbfc0,dest); + } + else { + bVar2 = false; + if (((pTVar5->Outfit).OutfitID == 0) && + ((pTVar5->Outfit).field_1.ObjectType == 0)) { + bVar2 = true; + } + if ((bVar2) && + ((WorldType != NON_PVP || + (iVar6 = (*pTVar5->_vptr_TCreature[4]) + (pTVar5), + (char)iVar6 == '\0')))) { + TSkillBase::SetTimer + (&pTVar5->super_TSkillBase); + iVar6 = TSkill::Get((pTVar5-> + super_TSkillBase).Skills[0x10]); + if (iVar6 == 0) { + aVar1 = (pTVar5->OrgOutfit).field_1; + (pTVar5->Outfit).OutfitID = + (pTVar5->OrgOutfit).OutfitID; + (pTVar5->Outfit).field_1 = aVar1; + AnnounceChangedCreature(pTVar5->ID,3); + local_5c.ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = + (pTVar5->CrObject).ObjectID; + NotifyAllCreatures(local_2c,2,&local_5c); + } + else { + GraphicalEffect(); + bVar3 = true; + if (WorldType == PVP_ENFORCED) { + local_94 = 1; + do { + GetBodyObject((ulong)&local_5c, + pTVar5->ID); + bVar2 = false; + local_2c[0].ObjectID = NONE.ObjectID; + z = NONE.ObjectID; + if (local_5c.ObjectID != NONE.ObjectID + ) { + Object::getObjectType + ((Object *)&z); + bVar4 = ObjectType::getFlag(( + ObjectType *)&z,SKILLBOOST); + if (bVar4) { + Object::getObjectType((Object *)&z); + uVar8 = ObjectType::getAttribute + ((ObjectType *)&z, + BODYPOSITION); + if (uVar8 == local_94) { + Object::getObjectType((Object *)&z); + uVar8 = ObjectType::getAttribute + ((ObjectType *)&z, + SKILLNUMBER); + if (uVar8 == 0x10) { + bVar2 = true; + } + } + } + } + if (bVar2) { + lVar7 = random(); + if (lVar7 == 1) { + z = local_5c.ObjectID; + Delete((Object *)&z,-1); + } + break; + } + local_94 = local_94 + 1; + } while ((int)local_94 < 0xb); + } + } + } + } + } + } while (local_3c.ObjectID != NONE.ObjectID); + } + local_4c = (_func_int_varargs **)NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if (!bVar3) { + GraphicalEffect(); + } + } + dy = dy + 1; + iVar6 = j * 0x41; + } while (dy < *local_9c); + } + j = j + 1; + local_9c = local_9c + 0x41; + local_a0 = local_a0 + 0x41; + } while (j <= in_stack_00000014); + } + return; + } + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 7; + goto LAB_08085bc9; + } + Text = &DAT_080fc000; + } + error(Text); + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0xffffffff; +LAB_08085bc9: + // WARNING: Subroutine does not return + __cxa_throw(puVar9,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreatureIllusion(void) + +{ + bool bVar1; + char *pcVar2; + int iVar3; + undefined4 *puVar4; + int i; + int iVar5; + int Race; + int Race_00; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + char *in_stack_00000010; + Object local_3c [6]; + int local_24; + anon_union_4_2_730cd3ca_for_TOutfit_2 local_20; + + if (in_stack_00000004 == (TCreature *)0x0) { + pcVar2 = &DAT_080fc0c0; + } + else { + if (in_stack_00000010 != (char *)0x0) { + iVar5 = 1; + do { + // try { // try from 08085c5f to 08085db2 has its CatchHandler @ 08085dd0 + pcVar2 = GetRaceName(iVar5); + iVar3 = stricmp(in_stack_00000010,pcVar2,-1); + Race_00 = iVar5; + if (iVar3 == 0) break; + iVar5 = iVar5 + 1; + Race_00 = 0; + } while (iVar5 < 0x200); + if (Race_00 == 0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x19; + } + else { + bVar1 = GetRaceNoIllusion(Race_00); + if (!bVar1) { + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + iVar5 = TSkill::Get((in_stack_00000004->super_TSkillBase).Skills[0x10]); + if (iVar5 == 0) { + GetRaceOutfit((int)&local_24); + (in_stack_00000004->Outfit).OutfitID = local_24; + (in_stack_00000004->Outfit).field_1 = local_20; + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + } + local_3c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_3c,0xd); + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + } + goto LAB_08085d6e; + } + pcVar2 = &DAT_080fc080; + } + error(pcVar2); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08085d6e: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ObjectIllusion(void) + +{ + bool bVar1; + int iVar2; + ulong uVar3; + undefined4 *puVar4; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + Object *in_stack_00000010; + char *Text; + Object local_2c [7]; + + if (in_stack_00000004 == (TCreature *)0x0) { + Text = &DAT_080fc140; + } + else { + // try { // try from 08085e10 to 08085f85 has its CatchHandler @ 08085fa3 + bVar1 = Object::exists(in_stack_00000010); + if (bVar1) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 99) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,UNMOVE); + if (!bVar1) { + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + iVar2 = TSkill::Get((in_stack_00000004->super_TSkillBase).Skills[0x10]); + if (iVar2 == 0) { + (in_stack_00000004->Outfit).OutfitID = 0; + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,DISGUISE); + if (bVar1) { + Object::getObjectType(local_2c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_2c,DISGUISETARGET); + local_2c[0].ObjectID._0_2_ = (ushort)uVar3; + } + else { + Object::getObjectType(local_2c); + } + (in_stack_00000004->Outfit).field_1.ObjectType = + (ushort)local_2c[0].ObjectID; + TSkillBase::SetTimer(&in_stack_00000004->super_TSkillBase); + } + local_2c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_2c,0xd); + return; + } + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 2; + goto LAB_08085f62; + } + Text = &DAT_080fc100; + } + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08085f62: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void ChangeData(TCreature *cr,char *Param) + +{ + bool bVar1; + uint Value; + char *pcVar2; + undefined4 *puVar3; + INSTANCEATTRIBUTE Attribute; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + ulong local_3c; + Object Obj2; + ulong local_2c; + Object Obj; + + if (cr == (TCreature *)0x0) { + pcVar2 = &DAT_080fc260; + } + else if (Param == (char *)0x0) { + pcVar2 = &DAT_080fc220; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08086004 to 080863b4 has its CatchHandler @ 080863c7 + bVar1 = CheckRight(cr->ID,CREATE_OBJECTS); + if (bVar1) { + GetBodyObject((ulong)&local_2c,cr->ID); + GetBodyObject((ulong)&local_3c,cr->ID); + bVar1 = false; + local_4c[0].ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + if ((local_2c != NONE.ObjectID) && + (local_6c[0].ObjectID = NONE.ObjectID, local_3c != NONE.ObjectID)) { + bVar1 = true; + } + if (bVar1) { + SendMessage(cr->Connection,0x17,"First drop one object."); + } + else { + if (local_3c != NONE.ObjectID) { + local_4c[0].ObjectID = local_3c; + local_2c = local_3c; + } + local_6c[0].ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = local_4c[0].ObjectID; + if (local_2c == NONE.ObjectID) { + GetFirstObject(); + local_2c = local_4c[0].ObjectID; + bVar1 = local_4c[0].ObjectID != NONE.ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (bVar1) { + do { + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,KEYDOOR); + if (bVar1) break; + Object::getNextObject(local_4c); + local_2c = local_4c[0].ObjectID; + local_5c[0] = (Object)NONE.ObjectID; + bVar1 = local_4c[0].ObjectID != NONE.ObjectID; + local_4c[0].ObjectID = local_5c[0].ObjectID; + } while (bVar1); + } + } + if (local_2c != NONE.ObjectID) { + local_6c[0].ObjectID = NONE.ObjectID; + Value = __strtol_internal(Param,0,10,0); + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,LIQUIDCONTAINER); + if (bVar1) { + Attribute = CONTAINERLIQUIDTYPE; + } + else { + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,KEY); + if ((bVar1) && (Value != 0)) { + Attribute = KEYNUMBER; + } + else { + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,KEYDOOR); + if ((bVar1) && (Value != 0)) { + Attribute = KEYHOLENUMBER; + } + else { + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,CUMULATIVE); + if (((bVar1) && (Value != 0)) && (Value < 0x65)) { + Attribute = AMOUNT; + } + else { + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,RUNE); + if (((!bVar1) || (Value == 0)) || (99 < Value)) { + local_6c[0].ObjectID = local_2c; + pcVar2 = GetName(local_6c); + SendMessage(cr->Connection,0x17, + "You can\'t change %s in this way.",pcVar2); + return; + } + Attribute = CHARGES; + } + } + } + } + local_6c[0].ObjectID = local_2c; + Change(local_6c,Attribute,Value); + local_6c[0].ObjectID = (cr->CrObject).ObjectID; + GraphicalEffect(local_6c,0xf); + } + } + } + return; + } + pcVar2 = "ChangeData: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(pcVar2); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void EnchantObject(void) + +{ + bool bVar1; + undefined4 *puVar2; + bool bVar3; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int *in_stack_00000010; + int *in_stack_00000014; + ulong Position; + undefined4 uVar4; + Object local_9c [4]; + Object local_8c [4]; + ulong local_7c [4]; + Object local_6c [4]; + ObjectType local_5c [4]; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + Object Obj; + + if (in_stack_00000004 == (TCreature *)0x0) { + error(&DAT_080fc2a0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + goto LAB_08086535; + } + // try { // try from 08086418 to 080865e9 has its CatchHandler @ 08086601 + GetBodyObject((ulong)&local_2c,in_stack_00000004->ID); + bVar1 = false; + local_3c = NONE.ObjectID; + if (local_2c == NONE.ObjectID) { +LAB_08086438: + bVar1 = true; + } + else { + Object::getObjectType(local_4c); + ObjectType::setTypeID(local_5c,*in_stack_00000010); + ObjectType::setTypeID((ObjectType *)local_6c,local_5c[0].TypeID); + if (local_4c[0].ObjectID != local_6c[0].ObjectID) goto LAB_08086438; + } + if (!bVar1) goto LAB_0808644c; + uVar4 = 6; + Position = in_stack_00000004->ID; + GetBodyObject((ulong)local_7c,Position); + bVar1 = false; + local_2c = local_7c[0]; + bVar3 = local_7c[0] == NONE.ObjectID; + local_6c[0].ObjectID = local_7c[0]; + local_7c[0] = NONE.ObjectID; + if (bVar3) { +LAB_0808650f: + local_8c[0].ObjectID = Position; + bVar1 = true; + } + else { + Object::getObjectType(local_6c); + ObjectType::setTypeID((ObjectType *)local_8c,*in_stack_00000010); + ObjectType::setTypeID((ObjectType *)local_9c,local_8c[0].ObjectID); + Position = local_8c[0].ObjectID; + if (local_6c[0].ObjectID != local_9c[0].ObjectID) goto LAB_0808650f; + } + if (bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,local_8c[0].ObjectID,uVar4); + *puVar2 = 0x22; +LAB_08086535: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } +LAB_0808644c: + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + ObjectType::setTypeID((ObjectType *)local_9c,*in_stack_00000014); + local_8c[0].ObjectID = local_2c; + Change(local_8c,(ObjectType *)local_9c,0); + local_9c[0].ObjectID = (in_stack_00000004->CrObject).ObjectID; + GraphicalEffect(local_9c,0xf); + return; +} + + + +void Convince(TCreature *master,TCreature *slave) + +{ + bool bVar1; + int Mana; + int iVar2; + undefined4 *puVar3; + int Delay; + Object local_2c [7]; + + if (slave->Type == MONSTER) { + if ((master->Type == PLAYER) && (1 < master->SummonedCreatures)) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x38; + goto LAB_08086716; + } + if (WorldType == NON_PVP) { + iVar2 = (*master->_vptr_TCreature[4])(master); + if ((char)iVar2 != '\0') { + iVar2 = (*slave->_vptr_TCreature[4])(slave); + if ((char)iVar2 != '\0') goto LAB_08086750; + } + } + // try { // try from 0808666f to 08086747 has its CatchHandler @ 08086778 + bVar1 = GetRaceNoConvince(slave->Race); + if (!bVar1) { + iVar2 = GetRaceSummonCost(slave->Race); + Delay = 1000; + if (WorldType != PVP_ENFORCED) { + Delay = 2000; + } + CheckMana(master,iVar2,0,Delay); + ConvinceMonster(master,slave); + local_2c[0].ObjectID = (master->CrObject).ObjectID; + GraphicalEffect(local_2c,0xd); + local_2c[0].ObjectID = (slave->CrObject).ObjectID; + GraphicalEffect(local_2c,10); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + } + else { +LAB_08086750: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x2b; + } +LAB_08086716: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void Challenge(void) + +{ + bool bVar1; + TCreature *Monster; + int dy; + int iVar2; + int dx; + int zx; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int iVar3; + ObjectType *pOVar4; + int local_60; + int *local_5c; + int local_54; + int j; + int i; + ObjectType local_3c [4]; + ulong local_2c; + Object Obj; + + // try { // try from 080867b5 to 08086931 has its CatchHandler @ 08086937 + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + j = 0; + if (-1 < in_stack_00000010) { + local_5c = &Circle[0].Count; + local_60 = 0; + do { + local_54 = 0; + iVar2 = local_60; + if (0 < *local_5c) { + do { + zx = in_stack_00000004->posx + Circle[0].x[iVar2 + local_54]; + iVar2 = in_stack_00000004->posy + Circle[0].y[iVar2 + local_54]; + bVar1 = ThrowPossible(in_stack_00000004->posx,in_stack_00000004->posy, + in_stack_00000004->posz,zx,iVar2,in_stack_00000004->posz,0 + ); + if (bVar1) { + GraphicalEffect(); + ObjectType::setTypeID(local_3c,99); + pOVar4 = local_3c; + iVar3 = in_stack_00000004->posz; + GetFirstSpecObject(); + i = NONE.ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + i = local_2c; + Monster = GetCreature((Object *)&i); + if (Monster == (TCreature *)0x0) { + error(&DAT_080fc2e0,zx,iVar2,iVar3,pOVar4); + } + else if (Monster->Type == MONSTER) { + ChallengeMonster(in_stack_00000004,Monster); + } + } + } + local_54 = local_54 + 1; + iVar2 = j * 0x41; + } while (local_54 < *local_5c); + } + j = j + 1; + local_5c = local_5c + 0x41; + local_60 = local_60 + 0x41; + } while (j <= in_stack_00000010); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void FindPerson(void) + +{ + int iVar1; + bool bVar2; + int iVar3; + undefined4 *puVar4; + int *piVar5; + TConnection *pTVar6; + TCreature *in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + char *in_stack_00000010; + char *pcVar7; + char *pcVar8; + int Distance; + int local_34; + TPlayer *local_30; + TPlayer *Opp; + + if (in_stack_00000004 == (TCreature *)0x0) { + pcVar7 = &DAT_080fc440; + } + else if (in_stack_00000010 == (char *)0x0) { + pcVar7 = &DAT_080fc400; + } + else if (in_stack_00000004->Type == PLAYER) { + // try { // try from 08086994 to 08086c19 has its CatchHandler @ 08086cb8 + bVar2 = CheckRight(in_stack_00000004->ID,READ_GAMEMASTER_CHANNEL); + iVar3 = IdentifyPlayer(in_stack_00000010,false,!bVar2,&local_30); + if (iVar3 == -1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1b; + goto LAB_08086c02; + } + if (iVar3 == -2) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1c; + goto LAB_08086c02; + } + if (local_30 != (TPlayer *)0x0) { + CheckMana(in_stack_00000004,in_stack_00000008,in_stack_0000000c,1000); + iVar3 = (local_30->super_TCreature).posx - in_stack_00000004->posx; + local_34 = -iVar3; + if (-1 < iVar3) { + local_34 = iVar3; + } + iVar3 = (local_30->super_TCreature).posy - in_stack_00000004->posy; + Distance = -iVar3; + if (-1 < iVar3) { + Distance = iVar3; + } + piVar5 = &Distance; + if (Distance <= local_34) { + piVar5 = &local_34; + } + iVar1 = *piVar5; + if (iVar1 < 5) { + iVar3 = (local_30->super_TCreature).posz; + if (iVar3 < in_stack_00000004->posz) { + pTVar6 = in_stack_00000004->Connection; + pcVar7 = "%s is above you."; + } + else if (in_stack_00000004->posz < iVar3) { + pTVar6 = in_stack_00000004->Connection; + pcVar7 = "%s is below you."; + } + else { + pTVar6 = in_stack_00000004->Connection; + pcVar7 = "%s is standing next to you."; + } + SendMessage(pTVar6,0x16,pcVar7,(local_30->super_TCreature).Name); + goto LAB_08086a85; + } + iVar3 = Direction((local_30->super_TCreature).posx - in_stack_00000004->posx,iVar3); + switch(iVar3) { + default: + pcVar7 = "FindPerson: Richtung ist Null.\n"; + goto LAB_08086beb; + case 1: + pcVar7 = "east"; + break; + case 2: + pcVar7 = "north-east"; + break; + case 3: + pcVar7 = "north"; + break; + case 4: + pcVar7 = "north-west"; + break; + case 5: + pcVar7 = "west"; + break; + case 6: + pcVar7 = "south-west"; + break; + case 7: + pcVar7 = "south"; + break; + case 8: + pcVar7 = "south-east"; + } + if (iVar1 < 100) { + iVar3 = (local_30->super_TCreature).posz; + if (iVar3 < in_stack_00000004->posz) { + pTVar6 = in_stack_00000004->Connection; + pcVar8 = "%s is on a higher level to the %s."; + } + else if (in_stack_00000004->posz < iVar3) { + pTVar6 = in_stack_00000004->Connection; + pcVar8 = "%s is on a lower level to the %s."; + } + else { + pTVar6 = in_stack_00000004->Connection; + pcVar8 = "%s is to the %s."; + } + SendMessage(pTVar6,0x16,pcVar8,(local_30->super_TCreature).Name,pcVar7); + } + else { + pcVar8 = "very "; + if (iVar1 < 0xfb) { + pcVar8 = ""; + } + SendMessage(in_stack_00000004->Connection,0x16,"%s is %sfar to the %s.", + (local_30->super_TCreature).Name,pcVar8,pcVar7); + } +LAB_08086a85: + Opp = (TPlayer *)(in_stack_00000004->CrObject).ObjectID; + GraphicalEffect((Object *)&Opp,0xd); + return; + } + pcVar7 = "FindPerson: Opp ist NULL.\n"; + } + else { + pcVar7 = "FindPerson: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } +LAB_08086beb: + error(pcVar7); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08086c02: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void GetPosition(TCreature *cr) + +{ + bool bVar1; + undefined4 *puVar2; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc4e0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08086cff to 08086d83 has its CatchHandler @ 08086d90 + bVar1 = CheckRight(cr->ID,SHOW_COORDINATE); + if (bVar1) { + SendMessage(cr->Connection,0x13,"Your position is [%d,%d,%d].",cr->posx,cr->posy, + cr->posz); + } + return; + } + Text = "GetPosition: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void GetQuestValue(TCreature *cr,char *Param) + +{ + bool bVar1; + int Number; + int iVar2; + undefined4 *puVar3; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc5a0; +LAB_08086e9c: + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if (Param == (char *)0x0) { + error("GetQuestValue: Param ist NULL.\n"); + } + else { + if (cr->Type != PLAYER) { + Text = "GetQuestValue: Zauberspruch kann nur von Spielern angewendet werden.\n"; + goto LAB_08086e9c; + } + // try { // try from 08086df1 to 08086ed6 has its CatchHandler @ 08086ee5 + bVar1 = CheckRight(cr->ID,CHANGE_SKILLS); + if (bVar1) { + Number = __strtol_internal(Param,0,10,0); + bVar1 = false; + if ((-1 < Number) && (Number < 500)) { + bVar1 = true; + } + if (bVar1) { + iVar2 = TPlayer::GetQuestValue((TPlayer *)cr,Number); + SendMessage(cr->Connection,0x16,"Quest value %d is %d.",Number,iVar2); + } + else { + SendMessage(cr->Connection,0x17,"Invalid quest number."); + } + } + } + return; +} + + + +void SetQuestValue(TCreature *cr,char *Param1,char *Param2) + +{ + bool bVar1; + int Number; + int Value; + undefined4 *puVar2; + char *pcVar3; + + if (cr == (TCreature *)0x0) { + pcVar3 = &DAT_080fc6c0; +LAB_08087027: + error(pcVar3); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + if (Param1 == (char *)0x0) { + pcVar3 = "SetQuestValue: Param1 ist NULL.\n"; + } + else { + if (Param2 != (char *)0x0) { + if (cr->Type == PLAYER) { + // try { // try from 08086f4f to 08087061 has its CatchHandler @ 08087080 + bVar1 = CheckRight(cr->ID,CHANGE_SKILLS); + if (!bVar1) { + return; + } + Number = __strtol_internal(Param1,0,10,0); + Value = __strtol_internal(Param2,0,10,0); + bVar1 = false; + if ((-1 < Number) && (Number < 500)) { + bVar1 = true; + } + if (!bVar1) { + SendMessage(cr->Connection,0x17,"Invalid quest number."); + return; + } + TPlayer::SetQuestValue((TPlayer *)cr,Number,Value); + SendMessage(cr->Connection,0x16,"Quest value %d set to %d.",Number,Value); + return; + } + pcVar3 = "SetQuestValue: Zauberspruch kann nur von Spielern angewendet werden.\n"; + goto LAB_08087027; + } + pcVar3 = "SetQuestValue: Param2 ist NULL.\n"; + } + error(pcVar3); + return; +} + + + +void ClearQuestValues(TCreature *cr) + +{ + bool bVar1; + undefined4 *puVar2; + int i; + int Number; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc760; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080870d2 to 0808715f has its CatchHandler @ 08087170 + bVar1 = CheckRight(cr->ID,CHANGE_SKILLS); + if (bVar1) { + Number = 0; + do { + TPlayer::SetQuestValue((TPlayer *)cr,Number,0); + Number = Number + 1; + } while (Number < 500); + SendMessage(cr->Connection,0x16,"All quest values deleted."); + } + return; + } + Text = "ClearQuestValues: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void CreateKnowledge(TCreature *cr,char *Param1,char *Param2) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + TSkill *pTVar4; + undefined4 *puVar5; + long k; + _func_int_varargs **pp_Var6; + char *Text; + Object local_2c [7]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc840; + } + else if (Param1 == (char *)0x0) { + Text = &DAT_080fc800; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080871d7 to 080872c2 has its CatchHandler @ 080872d5 + bVar1 = CheckRight(cr->ID,CHANGE_SKILLS); + if (bVar1) { + uVar2 = __strtol_internal(Param1,0,10,0); + if (Param2 == (char *)0x0) { + uVar3 = 0; + } + else { + uVar3 = __strtol_internal(Param2,0,10,0); + } + if (((int)uVar2 < 1) || (Param2 != (char *)0x0)) { + if (0x18 < uVar2) { + return; + } + if ((int)uVar3 < 1) { + return; + } + pp_Var6 = (cr->super_TSkillBase).Skills[uVar2]->_vptr_TSkill; + pTVar4 = (cr->super_TSkillBase).Skills[uVar2]; + uVar2 = uVar3; + } + else { + pTVar4 = (cr->super_TSkillBase).Skills[0]; + pp_Var6 = pTVar4->_vptr_TSkill; + } + (*pp_Var6[3])(pTVar4,uVar2); + local_2c[0].ObjectID = (cr->CrObject).ObjectID; + GraphicalEffect(local_2c,0xf); + } + return; + } + Text = "CreateKnowledge: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void ChangeProfession(TCreature *cr,char *Param) + +{ + bool bVar1; + uchar uVar2; + byte bVar3; + int iVar4; + undefined4 *puVar5; + char *Text; + Object local_1c [4]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc920; + } + else if (Param == (char *)0x0) { + Text = &DAT_080fc8e0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087331 to 08087525 has its CatchHandler @ 08087538 + bVar1 = CheckRight(cr->ID,CHANGE_PROFESSION); + if (!bVar1) { + return; + } + iVar4 = stricmp(Param,"male",-1); + if (iVar4 == 0) { + cr->Sex = 1; + } + else { + iVar4 = stricmp(Param,"female",-1); + if (iVar4 == 0) { + cr->Sex = 2; + } + else { + iVar4 = stricmp(Param,"none",-1); + if (iVar4 == 0) { + TPlayer::ClearProfession((TPlayer *)cr); + } + else { + iVar4 = stricmp(Param,"knight",-1); + if (iVar4 == 0) { + TPlayer::ClearProfession((TPlayer *)cr); + uVar2 = '\x01'; + } + else { + iVar4 = stricmp(Param,"paladin",-1); + if (iVar4 == 0) { + TPlayer::ClearProfession((TPlayer *)cr); + uVar2 = '\x02'; + } + else { + iVar4 = stricmp(Param,"sorcerer",-1); + if (iVar4 == 0) { + TPlayer::ClearProfession((TPlayer *)cr); + uVar2 = '\x03'; + } + else { + iVar4 = stricmp(Param,"druid",-1); + if (iVar4 == 0) { + TPlayer::ClearProfession((TPlayer *)cr); + uVar2 = '\x04'; + } + else { + iVar4 = stricmp(Param,"promote",-1); + if (iVar4 != 0) { + return; + } + uVar2 = TPlayer::GetRealProfession((TPlayer *)cr); + if (uVar2 == '\0') { + return; + } + bVar3 = TPlayer::GetRealProfession((TPlayer *)cr); + if (9 < bVar3) { + return; + } + uVar2 = '\n'; + } + } + } + } + TPlayer::SetProfession((TPlayer *)cr,uVar2); + } + } + } + local_1c[0].ObjectID = (cr->CrObject).ObjectID; + GraphicalEffect(local_1c,0xd); + return; + } + Text = "ChangeProfession: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void EditGuests(TCreature *cr) + +{ + ushort HouseID_00; + undefined4 *puVar1; + ushort HouseID; + char *Text; + char local_101c [4]; + char Buffer [4096]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fc9c0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087598 to 0808761b has its CatchHandler @ 08087640 + HouseID_00 = GetHouseID(cr->posx,cr->posy,cr->posz); + if (HouseID_00 != 0) { + ShowGuestList(HouseID_00,(TPlayer *)cr,local_101c); + SendEditList(cr->Connection,'\x01',(uint)HouseID_00,local_101c); + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 1; + goto LAB_080875f8; + } + Text = "EditGuests: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; +LAB_080875f8: + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void EditSubowners(TCreature *cr) + +{ + ushort HouseID_00; + undefined4 *puVar1; + ushort HouseID; + char *Text; + char local_101c [4]; + char Buffer [4096]; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fca60; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080876a8 to 0808772b has its CatchHandler @ 08087750 + HouseID_00 = GetHouseID(cr->posx,cr->posy,cr->posz); + if (HouseID_00 != 0) { + ShowSubownerList(HouseID_00,(TPlayer *)cr,local_101c); + SendEditList(cr->Connection,'\x02',(uint)HouseID_00,local_101c); + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 1; + goto LAB_08087708; + } + Text = "EditSubowners: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; +LAB_08087708: + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: Guest + +void KickGuest(TCreature *cr,char *Name) + +{ + bool bVar1; + ushort HouseID_00; + int Result; + int iVar2; + undefined4 *puVar3; + ushort HouseID; + char *Text; + TPlayer *local_10; + TPlayer *Guest; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fcb40; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fcb00; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080877b1 to 0808788b has its CatchHandler @ 080878b2 + bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); + iVar2 = IdentifyPlayer(Name,false,!bVar1,&local_10); + if (iVar2 == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + } + else if (iVar2 == -2) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + } + else { + HouseID_00 = GetHouseID((local_10->super_TCreature).posx, + (local_10->super_TCreature).posy, + (local_10->super_TCreature).posz); + if (HouseID_00 != 0) { + KickGuest(HouseID_00,(TPlayer *)cr,local_10); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + } + goto LAB_08087840; + } + Text = "KickGuest(magic): Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08087840: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void EditNameDoor(TCreature *cr) + +{ + bool bVar1; + undefined4 *puVar2; + int y; + int iVar3; + int x; + char *pcVar4; + int iVar5; + int iVar6; + int iVar7; + int z; + char Buffer [4096]; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Door; + + if (cr == (TCreature *)0x0) { + pcVar4 = &DAT_080fcbe0; + } + else { + if (cr->Type == PLAYER) { + iVar3 = cr->posy; + iVar7 = cr->posz; + iVar5 = iVar3; + iVar6 = iVar7; + // try { // try from 08087925 to 08087b48 has its CatchHandler @ 08087b66 + GetFirstObject(); + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + do { + local_4c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,NAMEDOOR); + if (bVar1) break; + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + bVar1 = local_3c[0].ObjectID != NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + } while (bVar1); + } + local_4c[0].ObjectID = NONE.ObjectID; + if (local_2c == NONE.ObjectID) { + iVar5 = cr->Direction; + if (iVar5 != 1) { + if (iVar5 < 2) { + if (iVar5 == 0) { + iVar3 = iVar3 + -1; + } + } + else if (iVar5 == 2) { + iVar3 = iVar3 + 1; + } + } + GetFirstObject(); + local_2c._0_1_ = Buffer[0xffc]; + local_2c._1_1_ = Buffer[0xffd]; + local_2c._2_1_ = Buffer[0xffe]; + local_2c._3_1_ = Buffer[0xfff]; + local_3c[0].ObjectID = NONE.ObjectID; + iVar5 = iVar3; + iVar6 = iVar7; + if (Buffer._4092_4_ != NONE.ObjectID) { + do { + Buffer._4092_4_ = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType((Object *)(Buffer + 0xffc)); + bVar1 = ObjectType::getFlag((ObjectType *)(Buffer + 0xffc),NAMEDOOR); + iVar5 = iVar3; + iVar6 = iVar7; + if (bVar1) break; + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + bVar1 = local_3c[0].ObjectID != NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + iVar5 = iVar3; + iVar6 = iVar7; + } while (bVar1); + } + } + if (local_2c != NONE.ObjectID) { + Buffer._4092_4_ = local_2c; + ShowNameDoor((Object *)(Buffer + 0xffc),(TPlayer *)cr,(char *)&z); + SendEditList(cr->Connection,'\x03',local_2c,(char *)&z); + return; + } + pcVar4 = "Keine NameDoor gefunden.\n"; + Buffer._4092_4_ = NONE.ObjectID; + print(); + puVar2 = (undefined4 *)__cxa_allocate_exception(4,pcVar4,iVar5,iVar6); + *puVar2 = 1; + goto LAB_08087ae7; + } + pcVar4 = "EditNameDoor: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(pcVar4); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08087ae7: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void Notation(TCreature *cr,char *Name,char *Comment) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fcd40; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fcd00; + } + else if (Comment == (char *)0x0) { + Text = &DAT_080fccc0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087bc2 to 08087c00 has its CatchHandler @ 08087c20 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "Notation: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void NameLock(TCreature *cr,char *Name) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fce20; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fcde0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087c77 to 08087cb5 has its CatchHandler @ 08087cc8 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "NameLock: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void BanishAccount(TCreature *cr,char *Name,int param_3,char *Reason) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fcf40; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fcf00; + } + else if (Reason == (char *)0x0) { + Text = &DAT_080fcec0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087d22 to 08087d60 has its CatchHandler @ 08087d80 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "BanishAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void DeleteAccount(TCreature *cr,char *Name,char *Reason) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fd060; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fd020; + } + else if (Reason == (char *)0x0) { + Text = &DAT_080fcfe0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087de2 to 08087e20 has its CatchHandler @ 08087e40 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "DeleteAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void BanishCharacter(TCreature *cr,char *Name,int param_3,char *Reason) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fd180; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fd140; + } + else if (Reason == (char *)0x0) { + Text = &DAT_080fd100; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087ea2 to 08087ee0 has its CatchHandler @ 08087f00 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "BanishCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void DeleteCharacter(TCreature *cr,char *Name,char *Reason) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fd2a0; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fd260; + } + else if (Reason == (char *)0x0) { + Text = &DAT_080fd220; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08087f62 to 08087fa0 has its CatchHandler @ 08087fc0 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "DeleteCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void IPBanishment(TCreature *cr,char *Name,char *Reason) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fd3c0; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fd380; + } + else if (Reason == (char *)0x0) { + Text = &DAT_080fd340; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08088022 to 08088060 has its CatchHandler @ 08088080 + SendMessage(cr->Connection,0x17, + "Spell is not available any more. Press Ctrl+Y for the dialog."); + return; + } + Text = "IPBanishment: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void SetNameRule(TCreature *cr,char *Name) + +{ + undefined4 *puVar1; + char *Text; + + if (cr == (TCreature *)0x0) { + Text = &DAT_080fd4e0; + } + else if (Name == (char *)0x0) { + Text = &DAT_080fd4a0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 080880d7 to 08088115 has its CatchHandler @ 08088128 + SendMessage(cr->Connection,0x17,"Spell is not available any more."); + return; + } + Text = "SetNameRule: Zauberspruch kann nur von Spieler angewendet werden.\n"; + } + error(Text); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); +} + + + +void KickPlayer(TCreature *cr,char *Name) + +{ + bool bVar1; + int Result; + int iVar2; + undefined4 *puVar3; + char *pcVar4; + TPlayer *local_20; + TPlayer *Opp; + + if (cr == (TCreature *)0x0) { + pcVar4 = &DAT_080fd600; + } + else if (Name == (char *)0x0) { + pcVar4 = &DAT_080fd5c0; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08088181 to 080882ae has its CatchHandler @ 080882d5 + bVar1 = CheckRight(cr->ID,KICK); + if (!bVar1) { + return; + } + bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); + iVar2 = IdentifyPlayer(Name,false,!bVar1,&local_20); + if (iVar2 == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + } + else { + if (iVar2 != -2) { + pcVar4 = (local_20->super_TCreature).Name; + Opp = (TPlayer *)(local_20->super_TCreature).CrObject.ObjectID; + GraphicalEffect((Object *)&Opp,0xf); + TCreature::StartLogout(&local_20->super_TCreature,true,true); + SendMessage(cr->Connection,0x16,"Player %s kicked out of the game.",pcVar4); + Log("banish","%s kickt %s.\n",cr->Name,pcVar4); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + } + goto LAB_08088277; + } + pcVar4 = "KickPlayer: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(pcVar4); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08088277: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void HomeTeleport(TCreature *cr,char *Name) + +{ + bool bVar1; + int Result; + int iVar2; + undefined4 *puVar3; + char *pcVar4; + TPlayer *local_60; + TPlayer *Opp; + Object local_4c [4]; + Object local_3c [4]; + TPlayer *local_2c; + Object Obj; + + if (cr == (TCreature *)0x0) { + pcVar4 = &DAT_080fd740; + } + else if ((Name == (char *)0x0) || (*Name == '\0')) { + pcVar4 = "HomeTeleport: Name existiert nicht.\n"; + } + else { + if (cr->Type == PLAYER) { + // try { // try from 08088340 to 080884dc has its CatchHandler @ 08088503 + bVar1 = CheckRight(cr->ID,HOME_TELEPORT); + if (!bVar1) { + return; + } + bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); + iVar2 = IdentifyPlayer(Name,false,!bVar1,&local_60); + if (iVar2 == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1b; + } + else { + if (iVar2 != -2) { + pcVar4 = (local_60->super_TCreature).Name; + local_3c[0].ObjectID = (local_60->super_TCreature).CrObject.ObjectID; + local_2c = (TPlayer *)local_3c[0].ObjectID; + GraphicalEffect(local_3c,3); + local_3c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_4c,(local_60->super_TCreature).startx, + (local_60->super_TCreature).starty); + Opp = local_2c; + Move(0,(Object *)&Opp,local_4c,-1,false,local_3c); + Opp = local_2c; + GraphicalEffect((Object *)&Opp,0xd); + SendMessage(cr->Connection,0x16,"Player %s has been moved to the temple.",pcVar4 + ); + Log("banish","%s teleportiert %s zum Tempel.\n",cr->Name,pcVar4); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1c; + } + goto LAB_080884a5; + } + pcVar4 = "HomeTeleport: Zauberspruch kann nur von Spielern angewendet werden.\n"; + } + error(pcVar4); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080884a5: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void SpellFailed(ulong CreatureID) + +{ + TCreature *pTVar1; + Object local_1c [6]; + + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + error("SpellFailed: Kreatur existiert nicht.\n"); + } + else { + local_1c[0].ObjectID = (pTVar1->CrObject).ObjectID; + GraphicalEffect(local_1c,3); + } + return; +} + + + +void CharacterRightSpell(ulong CreatureID,int SpellNr,char (*SpellStr) [512]) + +{ + TCreature *cr_00; + undefined4 *puVar1; + TCreature *cr; + char (*pacVar2) [512]; + + // try { // try from 08088582 to 080887ce has its CatchHandler @ 080887d0 + cr_00 = GetCreature(CreatureID); + if (cr_00 == (TCreature *)0x0) { + error("CharacterRightSpell: Kreatur existiert nicht.\n"); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,&RESULT::typeinfo,0); + } + if (cr_00->Type != PLAYER) { + return; + } + switch(SpellNr) { + case 0x22: + pacVar2 = SpellStr + 3; + goto LAB_080885b7; + case 0x23: + pacVar2 = (char (*) [512])0x0; +LAB_080885b7: + CreateThing(cr_00,SpellStr[2],*pacVar2); + break; + case 0x25: + Teleport(cr_00,SpellStr[2]); + break; + case 0x28: + pacVar2 = (char (*) [512])0x0; + goto LAB_080885fd; + case 0x29: + ChangeData(cr_00,SpellStr[2]); + break; + case 0x2e: + pacVar2 = SpellStr + 4; +LAB_080885fd: + CreateKnowledge(cr_00,SpellStr[3],*pacVar2); + break; + case 0x2f: + TeleportToCreature(cr_00,SpellStr[3]); + break; + case 0x34: + TeleportPlayerToMe(cr_00,SpellStr[3]); + break; + case 0x35: + SummonCreature(cr_00,0,SpellStr[3],true); + break; + case 0x3a: + GetPosition(cr_00); + break; + case 0x3f: + CreateMoney(cr_00,SpellStr[3]); + break; + case 0x40: + ChangeProfession(cr_00,SpellStr[3]); + break; + case 0x47: + EditGuests(cr_00); + break; + case 0x48: + EditSubowners(cr_00); + break; + case 0x49: + KickGuest(cr_00,SpellStr[3]); + break; + case 0x4a: + EditNameDoor(cr_00); + break; + case 0x60: + GetQuestValue(cr_00,SpellStr[3]); + break; + case 0x61: + SetQuestValue(cr_00,SpellStr[3],SpellStr[4]); + break; + case 0x62: + CleanupField(cr_00); + break; + case 99: + MagicClimbing(cr_00,SpellStr[3]); + break; + case 100: + ClearQuestValues(cr_00); + break; + case 0x65: + KillAllMonsters(cr_00,0x12,2); + break; + case 0x66: + StartMonsterraid(cr_00,SpellStr[4]); + } + return; +} + + + +void AccountRightSpell(ulong CreatureID,int SpellNr,char (*SpellStr) [512]) + +{ + TCreature *cr_00; + int iVar1; + undefined4 *puVar2; + TCreature *cr; + + // try { // try from 08088805 to 080889de has its CatchHandler @ 080889e0 + cr_00 = GetCreature(CreatureID); + if (cr_00 != (TCreature *)0x0) { + if (cr_00->Type == PLAYER) { + switch(SpellNr) { + case 0x39: + iVar1 = __strtol_internal(SpellStr + 4,0,10,0); + BanishAccount(cr_00,SpellStr[3],iVar1,SpellStr[5]); + break; + case 0x3c: + HomeTeleport(cr_00,SpellStr[2]); + break; + case 0x3d: + DeleteAccount(cr_00,SpellStr[4],SpellStr[5]); + break; + case 0x3e: + SetNameRule(cr_00,SpellStr[2]); + break; + case 0x41: + Notation(cr_00,SpellStr[2],SpellStr[3]); + break; + case 0x42: + NameLock(cr_00,SpellStr[3]); + break; + case 0x43: + KickPlayer(cr_00,SpellStr[2]); + break; + case 0x44: + DeleteCharacter(cr_00,SpellStr[4],SpellStr[5]); + break; + case 0x45: + IPBanishment(cr_00,SpellStr[3],SpellStr[4]); + break; + case 0x46: + iVar1 = __strtol_internal(SpellStr + 4,0,10,0); + BanishCharacter(cr_00,SpellStr[3],iVar1,SpellStr[5]); + } + } + return; + } + error("AccountRightSpell: Kreatur existiert nicht.\n"); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void CastSpell(ulong CreatureID,int SpellNr,char (*SpellStr) [512]) + +{ + bool bVar1; + TCreature *cr_00; + undefined4 *puVar2; + byte bVar3; + TCreature *cr; + int iVar4; + int iVar5; + int Damage; + + // try { // try from 08088a18 to 080894d1 has its CatchHandler @ 080894e6 + cr_00 = GetCreature(CreatureID); + if (cr_00 == (TCreature *)0x0) { + error("CastSpell: Kreatur existiert nicht.\n",CreatureID); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_0808947c: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + CheckSpellbook(cr_00,SpellNr); + CheckAccount(cr_00,SpellNr); + CheckLevel(cr_00,SpellNr); + CheckRing(cr_00,SpellNr); + if (ServerMilliseconds < cr_00->EarliestSpellTime) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x31; + goto LAB_0808947c; + } + if (SpellNr - 1U < 0xff) { + bVar3 = (byte)SpellList[SpellNr].Flags & 1; + } + else { + error(&DAT_080fa6c0,SpellNr); + bVar3 = 0; + } + if (((bVar3 != 0) && (cr_00->Type == PLAYER)) && + (bVar1 = CheckRight(cr_00->ID,ATTACK_EVERYWHERE), !bVar1)) { + iVar4 = cr_00->posz; + iVar5 = cr_00->posy; + bVar1 = IsProtectionZone(); + if (bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,iVar5,iVar4); + *puVar2 = 0x2f; + goto LAB_0808947c; + } + } + switch(SpellNr) { + case 1: + iVar5 = 10; + iVar4 = 0x14; + goto LAB_08088ad0; + case 2: + iVar5 = 0x14; + iVar4 = 0x28; + goto LAB_08088ad0; + case 3: + iVar5 = 0x32; + iVar4 = 0xfa; +LAB_08088ad0: + ComputeDamage(cr_00,SpellNr,iVar4,iVar5); + Heal(); + break; + case 6: + goto LAB_08088ba1; + case 9: + SummonCreature(cr_00,SpellList[SpellNr].Mana,SpellStr[3],false); + break; + case 10: + goto LAB_08088c10; + case 0xb: + goto LAB_08088c10; + case 0xd: + ComputeDamage(cr_00,SpellNr,0x96,0x32); + goto LAB_08088c8f; + case 0x13: + ComputeDamage(cr_00,SpellNr,0x1e,10); + goto LAB_08088c8f; + case 0x14: + FindPerson(); + break; + case 0x16: + ComputeDamage(cr_00,SpellNr,0x3c,0x14); + goto LAB_08088c8f; + case 0x17: + ComputeDamage(cr_00,SpellNr,0x78,0x50); + goto LAB_08088c8f; + case 0x18: + ComputeDamage(cr_00,SpellNr,0xfa,0x32); + goto LAB_08088e31; + case 0x1d: + NegatePoison(); + break; + case 0x26: + CreatureIllusion(); + break; + case 0x27: +LAB_08088ba1: + MagicGoStrength(); + break; + case 0x2a: + CreateFood(); + break; + case 0x2c: + Shielding(); + break; + case 0x2d: + Invisibility(); + break; + case 0x30: + goto LAB_08088f60; + case 0x31: + goto LAB_08088f60; + case 0x33: + goto LAB_08088f60; + case 0x38: + ComputeDamage(cr_00,SpellNr,200,0x32); + goto LAB_08088e31; + case 0x4b: +LAB_08088c10: + Enlight(); + break; + case 0x4c: + MagicRope(); + break; + case 0x4f: + goto LAB_08088f60; + case 0x50: + ComputeDamage(cr_00,SpellNr,0x50,0x14); + TSkill::Get((cr_00->super_TSkillBase).Skills[0]); + TSkill::Get((cr_00->super_TSkillBase).Skills[0]); +LAB_08088e31: + MassCombat(); + break; + case 0x51: + MagicClimbing(); + break; + case 0x52: + ComputeDamage(cr_00,SpellNr,200,0x28); + MassHeal(); + break; + case 0x54: + ComputeDamage(cr_00,SpellNr,0x78,0x28); + HealFriend(); + break; + case 0x55: + MassRaiseDead(); + break; + case 0x57: + ComputeDamage(cr_00,SpellNr,0x2d,10); + goto LAB_08088c8f; + case 0x58: + ComputeDamage(cr_00,SpellNr,0x2d,10); + goto LAB_08088c8f; + case 0x59: + ComputeDamage(cr_00,SpellNr,0x2d,10); +LAB_08088c8f: + AngleCombat(); + break; + case 0x5a: + CancelInvisibility(); + break; + case 0x5c: + GetNewObjectType(0xd4,'Z'); + GetNewObjectType(0xc4,'Z'); + EnchantObject(); + break; + case 0x5d: + Challenge(); + break; + case 0x5e: + CreateField(); + break; + case 0x5f: +LAB_08088f60: + CreateArrows(); + } + if (SpellNr - 1U < 0xff) { + bVar3 = (byte)SpellList[SpellNr].Flags & 1; + } + else { + error(&DAT_080fa6c0,SpellNr); + bVar3 = 0; + } + if (bVar3 != 0) { + TCreature::BlockLogout(cr_00,0x3c,false); + } + return; +} + + + +void RuneSpell(ulong CreatureID,int SpellNr) + +{ + bool bVar1; + bool bVar2; + TCreature *cr_00; + undefined4 *puVar3; + ObjectType *pOVar4; + ObjectType *pOVar5; + bool executed; + TCreature *cr; + ObjectType local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Obj2; + Object local_2c; + Object Obj1; + + // try { // try from 0808951b to 0808966f has its CatchHandler @ 08089836 + cr_00 = GetCreature(CreatureID); + if (cr_00 == (TCreature *)0x0) { + error("RuneSpell: Kreatur existiert nicht.\n"); + } + else { + if (SpellList[SpellNr].RuneGr != '\0') { + GetBodyObject((ulong)&local_2c,CreatureID); + GetBodyObject((ulong)&local_3c,CreatureID); + CheckSpellbook(cr_00,SpellNr); + CheckAccount(cr_00,SpellNr); + CheckLevel(cr_00,SpellNr); + pOVar4 = (ObjectType *)SpellNr; + CheckRing(cr_00,SpellNr); + if (ServerMilliseconds < cr_00->EarliestSpellTime) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x31; + } + else { + bVar1 = false; + bVar2 = Object::exists(&local_2c); + if (bVar2) { + // try { // try from 0808970d to 080897f2 has its CatchHandler @ 08089836 + Object::getObjectType(local_4c); + pOVar5 = local_5c; + pOVar4 = (ObjectType *)0x28; + GetSpecialObject((SPECIALMEANING)pOVar5); + if (local_4c[0].ObjectID == local_5c[0].TypeID) { + CheckMana(cr_00,SpellList[SpellNr].Mana,SpellList[SpellNr].SoulPoints,1000); + GetNewObjectType((uchar)pOVar5,SpellList[SpellNr].RuneGr); + cr = (TCreature *)local_2c.ObjectID; + Change((Object *)&cr,pOVar5,SpellList[SpellNr].Amount); + bVar1 = true; + pOVar4 = pOVar5; + } + } + bVar2 = Object::exists(&local_3c); + if (bVar2) { + Object::getObjectType((Object *)&cr); + pOVar5 = local_5c; + pOVar4 = (ObjectType *)0x28; + GetSpecialObject((SPECIALMEANING)pOVar5); + if (cr == (TCreature *)local_5c[0].TypeID) { + // try { // try from 080896ac to 080896f0 has its CatchHandler @ 080897f5 + CheckMana(cr_00,SpellList[SpellNr].Mana,SpellList[SpellNr].SoulPoints,1000); + GetNewObjectType((uchar)pOVar5,SpellList[SpellNr].RuneGr); + local_4c[0].ObjectID = local_3c.ObjectID; + Change(local_4c,pOVar5,SpellList[SpellNr].Amount); + bVar1 = true; + pOVar4 = pOVar5; + } + } + if (bVar1) { + cr = (TCreature *)(cr_00->CrObject).ObjectID; + GraphicalEffect((Object *)&cr,0xe); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4,pOVar4); + *puVar3 = 0x22; + } + goto LAB_08089630; + } + error("RuneSpell: Spell %d ist Runenspruch, hat aber keine Rune.\n",SpellNr); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_08089630: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +int TypeOfSpell(char *Text) + +{ + int iVar1; + char (*s2) [6]; + int i; + int iVar2; + + if (Text != (char *)0x0) { + iVar2 = 1; + s2 = SpellSyllable; + do { + s2 = s2 + 1; + iVar1 = stricmp(Text,*s2,2); + if (iVar1 == 0) { + return iVar2; + } + iVar2 = iVar2 + 1; + } while (iVar2 < 6); + } + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: Spell + +int FindSpell(uchar *Syllable) + +{ + uchar uVar1; + int j; + int iVar2; + int Params; + int iVar3; + int iVar4; + int local_1c; + int i; + int MinParams; + int Spell; + + local_1c = 1; + MinParams = 0; + i = 100; + iVar4 = 0x24; + do { + iVar3 = 0; + iVar2 = 0; + do { + uVar1 = SpellList[0].Syllable[iVar4 + iVar2]; + if (uVar1 == '\x06') { + if (Syllable[iVar2] == '\0') break; + } + else if (uVar1 != Syllable[iVar2]) break; + if (uVar1 == '\x06') { + iVar3 = iVar3 + 1; + } + if (uVar1 == '\0') { + if (iVar3 < i) { + MinParams = local_1c; + i = iVar3; + } + break; + } + iVar2 = iVar2 + 1; + } while (iVar2 < 10); + local_1c = local_1c + 1; + iVar4 = iVar4 + 0x24; + if (0xff < local_1c) { + return MinParams; + } + } while( true ); +} + + + +int FindSpell(Object *Obj) + +{ + bool bVar1; + int iVar2; + int i; + int iVar3; + char *Text; + ulong local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + iVar3 = 1; + iVar2 = 0x24; + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RUNE); + if (bVar1) { + do { + Object::getObjectType(local_2c); + GetNewObjectType((uchar)local_3c,SpellList[0].Syllable[iVar2 + 10]); + if (local_2c[0].ObjectID == local_3c[0]) { + return iVar3; + } + iVar3 = iVar3 + 1; + iVar2 = iVar2 + 0x24; + } while (iVar3 < 0x100); + return 0; + } + Text = &DAT_080fd940; + } + else { + Text = &DAT_080fd900; + } + error(Text); + return 0; +} + + + +void GetSpellString(int SpellNr,char *Text) + +{ + size_t sVar1; + int i; + int iVar2; + + *Text = '\0'; + if (0xfe < SpellNr - 1U) { + error(&DAT_080fd980); + return; + } + iVar2 = 0; + do { + if (SpellSyllable[SpellList[SpellNr].Syllable[iVar2]][0] == '\0') break; + strcat(Text,SpellSyllable[SpellList[SpellNr].Syllable[iVar2]]); + if (0 < iVar2) { + strcat(Text," "); + } + iVar2 = iVar2 + 1; + } while (iVar2 < 10); + if (*Text != '\0') { + sVar1 = strlen(Text); + Text[sVar1 - 1] = '\0'; + } + return; +} + + + +void GetMagicItemDescription(Object *Obj,char *SpellString,int *MagicLevel) + +{ + bool bVar1; + int SpellNr_00; + int SpellNr; + char *Text; + Object local_2c [7]; + + *MagicLevel = 0; + *SpellString = '\0'; + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RUNE); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + SpellNr_00 = FindSpell(local_2c); + if (SpellNr_00 == 0) { + Object::getObjectType(local_2c); + error("GetMagicItemDescription: Objekt %d hat keinen Zauberspruch.\n", + local_2c[0].ObjectID); + return; + } + GetSpellString(SpellNr_00,SpellString); + *MagicLevel = (uint)SpellList[SpellNr_00].RuneLevel; + return; + } + Text = &DAT_080fda00; + } + else { + Text = &DAT_080fd9c0; + } + error(Text); + return; +} + + + +void GetSpellbook(ulong CharacterID,char *Buffer) + +{ + bool bVar1; + bool bVar2; + TPlayer *this; + TPlayer **ppTVar3; + TPlayer **ppTVar4; + uint uVar5; + uint uVar6; + int i; + int SpellNumber; + int iVar7; + int Level; + uint uVar8; + char *Text; + bool first; + TPlayer *pl; + char Help [100]; + + this = GetPlayer(CharacterID); + if (this == (TPlayer *)0x0) { + Text = "GetSpellbook: Spieler existiert nicht.\n"; + } + else { + if (Buffer != (char *)0x0) { + uVar8 = 1; + *Buffer = '\0'; + do { + bVar1 = true; + SpellNumber = 1; + iVar7 = 0x24; + do { + if ((*(ushort *)(SpellList[0].Syllable + iVar7 + 0x10) == uVar8) && + (bVar2 = TPlayer::SpellKnown(this,SpellNumber), bVar2)) { + if (bVar1) { + sprintf((char *)&pl,"Spells for Level %d\n",uVar8); + strcat(Buffer,(char *)&pl); + bVar1 = false; + } + GetSpellString(SpellNumber,(char *)&pl); + ppTVar4 = &pl; + do { + ppTVar3 = ppTVar4; + uVar5 = (uint)((int)(*ppTVar3)[-0x127c].QuestValues + 0x68fU) & + ~(uint)*ppTVar3; + uVar6 = uVar5 & 0x80808080; + ppTVar4 = ppTVar3 + 1; + } while (uVar6 == 0); + bVar2 = (uVar5 & 0x8080) == 0; + if (bVar2) { + uVar6 = uVar6 >> 0x10; + } + if (bVar2) { + ppTVar4 = (TPlayer **)((int)ppTVar3 + 6); + } + if ((int)ppTVar4 + ((-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6)) - (int)&pl) + < 2) { + error("GetSpellbook: Zauberspruch %d hat keine Zauberformel.\n", + SpellNumber); + } + else { + strcat(Buffer," "); + strcat(Buffer,(char *)&pl); + if (**(char **)(SpellList[0].Syllable + iVar7 + 0xc) != '\0') { + strcat(Buffer," - "); + strcat(Buffer,*(char **)(SpellList[0].Syllable + iVar7 + 0xc)); + if (SpellNumber == 0x50) { + builtin_strncpy(Help,"*Level",7); + pl = (TPlayer *)0x34203a20; + } + else if ((SpellNumber < 0x51) && + ((SpellNumber == 9 || (SpellNumber == 0xc)))) { + Help._2_2_ = SUB42(Help._0_4_,2) & 0xff00; + pl = (TPlayer *)0x76203a20; + Help[0] = 'a'; + Help[1] = 'r'; + } + else { + sprintf((char *)&pl," : %d", + *(undefined4 *)(SpellList[0].Syllable + iVar7 + 0x18)); + } + strcat(Buffer,(char *)&pl); + } + strcat(Buffer,"\n"); + } + } + SpellNumber = SpellNumber + 1; + iVar7 = iVar7 + 0x24; + } while (SpellNumber < 0x100); + if (!bVar1) { + strcat(Buffer,"\n"); + } + uVar8 = uVar8 + 1; + } while ((int)uVar8 < 0x3d); + return; + } + Text = &DAT_080fdac0; + } + error(Text); + return; +} + + + +int GetSpellLevel(int SpellNr) + +{ + uint uVar1; + + if (SpellNr - 1U < 0xff) { + uVar1 = (uint)SpellList[SpellNr].Level; + } + else { + error(&DAT_080fdb40,SpellNr); + uVar1 = 1; + } + return uVar1; +} + + + +int CheckForSpell(ulong CreatureID,char *Text) + +{ + int *piVar1; + bool bVar2; + int SpellNr; + int iVar3; + int iVar4; + size_t sVar5; + int iVar6; + int Next; + char (*pacVar7) [6]; + int syl; + uint in_stack_ffffe8a0; + uint uVar8; + int local_1750; + char local_174c [4]; + char SpellStr [11] [512]; + uchar Syllable [11]; + char *local_11c [4]; + undefined4 local_10c; + istringstream IS; + undefined4 local_104 [20]; + int local_b4; + undefined4 local_b0; + ios_base aiStack_ac [16]; + byte local_9c; + + local_1750 = 0; + if (Text != (char *)0x0) { + local_1750 = 1; + pacVar7 = SpellSyllable; + do { + pacVar7 = pacVar7 + 1; + iVar3 = stricmp(Text,*pacVar7,2); + if (iVar3 == 0) goto LAB_08089ed2; + local_1750 = local_1750 + 1; + } while (local_1750 < 6); + local_1750 = 0; + } +LAB_08089ed2: + iVar3 = 0; + if (local_1750 != 0) { + if (Text != (char *)0x0) { + strlen(Text); + } + uVar8 = in_stack_ffffe8a0 & 0xffffff00; + // try { // try from 08089f11 to 08089f15 has its CatchHandler @ 0808a436 + local_11c[0] = basic_string<>::_S_construct<>(); + // try { // try from 08089f2d to 08089f31 has its CatchHandler @ 0808a413 + std::ios_base::ios_base(aiStack_ac); + local_b0 = 0x8128950; + // try { // try from 08089f56 to 08089f5a has its CatchHandler @ 0808a40f + std::istream::istream((istream *)&local_10c,(streambuf *)(std::istringstream::VTT + 4)); + local_10c = 0x8128964; + local_b0 = 0x8128978; + // try { // try from 08089f89 to 08089f8d has its CatchHandler @ 0808a40b + std::stringbuf::stringbuf((stringbuf *)local_104,local_11c,8,uVar8); + // try { // try from 08089f95 to 08089f99 has its CatchHandler @ 0808a3a5 + std::ios::init((EVP_PKEY_CTX *)&local_b0); + LOCK(); + piVar1 = (int *)(local_11c[0] + -4); + iVar3 = *piVar1; + *piVar1 = *piVar1 + -1; + UNLOCK(); + if (iVar3 < 1) { + // try { // try from 0808a380 to 0808a384 has its CatchHandler @ 0808a429 + std::__default_alloc_template::deallocate + (local_11c[0] + -0xc,*(int *)(local_11c[0] + -8) + 0xd); + } + SpellStr[10][0x1fc] = (char)local_1750; + strcpy(local_174c,SpellSyllable[local_1750]); + // try { // try from 08089ff2 to 0808a0d9 has its CatchHandler @ 0808a5e0 + std::istream::get(); + std::istream::get(); + SpellStr[10][0x1fd] = '\0'; + SpellStr[0][0x1fc] = '\0'; + iVar3 = 1; + if ((local_9c & 2) == 0) { + while( true ) { + while( true ) { + iVar4 = std::istream::peek(); + bVar2 = isSpace(iVar4); + if (!bVar2) break; + std::istream::get(); + } + if (iVar4 == 0x22) { + // try { // try from 0808a32b to 0808a36d has its CatchHandler @ 0808a5e0 + std::istream::get(); + std::istream::get((char *)&local_10c,(int)(SpellStr[iVar3 + -1] + 0x1fc),-2); + std::istream::get(); + } + else { + std::istream::get((char *)&local_10c,(int)(SpellStr[iVar3 + -1] + 0x1fc),'d'); + sVar5 = strlen(SpellStr[iVar3 + -1] + 0x1fc); + if (sVar5 == 99) { + local_10c = 0x8128964; + local_b0 = 0x8128978; + local_104[0] = 0x8128a08; + // try { // try from 0808a31b to 0808a31f has its CatchHandler @ 0808a43a + std::string::_Rep::_M_dispose((allocator *)(local_b4 + -0xc)); + goto LAB_0808a2a8; + } + } + if (SpellStr[iVar3 + -1][0x1fc] == '\0') break; + iVar4 = 1; + pacVar7 = SpellSyllable; + do { + pacVar7 = pacVar7 + 1; + iVar6 = stricmp(SpellStr[iVar3 + -1] + 0x1fc,*pacVar7,-1); + if (iVar6 == 0) { + SpellStr[10][iVar3 + 0x1fc] = (char)iVar4; + } + iVar4 = iVar4 + 1; + } while (iVar4 < 0x34); + if (SpellStr[10][iVar3 + 0x1fc] == '\0') { + SpellStr[10][iVar3 + 0x1fc] = '\x06'; + } + SpellStr[10][iVar3 + 0x1fd] = '\0'; + SpellStr[iVar3][0x1fc] = '\0'; + if ((9 < iVar3 + 1) || (iVar3 = iVar3 + 1, (local_9c & 2) != 0)) break; + } + } + iVar3 = FindSpell((uchar *)(SpellStr[10] + 0x1fc)); + if (iVar3 == 0) { + local_10c = 0x8128964; + local_b0 = 0x8128978; + local_104[0] = 0x8128a08; + // try { // try from 0808a2a3 to 0808a2a7 has its CatchHandler @ 0808a440 + std::string::_Rep::_M_dispose((allocator *)(local_b4 + -0xc)); +LAB_0808a2a8: + std::streambuf::~streambuf((streambuf *)local_104); + std::istream::~istream((istream *)&local_10c); + std::ios::~ios((ios *)&local_b0); + iVar3 = 0; + } + else { + switch(local_1750) { + default: + // try { // try from 0808a20c to 0808a260 has its CatchHandler @ 0808a442 + error("CheckForSpell: Spruchklasse %d existiert nicht.\n",local_1750); + break; + case 1: + // try { // try from 0808a16f to 0808a173 has its CatchHandler @ 0808a442 + CharacterRightSpell(CreatureID,iVar3,(char (*) [512])local_174c); + break; + case 2: + RuneSpell(CreatureID,iVar3); + break; + case 3: + case 4: + CastSpell(CreatureID,iVar3,(char (*) [512])local_174c); + break; + case 5: + AccountRightSpell(CreatureID,iVar3,(char (*) [512])local_174c); + } + local_10c = 0x8128964; + local_b0 = 0x8128978; + local_104[0] = 0x8128a08; + // try { // try from 0808a1b1 to 0808a1b5 has its CatchHandler @ 0808a436 + std::string::_Rep::_M_dispose((allocator *)(local_b4 + -0xc)); + std::streambuf::~streambuf((streambuf *)local_104); + std::istream::~istream((istream *)&local_10c); + std::ios::~ios((ios *)&local_b0); + iVar3 = local_1750; + } + } + return iVar3; +} + + + +void DeleteRune(Object *Obj) + +{ + bool bVar1; + ulong uVar2; + undefined4 *puVar3; + Object local_1c [5]; + + // try { // try from 0808a5ff to 0808a6a0 has its CatchHandler @ 0808a6a1 + bVar1 = Object::exists(Obj); + if (bVar1) { + uVar2 = Object::getAttribute(Obj,CHARGES); + if (uVar2 < 2) { + local_1c[0] = (Object)Obj->ObjectID; + Delete(local_1c,-1); + } + else { + uVar2 = Object::getAttribute(Obj,CHARGES); + local_1c[0] = (Object)Obj->ObjectID; + Change(local_1c,CHARGES,uVar2 - 1); + } + return; + } + error(&DAT_080fdbc0); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void UseMagicItem(ulong CreatureID,Object *Obj,Object *Dest) + +{ + bool bVar1; + byte bVar2; + uchar uVar3; + TCreature *cr; + TPlayer *this; + int *SpellNr_00; + ulong uVar4; + int Damage_00; + undefined4 *puVar5; + int Damage; + TPlayer *pl; + char *pcVar6; + int *piVar7; + int *piVar8; + TCreature *z; + int EffectNr; + int AnimationNr; + ushort DmgType; + TCreature *local_60; + TCreature *dest; + int SpellNr; + int dx; + int dy; + int dz; + Object local_3c [4]; + Object local_2c; + Object Help; + + // try { // try from 0808a6de to 0808a8d4 has its CatchHandler @ 0808b318 + this = GetPlayer(CreatureID); + if (this == (TPlayer *)0x0) { + pcVar6 = "UseMagicItem: Kreatur existiert nicht.\n"; +LAB_0808b285: + error(pcVar6); +LAB_0808b22e: + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; +LAB_0808b0ba: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + } + bVar1 = Object::exists(Obj); + if (!bVar1) { + pcVar6 = &DAT_080fdcc0; + goto LAB_0808b285; + } + bVar1 = Object::exists(Dest); + if (!bVar1) { + Object::getObjectType(&local_2c); + pcVar6 = &DAT_080fdc80; +LAB_0808b229: + error(pcVar6,local_2c.ObjectID); + goto LAB_0808b22e; + } + bVar1 = CheckRight((this->super_TCreature).ID,NO_RUNES); + if (bVar1) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x1d; + goto LAB_0808b0ba; + } + local_2c = (Object)Obj->ObjectID; + SpellNr_00 = (int *)FindSpell(&local_2c); + if (SpellNr_00 == (int *)0x0) { + Object::getObjectType(&local_2c); + pcVar6 = &DAT_080fdc40; + goto LAB_0808b229; + } + Object::getObjectType(&local_2c); + if (local_2c.ObjectID == 99) { + local_2c = (Object)Dest->ObjectID; + local_60 = GetCreature(&local_2c); + } + else { + local_60 = (TCreature *)0x0; + } + Object::getContainer(local_3c); + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + dz = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + Object::getObjectType((Object *)&dz); + if (dz == 99) { + if ((int)SpellNr_00 - 1U < 0xff) { + bVar2 = (byte)SpellList[(int)SpellNr_00].Flags & 1; + } + else { + error(&DAT_080fa6c0,SpellNr_00); + bVar2 = 0; + } + if ((bVar2 != 0) && + ((local_60 == (TCreature *)0x0 || + (uVar4 = Object::getCreatureID(&local_2c), uVar4 != (this->super_TCreature).ID)) + )) { + local_3c[0].ObjectID = local_2c.ObjectID; + Dest->ObjectID = (ulong)local_2c; + dz = local_2c.ObjectID; + local_60 = GetCreature((Object *)&dz); + } + if ((int)SpellNr_00 - 1U < 0xff) { + bVar2 = (byte)SpellList[(int)SpellNr_00].Flags & 1; + } + else { + error(&DAT_080fa6c0,SpellNr_00); + bVar2 = 0; + } + if ((bVar2 == 0) && + ((local_60 == (TCreature *)0x0 || + (uVar4 = Object::getCreatureID(&local_2c), uVar4 == (this->super_TCreature).ID)) + )) { + local_3c[0].ObjectID = local_2c.ObjectID; + Dest->ObjectID = (ulong)local_2c; + dz = local_2c.ObjectID; + local_60 = GetCreature((Object *)&dz); + } + } + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + dz = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + CheckRuneLevel(&this->super_TCreature,(int)SpellNr_00); + dz = Dest->ObjectID; + z = (TCreature *)&dy; + piVar8 = &dx; + piVar7 = &SpellNr; + GetObjectCoordinates((Object *)&dz,piVar7,piVar8,(int *)z); + if (ServerMilliseconds < (this->super_TCreature).EarliestSpellTime) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x31; + goto LAB_0808b0ba; + } + if ((int)SpellNr_00 - 1U < 0xff) { + bVar2 = (byte)SpellList[(int)SpellNr_00].Flags & 1; + } + else { + piVar7 = SpellNr_00; + error(&DAT_080fa6c0,SpellNr_00); + bVar2 = 0; + } + if (bVar2 != 0) { + piVar7 = (int *)0x43; + bVar1 = CheckRight((this->super_TCreature).ID,ATTACK_EVERYWHERE); + if (!bVar1) { + piVar8 = (int *)(this->super_TCreature).posz; + piVar7 = (int *)(this->super_TCreature).posy; + bVar1 = IsProtectionZone(); + if ((bVar1) || + (bVar1 = IsProtectionZone(), piVar7 = (int *)dx, piVar8 = (int *)dy, bVar1)) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4,piVar7,piVar8); + *puVar5 = 0x2f; + goto LAB_0808b0ba; + } + } + } + if ((int)SpellNr_00 - 1U < 0xff) { + bVar2 = (byte)SpellList[(int)SpellNr_00].Flags & 1; + } + else { + piVar7 = SpellNr_00; + error(&DAT_080fa6c0,SpellNr_00); + bVar2 = 0; + } + if (bVar2 != 0) { + // try { // try from 0808b080 to 0808b289 has its CatchHandler @ 0808b318 + Object::getContainer((Object *)&dz); + piVar7 = &dz; + Object::getObjectType(local_3c); + if (local_3c[0].ObjectID != 0) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4,piVar7); + *puVar5 = 4; + goto LAB_0808b0ba; + } + } + switch(SpellNr_00) { + case (int *)0x4: + if (local_60 != (TCreature *)0x0) { + // try { // try from 0808a978 to 0808b044 has its CatchHandler @ 0808b295 + z = (TCreature *)ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x46,0x1e); +LAB_0808a997: + piVar8 = (int *)0x0; + Heal(); + break; + } + goto LAB_0808aa1b; + case (int *)0x5: + if (local_60 != (TCreature *)0x0) { + z = (TCreature *)ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0xfa,0); + goto LAB_0808a997; + } + goto LAB_0808aa1b; + default: + error("UseMagicItem: Spell %d noch nicht implementiert.\n",SpellNr_00); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + goto LAB_0808aa2d; + case (int *)0x7: + Damage_00 = ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0xf,5); + dz = Dest->ObjectID; + DmgType = 8; + AnimationNr = 4; + EffectNr = 6; + goto LAB_0808aae3; + case (int *)0x8: + Damage_00 = ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x1e,10); + dz = Dest->ObjectID; + EffectNr = 6; + DmgType = 8; + goto LAB_0808ab2e; + case (int *)0xc: + if (local_60 != (TCreature *)0x0) { + Convince(&this->super_TCreature,local_60); + break; + } + goto LAB_0808aa1b; + case (int *)0xe: + dz = Dest->ObjectID; + z = (TCreature *)&dz; + piVar8 = (int *)0x0; + ObjectIllusion(); + break; + case (int *)0xf: + ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x14,5); + dz = Dest->ObjectID; + goto LAB_0808abfc; + case (int *)0x10: + ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x32,0xf); + dz = Dest->ObjectID; + goto LAB_0808abfc; + case (int *)0x11: + dz = Dest->ObjectID; + goto LAB_0808ac98; + case (int *)0x12: + ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x3c,0x28); + dz = Dest->ObjectID; +LAB_0808abfc: + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + MassCombat(); + break; + case (int *)0x15: + Damage_00 = ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x96,0x14); + dz = Dest->ObjectID; + EffectNr = 0x12; + DmgType = 1; + AnimationNr = 0xb; + goto LAB_0808aae3; + case (int *)0x19: + dz = Dest->ObjectID; + goto LAB_0808ad72; + case (int *)0x1a: + dz = Dest->ObjectID; + goto LAB_0808ad72; + case (int *)0x1b: + dz = Dest->ObjectID; + goto LAB_0808ad72; + case (int *)0x1c: + dz = Dest->ObjectID; + goto LAB_0808adf7; + case (int *)0x1e: + dz = Dest->ObjectID; + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + DeleteField(); + break; + case (int *)0x1f: + if (local_60 != (TCreature *)0x0) { + piVar8 = (int *)0x0; + NegatePoison(); + z = local_60; + break; + } + goto LAB_0808aa1b; + case (int *)0x20: + dz = Dest->ObjectID; + goto LAB_0808adf7; + case (int *)0x21: + dz = Dest->ObjectID; +LAB_0808adf7: + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + CreateFieldWall(); + break; + case (int *)0x32: + Damage_00 = ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x78,0x14); + dz = Dest->ObjectID; + EffectNr = 0x10; + DmgType = 0x40; +LAB_0808ab2e: + AnimationNr = 4; + goto LAB_0808aae3; + case (int *)0x36: + if (local_60 != (TCreature *)0x0) { + uVar3 = TPlayer::GetEffectiveProfession(this); + if (uVar3 == '\x04') { + z = (TCreature *)SpellList[(int)SpellNr_00].SoulPoints; + piVar8 = (int *)SpellList[(int)SpellNr_00].Mana; + MagicGoStrength(); + break; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4,piVar7); + *puVar5 = 0x1d; + goto LAB_0808aa2d; + } +LAB_0808aa1b: + puVar5 = (undefined4 *)__cxa_allocate_exception(4,piVar7,piVar8); + *puVar5 = 0x27; +LAB_0808aa2d: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + case (int *)0x37: + dz = Dest->ObjectID; + goto LAB_0808ac98; + case (int *)0x4d: + Damage_00 = ComputeDamage(&this->super_TCreature,(int)SpellNr_00,0x46,0x14); + dz = Dest->ObjectID; + EffectNr = 0x11; + DmgType = 0x20; + AnimationNr = 5; +LAB_0808aae3: + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + Combat(&this->super_TCreature,(Object *)&dz,0,0,Damage_00,EffectNr,AnimationNr,DmgType); + break; + case (int *)0x4e: + dz = Dest->ObjectID; + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + CleanupField(); + break; + case (int *)0x53: + dz = Dest->ObjectID; + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + RaiseDead(); + break; + case (int *)0x56: + dz = Dest->ObjectID; +LAB_0808ad72: + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + CreateField(); + break; + case (int *)0x5b: + dz = Dest->ObjectID; +LAB_0808ac98: + z = (TCreature *)0x0; + piVar8 = (int *)0x0; + MassCreateField(); + } + bVar1 = Object::exists(Obj); + if (bVar1) { + dz = Obj->ObjectID; + DeleteRune((Object *)&dz); + } + if ((int)SpellNr_00 - 1U < 0xff) { + bVar2 = (byte)SpellList[(int)SpellNr_00].Flags & 1; + } + else { + error(&DAT_080fa6c0,SpellNr_00,piVar8,z); + bVar2 = 0; + } + if (bVar2 != 0) { + TCreature::BlockLogout(&this->super_TCreature,0x3c,false); + } + return; +} + + + +void DrinkPotion(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + TPlayer *pTVar2; + ulong uVar3; + undefined4 *puVar4; + TPlayer *pl; + char *Text; + Object local_2c [7]; + + // try { // try from 0808b348 to 0808b48e has its CatchHandler @ 0808b4b5 + pTVar2 = GetPlayer(CreatureID); + if (pTVar2 == (TPlayer *)0x0) { + Text = "DrinkPotion: Kreatur existiert nicht.\n"; + } + else { + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LIQUIDCONTAINER); + if (bVar1) { + uVar3 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + if (uVar3 == 10) { + ComputeDamage((TCreature *)0x0,0,100,0x32); + RefreshMana(); + } + else { + if (uVar3 != 0xb) { + Text = &DAT_080fdd40; + goto LAB_0808b420; + } + ComputeDamage((TCreature *)0x0,0,0x32,0x19); + Heal(); + } + local_2c[0] = (Object)Obj->ObjectID; + Change(local_2c,CONTAINERLIQUIDTYPE,0); + return; + } + Text = &DAT_080fdd80; + } + else { + Text = &DAT_080fdde0; + } + } +LAB_0808b420: + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitCircles(void) + +{ + undefined4 *puVar1; + uint uVar2; + int iVar3; + int i; + int iVar4; + int x; + int iVar5; + int local_1160; + int local_1150; + int y; + int rad; + int Center; + int Y; + int X; + ifstream IN; + undefined4 local_1134 [3]; + uint auStack_1128 [23]; + __basic_file local_10cc [25]; + undefined1 local_10b3; + undefined *local_10ac; + ios_base local_10a8 [16]; + uint local_1098; + char local_101c [4]; + char FileName [4096]; + + // try { // try from 0808b4eb to 0808b4ef has its CatchHandler @ 0808b910 + std::ios_base::ios_base(local_10a8); + local_10ac = (undefined *)0x8128950; + // try { // try from 0808b514 to 0808b518 has its CatchHandler @ 0808b886 + std::istream::istream((istream *)&X,(streambuf *)(std::ifstream::VTT + 4)); + X = (int)&DAT_08128994; + local_10ac = &DAT_081289a8; + // try { // try from 0808b538 to 0808b53c has its CatchHandler @ 0808b880 + std::filebuf::filebuf((filebuf *)local_1134); + // try { // try from 0808b550 to 0808b554 has its CatchHandler @ 0808b820 + std::ios::init((EVP_PKEY_CTX *)&local_10ac); + local_1160 = 0; + iVar4 = 9; + do { + uVar2 = 0x104; + puVar1 = (undefined4 *)((int)Circle[0].x + local_1160); + if (((uint)puVar1 & 4) != 0) { + puVar1 = (undefined4 *)((int)Circle[0].x + local_1160 + 4); + uVar2 = 0x100; + *(undefined4 *)((int)Circle[0].x + local_1160) = 0; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + *puVar1 = 0; + puVar1 = puVar1 + 1; + } + local_1160 = local_1160 + 0x104; + iVar4 = iVar4 + -1; + } while (-1 < iVar4); + sprintf(local_101c,"%s/circles.dat",DATAPATH); + // try { // try from 0808b5e9 to 0808b6a8 has its CatchHandler @ 0808b88c + iVar4 = std::filebuf::open((char *)local_1134,(int)local_101c,8); + if (iVar4 == 0) { + std::ios::clear((int)&X + *(int *)(X + -0xc), + *(uint *)((int)auStack_1128 + *(int *)(X + -0xc)) | 4); + } + if ((local_1098 & 5) == 0) { + std::istream::operator>>((istream *)&X,&Y); + std::istream::operator>>((istream *)&X,&Center); + std::istream::operator>>((istream *)&X,&rad); + if (((Y - 1U < 0x15) && (0 < Center)) && (Center < 0x16)) { + local_1150 = 0; + iVar4 = Center; + iVar3 = Y; + if (0 < Center) { + do { + iVar5 = 0; + if (0 < iVar3) { + do { + std::istream::operator>>((istream *)&X,&y); + if (y < 10) { + iVar4 = Circle[y].Count; + Circle[y].x[iVar4] = iVar5 - rad; + Circle[y].Count = iVar4 + 1; + Circle[y].y[iVar4] = local_1150 - rad; + } + iVar5 = iVar5 + 1; + iVar4 = Center; + iVar3 = Y; + } while (iVar5 < Y); + } + local_1150 = local_1150 + 1; + } while (local_1150 < iVar4); + } + X = (int)&DAT_08128994; + local_10ac = &DAT_081289a8; + local_1134[0] = 0x8128ad0; + // try { // try from 0808b73e to 0808b789 has its CatchHandler @ 0808b910 + std::filebuf::close((int)local_1134); + local_10b3 = 0; + std::__basic_file::~__basic_file(local_10cc); + std::streambuf::~streambuf((streambuf *)local_1134); + std::istream::~istream((istream *)&X); + std::ios::~ios((ios *)&local_10ac); + return; + } + // try { // try from 0808b79e to 0808b813 has its CatchHandler @ 0808b88c + error(&DAT_080fde60); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot process \"circles.dat\""; + } + else { + error(&DAT_080fdea0,local_101c); + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "Cannot open \"circles.dat\""; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: va + +TSpellList * CreateSpell(int SpellNr,...) + +{ + int iVar1; + char *__s1; + int iVar2; + undefined4 *puVar3; + char (*__s2) [6]; + int i; + int iVar4; + char *Syl; + int local_18; + int syl; + va_list va; + + local_18 = 0; + syl = (int)&stack0x00000008; + do { + iVar1 = syl + 4; + __s1 = *(char **)syl; + if (*__s1 == '\0') { + return SpellList + SpellNr; + } + __s2 = SpellSyllable; + iVar4 = 1; + do { + __s2 = __s2 + 1; + iVar2 = strcmp(__s1,*__s2); + syl = iVar1; + if (iVar2 == 0) { + SpellList[SpellNr].Syllable[local_18] = (uchar)iVar4; + local_18 = local_18 + 1; + if (10 < local_18) { + // try { // try from 0808b9c1 to 0808b9ef has its CatchHandler @ 0808ba05 + error(&DAT_080fdee0,SpellNr); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "Spell has too many syllables"; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); + } + break; + } + iVar4 = iVar4 + 1; + } while (iVar4 < 0x34); + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitSpells(void) + +{ + uchar *puVar1; + TSpellList *S; + int iVar2; + TSpellList *pTVar3; + int i; + int iVar4; + + iVar2 = 0x24; + iVar4 = 0xfe; + do { + puVar1 = SpellList[0].Syllable + iVar2; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 4; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 8; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0xc; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0x10; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0x14; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0x18; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0x1c; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + puVar1 = SpellList[0].Syllable + iVar2 + 0x20; + puVar1[0] = '\0'; + puVar1[1] = '\0'; + puVar1[2] = '\0'; + puVar1[3] = '\0'; + iVar2 = iVar2 + 0x24; + iVar4 = iVar4 + -1; + } while (-1 < iVar4); + // try { // try from 0808ba9d to 0808dadb has its CatchHandler @ 0808daf8 + pTVar3 = CreateSpell(1,"ex",&DAT_080fe2ae,&DAT_080fed0c); + pTVar3->Mana = 0x19; + pTVar3->Level = 9; + pTVar3->Flags = 8; + pTVar3->Comment = "Light Healing"; + pTVar3 = CreateSpell(2,"ex",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fed0c); + pTVar3->Mana = 0x28; + pTVar3->Level = 0xb; + pTVar3->Flags = 8; + pTVar3->Comment = "Intense Healing"; + pTVar3 = CreateSpell(3,"ex",&DAT_080fe2ae,&DAT_080fe2d5,&DAT_080fed0c); + pTVar3->Mana = 0xa0; + pTVar3->Level = 0x14; + pTVar3->Flags = 8; + pTVar3->Comment = "Ultimate Healing"; + pTVar3 = CreateSpell(4,"ad",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fed0c); + pTVar3->Mana = 0xf0; + pTVar3->Level = 0xf; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x05'; + pTVar3->Flags = 8; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 1; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Intense Healing Rune"; + pTVar3 = CreateSpell(5,"ad",&DAT_080fe2ae,&DAT_080fe2d5,&DAT_080fed0c); + pTVar3->Mana = 400; + pTVar3->Level = 0x18; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\r'; + pTVar3->Flags = 8; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Ultimate Healing Rune"; + pTVar3 = CreateSpell(6,"ut",&DAT_080fe31a,&DAT_080fe316,&DAT_080fed0c); + pTVar3->Mana = 0x3c; + pTVar3->Level = 0xe; + pTVar3->Flags = 2; + pTVar3->Comment = "Haste"; + pTVar3 = CreateSpell(7,"ad",&DAT_080fe31e,&DAT_080fed0c); + pTVar3->Mana = 0x78; + pTVar3->Level = 0xf; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x1b'; + pTVar3->Flags = 9; + pTVar3->Amount = 5; + pTVar3->RuneLevel = 0; + pTVar3->SoulPoints = 1; + pTVar3->Comment = "Light Magic Missile"; + pTVar3 = CreateSpell(8,"ad",&DAT_080fe31e,&DAT_080fe2c0,&DAT_080fed0c); + pTVar3->Mana = 0x118; + pTVar3->Level = 0x19; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '3'; + pTVar3->Flags = 9; + pTVar3->Amount = 5; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Heavy Magic Missile"; + pTVar3 = CreateSpell(9,"ut",&DAT_080fe34f,"res",&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0x19; + pTVar3->Flags = 1; + pTVar3->Comment = "Summon Creature"; + pTVar3 = CreateSpell(10,"ut",&DAT_080fe34f,&DAT_080fe363,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 8; + pTVar3->Flags = 0; + pTVar3->Comment = "Light"; + pTVar3 = CreateSpell(0xb,"ut",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe363,&DAT_080fed0c); + pTVar3->Mana = 0x3c; + pTVar3->Level = 0xd; + pTVar3->Flags = 0; + pTVar3->Comment = "Great Light"; + pTVar3 = CreateSpell(0xc,"ad",&DAT_080fe377,&DAT_080fe373,&DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0x10; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x1e'; + pTVar3->Flags = 1; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 5; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Convince Creature"; + pTVar3 = CreateSpell(0xd,"ex",&DAT_080fe34f,&DAT_080fe38d,&DAT_080fe316,&DAT_080fed0c); + pTVar3->Mana = 0xfa; + pTVar3->Level = 0x26; + pTVar3->Flags = 1; + pTVar3->Comment = "Energy Wave"; + pTVar3 = CreateSpell(0xe,"ad",&DAT_080fe34f,&DAT_080fe39e,&DAT_080fed0c); + pTVar3->Mana = 600; + pTVar3->Level = 0x1b; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x1f'; + pTVar3->Flags = 0; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Chameleon"; + pTVar3 = CreateSpell(0xf,"ad",&DAT_080fe31e,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 0xa0; + pTVar3->Level = 0x11; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '*'; + pTVar3->Flags = 9; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 2; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Fireball"; + pTVar3 = CreateSpell(0x10,"ad",&DAT_080fe31e,&DAT_080fe2c0,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 0x1e0; + pTVar3->Level = 0x17; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = ','; + pTVar3->Flags = 9; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Great Fireball"; + pTVar3 = CreateSpell(0x11,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 600; + pTVar3->Level = 0x1b; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '-'; + pTVar3->Flags = 1; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 5; + pTVar3->SoulPoints = 4; + pTVar3->Comment = "Firebomb"; + pTVar3 = CreateSpell(0x12,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe316,&DAT_080fed0c); + pTVar3->Mana = 0x2d0; + pTVar3->Level = 0x1f; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '5'; + pTVar3->Flags = 1; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 6; + pTVar3->SoulPoints = 4; + pTVar3->Comment = "Explosion"; + pTVar3 = CreateSpell(0x13,"ex",&DAT_080fe34f,&DAT_080fe3ac,&DAT_080fe316,&DAT_080fed0c); + pTVar3->Mana = 0x50; + pTVar3->Level = 0x12; + pTVar3->Flags = 9; + pTVar3->Comment = "Fire Wave"; + pTVar3 = CreateSpell(0x14,"ex",&DAT_080fe3d7,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 8; + pTVar3->Flags = 0; + pTVar3->Comment = "Find Person"; + pTVar3 = CreateSpell(0x15,"ad",&DAT_080fe31e,&DAT_080fe2d5,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 0x370; + pTVar3->Level = 0x2d; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\b'; + pTVar3->Flags = 1; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 0xf; + pTVar3->SoulPoints = 5; + pTVar3->Comment = "Sudden Death"; + pTVar3 = CreateSpell(0x16,"ex",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe363,&DAT_080fed0c); + pTVar3->Mana = 100; + pTVar3->Level = 0x17; + pTVar3->Flags = 1; + pTVar3->Comment = "Energy Beam"; + pTVar3 = CreateSpell(0x17,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3e7,&DAT_080fe363, + &DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0x1d; + pTVar3->Flags = 1; + pTVar3->Comment = "Great Energy Beam"; + pTVar3 = CreateSpell(0x18,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3c0,&DAT_080fe3e7, + &DAT_080fed0c); + pTVar3->Mana = 0x4b0; + pTVar3->Level = 0x3c; + pTVar3->Flags = 3; + pTVar3->Comment = "Ultimate Explosion"; + pTVar3 = CreateSpell(0x19,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 0xf0; + pTVar3->Level = 0xf; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = ')'; + pTVar3->Flags = 1; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 1; + pTVar3->SoulPoints = 1; + pTVar3->Comment = "Fire Field"; + pTVar3 = CreateSpell(0x1a,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0xe; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x19'; + pTVar3->Flags = 1; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 0; + pTVar3->SoulPoints = 1; + pTVar3->Comment = "Poison Field"; + pTVar3 = CreateSpell(0x1b,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 0x140; + pTVar3->Level = 0x12; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x11'; + pTVar3->Flags = 1; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 3; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Energy Field"; + pTVar3 = CreateSpell(0x1c,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe3ac, + &DAT_080fed0c); + pTVar3->Mana = 0x30c; + pTVar3->Level = 0x21; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '+'; + pTVar3->Flags = 1; + pTVar3->Amount = 4; + pTVar3->RuneLevel = 6; + pTVar3->SoulPoints = 4; + pTVar3->Comment = "Fire Wall"; + pTVar3 = CreateSpell(0x1d,"ex",&DAT_081075ea,&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 0x1e; + pTVar3->Level = 10; + pTVar3->Flags = 0; + pTVar3->Comment = "Antidote"; + pTVar3 = CreateSpell(0x1e,"ad",&DAT_080fe45e,&DAT_080fe41d,&DAT_080fed0c); + pTVar3->Mana = 0x78; + pTVar3->Level = 0x11; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x01'; + pTVar3->Flags = 0; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 3; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Destroy Field"; + pTVar3 = CreateSpell(0x1f,"ad",&DAT_081075ea,&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0xf; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x06'; + pTVar3->Flags = 0; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 0; + pTVar3->SoulPoints = 1; + pTVar3->Comment = "Antidote Rune"; + pTVar3 = CreateSpell(0x20,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe42d, + &DAT_080fed0c); + pTVar3->Mana = 0x280; + pTVar3->Level = 0x1d; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x1d'; + pTVar3->Flags = 1; + pTVar3->Amount = 4; + pTVar3->RuneLevel = 5; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Poison Wall"; + pTVar3 = CreateSpell(0x21,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe41d,&DAT_080fe3e7, + &DAT_080fed0c); + pTVar3->Mana = 1000; + pTVar3->Level = 0x29; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x13'; + pTVar3->Flags = 1; + pTVar3->Amount = 4; + pTVar3->RuneLevel = 9; + pTVar3->SoulPoints = 5; + pTVar3->Comment = "Energy Wall"; + pTVar3 = CreateSpell(0x22,"al",&DAT_080fe34f,&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Item"; + pTVar3 = CreateSpell(0x23,"al",&DAT_080fe34f,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Item"; + pTVar3 = CreateSpell(0x25,"al",&DAT_080fe31a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Move"; + pTVar3 = CreateSpell(0x26,"ut",&DAT_080fe34f,"res",&DAT_080fe39e,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 100; + pTVar3->Level = 0x17; + pTVar3->Flags = 0; + pTVar3->Comment = "Creature Illusion"; + pTVar3 = CreateSpell(0x27,"ut",&DAT_080fe31a,&DAT_080fe2c0,&DAT_080fe316,&DAT_080fed0c); + pTVar3->Mana = 100; + pTVar3->Level = 0x14; + pTVar3->Flags = 2; + pTVar3->Comment = "Strong Haste"; + pTVar3 = CreateSpell(0x28,"al",&DAT_080fe34f,"cogni",&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Experience"; + pTVar3 = CreateSpell(0x29,"al",&DAT_080fe377,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Change Data"; + pTVar3 = CreateSpell(0x2a,"ex",&DAT_080fe34f,&DAT_080fe4e4,&DAT_080fed0c); + pTVar3->Mana = 0x78; + pTVar3->Level = 0xe; + pTVar3->SoulPoints = 1; + pTVar3->Flags = 0; + pTVar3->Comment = "Food"; + pTVar3 = CreateSpell(0x2c,"ut",&DAT_080fe4ed,&DAT_080fe2d5,&DAT_080fed0c); + pTVar3->Mana = 0x32; + pTVar3->Level = 0xe; + pTVar3->Flags = 0; + pTVar3->Comment = "Magic Shield"; + pTVar3 = CreateSpell(0x2d,"ut",&DAT_081075ea,&DAT_080fe4fe,&DAT_080fed0c); + pTVar3->Mana = 0x1b8; + pTVar3->Level = 0x23; + pTVar3->Flags = 0; + pTVar3->Comment = "Invisible"; + pTVar3 = CreateSpell(0x2e,"al",&DAT_080fe34f,"cogni",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Skill Experience"; + pTVar3 = CreateSpell(0x2f,"al",&DAT_080fe31a,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Teleport to Friend"; + pTVar3 = CreateSpell(0x30,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 0x82; + pTVar3->Level = 0x10; + pTVar3->SoulPoints = 2; + pTVar3->Flags = 0; + pTVar3->Comment = "Poisoned Arrow"; + pTVar3 = CreateSpell(0x31,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 0x122; + pTVar3->Level = 0x19; + pTVar3->SoulPoints = 3; + pTVar3->Flags = 0; + pTVar3->Comment = "Explosive Arrow"; + pTVar3 = CreateSpell(0x32,"ad",&DAT_080fe34f,"res",&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 600; + pTVar3->Level = 0x1b; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '0'; + pTVar3->Flags = 3; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 7; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Soulfire"; + pTVar3 = CreateSpell(0x33,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fed0c); + pTVar3->Mana = 100; + pTVar3->Level = 0xd; + pTVar3->SoulPoints = 1; + pTVar3->Flags = 0; + pTVar3->Comment = "Conjure Arrow"; + pTVar3 = CreateSpell(0x34,"al","liber",&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Retrieve Friend"; + pTVar3 = CreateSpell(0x35,"al",&DAT_080fe34f,"res",&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Summon Wild Creature"; + pTVar3 = CreateSpell(0x36,"ad",&DAT_081075ea,&DAT_080fe31a,&DAT_080fed0c); + pTVar3->Mana = 0x578; + pTVar3->Level = 0x36; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x12'; + pTVar3->Flags = 3; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 0x12; + pTVar3->SoulPoints = 3; + pTVar3->Comment = "Paralyze"; + pTVar3 = CreateSpell(0x37,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 0x370; + pTVar3->Level = 0x25; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x02'; + pTVar3->Flags = 3; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 10; + pTVar3->SoulPoints = 5; + pTVar3->Comment = "Energybomb"; + pTVar3 = CreateSpell(0x38,"ex",&DAT_080fe34f,&DAT_080fe2c0,&DAT_080fe3c0,&DAT_080fe42d, + &DAT_080fed0c); + pTVar3->Mana = 600; + pTVar3->Level = 0x32; + pTVar3->Flags = 3; + pTVar3->Comment = "Poison Storm"; + pTVar3 = CreateSpell(0x39,"om",&DAT_081075ea,"liber",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fe34a, + &DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Banish Account"; + pTVar3 = CreateSpell(0x3a,"al",&DAT_080fe3d7,&DAT_080fe5c9,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Position"; + pTVar3 = CreateSpell(0x3c,"om",&DAT_080fe31a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Temple Teleport"; + pTVar3 = CreateSpell(0x3d,"om",&DAT_081075ea,&DAT_080fe2c0,"liber",&DAT_080fe34a,&DAT_080fe34a, + &DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Delete Account"; + pTVar3 = CreateSpell(0x3e,"om",&DAT_080fe4ed,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Set Namerule"; + pTVar3 = CreateSpell(0x3f,"al",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Create Gold"; + pTVar3 = CreateSpell(0x40,"al",&DAT_080fe377,&DAT_080fe2d5,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Change Profession or Sex"; + pTVar3 = CreateSpell(0x41,"om",&DAT_080fe62c,&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Entry in Criminal Record"; + pTVar3 = CreateSpell(0x42,"om",&DAT_081075ea,&DAT_080fe649,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Namelock"; + pTVar3 = CreateSpell(0x43,"om",&DAT_081075ea,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Kick Player"; + pTVar3 = CreateSpell(0x44,"om",&DAT_081075ea,&DAT_080fe2c0,"res",&DAT_080fe34a,&DAT_080fe34a, + &DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Delete Character"; + pTVar3 = CreateSpell(0x45,"om",&DAT_081075ea,&DAT_080fe3e7,&DAT_080fe34a,&DAT_080fe34a, + &DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Banish IP Address"; + pTVar3 = CreateSpell(0x46,"om",&DAT_081075ea,"res",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fe34a, + &DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Banish Character"; + pTVar3 = CreateSpell(0x47,"al",&DAT_080fe377,&DAT_080fe373,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Invite Guests"; + pTVar3 = CreateSpell(0x48,"al",&DAT_080fe377,&DAT_080fe6a5,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Invite Subowners"; + pTVar3 = CreateSpell(0x49,"al",&DAT_081075ea,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Kick Guest"; + pTVar3 = CreateSpell(0x4a,"al",&DAT_080fe377,&DAT_080fe41d,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Edit Door"; + pTVar3 = CreateSpell(0x4b,"ut",&DAT_080fe34f,&DAT_080fe3e7,&DAT_080fe363,&DAT_080fed0c); + pTVar3->Mana = 0x8c; + pTVar3->Level = 0x1a; + pTVar3->Flags = 2; + pTVar3->Comment = "Ultimate Light"; + pTVar3 = CreateSpell(0x4c,"ex",&DAT_080fe31a,&DAT_080fe5c9,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 9; + pTVar3->Flags = 2; + pTVar3->Comment = "Magic Rope"; + pTVar3 = CreateSpell(0x4d,"ad",&DAT_080fe34f,"res",&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 400; + pTVar3->Level = 0x15; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = ' '; + pTVar3->Flags = 3; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Envenom"; + pTVar3 = CreateSpell(0x4e,"ad",&DAT_080fe45e,&DAT_080fe5c9,&DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0x15; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '2'; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 3; + pTVar3->Flags = 3; + pTVar3->Comment = "Desintegrate"; + pTVar3 = CreateSpell(0x4f,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe38d,&DAT_080fed0c); + pTVar3->Mana = 0x8c; + pTVar3->Level = 0x11; + pTVar3->SoulPoints = 2; + pTVar3->Flags = 2; + pTVar3->Comment = "Conjure Bolt"; + pTVar3 = CreateSpell(0x50,"ex",&DAT_080fe31e,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0x23; + pTVar3->Flags = 7; + pTVar3->Comment = "Berserk"; + pTVar3 = CreateSpell(0x51,"ex",&DAT_080fe31a,&DAT_080fe316,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0x32; + pTVar3->Level = 0xc; + pTVar3->Flags = 2; + pTVar3->Comment = "Levitate"; + pTVar3 = CreateSpell(0x52,"ex",&DAT_080fe2ae,&DAT_080fe2c0,&DAT_080fe3c0,"res",&DAT_080fed0c); + pTVar3->Mana = 0x96; + pTVar3->Level = 0x24; + pTVar3->Flags = 10; + pTVar3->Comment = "Mass Healing"; + pTVar3 = CreateSpell(0x53,"ad",&DAT_081075ea,&DAT_080fe38d,&DAT_080fed0c); + pTVar3->Mana = 600; + pTVar3->Level = 0x1b; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '8'; + pTVar3->Amount = 1; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 5; + pTVar3->Flags = 3; + pTVar3->Comment = "Animate Dead"; + pTVar3 = CreateSpell(0x54,"ex",&DAT_080fe2ae,&DAT_080fe373,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0x46; + pTVar3->Level = 0x12; + pTVar3->Flags = 10; + pTVar3->Comment = "Heal Friend"; + pTVar3 = CreateSpell(0x55,"ex",&DAT_081075ea,&DAT_080fe3c0,&DAT_080fe38d,&DAT_080fed0c); + pTVar3->Mana = 500; + pTVar3->Level = 0x1e; + pTVar3->Flags = 3; + pTVar3->Comment = "Undead Legion"; + pTVar3 = CreateSpell(0x56,"ad",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe5c9,&DAT_080fed0c); + pTVar3->Mana = 0x2ee; + pTVar3->Level = 0x20; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '!'; + pTVar3->Amount = 3; + pTVar3->RuneLevel = 9; + pTVar3->SoulPoints = 5; + pTVar3->Flags = 3; + pTVar3->Comment = "Magic Wall"; + pTVar3 = CreateSpell(0x57,"ex",&DAT_080fe31e,&DAT_080fe38d,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 0xb; + pTVar3->Flags = 3; + pTVar3->Comment = "Force Strike"; + pTVar3 = CreateSpell(0x58,"ex",&DAT_080fe31e,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 0xc; + pTVar3->Flags = 3; + pTVar3->Comment = "Energy Strike"; + pTVar3 = CreateSpell(0x59,"ex",&DAT_080fe31e,&DAT_080fe3ac,&DAT_080fed0c); + pTVar3->Mana = 0x14; + pTVar3->Level = 0xc; + pTVar3->Flags = 3; + pTVar3->Comment = "Flame Strike"; + pTVar3 = CreateSpell(0x5a,"ex",&DAT_081075ea,&DAT_080fe39e,&DAT_080fed0c); + pTVar3->Mana = 200; + pTVar3->Level = 0x1a; + pTVar3->Flags = 2; + pTVar3->Comment = "Cancel Invisibility"; + pTVar3 = CreateSpell(0x5b,"ad",&DAT_080fe34f,&DAT_080fe3c0,&DAT_080fe42d,&DAT_080fed0c); + pTVar3->Mana = 0x208; + pTVar3->Level = 0x19; + pTVar3->RuneGr = 'O'; + pTVar3->RuneNr = '\x1a'; + pTVar3->Flags = 3; + pTVar3->Amount = 2; + pTVar3->RuneLevel = 4; + pTVar3->SoulPoints = 2; + pTVar3->Comment = "Poisonbomb"; + pTVar3 = CreateSpell(0x5c,"ex",&DAT_080fe377,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 0x50; + pTVar3->Level = 0x29; + pTVar3->Flags = 2; + pTVar3->Comment = "Enchant Staff"; + pTVar3 = CreateSpell(0x5d,"ex",&DAT_080fe377,"res",&DAT_080fed0c); + pTVar3->Mana = 0x1e; + pTVar3->Level = 0x14; + pTVar3->Flags = 3; + pTVar3->Comment = "Challenge"; + pTVar3 = CreateSpell(0x5e,"ex",&DAT_080fe34f,&DAT_080fe41d,&DAT_080fe2d5,&DAT_080fed0c); + pTVar3->Mana = 0xdc; + pTVar3->Level = 0x1b; + pTVar3->Flags = 3; + pTVar3->Comment = "Wild Growth"; + pTVar3 = CreateSpell(0x5f,"ex",&DAT_080fe34f,&DAT_080fe534,&DAT_080fe3e7,&DAT_080fed0c); + pTVar3->Mana = 800; + pTVar3->Level = 0x3b; + pTVar3->SoulPoints = 3; + pTVar3->Flags = 2; + pTVar3->Comment = "Power Bolt"; + pTVar3 = CreateSpell(0x60,"al",&DAT_080fe3d7,"cogni",&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Get Quest Value"; + pTVar3 = CreateSpell(0x61,"al",&DAT_080fe377,"cogni",&DAT_080fe34a,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Set Quest Value"; + pTVar3 = CreateSpell(0x62,"al",&DAT_080fe45e,&DAT_080fe5c9,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Desintegrate Spell"; + pTVar3 = CreateSpell(99,"al",&DAT_080fe31a,&DAT_080fe316,&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Levitate Gamemaster"; + pTVar3 = CreateSpell(100,"al",&DAT_081075ea,"cogni",&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Clear Quest Values"; + pTVar3 = CreateSpell(0x65,"al",&DAT_080fe45e,&DAT_080fe3c0,"res",&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Kill All Creatures"; + pTVar3 = CreateSpell(0x66,"al",&DAT_080fe34f,&DAT_080fe3c0,"res",&DAT_080fe34a,&DAT_080fed0c); + pTVar3->Mana = 0; + pTVar3->Level = 0; + pTVar3->Flags = 0; + pTVar3->Comment = "Start Monsterraid"; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitMagic(void) + +{ + // try { // try from 0808db16 to 0808db2b has its CatchHandler @ 0808db30 + InitCircles(); + InitSpells(); + InitLog("banish"); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitMagic(void) + +{ + return; +} + + + +void CreateField(int x,int y,int z,int FieldType,ulong Owner,bool Peaceful) + +{ + bool bVar1; + undefined4 *puVar2; + ObjectType *this; + Object local_6c [4]; + ObjectType local_5c; + Object Help; + ObjectType local_4c; + Object Obj; + ObjectType local_3c [4]; + ObjectType local_2c; + ObjectType ObjectType; + + // try { // try from 0808db84 to 0808dc7d has its CatchHandler @ 0808dde0 + ::ObjectType::setTypeID(&local_2c,0); + switch(FieldType) { + default: + error(&DAT_080fdf20,FieldType); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + case 1: + GetSpecialObject((SPECIALMEANING)&local_4c); + ::ObjectType::setTypeID(&local_2c,local_4c.TypeID); + this = local_3c; + goto LAB_0808dbd1; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + } + GetSpecialObject((SPECIALMEANING)local_3c); + ::ObjectType::setTypeID(&local_2c,local_3c[0].TypeID); + this = &local_4c; +LAB_0808dbd1: + ::ObjectType::setTypeID(this,local_2c.TypeID); + bVar1 = FieldPossible(); + if (bVar1) { + GetFirstObject(); + if (local_4c.TypeID != NONE.ObjectID) { + do { + local_5c.TypeID = local_4c.TypeID; + local_3c[0].TypeID = NONE.ObjectID; + Object::getNextObject(local_6c); + local_4c.TypeID = local_6c[0].ObjectID; + local_3c[0].TypeID = local_6c[0].ObjectID; + Object::getObjectType(local_6c); + bVar1 = ::ObjectType::getFlag((ObjectType *)local_6c,MAGICFIELD); + if (bVar1) { + local_6c[0].ObjectID = local_5c.TypeID; + // try { // try from 0808dcf9 to 0808dd64 has its CatchHandler @ 0808dde0 + Delete(local_6c,-1); + } + } while (local_4c.TypeID != NONE.ObjectID); + } + local_5c.TypeID = NONE.ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + // try { // try from 0808dc9e to 0808dcdf has its CatchHandler @ 0808dda3 + ::ObjectType::setTypeID(&local_5c,local_2c.TypeID); + GetMapContainer((int)&local_4c,x,y); + Create(local_6c,&local_4c,(ulong)&local_5c); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_SpellSyllable(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void handleField(TImpact * this, int param_1, int param_2, int param_3) + +void __thiscall TImpact::handleField(TImpact *this,int param_1,int param_2,int param_3) + +{ + return; +} + + + +// DWARF original prototype: void handleCreature(TImpact * this, TCreature * param_1) + +void __thiscall TImpact::handleCreature(TImpact *this,TCreature *param_1) + +{ + return; +} + + + +// DWARF original prototype: bool isAggressive(TImpact * this) + +bool __thiscall TImpact::isAggressive(TImpact *this) + +{ + return true; +} + + + +// DWARF original prototype: bool isAggressive(THealingImpact * this) + +bool __thiscall THealingImpact::isAggressive(THealingImpact *this) + +{ + return false; +} + + + +// DWARF original prototype: void +// ~basic_stringbuf(basic_stringbuf,std::allocator_> * this, int +// __in_chrg) + +void __thiscall basic_stringbuf<>::~basic_stringbuf(basic_stringbuf<> *this,int __in_chrg) + +{ + int *piVar1; + int iVar2; + int iVar3; + size_t __size; + + *(undefined4 *)this = 0x8128a08; + iVar3 = *(int *)(this + 0x50); + LOCK(); + piVar1 = (int *)(iVar3 + -4); + iVar2 = *piVar1; + *piVar1 = *piVar1 + -1; + UNLOCK(); + if (iVar2 < 1) { + // try { // try from 0808deb4 to 0808deb8 has its CatchHandler @ 0808debb + std::__default_alloc_template::deallocate + ((void *)(iVar3 + -0xc),*(int *)(iVar3 + -8) + 0xd); + } + *(undefined4 *)this = 0x81289c8; + this[0x10] = (basic_stringbuf<>)0x0; + *(undefined4 *)(this + 8) = 0; + *(undefined4 *)(this + 0xc) = 0; + *(undefined4 *)(this + 0x2c) = 0; + std::locale::~locale((locale *)(this + 0x30)); + return; +} + + + +// DWARF original name: _S_construct + +char * basic_string<>::_S_construct<>(void) + +{ + undefined1 uVar1; + uint *puVar2; + uint *__dest; + _Rep *__r; + uint __n; + void *in_stack_00000004; + void *in_stack_00000008; + allocator *in_stack_0000000c; + + __n = (int)in_stack_00000008 - (int)in_stack_00000004; + if (in_stack_00000004 == in_stack_00000008) { + LOCK(); + std::string::_S_empty_rep_storage._8_4_ = std::string::_S_empty_rep_storage._8_4_ + 1; + UNLOCK(); + __dest = (uint *)(std::string::_S_empty_rep_storage + 0xc); + } + else { + if (in_stack_00000004 == (void *)0x0) { + std::__throw_logic_error("attempt to create string with null pointer"); + } + puVar2 = (uint *)std::string::_Rep::_S_create(__n,in_stack_0000000c); + __dest = puVar2 + 3; + memcpy(__dest,in_stack_00000004,__n); + uVar1 = std::string::_Rep::_S_terminal; + *puVar2 = __n; + *(undefined1 *)(__n + 0xc + (int)puVar2) = uVar1; + } + return (char *)__dest; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + undefined4 *puVar1; + TParty *this; + int iVar2; + TChannel *this_00; + int local_18; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + TChannel::TChannel(&Channel.init); + Channel.max = 0x12; + Channel.space = 0x13; + Channel.min = 0; + Channel.start = 0; + Channel.block = 10; + Channel.initialized = false; + // try { // try from 0808e13b to 0808e13f has its CatchHandler @ 0808e23b + puVar1 = (undefined4 *)operator_new__(0x808); + *puVar1 = 0x13; + local_18 = 0x12; + this_00 = (TChannel *)(puVar1 + 1); + do { + // try { // try from 0808e158 to 0808e15c has its CatchHandler @ 0808e1a5 + TChannel::TChannel(this_00); + local_18 = local_18 + -1; + this_00 = this_00 + 1; + } while (local_18 != -1); + Channel.entry = (TChannel *)(puVar1 + 1); + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + Statements.Entry = (TStatement *)operator_new__(0x7000); + Statements.Size = 0x400; + Statements.Head = -1; + Statements.Tail = 0; + __cxa_atexit(__tcf_1,0,&__dso_handle); + Listeners.Entry = (TListener *)operator_new__(0x2000); + Listeners.Size = 0x400; + Listeners.Head = -1; + Listeners.Tail = 0; + __cxa_atexit(__tcf_2,0,&__dso_handle); + TParty::TParty(&Party.init); + Party.min = 0; + Party.max = 100; + Party.start = 0; + Party.space = 0x65; + Party.block = 0x32; + Party.initialized = false; + // try { // try from 0808e009 to 0808e00d has its CatchHandler @ 0808e2b2 + puVar1 = (undefined4 *)operator_new__(0x1e00); + *puVar1 = 0x65; + iVar2 = 100; + this = (TParty *)(puVar1 + 1); + do { + // try { // try from 0808e021 to 0808e025 has its CatchHandler @ 0808e240 + TParty::TParty(this); + iVar2 = iVar2 + -1; + this = this + 1; + } while (iVar2 != -1); + Party.entry = (TParty *)(puVar1 + 1); + __cxa_atexit(__tcf_3,0,&__dso_handle); + } + } + return; +} + + + +void AnnounceMovingCreature(ulong CreatureID,Object *Con) + +{ + TConnection *Connection; + TCreature *pTVar1; + int iVar2; + ulong CharacterID; + TPlayer *pTVar3; + int iVar4; + int iVar5; + TCreature *cr; + int local_68; + int x; + int y; + int z; + TFindCreatures Search; + Object local_2c [7]; + + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + error("AnnounceMovingCreature: Kreatur %d existiert nicht.\n",CreatureID); + } + else { + local_2c[0] = (Object)Con->ObjectID; + GetObjectCoordinates(local_2c,&local_68,&x,&y); + iVar4 = x - pTVar1->posy; + iVar2 = -iVar4; + if (-1 < iVar4) { + iVar2 = iVar4; + } + iVar5 = local_68 - pTVar1->posx; + iVar4 = -iVar5; + if (-1 < iVar5) { + iVar4 = iVar5; + } + TFindCreatures::TFindCreatures + ((TFindCreatures *)&z,iVar4 / 2 + 0x11,iVar2 / 2 + 0xf, + (local_68 + pTVar1->posx) / 2,(x + pTVar1->posy) / 2,1); + while( true ) { + CharacterID = TFindCreatures::getNext((TFindCreatures *)&z); + if (CharacterID == 0) break; + pTVar3 = GetPlayer(CharacterID); + if ((pTVar3 != (TPlayer *)0x0) && + (Connection = (pTVar3->super_TCreature).Connection, Connection != (TConnection *)0x0) + ) { + SendMoveCreature(Connection,CreatureID,local_68,x,y); + } + } + } + return; +} + + + +void AnnounceChangedCreature(ulong CreatureID,int Type) + +{ + TKnownCreature *pTVar1; + TConnection *this; + bool bVar2; + TCreature *pTVar3; + TKnownCreature *KnownCreature; + TConnection *Connection; + TCreature *cr; + + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error("AnnounceChangedCreature: Kreatur %d existiert nicht (Type=%d).\n",CreatureID,Type); + } + else { + for (pTVar1 = pTVar3->FirstKnowingConnection; pTVar1 != (TKnownCreature *)0x0; + pTVar1 = pTVar1->Next) { + this = pTVar1->Connection; + if ((this->State == CONNECTION_GAME) && (pTVar1->State != KNOWNCREATURE_OUTDATED)) { + bVar2 = TConnection::IsVisible(this,pTVar3->posx,pTVar3->posy,pTVar3->posz); + if (bVar2) { + switch(Type) { + case 1: + SendCreatureHealth(this,CreatureID); + break; + case 2: + SendCreatureLight(this,CreatureID); + break; + case 3: + SendCreatureOutfit(this,CreatureID); + break; + case 4: + SendCreatureSpeed(this,CreatureID); + break; + case 5: + SendCreatureSkull(this,CreatureID); + break; + case 6: + SendCreatureParty(this,CreatureID); + } + } + else { + pTVar1->State = KNOWNCREATURE_OUTDATED; + } + } + } + } + return; +} + + + +void AnnounceChangedField(Object *Obj,int Type) + +{ + TConnection *this; + bool bVar1; + ulong ID; + ulong CharacterID; + TPlayer *pTVar2; + TPlayer *pl; + int local_68; + int x; + int y; + int z; + TFindCreatures Search; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&local_68,&x,&y); + TFindCreatures::TFindCreatures((TFindCreatures *)&z,0x10,0xe,local_68,x,1); +LAB_0808e5c0: + CharacterID = TFindCreatures::getNext((TFindCreatures *)&z); + if (CharacterID != 0) { + pTVar2 = GetPlayer(CharacterID); + if (((pTVar2 != (TPlayer *)0x0) && + (this = (pTVar2->super_TCreature).Connection, this != (TConnection *)0x0)) && + (bVar1 = TConnection::IsVisible(this,local_68,x,y), bVar1)) { + if (Type != 1) { + if (Type < 2) { + if (Type == 0) { + local_2c[0] = (Object)Obj->ObjectID; + SendDeleteField((pTVar2->super_TCreature).Connection,local_68,x,y, + local_2c); + goto LAB_0808e5c0; + } + } + else if (Type == 2) { + local_2c[0] = (Object)Obj->ObjectID; + SendChangeField((pTVar2->super_TCreature).Connection,local_68,x,y,local_2c); + goto LAB_0808e5c0; + } + error(&DAT_080fee80,Type); + return; + } + local_2c[0] = (Object)Obj->ObjectID; + SendAddField((pTVar2->super_TCreature).Connection,local_68,x,y,local_2c); + } + goto LAB_0808e5c0; + } + } + else { + error(&DAT_080fee40); + } + return; +} + + + +void AnnounceChangedContainer(Object *Obj,int Type) + +{ + bool bVar1; + ulong ID; + ulong CharacterID; + TPlayer *Window; + TPlayer *pl; + int con; + int ContNr; + int iVar2; + Object local_6c [4]; + Object local_5c [4]; + undefined1 local_4c [4]; + TFindCreatures Search; + + bVar1 = Object::exists(Obj); + if (bVar1) { + local_5c[0] = (Object)Obj->ObjectID; + TFindCreatures::TFindCreatures((TFindCreatures *)local_4c,1,1,local_5c,1); + while (CharacterID = TFindCreatures::getNext((TFindCreatures *)local_4c), CharacterID != 0) + { + Window = GetPlayer(CharacterID); + if ((Window != (TPlayer *)0x0) && + ((Window->super_TCreature).Connection != (TConnection *)0x0)) { + ContNr = 0; + do { + iVar2 = ContNr; + TPlayer::GetOpenContainer((TPlayer *)local_5c,(int)Window); + Object::getContainer(local_6c); + if (local_5c[0].ObjectID == local_6c[0].ObjectID) { + if (Type == 1) { + local_6c[0] = (Object)Obj->ObjectID; + SendCreateInContainer + ((Window->super_TCreature).Connection,ContNr,local_6c); + } + else if (Type < 2) { + if (Type != 0) goto LAB_0808e7c7; + local_6c[0] = (Object)Obj->ObjectID; + SendDeleteInContainer + ((Window->super_TCreature).Connection,ContNr,local_6c); + } + else { + if (Type != 2) { +LAB_0808e7c7: + error(&DAT_080fef00,Type,iVar2); + return; + } + local_6c[0] = (Object)Obj->ObjectID; + SendChangeInContainer + ((Window->super_TCreature).Connection,ContNr,local_6c); + } + } + ContNr = ContNr + 1; + } while (ContNr < 0x10); + } + } + } + else { + error(&DAT_080feec0); + } + return; +} + + + +void AnnounceChangedInventory(Object *Obj,int Type) + +{ + bool bVar1; + ulong id; + TCreature *pTVar2; + int iVar3; + TCreature *cr; + char *Text; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + id = GetObjectCreatureID(local_2c); + pTVar2 = GetCreature(id); + if (pTVar2 != (TCreature *)0x0) { + if (pTVar2->Type != PLAYER) { + return; + } + if (Type != 0) { + if ((-1 < Type) && (Type < 3)) { + local_3c[0] = (Object)Obj->ObjectID; + local_2c[0].ObjectID = local_3c[0].ObjectID; + iVar3 = GetObjectBodyPosition(local_3c); + SendSetInventory(pTVar2->Connection,iVar3,local_2c); + return; + } + error(&DAT_080fef80,Type); + return; + } + local_2c[0] = (Object)Obj->ObjectID; + iVar3 = GetObjectBodyPosition(local_2c); + SendDeleteInventory(pTVar2->Connection,iVar3); + return; + } + Text = "AnnounceChangedInventory: Objekt liegt in keinem Inventory.\n"; + } + else { + Text = &DAT_080fef40; + } + error(Text); + return; +} + + + +void AnnounceChangedObject(Object *Obj,int Type) + +{ + bool bVar1; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getContainer(local_2c); + Object::getObjectType(local_3c); + if (local_3c[0].ObjectID == 0) { + local_3c[0] = (Object)Obj->ObjectID; + AnnounceChangedField(local_3c,Type); + } + else { + Object::getContainer(local_3c); + Object::getObjectType(local_4c); + bVar1 = false; + if ((0 < (int)local_4c[0].ObjectID) && ((int)local_4c[0].ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) { + local_4c[0] = (Object)Obj->ObjectID; + AnnounceChangedInventory(local_4c,Type); + } + else { + local_4c[0] = (Object)Obj->ObjectID; + AnnounceChangedContainer(local_4c,Type); + } + } + } + else { + error(&DAT_080ff000); + } + return; +} + + + +void AnnounceGraphicalEffect(int x,int y,int z,int Type) + +{ + TConnection *pTVar1; + bool bVar2; + ulong ID; + ulong CharacterID; + TPlayer *pTVar3; + int x_00; + TPlayer *pl; + undefined1 local_4c [4]; + TFindCreatures Search; + + bVar2 = IsOnMap(x,y,z); + if (bVar2) { + TFindCreatures::TFindCreatures((TFindCreatures *)local_4c,0x10,0xe,x,y,1); + while( true ) { + CharacterID = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (CharacterID == 0) break; + pTVar3 = GetPlayer(CharacterID); + if ((pTVar3 != (TPlayer *)0x0) && + (pTVar1 = (pTVar3->super_TCreature).Connection, pTVar1 != (TConnection *)0x0)) { + bVar2 = TConnection::IsVisible(pTVar1,x,y,z); + if (bVar2) { + pTVar1 = (pTVar3->super_TCreature).Connection; + SendGraphicalEffect(pTVar1,x_00,(int)pTVar1,x,y); + } + } + } + } + return; +} + + + +void AnnounceTextualEffect(int x,int y,int z,int Color,char *Text) + +{ + TConnection *this; + bool bVar1; + ulong ID; + ulong CharacterID; + TPlayer *pTVar2; + TPlayer *pl; + undefined1 local_4c [4]; + TFindCreatures Search; + + bVar1 = IsOnMap(x,y,z); + if (bVar1) { + TFindCreatures::TFindCreatures((TFindCreatures *)local_4c,0x10,0xe,x,y,1); + while( true ) { + CharacterID = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (CharacterID == 0) break; + pTVar2 = GetPlayer(CharacterID); + if ((pTVar2 != (TPlayer *)0x0) && + (this = (pTVar2->super_TCreature).Connection, this != (TConnection *)0x0)) { + bVar1 = TConnection::IsVisible(this,x,y,z); + if (bVar1) { + SendTextualEffect((pTVar2->super_TCreature).Connection,x,y,z,Color,Text); + } + } + } + } + return; +} + + + +void AnnounceMissile(int sx,int sy,int sz,int zx,int zy,int zz,int Type) + +{ + TConnection *pTVar1; + bool bVar2; + ulong ID; + ulong CharacterID; + TPlayer *pTVar3; + int iVar4; + int extraout_EDX; + int extraout_EDX_00; + TPlayer *pl; + int iVar5; + int iVar6; + undefined1 local_4c [4]; + TFindCreatures Search; + + bVar2 = IsOnMap(sx,sy,sz); + if (bVar2) { + bVar2 = IsOnMap(zx,zy,zz); + if (bVar2) { + iVar5 = sy - zy; + iVar4 = -iVar5; + if (-1 < iVar5) { + iVar4 = iVar5; + } + iVar6 = sx - zx; + iVar5 = -iVar6; + if (-1 < iVar6) { + iVar5 = iVar6; + } + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_4c,iVar5 / 2 + 0x11,iVar4 / 2 + 0xf,(sx + zx) / 2, + (zy + sy) / 2,1); +LAB_0808ec90: + CharacterID = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (CharacterID != 0) { + pTVar3 = GetPlayer(CharacterID); + if ((pTVar3 != (TPlayer *)0x0) && + (pTVar1 = (pTVar3->super_TCreature).Connection, pTVar1 != (TConnection *)0x0)) { + bVar2 = TConnection::IsVisible(pTVar1,sx,sy,sz); + iVar4 = extraout_EDX; + if (!bVar2) { + bVar2 = TConnection::IsVisible + ((pTVar3->super_TCreature).Connection,zx,zy,zz); + iVar4 = extraout_EDX_00; + if (!bVar2) goto LAB_0808ec90; + } + pTVar1 = (pTVar3->super_TCreature).Connection; + SendMissileEffect(pTVar1,iVar4,(int)pTVar1,sx,sy,sz,zx,zy); + } + goto LAB_0808ec90; + } + } + } + return; +} + + + +void CheckTopMoveObject(ulong CreatureID,Object *Obj,Object *Ignore) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + undefined4 *puVar4; + Object *pOVar5; + Object local_7c [4]; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Help; + Object local_3c; + Object Best; + Object local_2c; + Object Con; + + // try { // try from 0808ed5b to 0808efdb has its CatchHandler @ 0808eff3 + bVar1 = Object::exists(Obj); + if (!bVar1) { + error("CheckTopMoveObject: Objekt existiert nicht.\n"); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0808eeb3: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); + } + if ((CreatureID != 0) && (bVar1 = IsCreaturePlayer(CreatureID), bVar1)) { + Object::getContainer(&local_2c); + Object::getObjectType(&local_3c); + if ((local_3c.ObjectID == 0) && + ((Object::getObjectType(&local_3c), local_3c.ObjectID != 99 || + (uVar3 = Object::getCreatureID(Obj), uVar3 != CreatureID)))) { + pOVar5 = local_5c; + local_3c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject(&local_4c); + local_5c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + do { + local_6c[0] = (Object)Ignore->ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != local_6c[0].ObjectID) { + local_6c[0].ObjectID = NONE.ObjectID; + bVar1 = false; + if (local_3c.ObjectID == NONE.ObjectID) { +LAB_0808ee2b: + bVar1 = true; + } + else { + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,UNMOVE); + if ((!bVar2) && + ((Object::getObjectType(local_5c), local_5c[0].ObjectID != 99 || + (Object::getObjectType(local_5c), local_5c[0].ObjectID != 99)))) + goto LAB_0808ee2b; + } + if (bVar1) { + local_7c[0].ObjectID = local_4c.ObjectID; + local_3c.ObjectID = local_4c.ObjectID; + local_5c[0].ObjectID = local_4c.ObjectID; + } + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BANK); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,CLIP); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BOTTOM); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,TOP); + if ((!bVar1) && + (pOVar5 = &local_4c, Object::getObjectType(local_7c), + local_7c[0].ObjectID != 99)) break; + } + } + } + } + pOVar5 = &local_4c; + Object::getNextObject(local_6c); + local_7c[0].ObjectID = local_6c[0].ObjectID; + local_4c.ObjectID = local_6c[0].ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + } while (local_6c[0].ObjectID != NONE.ObjectID); + } + local_7c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + if (Obj->ObjectID != local_3c.ObjectID) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,pOVar5); + *puVar4 = 1; + goto LAB_0808eeb3; + } + } + } + return; +} + + + +void CheckTopUseObject(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + bool bVar2; + undefined4 *puVar3; + Object *pOVar4; + Object local_7c [4]; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Help; + Object local_3c; + Object Best; + Object local_2c; + Object Con; + + // try { // try from 0808f02b to 0808f27b has its CatchHandler @ 0808f293 + bVar1 = Object::exists(Obj); + if (!bVar1) { + error("CheckTopUseObject: Objekt existiert nicht.\n"); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0808f19d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if ((CreatureID != 0) && (bVar1 = IsCreaturePlayer(CreatureID), bVar1)) { + Object::getContainer(&local_2c); + Object::getObjectType(&local_3c); + if (local_3c.ObjectID == 0) { + pOVar4 = local_5c; + local_3c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject(&local_4c); + local_5c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + do { + local_6c[0].ObjectID = NONE.ObjectID; + bVar1 = false; + local_5c[0].ObjectID = NONE.ObjectID; + if (local_3c.ObjectID == NONE.ObjectID) { +LAB_0808f0cd: + bVar1 = true; + } + else { + Object::getObjectType(local_5c); + if (local_5c[0].ObjectID != 99) { + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDPOOL); + if (!bVar2) goto LAB_0808f0cd; + } + } + if (bVar1) { + local_7c[0].ObjectID = local_4c.ObjectID; + local_3c.ObjectID = local_4c.ObjectID; + local_5c[0].ObjectID = local_4c.ObjectID; + } + Object::getObjectType(local_7c); + pOVar4 = (Object *)0x9; + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,FORCEUSE); + if (bVar1) break; + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BANK); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,CLIP); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BOTTOM); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,TOP); + if ((!bVar1) && + (pOVar4 = &local_4c, Object::getObjectType(local_7c), + local_7c[0].ObjectID != 99)) break; + } + } + } + pOVar4 = &local_4c; + Object::getNextObject(local_6c); + local_7c[0].ObjectID = local_6c[0].ObjectID; + local_4c.ObjectID = local_6c[0].ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + } while (local_6c[0].ObjectID != NONE.ObjectID); + } + local_7c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + if (Obj->ObjectID != local_3c.ObjectID) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4,pOVar4); + *puVar3 = 1; + goto LAB_0808f19d; + } + } + } + return; +} + + + +void CheckTopMultiuseObject(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + bool bVar2; + undefined4 *puVar3; + Object *pOVar4; + Object local_7c [4]; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Help; + Object local_3c; + Object Best; + Object local_2c; + Object Con; + + // try { // try from 0808f2cb to 0808f4eb has its CatchHandler @ 0808f503 + bVar1 = Object::exists(Obj); + if (!bVar1) { + error("CheckTopMultiuseObject: Objekt existiert nicht.\n"); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_0808f43d: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if ((CreatureID != 0) && (bVar1 = IsCreaturePlayer(CreatureID), bVar1)) { + Object::getContainer(&local_2c); + Object::getObjectType(&local_3c); + if (local_3c.ObjectID == 0) { + pOVar4 = local_5c; + local_3c.ObjectID = NONE.ObjectID; + local_5c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject(&local_4c); + local_5c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + do { + local_6c[0].ObjectID = NONE.ObjectID; + bVar1 = false; + local_5c[0].ObjectID = NONE.ObjectID; + if (local_3c.ObjectID == NONE.ObjectID) { +LAB_0808f36d: + bVar1 = true; + } + else { + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDPOOL); + if (!bVar2) goto LAB_0808f36d; + } + if (bVar1) { + local_7c[0].ObjectID = local_4c.ObjectID; + local_3c.ObjectID = local_4c.ObjectID; + local_5c[0].ObjectID = local_4c.ObjectID; + } + Object::getObjectType(local_7c); + pOVar4 = (Object *)0x9; + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,FORCEUSE); + if (bVar1) break; + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BANK); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,CLIP); + if (!bVar1) { + Object::getObjectType(local_7c); + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,BOTTOM); + if (!bVar1) { + Object::getObjectType(local_7c); + pOVar4 = (Object *)0x3; + bVar1 = ObjectType::getFlag((ObjectType *)local_7c,TOP); + if (!bVar1) break; + } + } + } + pOVar4 = &local_4c; + Object::getNextObject(local_6c); + local_7c[0].ObjectID = local_6c[0].ObjectID; + local_4c.ObjectID = local_6c[0].ObjectID; + local_5c[0].ObjectID = NONE.ObjectID; + } while (local_6c[0].ObjectID != NONE.ObjectID); + } + local_7c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + if (Obj->ObjectID != local_3c.ObjectID) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4,pOVar4); + *puVar3 = 1; + goto LAB_0808f43d; + } + } + } + return; +} + + + +void CheckMoveObject(ulong CreatureID,Object *Obj,bool Take) + +{ + bool bVar1; + undefined4 *puVar2; + ulong uVar3; + TCreature *pTVar4; + int iVar5; + Object *pOVar6; + Object OStack_2c; + bool Take_local; + + if (CreatureID == 0) { + return; + } + OStack_2c = (Object)Obj->ObjectID; + // try { // try from 0808f567 to 0808f674 has its CatchHandler @ 0808f6a7 + bVar1 = ObjectAccessible(CreatureID,&stack0xffffffd4,1); + if (!bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 1; + goto LAB_0808f5ef; + } + Object::getObjectType(&stack0xffffffd4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffd4,UNMOVE); + if (!bVar1) { + pOVar6 = Obj; + Object::getObjectType(&stack0xffffffd4); + if ((OStack_2c.ObjectID == 99) && (uVar3 = Object::getCreatureID(Obj), uVar3 != CreatureID)) + { + OStack_2c = (Object)Obj->ObjectID; + pTVar4 = GetCreature(&stack0xffffffd4); + if (pTVar4 == (TCreature *)0x0) { + error("CheckMoveObject: Kreatur existiert nicht.\n",pOVar6); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + goto LAB_0808f5ef; + } + bVar1 = GetRaceUnpushable(pTVar4->Race); + if ((bVar1) && + ((WorldType != NON_PVP || + (iVar5 = (*pTVar4->_vptr_TCreature[4])(pTVar4), (char)iVar5 == '\0')))) + goto LAB_0808f655; + } + if (Take) { + Object::getObjectType(&stack0xffffffd4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffd4,TAKE); + if (!bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 3; + goto LAB_0808f5ef; + } + } + return; + } +LAB_0808f655: + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 2; +LAB_0808f5ef: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void CheckMapDestination(ulong CreatureID,Object *Obj,Object *MapCon) + +{ + bool bVar1; + bool bVar2; + TCreature *pTVar3; + uint uVar4; + int iVar5; + undefined4 *puVar6; + int *piVar7; + int iVar8; + Object *pOVar9; + Object *pOVar10; + int iVar11; + int iVar12; + int *y_00; + int *z_00; + undefined4 uVar13; + TCreature *cr_1; + TCreature *cr; + int local_44; + int sx; + int sy; + int sz; + int x; + int y; + int z; + + if (CreatureID == 0) { + return; + } + z = MapCon->ObjectID; + // try { // try from 0808f713 to 0808fe64 has its CatchHandler @ 0808fe78 + GetObjectCoordinates((Object *)&z,&sz,&x,&y); + Object::getObjectType((Object *)&z); + piVar7 = (int *)y; + if (z != 99) { + bVar1 = false; + z_00 = (int *)0x0; + y_00 = (int *)y; + bVar2 = CoordinateFlag(); + if (bVar2) { + z_00 = (int *)0x20; + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + y_00 = piVar7; + } + if (bVar1) goto LAB_0808f731; + Object::getObjectType((Object *)&z); + pOVar9 = (Object *)0x20; + bVar1 = ObjectType::getFlag((ObjectType *)&z,UNPASS); + if (!bVar1) { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + y_00 = (int *)y; + pOVar9 = (Object *)x; + if (bVar1) goto LAB_0808f731; + bVar1 = false; + z_00 = (int *)0x2a; + pOVar10 = (Object *)x; + piVar7 = (int *)y; + bVar2 = CoordinateFlag(); + if (bVar2) { +LAB_0808fd7b: + y_00 = piVar7; + pOVar9 = pOVar10; + bVar1 = true; + } + else { + z_00 = (int *)0x2b; + bVar2 = CoordinateFlag(); + pOVar10 = pOVar9; + piVar7 = y_00; + if (bVar2) goto LAB_0808fd7b; + } + if (bVar1) { + Object::getObjectType((Object *)&z); + pOVar9 = (Object *)0x29; + bVar1 = ObjectType::getFlag((ObjectType *)&z,HANG); + if (bVar1) { + z_00 = (int *)0x29; + pOVar9 = (Object *)x; + y_00 = (int *)y; + bVar1 = CoordinateFlag(); + if (!bVar1) goto LAB_0808f731; + } + } + } +LAB_0808fb60: + puVar6 = (undefined4 *)__cxa_allocate_exception(4,pOVar9,y_00,z_00); + *puVar6 = 4; + goto LAB_0808f965; + } +LAB_0808f731: + z = Obj->ObjectID; + z_00 = &sy; + y_00 = &sx; + GetObjectCoordinates((Object *)&z,&local_44,y_00,z_00); + pOVar9 = Obj; + Object::getObjectType((Object *)&z); + if (z == 99) { + z = Obj->ObjectID; + pTVar3 = GetCreature((Object *)&z); + uVar4 = sz - pTVar3->posx; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if ((int)uVar4 < 2) { + uVar4 = x - pTVar3->posy; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if ((int)uVar4 < 2) { + piVar7 = (int *)pTVar3->posz; + uVar4 = y - (int)piVar7; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if ((int)uVar4 < 2) { + if ((int *)(y + 1) == piVar7) { + pOVar9 = (Object *)pTVar3->posy; + y_00 = piVar7; + iVar5 = GetHeight(); + if (iVar5 < 0x18) goto LAB_0808fb60; + piVar7 = (int *)pTVar3->posz; + } + if (y == (int)piVar7 + 1) { + pOVar9 = (Object *)x; + y_00 = (int *)y; + iVar5 = GetHeight(); + if (iVar5 < 0x18) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,pOVar9,y_00); + *puVar6 = 0x2c; + goto LAB_0808f965; + } + piVar7 = (int *)pTVar3->posz; + } + if ((pTVar3->Type != MONSTER) || ((int *)y == piVar7)) { + iVar5 = (*pTVar3->_vptr_TCreature[3]) + (pTVar3,sz,x,y,1,(uint)((int *)y != piVar7)); + if ((char)iVar5 == '\0') { + uVar13 = 0x34; + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + if (CreatureID != pTVar3->ID) { + uVar13 = 4; + } + *puVar6 = uVar13; + goto LAB_0808f965; + } + if (CreatureID != pTVar3->ID) { + z_00 = (int *)0x24; + pOVar9 = (Object *)x; + y_00 = (int *)y; + bVar1 = CoordinateFlag(); + if (bVar1) goto LAB_0808fb60; + if (((CreatureID != pTVar3->ID) && (bVar1 = IsProtectionZone(), bVar1)) + && (iVar5 = x, iVar12 = y, bVar1 = IsProtectionZone(), !bVar1)) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4,iVar5,iVar12,z_00) + ; + *puVar6 = 0x2f; + goto LAB_0808f965; + } + } + goto LAB_0808f8b2; + } + } + } + } + goto LAB_0808fa8d; + } + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,TAKE); + if (!bVar1) { + z = MapCon->ObjectID; + y_00 = (int *)0x2; + pOVar9 = (Object *)&z; + bVar1 = ObjectInRange(CreatureID,(Object *)&z,2); + if (!bVar1) goto LAB_0808fa8d; + } +LAB_0808f8b2: + Object::getObjectType((Object *)&z); + bVar1 = ObjectType::getFlag((ObjectType *)&z,HANG); + iVar12 = y; + iVar5 = x; + if (bVar1) { + bVar1 = false; + uVar13 = 0x2a; + iVar8 = x; + iVar11 = y; + bVar2 = CoordinateFlag(); + if (bVar2) { +LAB_0808f908: + iVar12 = iVar11; + iVar5 = iVar8; + bVar1 = true; + } + else { + uVar13 = 0x2b; + bVar2 = CoordinateFlag(); + iVar8 = iVar5; + iVar11 = iVar12; + if (bVar2) goto LAB_0808f908; + } + if (bVar1) { + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error(&DAT_080ff140,iVar5,iVar12,uVar13); + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xffffffff; + goto LAB_0808f965; + } + if (pTVar3->posz < y) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x18; + goto LAB_0808f965; + } + if (y < pTVar3->posz) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x17; + goto LAB_0808f965; + } + z_00 = (int *)0x2a; + pOVar9 = (Object *)x; + y_00 = (int *)y; + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar1 = false; + if ((x <= pTVar3->posy) && (pTVar3->posy <= x + 1)) { + bVar1 = true; + } + if (bVar1) { + bVar1 = false; + if ((sz + -1 <= pTVar3->posx) && (pTVar3->posx <= sz + 1)) { + bVar1 = true; + } + if (bVar1) goto LAB_0808fa1f; + } + } + else { +LAB_0808fa1f: + z_00 = (int *)0x2b; + pOVar9 = (Object *)x; + bVar1 = CoordinateFlag(); + if (!bVar1) { + return; + } + bVar1 = false; + if ((sz <= pTVar3->posx) && (pTVar3->posx <= sz + 1)) { + bVar1 = true; + } + y_00 = (int *)y; + if (bVar1) { + bVar1 = false; + if ((x + -1 <= pTVar3->posy) && (pTVar3->posy <= x + 1)) { + bVar1 = true; + } + if (bVar1) { + return; + } + } + } +LAB_0808fa8d: + puVar6 = (undefined4 *)__cxa_allocate_exception(4,pOVar9,y_00,z_00); + *puVar6 = 5; + goto LAB_0808f965; + } + } + bVar1 = ThrowPossible(local_44,sx,sy,sz,x,y,1); + if (bVar1) { + return; + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 7; +LAB_0808f965: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +void CheckMapPlace(ulong CreatureID,ObjectType *Type,Object *MapCon) + +{ + bool bVar1; + bool bVar2; + undefined4 *puVar3; + int iVar4; + int iVar5; + int iVar6; + int iVar7; + undefined4 uVar8; + int local_38; + int x; + int y; + int z; + + z = MapCon->ObjectID; + // try { // try from 0808fec5 to 08090120 has its CatchHandler @ 08090127 + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + bVar1 = ObjectType::getFlag(Type,UNMOVE); + if (!bVar1) { + uVar8 = 0; + iVar6 = y; + bVar1 = CoordinateFlag(); + if (!bVar1) { + iVar4 = 0x29; + bVar1 = ObjectType::getFlag(Type,HANG); + iVar7 = y; + iVar5 = x; + if (!bVar1) goto LAB_0808ffd8; + bVar1 = false; + uVar8 = 0x2a; + iVar4 = x; + iVar6 = y; + bVar2 = CoordinateFlag(); + if (bVar2) { +LAB_080900f0: + bVar1 = true; + } + else { + uVar8 = 0x2b; + bVar2 = CoordinateFlag(); + iVar4 = iVar5; + iVar6 = iVar7; + if (bVar2) goto LAB_080900f0; + } + if (!bVar1) goto LAB_0808ffd8; + } + } + iVar5 = y; + if (CreatureID == 0) { + return; + } + bVar1 = false; + uVar8 = 0; + iVar6 = y; + bVar2 = CoordinateFlag(); + if (bVar2) { + uVar8 = 0x20; + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + iVar6 = iVar5; + } + if (bVar1) { + return; + } + iVar4 = 0x20; + bVar1 = ObjectType::getFlag(Type,UNPASS); + if (bVar1) goto LAB_0808ffd8; + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + return; + } + bVar1 = false; + uVar8 = 0x2a; + iVar4 = x; + iVar6 = y; + bVar2 = CoordinateFlag(); + if (bVar2) { +LAB_0808ffb3: + bVar1 = true; + } + else { + uVar8 = 0x2b; + bVar2 = CoordinateFlag(); + iVar4 = x; + iVar6 = y; + if (bVar2) goto LAB_0808ffb3; + } + if (bVar1) { + iVar4 = 0x29; + bVar1 = ObjectType::getFlag(Type,HANG); + if (bVar1) { + return; + } + } +LAB_0808ffd8: + puVar3 = (undefined4 *)__cxa_allocate_exception(4,iVar4,iVar6,uVar8); + *puVar3 = 4; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void CheckContainerDestination(Object *Obj,Object *Con) + +{ + bool bVar1; + undefined4 *puVar2; + int iVar3; + ulong uVar4; + ulong *puVar5; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Help; + + local_2c = Con->ObjectID; + do { + puVar5 = &local_2c; + // try { // try from 08090164 to 08090227 has its CatchHandler @ 08090243 + Object::getObjectType(local_3c); + if (local_3c[0].ObjectID == 0) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CHEST); + if (!bVar1) { + local_4c[0] = (Object)Con->ObjectID; + iVar3 = CountObjectsInContainer(local_4c); + Object::getObjectType(local_3c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_3c,CAPACITY); + if ((int)uVar4 <= iVar3) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 10; +LAB_080901af: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + } + return; + } + local_3c[0] = (Object)Obj->ObjectID; + if (local_2c == local_3c[0].ObjectID) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4,puVar5); + *puVar2 = 9; + goto LAB_080901af; + } + Object::getContainer(local_4c); + local_3c[0].ObjectID = local_4c[0].ObjectID; + local_2c = local_4c[0].ObjectID; + } while( true ); +} + + + +void CheckContainerPlace(ObjectType *Type,Object *Con,Object *oldObj) + +{ + bool bVar1; + int iVar2; + ulong uVar3; + undefined4 *puVar4; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08090283 to 08090364 has its CatchHandler @ 08090394 + GetSpecialObject((SPECIALMEANING)local_2c); + if (Type->TypeID != local_2c[0].ObjectID) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) { + bVar1 = ObjectType::getFlag(Type,UNMOVE); + if (bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 2; + } + else { + bVar1 = ObjectType::getFlag(Type,TAKE); + if (bVar1) { + local_2c[0].ObjectID = NONE.ObjectID; + if (oldObj->ObjectID != NONE.ObjectID) { + return; + } + local_3c[0] = (Object)Con->ObjectID; + iVar2 = CountObjectsInContainer(local_3c); + Object::getObjectType(local_2c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_2c,CAPACITY); + if (iVar2 < (int)uVar3) { + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 10; + } + else { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 3; + } + } + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); + } + } + return; +} + + + +void CheckDepotSpace(ulong CreatureID,Object *Source,Object *Destination,int Count) + +{ + bool bVar1; + TCreature *pTVar2; + undefined4 *puVar3; + TCreature *cr; + Object *pOVar4; + Object local_3c [4]; + Object local_2c [7]; + + if (CreatureID == 0) { + return; + } + // try { // try from 080903d9 to 08090536 has its CatchHandler @ 08090540 + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + error("CheckDepotSpace: Kreatur %lu existiert nicht.\n",CreatureID); + } + else { + local_2c[0].ObjectID = NONE.ObjectID; + if (Destination->ObjectID != NONE.ObjectID) { + if (pTVar2->Type != PLAYER) { + return; + } + bVar1 = false; + if ((pTVar2[1].super_TSkillBase.TimerList[6] == (TSkill *)NONE.ObjectID) || + (Count <= (int)pTVar2[1].super_TSkillBase.TimerList[8])) { + bVar1 = true; + } + if (bVar1) { + return; + } + while( true ) { + local_2c[0].ObjectID = NONE.ObjectID; + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + if ((Source->ObjectID != NONE.ObjectID) && + (Object::getObjectType(local_3c), local_3c[0].ObjectID != 0)) { + bVar1 = true; + } + if (!bVar1) break; + local_3c[0].ObjectID = (ulong)pTVar2[1].super_TSkillBase.TimerList[6]; + if ((TSkill *)Source->ObjectID == (TSkill *)local_3c[0].ObjectID) { + return; + } + Object::getContainer(local_2c); + Source->ObjectID = (ulong)local_2c[0]; + } + while( true ) { + pOVar4 = Destination; + Object::getObjectType(local_3c); + if (local_3c[0].ObjectID == 0) { + return; + } + local_3c[0].ObjectID = (ulong)pTVar2[1].super_TSkillBase.TimerList[6]; + if ((TSkill *)Destination->ObjectID == (TSkill *)local_3c[0].ObjectID) break; + Object::getContainer(local_2c); + local_3c[0].ObjectID = local_2c[0].ObjectID; + Destination->ObjectID = (ulong)local_2c[0]; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4,pOVar4); + *puVar3 = 10; + goto LAB_080904cb; + } + error("CheckDepotSpace: Ziel existiert nicht.\n"); + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; +LAB_080904cb: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void CheckInventoryDestination(Object *Obj,Object *Con,bool Split) + +{ + uint uVar1; + Object OVar2; + bool bVar3; + int ClothesType; + ulong uVar4; + ulong uVar5; + ulong uVar6; + undefined4 *puVar7; + int Position; + bool bVar8; + undefined4 uVar9; + int local_68; + int Hand; + ulong uStack_5c; + bool Split_local; + Object Help; + Object local_4c [4]; + ulong local_3c; + Object local_2c; + Object Help_1; + + local_2c = (Object)Con->ObjectID; + // try { // try from 08090584 to 08090930 has its CatchHandler @ 080909c5 + uVar4 = GetObjectBodyPosition(&local_2c); + uVar1 = uVar4 - 5; + if ((1 < uVar1) && (uVar4 != 10)) { + Object::getObjectType(&local_2c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_2c,CLOTHES); + if (!bVar3) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xb; + goto LAB_0809079e; + } + Object::getObjectType(&local_2c); + uVar5 = ObjectType::getAttribute((ObjectType *)&local_2c,BODYPOSITION); + if (uVar5 == 0) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xc; + goto LAB_0809079e; + } + if (uVar4 != uVar5) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xd; + goto LAB_0809079e; + } + } + local_2c = (Object)Con->ObjectID; + uVar5 = GetObjectCreatureID(&local_2c); + Object::getObjectType(&local_2c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_2c,CLOTHES); + if (bVar3) { + Object::getObjectType(&local_2c); + uVar6 = ObjectType::getAttribute((ObjectType *)&local_2c,BODYPOSITION); + if ((uVar6 == 0) && (uVar1 < 2)) { + uVar9 = 5; + uVar4 = uVar5; + GetBodyObject((ulong)&local_2c,uVar5); + bVar3 = false; + local_3c = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if ((local_2c.ObjectID != NONE.ObjectID) && + (uStack_5c = Obj->ObjectID, local_4c[0].ObjectID = uStack_5c, + local_2c.ObjectID != uStack_5c)) { + bVar3 = true; + } + if (!bVar3) { + uVar9 = 6; + GetBodyObject((ulong)local_4c,uVar5); + OVar2.ObjectID = local_4c[0].ObjectID; + bVar3 = false; + local_2c.ObjectID = local_4c[0].ObjectID; + bVar8 = local_4c[0].ObjectID != NONE.ObjectID; + uStack_5c = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if ((bVar8) && + (local_4c[0] = (Object)Obj->ObjectID, local_3c = local_4c[0].ObjectID, + OVar2.ObjectID != local_4c[0].ObjectID)) { + bVar3 = true; + } + uVar4 = uVar5; + if (!bVar3) { + return; + } + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4,uVar4,uVar9); + *puVar7 = 0xe; + goto LAB_0809079e; + } + } + uVar6 = uVar5; + GetBodyObject((ulong)&stack0xffffffa4,uVar5); + local_4c[0].ObjectID = NONE.ObjectID; + local_3c = NONE.ObjectID; + if (uStack_5c == NONE.ObjectID) { + if (uVar1 < 2) { + local_68 = 5; + do { + GetBodyObject((ulong)&stack0xffffffa4,uVar5); + local_4c[0].ObjectID = NONE.ObjectID; + if (uStack_5c != NONE.ObjectID) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,CLOTHES); + if (bVar3) { + Object::getObjectType(local_4c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_4c,BODYPOSITION); + if (uVar4 == 0) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xf; + goto LAB_0809079e; + } + } + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,WEAPON); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,THROW); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,BOW); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,WAND); + if (!bVar3) goto LAB_080906c2; + } + } + } + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,WEAPON); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,THROW); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,BOW); + if (!bVar3) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,WAND); + if (!bVar3) goto LAB_080906c2; + } + } + } + if ((Split) || + (local_4c[0] = (Object)Obj->ObjectID, local_3c = local_4c[0].ObjectID, + uStack_5c != local_4c[0].ObjectID)) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x10; + goto LAB_0809079e; + } + } +LAB_080906c2: + local_68 = local_68 + 1; + } while (local_68 < 7); + } + return; + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4,uVar6,uVar4); + *puVar7 = 4; +LAB_0809079e: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +void CheckInventoryPlace(ObjectType *Type,Object *Con,Object *OldObj) + +{ + uint uVar1; + bool bVar2; + int ClothesType; + ulong uVar3; + ulong uVar4; + ulong uVar5; + undefined4 *puVar6; + int Position; + int iVar7; + ulong uVar8; + undefined4 uVar9; + ulong local_ac; + Object Help; + Object local_9c [4]; + ulong local_8c [4]; + ulong local_7c; + ulong local_6c [4]; + ulong local_5c; + ulong local_4c [4]; + ulong local_3c; + Object local_2c [7]; + + local_2c[0] = (Object)Con->ObjectID; + // try { // try from 08090a00 to 08090e39 has its CatchHandler @ 08090ea0 + uVar3 = GetObjectBodyPosition(local_2c); + uVar1 = uVar3 - 5; + if ((1 < uVar1) && (uVar3 != 10)) { + bVar2 = ObjectType::getFlag(Type,CLOTHES); + if (!bVar2) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xb; + goto LAB_08090c8d; + } + uVar4 = ObjectType::getAttribute(Type,BODYPOSITION); + if (uVar4 == 0) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xc; + goto LAB_08090c8d; + } + if (uVar3 != uVar4) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xd; + goto LAB_08090c8d; + } + } + local_2c[0] = (Object)Con->ObjectID; + uVar4 = GetObjectCreatureID(local_2c); + bVar2 = ObjectType::getFlag(Type,CLOTHES); + if (((!bVar2) || (uVar5 = ObjectType::getAttribute(Type,BODYPOSITION), uVar5 != 0)) || + (1 < uVar1)) { + bVar2 = false; + uVar5 = uVar4; + uVar8 = uVar3; + GetBodyObject((ulong)&local_ac,uVar4); + local_9c[0].ObjectID = NONE.ObjectID; + local_8c[0] = NONE.ObjectID; + if (local_ac != NONE.ObjectID) { + uVar5 = uVar4; + GetBodyObject((ulong)local_8c,uVar4); + local_7c = OldObj->ObjectID; + uVar8 = uVar3; + local_6c[0] = local_7c; + if (local_8c[0] != local_7c) { + bVar2 = true; + } + } + if (!bVar2) { + if (1 < uVar1) { + return; + } + iVar7 = 5; + do { + GetBodyObject((ulong)&local_ac,uVar4); + local_9c[0].ObjectID = NONE.ObjectID; + if ((local_ac != NONE.ObjectID) && + (local_9c[0] = (Object)OldObj->ObjectID, local_ac != local_9c[0].ObjectID)) { + Object::getObjectType(local_9c); + bVar2 = ObjectType::getFlag((ObjectType *)local_9c,CLOTHES); + if (bVar2) { + Object::getObjectType(local_9c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_9c,BODYPOSITION); + if (uVar3 == 0) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xf; + goto LAB_08090c8d; + } + } + bVar2 = ObjectType::getFlag(Type,WEAPON); + if (((bVar2) || (bVar2 = ObjectType::getFlag(Type,THROW), bVar2)) || + ((bVar2 = ObjectType::getFlag(Type,BOW), bVar2 || + (bVar2 = ObjectType::getFlag(Type,WAND), bVar2)))) { + Object::getObjectType(local_9c); + bVar2 = ObjectType::getFlag((ObjectType *)local_9c,WEAPON); + if (!bVar2) { + Object::getObjectType(local_9c); + bVar2 = ObjectType::getFlag((ObjectType *)local_9c,THROW); + if (!bVar2) { + Object::getObjectType(local_9c); + bVar2 = ObjectType::getFlag((ObjectType *)local_9c,BOW); + if (!bVar2) { + Object::getObjectType(local_9c); + bVar2 = ObjectType::getFlag((ObjectType *)local_9c,WAND); + if (!bVar2) goto LAB_08090b3f; + } + } + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x10; + goto LAB_08090c8d; + } + } +LAB_08090b3f: + iVar7 = iVar7 + 1; + if (6 < iVar7) { + return; + } + } while( true ); + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4,uVar5,uVar8); + *puVar6 = 4; + goto LAB_08090c8d; + } + bVar2 = false; + GetBodyObject((ulong)local_2c,uVar4); + local_3c = NONE.ObjectID; + local_4c[0] = NONE.ObjectID; + if (local_2c[0].ObjectID == NONE.ObjectID) { +LAB_08090dd4: + uVar9 = 6; + uVar3 = uVar4; + GetBodyObject((ulong)local_6c,uVar4); + local_7c = NONE.ObjectID; + local_8c[0] = NONE.ObjectID; + if (local_6c[0] != NONE.ObjectID) { + uVar9 = 6; + GetBodyObject((ulong)local_8c,uVar4); + local_ac = OldObj->ObjectID; + uVar3 = uVar4; + local_9c[0].ObjectID = local_ac; + if (local_8c[0] != local_ac) goto LAB_08090e56; + } + } + else { + uVar9 = 5; + uVar3 = uVar4; + GetBodyObject((ulong)local_4c,uVar4); + local_6c[0] = OldObj->ObjectID; + local_5c = local_6c[0]; + if (local_4c[0] == local_6c[0]) goto LAB_08090dd4; +LAB_08090e56: + bVar2 = true; + } + if (!bVar2) { + return; + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4,uVar3,uVar9); + *puVar6 = 0xe; +LAB_08090c8d: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +void CheckWeight(ulong CreatureID,Object *Obj,int Count) + +{ + TSkill *this; + bool bVar1; + ulong uVar2; + TCreature *pTVar3; + int iVar4; + int iVar5; + int iVar6; + undefined4 *puVar7; + TSkill *sk; + TCreature *cr; + Object local_2c [7]; + + local_2c[0] = (Object)Obj->ObjectID; + // try { // try from 08090ee0 to 08091075 has its CatchHandler @ 08091078 + uVar2 = GetObjectCreatureID(local_2c); + if (uVar2 == CreatureID) { + return; + } + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error("CheckWeight: Kreatur %d existiert nicht.\n",CreatureID); +LAB_08091005: + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; + } + else { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,TAKE); + if (bVar1) { + if (pTVar3->Type == PLAYER) { + bVar1 = CheckRight(CreatureID,UNLIMITED_CAPACITY); + if (bVar1) { + return; + } + if ((pTVar3->Type == PLAYER) && + (bVar1 = CheckRight(CreatureID,ZERO_CAPACITY), bVar1)) goto LAB_08090fbd; + } + this = (pTVar3->super_TSkillBase).Skills[5]; + if (this == (TSkill *)0x0) { + error("CheckWeight: Skill CARRYSTRENGTH existiert nicht.\n"); + goto LAB_08091005; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CUMULATIVE); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + iVar4 = GetWeight(local_2c,Count); + } + else { + cr = (TCreature *)Obj->ObjectID; + iVar4 = GetCompleteWeight((Object *)&cr); + } + iVar5 = GetInventoryWeight(CreatureID); + iVar6 = TSkill::Get(this); + if (iVar4 + iVar5 <= iVar6 * 100) { + return; + } + } +LAB_08090fbd: + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 8; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: sk + +void CheckWeight(ulong CreatureID,ObjectType *Type,ulong Data,int oldWeight) + +{ + TSkill *this; + bool bVar1; + TCreature *pTVar2; + ulong uVar3; + int iVar4; + int iVar5; + undefined4 *puVar6; + TCreature *cr; + TSkill *sk; + + // try { // try from 080910a8 to 080911f2 has its CatchHandler @ 080911f5 + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + error("CheckWeight: Kreatur %d existiert nicht.\n",CreatureID); +LAB_0809118c: + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xffffffff; + } + else { + bVar1 = ObjectType::getFlag(Type,TAKE); + if (bVar1) { + if (pTVar2->Type == PLAYER) { + bVar1 = CheckRight(CreatureID,UNLIMITED_CAPACITY); + if (bVar1) { + return; + } + if ((pTVar2->Type == PLAYER) && + (bVar1 = CheckRight(CreatureID,ZERO_CAPACITY), bVar1)) goto LAB_08091156; + } + this = (pTVar2->super_TSkillBase).Skills[5]; + if (this == (TSkill *)0x0) { + error("CheckWeight: Skill CARRYSTRENGTH existiert nicht.\n"); + goto LAB_0809118c; + } + uVar3 = ObjectType::getAttribute(Type,WEIGHT); + bVar1 = ObjectType::getFlag(Type,CUMULATIVE); + if ((bVar1) && (1 < Data)) { + uVar3 = Data * uVar3; + } + if ((int)uVar3 <= oldWeight) { + return; + } + iVar4 = GetInventoryWeight(CreatureID); + iVar5 = TSkill::Get(this); + if ((int)(uVar3 + iVar4) <= oldWeight + iVar5 * 100) { + return; + } + } +LAB_08091156: + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 8; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +void __regparm1 NotifyCreature(ulong CreatureID,Object *Obj,bool Inventory) + +{ + bool bVar1; + TCreature *this; + undefined3 in_stack_00000009; + char in_stack_0000000c; + TCreature *cr; + Object OStack_2c; + bool Inventory_local; + + if (Obj != (Object *)0x0) { + Object::getObjectType(&stack0xffffffd4); + if (OStack_2c.ObjectID != 99) { + this = GetCreature((ulong)Obj); + if (this == (TCreature *)0x0) { + error("NotifyCreature: Kreatur existiert nicht.\n",_Inventory); + } + else { + Object::getObjectType(&stack0xffffffd4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffd4,LIGHT); + if ((bVar1) && (in_stack_0000000c != '\0')) { + AnnounceChangedCreature((ulong)Obj,2); + } + TCreature::NotifyChangeInventory(this); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Inventory_local + +void __regparm3 NotifyCreature(ulong CreatureID,ObjectType *Type,bool Inventory) + +{ + bool bVar1; + TCreature *this; + TCreature *cr; + ulong in_stack_00000004; + ObjectType *in_stack_00000008; + char in_stack_0000000c; + bool Inventory_local; + + if (in_stack_00000004 == 0) { + return; + } + this = GetCreature(in_stack_00000004); + if (this != (TCreature *)0x0) { + bVar1 = ObjectType::getFlag(in_stack_00000008,LIGHT); + if ((bVar1) && (in_stack_0000000c != '\0')) { + AnnounceChangedCreature(in_stack_00000004,2); + } + TCreature::NotifyChangeInventory(this); + return; + } + error("NotifyCreature: Kreatur existiert nicht.\n"); + return; +} + + + +void NotifyAllCreatures(Object *Obj,int Type,Object *OldCon) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + TCreature *pTVar4; + uint uVar5; + uint uVar6; + char *Text; + int local_a4; + int oldx; + int oldy; + int oldz; + int x; + int y; + int z; + TFindCreatures Search; + undefined1 local_5c [4]; + TFindCreatures Search1; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 99) { + return; + } + if (Type != 3) { + local_2c[0] = (Object)Obj->ObjectID; + TFindCreatures::TFindCreatures((TFindCreatures *)&z,10,10,local_2c,7); + while (uVar2 = TFindCreatures::getNext((TFindCreatures *)&z), uVar2 != 0) { + uVar3 = Object::getCreatureID(Obj); + pTVar4 = GetCreature(uVar2); + (*pTVar4->_vptr_TCreature[9])(pTVar4,uVar3,Type); + } + return; + } + bVar1 = Object::exists(OldCon); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&oldz,&x,&y); + local_2c[0] = (Object)OldCon->ObjectID; + GetObjectCoordinates(local_2c,&local_a4,&oldx,&oldy); + uVar5 = oldz - local_a4; + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + if ((int)uVar5 < 0x15) { + uVar5 = x - oldx; + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + if ((int)uVar5 < 0x15) { + uVar5 = x - oldx; + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + uVar6 = oldz - local_a4; + if (0x7fffffff < uVar6) { + uVar6 = -uVar6; + } + TFindCreatures::TFindCreatures + ((TFindCreatures *)&z,(int)(uVar6 + 1) / 2 + 10, + (int)(uVar5 + 1) / 2 + 10,(oldz + local_a4) / 2,(oldx + x) / 2,7); + while (uVar2 = TFindCreatures::getNext((TFindCreatures *)&z), uVar2 != 0) { + uVar3 = Object::getCreatureID(Obj); + pTVar4 = GetCreature(uVar2); + (*pTVar4->_vptr_TCreature[9])(pTVar4,uVar3,2); + } + return; + } + } + TFindCreatures::TFindCreatures((TFindCreatures *)local_5c,10,10,local_a4,oldx,7); + while (uVar2 = TFindCreatures::getNext((TFindCreatures *)local_5c), uVar2 != 0) { + uVar3 = Object::getCreatureID(Obj); + pTVar4 = GetCreature(uVar2); + (*pTVar4->_vptr_TCreature[9])(pTVar4,uVar3,2); + } + TFindCreatures::TFindCreatures((TFindCreatures *)&z,10,10,oldz,x,7); + while (uVar2 = TFindCreatures::getNext((TFindCreatures *)&z), uVar2 != 0) { + uVar3 = Object::getCreatureID(Obj); + pTVar4 = GetCreature(uVar2); + (*pTVar4->_vptr_TCreature[9])(pTVar4,uVar3,2); + } + return; + } + Text = &DAT_080ff300; + } + else { + Text = &DAT_080ff2c0; + } + error(Text); + return; +} + + + +void NotifyTrades(Object *Obj) + +{ + bool bVar1; + ulong ID; + ulong CharacterID; + TPlayer *this; + TPlayer *pl; + TPlayer *pTVar2; + char *pcVar3; + Object *Obj_00; + Object OStack_8c; + bool Affected; + Object Help_1; + Object local_7c [4]; + Object local_6c; + Object Help; + undefined1 local_5c [4]; + TFindCreatures Search; + Object local_2c; + Object TradeObject; + + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(&local_2c); + if (local_2c.ObjectID != 99) { + Obj_00 = &local_2c; + local_2c = (Object)Obj->ObjectID; + pcVar3 = (char *)0xa; + pTVar2 = (TPlayer *)0xc; + TFindCreatures::TFindCreatures((TFindCreatures *)local_5c,0xc,10,Obj_00,1); +LAB_08091720: + CharacterID = TFindCreatures::getNext((TFindCreatures *)local_5c); + if (CharacterID != 0) { + this = GetPlayer(CharacterID); + if (this == (TPlayer *)0x0) { + error("NotifyTrade: Spieler existiert nicht.\n",pTVar2,pcVar3,Obj_00); + } + else { + Obj_00 = (Object *)0x0; + pcVar3 = (char *)0x1; + pTVar2 = this; + TPlayer::InspectTrade((TPlayer *)&local_2c,SUB41(this,0),1); + local_6c = (Object)NONE.ObjectID; + if (local_2c.ObjectID != NONE.ObjectID) { + local_6c = (Object)Obj->ObjectID; + bVar1 = local_2c.ObjectID == local_6c.ObjectID; + if (!bVar1) { + while( true ) { + Object::getObjectType(local_7c); + if (local_7c[0].ObjectID == 0) break; + local_7c[0].ObjectID = local_6c.ObjectID; + if (local_2c.ObjectID == local_6c.ObjectID) { + bVar1 = true; + } + Object::getContainer(&stack0xffffff74); + local_7c[0].ObjectID = OStack_8c.ObjectID; + local_6c.ObjectID = OStack_8c.ObjectID; + } + if (!bVar1) { + OStack_8c.ObjectID = local_2c.ObjectID; + while( true ) { + pTVar2 = (TPlayer *)&stack0xffffff74; + Object::getObjectType(local_7c); + if (local_7c[0].ObjectID == 0) break; + local_7c[0] = (Object)Obj->ObjectID; + if (OStack_8c.ObjectID == local_7c[0].ObjectID) { + bVar1 = true; + } + Object::getContainer(&local_6c); + OStack_8c.ObjectID = local_6c.ObjectID; + local_7c[0].ObjectID = OStack_8c.ObjectID; + } + if (!bVar1) goto LAB_08091720; + } + } + SendCloseTrade((this->super_TCreature).Connection); + pcVar3 = "Trade cancelled."; + pTVar2 = (TPlayer *)0x17; + SendMessage((this->super_TCreature).Connection,0x17,"Trade cancelled."); + TPlayer::RejectTrade(this); + } + } + goto LAB_08091720; + } + } + } + else { + error(&DAT_080ff360); + } + return; +} + + + +void NotifyDepot(ulong CreatureID,Object *Obj,int Count) + +{ + bool bVar1; + TCreature *pTVar2; + undefined4 *puVar3; + TCreature *cr; + Object local_3c [4]; + Object local_2c [7]; + + if (CreatureID != 0) { + pTVar2 = GetCreature(CreatureID); + if (pTVar2 == (TCreature *)0x0) { + error("NotifyDepot: Kreatur %lu existiert nicht.\n",CreatureID); + } + else { + bVar1 = Object::exists(Obj); + if (!bVar1) { + error("NotifyDepot: Objekt existiert nicht.\n"); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + if ((pTVar2->Type == PLAYER) && + (local_2c[0].ObjectID = NONE.ObjectID, + pTVar2[1].super_TSkillBase.TimerList[6] != (TSkill *)NONE.ObjectID)) { + while (Object::getObjectType(local_2c), local_2c[0].ObjectID != 0) { + local_2c[0].ObjectID = (ulong)pTVar2[1].super_TSkillBase.TimerList[6]; + if ((TSkill *)Obj->ObjectID == (TSkill *)local_2c[0].ObjectID) { + pTVar2[1].super_TSkillBase.TimerList[8] = + (TSkill *) + ((int)&pTVar2[1].super_TSkillBase.TimerList[8]->_vptr_TSkill + Count); + print(); + return; + } + Object::getContainer(local_3c); + local_2c[0].ObjectID = local_3c[0].ObjectID; + Obj->ObjectID = (ulong)local_3c[0]; + } + } + } + } + return; +} + + + +void CloseContainer(Object *Con,bool Force) + +{ + bool bVar1; + bool bVar2; + ulong ID; + ulong CharacterID; + TPlayer *this; + int con; + int ContNr; + bool Affected; + TPlayer *pl; + Object OStack_7c; + bool Force_local; + Object local_6c [4]; + undefined1 local_5c [4]; + TFindCreatures Search; + _func_int_varargs **local_2c; + Object Obj; + + bVar2 = Object::exists(Con); + if (bVar2) { + Object::getObjectType((Object *)&local_2c); + if (local_2c != (_func_int_varargs **)0x63) { + local_2c = (_func_int_varargs **)Con->ObjectID; + TFindCreatures::TFindCreatures((TFindCreatures *)local_5c,0xc,10,(Object *)&local_2c,1); + while (CharacterID = TFindCreatures::getNext((TFindCreatures *)local_5c), + CharacterID != 0) { + this = GetPlayer(CharacterID); + if (this == (TPlayer *)0x0) { + error("CloseContainer: Spieler existiert nicht.\n"); + } + else { + ContNr = 0; + do { + bVar2 = false; + TPlayer::GetOpenContainer((TPlayer *)&local_2c,(int)this); + while( true ) { + bVar1 = false; + local_6c[0].ObjectID = NONE.ObjectID; + OStack_7c.ObjectID = NONE.ObjectID; + if ((local_2c != (_func_int_varargs **)NONE.ObjectID) && + (Object::getObjectType(&stack0xffffff84), OStack_7c.ObjectID != 0)) { + bVar1 = true; + } + if (!bVar1) break; + OStack_7c = (Object)Con->ObjectID; + if (local_2c == (_func_int_varargs **)OStack_7c.ObjectID) { + bVar2 = true; + } + Object::getContainer(local_6c); + local_2c = (_func_int_varargs **)local_6c[0].ObjectID; + } + if (bVar2) { + if (!Force) { + OStack_7c = (Object)Con->ObjectID; + bVar2 = ObjectAccessible((this->super_TCreature).ID,&stack0xffffff84 + ,1); + if (bVar2) { + SendContainer((this->super_TCreature).Connection,ContNr); + goto LAB_08091b89; + } + } + local_6c[0].ObjectID = NONE.ObjectID; + TPlayer::SetOpenContainer(this,ContNr,local_6c); + SendCloseContainer((this->super_TCreature).Connection,ContNr); + } +LAB_08091b89: + ContNr = ContNr + 1; + } while (ContNr < 0x10); + } + } + } + } + else { + error(&DAT_080ff4a0); + } + return; +} + + + +Object Create(Object *Con,ObjectType *Type,ulong Value) + +{ + bool bVar1; + ulong uVar2; + TCreature *this; + undefined4 *puVar3; + int _TypeID; + ulong in_stack_00000010; + char *Text; + ulong newCreature; + int x; + int y; + int z; + Object Obj; + Object local_5c [4]; + Object local_4c; + Object Top; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08091c0b to 0809230e has its CatchHandler @ 08092330 + bVar1 = Object::exists((Object *)Type); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) { + Text = "Create: Zielobjekt ist kein Container.\n"; + goto LAB_080922e0; + } + } + ObjectType::setTypeID((ObjectType *)local_2c,0); + if (*(ulong *)Value != local_2c[0].ObjectID) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0) { + local_2c[0].ObjectID = Type->TypeID; + ObjectType::setTypeID((ObjectType *)local_3c,*(int *)Value); + CheckMapPlace(0,(ObjectType *)local_3c,local_2c); + } + else { + Object::getObjectType(local_3c); + bVar1 = false; + if ((0 < (int)local_3c[0].ObjectID) && ((int)local_3c[0].ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) { + local_4c.ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = Type->TypeID; + ObjectType::setTypeID((ObjectType *)local_2c,*(int *)Value); + CheckInventoryPlace((ObjectType *)local_2c,local_3c,&local_4c); + } + else { + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = Type->TypeID; + ObjectType::setTypeID((ObjectType *)&local_4c,*(int *)Value); + CheckContainerPlace((ObjectType *)&local_4c,local_2c,local_3c); + } + local_4c.ObjectID = Type->TypeID; + uVar2 = GetObjectCreatureID(&local_4c); + if (uVar2 != 0) { + ObjectType::setTypeID((ObjectType *)&local_4c,*(int *)Value); + CheckWeight(uVar2,(ObjectType *)&local_4c,in_stack_00000010,0); + } + } + Object::getObjectType(&local_4c); + if ((local_4c.ObjectID == 0) && + (bVar1 = ObjectType::getFlag((ObjectType *)Value,CUMULATIVE), bVar1)) { + if (in_stack_00000010 == 0) { + in_stack_00000010 = 1; + } + local_4c.ObjectID = Type->TypeID; + GetObjectCoordinates(&local_4c,(int *)&newCreature,&x,&y); + GetTopObject((int)&local_4c,newCreature,x,(bool)(undefined1)y); + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + Object::getObjectType(local_2c); + ObjectType::setTypeID((ObjectType *)local_5c,*(int *)Value); + if ((local_2c[0].ObjectID == local_5c[0].ObjectID) && + (uVar2 = Object::getAttribute(&local_4c,AMOUNT), + uVar2 + in_stack_00000010 < 0x65)) { + bVar1 = true; + } + } + if (bVar1) { + uVar2 = Object::getAttribute(&local_4c,AMOUNT); + z = local_4c.ObjectID; + Change((Object *)&z,AMOUNT,uVar2 + in_stack_00000010); + Con->ObjectID = (ulong)local_4c; + return (Object)(ulong)Con; + } + } + ObjectType::setTypeID((ObjectType *)local_5c,*(int *)Value); + local_4c.ObjectID = Type->TypeID; + SetObject((Object *)&z,(ObjectType *)&local_4c,(ulong)local_5c); + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,CUMULATIVE); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,AMOUNT,in_stack_00000010); + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,MAGICFIELD); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,RESPONSIBLE,in_stack_00000010); + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDPOOL); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,POOLLIQUIDTYPE,in_stack_00000010); + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDCONTAINER); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,CONTAINERLIQUIDTYPE,in_stack_00000010); + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,KEY); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,KEYNUMBER,in_stack_00000010); + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,RUNE); + if (bVar1) { + local_5c[0].ObjectID = z; + ChangeObject(local_5c,CHARGES,in_stack_00000010); + } + if (*(int *)Value != 99) { +LAB_08091e32: + local_5c[0].ObjectID = z; + AnnounceChangedObject(local_5c,1); + local_5c[0].ObjectID = z; + NotifyTrades(local_5c); + Object::getContainer(local_5c); + Object::getObjectType(&local_4c); + local_4c.ObjectID = z; + local_3c[0].ObjectID = z; + uVar2 = GetObjectCreatureID(local_3c); + NotifyCreature(uVar2,(Object *)uVar2,SUB41(&local_4c,0)); + Object::getContainer(local_5c); + Object::getContainer(&local_4c); + local_3c[0].ObjectID = z; + MovementEvent(local_3c,&local_4c,local_5c); + Object::getContainer(local_5c); + local_4c.ObjectID = z; + CollisionEvent(&local_4c,local_5c); + local_5c[0].ObjectID = NONE.ObjectID; + local_4c.ObjectID = z; + NotifyAllCreatures(&local_4c,1,local_5c); + Con->ObjectID = z; + return (Object)(ulong)Con; + } + this = GetCreature(in_stack_00000010); + if (this != (TCreature *)0x0) { + _TypeID = 10; + do { + ObjectType::setTypeID((ObjectType *)&local_4c,_TypeID); + local_3c[0].ObjectID = z; + SetObject(local_5c,(ObjectType *)local_3c,(ulong)&local_4c); + _TypeID = _TypeID + -1; + } while (0 < _TypeID); + local_5c[0].ObjectID = z; + local_3c[0].ObjectID = z; + (this->CrObject).ObjectID = z; + local_4c.ObjectID = z; + TCreature::NotifyCreate(this); + goto LAB_08091e32; + } + error(&DAT_080ff520,in_stack_00000010); + local_5c[0].ObjectID = z; + Delete(local_5c,-1); + goto LAB_08091ff4; + } + Text = "Create: Objekttyp existiert nicht.\n"; + } + else { + Text = "Create: Zielobjekt existiert nicht.\n"; + } +LAB_080922e0: + error(Text); +LAB_08091ff4: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +Object Copy(Object *Con,Object *Source) + +{ + bool bVar1; + ulong uVar2; + undefined4 *puVar3; + ulong newCreature; + Object *Obj; + Object *in_stack_0000000c; + char *Text; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Help; + Object local_2c [7]; + + // try { // try from 08092368 to 08092715 has its CatchHandler @ 08092730 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CHEST); + if (!bVar1) { + Text = "Copy: Ziel ist kein Container.\n"; + goto LAB_080926bf; + } + } + bVar1 = Object::exists(in_stack_0000000c); + if (bVar1) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 99) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 0) { + local_2c[0] = (Object)Obj->ObjectID; + local_3c.ObjectID = in_stack_0000000c->ObjectID; + CheckMapDestination(0,&local_3c,local_2c); + } + else { + local_3c = (Object)Obj->ObjectID; + uVar2 = GetObjectCreatureID(&local_3c); + if (uVar2 != 0) { + local_3c.ObjectID = in_stack_0000000c->ObjectID; + CheckWeight(uVar2,&local_3c,-1); + } + Object::getObjectType(&local_3c); + bVar1 = false; + if ((0 < (int)local_3c.ObjectID) && ((int)local_3c.ObjectID < 0xb)) { + bVar1 = true; + } + if (bVar1) { + local_3c = (Object)Obj->ObjectID; + local_2c[0].ObjectID = in_stack_0000000c->ObjectID; + CheckInventoryDestination(local_2c,&local_3c,true); + } + else { + local_3c = (Object)Obj->ObjectID; + local_2c[0].ObjectID = in_stack_0000000c->ObjectID; + CheckContainerDestination(local_2c,&local_3c); + } + } + local_3c.ObjectID = in_stack_0000000c->ObjectID; + local_2c[0] = (Object)Obj->ObjectID; + CopyObject(Con,local_2c); + Object::getObjectType(&local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER); + if (bVar1) { + local_2c[0].ObjectID = in_stack_0000000c->ObjectID; + GetFirstContainerObject(&local_3c); + local_4c[0] = (Object)NONE.ObjectID; + local_2c[0].ObjectID = local_4c[0].ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) { + do { + local_5c[0] = (Object)Con->ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = local_3c.ObjectID; + Copy(local_4c,local_5c); + Object::getNextObject(local_4c); + local_3c.ObjectID = local_4c[0].ObjectID; + bVar1 = local_4c[0].ObjectID != NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + } while (bVar1); + } + } + local_5c[0] = (Object)Con->ObjectID; + AnnounceChangedObject(local_5c,1); + local_5c[0] = (Object)Con->ObjectID; + NotifyTrades(local_5c); + Object::getContainer(local_5c); + Object::getObjectType(local_4c); + local_4c[0] = (Object)Con->ObjectID; + local_3c.ObjectID = local_4c[0].ObjectID; + uVar2 = GetObjectCreatureID(&local_3c); + NotifyCreature(uVar2,(Object *)uVar2,SUB41(local_4c,0)); + Object::getContainer(local_5c); + Object::getContainer(local_4c); + local_3c = (Object)Con->ObjectID; + MovementEvent(&local_3c,local_4c,local_5c); + Object::getContainer(local_5c); + local_4c[0] = (Object)Con->ObjectID; + CollisionEvent(local_4c,local_5c); + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0] = (Object)Con->ObjectID; + NotifyAllCreatures(local_4c,1,local_5c); + return (Object)(ulong)Con; + } + Text = "Copy: Quelle ist eine Kreatur.\n"; + } + else { + Text = "Copy: Quelle existiert nicht.\n"; + } + } + else { + Text = "Copy: Ziel existiert nicht.\n"; + } +LAB_080926bf: + error(Text); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +void Move(ulong CreatureID,Object *Obj,Object *Con,int Count,bool NoMerge,Object *Ignore) + +{ + Object OVar1; + bool bVar2; + TCreature *cr; + ulong uVar3; + TCreature *pTVar4; + int iVar5; + undefined4 *puVar6; + TCreature *cr_1; + char *Text; + Object *pOVar7; + Object *Destination; + ulong oldCreature; + Object *local_94; + int x; + int y; + int z; + int x_1; + int y_1; + int z_1; + Object Rest; + Object local_6c; + Object oldCon; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c; + Object Top; + Object local_2c [7]; + + // try { // try from 0809276c to 08092fab has its CatchHandler @ 08093120 + bVar2 = Object::exists(Obj); + if (bVar2) { + bVar2 = Object::exists(Con); + if (!bVar2) { + error("Move: Zielobjekt existiert nicht.\n"); + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&z,&x_1,&y_1); + Object::getObjectType(local_2c); + error("# Objekt %d an [%d,%d,%d]\n",local_2c[0].ObjectID,z,x_1,y_1); + goto LAB_08093028; + } + Object::getObjectType(local_2c); + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar2) { + Object::getObjectType(local_2c); + pOVar7 = (Object *)0x6; + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,CUMULATIVE); + if (!bVar2) { +LAB_08092800: + OVar1.ObjectID = local_3c.ObjectID; + if ((!NoMerge) && + (pOVar7 = Con, Object::getObjectType(local_2c), + OVar1.ObjectID = local_3c.ObjectID, local_2c[0].ObjectID == 0)) { + Object::getObjectType(local_2c); + pOVar7 = (Object *)0x6; + bVar2 = ObjectType::getFlag((ObjectType *)local_2c,CUMULATIVE); + OVar1.ObjectID = local_3c.ObjectID; + if (bVar2) { + pOVar7 = Obj; + Object::getContainer(local_2c); + local_3c = (Object)Con->ObjectID; + OVar1.ObjectID = local_2c[0].ObjectID; + if (local_3c.ObjectID != local_2c[0].ObjectID) { + GetObjectCoordinates(&local_3c,(int *)&local_94,&x,&y); + GetTopObject((int)&local_3c,(int)local_94,x,(bool)(undefined1)y); + local_5c[0] = (Object)NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + pOVar7 = local_94; + OVar1.ObjectID = local_3c.ObjectID; + if (local_3c.ObjectID != NONE.ObjectID) { + local_5c[0] = (Object)Ignore->ObjectID; + local_6c.ObjectID = local_3c.ObjectID; + z_1 = Obj->ObjectID; + // try { // try from 08092ff7 to 08092ffb has its CatchHandler @ 080930df + Merge(CreatureID,(Object *)&z_1,&local_6c,Count,local_5c); + return; + } + } + } + } + local_3c.ObjectID = OVar1.ObjectID; + bVar2 = Object::exists(Obj); + if (!bVar2) { + error(&DAT_080ff6c0,pOVar7); + } + Object::getObjectType((Object *)&z_1); + bVar2 = ObjectType::getFlag((ObjectType *)&z_1,CUMULATIVE); + if ((bVar2) && (Count == -1)) { + Count = Object::getAttribute(Obj,AMOUNT); + } + z_1 = Ignore->ObjectID; + local_6c = (Object)Obj->ObjectID; + CheckTopMoveObject(CreatureID,&local_6c,(Object *)&z_1); + Object::getObjectType((Object *)&z_1); + bVar2 = z_1 != 0; + z_1 = Obj->ObjectID; + CheckMoveObject(CreatureID,(Object *)&z_1,bVar2); + Object::getObjectType((Object *)&z_1); + if (z_1 == 0) { + z_1 = Con->ObjectID; + local_6c = (Object)Obj->ObjectID; + CheckMapDestination(CreatureID,&local_6c,(Object *)&z_1); + } + else { + oldCreature._3_1_ = false; + Object::getObjectType((Object *)&z_1); + bVar2 = ObjectType::getFlag((ObjectType *)&z_1,CUMULATIVE); + if ((bVar2) && (uVar3 = Object::getAttribute(Obj,AMOUNT), Count < (int)uVar3)) { + oldCreature._3_1_ = true; + } + Object::getObjectType((Object *)&z_1); + bVar2 = false; + if ((0 < z_1) && (z_1 < 0xb)) { + bVar2 = true; + } + if (bVar2) { + z_1 = Con->ObjectID; + local_6c = (Object)Obj->ObjectID; + CheckInventoryDestination(&local_6c,(Object *)&z_1,oldCreature._3_1_); + } + else { + z_1 = Con->ObjectID; + local_6c = (Object)Obj->ObjectID; + CheckContainerDestination(&local_6c,(Object *)&z_1); + } + if (oldCreature._3_1_ == false) { + z_1 = Obj->ObjectID; + iVar5 = CountObjects((Object *)&z_1); + local_6c = (Object)Con->ObjectID; + pOVar7 = local_5c; + local_5c[0] = (Object)Obj->ObjectID; + Destination = &local_6c; + } + else { + z_1 = Con->ObjectID; + iVar5 = 1; + local_6c.ObjectID = NONE.ObjectID; + pOVar7 = &local_6c; + Destination = (Object *)&z_1; + } + CheckDepotSpace(CreatureID,pOVar7,Destination,iVar5); + z_1 = Con->ObjectID; + uVar3 = GetObjectCreatureID((Object *)&z_1); + if (uVar3 != 0) { + z_1 = Obj->ObjectID; + CheckWeight(uVar3,(Object *)&z_1,Count); + } + } + z_1 = NONE.ObjectID; + Object::getObjectType(&local_6c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_6c,CUMULATIVE); + if ((bVar2) && (uVar3 = Object::getAttribute(Obj,AMOUNT), Count < (int)uVar3)) { + z_1 = Obj->ObjectID; + local_6c.ObjectID = z_1; + local_5c[0].ObjectID = z_1; + local_4c[0].ObjectID = z_1; + SplitObject(local_5c,(int)local_4c); + local_6c.ObjectID = local_5c[0].ObjectID; + Obj->ObjectID = (ulong)local_5c[0]; + } + Object::getContainer(&local_6c); + local_5c[0] = (Object)Obj->ObjectID; + pOVar7 = (Object *)GetObjectCreatureID(local_5c); + local_5c[0].ObjectID = local_6c.ObjectID; + local_4c[0].ObjectID = local_6c.ObjectID; + if (Con->ObjectID != local_6c.ObjectID) { + local_3c = (Object)Obj->ObjectID; + SeparationEvent(&local_3c,local_4c); + } + Object::getObjectType(local_5c); + if ((local_5c[0].ObjectID != 99) && + (local_5c[0].ObjectID = NONE.ObjectID, z_1 == NONE.ObjectID)) { + local_4c[0] = (Object)Obj->ObjectID; + AnnounceChangedObject(local_4c,0); + local_4c[0] = (Object)Obj->ObjectID; + NotifyTrades(local_4c); + local_4c[0] = (Object)Obj->ObjectID; + iVar5 = CountObjects(local_4c); + local_3c = (Object)Obj->ObjectID; + NotifyDepot(CreatureID,&local_3c,iVar5); + } + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,CONTAINER); + if ((bVar2) && (CreatureID == 0)) { + local_5c[0] = (Object)Obj->ObjectID; + CloseContainer(local_5c,true); + } + Object::getObjectType(local_5c); + if (local_5c[0].ObjectID == 99) { + local_5c[0] = (Object)Obj->ObjectID; + pTVar4 = GetCreature(local_5c); + if (pTVar4 == (TCreature *)0x0) { + uVar3 = Object::getCreatureID(Obj); + error(&DAT_080ff680,uVar3); + } + else { + local_5c[0] = (Object)Con->ObjectID; + TCreature::NotifyTurn(pTVar4,local_5c); + } + local_5c[0] = (Object)Con->ObjectID; + uVar3 = Object::getCreatureID(Obj); + AnnounceMovingCreature(uVar3,local_5c); + } + local_5c[0] = (Object)Con->ObjectID; + local_4c[0] = (Object)Obj->ObjectID; + MoveObject(local_4c,local_5c); + Object::getObjectType(local_5c); + if (local_5c[0].ObjectID != 99) { + local_5c[0] = (Object)Obj->ObjectID; + AnnounceChangedObject(local_5c,1); + local_5c[0] = (Object)Obj->ObjectID; + NotifyTrades(local_5c); + local_5c[0] = (Object)Obj->ObjectID; + iVar5 = CountObjects(local_5c); + local_4c[0] = (Object)Obj->ObjectID; + NotifyDepot(CreatureID,local_4c,-iVar5); + } + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (z_1 != NONE.ObjectID) { + local_4c[0].ObjectID = z_1; + AnnounceChangedObject(local_4c,2); + local_4c[0].ObjectID = z_1; + NotifyTrades(local_4c); + } + Object::getObjectType(local_5c); + if (local_5c[0].ObjectID == 99) { + local_5c[0] = (Object)Obj->ObjectID; + pTVar4 = GetCreature(local_5c); + if (pTVar4 == (TCreature *)0x0) { + uVar3 = Object::getCreatureID(Obj); + error(&DAT_080ff680,uVar3); + } + else { + TCreature::NotifyGo(pTVar4); + } + } + Object::getObjectType(local_5c); + local_5c[0] = (Object)Obj->ObjectID; + NotifyCreature(local_5c[0].ObjectID,pOVar7,SUB41(local_5c,0)); + Object::getContainer(local_5c); + Object::getObjectType(local_4c); + local_4c[0] = (Object)Obj->ObjectID; + local_3c.ObjectID = local_4c[0].ObjectID; + uVar3 = GetObjectCreatureID(&local_3c); + NotifyCreature(uVar3,(Object *)uVar3,SUB41(local_4c,0)); + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,CONTAINER); + if (bVar2) { + local_5c[0] = (Object)Obj->ObjectID; + CloseContainer(local_5c,false); + } + local_5c[0] = (Object)Con->ObjectID; + local_4c[0].ObjectID = local_6c.ObjectID; + local_3c = (Object)Obj->ObjectID; + MovementEvent(&local_3c,local_4c,local_5c); + local_5c[0] = (Object)Obj->ObjectID; + Object::getContainer(local_4c); + CollisionEvent(local_5c,local_4c); + local_5c[0].ObjectID = local_6c.ObjectID; + local_4c[0] = (Object)Obj->ObjectID; + NotifyAllCreatures(local_4c,3,local_5c); + return; + } + if (Count != 0) { + pOVar7 = (Object *)0x2; + uVar3 = Object::getAttribute(Obj,AMOUNT); + if (Count <= (int)uVar3) goto LAB_08092800; + } + // try { // try from 0809300c to 080930cd has its CatchHandler @ 08093120 + uVar3 = Object::getAttribute(Obj,AMOUNT); + error(&DAT_080ff700,Count,uVar3); + goto LAB_08093028; + } + Text = "Move: Zielobjekt ist kein Container.\n"; + } + else { + Text = &DAT_080ff7e0; + } + error(Text); +LAB_08093028: + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +void Merge(ulong CreatureID,Object *Obj,Object *Dest,int Count,Object *Ignore) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + undefined4 *puVar4; + ulong newCreature; + char *Text; + ulong oldCreature; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Con; + Object local_3c; + Object oldCon; + Object local_2c [7]; + + // try { // try from 0809314b to 080936c5 has its CatchHandler @ 080936d1 + bVar1 = Object::exists(Obj); + if (bVar1) { + bVar1 = Object::exists(Dest); + if (!bVar1) { + Text = "Merge: Zielobjekt existiert nicht.\n"; + goto LAB_080936c1; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CUMULATIVE); + if ((!bVar1) || + ((Count != 0 && (uVar2 = Object::getAttribute(Obj,AMOUNT), Count <= (int)uVar2)))) { + local_2c[0] = (Object)Dest->ObjectID; + if (Obj->ObjectID == local_2c[0].ObjectID) { + return; + } + Object::getObjectType(local_2c); + Object::getObjectType(&local_3c); + ObjectType::setTypeID((ObjectType *)&local_4c,local_3c.ObjectID); + if (local_2c[0].ObjectID == local_4c.ObjectID) { + Object::getObjectType(&local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_4c,CUMULATIVE); + if (bVar1) { + if (Count == -1) { + Count = Object::getAttribute(Obj,AMOUNT); + } + uVar2 = Object::getAttribute(Dest,AMOUNT); + if (uVar2 + Count < 0x65) { + Object::getContainer(&local_4c); + local_3c = (Object)Ignore->ObjectID; + local_2c[0] = (Object)Obj->ObjectID; + CheckTopMoveObject(CreatureID,local_2c,&local_3c); + Object::getObjectType(&local_3c); + bVar1 = local_3c.ObjectID != 0; + local_3c = (Object)Obj->ObjectID; + CheckMoveObject(CreatureID,&local_3c,bVar1); + Object::getObjectType(&local_3c); + if (local_3c.ObjectID == 0) { + local_3c.ObjectID = local_4c.ObjectID; + local_2c[0] = (Object)Obj->ObjectID; + CheckMapDestination(CreatureID,local_2c,&local_3c); + } + else { + local_3c.ObjectID = local_4c.ObjectID; + local_2c[0] = (Object)Obj->ObjectID; + CheckDepotSpace(CreatureID,local_2c,&local_3c,0); + local_3c.ObjectID = local_4c.ObjectID; + uVar2 = GetObjectCreatureID(&local_3c); + if (uVar2 != 0) { + local_3c = (Object)Obj->ObjectID; + CheckWeight(uVar2,&local_3c,Count); + } + } + Object::getContainer(&local_3c); + local_2c[0] = (Object)Obj->ObjectID; + uVar2 = GetObjectCreatureID(local_2c); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,MOVEMENTEVENT); + if (bVar1) { + Object::getObjectType(local_2c); + error(&DAT_080ff820,local_2c[0].ObjectID); + } + Object::getContainer(local_2c); + local_5c[0].ObjectID = local_3c.ObjectID; + local_6c[0].ObjectID = local_3c.ObjectID; + if (local_2c[0].ObjectID != local_3c.ObjectID) { + oldCreature = Obj->ObjectID; + SeparationEvent((Object *)&oldCreature,local_6c); + } + uVar3 = Object::getAttribute(Obj,AMOUNT); + if (Count < (int)uVar3) { + oldCreature = Obj->ObjectID; + uVar3 = Object::getAttribute(Obj,AMOUNT); + ChangeObject((Object *)&oldCreature,AMOUNT,uVar3 - Count); + oldCreature = Obj->ObjectID; + AnnounceChangedObject((Object *)&oldCreature,2); + oldCreature = Obj->ObjectID; + NotifyTrades((Object *)&oldCreature); + oldCreature = Dest->ObjectID; + uVar3 = Object::getAttribute(Dest,AMOUNT); + ChangeObject((Object *)&oldCreature,AMOUNT,uVar3 + Count); + } + else { + oldCreature = Obj->ObjectID; + AnnounceChangedObject((Object *)&oldCreature,0); + oldCreature = Obj->ObjectID; + NotifyTrades((Object *)&oldCreature); + oldCreature = Obj->ObjectID; + NotifyDepot(CreatureID,(Object *)&oldCreature,1); + oldCreature = Dest->ObjectID; + local_6c[0] = (Object)Obj->ObjectID; + MergeObjects(local_6c,(Object *)&oldCreature); + } + oldCreature = Dest->ObjectID; + AnnounceChangedObject((Object *)&oldCreature,2); + oldCreature = Dest->ObjectID; + NotifyTrades((Object *)&oldCreature); + Object::getObjectType((Object *)&oldCreature); + oldCreature = Dest->ObjectID; + NotifyCreature(uVar2,(Object *)uVar2,SUB41((Object *)&oldCreature,0)); + Object::getContainer((Object *)&oldCreature); + Object::getObjectType(local_6c); + local_6c[0] = (Object)Dest->ObjectID; + local_5c[0].ObjectID = local_6c[0].ObjectID; + uVar2 = GetObjectCreatureID(local_5c); + NotifyCreature(uVar2,(Object *)uVar2,SUB41(local_6c,0)); + oldCreature = Dest->ObjectID; + Object::getContainer(local_6c); + CollisionEvent((Object *)&oldCreature,local_6c); + oldCreature = NONE.ObjectID; + local_6c[0] = (Object)Dest->ObjectID; + NotifyAllCreatures(local_6c,2,(Object *)&oldCreature); + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x13; + } + else { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x12; + } + } + else { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x11; + } + goto LAB_08093635; + } + error(&DAT_080ff880,Count); + } + else { + Text = &DAT_080ff900; +LAB_080936c1: + error(Text); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_08093635: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void Change(Object *Obj,ObjectType *NewType,ulong Value) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + int iVar4; + undefined4 *puVar5; + ulong Data; + char *pcVar6; + Object OVar7; + ulong Creature; + Object local_7c; + ObjectType OldType; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 0809370b to 08093ef9 has its CatchHandler @ 08093f30 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType(local_2c); + if ((local_2c[0].ObjectID == 99) || (NewType->TypeID == 99)) { + pcVar6 = &DAT_080ffa00; + } + else { + ObjectType::setTypeID((ObjectType *)local_2c,0); + if (NewType->TypeID == local_2c[0].ObjectID) { + local_3c[0] = (Object)Obj->ObjectID; + Delete(local_3c,-1); + return; + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar1) { + bVar1 = ObjectType::getFlag(NewType,CONTAINER); + if (!bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject(local_3c); + local_5c[0] = (Object)NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (local_3c[0].ObjectID == NONE.ObjectID) goto LAB_08093e33; + Object::getObjectType(local_5c); + iVar4 = NewType->TypeID; + pcVar6 = &DAT_080ff9c0; + OVar7.ObjectID = local_5c[0].ObjectID; +LAB_08093e9d: + error(pcVar6,iVar4,OVar7.ObjectID); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x14; + goto LAB_08093d62; + } +LAB_08093e33: + bVar1 = ObjectType::getFlag(NewType,CONTAINER); + if (bVar1) { + uVar3 = ObjectType::getAttribute(NewType,CAPACITY); + local_5c[0] = (Object)Obj->ObjectID; + iVar4 = CountObjectsInContainer(local_5c); + if ((int)uVar3 < iVar4) { + Object::getObjectType(local_4c); + iVar4 = NewType->TypeID; + pcVar6 = &DAT_080ff980; + OVar7.ObjectID = local_4c[0].ObjectID; + goto LAB_08093e9d; + } + } + } + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,CHEST); + if ((!bVar1) || (bVar1 = ObjectType::getFlag(NewType,CHEST), bVar1)) { + bVar1 = false; + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,CUMULATIVE); + if (bVar2) { + Object::getObjectType(local_5c); + ObjectType::setTypeID((ObjectType *)local_4c,NewType->TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,local_4c[0].ObjectID); + if ((local_5c[0].ObjectID != local_3c[0].ObjectID) && + (uVar3 = Object::getAttribute(Obj,AMOUNT), 1 < uVar3)) { + bVar1 = true; + } + } + if (!bVar1) { + local_5c[0] = (Object)Obj->ObjectID; + uVar3 = GetObjectCreatureID(local_5c); + if (uVar3 != 0) { + Object::getObjectType(local_5c); + ObjectType::setTypeID((ObjectType *)local_4c,NewType->TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,local_4c[0].ObjectID); + if (local_5c[0].ObjectID != local_3c[0].ObjectID) { + Object::getContainer(local_3c); + Object::getObjectType(local_2c); + bVar1 = false; + if ((0 < (int)local_2c[0].ObjectID) && ((int)local_2c[0].ObjectID < 0xb) + ) { + bVar1 = true; + } + if (bVar1) { + local_7c = (Object)Obj->ObjectID; + ObjectType::setTypeID((ObjectType *)local_6c,NewType->TypeID); + Object::getContainer(local_2c); + CheckInventoryPlace((ObjectType *)local_6c,local_2c,&local_7c); + } + else { + local_2c[0] = (Object)Obj->ObjectID; + ObjectType::setTypeID((ObjectType *)local_6c,NewType->TypeID); + Object::getContainer(&local_7c); + CheckContainerPlace((ObjectType *)local_6c,&local_7c,local_2c); + } + local_7c = (Object)Obj->ObjectID; + iVar4 = GetWeight(&local_7c,-1); + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,CUMULATIVE); + if (bVar1) { + Data = Object::getAttribute(Obj,AMOUNT); + } + else { + Data = 1; + } + ObjectType::setTypeID((ObjectType *)local_6c,NewType->TypeID); + CheckWeight(uVar3,(ObjectType *)local_6c,Data,iVar4); + } + } + Object::getObjectType(&local_7c); + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,CONTAINER); + if ((bVar1) && (bVar1 = ObjectType::getFlag(NewType,CONTAINER), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + CloseContainer(local_6c,true); + } + ObjectType::setTypeID((ObjectType *)local_6c,NewType->TypeID); + local_5c[0] = (Object)Obj->ObjectID; + ChangeObject(local_5c,(ObjectType *)local_6c); + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,CUMULATIVE); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,CUMULATIVE), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,AMOUNT,Value); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,MAGICFIELD); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,MAGICFIELD), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,RESPONSIBLE,Value); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,LIQUIDPOOL); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,LIQUIDPOOL), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,POOLLIQUIDTYPE,Value); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,LIQUIDCONTAINER); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,LIQUIDCONTAINER), !bVar1 + )) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,CONTAINERLIQUIDTYPE,Value); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,KEY); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,KEY), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,KEYNUMBER,Value); + } + Object::getObjectType(local_6c); + bVar1 = ObjectType::getFlag((ObjectType *)local_6c,RUNE); + if ((bVar1) && + (bVar1 = ObjectType::getFlag((ObjectType *)&local_7c,RUNE), !bVar1)) { + local_6c[0] = (Object)Obj->ObjectID; + ChangeObject(local_6c,CHARGES,Value); + } + local_6c[0] = (Object)Obj->ObjectID; + AnnounceChangedObject(local_6c,2); + local_6c[0] = (Object)Obj->ObjectID; + NotifyTrades(local_6c); + Object::getContainer(local_6c); + Object::getObjectType(local_5c); + local_5c[0] = (Object)Obj->ObjectID; + local_4c[0].ObjectID = local_5c[0].ObjectID; + uVar3 = GetObjectCreatureID(local_4c); + NotifyCreature(uVar3,(Object *)uVar3,SUB41(local_5c,0)); + local_6c[0].ObjectID = NONE.ObjectID; + local_5c[0] = (Object)Obj->ObjectID; + NotifyAllCreatures(local_5c,2,local_6c); + return; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x15; + goto LAB_08093d62; + } + pcVar6 = &DAT_080ff940; + } + } + else { + pcVar6 = &DAT_080ffa40; + } + error(pcVar6); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; +LAB_08093d62: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void Change(Object *Obj,INSTANCEATTRIBUTE Attribute,ulong Value) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + int oldWeight; + undefined4 *puVar4; + ulong Creature; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08093f6b to 0809414b has its CatchHandler @ 08094150 + bVar1 = Object::exists(Obj); + if (bVar1) { + if ((((CHESTQUESTNUMBER < Attribute) && (Attribute != DOORLEVEL)) && + (Attribute != DOORQUESTNUMBER)) && + (((Attribute != DOORQUESTVALUE && (Attribute != ABSTELEPORTDESTINATION)) && + (Attribute != REMAININGEXPIRETIME)))) { + local_2c[0] = (Object)Obj->ObjectID; + uVar2 = GetObjectCreatureID(local_2c); + if (((uVar2 != 0) && (Attribute == AMOUNT)) && + (uVar3 = Object::getAttribute(Obj,AMOUNT), uVar3 < Value)) { + local_2c[0] = (Object)Obj->ObjectID; + oldWeight = GetWeight(local_2c,-1); + Object::getObjectType(local_3c); + CheckWeight(uVar2,(ObjectType *)local_3c,Value,oldWeight); + } + local_3c[0] = (Object)Obj->ObjectID; + ChangeObject(local_3c,Attribute,Value); + if (((Attribute == AMOUNT) || (Attribute == CONTAINERLIQUIDTYPE)) || + (Attribute == POOLLIQUIDTYPE)) { + local_3c[0] = (Object)Obj->ObjectID; + AnnounceChangedObject(local_3c,2); + } + local_3c[0] = (Object)Obj->ObjectID; + NotifyTrades(local_3c); + Object::getContainer(local_3c); + Object::getObjectType(local_2c); + Creature = Obj->ObjectID; + local_2c[0].ObjectID = Creature; + uVar2 = GetObjectCreatureID((Object *)&Creature); + NotifyCreature(uVar2,(Object *)uVar2,SUB41(local_2c,0)); + return; + } + error(&DAT_080ffa80,Attribute); + } + else { + error(&DAT_080ffa40); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void Delete(Object *Obj,int Count) + +{ + bool bVar1; + TCreature *cr; + ulong uVar2; + TCreature *this; + undefined4 *puVar3; + bool Inventory; + ObjectType *Type; + ulong oldCreature; + Object local_5c; + Object oldCon; + Object local_4c; + ObjectType oldType; + Object local_3c [4]; + Object local_2c; + Object Rest; + + // try { // try from 0809418b to 08094506 has its CatchHandler @ 08094510 + bVar1 = Object::exists(Obj); + if (!bVar1) { + error(&DAT_080ffb60); +LAB_080944d1: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CUMULATIVE); + if ((bVar1) && ((Count == 0 || (uVar2 = Object::getAttribute(Obj,AMOUNT), (int)uVar2 < Count)))) + { + error(&DAT_080ffb00,Count); + goto LAB_080944d1; + } + local_2c.ObjectID = NONE.ObjectID; + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (((bVar1) && (Count != -1)) && (uVar2 = Object::getAttribute(Obj,AMOUNT), Count < (int)uVar2) + ) { + local_5c = (Object)Obj->ObjectID; + local_4c.ObjectID = local_5c.ObjectID; + local_3c[0].ObjectID = local_5c.ObjectID; + local_2c.ObjectID = local_5c.ObjectID; + SplitObject(local_3c,(int)&local_5c); + local_4c.ObjectID = local_3c[0].ObjectID; + Obj->ObjectID = (ulong)local_3c[0]; + } + else { + local_5c = (Object)Obj->ObjectID; + NotifyTrades(&local_5c); + } + Object::getObjectType(&local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_5c,CONTAINER); + if (!bVar1) { + Object::getObjectType(&local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_5c,CHEST); + if (!bVar1) goto LAB_080942ee; + } + Object::getObjectType(&local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_5c,CONTAINER); + if (bVar1) { + local_5c = (Object)Obj->ObjectID; + CloseContainer(&local_5c,true); + } + while( true ) { + local_4c = (Object)Obj->ObjectID; + GetFirstContainerObject(&local_5c); + local_4c.ObjectID = NONE.ObjectID; + if (local_5c.ObjectID == NONE.ObjectID) break; + local_4c.ObjectID = local_5c.ObjectID; + DeleteObject(&local_4c); + } +LAB_080942ee: + Object::getContainer(&local_5c); + local_4c = (Object)Obj->ObjectID; + uVar2 = GetObjectCreatureID(&local_4c); + Object::getObjectType(&local_4c); + local_3c[0].ObjectID = local_5c.ObjectID; + oldCreature = Obj->ObjectID; + SeparationEvent((Object *)&oldCreature,local_3c); + bVar1 = Object::exists(Obj); + if (bVar1) { + oldCreature = NONE.ObjectID; + if (local_2c.ObjectID == NONE.ObjectID) { + local_3c[0] = (Object)Obj->ObjectID; + AnnounceChangedObject(local_3c,0); + } + oldCreature = NONE.ObjectID; + local_3c[0] = (Object)Obj->ObjectID; + NotifyAllCreatures(local_3c,0,(Object *)&oldCreature); + if (local_4c.ObjectID == 99) { + this = GetCreature(uVar2); + if (this == (TCreature *)0x0) { + error(&DAT_080ffac0,uVar2); + } + else { + TCreature::NotifyDelete(this); + } + } + oldCreature = Obj->ObjectID; + DeleteObject((Object *)&oldCreature); + oldCreature = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c.ObjectID != NONE.ObjectID) { + local_3c[0].ObjectID = local_2c.ObjectID; + AnnounceChangedObject(local_3c,2); + local_3c[0].ObjectID = local_2c.ObjectID; + NotifyTrades(local_3c); + } + Object::getObjectType((Object *)&oldCreature); + ObjectType::setTypeID((ObjectType *)&oldCreature,local_4c.ObjectID); + NotifyCreature(uVar2,Type,Inventory); + } + return; +} + + + +void Empty(Object *Con,int Rest) + +{ + bool bVar1; + int iVar2; + undefined4 *puVar3; + char *Text; + bool IsCorpse; + int Count; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Obj; + + // try { // try from 0809454b to 080946b9 has its CatchHandler @ 080946c5 + bVar1 = Object::exists(Con); + if (bVar1) { + if (Rest < 0) { + error(&DAT_081013ed,Rest); + goto LAB_08094680; + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CONTAINER); + if (bVar1) { + local_2c = (Object)Con->ObjectID; + iVar2 = CountObjectsInContainer(&local_2c); + local_2c = (Object)Con->ObjectID; + CloseContainer(&local_2c,true); + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CORPSE); + for (; Rest < iVar2; iVar2 = iVar2 + -1) { + local_3c[0] = (Object)Con->ObjectID; + GetFirstContainerObject(&local_2c); + if (bVar1) { + local_3c[0].ObjectID = local_2c.ObjectID; + Delete(local_3c,-1); + } + else { + local_3c[0].ObjectID = NONE.ObjectID; + Object::getContainer(local_4c); + Count = local_2c.ObjectID; + Move(0,(Object *)&Count,local_4c,-1,false,local_3c); + } + } + return; + } + Text = &DAT_080ffba0; + } + else { + Text = &DAT_080ffbe0; + } + error(Text); +LAB_08094680: + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void GraphicalEffect(void) + +{ + int in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + AnnounceGraphicalEffect(in_stack_00000004,in_stack_00000008,in_stack_0000000c,in_stack_00000010) + ; + return; +} + + + +void GraphicalEffect(Object *Obj,int Type) + +{ + bool bVar1; + int local_28; + int x; + int y; + int z; + + bVar1 = Object::exists(Obj); + if (bVar1) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&local_28,&x,&y); + AnnounceGraphicalEffect(local_28,x,y,Type); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void TextualEffect(void) + +{ + bool bVar1; + Object *in_stack_00000004; + int in_stack_00000008; + char *in_stack_0000000c; + int local_58; + int x; + int y; + int z; + char Buffer [10]; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(in_stack_00000004); + if (bVar1) { + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 0) { + z = in_stack_00000004->ObjectID; + GetMapContainer(local_3c); + in_stack_00000004->ObjectID = local_3c[0].ObjectID; + } + vsnprintf((char *)&z,10,in_stack_0000000c,&stack0x00000010); + local_3c[0].ObjectID = in_stack_00000004->ObjectID; + GetObjectCoordinates(local_3c,&local_58,&x,&y); + AnnounceTextualEffect(local_58,x,y,in_stack_00000008,(char *)&z); + } + else { + error(&DAT_080ffc20); + } + return; +} + + + +void Missile(Object *Start,Object *Dest,int Type) + +{ + bool bVar1; + char *Text; + int local_44; + int zx; + int zy; + int zz; + int sx; + int sy; + int sz; + + bVar1 = Object::exists(Start); + if (bVar1) { + bVar1 = Object::exists(Dest); + if (bVar1) { + sz = Start->ObjectID; + GetObjectCoordinates((Object *)&sz,&zz,&sx,&sy); + sz = Dest->ObjectID; + GetObjectCoordinates((Object *)&sz,&local_44,&zx,&zy); + AnnounceMissile(zz,sx,sy,local_44,zx,zy,Type); + return; + } + Text = &DAT_080ffca0; + } + else { + Text = &DAT_080ffc60; + } + error(Text); + return; +} + + + +void Look(ulong CreatureID,Object *Obj) + +{ + TSkill *this; + bool bVar1; + byte bVar2; + ushort HouseID; + int Profession; + TPlayer *pTVar3; + TPlayer *this_00; + ulong uVar4; + int iVar5; + uint uVar6; + ulong uVar7; + undefined4 *puVar8; + TCreature *cr; + TConnection *Connection; + char *pcVar9; + char *pcVar10; + Object *Buffer; + int local_5bc; + int c; + bool Yourself; + TPlayer *pl; + int x; + int y; + int z; + int MagicLevel; + char Pronoun [4]; + char s2 [500]; + char local_39c [4]; + char s [500]; + Object local_19c; + char HelpProfession [30]; + char Membership [200]; + char local_ac [4]; + char Vocation [50]; + char local_6c [4]; + char Player [50]; + Object local_2c [7]; + + // try { // try from 0809494b to 08095fb2 has its CatchHandler @ 08095fc0 + pTVar3 = GetPlayer(CreatureID); + if (pTVar3 == (TPlayer *)0x0) { + pcVar9 = "Look: Kreatur existiert nicht.\n"; +LAB_08095f84: + error(pcVar9); + puVar8 = (undefined4 *)__cxa_allocate_exception(4); + *puVar8 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar8,&RESULT::typeinfo,0); + } + bVar1 = Object::exists(Obj); + if (!bVar1) { + pcVar9 = "Look: Objekt existiert nicht.\n"; + goto LAB_08095f84; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID == 99) { + local_2c[0] = (Object)Obj->ObjectID; + this_00 = (TPlayer *)GetCreature(local_2c); + if (this_00 == (TPlayer *)0x0) { + Object::getObjectType(local_2c); + error("Look: Object %d hat keine Kreatur!\n",local_2c[0].ObjectID); + return; + } + if ((this_00->super_TCreature).Type == PLAYER) { + uVar4 = Object::getCreatureID(Obj); + bVar1 = CreatureID == uVar4; + if (bVar1) { + builtin_strncpy(local_6c,"your",4); + builtin_strncpy(Player,"self",5); + } + else { + this = (this_00->super_TCreature).super_TSkillBase.Skills[0]; + if (this == (TSkill *)0x0) { + iVar5 = 1; + } + else { + iVar5 = TSkill::Get(this); + } + snprintf(local_6c,0x32,"%s (Level %d)",(this_00->super_TCreature).Name,iVar5); + } + if ((this_00->super_TCreature).Sex == 2) { + MagicLevel = 0x656853; + } + else { + MagicLevel = CONCAT13(MagicLevel._3_1_,0x6548); + } + bVar2 = TPlayer::GetActiveProfession(this_00); + uVar6 = (uint)bVar2; + if (bVar1) { + if (uVar6 == 0) { + builtin_strncpy(Vocation,"have no vocation",0x11); + builtin_strncpy(local_ac,"You ",4); + goto LAB_08094ad9; + } + Buffer = &local_19c; + GetProfessionName((char *)Buffer,uVar6,true,false); + pcVar9 = "You are %s"; + } + else { + if (uVar6 != 0) { + GetProfessionName((char *)&local_19c,uVar6,true,false); + snprintf(local_ac,0x32,"%s is %s",&MagicLevel,&local_19c); + goto LAB_08094ad9; + } + pcVar9 = "%s has no vocation"; + Buffer = (Object *)&MagicLevel; + } + snprintf(local_ac,0x32,pcVar9,Buffer); +LAB_08094ad9: + if (this_00->Guild[0] == '\0') { + stack0xfffffe84 = stack0xfffffe84 & 0xffffff00; + } + else { + if (bVar1) { + stack0xfffffe84 = 0x20756f59; + } + else { + snprintf(HelpProfession + 0x1c,200,"%s is ",&MagicLevel); + } + if (this_00->Rank[0] == '\0') { + pcVar9 = "a member"; + } + else { + pcVar9 = this_00->Rank; + } + strcat(HelpProfession + 0x1c,pcVar9); + strcat(HelpProfession + 0x1c," of the "); + strcat(HelpProfession + 0x1c,this_00->Guild); + if (this_00->Title[0] != '\0') { + strcat(HelpProfession + 0x1c," ("); + strcat(HelpProfession + 0x1c,this_00->Title); + strcat(HelpProfession + 0x1c,")"); + } + } + if (HelpProfession[0x1c] != '\0') { + SendMessage((pTVar3->super_TCreature).Connection,0x16,"You see %s. %s. %s.",local_6c + ,local_ac,HelpProfession + 0x1c); + return; + } + SendMessage((pTVar3->super_TCreature).Connection,0x16,"You see %s. %s.",local_6c, + local_ac); + return; + } + pcVar9 = (this_00->super_TCreature).Name; + Connection = (pTVar3->super_TCreature).Connection; + pcVar10 = "You see %s."; + goto LAB_080949d4; + } + builtin_strncpy(s,"see ",5); + builtin_strncpy(local_39c,"You ",4); + local_2c[0] = (Object)Obj->ObjectID; + pcVar9 = GetName(local_2c); + strcat(local_39c,pcVar9); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LEVELDOOR); + if (bVar1) { + uVar4 = Object::getAttribute(Obj,DOORLEVEL); + sprintf(Pronoun," for level %lu",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,CAPACITY); + sprintf(Pronoun," (Vol:%lu)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,WEAPON); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,WEAPONDEFENDVALUE); + Object::getObjectType(local_2c); + uVar7 = ObjectType::getAttribute((ObjectType *)local_2c,WEAPONATTACKVALUE); + sprintf(Pronoun," (Atk:%lu Def:%lu)",uVar7,uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,THROW); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,THROWDEFENDVALUE); + Object::getObjectType(local_2c); + uVar7 = ObjectType::getAttribute((ObjectType *)local_2c,THROWATTACKVALUE); + sprintf(Pronoun," (Atk:%lu Def:%lu)",uVar7,uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,SHIELD); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,SHIELDDEFENDVALUE); + sprintf(Pronoun," (Def:%lu)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,ARMOR); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,ARMORVALUE); + sprintf(Pronoun," (Arm:%lu)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,KEY); + if (bVar1) { + uVar4 = Object::getAttribute(Obj,KEYNUMBER); + sprintf(Pronoun," (Key:%04ld)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,KEYDOOR); + if ((bVar1) && (bVar1 = CheckRight((pTVar3->super_TCreature).ID,SHOW_KEYHOLE_NUMBERS), bVar1)) { + uVar4 = Object::getAttribute(Obj,KEYHOLENUMBER); + sprintf(Pronoun," (Door:%04ld)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,SHOWDETAIL); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,WEAROUT); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,TOTALUSES); + if (uVar4 < 2) goto LAB_08095af9; + uVar4 = Object::getAttribute(Obj,REMAININGUSES); + pcVar9 = ""; + if (uVar4 != 1) { + pcVar9 = "s"; + } + uVar4 = Object::getAttribute(Obj,REMAININGUSES); + sprintf(Pronoun," that has %ld charge%s left",uVar4,pcVar9); + pcVar9 = Pronoun; + } + else { +LAB_08095af9: + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,EXPIRE); + if (!bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,EXPIRESTOP); + if (!bVar1) { + Object::getObjectType(local_2c); + error("Look: Objekt %d hat Flag SHOWDETAIL, aber weder WEAROUT noch EXPIRE.\n", + local_2c[0].ObjectID); + goto LAB_08094f1f; + } + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,EXPIRE); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + uVar4 = CronInfo(local_2c,false); + } + else { + uVar4 = Object::getAttribute(Obj,SAVEDEXPIRETIME); + } + uVar6 = (uVar4 + 0x3b) / 0x3c; + if (uVar6 == 0) { + pcVar9 = " that is brand-new"; + } + else { + pcVar9 = ""; + if (uVar6 != 1) { + pcVar9 = "s"; + } + sprintf(Pronoun," that has energy for %d minute%s left",uVar6,pcVar9); + pcVar9 = Pronoun; + } + } + strcat(local_39c,pcVar9); + } +LAB_08094f1f: + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTLEVEL); + if (bVar1) { +LAB_08094f69: + strcat(local_39c,".\nIt can only be wielded by "); + Pronoun = (char [4])((uint)Pronoun & 0xffffff00); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTPROFESSION); + if (bVar1) { + iVar5 = 5; + local_5bc = 0; + do { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,PROFESSIONS); + if (iVar5 == 5) { + uVar6 = uVar4 & 1; + } + else { + uVar6 = 1 << ((byte)iVar5 & 0x1f) & uVar4; + } + if (uVar6 != 0) { + if (local_5bc == 0) { + stack0xfffffe84 = stack0xfffffe84 & 0xffffff00; + } + if (local_5bc == 1) { + sprintf(HelpProfession + 0x1c," and %s",Pronoun); + } + if (1 < local_5bc) { + sprintf(HelpProfession + 0x1c,", %s",Pronoun); + } + switch(iVar5) { + case 1: + builtin_strncpy(Pronoun,"knig",4); + break; + case 2: + builtin_strncpy(Pronoun,"pala",4); + break; + case 3: + builtin_strncpy(Pronoun,"sorc",4); + break; + case 4: + builtin_strncpy(Pronoun,"drui",4); + break; + case 5: + builtin_strncpy(Pronoun,"play",4); + } + strcat(Pronoun,HelpProfession + 0x1c); + local_5bc = local_5bc + 1; + } + iVar5 = iVar5 + -1; + } while (0 < iVar5); + } + else { + builtin_strncpy(Pronoun,"play",4); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTLEVEL); + if (bVar1) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,MINIMUMLEVEL); + sprintf(HelpProfession + 0x1c," of level %ld or higher",uVar4); + strcat(Pronoun,HelpProfession + 0x1c); + } + strcat(local_39c,Pronoun); + } + else { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTPROFESSION); + if (bVar1) goto LAB_08094f69; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RUNE); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetMagicItemDescription(local_2c,Pronoun,&z); + if (z != 0) { + sprintf((char *)&local_19c," for magic level %d",z); + strcat(local_39c,(char *)&local_19c); + } + strcat(local_39c,". It\'s an \""); + strcat(local_39c,Pronoun); + strcat(local_39c,"\"-spell"); + uVar4 = Object::getAttribute(Obj,CHARGES); + sprintf(Pronoun," (%ldx)",uVar4); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,BED); + if ((bVar1) && (uVar4 = Object::getAttribute(Obj,TEXTSTRING), uVar4 != 0)) { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + pcVar9 = GetDynamicString(uVar4); + sprintf(Pronoun,". %s is sleeping there",pcVar9); + strcat(local_39c,Pronoun); + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,NAMEDOOR); + if (bVar1) { + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,(int *)&pl,&x,&y); + HouseID = GetHouseID((int)pl,x,y); + if (HouseID == 0) { + error(&DAT_080ffd20,pl,x,y); + } + else { + pcVar9 = GetHouseName(HouseID); + sprintf(Pronoun,". It belongs to house \'%s\'",pcVar9); + strcat(local_39c,Pronoun); + pcVar9 = GetHouseOwner(HouseID); + if ((pcVar9 == (char *)0x0) || (*pcVar9 == '\0')) { + builtin_strncpy(Pronoun,". No",4); + } + else { + sprintf(Pronoun,". %s owns this house",pcVar9); + } + strcat(local_39c,Pronoun); + } + } + strcat(local_39c,"."); + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LIQUIDCONTAINER); + if ((bVar1) && (uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE), uVar4 == 0)) { +LAB_08095675: + strcat(local_39c," It is empty."); + } + else { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,LIQUIDPOOL); + if ((bVar1) && (uVar4 = Object::getAttribute(Obj,POOLLIQUIDTYPE), uVar4 == 0)) + goto LAB_08095675; + } + if (CreatureID == 0) { +LAB_080951b8: + Object::getObjectType((Object *)(HelpProfession + 0xc)); + bVar1 = ObjectType::getFlag((ObjectType *)(HelpProfession + 0xc),TAKE); + if (bVar1) { + HelpProfession._12_4_ = Obj->ObjectID; + iVar5 = GetWeight((Object *)(HelpProfession + 0xc),-1); + if (0 < iVar5) { + local_19c = (Object)Obj->ObjectID; + iVar5 = GetCompleteWeight(&local_19c); + Object::getObjectType(&local_19c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_19c,CUMULATIVE); + if ((bVar1) && (uVar4 = Object::getAttribute(Obj,AMOUNT), 1 < uVar4)) { + Object::getObjectType(&local_19c); + pcVar9 = ObjectType::getName((ObjectType *)&local_19c); + bVar1 = IsCountable(pcVar9); + if (!bVar1) goto LAB_0809559b; + pcVar9 = "\nThey weigh %d.%02d oz."; + } + else { +LAB_0809559b: + pcVar9 = "\nIt weighs %d.%02d oz."; + } + sprintf(Pronoun,pcVar9,iVar5 / 100,iVar5 % 100); + strcat(local_39c,Pronoun); + } + } + HelpProfession._12_4_ = Obj->ObjectID; + pcVar9 = GetInfo((Object *)(HelpProfession + 0xc)); + if (pcVar9 != (char *)0x0) { + local_19c = (Object)Obj->ObjectID; + pcVar9 = GetInfo(&local_19c); + snprintf(Pronoun,500,"\n%s.",pcVar9); + strcat(local_39c,Pronoun); + } + } + else { + local_2c[0] = (Object)Obj->ObjectID; + bVar1 = ObjectInRange(CreatureID,local_2c,1); + if (bVar1) goto LAB_080951b8; + } + Object::getObjectType((Object *)(HelpProfession + 0xc)); + bVar1 = ObjectType::getFlag((ObjectType *)(HelpProfession + 0xc),TEXT); + if (bVar1) { + Object::getObjectType((Object *)(HelpProfession + 0xc)); + uVar4 = ObjectType::getAttribute((ObjectType *)(HelpProfession + 0xc),FONTSIZE); + if ((ushort)uVar4 == 0) { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + if (uVar4 == 0) goto LAB_080952a3; + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + pcVar9 = GetDynamicString(uVar4); + pcVar10 = "\n%s."; +LAB_0809540b: + snprintf(Pronoun,500,pcVar10,pcVar9); + } + else if ((ushort)uVar4 < 2) { +LAB_080952a3: + Pronoun = (char [4])((uint)Pronoun & 0xffffff00); + } + else { + uVar7 = Object::getAttribute(Obj,TEXTSTRING); + if (uVar7 == 0) { + builtin_strncpy(Pronoun,"\nNot",4); + } + else { + if (CreatureID != 0) { + HelpProfession._12_4_ = Obj->ObjectID; + bVar1 = ObjectInRange(CreatureID,(Object *)(HelpProfession + 0xc),uVar4 & 0xffff + ); + if (!bVar1) { + builtin_strncpy(Pronoun,"\nYou",4); + goto LAB_080952aa; + } + } + uVar4 = Object::getAttribute(Obj,EDITOR); + if (uVar4 == 0) { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + pcVar9 = GetDynamicString(uVar4); + pcVar10 = "\nYou read: %s"; + goto LAB_0809540b; + } + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + pcVar9 = GetDynamicString(uVar4); + uVar4 = Object::getAttribute(Obj,EDITOR); + pcVar10 = GetDynamicString(uVar4); + snprintf(Pronoun,500,"\n%s has written: %s",pcVar10,pcVar9); + } + } +LAB_080952aa: + strcat(local_39c,Pronoun); + } + pcVar9 = local_39c; + Connection = (pTVar3->super_TCreature).Connection; + pcVar10 = "%s"; +LAB_080949d4: + SendMessage(Connection,0x16,pcVar10,pcVar9); + return; +} + + + +void Talk(ulong CreatureID,int Mode,char *Addressee,char *Text,bool CheckSpamming) + +{ + bool bVar1; + ulong ID; + TPlayer *this; + size_t sVar2; + ulong uVar3; + TCreature *pTVar4; + TPlayer *pTVar5; + int iVar6; + TChannel *pTVar7; + ulong *puVar8; + TListener *pTVar9; + TStatement *pTVar10; + ulong uVar11; + TConnection *pTVar12; + undefined4 *puVar13; + int dx; + uint uVar14; + char *pcVar15; + TCreature *cr_1; + uint uVar16; + TPlayer *recv; + CreatureType CVar17; + uint uVar18; + TCreature *cr; + bool bVar19; + char *pcVar20; + char *pcVar21; + char *pcVar22; + ulong local_c4; + ulong StatementID; + ulong local_bc; + TConnection *Connection_2; + TPlayer *pl; + ulong local_98; + ulong StatementID_1; + int local_8c; + int Muting; + int SpellType; + int Channel; + char *Name; + int iStack_78; + bool CheckSpamming_local; + int destX; + int destY; + int destZ; + TPlayer *pl_1; + int x; + int y; + int z; + TFindCreatures Search; + Object local_2c [7]; + + local_8c = 0; + SpellType = 0; + Muting = 0; + // try { // try from 08096019 to 0809706d has its CatchHandler @ 08097073 + this = (TPlayer *)GetCreature(CreatureID); + if (this == (TPlayer *)0x0) { + error(&DAT_08100160,CreatureID); + } + else { + local_2c[0].ObjectID = (this->super_TCreature).CrObject.ObjectID; + GetObjectCoordinates(local_2c,(int *)&pl_1,&x,&y); + pcVar15 = (this->super_TCreature).Name; + if (Text == (char *)0x0) { + pcVar20 = "Talk: Text ist NULL (Sprecher: %s, Modus: %d).\n"; + } + else { + sVar2 = strlen(Text); + if (sVar2 < 0x100) { + if (((((Mode == 5) || (Mode == 10)) || (Mode == 0xc)) || (Mode == 0xe)) && + ((SpellType = __strtol_internal(Addressee,0,10,0), SpellType < 0 || + (Channels <= SpellType)))) { + error(&DAT_0810b8bc,SpellType); + return; + } + pcVar20 = "%s: \"%s\"\n"; + pcVar21 = pcVar15; + pcVar22 = Text; + print(); + if ((this->super_TCreature).Type == PLAYER) { + CVar17 = PLAYER; + if (CheckSpamming) { + local_8c = TPlayer::CheckForMuting(this); + if (0 < local_8c) { + if (Mode - 1U < 4) { +LAB_08096fa7: + pcVar15 = ""; + pTVar12 = (this->super_TCreature).Connection; + pcVar20 = "You are still muted for %d second%s."; + if (local_8c != 1) { + pcVar15 = "s"; + } + goto LAB_08096d7b; + } + if ((Mode == 5) || (Mode == 0xc)) { + bVar1 = false; + if ((0 < SpellType) && (bVar1 = true, 7 < SpellType)) { + bVar1 = false; + } + if (bVar1) goto LAB_08096fa7; + } + } + CVar17 = (this->super_TCreature).Type; + } + if (CVar17 == PLAYER) { + CVar17 = PLAYER; + if (local_8c == 0) { + pcVar20 = Text; + Muting = CheckForSpell(CreatureID,Text); + if (Muting == 1) { + return; + } + if (Muting == 5) { + return; + } + if (Muting < 0) { + return; + } + CVar17 = (this->super_TCreature).Type; + if (Muting != 0) { + Mode = 1; + } + } + if (CVar17 == PLAYER) { + CVar17 = PLAYER; + if ((char *)Mode == (char *)0x3) { + if (RoundNr < (this->super_TCreature).EarliestYellRound) { + puVar13 = (undefined4 *) + __cxa_allocate_exception(4,pcVar20,pcVar21,pcVar22); + *puVar13 = 0x31; + goto LAB_08096dae; + } + (this->super_TCreature).EarliestYellRound = RoundNr + 0x1e; + strUpper(Text); + CVar17 = (this->super_TCreature).Type; + } + if (CVar17 == PLAYER) { + if (((char *)Mode == (char *)0x5) && (SpellType == 5)) { + if (RoundNr < (this->super_TCreature).EarliestTradeChannelRound) + { + SendMessage((this->super_TCreature).Connection,0x17, + "You may only place one offer in two minutes."); + return; + } + (this->super_TCreature).EarliestTradeChannelRound = + RoundNr + 0x78; + } + if ((CheckSpamming) && (Muting == 0)) { + if ((char *)(Mode + -1) < (char *)0x4) { +LAB_08096e19: + bVar1 = CheckRight((this->super_TCreature).ID,NO_BANISHMENT) + ; + if (!bVar1) { + local_8c = TPlayer::RecordTalk(this); + } + if (0 < local_8c) { + pTVar12 = (this->super_TCreature).Connection; + pcVar20 = "You are muted for %d second%s."; + pcVar15 = ""; + if (local_8c != 1) { + pcVar15 = "s"; + } + goto LAB_08096d7b; + } + } + else if (((char *)Mode == (char *)0x5) || + ((char *)Mode == (char *)0xc)) { + bVar1 = false; + if ((0 < SpellType) && (SpellType < 8)) { + bVar1 = true; + } + if (bVar1) goto LAB_08096e19; + } + } + } + } + } + } + if (((((char *)Mode == (char *)0x4) || ((char *)Mode == (char *)0x7)) || + ((char *)Mode == (char *)0x8)) || + (((char *)Mode == (char *)0xb || ((char *)Mode == (char *)0xf)))) { + if (Addressee == (char *)0x0) { + pcVar15 = &DAT_08100000; + } + else { + bVar1 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + iVar6 = IdentifyPlayer(Addressee,false,!bVar1,(TPlayer **)&destZ); + if (iVar6 == -1) { + puVar13 = (undefined4 *)__cxa_allocate_exception(4); + *puVar13 = 0x1b; + goto LAB_08096dae; + } + if (iVar6 < 0) { + if (iVar6 == -2) { + puVar13 = (undefined4 *)__cxa_allocate_exception(4); + *puVar13 = 0x1c; + goto LAB_08096dae; + } + } + else if (iVar6 == 0) { + if (((char *)Mode == (char *)0x4) && + (local_8c = TPlayer::RecordMessage(this,*(ulong *)(destZ + 0x208)), + 0 < local_8c)) { + pcVar15 = ""; + if (local_8c != 1) { + pcVar15 = "s"; + } + pTVar12 = (this->super_TCreature).Connection; + pcVar20 = + "You have addressed too many players. You are muted for %d second%s." + ; +LAB_08096d7b: + SendMessage(pTVar12,0x17,pcVar20,local_8c,pcVar15); + return; + } + if ((char *)Mode == (char *)0xf) { + SendMessage(*(TConnection **)(destZ + 0x318),0x12,"%s",Text); + goto LAB_08096bd1; + } + uVar3 = (this->super_TCreature).ID; + if (Text == (char *)0x0) { + pcVar20 = "LogCommunication: Text ist NULL.\n"; +LAB_08096b2f: + error(pcVar20); + StatementID_1 = 0; + } + else { + if (uVar3 == 0) { + pcVar20 = "LogCommunication: CharacterID ist Null.\n"; + goto LAB_08096b2f; + } + ::StatementID = ::StatementID + 1; + pTVar10 = fifo::append(&Statements); + pTVar10->StatementID = ::StatementID; + uVar11 = time((time_t *)0x0); + pTVar10->TimeStamp = uVar11; + pTVar10->Channel = 0; + pTVar10->Mode = Mode; + pTVar10->CharacterID = uVar3; + uVar3 = AddDynamicString(Text); + pTVar10->Reported = false; + pTVar10->Text = uVar3; + StatementID_1 = ::StatementID; + } + if (((StatementID_1 != 0) && (this != (TPlayer *)0x0)) && + (bVar1 = CheckRight((this->super_TCreature).ID,LOG_COMMUNICATION), + bVar1)) { + pTVar9 = fifo::append(&Listeners); + pTVar9->StatementID = StatementID_1; + pTVar9->CharacterID = (this->super_TCreature).ID; + } + iVar6 = destZ; + uVar3 = 0; + if ((StatementID_1 != 0) && (uVar3 = 0, destZ != 0)) { + bVar1 = CheckRight(*(ulong *)(destZ + 0x208),LOG_COMMUNICATION); + if (bVar1) { + pTVar9 = fifo::append(&Listeners); + pTVar9->StatementID = StatementID_1; + pTVar9->CharacterID = *(ulong *)(iVar6 + 0x208); + uVar3 = StatementID_1; + } + else { + uVar3 = 0; + } + } + if ((char *)Mode == (char *)0x7) { + pTVar12 = *(TConnection **)(destZ + 0x318); + pcVar15 = "Gamemaster"; + pcVar20 = (char *)0x7; + } + else { + pTVar12 = *(TConnection **)(destZ + 0x318); + pcVar20 = (char *)Mode; + } + SendTalk(pTVar12,uVar3,pcVar15,(int)pcVar20,Text,0); +LAB_08096bd1: + if (this == (TPlayer *)0x0) { + return; + } + if ((this->super_TCreature).Type != PLAYER) { + return; + } + pcVar15 = "Gamemaster"; + if ((char *)Mode != (char *)0x8) { + pcVar15 = (char *)(destZ + 0x214); + } + SendMessage((this->super_TCreature).Connection,0x17, + "Message sent to %s.",pcVar15); + return; + } + pcVar15 = &DAT_080fffc0; + } + error(pcVar15); + goto LAB_08096d9c; + } + if ((((char *)(Mode + -1) < (char *)0x3) || ((char *)Mode == (char *)0x10)) || + ((char *)Mode == (char *)0x11)) { + if ((this->super_TCreature).Type == PLAYER) { + uVar3 = (this->super_TCreature).ID; + if (Text == (char *)0x0) { + pcVar20 = "LogCommunication: Text ist NULL.\n"; + } + else { + if (uVar3 != 0) { + ::StatementID = ::StatementID + 1; + pTVar10 = fifo::append(&Statements); + pTVar10->StatementID = ::StatementID; + uVar11 = time((time_t *)0x0); + pTVar10->TimeStamp = uVar11; + pTVar10->Channel = 0; + pTVar10->Mode = Mode; + pTVar10->CharacterID = uVar3; + uVar3 = AddDynamicString(Text); + pTVar10->Reported = false; + pTVar10->Text = uVar3; + local_98 = ::StatementID; + goto LAB_08096778; + } + pcVar20 = "LogCommunication: CharacterID ist Null.\n"; + } + error(pcVar20); + local_98 = 0; + } + else { + local_98 = 0; + } +LAB_08096778: + if (((char *)Mode == (char *)0x3) || (iVar6 = 7, (char *)Mode == (char *)0x11)) + { + iVar6 = 0x1e; + } + TFindCreatures::TFindCreatures((TFindCreatures *)&z,iVar6,iVar6,(int)pl_1,x,1); +switchD_08096875_caseD_0: + uVar3 = TFindCreatures::getNext((TFindCreatures *)&z); + if (uVar3 != 0) { + pTVar5 = GetPlayer(uVar3); + if ((pTVar5 != (TPlayer *)0x0) && + (pTVar12 = (pTVar5->super_TCreature).Connection, + pTVar12 != (TConnection *)0x0)) { + TConnection::GetPosition(pTVar12,&stack0xffffff88,&destX,&destY); + uVar14 = (int)pl_1 - iStack_78; + if (0x7fffffff < uVar14) { + uVar14 = -uVar14; + } + uVar18 = x - destX; + if (0x7fffffff < uVar18) { + uVar18 = -uVar18; + } + uVar16 = y - destY; + if (0x7fffffff < uVar16) { + uVar16 = -uVar16; + } + switch(Mode) { + default: + goto switchD_08096875_caseD_0; + case 1: + case 0x10: + if ((uVar16 != 0) || (7 < (int)uVar14)) + goto switchD_08096875_caseD_0; + bVar19 = SBORROW4(uVar18,5); + iVar6 = uVar18 - 5; + bVar1 = uVar18 == 5; + break; + case 2: + if (((uVar16 == 0) && ((int)uVar14 < 8)) && ((int)uVar18 < 6)) { + if (((int)uVar14 < 2) && ((int)uVar18 < 2)) goto LAB_080968e8; + uVar3 = 0; + pcVar20 = "pspsps"; + goto LAB_080968de; + } + goto switchD_08096875_caseD_0; + case 3: + case 0x11: + if ((0x1e < (int)uVar14) || (0x1e < (int)uVar18)) + goto switchD_08096875_caseD_0; + if (uVar16 == 0) goto LAB_080968e8; + if (7 < y) goto switchD_08096875_caseD_0; + bVar19 = SBORROW4(destY,7); + iVar6 = destY + -7; + bVar1 = iVar6 == 0; + } + if (bVar1 || bVar19 != iVar6 < 0) { +LAB_080968e8: + uVar3 = 0; + pcVar20 = Text; + if ((local_98 != 0) && (uVar3 = 0, pTVar5 != (TPlayer *)0x0)) { + bVar1 = CheckRight((pTVar5->super_TCreature).ID, + LOG_COMMUNICATION); + if (bVar1) { + pTVar9 = fifo::append(&Listeners); + pTVar9->StatementID = local_98; + pTVar9->CharacterID = (pTVar5->super_TCreature).ID; + uVar3 = local_98; + } + else { + uVar3 = 0; + } + } +LAB_080968de: + SendTalk(pTVar12,uVar3,pcVar15,Mode,(int)pl_1,x,y,pcVar20); + } + } + goto switchD_08096875_caseD_0; + } + goto LAB_080961c4; + } + if ((char *)Mode != (char *)0x9) { + if ((char *)Mode == (char *)0xd) { + pTVar12 = GetFirstConnection(); + while (pTVar12 != (TConnection *)0x0) { + if (pTVar12->State - CONNECTION_LOGIN < 4) { + SendMessage(pTVar12,0x12,Text); + } + pTVar12 = GetNextConnection(); + } + goto LAB_080961c4; + } + if ((((char *)Mode == (char *)0x5) || ((char *)Mode == (char *)0xa)) || + ((char *)Mode == (char *)0xc)) { + if ((char *)Mode == (char *)0xe) goto LAB_08096253; + uVar3 = (this->super_TCreature).ID; + if (Text == (char *)0x0) { + pcVar20 = "LogCommunication: Text ist NULL.\n"; +LAB_080964fe: + error(pcVar20); + local_c4 = 0; + } + else { + if (uVar3 == 0) { + pcVar20 = "LogCommunication: CharacterID ist Null.\n"; + goto LAB_080964fe; + } + ::StatementID = ::StatementID + 1; + pTVar10 = fifo::append(&Statements); + pTVar10->StatementID = ::StatementID; + uVar11 = time((time_t *)0x0); + pTVar10->TimeStamp = uVar11; + pTVar10->Mode = Mode; + pTVar10->CharacterID = uVar3; + pTVar10->Channel = SpellType; + uVar3 = AddDynamicString(Text); + pTVar10->Reported = false; + pTVar10->Text = uVar3; + local_c4 = ::StatementID; + } + } + else { + if ((char *)Mode != (char *)0xe) { + error(&DAT_080ffe40,Mode); + goto LAB_080961c4; + } +LAB_08096253: + local_c4 = 0; + } + if ((SpellType < 0) || (Channels <= SpellType)) { + error(&DAT_080ffea0,SpellType); + bVar1 = false; + } + else { + bVar1 = true; + if (7 < SpellType) { + pTVar7 = vector::operator()(&::Channel,SpellType); + bVar1 = pTVar7->Moderator != 0; + } + } + uVar3 = 0; + if (bVar1) { + CurrentSubscriberNumber = 0; + CurrentChannelID = SpellType; + bVar1 = ChannelActive(SpellType); + uVar3 = 0; + if (bVar1) { + pTVar7 = vector::operator()(&::Channel,CurrentChannelID); + iVar6 = CurrentSubscriberNumber; + if (CurrentSubscriberNumber < pTVar7->Subscribers) { + CurrentSubscriberNumber = CurrentSubscriberNumber + 1; + puVar8 = vector<>::operator()(&pTVar7->Subscriber,iVar6); + uVar3 = *puVar8; + } + else { + uVar3 = 0; + } + } + } + while (uVar3 != 0) { + pTVar5 = GetPlayer(uVar3); + if ((pTVar5 != (TPlayer *)0x0) && + ((SpellType != 0 || + (((this->super_TCreature).Type == PLAYER && + (iVar6 = strcmp(this->Guild,pTVar5->Guild), iVar6 == 0)))))) { + if ((local_c4 != 0) && + (bVar1 = CheckRight((pTVar5->super_TCreature).ID,LOG_COMMUNICATION), + bVar1)) { + pTVar9 = fifo::append(&Listeners); + pTVar9->StatementID = local_c4; + pTVar9->CharacterID = (pTVar5->super_TCreature).ID; + } + bVar1 = false; + if ((3 < SpellType) && (SpellType < 8)) { + bVar1 = true; + } + if ((bVar1) || (SpellType == 2)) { +LAB_08096325: + uVar3 = local_c4; + } + else { + bVar1 = CheckRight((pTVar5->super_TCreature).ID,LOG_COMMUNICATION); + uVar3 = 0; + if (bVar1) goto LAB_08096325; + } + pTVar12 = (pTVar5->super_TCreature).Connection; + SendTalk(pTVar12,uVar3,(char *)pTVar12,uVar3,(int)pcVar15,(char *)Mode); + } + if ((CurrentChannelID < 0) || (Channels <= CurrentChannelID)) { + error(&DAT_080ffea0,CurrentChannelID); + bVar1 = false; + } + else { + bVar1 = true; + if (7 < CurrentChannelID) { + pTVar7 = vector::operator()(&::Channel,CurrentChannelID); + bVar1 = pTVar7->Moderator != 0; + } + } + uVar3 = 0; + if (bVar1) { + pTVar7 = vector::operator()(&::Channel,CurrentChannelID); + iVar6 = CurrentSubscriberNumber; + if (CurrentSubscriberNumber < pTVar7->Subscribers) { + CurrentSubscriberNumber = CurrentSubscriberNumber + 1; + puVar8 = vector<>::operator()(&pTVar7->Subscriber,iVar6); + uVar3 = *puVar8; + } + else { + uVar3 = 0; + } + } + } + goto LAB_080961c4; + } + uVar3 = (this->super_TCreature).ID; + if (Text == (char *)0x0) { + pcVar20 = "LogCommunication: Text ist NULL.\n"; +LAB_080965e5: + error(pcVar20); + local_bc = 0; + } + else { + if (uVar3 == 0) { + pcVar20 = "LogCommunication: CharacterID ist Null.\n"; + goto LAB_080965e5; + } + ::StatementID = ::StatementID + 1; + pTVar10 = fifo::append(&Statements); + pTVar10->StatementID = ::StatementID; + uVar11 = time((time_t *)0x0); + pTVar10->TimeStamp = uVar11; + pTVar10->Channel = 0; + pTVar10->Mode = 9; + pTVar10->CharacterID = uVar3; + uVar3 = AddDynamicString(Text); + pTVar10->Reported = false; + pTVar10->Text = uVar3; + local_bc = ::StatementID; + } + pTVar12 = GetFirstConnection(); + while (pTVar12 != (TConnection *)0x0) { + if (pTVar12->State - CONNECTION_LOGIN < 4) { + pTVar5 = TConnection::GetPlayer(pTVar12); + uVar3 = 0; + if ((local_bc != 0) && (uVar3 = 0, pTVar5 != (TPlayer *)0x0)) { + bVar1 = CheckRight((pTVar5->super_TCreature).ID,LOG_COMMUNICATION); + uVar3 = 0; + if (bVar1) { + pTVar9 = fifo::append(&Listeners); + pTVar9->StatementID = local_bc; + pTVar9->CharacterID = (pTVar5->super_TCreature).ID; + uVar3 = local_bc; + } + } + SendTalk(pTVar12,uVar3,pcVar15,9,Text,0); + } + pTVar12 = GetNextConnection(); + } +LAB_080961c4: + if (((char *)Mode == (char *)0x1) && ((this->super_TCreature).Type == PLAYER)) { + TFindCreatures::TFindCreatures((TFindCreatures *)&z,3,3,CreatureID,2); + while (uVar3 = TFindCreatures::getNext((TFindCreatures *)&z), uVar3 != 0) { + pTVar4 = GetCreature(uVar3); + if (pTVar4 == (TCreature *)0x0) { + error("Talk: Kreatur existiert nicht.\n"); + } + else if (pTVar4->posz == y) { + (*pTVar4->_vptr_TCreature[6])(pTVar4,CreatureID,Text); + } + } + } + return; + } + pcVar20 = &DAT_081000e0; + Mode = sVar2; + } + error(pcVar20,pcVar15,Mode); + } +LAB_08096d9c: + puVar13 = (undefined4 *)__cxa_allocate_exception(4); + *puVar13 = 0xffffffff; +LAB_08096dae: + // WARNING: Subroutine does not return + __cxa_throw(puVar13,&RESULT::typeinfo,0); +} + + + +void Use(ulong CreatureID,Object *Obj1,Object *Obj2,uchar Info) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + undefined4 *puVar4; + TCreature *pTVar5; + char *Text; + Object *this; + TCreature *cr; + int iStack_68; + uchar Info_local; + int x; + int y; + int z; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 080970b2 to 080978b7 has its CatchHandler @ 080978d3 + bVar1 = Object::exists(Obj1); + if (bVar1) { + bVar1 = false; + local_2c[0].ObjectID = NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if ((Obj2->ObjectID != NONE.ObjectID) && (bVar2 = Object::exists(Obj2), !bVar2)) { + bVar1 = true; + } + if (!bVar1) { + local_3c[0] = (Object)Obj1->ObjectID; + CheckTopUseObject(CreatureID,local_3c); + local_3c[0] = (Object)Obj1->ObjectID; + bVar1 = ObjectAccessible(CreatureID,local_3c,1); + if (bVar1) { + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + uVar3 = Obj2->ObjectID; + if (uVar3 != NONE.ObjectID) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,DISTUSE); + bVar1 = !bVar1; + uVar3 = Obj2->ObjectID; + } + if (bVar1) { + local_2c[0].ObjectID = uVar3; + CheckTopMultiuseObject(CreatureID,local_2c); + uVar3 = Obj2->ObjectID; + } + bVar1 = false; + local_3c[0].ObjectID = NONE.ObjectID; + local_2c[0].ObjectID = NONE.ObjectID; + if ((uVar3 != NONE.ObjectID) && + (local_2c[0].ObjectID = uVar3, bVar2 = ObjectAccessible(CreatureID,local_2c,1), + !bVar2)) { + bVar1 = true; + } + if (bVar1) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,DISTUSE); + if (!bVar1) goto LAB_0809780e; + pTVar5 = GetCreature(CreatureID); + if (pTVar5 == (TCreature *)0x0) { + Text = "Use: Verursachende Kreatur existiert nicht.\n"; + goto LAB_080977f2; + } + local_4c[0] = (Object)Obj2->ObjectID; + GetObjectCoordinates(local_4c,&stack0xffffff98,&x,&y); + if (y < pTVar5->posz) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x17; + goto LAB_0809762d; + } + if (pTVar5->posz < y) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x18; + goto LAB_0809762d; + } + bVar1 = ThrowPossible(pTVar5->posx,pTVar5->posy,pTVar5->posz,iStack_68,x,y,0); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 7; + goto LAB_0809762d; + } + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CONTAINER); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseContainer(CreatureID,local_4c,Info); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CHEST); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseChest(CreatureID,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,LIQUIDCONTAINER); + if (bVar1) { + local_4c[0] = (Object)Obj2->ObjectID; + local_3c[0] = (Object)Obj1->ObjectID; + UseLiquidContainer(CreatureID,local_3c,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,FOOD); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseFood(CreatureID,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,WRITE); + if (!bVar1) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,WRITEONCE); + if (!bVar1) { + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,INFORMATION); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseAnnouncer(CreatureID,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,RUNE); + if (bVar1) { + local_4c[0] = (Object)Obj2->ObjectID; + local_3c[0] = (Object)Obj1->ObjectID; + UseMagicItem(CreatureID,local_3c,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,KEY); + if (bVar1) { + local_4c[0] = (Object)Obj2->ObjectID; + local_3c[0] = (Object)Obj1->ObjectID; + UseKeyDoor(CreatureID,local_3c,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,NAMEDOOR); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseNameDoor(CreatureID,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,LEVELDOOR); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseLevelDoor(CreatureID,local_4c); + return; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,QUESTDOOR); + if (bVar1) { + local_4c[0] = (Object)Obj1->ObjectID; + UseQuestDoor(CreatureID,local_4c); + return; + } + bVar1 = false; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,WEAPON); + if (bVar2) { + Object::getObjectType(local_4c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_4c,WEAPONTYPE); + bVar2 = false; + if ((0 < (int)uVar3) && ((int)uVar3 < 4)) { + bVar2 = true; + } + if (bVar2) { + local_4c[0] = (Object)NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (Obj2->ObjectID != NONE.ObjectID) { + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,DESTROY); + if (bVar2) { + bVar1 = true; + } + } + } + } + if (bVar1) { + local_3c[0] = (Object)Obj2->ObjectID; + local_2c[0] = (Object)Obj1->ObjectID; + UseWeapon(CreatureID,local_2c,local_3c); + return; + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CHANGEUSE); + if (bVar1) { + local_3c[0] = (Object)Obj1->ObjectID; + UseChangeObject(CreatureID,local_3c); + return; + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,USEEVENT); + if ((bVar1) && + (local_3c[0].ObjectID = NONE.ObjectID, Obj2->ObjectID == NONE.ObjectID)) + { + local_2c[0] = (Object)Obj1->ObjectID; + UseObject(CreatureID,local_2c); + return; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,USEEVENT); + if (bVar1) { + local_2c[0] = (Object)Obj2->ObjectID; + z = Obj1->ObjectID; + UseObjects(CreatureID,(Object *)&z,local_2c); + return; + } + this = (Object *)&z; + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,TEXT); + if (bVar1) { + Object::getObjectType(this); + uVar3 = ObjectType::getAttribute((ObjectType *)this,FONTSIZE); + if (uVar3 == 1) { + z = Obj1->ObjectID; + goto LAB_080972e9; + } + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1d; + goto LAB_0809762d; + } + } + local_4c[0] = (Object)Obj1->ObjectID; + this = local_4c; +LAB_080972e9: + UseTextObject(CreatureID,this); + return; + } +LAB_0809780e: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + goto LAB_0809762d; + } + Text = &DAT_081001e0; + } + else { + Text = &DAT_08100220; + } +LAB_080977f2: + error(Text); + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_0809762d: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +void Turn(ulong CreatureID,Object *Obj) + +{ + bool bVar1; + ulong _TypeID; + undefined4 *puVar2; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + ObjectType NewType; + + // try { // try from 08097905 to 08097a4e has its CatchHandler @ 08097a63 + bVar1 = Object::exists(Obj); + if (bVar1) { + local_2c = (Object)Obj->ObjectID; + bVar1 = ObjectAccessible(CreatureID,&local_2c,1); + if (bVar1) { + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,ROTATE); + if (bVar1) { + Object::getObjectType(local_3c); + _TypeID = ObjectType::getAttribute((ObjectType *)local_3c,ROTATETARGET); + ObjectType::setTypeID((ObjectType *)&local_2c,_TypeID); + ObjectType::setTypeID((ObjectType *)local_3c,0); + if (local_2c.ObjectID == local_3c[0].ObjectID) { + Object::getObjectType(local_4c); + error(&DAT_08100260,local_4c[0].ObjectID); + } + ObjectType::setTypeID((ObjectType *)local_4c,local_2c.ObjectID); + local_3c[0] = (Object)Obj->ObjectID; + Change(local_3c,(ObjectType *)local_4c,0); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x39; + } + else { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 1; + } + } + else { + error(&DAT_081002a0); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CreatePool(void) + +{ + bool bVar1; + undefined4 *puVar2; + Object *in_stack_00000004; + int *in_stack_00000008; + char *Text; + Object local_5c [4]; + ObjectType local_4c; + Object Help; + ObjectType local_3c [4]; + Object local_2c; + Object Obj; + + // try { // try from 08097a95 to 08097bba has its CatchHandler @ 08097c76 + bVar1 = Object::exists(in_stack_00000004); + if (bVar1) { + Object::getObjectType(&local_2c); + if (local_2c.ObjectID == 0) { + local_3c[0].TypeID = in_stack_00000004->ObjectID; + GetFirstContainerObject(&local_2c); + if (local_2c.ObjectID != NONE.ObjectID) { + do { + local_4c.TypeID = local_2c.ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + Object::getNextObject(local_5c); + local_2c.ObjectID = local_5c[0].ObjectID; + local_3c[0].TypeID = local_5c[0].ObjectID; + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,BOTTOM); + if (bVar1) { + Object::getObjectType(local_5c); + bVar1 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDPOOL); + if (!bVar1) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 4; + goto LAB_08097bef; + } + local_5c[0].ObjectID = local_4c.TypeID; + // try { // try from 08097bd3 to 08097bd7 has its CatchHandler @ 08097c30 + Delete(local_5c,-1); + } + } while (local_2c.ObjectID != NONE.ObjectID); + } + local_4c.TypeID = NONE.ObjectID; + local_3c[0].TypeID = NONE.ObjectID; + ObjectType::setTypeID(&local_4c,*in_stack_00000008); + local_3c[0].TypeID = in_stack_00000004->ObjectID; + Create(local_5c,local_3c,(ulong)&local_4c); + return; + } + Text = &DAT_081002e0; + } + else { + Text = &DAT_08100320; + } + error(Text); + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; +LAB_08097bef: + // WARNING: Subroutine does not return + // try { // try from 08097c02 to 08097c12 has its CatchHandler @ 08097c76 + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void EditText(ulong CreatureID,Object *Obj,char *Text) + +{ + bool bVar1; + TCreature *pTVar2; + size_t sVar3; + ulong uVar4; + char *pcVar5; + int iVar6; + undefined4 *puVar7; + TCreature *cr; + + // try { // try from 08097ca8 to 08097f12 has its CatchHandler @ 08097f30 + bVar1 = Object::exists(Obj); + if (bVar1) { + Object::getObjectType((Object *)&cr); + bVar1 = ObjectType::getFlag((ObjectType *)&cr,WRITE); + if (bVar1) { +LAB_08097cdf: + pTVar2 = GetCreature(CreatureID); + if (pTVar2 != (TCreature *)0x0) { + sVar3 = strlen(Text); + Object::getObjectType((Object *)&cr); + bVar1 = ObjectType::getFlag((ObjectType *)&cr,WRITE); + Object::getObjectType((Object *)&cr); + uVar4 = ObjectType::getAttribute((ObjectType *)&cr,!bVar1 + MAXLENGTH); + if (uVar4 <= sVar3) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x28; + goto LAB_08097e92; + } + if (CreatureID != 0) { + cr = (TCreature *)Obj->ObjectID; + bVar1 = ObjectAccessible(CreatureID,(Object *)&cr,1); + if (!bVar1) { + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 1; + goto LAB_08097e92; + } + } + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + if ((uVar4 == 0) && (*Text != '\0')) { +LAB_08097dbf: + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + DeleteDynamicString(uVar4); + cr = (TCreature *)Obj->ObjectID; + uVar4 = AddDynamicString(Text); + Change((Object *)&cr,TEXTSTRING,uVar4); + uVar4 = Object::getAttribute(Obj,EDITOR); + DeleteDynamicString(uVar4); + cr = (TCreature *)Obj->ObjectID; + uVar4 = AddDynamicString(pTVar2->Name); + Change((Object *)&cr,EDITOR,uVar4); + } + else { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + if (uVar4 != 0) { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + pcVar5 = GetDynamicString(uVar4); + iVar6 = strcmp(Text,pcVar5); + if (iVar6 != 0) goto LAB_08097dbf; + } + print(); + } + return; + } + pcVar5 = "EditText: Kreatur existiert nicht.\n"; + } + else { + Object::getObjectType((Object *)&cr); + bVar1 = ObjectType::getFlag((ObjectType *)&cr,WRITEONCE); + if (bVar1) { + uVar4 = Object::getAttribute(Obj,TEXTSTRING); + if (uVar4 == 0) goto LAB_08097cdf; + } + pcVar5 = "EditText: Objekt ist nicht beschreibbar.\n"; + } + } + else { + pcVar5 = &DAT_08100440; + } + error(pcVar5); + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; +LAB_08097e92: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +Object CreateAtCreature(ulong CreatureID,ObjectType *Type,ulong Value) + +{ + bool bVar1; + bool bVar2; + bool bVar3; + TCreature *pTVar4; + undefined4 *puVar5; + int pos; + int iVar6; + ulong in_stack_00000010; + Object *Type_00; + Object *this; + bool local_61; + bool invert; + bool first; + TCreature *cr; + Object local_4c; + Object Obj; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 08097f5f to 08097f63 has its CatchHandler @ 08098240 + pTVar4 = GetCreature((ulong)Type); + if (pTVar4 == (TCreature *)0x0) { + // try { // try from 08098159 to 08098187 has its CatchHandler @ 08098240 + error("GiveObjectToCreature: Kann Kreatur nicht finden.\n"); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + } + // try { // try from 08097f7e to 08097fa3 has its CatchHandler @ 08098188 + ObjectType::setTypeID((ObjectType *)local_2c,*(int *)Value); + CheckWeight((ulong)Type,(ObjectType *)local_2c,in_stack_00000010,0); + local_61 = true; + iVar6 = 0; + // try { // try from 08097fb8 to 08097fbc has its CatchHandler @ 08098240 + bVar2 = ObjectType::getFlag((ObjectType *)Value,MOVEMENTEVENT); + while( true ) { + iVar6 = iVar6 + 1; + // try { // try from 08097fd2 to 08097fd6 has its CatchHandler @ 08098210 + GetBodyObject((ulong)&local_4c,(int)Type); + if ((local_61 != bVar2) && + (local_3c[0].ObjectID = NONE.ObjectID, local_4c.ObjectID == NONE.ObjectID)) { + ObjectType::setTypeID((ObjectType *)local_2c,*(int *)Value); + Type_00 = (Object *)&cr; + GetBodyContainer((ulong)Type_00,(int)Type); + this = local_2c; + goto LAB_080980b2; + } + bVar1 = false; + if (local_61 == bVar2) { + cr = (TCreature *)NONE.ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + if (local_4c.ObjectID != NONE.ObjectID) { + Object::getObjectType(local_3c); + bVar3 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar3) { + bVar1 = true; + } + } + } + if (bVar1) break; + if (9 < iVar6) { + if (local_61 == false) { + // try { // try from 08098029 to 0809806b has its CatchHandler @ 08098240 + ObjectType::setTypeID((ObjectType *)&cr,*(int *)Value); + local_3c[0].ObjectID = (pTVar4->CrObject).ObjectID; + GetMapContainer(&local_4c); + Create((Object *)CreatureID,(ObjectType *)&local_4c,(ulong)&cr); + return (Object)CreatureID; + } + local_61 = false; + iVar6 = 0; + } + } + this = local_3c; + // try { // try from 0809808f to 08098131 has its CatchHandler @ 08098210 + ObjectType::setTypeID((ObjectType *)this,*(int *)Value); + Type_00 = local_2c; + local_2c[0].ObjectID = local_4c.ObjectID; +LAB_080980b2: + Create((Object *)CreatureID,(ObjectType *)Type_00,(ulong)this); + return (Object)CreatureID; +} + + + +void DeleteAtCreature(ulong CreatureID,ObjectType *Type,int Amount,ulong Data) + +{ + bool bVar1; + ulong uVar2; + undefined4 *puVar3; + Object *pOVar4; + ulong uVar5; + Object local_3c [4]; + Object local_2c; + Object Obj; + + if (0 < Amount) { + do { + // try { // try from 0809827c to 080983d5 has its CatchHandler @ 080983d6 + ObjectType::setTypeID((ObjectType *)local_3c,Type->TypeID); + uVar2 = CreatureID; + pOVar4 = local_3c; + uVar5 = Data; + GetInventoryObject((ulong)&local_2c,(ObjectType *)CreatureID,(ulong)local_3c); + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c.ObjectID == NONE.ObjectID) { + error("DeleteAtCreature: Kein Objekt gefunden.\n",uVar2,pOVar4,uVar5); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if ((bVar1) && (uVar2 = Object::getAttribute(&local_2c,AMOUNT), (int)uVar2 <= Amount)) { + uVar2 = Object::getAttribute(&local_2c,AMOUNT); + Amount = Amount - uVar2; + local_3c[0].ObjectID = local_2c.ObjectID; + Delete(local_3c,-1); + } + else { + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar1) { + local_3c[0].ObjectID = local_2c.ObjectID; + uVar2 = Object::getAttribute(&local_2c,AMOUNT); + Change(local_3c,AMOUNT,uVar2 - Amount); + Amount = 0; + } + else { + local_3c[0].ObjectID = local_2c.ObjectID; + Delete(local_3c,-1); + Amount = Amount + -1; + } + } + } while (0 < Amount); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessCronSystem(void) + +{ + bool bVar1; + RESULT r_1; + ulong uVar2; + RESULT r; + Object local_5c [4]; + Object local_4c [4]; + ObjectType local_3c; + ObjectType Dest; + ulong local_2c; + Object Obj; + + while( true ) { + CronCheck(); + local_3c.TypeID = NONE.ObjectID; + if (local_2c == NONE.ObjectID) break; + // try { // try from 08098422 to 080984f7 has its CatchHandler @ 08098508 + Object::getObjectType(local_4c); + uVar2 = ObjectType::getAttribute((ObjectType *)local_4c,EXPIRETARGET); + ObjectType::setTypeID(&local_3c,uVar2); + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CONTAINER); + if (bVar1) { + ObjectType::setTypeID((ObjectType *)local_4c,0); + if ((local_3c.TypeID == local_4c[0].ObjectID) || + (bVar1 = ObjectType::getFlag(&local_3c,CONTAINER), !bVar1)) { + uVar2 = 0; + } + else { + uVar2 = ObjectType::getAttribute(&local_3c,CAPACITY); + } + Empty(local_5c,uVar2); + } + ObjectType::setTypeID((ObjectType *)local_5c,local_3c.TypeID); + local_4c[0].ObjectID = local_2c; + Change(local_4c,(ObjectType *)local_5c,0); + } + return; +} + + + +bool SectorRefreshable(int SectorX,int SectorY,int SectorZ) + +{ + int iVar1; + ulong id; + TCreature *pTVar2; + undefined1 local_3c [4]; + TFindCreatures SearchPlayers; + + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_3c,0x1f,0x1f,SectorX * 0x20 + 0x10,SectorY * 0x20 + 0x10,1); +LAB_08098600: + do { + while( true ) { + id = TFindCreatures::getNext((TFindCreatures *)local_3c); + if (id == 0) { + return true; + } + pTVar2 = GetCreature(id); + if (pTVar2 != (TCreature *)0x0) break; + error("SectorRefreshable: Kreatur existiert nicht.\n"); + } + iVar1 = pTVar2->posz; + if (iVar1 < 8) { + if (SectorZ < 8) { + return false; + } + if (iVar1 < 8) goto LAB_08098600; + } + if ((SectorZ - iVar1) + 2U < 5) { + return false; + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RefreshSector(void) + +{ + bool bVar1; + bool bVar2; + ulong id; + TCreature *pTVar3; + TCreature *cr; + int in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + uchar *in_stack_00000010; + int in_stack_00000014; + Object *Obj_00; + Object *Con; + int x_00; + int iVar4; + int y_00; + Object *Ignore; + Object *pOStack_a8; + bool PositionOk; + int x; + int y; + int z; + Object local_8c [4]; + Object local_7c [4]; + Object local_6c; + Object Obj; + undefined1 local_5c [4]; + TFindCreatures SearchMonsters; + undefined1 local_2c [4]; + TReadBuffer Buffer; + + bVar1 = SectorRefreshable(in_stack_00000004,in_stack_00000008,in_stack_0000000c); + if (bVar1) { + TReadBuffer::TReadBuffer((TReadBuffer *)local_2c,in_stack_00000010,in_stack_00000014); + RefreshSector(in_stack_00000004,in_stack_00000008,in_stack_0000000c,(TReadStream *)local_2c) + ; + x_00 = in_stack_00000004 * 0x20 + 0x10; + y_00 = in_stack_00000008 * 0x20 + 0x10; + Con = (Object *)0x10; + Obj_00 = (Object *)0x10; + TFindCreatures::TFindCreatures((TFindCreatures *)local_5c,0x10,0x10,x_00,y_00,7); +LAB_08098700: + id = TFindCreatures::getNext((TFindCreatures *)local_5c); + if (id != 0) { + pTVar3 = GetCreature(id); + if (pTVar3 == (TCreature *)0x0) { + error("RefreshSector: Kreatur existiert nicht.\n",Obj_00,Con,x_00,y_00); + } + else { + iVar4 = pTVar3->posz; + if (iVar4 == in_stack_0000000c) { + bVar1 = true; + Obj_00 = (Object *)pTVar3->posx; + Con = (Object *)pTVar3->posy; + pOStack_a8 = Obj_00; + x = (int)Con; + y = iVar4; + GetFirstObject(); + x_00 = iVar4; + if (local_6c.ObjectID != NONE.ObjectID) { + do { + local_8c[0].ObjectID = NONE.ObjectID; + local_7c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_8c); + x_00 = iVar4; + if (local_8c[0].ObjectID != 99) { + Object::getObjectType(local_8c); + bVar2 = ObjectType::getFlag((ObjectType *)local_8c,UNPASS); + x_00 = iVar4; + if (bVar2) { + bVar1 = false; + } + } + Obj_00 = &local_6c; + Object::getNextObject(local_7c); + local_6c.ObjectID = local_7c[0].ObjectID; + iVar4 = x_00; + } while (local_7c[0].ObjectID != NONE.ObjectID); + } + local_8c[0].ObjectID = NONE.ObjectID; + local_7c[0].ObjectID = NONE.ObjectID; + if (!bVar1) { + y_00 = 0; + // try { // try from 0809881e to 08098994 has its CatchHandler @ 08098a14 + bVar1 = SearchFreeField((int *)&stack0xffffff58,&x,&y,1,0,false); + if (bVar1) { + local_8c[0].ObjectID = NONE.ObjectID; + GetMapContainer((int)local_7c,(int)pOStack_a8,x); + z = (pTVar3->CrObject).ObjectID; + Ignore = local_8c; + Obj_00 = (Object *)&z; + Con = local_7c; + } + else { + if (pTVar3->Type != NPC) { + if (pTVar3->Type == MONSTER) { + Obj_00 = (Object *)&DAT_08100600; + Con = pOStack_a8; + x_00 = x; + y_00 = y; + print(); + if (pTVar3 != (TCreature *)0x0) { + (*pTVar3->_vptr_TCreature[1])(pTVar3); + } + } + else { + Obj_00 = pOStack_a8; + Con = (Object *)x; + x_00 = y; + error("Spieler auf [%d,%d,%d] ist von Refresh betroffen.\n", + pOStack_a8,x,y); + } + goto LAB_08098700; + } + print(); + Ignore = (Object *)&z; + z = NONE.ObjectID; + GetMapContainer((int)local_8c,pTVar3->startx,pTVar3->starty); + local_7c[0].ObjectID = (pTVar3->CrObject).ObjectID; + Obj_00 = local_7c; + Con = local_8c; + } + y_00 = 0; + x_00 = -1; + Move(0,Obj_00,Con,-1,false,Ignore); + } + } + } + goto LAB_08098700; + } + } + return; +} + + + +// WARNING: Removing unreachable block (ram,0x08098d29) +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RefreshMap(void) + +{ + byte b; + bool bVar1; + char cVar2; + int DataSize; + int iVar3; + byte *pbVar4; + int iVar5; + int iVar6; + int y; + TWriteStream *SectorY; + char *pcVar7; + undefined1 uVar8; + TWriteStream *__in_chrg; + char *Stream; + char *pcVar9; + int local_5040; + int z; + byte local_5029; + bool Refreshable; + int yy; + int xx; + int x; + TReadBuffer ReadBuffer; + TReadScriptFile Script; + TWriteStream local_102c; + char FileName [4096]; + TDynamicWriteBuffer HelpBuffer; + + __in_chrg = (TWriteStream *)0x10000; + TDynamicWriteBuffer::TDynamicWriteBuffer((TDynamicWriteBuffer *)(FileName + 0xffc),0x10000); + xx = SectorXMin; + iVar5 = SectorXMax; + iVar6 = SectorYMax; + if (SectorXMin <= SectorXMax) { + do { + iVar3 = SectorZMax; + SectorY = (TWriteStream *)SectorYMin; + if (SectorYMin <= iVar6) { + do { + local_5040 = SectorZMin; + if (SectorZMin <= iVar3) { + do { + __in_chrg = SectorY; + // try { // try from 08098afd to 08098b58 has its CatchHandler @ 08098dd0 + bVar1 = SectorRefreshable(xx,(int)SectorY,local_5040); + if (bVar1) { + Stream = (char *)&local_102c; + pcVar9 = ORIGMAPPATH; + __in_chrg = (TWriteStream *)&DAT_080f2af5; + sprintf(Stream,"%s/%04u-%04u-%02u.sec",ORIGMAPPATH,xx,SectorY, + local_5040); + bVar1 = FileExists(Stream); + if (bVar1) { + // try { // try from 08098b66 to 08098b6a has its CatchHandler @ 08098db6 + TReadScriptFile::TReadScriptFile + ((TReadScriptFile *)&ReadBuffer.Position); + // try { // try from 08098b78 to 08098d61 has its CatchHandler @ 08098d75 + TReadScriptFile::open + ((TReadScriptFile *)&ReadBuffer.Position,Stream, + (int)pcVar9); + local_5029 = 0; + yy = -1; + b = 0xff; + while (TReadScriptFile::nextToken + ((TReadScriptFile *)&ReadBuffer.Position), + ReadBuffer.Position != 0) { + if ((ReadBuffer.Position != 6) || + (cVar2 = TReadScriptFile::getSpecial + ((TReadScriptFile *) + &ReadBuffer.Position), cVar2 != ',')) + { + if (ReadBuffer.Position == 4) { + pbVar4 = TReadScriptFile::getBytesequence + ((TReadScriptFile *) + &ReadBuffer.Position); + yy = (int)*pbVar4; + b = pbVar4[1]; + Stream = (char *)0x3a; + TReadScriptFile::readSymbol + ((TReadScriptFile *)&ReadBuffer.Position, + ':'); + local_5029 = 0; + } + else if (ReadBuffer.Position == 1) { + uVar8 = yy == -1; + if ((bool)uVar8) { + Stream = "coordinate expected"; + TReadScriptFile::error + ((TReadScriptFile *) + &ReadBuffer.Position, + "coordinate expected"); + } + pcVar9 = TReadScriptFile::getIdentifier + ((TReadScriptFile *) + &ReadBuffer.Position); + iVar5 = 8; + pcVar7 = "refresh"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar8 = *pcVar9 == *pcVar7; + pcVar9 = pcVar9 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + local_5029 = 1; + } + pcVar9 = TReadScriptFile::getIdentifier + ((TReadScriptFile *) + &ReadBuffer.Position); + iVar5 = 8; + pcVar7 = "content"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar8 = *pcVar9 == *pcVar7; + pcVar9 = pcVar9 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar8); + if ((bool)uVar8) { + TReadScriptFile::readSymbol + ((TReadScriptFile *) + &ReadBuffer.Position,'='); + if (local_5029 != 0) { + TDynamicWriteBuffer::writeByte + ((TDynamicWriteBuffer *) + (FileName + 0xffc),(uchar)yy); + TDynamicWriteBuffer::writeByte + ((TDynamicWriteBuffer *) + (FileName + 0xffc),b); + } + Stream = FileName + 0xffc; + LoadObjects((TReadScriptFile *) + &ReadBuffer.Position, + (TWriteStream *)Stream, + (bool)(local_5029 ^ 1)); + } + } + } + } + TReadScriptFile::close + ((TReadScriptFile *)&ReadBuffer.Position,(int)Stream); + // try { // try from 08098d6b to 08098d6f has its CatchHandler @ 08098db6 + TReadScriptFile::~TReadScriptFile + ((TReadScriptFile *)&ReadBuffer.Position,(int)Stream); + __in_chrg = (TWriteStream *)Stream; + } + } + local_5040 = local_5040 + 1; + iVar3 = SectorZMax; + iVar6 = SectorYMax; + } while (local_5040 <= SectorZMax); + } + SectorY = (TWriteStream *)((int)&SectorY->_vptr_TWriteStream + 1); + iVar5 = SectorXMax; + } while ((int)SectorY <= iVar6); + } + xx = xx + 1; + } while (xx <= iVar5); + } + TDynamicWriteBuffer::~TDynamicWriteBuffer + ((TDynamicWriteBuffer *)(FileName + 0xffc),(int)__in_chrg); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void RefreshCylinders(void) + +{ + bool bVar1; + int iVar2; + int iVar3; + int z; + int iVar4; + int i; + int iVar5; + + if (0 < RefreshedCylinders) { + iVar5 = 0; + iVar2 = RefreshedCylinders; + iVar3 = SectorZMax; + do { + if (RefreshCylinders::RefreshX < SectorXMax) { + RefreshCylinders::RefreshX = RefreshCylinders::RefreshX + 1; + iVar4 = RefreshCylinders::RefreshY; + } + else { + RefreshCylinders::RefreshX = SectorXMin; + iVar4 = SectorYMin; + if (RefreshCylinders::RefreshY < SectorYMax) { + iVar4 = RefreshCylinders::RefreshY + 1; + } + } + RefreshCylinders::RefreshY = iVar4; + iVar4 = SectorZMin; + if (SectorZMin <= iVar3) { + do { + bVar1 = SectorRefreshable(RefreshCylinders::RefreshX,RefreshCylinders::RefreshY, + iVar4); + if (bVar1) { + LoadSectorOrder(RefreshCylinders::RefreshX,RefreshCylinders::RefreshY,iVar4) + ; + } + iVar4 = iVar4 + 1; + iVar2 = RefreshedCylinders; + iVar3 = SectorZMax; + } while (iVar4 <= SectorZMax); + } + iVar5 = iVar5 + 1; + } while (iVar5 < iVar2); + } + return; +} + + + +void ApplyPatch(int SectorX,int SectorY,int SectorZ,bool FullSector,TReadScriptFile *Script, + bool SaveHouses) + +{ + bool bVar1; + bool bVar2; + ulong id; + TCreature *this; + Object *Con; + Object *Con_00; + int x_00; + Object *Ignore; + bool PositionOk; + bool SaveHouses_local; + Object *pOStack_98; + bool FullSector_local; + int x; + int y; + int z; + Object local_7c [4]; + Object local_6c [4]; + ulong local_5c; + Object Obj; + undefined1 local_4c [4]; + TFindCreatures SearchMonsters; + + bVar1 = false; + if ((SectorXMin <= SectorX) && (SectorX <= SectorXMax)) { + bVar1 = true; + } + if (bVar1) { + bVar1 = false; + if ((SectorYMin <= SectorY) && (SectorY <= SectorYMax)) { + bVar1 = true; + } + if (bVar1) { + bVar1 = false; + if ((SectorZMin <= SectorZ) && (SectorZ <= SectorZMax)) { + bVar1 = true; + } + if (bVar1) { + // try { // try from 08098f53 to 08099069 has its CatchHandler @ 08099366 + PrepareHouseCleanup(); + PatchSector(SectorX,SectorY,SectorZ,FullSector,Script,SaveHouses); + FinishHouseCleanup(); + Con_00 = (Object *)0x10; + x_00 = SectorX * 0x20 + 0x10; + Con = (Object *)0x10; + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_4c,0x10,0x10,x_00,SectorY * 0x20 + 0x10,7); +LAB_08098fc1: + id = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (id != 0) { + this = GetCreature(id); + if (this == (TCreature *)0x0) { + error("ApplyPatch: Kreatur existiert nicht.\n",Con,Con_00,x_00); + } + else if (this->posz == SectorZ) { + bVar1 = true; + pOStack_98 = (Object *)this->posx; + x = this->posy; + y = this->posz; + GetFirstObject(); + if (local_5c != NONE.ObjectID) { + do { + local_7c[0].ObjectID = NONE.ObjectID; + local_6c[0].ObjectID = NONE.ObjectID; + Object::getObjectType(local_7c); + if (local_7c[0].ObjectID != 99) { + Object::getObjectType(local_7c); + bVar2 = ObjectType::getFlag((ObjectType *)local_7c,UNPASS); + if (bVar2) { + bVar1 = false; + } + } + Object::getNextObject(local_6c); + local_5c = local_6c[0].ObjectID; + } while (local_6c[0].ObjectID != NONE.ObjectID); + } + local_6c[0].ObjectID = NONE.ObjectID; + if (bVar1) { + local_7c[0].ObjectID = (this->CrObject).ObjectID; + Con = local_6c; + Con_00 = (Object *)x; + x_00 = y; + // try { // try from 080992bc to 0809931c has its CatchHandler @ 08099366 + GetMapContainer((int)Con,(int)pOStack_98,x); + MoveObject(local_7c,Con); + } + else { + local_7c[0].ObjectID = NONE.ObjectID; + // try { // try from 080990c4 to 0809926a has its CatchHandler @ 08099322 + bVar1 = SearchFreeField((int *)&stack0xffffff68,&x,&y,1,0,false); + if (bVar1) { + Con = local_6c; + local_7c[0].ObjectID = NONE.ObjectID; + local_6c[0].ObjectID = (this->CrObject).ObjectID; + Con_00 = (Object *)&z; + GetMapContainer((int)Con_00,(int)pOStack_98,x); + Ignore = local_7c; + } + else { + if (this->Type != NPC) { + if (this->Type == MONSTER) { + x_00 = x; + print(); + z = (this->CrObject).ObjectID; + Delete((Object *)&z,-1); + Con_00 = (Object *)0x0; + Con = (Object *)0x0; + TCreature::StartLogout(this,false,false); + } + else { + Con = pOStack_98; + Con_00 = (Object *)x; + x_00 = y; + error("Spieler auf [%d,%d,%d] ist von Patch betroffen.\n", + pOStack_98,x,y); + } + goto LAB_08098fc1; + } + print(); + Con_00 = local_6c; + z = NONE.ObjectID; + local_7c[0].ObjectID = (this->CrObject).ObjectID; + GetMapContainer((int)Con_00,this->startx,this->starty); + Ignore = (Object *)&z; + Con = local_7c; + } + x_00 = -1; + Move(0,Con,Con_00,-1,false,Ignore); + } + } + goto LAB_08098fc1; + } + } + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ApplyPatches(void) + +{ + bool bVar1; + DIR *__dirp; + dirent *pdVar2; + size_t sVar3; + int iVar4; + int iVar5; + dirent *DirEntry; + char *pcVar6; + undefined1 uVar7; + char *pcVar8; + char *pcVar9; + int local_5018; + int MaxPatch; + DIR *WorkDir; + int iStack_500c; + bool SaveHouses; + int x; + int y; + int z; + int nr; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + sprintf(local_101c,"%s/save-houses",SAVEPATH); + // try { // try from 080993ba to 08099525 has its CatchHandler @ 0809979b + bVar1 = FileExists(local_101c); + if (bVar1) { + print(); + unlink(local_101c); + } + __dirp = opendir(SAVEPATH); + if (__dirp == (DIR *)0x0) { + // try { // try from 08099746 to 08099763 has its CatchHandler @ 0809979b + error("ApplyPatches: Unterverzeichnis %s nicht gefunden.\n",SAVEPATH); + } + else { + local_5018 = -1; +LAB_080993f0: + pdVar2 = readdir(__dirp); + if (pdVar2 != (dirent *)0x0) { + pcVar9 = pdVar2->d_name; + sVar3 = strlen(pcVar9); + uVar7 = sVar3 == 4; + if (4 < sVar3) { + iVar5 = 5; + pcVar8 = pdVar2->d_name + (sVar3 - 4); + pcVar6 = ".pat"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + iVar5 = sscanf(pcVar9,"%d.pat",&z); + uVar7 = iVar5 == 1; + if ((bool)uVar7) { + if (local_5018 < z) { + local_5018 = z; + } + goto LAB_080993f0; + } + } + sVar3 = strlen(pcVar9); + iVar5 = 5; + pcVar8 = pdVar2->d_name + (sVar3 - 4); + pcVar6 = ".sec"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if (((bool)uVar7) && + (iVar5 = sscanf(pcVar9,"%d-%d-%d.sec",&stack0xffffaff4,&x,&y), iVar5 == 3)) { + iVar5 = y; + print(); + pcVar8 = SAVEPATH; + sprintf(local_101c,"%s/%s",SAVEPATH,pcVar9,iVar5); + TReadScriptFile::TReadScriptFile((TReadScriptFile *)&nr); + // try { // try from 08099533 to 08099578 has its CatchHandler @ 08099778 + TReadScriptFile::open((TReadScriptFile *)&nr,local_101c,(int)pcVar8); + iVar5 = x; + ApplyPatch(iStack_500c,x,y,true,(TReadScriptFile *)&nr,bVar1); + TReadScriptFile::close((TReadScriptFile *)&nr,iVar5); + unlink(local_101c); + // try { // try from 0809958a to 0809961a has its CatchHandler @ 0809979b + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)&nr,iVar5); + } + } + goto LAB_080993f0; + } + iVar5 = 0; + closedir(__dirp); + if (-1 < local_5018) { + do { + pcVar9 = SAVEPATH; + sprintf(local_101c,"%s/%03d.pat",SAVEPATH,iVar5); + bVar1 = FileExists(local_101c); + if (bVar1) { + TReadScriptFile::TReadScriptFile((TReadScriptFile *)&nr); + // try { // try from 08099622 to 08099706 has its CatchHandler @ 08099778 + TReadScriptFile::open((TReadScriptFile *)&nr,local_101c,(int)pcVar9); + pcVar9 = TReadScriptFile::readIdentifier((TReadScriptFile *)&nr); + iVar4 = stricmp(pcVar9,"sector",-1); + if (iVar4 != 0) { + // try { // try from 0809972d to 08099731 has its CatchHandler @ 08099778 + TReadScriptFile::error((TReadScriptFile *)&nr,"Sector expected"); + } + iStack_500c = TReadScriptFile::readNumber((TReadScriptFile *)&nr); + TReadScriptFile::readSymbol((TReadScriptFile *)&nr,','); + x = TReadScriptFile::readNumber((TReadScriptFile *)&nr); + TReadScriptFile::readSymbol((TReadScriptFile *)&nr,','); + y = TReadScriptFile::readNumber((TReadScriptFile *)&nr); + print(); + iVar4 = x; + ApplyPatch(iStack_500c,x,y,false,(TReadScriptFile *)&nr,false); + TReadScriptFile::close((TReadScriptFile *)&nr,iVar4); + unlink(local_101c); + // try { // try from 08099718 to 0809971c has its CatchHandler @ 0809979b + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)&nr,iVar4); + } + iVar5 = iVar5 + 1; + } while (iVar5 <= local_5018); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetNumberOfChannels(void) + +{ + return Channels; +} + + + +bool ChannelActive(int ChannelID) + +{ + TChannel *pTVar1; + bool bVar2; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar2 = false; + } + else { + bVar2 = true; + if (7 < ChannelID) { + pTVar1 = vector::operator()(&Channel,ChannelID); + bVar2 = pTVar1->Moderator != 0; + } + } + return bVar2; +} + + + +bool ChannelAvailable(int ChannelID,ulong CharacterID) + +{ + TPlayer *pl; + TPlayer *pTVar1; + TChannel *pTVar2; + ulong *puVar3; + int i; + TChannel *C; + bool bVar4; + RIGHT Right; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar4 = false; + } + else { + bVar4 = true; + if (7 < ChannelID) { + pTVar2 = vector::operator()(&Channel,ChannelID); + bVar4 = pTVar2->Moderator != 0; + } + } + if (!bVar4) { + return false; + } + pTVar1 = GetPlayer(CharacterID); + if (pTVar1 == (TPlayer *)0x0) { + error("ChannelAvailable: Spieler existiert nicht.\n"); + return false; + } + switch(ChannelID) { + case 0: + return pTVar1->Guild[0] != '\0'; + case 1: + case 3: + Right = READ_GAMEMASTER_CHANNEL; + break; + case 2: + Right = READ_TUTOR_CHANNEL; + break; + case 4: + case 5: + case 6: + case 7: + return true; + default: + if (ChannelID < 8) { + return false; + } + pTVar2 = vector::operator()(&Channel,ChannelID); + if (CharacterID == pTVar2->Moderator) { + return true; + } + i = 0; + if (pTVar2->InvitedPlayers < 1) { + return false; + } + do { + puVar3 = vector<>::operator()(&pTVar2->InvitedPlayer,i); + if (CharacterID == *puVar3) { + return true; + } + i = i + 1; + } while (i < pTVar2->InvitedPlayers); + return false; + } + bVar4 = CheckRight(CharacterID,Right); + return bVar4; +} + + + +char * GetChannelName(int ChannelID,ulong CharacterID) + +{ + TPlayer *pTVar1; + TChannel *pTVar2; + char *pcVar3; + bool bVar4; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar4 = false; + } + else { + bVar4 = true; + if (7 < ChannelID) { + pTVar2 = vector::operator()(&Channel,ChannelID); + bVar4 = pTVar2->Moderator != 0; + } + } + if (!bVar4) { + return "Unknown"; + } + pTVar1 = GetPlayer(CharacterID); + if (pTVar1 == (TPlayer *)0x0) { + error("GetChannelName: Spieler existiert nicht.\n"); +LAB_080999fd: + pcVar3 = "Unknown"; + } + else { + switch(ChannelID) { + case 0: + pcVar3 = pTVar1->Guild; + break; + case 1: + pcVar3 = "Gamemaster"; + break; + case 2: + pcVar3 = "Tutor"; + break; + case 3: + pcVar3 = "Rule Violations"; + break; + case 4: + pcVar3 = "Game-Chat"; + break; + case 5: + pcVar3 = "Trade"; + break; + case 6: + pcVar3 = "RL-Chat"; + break; + case 7: + pcVar3 = "Help"; + break; + default: + if (7 < ChannelID) { + pTVar2 = vector::operator()(&Channel,ChannelID); + sprintf(GetChannelName::ChannelName,"%s\'s Channel",pTVar2->ModeratorName); + return GetChannelName::ChannelName; + } + error("GetChannelName: Unbenutzter Kanal %d.\n",ChannelID); + goto LAB_080999fd; + } + } + return pcVar3; +} + + + +bool ChannelSubscribed(int ChannelID,ulong CharacterID) + +{ + TChannel *pTVar1; + ulong *puVar2; + int i; + TChannel *C; + bool bVar3; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar3 = false; + } + else { + bVar3 = true; + if (7 < ChannelID) { + pTVar1 = vector::operator()(&Channel,ChannelID); + bVar3 = pTVar1->Moderator != 0; + } + } + if (bVar3) { + i = 0; + pTVar1 = vector::operator()(&Channel,ChannelID); + if (0 < pTVar1->Subscribers) { + do { + puVar2 = vector<>::operator()(&pTVar1->Subscriber,i); + if (CharacterID == *puVar2) { + return true; + } + i = i + 1; + } while (i < pTVar1->Subscribers); + } + } + return false; +} + + + +ulong GetFirstSubscriber(int ChannelID) + +{ + int i; + TChannel *pTVar1; + ulong *puVar2; + TChannel *C; + ulong uVar3; + bool bVar4; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar4 = false; + } + else { + bVar4 = true; + if (7 < ChannelID) { + pTVar1 = vector::operator()(&Channel,ChannelID); + bVar4 = pTVar1->Moderator != 0; + } + } + uVar3 = 0; + if (bVar4) { + CurrentChannelID = ChannelID; + CurrentSubscriberNumber = 0; + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar4 = false; + } + else { + bVar4 = true; + if (7 < ChannelID) { + pTVar1 = vector::operator()(&Channel,ChannelID); + bVar4 = pTVar1->Moderator != 0; + } + } + uVar3 = 0; + if (bVar4) { + pTVar1 = vector::operator()(&Channel,CurrentChannelID); + i = CurrentSubscriberNumber; + if (CurrentSubscriberNumber < pTVar1->Subscribers) { + CurrentSubscriberNumber = CurrentSubscriberNumber + 1; + puVar2 = vector<>::operator()(&pTVar1->Subscriber,i); + uVar3 = *puVar2; + } + else { + uVar3 = 0; + } + } + } + return uVar3; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ulong GetNextSubscriber(void) + +{ + int i; + TChannel *pTVar1; + ulong *puVar2; + TChannel *C; + ulong uVar3; + bool bVar4; + + if ((CurrentChannelID < 0) || (Channels <= CurrentChannelID)) { + error(&DAT_080ffea0,CurrentChannelID); + bVar4 = false; + } + else { + bVar4 = true; + if (7 < CurrentChannelID) { + pTVar1 = vector::operator()(&Channel,CurrentChannelID); + bVar4 = pTVar1->Moderator != 0; + } + } + uVar3 = 0; + if (bVar4) { + pTVar1 = vector::operator()(&Channel,CurrentChannelID); + i = CurrentSubscriberNumber; + if (CurrentSubscriberNumber < pTVar1->Subscribers) { + CurrentSubscriberNumber = CurrentSubscriberNumber + 1; + puVar2 = vector<>::operator()(&pTVar1->Subscriber,i); + uVar3 = *puVar2; + } + else { + uVar3 = 0; + } + } + return uVar3; +} + + + +bool MayOpenChannel(ulong CharacterID) + +{ + bool bVar1; + TChannel *pTVar2; + bool bVar3; + int i; + int i_00; + + if (Channels < 0xffff) { + bVar1 = CheckRight(CharacterID,PREMIUM_ACCOUNT); + bVar3 = false; + if (bVar1) { + i_00 = 8; + if (8 < Channels) { + do { + pTVar2 = vector::operator()(&Channel,i_00); + if (pTVar2->Moderator == CharacterID) goto LAB_08099cfb; + i_00 = i_00 + 1; + } while (i_00 < Channels); + } + bVar3 = true; + } + } + else { +LAB_08099cfb: + bVar3 = false; + } + return bVar3; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void OpenChannel(ulong CharacterID) + +{ + bool bVar1; + TPlayer *pTVar2; + TChannel *pTVar3; + ulong *puVar4; + undefined4 *puVar5; + int ChannelID; + int i; + TChannel *C; + int i_00; + TPlayer *pl; + + // try { // try from 08099d75 to 08099ef2 has its CatchHandler @ 08099ef5 + pTVar2 = GetPlayer(CharacterID); + if (pTVar2 == (TPlayer *)0x0) { + error("OpenChannel: Kreatur %lu existiert nicht.\n",CharacterID); + } + else { + if (Channels < 0xffff) { + bVar1 = CheckRight(CharacterID,PREMIUM_ACCOUNT); + if (bVar1) { + i = 8; + if (8 < Channels) { + do { + pTVar3 = vector::operator()(&Channel,i); + if (pTVar3->Moderator == CharacterID) goto LAB_08099e20; + i = i + 1; + } while (i < Channels); + } + i_00 = 8; + i = Channels; + if (8 < Channels) { + do { + pTVar3 = vector::operator()(&Channel,i_00); + if (pTVar3->Moderator == 0) { + i = i_00; + } + i_00 = i_00 + 1; + } while (i_00 < Channels); + } + if (i == Channels) { + Channels = i + 1; + } + pTVar3 = vector::operator()(&Channel,i); + pTVar3->Moderator = CharacterID; + strcpy(pTVar3->ModeratorName,(pTVar2->super_TCreature).Name); + puVar4 = vector<>::operator()(&pTVar3->Subscriber,0); + *puVar4 = CharacterID; + pTVar3->Subscribers = 1; + pTVar3->InvitedPlayers = 0; +LAB_08099e20: + SendOpenOwnChannel((pTVar2->super_TCreature).Connection,i); + return; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x33; + goto LAB_08099eab; + } + error(&DAT_081009a0); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; +LAB_08099eab: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +void CloseChannel(int ChannelID) + +{ + TChannel *pTVar1; + + if ((ChannelID < 8) || (Channels <= ChannelID)) { + error(&DAT_08100a00,ChannelID); + } + else { + pTVar1 = vector::operator()(&Channel,ChannelID); + if (pTVar1->Moderator == 0) { + error("CloseChannel: Kanal ist schon geschlossen.\n"); + return; + } + pTVar1->Moderator = 0; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Opp + +void InviteToChannel(ulong CharacterID,char *Name) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + ulong *puVar4; + undefined4 *puVar5; + TChannel *pTVar6; + char *pcVar7; + ulong OppID; + TChannel *pTVar8; + ulong uVar9; + TPlayer *pl; + int local_20; + int i_1; + TChannel *C; + int channel; + TPlayer *Opp; + + // try { // try from 08099f85 to 0809a218 has its CatchHandler @ 0809a220 + pTVar2 = GetPlayer(CharacterID); + if (pTVar2 == (TPlayer *)0x0) { + error("InviteToChannel: Kreatur %lu existiert nicht.\n",CharacterID); + return; + } + C = (TChannel *)0xffffffff; + pTVar8 = (TChannel *)0x8; + if (8 < Channels) { + do { + pTVar6 = vector::operator()(&Channel,(int)pTVar8); + if (pTVar6->Moderator == CharacterID) { + C = pTVar8; + } + pTVar8 = (TChannel *)((int)&pTVar8->Moderator + 1); + } while ((int)pTVar8 < Channels); + } + if (C == (TChannel *)0xffffffff) { + return; + } + uVar9 = 0; + channel = 0; + bVar1 = CheckRight((pTVar2->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + iVar3 = IdentifyPlayer(Name,false,!bVar1,(TPlayer **)&channel); + if (iVar3 == -1) { + uVar9 = GetCharacterID(Name); + if (uVar9 == 0) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x1a; +LAB_0809a19d: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + } + } + else { + if (-1 < iVar3) { + if (iVar3 == 0) { + uVar9 = *(ulong *)(channel + 0x208); + Name = (char *)(channel + 0x214); + } + goto LAB_0809a01f; + } + if (iVar3 != -2) goto LAB_0809a01f; + uVar9 = GetCharacterID(Name); + if (uVar9 == 0) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x1c; + goto LAB_0809a19d; + } + } + Name = GetCharacterName(Name); +LAB_0809a01f: + print(); + pTVar8 = vector::operator()(&Channel,(int)C); + if (CharacterID != uVar9) { + local_20 = 0; + iVar3 = pTVar8->InvitedPlayers; + if (0 < iVar3) { + do { + puVar4 = vector<>::operator()(&pTVar8->InvitedPlayer,local_20); + if (*puVar4 == uVar9) { + SendMessage((pTVar2->super_TCreature).Connection,0x16, + "%s has already been invited.",Name); + return; + } + local_20 = local_20 + 1; + iVar3 = pTVar8->InvitedPlayers; + } while (local_20 < iVar3); + } + puVar4 = vector<>::operator()(&pTVar8->InvitedPlayer,iVar3); + *puVar4 = uVar9; + pTVar8->InvitedPlayers = pTVar8->InvitedPlayers + 1; + SendMessage((pTVar2->super_TCreature).Connection,0x16,"%s has been invited.",Name); + if (channel != 0) { + pcVar7 = "his"; + if ((pTVar2->super_TCreature).Sex != 1) { + pcVar7 = "her"; + } + SendMessage(*(TConnection **)(channel + 0x318),0x16, + "%s invites you to %s private chat channel.",(pTVar2->super_TCreature).Name, + pcVar7); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Opp + +void ExcludeFromChannel(ulong CharacterID,char *Name) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + ulong *puVar4; + ulong *puVar5; + undefined4 *puVar6; + TChannel *pTVar7; + ulong OppID; + TChannel *pTVar8; + ulong CharacterID_00; + int i; + int local_24; + int Position; + TChannel *C; + int channel; + TPlayer *pl; + TPlayer *Opp; + + // try { // try from 0809a258 to 0809a4fe has its CatchHandler @ 0809a504 + pTVar2 = GetPlayer(CharacterID); + if (pTVar2 == (TPlayer *)0x0) { + error("ExcludeFromChannel: Kreatur %lu existiert nicht.\n",CharacterID); + } + else { + C = (TChannel *)0xffffffff; + pTVar8 = (TChannel *)0x8; + if (8 < Channels) { + do { + pTVar7 = vector::operator()(&Channel,(int)pTVar8); + if (pTVar7->Moderator == CharacterID) { + C = pTVar8; + } + pTVar8 = (TChannel *)((int)&pTVar8->Moderator + 1); + } while ((int)pTVar8 < Channels); + } + if (C != (TChannel *)0xffffffff) { + CharacterID_00 = 0; + pl = (TPlayer *)0x0; + bVar1 = CheckRight((pTVar2->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + iVar3 = IdentifyPlayer(Name,false,!bVar1,&pl); + if (iVar3 == -1) { + CharacterID_00 = GetCharacterID(Name); + if (CharacterID_00 == 0) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x1a; +LAB_0809a484: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); + } + } + else if (iVar3 < 0) { + if ((iVar3 == -2) && (CharacterID_00 = GetCharacterID(Name), CharacterID_00 == 0)) { + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 0x1c; + goto LAB_0809a484; + } + } + else if (iVar3 == 0) { + CharacterID_00 = (pl->super_TCreature).ID; + Name = (pl->super_TCreature).Name; + } + print(); + pTVar8 = vector::operator()(&Channel,(int)C); + if (CharacterID != CharacterID_00) { + local_24 = -1; + iVar3 = pTVar8->InvitedPlayers; + i = 0; + if (0 < iVar3) { + do { + puVar4 = vector<>::operator()(&pTVar8->InvitedPlayer,i); + if (*puVar4 == CharacterID_00) { + local_24 = i; + } + i = i + 1; + iVar3 = pTVar8->InvitedPlayers; + } while (i < iVar3); + } + if (local_24 == -1) { + SendMessage((pTVar2->super_TCreature).Connection,0x16,"%s has not been invited." + ,Name); + } + else { + pTVar8->InvitedPlayers = iVar3 + -1; + puVar4 = vector<>::operator()(&pTVar8->InvitedPlayer,local_24); + puVar5 = vector<>::operator()(&pTVar8->InvitedPlayer,pTVar8->InvitedPlayers); + *puVar4 = *puVar5; + SendMessage((pTVar2->super_TCreature).Connection,0x16,"%s has been excluded.", + Name); + bVar1 = ChannelSubscribed((int)C,CharacterID_00); + if (bVar1) { + LeaveChannel((int)C,CharacterID_00,false); + SendCloseChannel((pl->super_TCreature).Connection,(int)C); + } + } + } + } + } + return; +} + + + +bool JoinChannel(int ChannelID,ulong CharacterID) + +{ + bool bVar1; + TChannel *pTVar2; + ulong *puVar3; + undefined4 *puVar4; + TChannel *C; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + // try { // try from 0809a550 to 0809a61d has its CatchHandler @ 0809a630 + error(&DAT_080ffea0,ChannelID); + bVar1 = false; + } + else { + bVar1 = true; + if (7 < ChannelID) { + pTVar2 = vector::operator()(&Channel,ChannelID); + bVar1 = pTVar2->Moderator != 0; + } + } + if (bVar1) { + bVar1 = ChannelAvailable(ChannelID,CharacterID); + if (bVar1) { + pTVar2 = vector::operator()(&Channel,ChannelID); + bVar1 = ChannelSubscribed(ChannelID,CharacterID); + if (!bVar1) { + puVar3 = vector<>::operator()(&pTVar2->Subscriber,pTVar2->Subscribers); + *puVar3 = CharacterID; + pTVar2->Subscribers = pTVar2->Subscribers + 1; + } + return CharacterID == pTVar2->Moderator; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + } + else { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: CharacterID_local + +void LeaveChannel(int ChannelID,ulong CharacterID,bool Close) + +{ + vector<> *this; + TChannel *C_1; + TChannel *pTVar1; + ulong *puVar2; + TPlayer *pTVar3; + ulong *puVar4; + int i; + int iVar5; + TChannel *C; + bool bVar6; + bool Close_local; + ulong CharacterID_local; + + if ((ChannelID < 0) || (Channels <= ChannelID)) { + error(&DAT_080ffea0,ChannelID); + bVar6 = false; + } + else { + bVar6 = true; + if (7 < ChannelID) { + pTVar1 = vector::operator()(&Channel,ChannelID); + bVar6 = pTVar1->Moderator != 0; + } + } + if (bVar6) { + iVar5 = 0; + pTVar1 = vector::operator()(&Channel,ChannelID); + if (0 < pTVar1->Subscribers) { + this = &pTVar1->Subscriber; + do { + puVar2 = vector<>::operator()(this,iVar5); + if (CharacterID == *puVar2) { + pTVar1->Subscribers = pTVar1->Subscribers + -1; + puVar2 = vector<>::operator()(this,iVar5); + puVar4 = vector<>::operator()(this,pTVar1->Subscribers); + *puVar2 = *puVar4; + break; + } + iVar5 = iVar5 + 1; + } while (iVar5 < pTVar1->Subscribers); + } + if ((Close) && (CharacterID == pTVar1->Moderator)) { + iVar5 = 0; + if (0 < pTVar1->Subscribers) { + do { + puVar2 = vector<>::operator()(&pTVar1->Subscriber,iVar5); + pTVar3 = GetPlayer(*puVar2); + if (pTVar3 != (TPlayer *)0x0) { + SendCloseChannel((pTVar3->super_TCreature).Connection,ChannelID); + } + iVar5 = iVar5 + 1; + } while (iVar5 < pTVar1->Subscribers); + } + pTVar1->Subscribers = 0; + } + if ((7 < ChannelID) && (pTVar1->Subscribers == 0)) { + if (Channels <= ChannelID) { + error(&DAT_08100a00); + return; + } + pTVar1 = vector::operator()(&Channel,ChannelID); + if (pTVar1->Moderator == 0) { + error("CloseChannel: Kanal ist schon geschlossen.\n"); + return; + } + pTVar1->Moderator = 0; + } + } + return; +} + + + +void LeaveAllChannels(ulong CharacterID) + +{ + TChannel *pTVar1; + int ChannelID; + int i; + bool bVar2; + + i = 0; + if (0 < Channels) { + do { + if ((i < 0) || (Channels <= i)) { + error(&DAT_080ffea0,i); + bVar2 = false; + } + else { + bVar2 = true; + if (7 < i) { + pTVar1 = vector::operator()(&Channel,i); + bVar2 = pTVar1->Moderator != 0; + } + } + if (bVar2) { + LeaveChannel(i,CharacterID,false); + } + i = i + 1; + } while (i < Channels); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +ulong LogCommunication(void) + +{ + TStatement *pTVar1; + ulong uVar2; + TStatement *Statement; + ulong in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + char *in_stack_00000010; + char *Text; + + if (in_stack_00000010 == (char *)0x0) { + Text = "LogCommunication: Text ist NULL.\n"; + } + else { + if (in_stack_00000004 != 0) { + StatementID = StatementID + 1; + pTVar1 = fifo::append(&Statements); + pTVar1->StatementID = StatementID; + uVar2 = time((time_t *)0x0); + pTVar1->TimeStamp = uVar2; + pTVar1->CharacterID = in_stack_00000004; + pTVar1->Mode = in_stack_00000008; + pTVar1->Channel = in_stack_0000000c; + uVar2 = AddDynamicString(in_stack_00000010); + pTVar1->Reported = false; + pTVar1->Text = uVar2; + return StatementID; + } + Text = "LogCommunication: CharacterID ist Null.\n"; + } + error(Text); + return 0; +} + + + +ulong LogListener(ulong StatementID,TPlayer *pl) + +{ + bool bVar1; + TListener *Listener; + TListener *pTVar2; + ulong uVar3; + + uVar3 = 0; + if ((StatementID != 0) && (uVar3 = 0, pl != (TPlayer *)0x0)) { + bVar1 = CheckRight((pl->super_TCreature).ID,LOG_COMMUNICATION); + uVar3 = 0; + if (bVar1) { + pTVar2 = fifo::append(&Listeners); + pTVar2->StatementID = StatementID; + pTVar2->CharacterID = (pl->super_TCreature).ID; + uVar3 = StatementID; + } + } + return uVar3; +} + + + +// WARNING: Restarted to delay deadcode elimination for space: ram +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessCommunicationControl(void) + +{ + time_t tVar1; + TListener *pTVar2; + TStatement *pTVar3; + uint local_3c; + ulong Limit; + + tVar1 = time((time_t *)0x0); + while( true ) { + if (Statements.Head < Statements.Tail) { + pTVar3 = (TStatement *)0x0; + } + else { + pTVar3 = Statements.Entry + Statements.Tail % Statements.Size; + } + if ((pTVar3 == (TStatement *)0x0) || (tVar1 - 0x708U <= pTVar3->TimeStamp)) break; + DeleteDynamicString(pTVar3->Text); + if (Statements.Head < Statements.Tail) { + error("fifo::remove: Fifo ist leer.\n"); + } + else { + Statements.Tail = Statements.Tail + 1; + } + } + if (Statements.Head < Statements.Tail) { + pTVar3 = (TStatement *)0x0; + } + else { + pTVar3 = Statements.Entry + Statements.Tail % Statements.Size; + } + if (pTVar3 == (TStatement *)0x0) { + local_3c = 0; + } + else { + if (Statements.Head < Statements.Tail) { + pTVar3 = (TStatement *)0x0; + } + else { + pTVar3 = Statements.Entry + Statements.Tail % Statements.Size; + } + local_3c = pTVar3->StatementID; + } + while( true ) { + if (Listeners.Head < Listeners.Tail) { + pTVar2 = (TListener *)0x0; + } + else { + pTVar2 = Listeners.Entry + Listeners.Tail % Listeners.Size; + } + if ((pTVar2 == (TListener *)0x0) || (local_3c <= pTVar2->StatementID)) break; + if (Listeners.Head < Listeners.Tail) { + error("fifo::remove: Fifo ist leer.\n"); + } + else { + Listeners.Tail = Listeners.Tail + 1; + } + } + return; +} + + + +int GetCommunicationContext + (ulong CharacterID,ulong StatementID,int *NumberOfStatements, + vector<> **ReportedStatements) + +{ + int iVar1; + bool bVar2; + vector<> *pvVar3; + TReportedStatement *pTVar4; + TStatement *pTVar5; + char *pcVar6; + char *pcVar7; + uint uVar8; + uint uVar9; + int i; + fifo *pfVar10; + char *pcVar11; + TListener *pTVar12; + int *piVar13; + bool bVar14; + char *pcVar15; + char *local_40; + int FreeSpace; + TStatement *pTStack_38; + bool StatementContained; + fifoIterator iter2; + int local_20; + fifo *local_1c; + fifoIterator iter; + + local_1c = &Statements; + iter.Fifo = (fifo *)Statements.Head; + while( true ) { + bVar2 = false; + if ((Statements.Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= Statements.Head)) { + bVar2 = true; + } + if (bVar2) { + pTVar5 = Statements.Entry + (int)iter.Fifo % Statements.Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5 == (TStatement *)0x0) break; + bVar2 = false; + if ((Statements.Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= Statements.Head)) { + bVar2 = true; + } + if (bVar2) { + pTVar5 = Statements.Entry + (int)iter.Fifo % Statements.Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->StatementID == StatementID) break; + iter.Fifo = (fifo *)((int)&iter.Fifo[-1].Tail + 3); + } + bVar2 = false; + if ((Statements.Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= Statements.Head)) { + bVar2 = true; + } + if (bVar2) { + pTStack_38 = Statements.Entry + (int)iter.Fifo % Statements.Size; + } + else { + pTStack_38 = (TStatement *)0x0; + } + if (pTStack_38 == (TStatement *)0x0) { + return 1; + } + if (CharacterID != 0) { +LAB_0809ac90: + if (pTStack_38->Reported != false) { + return 2; + } + bVar2 = false; + *NumberOfStatements = 0; + local_20 = 0x4000; + iter2.Position = MaxPlayers * 0x42 + 2; + piVar13 = &iter2.Position; + if (iter2.Position < 0x4001) { + piVar13 = &local_20; + } + local_40 = (char *)(*piVar13 + -0x11f); + pvVar3 = (vector<> *)operator_new(0x130); + pcVar15 = (char *)0x0; + // try { // try from 0809ad0a to 0809ad0e has its CatchHandler @ 0809b61f + vector<>::vector(pvVar3,0,100,100); + *ReportedStatements = pvVar3; + iter2.Fifo = (fifo *)Listeners.Tail; + local_1c = &Statements; + pfVar10 = &Statements; + iter.Fifo = (fifo *)Statements.Tail; +LAB_0809ad41: + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5 == (TStatement *)0x0) goto LAB_0809b4bf; + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + uVar9 = pTStack_38->TimeStamp; + if (((int)(uVar9 - 0xb4) <= (int)pTVar5->TimeStamp) && + ((int)pTVar5->TimeStamp <= (int)(uVar9 + 0x3c))) { + bVar14 = true; + } + if (!bVar14) goto LAB_0809ae99; + if ((int)local_40 < 1) { + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (uVar9 < pTVar5->TimeStamp) { + error(&DAT_08100c20); +LAB_0809b4bf: + if ((int)local_40 < 0) { + pcVar11 = (char *)0x0; + pcVar15 = (char *)-(int)local_40; + error(&DAT_08100ce0,pcVar15); + if (*NumberOfStatements < 1) { +LAB_0809b5c9: + if ((int)local_40 < 0) { + error("GetCommunicationContext: FreeSpace ist immer noch negativ (%d).\n" + ,local_40); + pcVar15 = local_40; + } + } + else { + do { + pcVar15 = pcVar11; + pTVar4 = vector<>::operator()(*ReportedStatements,(int)pcVar11); + if (pTVar4->StatementID != StatementID) { + pTVar4 = vector<>::operator()(*ReportedStatements,(int)pcVar11); + pTVar4->StatementID = 0; + pcVar15 = pcVar11; + pTVar4 = vector<>::operator()(*ReportedStatements,(int)pcVar11); + pcVar7 = pTVar4->Text; + do { + pcVar6 = pcVar7; + uVar8 = *(uint *)pcVar6 + 0xfefefeff & ~*(uint *)pcVar6; + uVar9 = uVar8 & 0x80808080; + pcVar7 = pcVar6 + 4; + } while (uVar9 == 0); + bVar14 = (uVar8 & 0x8080) == 0; + if (bVar14) { + uVar9 = uVar9 >> 0x10; + } + if (bVar14) { + pcVar7 = pcVar6 + 6; + } + local_40 = pcVar7 + (int)(local_40 + + (-(int)pTVar4->Text - + (uint)CARRY1((byte)uVar9,(byte)uVar9)) + + 0x2b); + } + pcVar11 = pcVar11 + 1; + if (*NumberOfStatements <= (int)pcVar11) goto LAB_0809b5c9; + } while ((int)local_40 < 0); + } + } + if (bVar2) { + pTStack_38->Reported = true; + return 0; + } + error("GetCommunicationContext: Statement ist nicht im Kontext enthalten.\n",pcVar15 + ); + pvVar3 = *ReportedStatements; + if (pvVar3 == (vector<> *)0x0) { + return 1; + } + if (pvVar3->entry != (TReportedStatement *)0x0) { + operator_delete__(pvVar3->entry); + } + operator_delete(pvVar3); + return 1; + } + } + if (CharacterID != 0) { + while( true ) { + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + if (pTVar12 == (TListener *)0x0) break; + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->StatementID <= pTVar12->StatementID) break; + iter2.Fifo = (fifo *)((int)&(iter2.Fifo)->Entry + 1); + } + do { + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + if (pTVar12 == (TListener *)0x0) goto LAB_0809b39a; + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar12->StatementID != pTVar5->StatementID) goto LAB_0809b39a; + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + if (pTVar12->CharacterID == CharacterID) goto LAB_0809b39a; + iter2.Fifo = (fifo *)((int)&(iter2.Fifo)->Entry + 1); + } while( true ); + } + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && (bVar14 = true, pfVar10->Head < (int)iter.Fifo)) { + bVar14 = false; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->Mode != 5) { + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->Mode != 10) { + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->Mode != 0xc) goto LAB_0809ae99; + } + } + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTStack_38->Channel != pTVar5->Channel) goto LAB_0809ae99; + goto LAB_0809aedf; + } + iVar1 = pTStack_38->Mode; + if (((iVar1 == 5) || (iVar1 == 10)) || (iVar1 == 0xc)) { + bVar2 = false; + iVar1 = pTStack_38->Channel; + if ((3 < iVar1) && (iVar1 < 8)) { + bVar2 = true; + } + if ((bVar2) || (iVar1 == 2)) goto LAB_0809ac90; + } + error(&DAT_08100bc0); + return 1; +LAB_0809b39a: + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + if (pTVar12 != (TListener *)0x0) { + bVar14 = false; + if ((Listeners.Tail <= (int)iter2.Fifo) && ((int)iter2.Fifo <= Listeners.Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar12 = Listeners.Entry + (int)iter2.Fifo % Listeners.Size; + } + else { + pTVar12 = (TListener *)0x0; + } + bVar14 = false; + if ((pfVar10->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= pfVar10->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = pfVar10->Entry + (int)iter.Fifo % pfVar10->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar12->StatementID <= pTVar5->StatementID) { +LAB_0809aedf: + bVar14 = false; + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + pTVar4->StatementID = pTVar5->StatementID; + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + pTVar4->TimeStamp = pTVar5->TimeStamp; + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + pTVar4->CharacterID = pTVar5->CharacterID; + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + pTVar4->Mode = pTVar5->Mode; + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + bVar14 = false; + pTVar4->Channel = pTVar5->Channel; + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + if (pTVar5->Text == 0) { + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + pTVar4->Text[0] = '\0'; + } + else { + bVar14 = false; + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + pcVar15 = GetDynamicString(pTVar5->Text); + pTVar4 = vector<>::operator()(*ReportedStatements,*NumberOfStatements); + strcpy(pTVar4->Text,pcVar15); + } + pcVar15 = (char *)*NumberOfStatements; + pTVar4 = vector<>::operator()(*ReportedStatements,(int)pcVar15); + pcVar11 = pTVar4->Text; + do { + pcVar7 = pcVar11; + uVar8 = *(uint *)pcVar7 + 0xfefefeff & ~*(uint *)pcVar7; + uVar9 = uVar8 & 0x80808080; + pcVar11 = pcVar7 + 4; + } while (uVar9 == 0); + if ((uVar8 & 0x8080) == 0) { + pcVar11 = pcVar7 + 6; + uVar9 = uVar9 >> 0x10; + } + bVar14 = false; + local_40 = local_40 + + (-0x2e - (int)(pcVar11 + + ((-3 - (uint)CARRY1((byte)uVar9,(byte)uVar9)) - + (int)pTVar4->Text))); + *NumberOfStatements = *NumberOfStatements + 1; + if ((local_1c->Tail <= (int)iter.Fifo) && ((int)iter.Fifo <= local_1c->Head)) { + bVar14 = true; + } + if (bVar14) { + pTVar5 = local_1c->Entry + (int)iter.Fifo % local_1c->Size; + } + else { + pTVar5 = (TStatement *)0x0; + } + pfVar10 = local_1c; + if (pTVar5->StatementID == StatementID) { + bVar2 = true; + } + } + } +LAB_0809ae99: + iter.Fifo = (fifo *)((int)&(iter.Fifo)->Entry + 1); + goto LAB_0809ad41; +} + + + +TParty * GetParty(ulong Leader) + +{ + TParty *pTVar1; + int i; + int i_00; + + i_00 = 0; + if (0 < Parties) { + do { + pTVar1 = vector::operator()(&Party,i_00); + if (pTVar1->Leader == Leader) { + pTVar1 = vector::operator()(&Party,i_00); + return pTVar1; + } + i_00 = i_00 + 1; + } while (i_00 < Parties); + } + return (TParty *)0x0; +} + + + +bool IsInvitedToParty(ulong Guest,ulong Host) + +{ + ulong *puVar1; + int i; + int iVar2; + TParty *pTVar3; + + iVar2 = 0; + if (0 < Parties) { + do { + pTVar3 = vector::operator()(&Party,iVar2); + if (pTVar3->Leader == Host) { + pTVar3 = vector::operator()(&Party,iVar2); + goto LAB_0809b6b8; + } + iVar2 = iVar2 + 1; + } while (iVar2 < Parties); + } + pTVar3 = (TParty *)0x0; +LAB_0809b6b8: + if ((pTVar3 != (TParty *)0x0) && (iVar2 = 0, 0 < pTVar3->InvitedPlayers)) { + do { + puVar1 = vector<>::operator()(&pTVar3->InvitedPlayer,iVar2); + if (Guest == *puVar1) { + return true; + } + iVar2 = iVar2 + 1; + } while (iVar2 < pTVar3->InvitedPlayers); + } + return false; +} + + + +// WARNING: Variable defined which should be unmapped: leader + +void DisbandParty(ulong Leader) + +{ + vector<> *this; + TPlayer *pl; + TPlayer *pTVar1; + ulong *puVar2; + TPlayer *pTVar3; + TParty *pTVar4; + int i; + int iVar5; + int iVar6; + int iVar7; + TPlayer *pl_1; + int local_1c; + int i_2; + TPlayer *leader; + + iVar5 = 0; + pTVar1 = GetPlayer(Leader); + if (0 < Parties) { + do { + pTVar4 = vector::operator()(&Party,iVar5); + if (pTVar4->Leader == Leader) { + i_2 = (int)vector::operator()(&Party,iVar5); + goto LAB_0809b76c; + } + iVar5 = iVar5 + 1; + } while (iVar5 < Parties); + } + i_2 = 0; +LAB_0809b76c: + if (i_2 == 0) { + error(&DAT_08100dc0,Leader); + } + else { + iVar6 = 0; + iVar5 = *(int *)(i_2 + 0x24); + if (0 < iVar5) { + do { + puVar2 = vector<>::operator()((vector<> *)(i_2 + 4),iVar6); + pTVar3 = GetPlayer(*puVar2); + if (pTVar3 != (TPlayer *)0x0) { + TPlayer::LeaveParty(pTVar3); + } + iVar6 = iVar6 + 1; + iVar5 = *(int *)(i_2 + 0x24); + } while (iVar6 < iVar5); + } + *(undefined4 *)i_2 = 0; + local_1c = 0; + if (0 < iVar5) { + this = (vector<> *)(i_2 + 4); + do { + puVar2 = vector<>::operator()(this,local_1c); + pTVar3 = GetPlayer(*puVar2); + if (pTVar3 == (TPlayer *)0x0) { + iVar5 = *(int *)(i_2 + 0x24); + } + else { + SendMessage((pTVar3->super_TCreature).Connection,0x16, + "Your party has been disbanded."); + iVar5 = *(int *)(i_2 + 0x24); + iVar6 = 0; + if (0 < iVar5) { + do { + puVar2 = vector<>::operator()(this,iVar6); + SendCreatureParty((pTVar3->super_TCreature).Connection,*puVar2); + iVar7 = iVar6 + 1; + puVar2 = vector<>::operator()(this,iVar6); + SendCreatureSkull((pTVar3->super_TCreature).Connection,*puVar2); + iVar5 = *(int *)(i_2 + 0x24); + iVar6 = iVar7; + } while (iVar7 < iVar5); + } + } + local_1c = local_1c + 1; + } while (local_1c < iVar5); + } + if ((pTVar1 != (TPlayer *)0x0) && (0 < *(int *)(i_2 + 0x48))) { + iVar5 = 0; + do { + puVar2 = vector<>::operator()((vector<> *)(i_2 + 0x28),iVar5); + pTVar3 = GetPlayer(*puVar2); + if (pTVar3 != (TPlayer *)0x0) { + SendCreatureParty((pTVar3->super_TCreature).Connection,Leader); + SendCreatureParty((pTVar1->super_TCreature).Connection, + (pTVar3->super_TCreature).ID); + } + iVar5 = iVar5 + 1; + } while (iVar5 < *(int *)(i_2 + 0x48)); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Guest_local + +void InviteToParty(ulong Host,ulong Guest) + +{ + TPlayer *this; + TPlayer *this_00; + ulong uVar1; + TParty *pTVar2; + ulong *puVar3; + char *pcVar4; + TConnection *Connection; + TParty *P; + int iVar5; + int i; + TPlayer *host; + vector<> *local_20; + TParty *local_1c; + TPlayer *guest; + ulong Guest_local; + + if (Host != Guest) { + this = GetPlayer(Host); + if (this == (TPlayer *)0x0) { + Host = (ulong)s_InviteToParty__Einladender_Spiel_08100ec0; +LAB_0809bd08: + error((char *)Host); + return; + } + this_00 = GetPlayer(Guest); + if (this_00 == (TPlayer *)0x0) { + SendResult((this->super_TCreature).Connection,PLAYERNOTONLINE); + return; + } + uVar1 = TPlayer::GetPartyLeader(this,true); + if (uVar1 == 0) { + uVar1 = TPlayer::GetPartyLeader(this_00,true); + if (uVar1 == 0) { + iVar5 = 0; + if (0 < Parties) { + do { + pTVar2 = vector::operator()(&Party,iVar5); + if (pTVar2->Leader == 0) { + pTVar2 = vector::operator()(&Party,iVar5); + goto LAB_0809b9e5; + } + iVar5 = iVar5 + 1; + } while (iVar5 < Parties); + } + pTVar2 = (TParty *)0x0; +LAB_0809b9e5: + if (pTVar2 == (TParty *)0x0) { + pTVar2 = vector::operator()(&Party,Parties); + Parties = Parties + 1; + } + pTVar2->Leader = Host; + puVar3 = vector<>::operator()(&pTVar2->Member,0); + *puVar3 = Host; + pTVar2->Members = 1; + puVar3 = vector<>::operator()(&pTVar2->InvitedPlayer,0); + *puVar3 = Guest; + pTVar2->InvitedPlayers = 1; + TPlayer::JoinParty(this,Host); + SendMessage((this->super_TCreature).Connection,0x16,"%s has been invited.", + (this_00->super_TCreature).Name); + pcVar4 = "his"; + if ((this->super_TCreature).Sex != 1) { + pcVar4 = "her"; + } + SendMessage((this_00->super_TCreature).Connection,0x16,"%s invites you to %s party." + ,(this->super_TCreature).Name,pcVar4); + SendCreatureParty((this->super_TCreature).Connection,Host); + SendCreatureSkull((this->super_TCreature).Connection,Host); +LAB_0809bac9: + SendCreatureParty((this->super_TCreature).Connection,Guest); + SendCreatureParty((this_00->super_TCreature).Connection,Host); + return; + } + Connection = (this->super_TCreature).Connection; + pcVar4 = "%s is already member of a party."; +LAB_0809bb73: + SendMessage(Connection,0x16,pcVar4,(this_00->super_TCreature).Name); + } + else { + uVar1 = TPlayer::GetPartyLeader(this,false); + if (uVar1 == Host) { + uVar1 = TPlayer::GetPartyLeader(this_00,true); + if (uVar1 == 0) { + iVar5 = 0; + if (0 < Parties) { + do { + pTVar2 = vector::operator()(&Party,iVar5); + if (pTVar2->Leader == Host) { + local_1c = vector::operator()(&Party,iVar5); + goto LAB_0809bbfc; + } + iVar5 = iVar5 + 1; + } while (iVar5 < Parties); + } + local_1c = (TParty *)0x0; +LAB_0809bbfc: + if (local_1c == (TParty *)0x0) { + Host = (ulong)&DAT_08100e40; + goto LAB_0809bd08; + } + i = 0; + iVar5 = local_1c->InvitedPlayers; + if (0 < iVar5) { + do { + puVar3 = vector<>::operator()(&local_1c->InvitedPlayer,i); + if (*puVar3 == Guest) { + Connection = (this->super_TCreature).Connection; + pcVar4 = "%s has already been invited."; + goto LAB_0809bb73; + } + i = i + 1; + iVar5 = local_1c->InvitedPlayers; + } while (i < iVar5); + } + local_20 = &local_1c->InvitedPlayer; + puVar3 = vector<>::operator()(local_20,iVar5); + *puVar3 = Guest; + local_1c->InvitedPlayers = local_1c->InvitedPlayers + 1; + SendMessage((this->super_TCreature).Connection,0x16,"%s has been invited.", + (this_00->super_TCreature).Name); + pcVar4 = "his"; + if ((this->super_TCreature).Sex != 1) { + pcVar4 = "her"; + } + SendMessage((this_00->super_TCreature).Connection,0x16, + "%s invites you to %s party.",(this->super_TCreature).Name,pcVar4); + goto LAB_0809bac9; + } + pcVar4 = "your"; + uVar1 = TPlayer::GetPartyLeader(this_00,true); + if (uVar1 != Host) { + pcVar4 = "a"; + } + SendMessage((this->super_TCreature).Connection,0x16, + "%s is already member of %s party.",(this_00->super_TCreature).Name, + pcVar4); + } + else { + SendMessage((this->super_TCreature).Connection,0x16,"You may not invite players."); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Host_local + +void RevokeInvitation(ulong Host,ulong Guest) + +{ + TPlayer *this; + TPlayer *pTVar1; + ulong uVar2; + TConnection *Connection; + ulong *puVar3; + ulong *puVar4; + TParty *pTVar5; + int Position; + int iVar6; + int i; + int i_1; + int iVar7; + char *pcVar8; + TParty *local_24; + TPlayer *guest; + TPlayer *host; + ulong Guest_local; + ulong Host_local; + + if (Host == Guest) { + return; + } + this = GetPlayer(Host); + if (this == (TPlayer *)0x0) { + Host = (ulong)s_RevokeInvitation__Einladender_Sp_08100fc0; +LAB_0809c05e: + error((char *)Host); + return; + } + pTVar1 = GetPlayer(Guest); + uVar2 = TPlayer::GetPartyLeader(this,false); + if (uVar2 == Host) { + iVar6 = 0; + if (0 < Parties) { + do { + pTVar5 = vector::operator()(&Party,iVar6); + if (pTVar5->Leader == Host) { + local_24 = vector::operator()(&Party,iVar6); + goto LAB_0809be65; + } + iVar6 = iVar6 + 1; + } while (iVar6 < Parties); + } + local_24 = (TParty *)0x0; +LAB_0809be65: + if (local_24 == (TParty *)0x0) { + Host = (ulong)&DAT_08100f80; + goto LAB_0809c05e; + } + i = -1; + iVar6 = local_24->InvitedPlayers; + if (0 < iVar6) { + iVar7 = 0; + do { + puVar3 = vector<>::operator()(&local_24->InvitedPlayer,iVar7); + iVar6 = local_24->InvitedPlayers; + if (*puVar3 == Guest) { + i = iVar7; + } + iVar7 = iVar7 + 1; + } while (iVar7 < iVar6); + } + if (i != -1) { + if (i < iVar6 + -1) { + do { + iVar7 = i + 1; + puVar3 = vector<>::operator()(&local_24->InvitedPlayer,i); + puVar4 = vector<>::operator()(&local_24->InvitedPlayer,iVar7); + *puVar3 = *puVar4; + iVar6 = local_24->InvitedPlayers; + i = iVar7; + } while (iVar7 < iVar6 + -1); + } + local_24->InvitedPlayers = iVar6 + -1; + if (pTVar1 == (TPlayer *)0x0) { + SendMessage((this->super_TCreature).Connection,0x16,"Invitation has been revoked."); + } + else { + SendMessage((this->super_TCreature).Connection,0x16, + "Invitation for %s has been revoked.",(pTVar1->super_TCreature).Name); + pcVar8 = "his"; + if ((this->super_TCreature).Sex != 1) { + pcVar8 = "her"; + } + SendMessage((pTVar1->super_TCreature).Connection,0x16, + "%s has revoked %s invitation.",(this->super_TCreature).Name,pcVar8); + SendCreatureParty((this->super_TCreature).Connection,Guest); + SendCreatureParty((pTVar1->super_TCreature).Connection,Host); + } + if (local_24->Members != 1) { + return; + } + if (local_24->InvitedPlayers != 0) { + return; + } + DisbandParty(Host); + return; + } + if (pTVar1 != (TPlayer *)0x0) { + SendMessage((this->super_TCreature).Connection,0x16,"%s has not been invited.", + (pTVar1->super_TCreature).Name); + return; + } + Connection = (this->super_TCreature).Connection; + pcVar8 = "This player has not been invited."; + } + else { + Connection = (this->super_TCreature).Connection; + pcVar8 = "You may not invite players."; + } + SendMessage(Connection,0x16,pcVar8); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Guest_local + +void JoinParty(ulong Guest,ulong Host) + +{ + vector<> *this; + TPlayer *this_00; + TPlayer *pTVar1; + ulong uVar2; + ulong *puVar3; + ulong *puVar4; + ulong uVar5; + int i; + int iVar6; + int i_2; + char *pcVar7; + TParty *pTVar8; + TConnection *pTVar9; + char *Text; + int local_24; + int Position; + TPlayer *host; + TPlayer *guest; + ulong Host_local; + ulong Guest_local; + + if (Guest != Host) { + this_00 = GetPlayer(Guest); + if (this_00 == (TPlayer *)0x0) { + error("JoinParty: Eingeladener Spieler %lu existiert nicht.\n"); + return; + } + pTVar1 = GetPlayer(Host); + if (pTVar1 == (TPlayer *)0x0) { + SendResult((this_00->super_TCreature).Connection,PLAYERNOTONLINE); + return; + } + uVar2 = TPlayer::GetPartyLeader(this_00,true); + if (uVar2 == 0) { + iVar6 = 0; + if (0 < Parties) { + do { + pTVar8 = vector::operator()(&Party,iVar6); + if (pTVar8->Leader == Host) { + pTVar8 = vector::operator()(&Party,iVar6); + goto LAB_0809c131; + } + iVar6 = iVar6 + 1; + } while (iVar6 < Parties); + } + pTVar8 = (TParty *)0x0; +LAB_0809c131: + local_24 = -1; + if ((pTVar8 != (TParty *)0x0) && (iVar6 = 0, 0 < pTVar8->InvitedPlayers)) { + do { + puVar3 = vector<>::operator()(&pTVar8->InvitedPlayer,iVar6); + if (*puVar3 == Guest) { + local_24 = iVar6; + } + iVar6 = iVar6 + 1; + } while (iVar6 < pTVar8->InvitedPlayers); + } + if (local_24 != -1) { + this = &pTVar8->Member; + puVar3 = vector<>::operator()(this,pTVar8->Members); + *puVar3 = Guest; + pTVar8->Members = pTVar8->Members + 1; + pTVar8->InvitedPlayers = pTVar8->InvitedPlayers + -1; + puVar3 = vector<>::operator()(&pTVar8->InvitedPlayer,local_24); + puVar4 = vector<>::operator()(&pTVar8->InvitedPlayer,pTVar8->InvitedPlayers); + *puVar3 = *puVar4; + TPlayer::JoinParty(this_00,Host); + SendMessage((this_00->super_TCreature).Connection,0x16, + "You have joined %s\'s party.",(pTVar1->super_TCreature).Name); + iVar6 = 0; + SendCreatureParty((this_00->super_TCreature).Connection,Guest); + SendCreatureSkull((this_00->super_TCreature).Connection,Guest); + if (pTVar8->Members < 1) { + return; + } + do { + puVar3 = vector<>::operator()(this,iVar6); + if (*puVar3 != Guest) { + pTVar9 = (this_00->super_TCreature).Connection; + puVar3 = vector<>::operator()(this,iVar6); + SendCreatureParty(pTVar9,*puVar3); + pTVar9 = (this_00->super_TCreature).Connection; + puVar3 = vector<>::operator()(this,iVar6); + SendCreatureSkull(pTVar9,*puVar3); + puVar3 = vector<>::operator()(this,iVar6); + pTVar1 = GetPlayer(*puVar3); + if (pTVar1 != (TPlayer *)0x0) { + SendMessage((pTVar1->super_TCreature).Connection,0x16, + "%s has joined the party.",(this_00->super_TCreature).Name); + SendCreatureParty((pTVar1->super_TCreature).Connection,Guest); + SendCreatureSkull((pTVar1->super_TCreature).Connection,Guest); + } + } + iVar6 = iVar6 + 1; + } while (iVar6 < pTVar8->Members); + return; + } + pTVar9 = (this_00->super_TCreature).Connection; + pcVar7 = (pTVar1->super_TCreature).Name; + Text = "%s has not invited you."; + } + else { + pcVar7 = "this"; + uVar2 = TPlayer::GetPartyLeader(this_00,true); + uVar5 = TPlayer::GetPartyLeader(pTVar1,true); + if (uVar2 != uVar5) { + pcVar7 = "a"; + } + pTVar9 = (this_00->super_TCreature).Connection; + Text = "You are already member of %s party."; + } + SendMessage(pTVar9,0x16,Text,pcVar7); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: oldLeader + +void PassLeadership(ulong OldLeader,ulong NewLeader) + +{ + TPlayer *pl; + TPlayer *this; + TPlayer *pTVar1; + ulong uVar2; + ulong *puVar3; + TPlayer *pTVar4; + TParty *pTVar5; + int i; + int iVar6; + int iVar7; + int InvitedPlayers; + int i_2; + TPlayer *newLeader; + TPlayer *oldLeader; + + if (OldLeader != NewLeader) { + this = GetPlayer(OldLeader); + if (this == (TPlayer *)0x0) { + OldLeader = (ulong)&DAT_08101160; +LAB_0809c6c4: + error((char *)OldLeader); + return; + } + pTVar1 = GetPlayer(NewLeader); + if (pTVar1 == (TPlayer *)0x0) { + SendResult((this->super_TCreature).Connection,PLAYERNOTONLINE); + return; + } + uVar2 = TPlayer::GetPartyLeader(this,false); + if (uVar2 == OldLeader) { + uVar2 = TPlayer::GetPartyLeader(pTVar1,false); + if (uVar2 == OldLeader) { + iVar6 = 0; + if (0 < Parties) { + do { + pTVar5 = vector::operator()(&Party,iVar6); + if (pTVar5->Leader == OldLeader) { + i_2 = (int)vector::operator()(&Party,iVar6); + goto LAB_0809c51b; + } + iVar6 = iVar6 + 1; + } while (iVar6 < Parties); + } + i_2 = 0; +LAB_0809c51b: + if (i_2 == 0) { + OldLeader = (ulong)&DAT_08101120; + goto LAB_0809c6c4; + } + iVar7 = 0; + iVar6 = *(int *)(i_2 + 0x24); + *(ulong *)i_2 = NewLeader; + if (0 < iVar6) { + do { + puVar3 = vector<>::operator()((vector<> *)(i_2 + 4),iVar7); + pTVar4 = GetPlayer(*puVar3); + if (pTVar4 != (TPlayer *)0x0) { + TPlayer::JoinParty(pTVar4,NewLeader); + } + iVar7 = iVar7 + 1; + iVar6 = *(int *)(i_2 + 0x24); + } while (iVar7 < iVar6); + } + InvitedPlayers = 0; + if (0 < iVar6) { + do { + puVar3 = vector<>::operator()((vector<> *)(i_2 + 4),InvitedPlayers); + pTVar4 = GetPlayer(*puVar3); + if (pTVar4 != (TPlayer *)0x0) { + if (pTVar4 == pTVar1) { + SendMessage((pTVar4->super_TCreature).Connection,0x16, + "You are now leader of your party."); + } + else { + SendMessage((pTVar4->super_TCreature).Connection,0x16, + "%s is now leader of your party.", + (pTVar1->super_TCreature).Name); + } + SendCreatureParty((pTVar4->super_TCreature).Connection,OldLeader); + SendCreatureParty((pTVar4->super_TCreature).Connection,NewLeader); + } + InvitedPlayers = InvitedPlayers + 1; + } while (InvitedPlayers < *(int *)(i_2 + 0x24)); + } + iVar6 = *(int *)(i_2 + 0x48); + iVar7 = 0; + *(undefined4 *)(i_2 + 0x48) = 0; + if (0 < iVar6) { + do { + puVar3 = vector<>::operator()((vector<> *)(i_2 + 0x28),iVar7); + pTVar1 = GetPlayer(*puVar3); + if (pTVar1 != (TPlayer *)0x0) { + SendCreatureParty((pTVar1->super_TCreature).Connection,OldLeader); + SendCreatureParty((this->super_TCreature).Connection, + (pTVar1->super_TCreature).ID); + } + iVar7 = iVar7 + 1; + } while (iVar7 < iVar6); + } + } + else { + SendMessage((this->super_TCreature).Connection,0x16, + "%s is not member of your party.",(pTVar1->super_TCreature).Name); + } + } + else { + SendMessage((this->super_TCreature).Connection,0x16,"You are not leader of a party."); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Member_local + +void LeaveParty(ulong Member,bool Forced) + +{ + vector<> *this; + TConnection *pTVar1; + ulong NewLeader; + TPlayer *this_00; + ulong uVar2; + ulong *puVar3; + ulong *puVar4; + TPlayer *pTVar5; + TParty *pTVar6; + int Position; + int iVar7; + int i; + int i_1; + int iVar8; + TParty *local_20; + TPlayer *member; + bool Forced_local; + ulong Member_local; + + this_00 = GetPlayer(Member); + if (this_00 == (TPlayer *)0x0) { + Member = (ulong)s_LeaveParty__Mitglied_existiert_n_081012c0; + } + else { + uVar2 = TPlayer::GetPartyLeader(this_00,false); + if (uVar2 != 0) { + if ((Forced) || ((this_00->super_TCreature).EarliestLogoutRound <= RoundNr)) { + iVar7 = 0; + uVar2 = TPlayer::GetPartyLeader(this_00,false); + if (0 < Parties) { + do { + pTVar6 = vector::operator()(&Party,iVar7); + if (pTVar6->Leader == uVar2) { + local_20 = vector::operator()(&Party,iVar7); + goto LAB_0809c7c8; + } + iVar7 = iVar7 + 1; + } while (iVar7 < Parties); + } + local_20 = (TParty *)0x0; +LAB_0809c7c8: + if (local_20 == (TParty *)0x0) { + TPlayer::GetPartyLeader(this_00,false); + error(&DAT_081011e0); + return; + } + iVar7 = local_20->Members; + if ((iVar7 == 1) || ((iVar7 == 2 && (local_20->InvitedPlayers == 0)))) { + DisbandParty(local_20->Leader); + return; + } + if (local_20->Leader == Member) { + puVar3 = vector<>::operator()(&local_20->Member,0); + uVar2 = *puVar3; + if (uVar2 == Member) { + puVar3 = vector<>::operator()(&local_20->Member,1); + uVar2 = *puVar3; + } + PassLeadership(Member,uVar2); + iVar7 = local_20->Members; + } + i = -1; + if (0 < iVar7) { + iVar8 = 0; + do { + puVar3 = vector<>::operator()(&local_20->Member,iVar8); + iVar7 = local_20->Members; + if (*puVar3 == Member) { + i = iVar8; + } + iVar8 = iVar8 + 1; + } while (iVar8 < iVar7); + } + if (i == -1) { + Member = (ulong)s_LeaveParty__Mitglied_nicht_gefun_081011a0; + goto LAB_0809c9e0; + } + if (i < iVar7 + -1) { + do { + iVar8 = i + 1; + puVar3 = vector<>::operator()(&local_20->Member,i); + puVar4 = vector<>::operator()(&local_20->Member,iVar8); + *puVar3 = *puVar4; + iVar7 = local_20->Members; + i = iVar8; + } while (iVar8 < iVar7 + -1); + } + local_20->Members = iVar7 + -1; + TPlayer::LeaveParty(this_00); + if (!Forced) { + SendMessage((this_00->super_TCreature).Connection,0x16, + "You have left the party."); + } + SendCreatureParty((this_00->super_TCreature).Connection,Member); + SendCreatureSkull((this_00->super_TCreature).Connection,Member); + if (0 < local_20->Members) { + this = &local_20->Member; + iVar7 = 0; + do { + pTVar1 = (this_00->super_TCreature).Connection; + puVar3 = vector<>::operator()(this,iVar7); + SendCreatureParty(pTVar1,*puVar3); + pTVar1 = (this_00->super_TCreature).Connection; + puVar3 = vector<>::operator()(this,iVar7); + SendCreatureSkull(pTVar1,*puVar3); + puVar3 = vector<>::operator()(this,iVar7); + pTVar5 = GetPlayer(*puVar3); + if (pTVar5 != (TPlayer *)0x0) { + SendMessage((pTVar5->super_TCreature).Connection,0x16, + "%s has left the party.",(this_00->super_TCreature).Name); + SendCreatureParty((pTVar5->super_TCreature).Connection,Member); + SendCreatureSkull((pTVar5->super_TCreature).Connection,Member); + } + iVar7 = iVar7 + 1; + } while (iVar7 < local_20->Members); + } + } + else { + SendMessage((this_00->super_TCreature).Connection,0x16, + "You may not leave your party during or immediately after a fight!"); + } + return; + } + Member = (ulong)s_LeaveParty__Spieler_ist_kein_Mit_08101280; + } +LAB_0809c9e0: + error((char *)Member); + return; +} + + + +void __tcf_0(void *param_1) + +{ + ulong *puVar1; + TChannel *pTVar2; + TChannel *pTVar3; + + if (Channel.entry != (TChannel *)0x0) { + pTVar2 = Channel.entry + Channel.entry[-1].InvitedPlayers; + while (Channel.entry != pTVar2) { + pTVar3 = pTVar2 + -1; + puVar1 = pTVar2[-1].InvitedPlayer.entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + puVar1 = pTVar2[-1].Subscriber.entry; + pTVar2 = pTVar3; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + } + operator_delete__(&Channel.entry[-1].InvitedPlayers); + } + if (Channel.init.InvitedPlayer.entry != (ulong *)0x0) { + operator_delete__(Channel.init.InvitedPlayer.entry); + } + if (Channel.init.Subscriber.entry != (ulong *)0x0) { + operator_delete__(Channel.init.Subscriber.entry); + return; + } + return; +} + + + +void __tcf_1(void *param_1) + +{ + if (Statements.Entry == (TStatement *)0x0) { + return; + } + operator_delete__(Statements.Entry); + return; +} + + + +void __tcf_2(void *param_1) + +{ + if (Listeners.Entry == (TListener *)0x0) { + return; + } + operator_delete__(Listeners.Entry); + return; +} + + + +void __tcf_3(void *param_1) + +{ + ulong *puVar1; + TParty *pTVar2; + TParty *pTVar3; + + if (Party.entry != (TParty *)0x0) { + pTVar2 = Party.entry + Party.entry[-1].InvitedPlayers; + while (Party.entry != pTVar2) { + pTVar3 = pTVar2 + -1; + puVar1 = pTVar2[-1].InvitedPlayer.entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + puVar1 = pTVar2[-1].Member.entry; + pTVar2 = pTVar3; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + } + operator_delete__(&Party.entry[-1].InvitedPlayers); + } + if (Party.init.InvitedPlayer.entry != (ulong *)0x0) { + operator_delete__(Party.init.InvitedPlayer.entry); + } + if (Party.init.Member.entry != (ulong *)0x0) { + operator_delete__(Party.init.Member.entry); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_Channel(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void TChannel(TChannel * this) + +void __thiscall TChannel::TChannel(TChannel *this) + +{ + vector<>::vector(&this->Subscriber,0,10,10); + // try { // try from 0809ccd0 to 0809ccd4 has its CatchHandler @ 0809ccf3 + vector<>::vector(&this->InvitedPlayer,0,10,10); + this->Moderator = 0; + this->Subscribers = 0; + this->InvitedPlayers = 0; + return; +} + + + +// DWARF original prototype: void TParty(TParty * this) + +void __thiscall TParty::TParty(TParty *this) + +{ + vector<>::vector(&this->Member,0,10,10); + // try { // try from 0809cd60 to 0809cd64 has its CatchHandler @ 0809cd83 + vector<>::vector(&this->InvitedPlayer,0,10,10); + this->Leader = 0; + this->Members = 0; + this->InvitedPlayers = 0; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int +// block) + +void __thiscall vector<>::vector(vector<> *this,int min,int max,int block) + +{ + ulong *puVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + puVar1 = (ulong *)operator_new__(this->space << 2); + this->entry = puVar1; + return; +} + + + +// DWARF original prototype: TChannel * operator()(vector * this, int i) + +TChannel * __thiscall vector::operator()(vector *this,int i) + +{ + int j; + int *piVar1; + int iVar2; + int iVar3; + int iVar4; + TChannel *pTVar5; + int iVar6; + ulong *puVar7; + TChannel *pTVar8; + TChannel *pTVar9; + int extend_1; + int local_90; + int extend; + uchar Help [108]; + + iVar2 = this->start; + while (i < iVar2) { + local_90 = this->block; + if (local_90 == 0) { + iVar2 = this->space; + local_90 = iVar2; + } + else { + iVar2 = this->space; + } + iVar2 = local_90 + iVar2; + piVar1 = (int *)operator_new__(iVar2 * 0x6c + 4); + *piVar1 = iVar2; + pTVar9 = (TChannel *)(piVar1 + 1); + pTVar5 = pTVar9; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 0809ceaf to 0809ceb3 has its CatchHandler @ 0809d21b + TChannel::TChannel(pTVar5); + pTVar5 = pTVar5 + 1; + } + iVar2 = this->min; + if (iVar2 <= this->max) { + do { + pTVar5 = pTVar9 + (iVar2 - this->start) + local_90; + puVar7 = (ulong *)&extend; + for (iVar3 = 0x1b; iVar3 != 0; iVar3 = iVar3 + -1) { + *puVar7 = pTVar5->Moderator; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + puVar7 = puVar7 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar8 = pTVar9 + local_90 + iVar6; + for (iVar3 = 0x1b; iVar3 != 0; iVar3 = iVar3 + -1) { + pTVar8->Moderator = pTVar5->Moderator; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + pTVar8 = (TChannel *)pTVar8->ModeratorName; + } + iVar3 = iVar2 + 1; + puVar7 = (ulong *)&extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Moderator = *puVar7; + puVar7 = puVar7 + 1; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + } + iVar2 = iVar3; + } while (iVar3 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TChannel *)0x0) { + pTVar8 = pTVar5 + pTVar5[-1].InvitedPlayers; + while (pTVar5 != pTVar8) { + puVar7 = pTVar8[-1].InvitedPlayer.entry; + if (puVar7 != (ulong *)0x0) { + operator_delete__(puVar7); + } + puVar7 = pTVar8[-1].Subscriber.entry; + if (puVar7 != (ulong *)0x0) { + operator_delete__(puVar7); + } + pTVar8 = pTVar8 + -1; + pTVar5 = this->entry; + } + operator_delete__(&pTVar5[-1].InvitedPlayers); + } + this->entry = pTVar9; + iVar2 = this->start - local_90; + this->start = iVar2; + this->space = this->space + local_90; + } + iVar6 = this->space; + iVar3 = iVar6 + iVar2; + while (iVar3 <= i) { + iVar3 = iVar6; + if (this->block != 0) { + iVar3 = this->block; + } + iVar6 = iVar3 + iVar6; + piVar1 = (int *)operator_new__(iVar6 * 0x6c + 4); + *piVar1 = iVar6; + pTVar9 = (TChannel *)(piVar1 + 1); + pTVar5 = pTVar9; + while (iVar6 = iVar6 + -1, iVar6 != -1) { + // try { // try from 0809d04d to 0809d051 has its CatchHandler @ 0809d29c + TChannel::TChannel(pTVar5); + pTVar5 = pTVar5 + 1; + } + if (this->min <= this->max) { + iVar2 = this->min; + do { + pTVar5 = pTVar9 + (iVar2 - this->start); + puVar7 = (ulong *)&extend; + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + *puVar7 = pTVar5->Moderator; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + puVar7 = puVar7 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar8 = pTVar9 + iVar6; + for (iVar4 = 0x1b; iVar4 != 0; iVar4 = iVar4 + -1) { + pTVar8->Moderator = pTVar5->Moderator; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + pTVar8 = (TChannel *)pTVar8->ModeratorName; + } + iVar6 = iVar2 + 1; + puVar7 = (ulong *)&extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar4 = 0x1b; iVar4 != 0; iVar4 = iVar4 + -1) { + pTVar5->Moderator = *puVar7; + puVar7 = puVar7 + 1; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + } + iVar2 = iVar6; + } while (iVar6 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TChannel *)0x0) { + pTVar8 = pTVar5 + pTVar5[-1].InvitedPlayers; + while (pTVar5 != pTVar8) { + puVar7 = pTVar8[-1].InvitedPlayer.entry; + if (puVar7 != (ulong *)0x0) { + operator_delete__(puVar7); + } + puVar7 = pTVar8[-1].Subscriber.entry; + if (puVar7 != (ulong *)0x0) { + operator_delete__(puVar7); + } + pTVar8 = pTVar8 + -1; + pTVar5 = this->entry; + } + operator_delete__(&pTVar5[-1].InvitedPlayers); + } + iVar2 = this->start; + this->entry = pTVar9; + iVar6 = iVar3 + this->space; + this->space = iVar6; + iVar3 = iVar6 + iVar2; + } + iVar3 = this->min; + while (i < iVar3) { + this->min = iVar3 + -1; + if (this->initialized != false) { + pTVar9 = &this->init; + pTVar5 = this->entry + ((iVar3 + -1) - iVar2); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Moderator = pTVar9->Moderator; + pTVar9 = (TChannel *)pTVar9->ModeratorName; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + } + iVar2 = this->start; + } + iVar3 = this->min; + } + iVar3 = this->max; + while (iVar3 < i) { + this->max = iVar3 + 1; + if (this->initialized != false) { + pTVar9 = &this->init; + pTVar5 = this->entry + ((iVar3 + 1) - iVar2); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Moderator = pTVar9->Moderator; + pTVar9 = (TChannel *)pTVar9->ModeratorName; + pTVar5 = (TChannel *)pTVar5->ModeratorName; + } + iVar2 = this->start; + } + iVar3 = this->max; + } + return this->entry + (i - iVar2); +} + + + +// WARNING: Variable defined which should be unmapped: extend +// DWARF original prototype: ulong * operator()(vector * this, int i) + +ulong * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ulong uVar1; + ulong *puVar2; + int iVar3; + int iVar4; + int j_1; + int j; + int iVar5; + int extend_1; + ulong *help; + int extend; + + iVar3 = this->start; + while (i < iVar3) { + help = (ulong *)this->block; + if (help == (ulong *)0x0) { + puVar2 = (ulong *)this->space; + help = puVar2; + } + else { + puVar2 = (ulong *)this->space; + } + puVar2 = (ulong *)operator_new__(((int)help + (int)puVar2) * 4); + iVar3 = this->min; + if (this->min <= this->max) { + do { + iVar4 = iVar3 - this->start; + iVar5 = (int)help + iVar4; + uVar1 = puVar2[iVar5]; + puVar2[iVar5] = this->entry[iVar4]; + iVar5 = iVar3 + 1; + this->entry[iVar3 - this->start] = uVar1; + iVar3 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (ulong *)0x0) { + operator_delete__(this->entry); + } + this->entry = puVar2; + iVar3 = this->start - (int)help; + this->start = iVar3; + this->space = this->space + (int)help; + } + iVar4 = this->space; + iVar5 = iVar4 + iVar3; + while (iVar5 <= i) { + iVar5 = iVar4; + if (this->block != 0) { + iVar5 = this->block; + } + puVar2 = (ulong *)operator_new__((iVar5 + iVar4) * 4); + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar4 = iVar3 - this->start; + uVar1 = puVar2[iVar4]; + puVar2[iVar4] = this->entry[iVar4]; + iVar4 = iVar3 + 1; + this->entry[iVar3 - this->start] = uVar1; + iVar3 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (ulong *)0x0) { + operator_delete__(this->entry); + } + this->entry = puVar2; + iVar3 = this->start; + iVar4 = iVar5 + this->space; + this->space = iVar4; + iVar5 = iVar4 + iVar3; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + this->entry[(iVar5 + -1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + this->entry[(iVar5 + 1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar3); +} + + + +// DWARF original prototype: TStatement * append(fifo * this) + +TStatement * __thiscall fifo::append(fifo *this) + +{ + TStatement *pTVar1; + undefined3 uVar2; + TStatement *pTVar3; + int iVar4; + int iVar5; + int iVar6; + int i; + int iVar7; + TStatement *NewEntry; + + iVar5 = this->Head; + iVar6 = this->Size; + iVar4 = iVar6; + if ((iVar5 - this->Tail) + 1 == iVar6) { + iVar4 = iVar6 * 2; + pTVar3 = (TStatement *)operator_new__(iVar6 * 0x38); + iVar5 = this->Head; + iVar6 = this->Tail; + if (iVar6 <= iVar5) { + do { + iVar5 = iVar6 % iVar4; + iVar7 = iVar6 + 1; + iVar6 = iVar6 % this->Size; + pTVar1 = this->Entry; + pTVar3[iVar5].StatementID = pTVar1[iVar6].StatementID; + pTVar3[iVar5].TimeStamp = pTVar1[iVar6].TimeStamp; + pTVar3[iVar5].CharacterID = pTVar1[iVar6].CharacterID; + pTVar3[iVar5].Mode = pTVar1[iVar6].Mode; + pTVar3[iVar5].Channel = pTVar1[iVar6].Channel; + pTVar3[iVar5].Text = pTVar1[iVar6].Text; + uVar2 = *(undefined3 *)&pTVar1[iVar6].field_0x19; + pTVar3[iVar5].Reported = pTVar1[iVar6].Reported; + *(undefined3 *)&pTVar3[iVar5].field_0x19 = uVar2; + iVar5 = this->Head; + iVar6 = iVar7; + } while (iVar7 <= iVar5); + } + if (this->Entry != (TStatement *)0x0) { + operator_delete__(this->Entry); + iVar5 = this->Head; + } + this->Entry = pTVar3; + this->Size = iVar4; + } + this->Head = iVar5 + 1; + return this->Entry + (iVar5 + 1) % iVar4; +} + + + +// DWARF original prototype: TListener * append(fifo * this) + +TListener * __thiscall fifo::append(fifo *this) + +{ + ulong uVar1; + TListener *pTVar2; + int iVar3; + int iVar4; + int i; + int iVar5; + int iVar6; + TListener *NewEntry; + + iVar3 = this->Head; + iVar5 = this->Size; + iVar4 = iVar5; + if ((iVar3 - this->Tail) + 1 == iVar5) { + iVar4 = iVar5 * 2; + pTVar2 = (TListener *)operator_new__(iVar5 << 4); + iVar5 = this->Tail; + iVar3 = this->Head; + if (iVar5 <= iVar3) { + do { + iVar6 = iVar5 + 1; + uVar1 = this->Entry[iVar5 % this->Size].CharacterID; + pTVar2[iVar5 % iVar4].StatementID = this->Entry[iVar5 % this->Size].StatementID; + pTVar2[iVar5 % iVar4].CharacterID = uVar1; + iVar3 = this->Head; + iVar5 = iVar6; + } while (iVar6 <= iVar3); + } + if (this->Entry != (TListener *)0x0) { + operator_delete__(this->Entry); + iVar3 = this->Head; + } + this->Entry = pTVar2; + this->Size = iVar4; + } + this->Head = iVar3 + 1; + return this->Entry + (iVar3 + 1) % iVar4; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int +// block) + +void __thiscall vector<>::vector(vector<> *this,int min,int max,int block) + +{ + TReportedStatement *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (TReportedStatement *)operator_new__(this->space * 0x114); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: TParty * operator()(vector * this, int i) + +TParty * __thiscall vector::operator()(vector *this,int i) + +{ + int *piVar1; + int iVar2; + int iVar3; + int iVar4; + TParty *pTVar5; + int j_1; + int iVar6; + int j; + TParty *pTVar7; + ulong *puVar8; + TParty *pTVar9; + int extend_1; + int local_70; + int extend; + uchar Help [76]; + + iVar2 = this->start; + while (i < iVar2) { + local_70 = this->block; + if (local_70 == 0) { + iVar2 = this->space; + local_70 = iVar2; + } + else { + iVar2 = this->space; + } + iVar2 = local_70 + iVar2; + piVar1 = (int *)operator_new__(iVar2 * 0x4c + 4); + *piVar1 = iVar2; + pTVar9 = (TParty *)(piVar1 + 1); + pTVar5 = pTVar9; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 0809d7c5 to 0809d7c9 has its CatchHandler @ 0809db35 + TParty::TParty(pTVar5); + pTVar5 = pTVar5 + 1; + } + iVar2 = this->min; + if (iVar2 <= this->max) { + do { + pTVar5 = pTVar9 + (iVar2 - this->start) + local_70; + puVar8 = (ulong *)&extend; + for (iVar3 = 0x13; iVar3 != 0; iVar3 = iVar3 + -1) { + *puVar8 = pTVar5->Leader; + pTVar5 = (TParty *)&pTVar5->Member; + puVar8 = puVar8 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar7 = pTVar9 + local_70 + iVar6; + for (iVar3 = 0x13; iVar3 != 0; iVar3 = iVar3 + -1) { + pTVar7->Leader = pTVar5->Leader; + pTVar5 = (TParty *)&pTVar5->Member; + pTVar7 = (TParty *)&pTVar7->Member; + } + iVar6 = iVar2 + 1; + puVar8 = (ulong *)&extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar3 = 0x13; iVar3 != 0; iVar3 = iVar3 + -1) { + pTVar5->Leader = *puVar8; + puVar8 = puVar8 + 1; + pTVar5 = (TParty *)&pTVar5->Member; + } + iVar2 = iVar6; + } while (iVar6 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TParty *)0x0) { + pTVar7 = pTVar5 + pTVar5[-1].InvitedPlayers; + while (pTVar5 != pTVar7) { + puVar8 = pTVar7[-1].InvitedPlayer.entry; + if (puVar8 != (ulong *)0x0) { + operator_delete__(puVar8); + } + puVar8 = pTVar7[-1].Member.entry; + if (puVar8 == (ulong *)0x0) { + pTVar5 = this->entry; + pTVar7 = pTVar7 + -1; + } + else { + operator_delete__(puVar8); + pTVar5 = this->entry; + pTVar7 = pTVar7 + -1; + } + } + operator_delete__(&pTVar5[-1].InvitedPlayers); + } + this->entry = pTVar9; + iVar2 = this->start - local_70; + this->start = iVar2; + this->space = this->space + local_70; + } + iVar6 = this->space; + iVar3 = iVar6 + iVar2; + while (iVar3 <= i) { + iVar3 = iVar6; + if (this->block != 0) { + iVar3 = this->block; + } + iVar6 = iVar3 + iVar6; + piVar1 = (int *)operator_new__(iVar6 * 0x4c + 4); + pTVar9 = (TParty *)(piVar1 + 1); + *piVar1 = iVar6; + pTVar5 = pTVar9; + while (iVar6 = iVar6 + -1, iVar6 != -1) { + // try { // try from 0809d949 to 0809d94d has its CatchHandler @ 0809dba6 + TParty::TParty(pTVar5); + pTVar5 = pTVar5 + 1; + } + if (this->min <= this->max) { + iVar2 = this->min; + do { + pTVar5 = pTVar9 + (iVar2 - this->start); + puVar8 = (ulong *)&extend; + for (iVar6 = 0x13; iVar6 != 0; iVar6 = iVar6 + -1) { + *puVar8 = pTVar5->Leader; + pTVar5 = (TParty *)&pTVar5->Member; + puVar8 = puVar8 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar7 = pTVar9 + iVar6; + for (iVar4 = 0x13; iVar4 != 0; iVar4 = iVar4 + -1) { + pTVar7->Leader = pTVar5->Leader; + pTVar5 = (TParty *)&pTVar5->Member; + pTVar7 = (TParty *)&pTVar7->Member; + } + iVar4 = iVar2 + 1; + puVar8 = (ulong *)&extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar6 = 0x13; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Leader = *puVar8; + puVar8 = puVar8 + 1; + pTVar5 = (TParty *)&pTVar5->Member; + } + iVar2 = iVar4; + } while (iVar4 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TParty *)0x0) { + pTVar7 = pTVar5 + pTVar5[-1].InvitedPlayers; + while (pTVar5 != pTVar7) { + puVar8 = pTVar7[-1].InvitedPlayer.entry; + if (puVar8 != (ulong *)0x0) { + operator_delete__(puVar8); + } + puVar8 = pTVar7[-1].Member.entry; + if (puVar8 == (ulong *)0x0) { + pTVar5 = this->entry; + pTVar7 = pTVar7 + -1; + } + else { + operator_delete__(puVar8); + pTVar5 = this->entry; + pTVar7 = pTVar7 + -1; + } + } + operator_delete__(&pTVar5[-1].InvitedPlayers); + } + this->entry = pTVar9; + iVar2 = this->start; + iVar6 = iVar3 + this->space; + this->space = iVar6; + iVar3 = iVar6 + iVar2; + } + iVar3 = this->min; + while (i < iVar3) { + this->min = iVar3 + -1; + if (this->initialized != false) { + pTVar9 = &this->init; + pTVar5 = this->entry + ((iVar3 + -1) - iVar2); + for (iVar6 = 0x13; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Leader = pTVar9->Leader; + pTVar9 = (TParty *)&pTVar9->Member; + pTVar5 = (TParty *)&pTVar5->Member; + } + iVar2 = this->start; + } + iVar3 = this->min; + } + iVar3 = this->max; + while (iVar3 < i) { + this->max = iVar3 + 1; + if (this->initialized != false) { + pTVar9 = &this->init; + pTVar5 = this->entry + ((iVar3 + 1) - iVar2); + for (iVar6 = 0x13; iVar6 != 0; iVar6 = iVar6 + -1) { + pTVar5->Leader = pTVar9->Leader; + pTVar9 = (TParty *)&pTVar9->Member; + pTVar5 = (TParty *)&pTVar5->Member; + } + iVar2 = this->start; + } + iVar3 = this->max; + } + return this->entry + (i - iVar2); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + vector<> *pvVar1; + priority_queue_entry<> *ppVar2; + vector<> *pvVar3; + priority_queue_entry<> *ppVar4; + int i; + int iVar5; + TRaceData *this; + int local_14; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + CreatureList.initialized = true; + CreatureList.max = 10000; + CreatureList.space = 0x2711; + CreatureList.block = 1000; + CreatureList.start = 0; + CreatureList.min = 0; + CreatureList.init = (TCreature *)0x0; + CreatureList.entry = (TCreature **)operator_new__(0x9c44); + iVar5 = 0; + if (0 < CreatureList.space) { + do { + CreatureList.entry[iVar5] = (TCreature *)0x0; + iVar5 = iVar5 + 1; + } while (iVar5 < CreatureList.space); + } + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + local_14 = 0x1ff; + this = RaceData; + do { + // try { // try from 0809dd7f to 0809dd83 has its CatchHandler @ 0809de53 + TRaceData::TRaceData(this); + local_14 = local_14 + -1; + this = this + 1; + } while (local_14 != -1); + __cxa_atexit(__tcf_1,0,&__dso_handle); + } + if (__initialize_p == 1) { + pvVar3 = (vector<> *)operator_new(0x24); + pvVar3->min = 1; + pvVar3->max = 5000; + pvVar3->start = 1; + pvVar3->space = 5000; + pvVar3->block = 1000; + pvVar3->initialized = false; + // try { // try from 0809dd38 to 0809dd3c has its CatchHandler @ 0809dee5 + ppVar4 = (priority_queue_entry<> *)operator_new__(40000); + pvVar3->entry = ppVar4; + ToDoQueue.Entries = 0; + ToDoQueue.Entry = pvVar3; + __cxa_atexit(__tcf_2,0,&__dso_handle); + pvVar1 = (vector<> *)operator_new(0x24); + pvVar1->min = 1; + pvVar1->max = 100; + pvVar1->start = 1; + pvVar1->space = 100; + pvVar1->block = 100; + pvVar1->initialized = false; + // try { // try from 0809dcc6 to 0809dcca has its CatchHandler @ 0809df01 + ppVar2 = (priority_queue_entry<> *)operator_new__(800); + pvVar1->entry = ppVar2; + AttackWaveQueue.Entries = 0; + AttackWaveQueue.Entry = pvVar1; + __cxa_atexit(__tcf_3,0,&__dso_handle); + } + } + return; +} + + + +TCreature * GetCreature(ulong id) + +{ + TCreature *pTVar1; + ulong m; + + if ((id != 0) && (pTVar1 = HashList[id % 1000], pTVar1 != (TCreature *)0x0)) { + if (pTVar1->ID == id) { + return pTVar1; + } + for (pTVar1 = pTVar1->NextHashEntry; pTVar1 != (TCreature *)0x0; + pTVar1 = pTVar1->NextHashEntry) { + if (pTVar1->ID == id) { + return pTVar1; + } + } + } + return (TCreature *)0x0; +} + + + +TCreature * GetCreature(Object *Obj) + +{ + ulong id; + TCreature *pTVar1; + + id = Object::getCreatureID(Obj); + pTVar1 = GetCreature(id); + return pTVar1; +} + + + +bool IsCreaturePlayer(ulong CreatureID) + +{ + return CreatureID < 0x40000000; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessSkills(void) + +{ + TCreature *pTVar1; + TCreature *cr; + TCreature **ppTVar2; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreeCreature) { + do { + ppTVar2 = vector::operator()(&CreatureList,i_00); + pTVar1 = *ppTVar2; + if (pTVar1 == (TCreature *)0x0) { + error("ProcessSkills: Kreatur %d existiert nicht.\n",i_00); + } + else if ((pTVar1->super_TSkillBase).FirstFreeTimer != 0) { + TSkillBase::ProcessSkills(&pTVar1->super_TSkillBase); + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeCreature); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessCreatures(void) + +{ + TPlayer *this; + bool bVar1; + TCreature **ppTVar2; + int iVar3; + uint uVar4; + CreatureType CVar5; + TCreature *cr; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreeCreature) { + do { + ppTVar2 = vector::operator()(&CreatureList,i_00); + this = (TPlayer *)*ppTVar2; + if (this == (TPlayer *)0x0) { + error("ProcessCreatures: Kreatur %d existiert nicht.\n",i_00); + } + else { + iVar3 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0xe]); + if ((((iVar3 < 1) || + (uVar4 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0xe]), + RoundNr % uVar4 != 0)) || ((this->super_TCreature).IsDead != false)) || + (bVar1 = IsProtectionZone(), bVar1)) { +LAB_0809e093: + if ((this->super_TCreature).Type == PLAYER) { + CVar5 = PLAYER; + if ((this->super_TCreature).Connection != (TConnection *)0x0) { + TPlayer::CheckState(this); + CVar5 = (this->super_TCreature).Type; + } + if (((CVar5 == PLAYER) && + (uVar4 = (this->super_TCreature).EarliestLogoutRound, uVar4 != 0)) && + (uVar4 <= RoundNr)) { + TPlayer::ClearPlayerkillingMarks(this); + (this->super_TCreature).EarliestLogoutRound = 0; + } + } + } + else { + TSkill::Change((this->super_TCreature).super_TSkillBase.Skills[2],1); + TSkill::Change((this->super_TCreature).super_TSkillBase.Skills[3],4); + if ((this->super_TCreature).Type == PLAYER) { + SendPlayerData((this->super_TCreature).Connection); + goto LAB_0809e093; + } + } + if (((this->super_TCreature).IsDead == false) && + (iVar3 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[2]), + iVar3 < 1)) { + error("ProcessCreatures: Kreatur %s ist nicht tot, obwohl sie keine HP mehr hat.\n" + ,(this->super_TCreature).Name); + (*(this->super_TCreature)._vptr_TCreature[2])(this); + } + if (((this->super_TCreature).LoggingOut != false) && + (iVar3 = TCreature::LogoutPossible((TCreature *)this), iVar3 == 0)) { + if (((this->super_TCreature).IsDead != false) && + (iVar3 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[2]), + 0 < iVar3)) { + error("ProcessCreatures: Kreatur %s hat HP, obwohl sie tot ist.\n", + (this->super_TCreature).Name); + (*(this->super_TCreature).super_TSkillBase.Skills[2]->_vptr_TSkill[2]) + ((this->super_TCreature).super_TSkillBase.Skills[2],0); + } + if (this != (TPlayer *)0x0) { + (*(this->super_TCreature)._vptr_TCreature[1])(this); + } + i_00 = i_00 + -1; + } + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeCreature); + } + return; +} + + + +void MoveCreatures(int Delay) + +{ + uint uVar1; + ulong id; + bool Found; + TCreature *this; + priority_queue_entry<> *ppVar2; + ulong CreatureID; + ulong ExecutionTime; + + ServerMilliseconds = ServerMilliseconds + Delay; + while( true ) { + if (ToDoQueue.Entries == 0) { + return; + } + ppVar2 = vector<>::operator()(ToDoQueue.Entry,1); + uVar1 = ppVar2->Key; + ppVar2 = vector<>::operator()(ToDoQueue.Entry,1); + id = ppVar2->Data; + if (ServerMilliseconds < uVar1) break; + priority_queue<>::deleteMin(&ToDoQueue); + this = GetCreature(id); + if (this != (TCreature *)0x0) { + TCreature::Execute(this); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: blockx + +void DeleteChainCreature(TCreature *cr) + +{ + ulong id; + matrix<> *pmVar1; + ulong ID; + uint uVar2; + uint uVar3; + int iVar4; + ulong *puVar5; + TCreature *pTVar6; + TCreature *Help; + int iVar7; + int blocky; + int blockx; + + pmVar1 = FirstChainCreature; + if (cr == (TCreature *)0x0) { + cr = (TCreature *)&DAT_08101a00; +LAB_0809e38b: + error((char *)cr); + return; + } + uVar2 = cr->posx; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + uVar3 = cr->posy; + if (0x7fffffff < uVar3) { + uVar3 = uVar3 + 0xf; + } + iVar4 = ((int)uVar3 >> 4) - FirstChainCreature->ymin; + iVar7 = ((int)uVar2 >> 4) - FirstChainCreature->xmin; + if ((((iVar7 < 0) || (FirstChainCreature->dx <= iVar7)) || (iVar4 < 0)) || + (FirstChainCreature->dy <= iVar4)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar7 + FirstChainCreature->xmin, + iVar4 + FirstChainCreature->ymin); + puVar5 = pmVar1->entry; + } + else { + puVar5 = FirstChainCreature->entry + iVar7 + iVar4 * FirstChainCreature->dx; + } + pmVar1 = FirstChainCreature; + id = *puVar5; + if (id == cr->ID) { + iVar4 = ((int)uVar3 >> 4) - FirstChainCreature->ymin; + iVar7 = ((int)uVar2 >> 4) - FirstChainCreature->xmin; + if (((iVar7 < 0) || (FirstChainCreature->dx <= iVar7)) || + ((iVar4 < 0 || (FirstChainCreature->dy <= iVar4)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar7 + FirstChainCreature->xmin, + iVar4 + FirstChainCreature->ymin); + puVar5 = pmVar1->entry; + } + else { + puVar5 = FirstChainCreature->entry + iVar7 + iVar4 * FirstChainCreature->dx; + } + *puVar5 = cr->NextChainCreature; + } + else { + do { + if (id == 0) { + cr = (TCreature *)s_DeleteChainCreature__Kreatur_nic_08101980; + goto LAB_0809e38b; + } + pTVar6 = GetCreature(id); + if (pTVar6 == (TCreature *)0x0) { + cr = (TCreature *)s_DeleteChainCreature__Kreatur_exi_081019c0; + goto LAB_0809e38b; + } + id = pTVar6->NextChainCreature; + } while (id != cr->ID); + pTVar6->NextChainCreature = cr->NextChainCreature; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: cr_local + +void InsertChainCreature(TCreature *cr,int newx,int newy) + +{ + matrix<> *pmVar1; + int iVar2; + ulong *puVar3; + int iVar4; + int blocky; + int blockx; + TCreature *cr_local; + + pmVar1 = FirstChainCreature; + if (cr == (TCreature *)0x0) { + error(&DAT_08101a00); + return; + } + if (newx == 0) { + newx = cr->posx; + if (0x7fffffff < (uint)newx) { + newx = newx + 0xf; + } + } + else if (0x7fffffff < (uint)newx) { + newx = newx + 0xf; + } + if (newy == 0) { + newy = cr->posy; + if (0x7fffffff < (uint)newy) { + newy = newy + 0xf; + } + } + else if (0x7fffffff < (uint)newy) { + newy = newy + 0xf; + } + iVar2 = (newy >> 4) - FirstChainCreature->ymin; + iVar4 = (newx >> 4) - FirstChainCreature->xmin; + if ((((iVar4 < 0) || (FirstChainCreature->dx <= iVar4)) || (iVar2 < 0)) || + (FirstChainCreature->dy <= iVar2)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + FirstChainCreature->xmin, + iVar2 + FirstChainCreature->ymin); + puVar3 = pmVar1->entry; + } + else { + puVar3 = FirstChainCreature->entry + iVar4 + iVar2 * FirstChainCreature->dx; + } + cr->NextChainCreature = *puVar3; + pmVar1 = FirstChainCreature; + iVar2 = (newy >> 4) - FirstChainCreature->ymin; + iVar4 = (newx >> 4) - FirstChainCreature->xmin; + if (((iVar4 < 0) || (FirstChainCreature->dx <= iVar4)) || + ((iVar2 < 0 || (FirstChainCreature->dy <= iVar2)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + FirstChainCreature->xmin, + iVar2 + FirstChainCreature->ymin); + puVar3 = pmVar1->entry; + } + else { + puVar3 = FirstChainCreature->entry + iVar4 + iVar2 * FirstChainCreature->dx; + } + *puVar3 = cr->ID; + return; +} + + + +void MoveChainCreature(TCreature *cr,int newx,int newy) + +{ + uint uVar1; + int iVar2; + + if (cr == (TCreature *)0x0) { + error(&DAT_08101a00); + return; + } + uVar1 = cr->posx; + if (0x7fffffff < uVar1) { + uVar1 = uVar1 + 0xf; + } + iVar2 = newx + 0xf; + if (-1 < newx) { + iVar2 = newx; + } + if ((int)uVar1 >> 4 == iVar2 >> 4) { + uVar1 = cr->posy; + if (0x7fffffff < uVar1) { + uVar1 = uVar1 + 0xf; + } + iVar2 = newy + 0xf; + if (-1 < newy) { + iVar2 = newy; + } + if ((int)uVar1 >> 4 == iVar2 >> 4) { + return; + } + } + DeleteChainCreature(cr); + InsertChainCreature(cr,newx,newy); + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, int x, +// int y, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,int x,int y,int Mask) + +{ + uint uVar1; + uint uVar2; + + uVar1 = x - radx; + uVar2 = y - rady; + this->endx = x + radx; + this->startx = uVar1; + this->starty = uVar2; + this->endy = y + rady; + if (0x7fffffff < uVar1) { + uVar1 = uVar1 + 0xf; + } + this->blockx = ((int)uVar1 >> 4) + -1; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + this->blocky = (int)uVar2 >> 4; + this->ActID = 0; + this->SkipID = 0; + this->Mask = Mask; + this->finished = false; + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, int x, +// int y, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,int x,int y,int Mask) + +{ + uint uVar1; + uint uVar2; + + uVar1 = x - radx; + uVar2 = y - rady; + this->endy = y + rady; + this->startx = uVar1; + if (0x7fffffff < uVar1) { + uVar1 = uVar1 + 0xf; + } + this->endx = x + radx; + this->blockx = ((int)uVar1 >> 4) + -1; + this->starty = uVar2; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + this->blocky = (int)uVar2 >> 4; + this->ActID = 0; + this->SkipID = 0; + this->Mask = Mask; + this->finished = false; + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, ulong +// CreatureID, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,ulong CreatureID,int Mask) + +{ + int iVar1; + int iVar2; + TCreature *pTVar3; + uint uVar4; + uint uVar5; + + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error("TFindCreatures::TFindCreatures: Kreatur existiert nicht.\n"); + this->finished = true; + } + else { + iVar1 = pTVar3->posx; + iVar2 = pTVar3->posy; + uVar4 = iVar1 - radx; + this->startx = uVar4; + uVar5 = iVar2 - rady; + this->ActID = 0; + this->endy = iVar2 + rady; + if (0x7fffffff < uVar4) { + uVar4 = uVar4 + 0xf; + } + this->blockx = ((int)uVar4 >> 4) + -1; + this->finished = false; + this->endx = iVar1 + radx; + this->Mask = Mask; + this->starty = uVar5; + if (0x7fffffff < uVar5) { + uVar5 = uVar5 + 0xf; + } + this->blocky = (int)uVar5 >> 4; + this->SkipID = CreatureID; + } + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, ulong +// CreatureID, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,ulong CreatureID,int Mask) + +{ + int iVar1; + int iVar2; + TCreature *pTVar3; + uint uVar4; + uint uVar5; + + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error("TFindCreatures::TFindCreatures: Kreatur existiert nicht.\n"); + this->finished = true; + } + else { + iVar1 = pTVar3->posx; + iVar2 = pTVar3->posy; + uVar4 = iVar1 - radx; + this->startx = uVar4; + uVar5 = iVar2 - rady; + this->ActID = 0; + this->endy = iVar2 + rady; + if (0x7fffffff < uVar4) { + uVar4 = uVar4 + 0xf; + } + this->blockx = ((int)uVar4 >> 4) + -1; + this->finished = false; + this->endx = iVar1 + radx; + this->Mask = Mask; + this->starty = uVar5; + if (0x7fffffff < uVar5) { + uVar5 = uVar5 + 0xf; + } + this->blocky = (int)uVar5 >> 4; + this->SkipID = CreatureID; + } + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, Object * +// Obj, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,Object *Obj,int Mask) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + int local_38; + int x; + int y; + int z; + + bVar1 = Object::exists(Obj); + if (bVar1) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + uVar3 = x - rady; + this->endx = local_38 + radx; + uVar2 = local_38 - radx; + this->SkipID = 0; + this->startx = uVar2; + this->endy = x + rady; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + this->blockx = ((int)uVar2 >> 4) + -1; + this->starty = uVar3; + if (0x7fffffff < uVar3) { + uVar3 = uVar3 + 0xf; + } + this->blocky = (int)uVar3 >> 4; + this->ActID = 0; + this->Mask = Mask; + this->finished = false; + } + else { + error(&DAT_08101a80); + this->finished = true; + } + return; +} + + + +// DWARF original prototype: void TFindCreatures(TFindCreatures * this, int radx, int rady, Object * +// Obj, int Mask) + +void __thiscall +TFindCreatures::TFindCreatures(TFindCreatures *this,int radx,int rady,Object *Obj,int Mask) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + int local_38; + int x; + int y; + int z; + + bVar1 = Object::exists(Obj); + if (bVar1) { + z = Obj->ObjectID; + GetObjectCoordinates((Object *)&z,&local_38,&x,&y); + uVar3 = x - rady; + this->endx = local_38 + radx; + uVar2 = local_38 - radx; + this->SkipID = 0; + this->startx = uVar2; + this->endy = x + rady; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + this->blockx = ((int)uVar2 >> 4) + -1; + this->starty = uVar3; + if (0x7fffffff < uVar3) { + uVar3 = uVar3 + 0xf; + } + this->blocky = (int)uVar3 >> 4; + this->ActID = 0; + this->Mask = Mask; + this->finished = false; + } + else { + error(&DAT_08101a80); + this->finished = true; + } + return; +} + + + +// DWARF original prototype: void initSearch(TFindCreatures * this, int radx, int rady, int x, int +// y, int mask) + +void __thiscall +TFindCreatures::initSearch(TFindCreatures *this,int radx,int rady,int x,int y,int mask) + +{ + uint uVar1; + uint uVar2; + + uVar1 = x - radx; + uVar2 = y - rady; + this->endy = y + rady; + this->startx = uVar1; + if (0x7fffffff < uVar1) { + uVar1 = uVar1 + 0xf; + } + this->endx = x + radx; + this->blockx = ((int)uVar1 >> 4) + -1; + this->starty = uVar2; + if (0x7fffffff < uVar2) { + uVar2 = uVar2 + 0xf; + } + this->blocky = (int)uVar2 >> 4; + this->ActID = 0; + this->SkipID = 0; + this->Mask = mask; + this->finished = false; + return; +} + + + +// DWARF original prototype: ulong getNext(TFindCreatures * this) + +ulong __thiscall TFindCreatures::getNext(TFindCreatures *this) + +{ + CreatureType CVar1; + bool bVar2; + matrix<> *pmVar3; + int iVar4; + uint uVar5; + TCreature *pTVar6; + int iVar7; + ulong *puVar8; + ulong uVar9; + TCreature *cr; + + if (this->finished == false) { + do { + do { + do { + while( true ) { + uVar9 = this->ActID; + while (uVar9 == 0) { + uVar5 = this->endx; + iVar4 = this->blockx + 1; + if (0x7fffffff < uVar5) { + uVar5 = uVar5 + 0xf; + } + this->blockx = iVar4; + if ((int)uVar5 >> 4 < iVar4) { + uVar5 = this->startx; + if (0x7fffffff < uVar5) { + uVar5 = uVar5 + 0xf; + } + iVar4 = this->blocky + 1; + this->blockx = (int)uVar5 >> 4; + uVar5 = this->endy; + this->blocky = iVar4; + if (0x7fffffff < uVar5) { + uVar5 = uVar5 + 0xf; + } + if ((int)uVar5 >> 4 < iVar4) { + this->finished = true; + goto LAB_0809ec9e; + } + } + pmVar3 = FirstChainCreature; + iVar4 = this->blockx; + if ((((SBORROW4(iVar4,SectorXMin * 2) == iVar4 + SectorXMin * -2 < 0) && + (iVar4 <= SectorXMax * 2 + 1)) && + (iVar7 = this->blocky, + SBORROW4(iVar7,SectorYMin * 2) == iVar7 + SectorYMin * -2 < 0)) && + (iVar7 <= SectorYMax * 2 + 1)) { + iVar7 = iVar7 - FirstChainCreature->ymin; + iVar4 = iVar4 - FirstChainCreature->xmin; + if (((iVar4 < 0) || (FirstChainCreature->dx <= iVar4)) || + ((iVar7 < 0 || (FirstChainCreature->dy <= iVar7)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n", + iVar4 + FirstChainCreature->xmin, + iVar7 + FirstChainCreature->ymin); + puVar8 = pmVar3->entry; + } + else { + puVar8 = FirstChainCreature->entry + + iVar4 + iVar7 * FirstChainCreature->dx; + } + this->ActID = *puVar8; + } + else { + this->ActID = 0; + } + uVar9 = this->ActID; + } + pTVar6 = GetCreature(uVar9); + if (pTVar6 != (TCreature *)0x0) break; + error("TFindCreatures::getNext: Kreatur existiert nicht.\n"); + this->ActID = 0; + } + this->ActID = pTVar6->NextChainCreature; + uVar9 = pTVar6->ID; + } while (uVar9 == this->SkipID); + bVar2 = false; + if ((this->startx <= pTVar6->posx) && (pTVar6->posx <= this->endx)) { + bVar2 = true; + } + } while (!bVar2); + bVar2 = false; + if ((this->starty <= pTVar6->posy) && (pTVar6->posy <= this->endy)) { + bVar2 = true; + } + } while ((((!bVar2) || ((CVar1 = pTVar6->Type, CVar1 == PLAYER && ((this->Mask & 1) == 0)))) + || ((CVar1 == NPC && ((this->Mask & 2) == 0)))) || + ((CVar1 == MONSTER && ((this->Mask & 4) == 0)))); + } + else { +LAB_0809ec9e: + uVar9 = 0; + } + return uVar9; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitKillStatistics(void) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + KilledCreatures[iVar1] = 0; + KilledPlayers[iVar1] = 0; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x200); + return; +} + + + +// WARNING: Variable defined which should be unmapped: NumberOfRaces +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void WriteKillStatistics(void) + +{ + int i_1; + char *RaceNames; + int *KilledPlayers; + int *KilledCreatures; + char *Text; + char *pcVar1; + int i; + int iVar2; + char *__s; + int local_24; + int *Creatures; + int *Players; + char *Names; + int NumberOfRaces; + + Names = (char *)0x0; + RaceNames = (char *)operator_new__(0x3c00); + KilledPlayers = (int *)operator_new__(0x800); + KilledCreatures = (int *)operator_new__(0x800); + local_24 = 0; + iVar2 = 0; + pcVar1 = RaceNames; + __s = RaceNames; + do { + if ((::KilledCreatures[iVar2] != 0) || (::KilledPlayers[iVar2] != 0)) { + if (iVar2 < 1) { + builtin_strncpy(pcVar1,"(fire/poison/energy)",0x15); + } + else { + sprintf(__s,"%s %s",local_24 + 0x81c477e,RaceData[0].Name + local_24); + Text = Plural(__s,0); + Capitals(Text); + } + pcVar1 = pcVar1 + 0x1e; + __s = __s + 0x1e; + KilledPlayers[(int)Names] = ::KilledPlayers[iVar2]; + KilledCreatures[(int)Names] = ::KilledCreatures[iVar2]; + Names = Names + 1; + } + local_24 = local_24 + 0x150; + iVar2 = iVar2 + 1; + } while (iVar2 < 0x200); + KillStatisticsOrder((int)Names,RaceNames,KilledPlayers,KilledCreatures); + iVar2 = 0; + do { + ::KilledCreatures[iVar2] = 0; + ::KilledPlayers[iVar2] = 0; + iVar2 = iVar2 + 1; + } while (iVar2 < 0x200); + return; +} + + + +void AddKillStatistics(int AttackerRace,int DefenderRace) + +{ + int iVar1; + TRaceData *pTVar2; + char *pcVar3; + bool bVar4; + + bVar4 = AttackerRace * 0x150 == 0; + iVar1 = 6; + pTVar2 = RaceData + AttackerRace; + pcVar3 = "human"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = pTVar2->Name[0] == *pcVar3; + pTVar2 = (TRaceData *)(pTVar2->Name + 1); + pcVar3 = pcVar3 + 1; + } while (bVar4); + if (bVar4) { + KilledCreatures[DefenderRace] = KilledCreatures[DefenderRace] + 1; + } + iVar1 = 6; + bVar4 = DefenderRace * 0x150 == 0; + pTVar2 = RaceData + DefenderRace; + pcVar3 = "human"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = pTVar2->Name[0] == *pcVar3; + pTVar2 = (TRaceData *)(pTVar2->Name + 1); + pcVar3 = pcVar3 + 1; + } while (bVar4); + if (bVar4) { + KilledPlayers[AttackerRace] = KilledPlayers[AttackerRace] + 1; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitKillStatistics(void) + +{ + WriteKillStatistics(); + return; +} + + + +// DWARF original prototype: void TCreature(TCreature * this) + +void __thiscall TCreature::TCreature(TCreature *this) + +{ + int i; + int iVar1; + + TSkillBase::TSkillBase(&this->super_TSkillBase); + this->_vptr_TCreature = (_func_int_varargs **)&PTR__TCreature_08127be8; + // try { // try from 0809ef0c to 0809ef41 has its CatchHandler @ 0809f0a0 + TCombat::TCombat(&this->Combat); + (this->CrObject).ObjectID = 0; + vector::vector(&this->ToDoList,0,0x14,10); + this->LoggingOut = false; + this->Connection = (TConnection *)0x0; + this->ID = 0; + this->NextChainCreature = 0; + this->EarliestLogoutRound = 0; + this->NextHashEntry = (TCreature *)0x0; + this->EarliestProtectionZoneRound = 0; + this->EarliestYellRound = 0; + this->EarliestTradeChannelRound = 0; + this->EarliestSpellTime = 0; + this->EarliestMultiuseTime = 0; + this->EarliestWalkTime = 0; + this->LifeEndRound = 0; + this->ActToDo = 0; + this->NrToDo = 0; + this->NextWakeup = 0; + this->starty = 0; + this->posx = 0; + this->posy = 0; + this->posz = 0; + this->Radius = 0x7fffffff; + this->startz = 0; + iVar1 = 0; + this->LogoutAllowed = false; + this->Stop = false; + this->LockToDo = false; + this->Direction = 0; + this->startx = 0; + this->IsDead = false; + this->LoseInventory = 2; + (this->Combat).Master = this; + do { + // try { // try from 0809f041 to 0809f045 has its CatchHandler @ 0809f088 + TSkillBase::NewSkill(&this->super_TSkillBase,(ushort)iVar1,this); + iVar1 = iVar1 + 1; + } while (iVar1 < 0x19); + this->Murderer[0] = '\0'; + this->FireDamageOrigin = 0; + this->FirstKnowingConnection = (TKnownCreature *)0x0; + this->SummonedCreatures = 0; + this->PoisonDamageOrigin = 0; + this->EnergyDamageOrigin = 0; + return; +} + + + +// DWARF original prototype: void TCreature(TCreature * this) + +void __thiscall TCreature::TCreature(TCreature *this) + +{ + int i; + int iVar1; + + TSkillBase::TSkillBase(&this->super_TSkillBase); + this->_vptr_TCreature = (_func_int_varargs **)&PTR__TCreature_08127be8; + // try { // try from 0809f0ec to 0809f121 has its CatchHandler @ 0809f280 + TCombat::TCombat(&this->Combat); + (this->CrObject).ObjectID = 0; + vector::vector(&this->ToDoList,0,0x14,10); + this->LoggingOut = false; + this->ID = 0; + this->Connection = (TConnection *)0x0; + this->NextHashEntry = (TCreature *)0x0; + this->NextChainCreature = 0; + this->EarliestLogoutRound = 0; + this->EarliestTradeChannelRound = 0; + this->EarliestYellRound = 0; + this->EarliestSpellTime = 0; + this->EarliestWalkTime = 0; + this->EarliestMultiuseTime = 0; + this->LifeEndRound = 0; + this->NrToDo = 0; + this->EarliestProtectionZoneRound = 0; + this->ActToDo = 0; + this->posx = 0; + this->posy = 0; + this->NextWakeup = 0; + this->posz = 0; + this->Direction = 0; + this->startx = 0; + this->Radius = 0x7fffffff; + iVar1 = 0; + this->LogoutAllowed = false; + this->Stop = false; + this->LockToDo = false; + this->starty = 0; + this->startz = 0; + this->IsDead = false; + this->LoseInventory = 2; + (this->Combat).Master = this; + do { + // try { // try from 0809f221 to 0809f225 has its CatchHandler @ 0809f268 + TSkillBase::NewSkill(&this->super_TSkillBase,(ushort)iVar1,this); + iVar1 = iVar1 + 1; + } while (iVar1 < 0x19); + this->Murderer[0] = '\0'; + this->FirstKnowingConnection = (TKnownCreature *)0x0; + this->SummonedCreatures = 0; + this->FireDamageOrigin = 0; + this->PoisonDamageOrigin = 0; + this->EnergyDamageOrigin = 0; + return; +} + + + +// DWARF original prototype: void ~TCreature(TCreature * this, int __in_chrg) + +void __thiscall TCreature::~TCreature(TCreature *this,int __in_chrg) + +{ + TKnownCreature *pTVar1; + TToDoEntry *pTVar2; + bool bVar3; + bool bVar4; + RESULT r_2; + ObjectType *pOVar5; + TCreature **ppTVar6; + TCreature **ppTVar7; + long lVar8; + ulong Value; + RESULT r; + TKnownCreature *KnownCreature; + int iVar9; + int i_1; + Object *pOVar10; + char *in_stack_fffffef8; + char *__src; + Object local_ec; + char s [128]; + Object Corpse; + Object local_5c; + Object Obj; + ObjectType local_4c; + ObjectType CorpseType; + Object local_3c; + Object Obj_1; + Object local_2c [7]; + + this->_vptr_TCreature = (_func_int_varargs **)&PTR__TCreature_08127be8; + if (this->IsDead != false) { + iVar9 = this->Race; + if (RaceData[iVar9].Blood == BT_BLOOD) { + GetSpecialObject((SPECIALMEANING)local_2c); + local_4c.TypeID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (RaceData[iVar9].Blood == BT_SLIME) { + // try { // try from 0809f7ce to 0809f85d has its CatchHandler @ 0809f869 + GetSpecialObject((SPECIALMEANING)&local_4c); + local_2c[0].ObjectID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (this->Sex == 1) { + pOVar5 = &RaceData[iVar9].MaleCorpse; + } + else { + pOVar5 = &RaceData[iVar9].FemaleCorpse; + } + // try { // try from 0809f31c to 0809f4ab has its CatchHandler @ 0809f957 + ObjectType::setTypeID(&local_4c,pOVar5->TypeID); + bVar3 = ObjectType::getFlag(&local_4c,MAGICFIELD); + if (bVar3) { + GetFirstObject(); + local_5c = (Object)::NONE.ObjectID; + local_2c[0].ObjectID = local_5c.ObjectID; + if (local_3c.ObjectID != ::NONE.ObjectID) { + do { + local_5c.ObjectID = local_3c.ObjectID; + local_2c[0].ObjectID = ::NONE.ObjectID; + Object::getNextObject((Object *)(s + 0x7c)); + local_3c.ObjectID._0_1_ = s[0x7c]; + local_3c.ObjectID._1_1_ = s[0x7d]; + local_3c.ObjectID._2_1_ = s[0x7e]; + local_3c.ObjectID._3_1_ = s[0x7f]; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + Object::getObjectType((Object *)(s + 0x7c)); + bVar3 = ObjectType::getFlag((ObjectType *)(s + 0x7c),MAGICFIELD); + if (bVar3) { + s[0x7c] = (undefined1)local_5c.ObjectID; + s[0x7d] = local_5c.ObjectID._1_1_; + s[0x7e] = local_5c.ObjectID._2_1_; + s[0x7f] = local_5c.ObjectID._3_1_; + // try { // try from 0809f7a4 to 0809f7a8 has its CatchHandler @ 0809f8d4 + Delete((Object *)(s + 0x7c),-1); + } + local_2c[0].ObjectID = ::NONE.ObjectID; + local_5c.ObjectID = ::NONE.ObjectID; + } while (local_3c.ObjectID != ::NONE.ObjectID); + } + } + ObjectType::setTypeID((ObjectType *)&local_5c,local_4c.TypeID); + GetMapContainer((int)&local_3c,this->posx,this->posy); + Create((Object *)(s + 0x7c),(ObjectType *)&local_3c,(ulong)&local_5c); + in_stack_fffffef8 = "Tod von %s: LoseInventory=%d.\n"; + Log("game","Tod von %s: LoseInventory=%d.\n",this->Name,this->LoseInventory); + if (this->Type == PLAYER) { + sprintf((char *)&local_ec,"You recognize %s",this->Name); + if (this->Murderer[0] != '\0') { + if (this->Sex == 1) { + __src = ". He "; + } + else { + __src = ". She "; + } + strcat((char *)&local_ec,__src); + strcat((char *)&local_ec,"was killed by "); + strcat((char *)&local_ec,this->Murderer); + } + Value = AddDynamicString((char *)&local_ec); + in_stack_fffffef8 = (char *)0x9; + local_5c.ObjectID._0_1_ = s[0x7c]; + local_5c.ObjectID._1_1_ = s[0x7d]; + local_5c.ObjectID._2_1_ = s[0x7e]; + local_5c.ObjectID._3_1_ = s[0x7f]; + Change(&local_5c,TEXTSTRING,Value); + } + if (this->LoseInventory != 0) { + iVar9 = 1; + do { + in_stack_fffffef8 = (char *)this->ID; + GetBodyObject((ulong)&local_5c,(int)in_stack_fffffef8); + local_3c.ObjectID = ::NONE.ObjectID; + if (local_5c.ObjectID != ::NONE.ObjectID) { + if (this->LoseInventory != 2) { + Object::getObjectType(&local_3c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER); + if (!bVar3) { + in_stack_fffffef8 = (char *)0x9; + // try { // try from 0809f63b to 0809f76e has its CatchHandler @ 0809f957 + lVar8 = random(); + if (lVar8 != 0) goto LAB_0809f487; + } + } + local_3c.ObjectID = ::NONE.ObjectID; + local_ec.ObjectID = local_5c.ObjectID; + in_stack_fffffef8 = (char *)&local_ec; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + ::Move(0,(Object *)in_stack_fffffef8,local_2c,-1,false,&local_3c); + } +LAB_0809f487: + iVar9 = iVar9 + 1; + } while (iVar9 < 0xb); + } + if ((this->Type == PLAYER) && (this->LoseInventory != 2)) { + TPlayer::SaveInventory((TPlayer *)this); + } + } + bVar3 = false; + local_ec.ObjectID = ::NONE.ObjectID; + s[0x7c] = (undefined1)::NONE.ObjectID; + s[0x7d] = ::NONE.ObjectID._1_1_; + s[0x7e] = ::NONE.ObjectID._2_1_; + s[0x7f] = ::NONE.ObjectID._3_1_; + if (((this->CrObject).ObjectID != ::NONE.ObjectID) && + (bVar4 = Object::exists(&this->CrObject), bVar4)) { + bVar3 = true; + } + if (bVar3) { + DelOnMap(this); + } + ToDoClear(this); + if ((this->Type == PLAYER) && (this->Connection != (TConnection *)0x0)) { + in_stack_fffffef8 = (char *)0x1e; + TConnection::Logout(this->Connection,0x1e,true); + } + pOVar10 = (Object *)0x0; + if (0 < FirstFreeCreature) { + do { + in_stack_fffffef8 = (char *)pOVar10; + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + if (*ppTVar6 == this) { + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + ppTVar7 = vector::operator()(&CreatureList,FirstFreeCreature + -1); + *ppTVar6 = *ppTVar7; + in_stack_fffffef8 = (char *)(FirstFreeCreature + -1); + ppTVar6 = vector::operator()(&CreatureList,(int)in_stack_fffffef8); + *ppTVar6 = (TCreature *)0x0; + FirstFreeCreature = FirstFreeCreature + -1; + } + pOVar10 = (Object *)((int)&pOVar10->ObjectID + 1); + } while ((int)pOVar10 < FirstFreeCreature); + } + if (this->ID != 0) { + DelID(this); + } + for (pTVar1 = this->FirstKnowingConnection; pTVar1 != (TKnownCreature *)0x0; + pTVar1 = pTVar1->Next) { + pOVar10 = (Object *)this->ID; + if ((Object *)pTVar1->CreatureID != pOVar10) { + error("TCreature::~TCreature: Verkettungsfehler bei Kreatur %lu.\n"); + in_stack_fffffef8 = (char *)pOVar10; + } + pTVar1->State = KNOWNCREATURE_FREE; + } + pTVar2 = (this->ToDoList).entry; + if (pTVar2 != (TToDoEntry *)0x0) { + operator_delete__(pTVar2); + } + TSkillBase::~TSkillBase(&this->super_TSkillBase,(int)in_stack_fffffef8); + return; +} + + + +// DWARF original prototype: void ~TCreature(TCreature * this, int __in_chrg) + +void __thiscall TCreature::~TCreature(TCreature *this,int __in_chrg) + +{ + TKnownCreature *pTVar1; + TToDoEntry *pTVar2; + bool bVar3; + bool bVar4; + RESULT r_2; + ObjectType *pOVar5; + TCreature **ppTVar6; + TCreature **ppTVar7; + long lVar8; + ulong Value; + RESULT r; + TKnownCreature *KnownCreature; + int iVar9; + int i_1; + Object *pOVar10; + char *in_stack_fffffef8; + char *__src; + Object local_ec; + char s [128]; + Object Corpse; + Object local_5c; + Object Obj; + ObjectType local_4c; + ObjectType CorpseType; + Object local_3c; + Object Obj_1; + Object local_2c [7]; + + this->_vptr_TCreature = (_func_int_varargs **)&PTR__TCreature_08127be8; + if (this->IsDead != false) { + iVar9 = this->Race; + if (RaceData[iVar9].Blood == BT_BLOOD) { + GetSpecialObject((SPECIALMEANING)local_2c); + local_4c.TypeID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (RaceData[iVar9].Blood == BT_SLIME) { + // try { // try from 0809fe8e to 0809ff1d has its CatchHandler @ 0809ff29 + GetSpecialObject((SPECIALMEANING)&local_4c); + local_2c[0].ObjectID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (this->Sex == 1) { + pOVar5 = &RaceData[iVar9].MaleCorpse; + } + else { + pOVar5 = &RaceData[iVar9].FemaleCorpse; + } + // try { // try from 0809f9dc to 0809fb6b has its CatchHandler @ 080a0017 + ObjectType::setTypeID(&local_4c,pOVar5->TypeID); + bVar3 = ObjectType::getFlag(&local_4c,MAGICFIELD); + if (bVar3) { + GetFirstObject(); + local_5c = (Object)::NONE.ObjectID; + local_2c[0].ObjectID = local_5c.ObjectID; + if (local_3c.ObjectID != ::NONE.ObjectID) { + do { + local_5c.ObjectID = local_3c.ObjectID; + local_2c[0].ObjectID = ::NONE.ObjectID; + Object::getNextObject((Object *)(s + 0x7c)); + local_3c.ObjectID._0_1_ = s[0x7c]; + local_3c.ObjectID._1_1_ = s[0x7d]; + local_3c.ObjectID._2_1_ = s[0x7e]; + local_3c.ObjectID._3_1_ = s[0x7f]; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + Object::getObjectType((Object *)(s + 0x7c)); + bVar3 = ObjectType::getFlag((ObjectType *)(s + 0x7c),MAGICFIELD); + if (bVar3) { + s[0x7c] = (undefined1)local_5c.ObjectID; + s[0x7d] = local_5c.ObjectID._1_1_; + s[0x7e] = local_5c.ObjectID._2_1_; + s[0x7f] = local_5c.ObjectID._3_1_; + // try { // try from 0809fe64 to 0809fe68 has its CatchHandler @ 0809ff94 + Delete((Object *)(s + 0x7c),-1); + } + local_2c[0].ObjectID = ::NONE.ObjectID; + local_5c.ObjectID = ::NONE.ObjectID; + } while (local_3c.ObjectID != ::NONE.ObjectID); + } + } + ObjectType::setTypeID((ObjectType *)&local_5c,local_4c.TypeID); + GetMapContainer((int)&local_3c,this->posx,this->posy); + Create((Object *)(s + 0x7c),(ObjectType *)&local_3c,(ulong)&local_5c); + in_stack_fffffef8 = "Tod von %s: LoseInventory=%d.\n"; + Log("game","Tod von %s: LoseInventory=%d.\n",this->Name,this->LoseInventory); + if (this->Type == PLAYER) { + sprintf((char *)&local_ec,"You recognize %s",this->Name); + if (this->Murderer[0] != '\0') { + if (this->Sex == 1) { + __src = ". He "; + } + else { + __src = ". She "; + } + strcat((char *)&local_ec,__src); + strcat((char *)&local_ec,"was killed by "); + strcat((char *)&local_ec,this->Murderer); + } + Value = AddDynamicString((char *)&local_ec); + in_stack_fffffef8 = (char *)0x9; + local_5c.ObjectID._0_1_ = s[0x7c]; + local_5c.ObjectID._1_1_ = s[0x7d]; + local_5c.ObjectID._2_1_ = s[0x7e]; + local_5c.ObjectID._3_1_ = s[0x7f]; + Change(&local_5c,TEXTSTRING,Value); + } + if (this->LoseInventory != 0) { + iVar9 = 1; + do { + in_stack_fffffef8 = (char *)this->ID; + GetBodyObject((ulong)&local_5c,(int)in_stack_fffffef8); + local_3c.ObjectID = ::NONE.ObjectID; + if (local_5c.ObjectID != ::NONE.ObjectID) { + if (this->LoseInventory != 2) { + Object::getObjectType(&local_3c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER); + if (!bVar3) { + in_stack_fffffef8 = (char *)0x9; + // try { // try from 0809fcfb to 0809fe2e has its CatchHandler @ 080a0017 + lVar8 = random(); + if (lVar8 != 0) goto LAB_0809fb47; + } + } + local_3c.ObjectID = ::NONE.ObjectID; + local_ec.ObjectID = local_5c.ObjectID; + in_stack_fffffef8 = (char *)&local_ec; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + ::Move(0,(Object *)in_stack_fffffef8,local_2c,-1,false,&local_3c); + } +LAB_0809fb47: + iVar9 = iVar9 + 1; + } while (iVar9 < 0xb); + } + if ((this->Type == PLAYER) && (this->LoseInventory != 2)) { + TPlayer::SaveInventory((TPlayer *)this); + } + } + bVar3 = false; + local_ec.ObjectID = ::NONE.ObjectID; + s[0x7c] = (undefined1)::NONE.ObjectID; + s[0x7d] = ::NONE.ObjectID._1_1_; + s[0x7e] = ::NONE.ObjectID._2_1_; + s[0x7f] = ::NONE.ObjectID._3_1_; + if (((this->CrObject).ObjectID != ::NONE.ObjectID) && + (bVar4 = Object::exists(&this->CrObject), bVar4)) { + bVar3 = true; + } + if (bVar3) { + DelOnMap(this); + } + ToDoClear(this); + if ((this->Type == PLAYER) && (this->Connection != (TConnection *)0x0)) { + in_stack_fffffef8 = (char *)0x1e; + TConnection::Logout(this->Connection,0x1e,true); + } + pOVar10 = (Object *)0x0; + if (0 < FirstFreeCreature) { + do { + in_stack_fffffef8 = (char *)pOVar10; + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + if (*ppTVar6 == this) { + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + ppTVar7 = vector::operator()(&CreatureList,FirstFreeCreature + -1); + *ppTVar6 = *ppTVar7; + in_stack_fffffef8 = (char *)(FirstFreeCreature + -1); + ppTVar6 = vector::operator()(&CreatureList,(int)in_stack_fffffef8); + *ppTVar6 = (TCreature *)0x0; + FirstFreeCreature = FirstFreeCreature + -1; + } + pOVar10 = (Object *)((int)&pOVar10->ObjectID + 1); + } while ((int)pOVar10 < FirstFreeCreature); + } + if (this->ID != 0) { + DelID(this); + } + for (pTVar1 = this->FirstKnowingConnection; pTVar1 != (TKnownCreature *)0x0; + pTVar1 = pTVar1->Next) { + pOVar10 = (Object *)this->ID; + if ((Object *)pTVar1->CreatureID != pOVar10) { + error("TCreature::~TCreature: Verkettungsfehler bei Kreatur %lu.\n"); + in_stack_fffffef8 = (char *)pOVar10; + } + pTVar1->State = KNOWNCREATURE_FREE; + } + pTVar2 = (this->ToDoList).entry; + if (pTVar2 != (TToDoEntry *)0x0) { + operator_delete__(pTVar2); + } + TSkillBase::~TSkillBase(&this->super_TSkillBase,(int)in_stack_fffffef8); + return; +} + + + +// DWARF original prototype: void ~TCreature(TCreature * this, int __in_chrg) + +void __thiscall TCreature::~TCreature(TCreature *this,int __in_chrg) + +{ + TKnownCreature *pTVar1; + TToDoEntry *pTVar2; + bool bVar3; + bool bVar4; + RESULT r_2; + ObjectType *pOVar5; + TCreature **ppTVar6; + TCreature **ppTVar7; + long lVar8; + ulong Value; + RESULT r; + TKnownCreature *KnownCreature; + int iVar9; + int i_1; + Object *pOVar10; + char *in_stack_fffffef8; + char *__src; + Object local_ec; + char s [128]; + Object Corpse; + Object local_5c; + Object Obj; + ObjectType local_4c; + ObjectType CorpseType; + Object local_3c; + Object Obj_1; + Object local_2c [7]; + + this->_vptr_TCreature = (_func_int_varargs **)&PTR__TCreature_08127be8; + if (this->IsDead != false) { + iVar9 = this->Race; + if (RaceData[iVar9].Blood == BT_BLOOD) { + GetSpecialObject((SPECIALMEANING)local_2c); + local_4c.TypeID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (RaceData[iVar9].Blood == BT_SLIME) { + // try { // try from 080a054e to 080a05dd has its CatchHandler @ 080a05e9 + GetSpecialObject((SPECIALMEANING)&local_4c); + local_2c[0].ObjectID = (this->CrObject).ObjectID; + GetMapContainer(&local_3c); + CreatePool(); + iVar9 = this->Race; + } + if (this->Sex == 1) { + pOVar5 = &RaceData[iVar9].MaleCorpse; + } + else { + pOVar5 = &RaceData[iVar9].FemaleCorpse; + } + // try { // try from 080a009c to 080a022b has its CatchHandler @ 080a06d7 + ObjectType::setTypeID(&local_4c,pOVar5->TypeID); + bVar3 = ObjectType::getFlag(&local_4c,MAGICFIELD); + if (bVar3) { + GetFirstObject(); + local_5c = (Object)::NONE.ObjectID; + local_2c[0].ObjectID = local_5c.ObjectID; + if (local_3c.ObjectID != ::NONE.ObjectID) { + do { + local_5c.ObjectID = local_3c.ObjectID; + local_2c[0].ObjectID = ::NONE.ObjectID; + Object::getNextObject((Object *)(s + 0x7c)); + local_3c.ObjectID._0_1_ = s[0x7c]; + local_3c.ObjectID._1_1_ = s[0x7d]; + local_3c.ObjectID._2_1_ = s[0x7e]; + local_3c.ObjectID._3_1_ = s[0x7f]; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + Object::getObjectType((Object *)(s + 0x7c)); + bVar3 = ObjectType::getFlag((ObjectType *)(s + 0x7c),MAGICFIELD); + if (bVar3) { + s[0x7c] = (undefined1)local_5c.ObjectID; + s[0x7d] = local_5c.ObjectID._1_1_; + s[0x7e] = local_5c.ObjectID._2_1_; + s[0x7f] = local_5c.ObjectID._3_1_; + // try { // try from 080a0524 to 080a0528 has its CatchHandler @ 080a0654 + Delete((Object *)(s + 0x7c),-1); + } + local_2c[0].ObjectID = ::NONE.ObjectID; + local_5c.ObjectID = ::NONE.ObjectID; + } while (local_3c.ObjectID != ::NONE.ObjectID); + } + } + ObjectType::setTypeID((ObjectType *)&local_5c,local_4c.TypeID); + GetMapContainer((int)&local_3c,this->posx,this->posy); + Create((Object *)(s + 0x7c),(ObjectType *)&local_3c,(ulong)&local_5c); + in_stack_fffffef8 = "Tod von %s: LoseInventory=%d.\n"; + Log("game","Tod von %s: LoseInventory=%d.\n",this->Name,this->LoseInventory); + if (this->Type == PLAYER) { + sprintf((char *)&local_ec,"You recognize %s",this->Name); + if (this->Murderer[0] != '\0') { + if (this->Sex == 1) { + __src = ". He "; + } + else { + __src = ". She "; + } + strcat((char *)&local_ec,__src); + strcat((char *)&local_ec,"was killed by "); + strcat((char *)&local_ec,this->Murderer); + } + Value = AddDynamicString((char *)&local_ec); + in_stack_fffffef8 = (char *)0x9; + local_5c.ObjectID._0_1_ = s[0x7c]; + local_5c.ObjectID._1_1_ = s[0x7d]; + local_5c.ObjectID._2_1_ = s[0x7e]; + local_5c.ObjectID._3_1_ = s[0x7f]; + Change(&local_5c,TEXTSTRING,Value); + } + if (this->LoseInventory != 0) { + iVar9 = 1; + do { + in_stack_fffffef8 = (char *)this->ID; + GetBodyObject((ulong)&local_5c,(int)in_stack_fffffef8); + local_3c.ObjectID = ::NONE.ObjectID; + if (local_5c.ObjectID != ::NONE.ObjectID) { + if (this->LoseInventory != 2) { + Object::getObjectType(&local_3c); + bVar3 = ObjectType::getFlag((ObjectType *)&local_3c,CONTAINER); + if (!bVar3) { + in_stack_fffffef8 = (char *)0x9; + // try { // try from 080a03bc to 080a04ee has its CatchHandler @ 080a06d7 + lVar8 = random(); + if (lVar8 != 0) goto LAB_080a0207; + } + } + local_3c.ObjectID = ::NONE.ObjectID; + local_ec.ObjectID = local_5c.ObjectID; + in_stack_fffffef8 = (char *)&local_ec; + local_2c[0].ObjectID._0_1_ = s[0x7c]; + local_2c[0].ObjectID._1_1_ = s[0x7d]; + local_2c[0].ObjectID._2_1_ = s[0x7e]; + local_2c[0].ObjectID._3_1_ = s[0x7f]; + ::Move(0,(Object *)in_stack_fffffef8,local_2c,-1,false,&local_3c); + } +LAB_080a0207: + iVar9 = iVar9 + 1; + } while (iVar9 < 0xb); + } + if ((this->Type == PLAYER) && (this->LoseInventory != 2)) { + TPlayer::SaveInventory((TPlayer *)this); + } + } + bVar3 = false; + local_ec.ObjectID = ::NONE.ObjectID; + s[0x7c] = (undefined1)::NONE.ObjectID; + s[0x7d] = ::NONE.ObjectID._1_1_; + s[0x7e] = ::NONE.ObjectID._2_1_; + s[0x7f] = ::NONE.ObjectID._3_1_; + if (((this->CrObject).ObjectID != ::NONE.ObjectID) && + (bVar4 = Object::exists(&this->CrObject), bVar4)) { + bVar3 = true; + } + if (bVar3) { + DelOnMap(this); + } + ToDoClear(this); + if ((this->Type == PLAYER) && (this->Connection != (TConnection *)0x0)) { + in_stack_fffffef8 = (char *)0x1e; + TConnection::Logout(this->Connection,0x1e,true); + } + pOVar10 = (Object *)0x0; + if (0 < FirstFreeCreature) { + do { + in_stack_fffffef8 = (char *)pOVar10; + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + if (*ppTVar6 == this) { + ppTVar6 = vector::operator()(&CreatureList,(int)pOVar10); + ppTVar7 = vector::operator()(&CreatureList,FirstFreeCreature + -1); + *ppTVar6 = *ppTVar7; + in_stack_fffffef8 = (char *)(FirstFreeCreature + -1); + ppTVar6 = vector::operator()(&CreatureList,(int)in_stack_fffffef8); + *ppTVar6 = (TCreature *)0x0; + FirstFreeCreature = FirstFreeCreature + -1; + } + pOVar10 = (Object *)((int)&pOVar10->ObjectID + 1); + } while ((int)pOVar10 < FirstFreeCreature); + } + if (this->ID != 0) { + DelID(this); + } + for (pTVar1 = this->FirstKnowingConnection; pTVar1 != (TKnownCreature *)0x0; + pTVar1 = pTVar1->Next) { + pOVar10 = (Object *)this->ID; + if ((Object *)pTVar1->CreatureID != pOVar10) { + error("TCreature::~TCreature: Verkettungsfehler bei Kreatur %lu.\n"); + in_stack_fffffef8 = (char *)pOVar10; + } + pTVar1->State = KNOWNCREATURE_FREE; + } + pTVar2 = (this->ToDoList).entry; + if (pTVar2 != (TToDoEntry *)0x0) { + operator_delete__(pTVar2); + } + TSkillBase::~TSkillBase(&this->super_TSkillBase,(int)in_stack_fffffef8); + operator_delete(this); + return; +} + + + +// DWARF original prototype: void SetID(TCreature * this, ulong CharacterID) + +void __thiscall TCreature::SetID(TCreature *this,ulong CharacterID) + +{ + TCreature *pTVar1; + ulong m; + uint uVar2; + int iVar3; + char *Text; + ulong uVar4; + + if (this->ID != 0) { + error("TCreature::SetID: ID ist schon gesetzt.\n"); + } + if (CharacterID == 0) { + iVar3 = 0; + this->ID = NextCreatureID; + NextCreatureID = NextCreatureID + 1; + do { + pTVar1 = GetCreature(this->ID); + if (pTVar1 == (TCreature *)0x0) goto LAB_080a0775; + iVar3 = iVar3 + 1; + error("TCreature::SetID: Doppelte Nonplayer-ID %d gefunden.\n",this->ID); + this->ID = NextCreatureID; + NextCreatureID = NextCreatureID + 1; + } while (iVar3 < 0x11); + uVar4 = this->ID; + Text = "TCreature::SetID: 16x hintereinander doppelte ID. Verwende nun doppelte ID %d\n"; + } + else { + this->ID = CharacterID; + pTVar1 = GetCreature(CharacterID); + if (pTVar1 == (TCreature *)0x0) goto LAB_080a0775; + uVar4 = this->ID; + Text = "TCreature::SetID: Doppelte Character-ID %d gefunden.\n"; + } + error(Text,uVar4); +LAB_080a0775: + uVar2 = this->ID % 1000; + this->NextHashEntry = HashList[uVar2]; + HashList[uVar2] = this; + return; +} + + + +// DWARF original prototype: void DelID(TCreature * this) + +void __thiscall TCreature::DelID(TCreature *this) + +{ + uint uVar1; + TCreature *pTVar2; + uint uVar3; + TCreature *pTVar4; + TCreature *pTVar5; + ulong m; + TCreature *ocr; + TCreature *pTVar6; + char *Text; + + uVar1 = this->ID; + pTVar2 = HashList[uVar1 % 1000]; + if (pTVar2 == (TCreature *)0x0) { + Text = "TCreature::DelID: Hasheintrag nicht gefunden id = %d\n"; + } + else { + uVar3 = pTVar2->ID; + if (uVar3 == uVar1) { + HashList[uVar1 % 1000] = pTVar2->NextHashEntry; + return; + } + pTVar4 = pTVar2->NextHashEntry; + pTVar6 = (TCreature *)0x0; + while (pTVar4 != (TCreature *)0x0) { + pTVar5 = pTVar2->NextHashEntry; + uVar3 = pTVar5->ID; + pTVar6 = pTVar2; + if (uVar3 == uVar1) goto LAB_080a0867; + pTVar2 = pTVar5; + pTVar4 = pTVar5->NextHashEntry; + } + pTVar5 = pTVar2; + if (uVar3 == uVar1) { +LAB_080a0867: + pTVar6->NextHashEntry = pTVar5->NextHashEntry; + return; + } + Text = "TCreature::DelID: id=%d nicht gefunden.\n"; + } + error(Text,uVar1); + return; +} + + + +// DWARF original prototype: void SetInCrList(TCreature * this) + +void __thiscall TCreature::SetInCrList(TCreature *this) + +{ + TCreature **ppTVar1; + + ppTVar1 = vector::operator()(&CreatureList,FirstFreeCreature); + FirstFreeCreature = FirstFreeCreature + 1; + *ppTVar1 = this; + return; +} + + + +// DWARF original prototype: void DelInCrList(TCreature * this) + +void __thiscall TCreature::DelInCrList(TCreature *this) + +{ + TCreature **ppTVar1; + TCreature **ppTVar2; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreeCreature) { + do { + ppTVar1 = vector::operator()(&CreatureList,i_00); + if (*ppTVar1 == this) { + ppTVar1 = vector::operator()(&CreatureList,i_00); + ppTVar2 = vector::operator()(&CreatureList,FirstFreeCreature + -1); + *ppTVar1 = *ppTVar2; + ppTVar1 = vector::operator()(&CreatureList,FirstFreeCreature + -1); + *ppTVar1 = (TCreature *)0x0; + FirstFreeCreature = FirstFreeCreature + -1; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeCreature); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: StopFight_local +// DWARF original prototype: void StartLogout(TCreature * this, bool Force, bool StopFight) + +void __thiscall TCreature::StartLogout(TCreature *this,bool Force,bool StopFight) + +{ + bool bVar1; + int Delay; + bool StopFight_local; + + this->LoggingOut = true; + if ((Force) || (bVar1 = LagDetected(), bVar1)) { + this->LogoutAllowed = true; + } + if ((this->Type == PLAYER) && (this->Connection != (TConnection *)0x0)) { + TConnection::Logout(this->Connection,0,true); + } + Delay = 0; + if (!StopFight) { + Delay = 0x3c; + } + TCombat::StopAttack(&this->Combat,Delay); + return; +} + + + +// DWARF original prototype: int LogoutPossible(TCreature * this) + +int __thiscall TCreature::LogoutPossible(TCreature *this) + +{ + bool bVar1; + + if (((this->LogoutAllowed == false) && (bVar1 = GameEnding(), !bVar1)) && + (this->IsDead == false)) { + if ((RoundNr < this->EarliestLogoutRound) && (bVar1 = LagDetected(), !bVar1)) { + return 1; + } + bVar1 = IsNoLogoutField(); + if (bVar1) { + return 2; + } + this->LogoutAllowed = true; + } + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: BlockProtectionZone_local +// DWARF original prototype: void BlockLogout(TCreature * this, int Delay, bool BlockProtectionZone) + +void __thiscall TCreature::BlockLogout(TCreature *this,int Delay,bool BlockProtectionZone) + +{ + uint uVar1; + bool bVar2; + ulong Round; + uint uVar3; + char local_d; + bool BlockProtectionZone_local; + + local_d = BlockProtectionZone; + if (WorldType == NON_PVP) { + local_d = '\0'; + } + if ((this->Type == PLAYER) && (bVar2 = CheckRight(this->ID,NO_LOGOUT_BLOCK), !bVar2)) { + if (local_d == '\0') { + uVar3 = this->EarliestProtectionZoneRound; + if (((uVar3 < RoundNr) && (this->Type == PLAYER)) && + (this->Connection == (TConnection *)0x0)) { + return; + } + } + else { + uVar3 = this->EarliestProtectionZoneRound; + } + uVar1 = Delay + RoundNr; + if (((local_d != '\0') || (RoundNr < uVar3)) && (uVar3 < uVar1)) { + this->EarliestProtectionZoneRound = uVar1; + } + if (this->EarliestLogoutRound < uVar1) { + this->EarliestLogoutRound = uVar1; + } + TPlayer::CheckState((TPlayer *)this); + return; + } + return; +} + + + +// DWARF original prototype: int GetHealth(TCreature * this) + +int __thiscall TCreature::GetHealth(TCreature *this) + +{ + TSkill *this_00; + int iVar1; + uint uVar2; + int iVar3; + int MaxHitpoints; + TSkill *sk; + + this_00 = (this->super_TSkillBase).Skills[2]; + iVar3 = this_00->Max; + if (iVar3 < 1) { + if (this->IsDead == false) { + error("TCreature::GetHealth: MaxHitpoints von %s ist %d, obwohl sie nicht tot ist.\n", + this->Name,iVar3); + } + uVar2 = 0; + } + else { + iVar1 = TSkill::Get(this_00); + uVar2 = (iVar1 * 100) / iVar3; + if ((int)uVar2 < 1) { + iVar3 = TSkill::Get(this_00); + uVar2 = (uint)(iVar3 != 0); + } + } + return uVar2; +} + + + +// DWARF original prototype: int GetSpeed(TCreature * this) + +int __thiscall TCreature::GetSpeed(TCreature *this) + +{ + TSkill *this_00; + int iVar1; + + this_00 = (this->super_TSkillBase).Skills[4]; + if (this_00 == (TSkill *)0x0) { + error("TCreature::GetSpeed: Kein Skill GOSTRENGTH vorhanden.\n"); + iVar1 = 0; + } + else { + iVar1 = TSkill::Get(this_00); + iVar1 = iVar1 * 2 + 0x50; + } + return iVar1; +} + + + +// DWARF original prototype: void Death(TCreature * this) + +void __thiscall TCreature::Death(TCreature *this) + +{ + this->IsDead = true; + this->LoggingOut = true; + return; +} + + + +// DWARF original prototype: int Damage(TCreature * this, TCreature * atk, int Damage, int +// DamageType) + +int __thiscall TCreature::Damage(TCreature *this,TCreature *atk,int Damage,int DamageType) + +{ + TConnection *pTVar1; + bool bVar2; + bool bVar3; + ushort uVar4; + int iVar5; + int iVar6; + int iVar7; + ulong uVar8; + TPlayer *this_00; + int iVar9; + _func_int_varargs **pp_Var10; + TSkill *pTVar11; + CreatureType CVar12; + TSkill *sk_1; + char *pcVar13; + Object *pOVar14; + char *pcVar15; + undefined4 uVar16; + TPlayer *pl; + int Unjustified; + int i; + uint local_88; + ulong MurdererID; + int OldLevel; + int b; + TSkill *sk; + int b_1; + ulong atkID; + TCreature *Responsible; + char Remark [30]; + Object Obj; + Object local_3c [4]; + Object local_2c; + Object Obj_1; + + if (this->IsDead != false) { + return 0; + } + if (this->Type == NPC) { + return 0; + } + if (this->Type == PLAYER) { + CVar12 = PLAYER; + if ((this->Connection != (TConnection *)0x0) && (atk != (TCreature *)0x0)) { + SendMarkCreature((TConnection *)atk->ID,0,(int)this->Connection); + CVar12 = this->Type; + } + if ((((CVar12 == PLAYER) && (atk != (TCreature *)0x0)) && (atk->Type == PLAYER)) && + (((DamageType != 0x20 && (DamageType != 0x40)) && (DamageType != 0x80)))) { + Damage = (Damage + 1) / 2; + } + } + atkID = (ulong)atk; + if (atk == (TCreature *)0x0) { + b_1 = 0; + } + else { + iVar5 = (*atk->_vptr_TCreature[5])(atk); + if (iVar5 != 0) { + uVar8 = (*atk->_vptr_TCreature[5])(atk); + atkID = (ulong)GetCreature(uVar8); + } + b_1 = atk->ID; + } + if (atk != (TCreature *)0x0) { + BlockLogout(atk,0x3c,this->Type == PLAYER); + } + if (((atkID != 0) && + (BlockLogout((TCreature *)atkID,0x3c,this->Type == PLAYER), *(int *)(atkID + 0x28c) == 0)) + && (this->Type == PLAYER)) { + TPlayer::RecordAttack((TPlayer *)atkID,this->ID); + } + if (Damage < 1) { +LAB_080a1ca4: + local_2c.ObjectID = (this->CrObject).ObjectID; + pOVar14 = &local_2c; + } + else { + if (this->Type == PLAYER) { + bVar2 = CheckRight(this->ID,INVULNERABLE); + if (bVar2) goto LAB_080a1ca4; + if (this->Type == PLAYER) { + sk = (TSkill *)0x1; + do { + if (Damage < 1) goto LAB_080a1c71; + bVar2 = false; + GetBodyObject((ulong)&local_2c,this->ID); + local_3c[0].ObjectID = ::NONE.ObjectID; + if (local_2c.ObjectID == ::NONE.ObjectID) { +LAB_080a1d02: + bVar2 = true; + } + else { + Object::getObjectType((Object *)(Remark + 0x1c)); + bVar3 = ObjectType::getFlag((ObjectType *)(Remark + 0x1c),PROTECTION); + if (!bVar3) goto LAB_080a1d02; + } + if (!bVar2) { + Object::getObjectType((Object *)(Remark + 0x1c)); + bVar2 = ObjectType::getFlag((ObjectType *)(Remark + 0x1c),CLOTHES); + if (bVar2) { + Object::getObjectType((Object *)(Remark + 0x1c)); + pTVar11 = (TSkill *) + ObjectType::getAttribute + ((ObjectType *)(Remark + 0x1c),BODYPOSITION); + if (pTVar11 == sk) { + Object::getObjectType((Object *)(Remark + 0x1c)); + uVar8 = ObjectType::getAttribute + ((ObjectType *)(Remark + 0x1c), + PROTECTIONDAMAGETYPES); + if ((DamageType & uVar8) != 0) { + Object::getObjectType((Object *)(Remark + 0x1c)); + uVar8 = ObjectType::getAttribute + ((ObjectType *)(Remark + 0x1c),DAMAGEREDUCTION + ); + Damage = (Damage * (100 - uVar8)) / 100; + Object::getObjectType((Object *)(Remark + 0x1c)); + bVar2 = ObjectType::getFlag((ObjectType *)(Remark + 0x1c), + WEAROUT); + if (bVar2) { + uVar8 = Object::getAttribute(&local_2c,REMAININGUSES); + if (uVar8 < 2) { + // try { // try from 080a1e9f to 080a1ee8 has its CatchHandler @ 080a1f63 + Object::getObjectType(local_3c); + uVar8 = ObjectType::getAttribute + ((ObjectType *)local_3c,WEAROUTTARGET) + ; + ObjectType::setTypeID + ((ObjectType *)(Remark + 0x1c),uVar8); + local_3c[0].ObjectID = local_2c.ObjectID; + Change(local_3c,(ObjectType *)(Remark + 0x1c),0); + } + else { + stack0xffffffb4 = local_2c.ObjectID; + uVar8 = Object::getAttribute(&local_2c,REMAININGUSES); + Change((Object *)(Remark + 0x1c),REMAININGUSES,uVar8 - 1 + ); + } + } + } + } + } + else { + Object::getObjectType((Object *)(Remark + 0x1c)); + error("TCreature::Damage: Objekt %d hat PROTECTION, aber nicht CLOTHES.\n" + ,stack0xffffffb4); + } + } + sk = (TSkill *)((int)&sk->_vptr_TSkill + 1); + } while ((int)sk < 0xb); + } + } + if (0 < Damage) { + if (DamageType == 0x20) { + if (RaceData[this->Race].NoPoison != false) { + return 0; + } + pTVar11 = (this->super_TSkillBase).Skills[0x11]; + iVar5 = (*pTVar11->_vptr_TSkill[0xd])(pTVar11); + if (iVar5 < Damage) { + this->PoisonDamageOrigin = b_1; + TSkillBase::SetTimer(&this->super_TSkillBase); + } + pp_Var10 = this->_vptr_TCreature; + uVar16 = 0x20; +LAB_080a1b71: + (*pp_Var10[7])(this,b_1,Damage,uVar16); + return (int)(Object *)Damage; + } + if (DamageType == 0x40) { + if (RaceData[this->Race].NoBurning != false) { + return 0; + } + this->FireDamageOrigin = b_1; + TSkillBase::SetTimer(&this->super_TSkillBase); + pp_Var10 = this->_vptr_TCreature; + uVar16 = 0x40; + goto LAB_080a1b71; + } + if (DamageType == 0x80) { + if (RaceData[this->Race].NoEnergy != false) { + return 0; + } + this->EnergyDamageOrigin = b_1; + TSkillBase::SetTimer(&this->super_TSkillBase); + pp_Var10 = this->_vptr_TCreature; + uVar16 = 0x80; + goto LAB_080a1b71; + } + if (DamageType == 1) { + uVar4 = TCombat::GetArmorStrength(&this->Combat); + Damage = Damage - (uint)uVar4; + if (0 < Damage) goto LAB_080a0dd2; + } + else { +LAB_080a0dd2: + if ((((DamageType != 2) || (RaceData[this->Race].NoPoison == false)) && + (((DamageType != 4 || (RaceData[this->Race].NoBurning == false)) && + ((DamageType != 8 || (RaceData[this->Race].NoEnergy == false)))))) && + (((DamageType != 1 || (RaceData[this->Race].NoHit == false)) && + ((DamageType != 0x100 || (RaceData[this->Race].NoLifeDrain == false)))))) { + pOVar14 = (Object *)Damage; + iVar5 = DamageType; + (*this->_vptr_TCreature[7])(this,b_1,Damage,DamageType); + bVar2 = false; + if (((this->Outfit).OutfitID == 0) && ((this->Outfit).field_1.ObjectType == 0)) + { + bVar2 = true; + } + if ((bVar2) && (this->Type != PLAYER)) { + iVar5 = 0; + TSkillBase::SetTimer(&this->super_TSkillBase); + iVar9 = (this->OrgOutfit).OutfitID; + (this->Outfit).field_1 = (this->OrgOutfit).field_1; + (this->Outfit).OutfitID = iVar9; + AnnounceChangedCreature(this->ID,3); + pOVar14 = (Object *)(Remark + 0x1c); + stack0xffffffb4 = ::NONE.ObjectID; + local_3c[0].ObjectID = (this->CrObject).ObjectID; + b_1 = 2; + NotifyAllCreatures(local_3c,2,pOVar14); + } + if (DamageType == 0x200) { + pTVar11 = (this->super_TSkillBase).Skills[3]; + iVar5 = TSkill::Get(pTVar11); + if (iVar5 < Damage) { + Damage = TSkill::Get(pTVar11); + } + if ((Object *)Damage != (Object *)0x0) { + TSkill::Change(pTVar11,-Damage); + if ((this->Type == PLAYER) && (this->Connection != (TConnection *)0x0)) + { + SendMessage(this->Connection,0x15,"You lose %d mana.",Damage); + } + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),0xe); + unique0x00009680 = (this->CrObject).ObjectID; + TextualEffect(); + return (int)(Object *)Damage; + } + return 0; + } + pTVar11 = (this->super_TSkillBase).Skills[0x15]; + iVar5 = (*pTVar11->_vptr_TSkill[0xd])(pTVar11,b_1,pOVar14,iVar5); + if ((0 < iVar5) || + (iVar5 = TSkill::Get((this->super_TSkillBase).Skills[0x15]), 0 < iVar5)) { + pTVar11 = (this->super_TSkillBase).Skills[3]; + iVar5 = TSkill::Get(pTVar11); + if (Damage <= iVar5) { + TSkill::Change(pTVar11,-Damage); + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),2); + unique0x00009680 = (this->CrObject).ObjectID; + TextualEffect(); + if (this->Type != PLAYER) { + return (int)(Object *)Damage; + } + pTVar1 = this->Connection; + if (pTVar1 != (TConnection *)0x0) { + if (atk == (TCreature *)0x0) { + SendMessage(pTVar1,0x15,"You lose %d mana.",Damage); + } + else { + SendMessage(pTVar1,0x15, + "You lose %d mana blocking an attack by %s.",Damage, + atk->Name); + } + SendPlayerData(this->Connection); + return (int)(Object *)Damage; + } + return (int)(Object *)Damage; + } + iVar5 = TSkill::Get(pTVar11); + Damage = Damage - iVar5; + (*pTVar11->_vptr_TSkill[2])(pTVar11,0); + } + pTVar11 = (this->super_TSkillBase).Skills[2]; + iVar5 = TSkill::Get(pTVar11); + if (iVar5 < Damage) { + Damage = TSkill::Get(pTVar11); + } + TSkill::Change(pTVar11,-Damage); + if ((TCreature *)atkID == atk) { + pOVar14 = (Object *)Damage; + if (atk != (TCreature *)0x0) goto LAB_080a0fec; + } + else { + if (atkID != 0) { + TCombat::AddDamageToCombatList + (&this->Combat,*(ulong *)(atkID + 0x208),(ushort)(Damage / 2)) + ; + } + if (atk != (TCreature *)0x0) { + pOVar14 = (Object *)(Damage / 2); +LAB_080a0fec: + TCombat::AddDamageToCombatList(&this->Combat,atk->ID,(ushort)pOVar14); + } + } + if (DamageType == 4) { + unique0x00009680 = (this->CrObject).ObjectID; + iVar5 = 0x10; +LAB_080a17a3: + GraphicalEffect((Object *)(Remark + 0x1c),iVar5); + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)0xc6; +LAB_080a1080: + pcVar15 = "%d"; + TextualEffect(); + } + else { + if (4 < DamageType) { + if (DamageType == 8) { +switchD_080a1623_caseD_4: + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),0xc); + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)0x23; + } + else { + if (DamageType != 0x100) goto LAB_080a102f; + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),0xe); + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)0xb4; + } + goto LAB_080a1080; + } + if (DamageType != 1) { + if (DamageType != 2) { +LAB_080a102f: + error(&DAT_08101f00,DamageType); + return (int)(Object *)Damage; + } + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),9); + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)0x1e; + goto LAB_080a1080; + } + pcVar15 = (char *)this->Race; + switch(RaceData[(int)pcVar15].Blood) { + case BT_BLOOD: + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),1); + unique0x00009680 = (this->CrObject).ObjectID; + TextualEffect(); + local_3c[0].ObjectID = (this->CrObject).ObjectID; + // try { // try from 080a1684 to 080a16b8 has its CatchHandler @ 080a1fb1 + GetMapContainer((Object *)(Remark + 0x1c)); + pOVar14 = &local_2c; + GetSpecialObject((SPECIALMEANING)pOVar14); + pcVar15 = (char *)0x5; + CreatePool(); + break; + case BT_SLIME: + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),0x11); + unique0x00009680 = (this->CrObject).ObjectID; + TextualEffect(); + local_3c[0].ObjectID = (this->CrObject).ObjectID; + // try { // try from 080a171a to 080a174e has its CatchHandler @ 080a1fb1 + GetMapContainer((Object *)(Remark + 0x1c)); + pOVar14 = &local_2c; + GetSpecialObject((SPECIALMEANING)pOVar14); + pcVar15 = (char *)0x6; + CreatePool(); + break; + case BT_BONES: + unique0x00009680 = (this->CrObject).ObjectID; + GraphicalEffect((Object *)(Remark + 0x1c),10); + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)0x81; + goto LAB_080a1080; + case BT_FIRE: + unique0x00009680 = (this->CrObject).ObjectID; + iVar5 = 1; + goto LAB_080a17a3; + case BT_ENERGY: + goto switchD_080a1623_caseD_4; + default: + pOVar14 = (Object *)RaceData[(int)pcVar15].Blood; + error(&DAT_08101fe0,pOVar14,pcVar15); + } + } + if ((this->Type == PLAYER) && + (pTVar1 = this->Connection, pTVar1 != (TConnection *)0x0)) { + if (atk == (TCreature *)0x0) { + pcVar15 = "You lose %d hitpoint%s."; + pcVar13 = ""; + if ((Object *)Damage != (Object *)0x1) { + pcVar13 = "s"; + } + pOVar14 = (Object *)0x15; + SendMessage(pTVar1,0x15,"You lose %d hitpoint%s.",Damage,pcVar13); + } + else { + pcVar13 = ""; + pcVar15 = "You lose %d hitpoint%s due to an attack by %s."; + pOVar14 = (Object *)0x15; + if ((Object *)Damage != (Object *)0x1) { + pcVar13 = "s"; + } + SendMessage(pTVar1,0x15,"You lose %d hitpoint%s due to an attack by %s." + ,Damage,pcVar13,atk->Name); + } + SendPlayerData(this->Connection); + } + iVar5 = TSkill::Get(pTVar11); + if (0 < iVar5) goto LAB_080a1103; + if (this->Type == PLAYER) { + OldLevel = 1; + do { + pOVar14 = (Object *)this->ID; + pcVar15 = (char *)OldLevel; + GetBodyObject((ulong)(Remark + 0x1c),(int)pOVar14); + local_3c[0].ObjectID = ::NONE.ObjectID; + if (stack0xffffffb4 != ::NONE.ObjectID) { + Object::getObjectType(local_3c); + pOVar14 = (Object *)0x2e; + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CLOTHES); + if (bVar2) { + Object::getObjectType(local_3c); + pOVar14 = (Object *)0x16; + uVar8 = ObjectType::getAttribute + ((ObjectType *)local_3c,BODYPOSITION); + if (uVar8 == OldLevel) { + Object::getObjectType(local_3c); + pcVar15 = (char *)0xc; + pOVar14 = (Object *)0x4d; + GetNewObjectType((uchar)&local_2c,'M'); + if (local_3c[0].ObjectID == local_2c.ObjectID) { + pcVar15 = this->Name; + Log("game","%s stirbt mit Amulett of Loss.\n",pcVar15); + this->LoseInventory = 0; + pOVar14 = (Object *)0xffffffff; + local_3c[0].ObjectID = stack0xffffffb4; + // try { // try from 080a159b to 080a159f has its CatchHandler @ 080a1fc8 + Delete(local_3c,-1); + } + } + } + } + OldLevel = OldLevel + 1; + } while (OldLevel < 0xb); + } + iVar5 = TSkill::Get((this->super_TSkillBase).Skills[0]); + (*this->_vptr_TCreature[2])(this,pOVar14,pcVar15); + if ((atk != (TCreature *)0x0) && (this->Type == PLAYER)) { + BlockLogout(atk,900,true); + } + if ((atkID != 0) && (this->Type == PLAYER)) { + BlockLogout((TCreature *)atkID,900,true); + } + Responsible = (TCreature *)((uint)Responsible & 0xffffff00); + local_88 = 0; + if (atk == (TCreature *)0x0) { + iVar9 = this->Race; + iVar7 = strcmp(RaceData[0].Name,"human"); + if (iVar7 == 0) { + KilledCreatures[iVar9] = KilledCreatures[iVar9] + 1; + } + uVar16 = 6; + iVar9 = strcmp(RaceData[iVar9].Name,"human"); + if (iVar9 == 0) { + KilledPlayers[0] = KilledPlayers[0] + 1; + } + if (DamageType == 2) { + Responsible = (TCreature *)0x73696f70; + Remark[0] = 'o'; + Remark[1] = 'n'; +LAB_080a1479: + Remark[2] = '\0'; + } + else if (DamageType < 3) { + if (DamageType == 1) { + Responsible = (TCreature *)0x69682061; + Remark[0] = 't'; + Remark[1] = '\0'; + } + else { +LAB_080a1436: + error(&DAT_08101f80,DamageType,uVar16); + } + } + else { + if (DamageType != 4) { + if (DamageType == 8) { + Responsible = (TCreature *)0x72656e65; + Remark[0] = 'g'; + Remark[1] = 'y'; + goto LAB_080a1479; + } + goto LAB_080a1436; + } + Responsible = (TCreature *)0x65726966; + Remark._0_2_ = Remark._0_2_ & 0xff00; + } + } + else { + iVar9 = atk->Race; + iVar7 = this->Race; + iVar6 = strcmp(RaceData[iVar9].Name,"human"); + if (iVar6 == 0) { + KilledCreatures[iVar7] = KilledCreatures[iVar7] + 1; + } + iVar7 = strcmp(RaceData[iVar7].Name,"human"); + if (iVar7 == 0) { + KilledPlayers[iVar9] = KilledPlayers[iVar9] + 1; + } + strcpy(this->Murderer,atk->Name); + if ((atkID != 0) && (*(int *)(atkID + 0x28c) == 0)) { + local_88 = *(uint *)(atkID + 0x208); + } + if (atk->Type != PLAYER) { + strcpy((char *)&Responsible,atk->Name); + } + } + if (this->Type == PLAYER) { + Unjustified = 1; + do { + uVar8 = local_88; + if (Unjustified != 1) { + uVar8 = TCombat::GetMostDangerousAttacker(&this->Combat); + } + if ((Unjustified != 2) || + (((uVar8 != 0 && (uVar8 != local_88)) && (uVar8 < 0x40000000)))) { + bVar2 = false; + if (uVar8 - 1 < 0x3fffffff) { + this_00 = GetPlayer(uVar8); + if (this_00 == (TPlayer *)0x0) goto LAB_080a1376; + bVar2 = TPlayer::IsAttackJustified(this_00,this->ID); + bVar2 = !bVar2; + TPlayer::RecordMurder(this_00,this->ID); + } + bVar3 = false; + if (this->ID != uVar8) { + bVar3 = bVar2; + } + CharacterDeathOrder(this,iVar5,uVar8,(char *)&Responsible,bVar3); + Responsible = (TCreature *)((uint)Responsible & 0xffffff00); + } +LAB_080a1376: + Unjustified = Unjustified + 1; + } while (Unjustified < 3); + } +LAB_080a1103: + AnnounceChangedCreature(this->ID,1); + return (int)(Object *)Damage; + } + } + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)(Remark + 0x1c); + iVar5 = 4; + goto LAB_080a1a50; + } +LAB_080a1c71: + unique0x00009680 = (this->CrObject).ObjectID; + pOVar14 = (Object *)(Remark + 0x1c); + } + iVar5 = 3; +LAB_080a1a50: + GraphicalEffect(pOVar14,iVar5); + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: Execute_local +// DWARF original prototype: bool MovePossible(TCreature * this, int x, int y, int z, bool Execute, +// bool Jump) + +bool __thiscall TCreature::MovePossible(TCreature *this,int x,int y,int z,bool Execute,bool Jump) + +{ + bool bVar1; + bool local_18; + bool Execute_local; + + if (Jump) { + local_18 = JumpPossible(x,y,z,false); + } + else { + local_18 = false; + // try { // try from 080a2053 to 080a20dd has its CatchHandler @ 080a20e7 + bVar1 = CoordinateFlag(); + if (bVar1) { + local_18 = CoordinateFlag(); + local_18 = !local_18; + } + } + bVar1 = false; + if (local_18 != false) { + if ((!Execute) && (bVar1 = CoordinateFlag(), bVar1)) { + return false; + } + bVar1 = true; + } + return bVar1; +} + + + +// DWARF original prototype: void TRaceData(TRaceData * this) + +void __thiscall TRaceData::TRaceData(TRaceData *this) + +{ + int i; + int iVar1; + + ObjectType::setTypeID(&this->MaleCorpse,0); + ObjectType::setTypeID(&this->FemaleCorpse,0); + vector::vector(&this->Skill,1,5,5); + // try { // try from 080a2181 to 080a2185 has its CatchHandler @ 080a22e4 + vector<>::vector(&this->Talk,1,5,5,0); + // try { // try from 080a21a7 to 080a21ab has its CatchHandler @ 080a22e0 + vector::vector(&this->Item,1,5,5); + // try { // try from 080a21cd to 080a21d1 has its CatchHandler @ 080a22a0 + vector::vector(&this->Spell,1,5,5); + this->Name[0] = '\0'; + iVar1 = 1; + this->Article[0] = '\0'; + (this->Outfit).OutfitID = 0; + (this->Outfit).field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + this->Blood = BT_BLOOD; + this->ExperiencePoints = 0; + this->FleeThreshold = 0; + this->Attack = 0; + this->Defend = 0; + this->Armor = 0; + this->Poison = 0; + this->SummonCost = 0; + this->LoseTarget = 0; + this->Strategy[0] = 100; + do { + this->Strategy[iVar1] = 0; + iVar1 = iVar1 + 1; + } while (iVar1 < 4); + this->KickBoxes = false; + this->KickCreatures = false; + this->SeeInvisible = false; + this->Unpushable = false; + this->DistanceFighting = false; + this->NoSummon = false; + this->NoIllusion = false; + this->NoConvince = false; + this->NoBurning = false; + this->NoPoison = false; + this->NoEnergy = false; + this->NoHit = false; + this->NoLifeDrain = false; + this->NoParalyze = false; + this->Skills = 0; + this->Talks = 0; + this->Items = 0; + this->Spells = 0; + return; +} + + + +// DWARF original prototype: void TRaceData(TRaceData * this) + +void __thiscall TRaceData::TRaceData(TRaceData *this) + +{ + int i; + int iVar1; + + ObjectType::setTypeID(&this->MaleCorpse,0); + ObjectType::setTypeID(&this->FemaleCorpse,0); + vector::vector(&this->Skill,1,5,5); + // try { // try from 080a2371 to 080a2375 has its CatchHandler @ 080a24d4 + vector<>::vector(&this->Talk,1,5,5,0); + // try { // try from 080a2397 to 080a239b has its CatchHandler @ 080a24d0 + vector::vector(&this->Item,1,5,5); + // try { // try from 080a23bd to 080a23c1 has its CatchHandler @ 080a2490 + vector::vector(&this->Spell,1,5,5); + this->Name[0] = '\0'; + iVar1 = 1; + this->Article[0] = '\0'; + (this->Outfit).OutfitID = 0; + (this->Outfit).field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + this->Blood = BT_BLOOD; + this->ExperiencePoints = 0; + this->FleeThreshold = 0; + this->Attack = 0; + this->Defend = 0; + this->Armor = 0; + this->Poison = 0; + this->SummonCost = 0; + this->LoseTarget = 0; + this->Strategy[0] = 100; + do { + this->Strategy[iVar1] = 0; + iVar1 = iVar1 + 1; + } while (iVar1 < 4); + this->KickBoxes = false; + this->KickCreatures = false; + this->SeeInvisible = false; + this->Unpushable = false; + this->DistanceFighting = false; + this->NoSummon = false; + this->NoIllusion = false; + this->NoConvince = false; + this->NoBurning = false; + this->NoPoison = false; + this->NoEnergy = false; + this->NoHit = false; + this->NoLifeDrain = false; + this->NoParalyze = false; + this->Skills = 0; + this->Talks = 0; + this->Items = 0; + this->Spells = 0; + return; +} + + + +char * GetRaceName(int Race) + +{ + TRaceData *pTVar1; + + if (Race - 1U < 0x1ff) { + pTVar1 = RaceData + Race; + } + else { + error(&DAT_08102100,Race); + pTVar1 = (TRaceData *)0x0; + } + return pTVar1->Name; +} + + + +TOutfit GetRaceOutfit(int Race) + +{ + int iVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + TOutfit TVar3; + int in_stack_00000008; + + if (in_stack_00000008 - 1U < 0x1ff) { + iVar1 = RaceData[in_stack_00000008].Outfit.OutfitID; + aVar2 = RaceData[in_stack_00000008].Outfit.field_1; + } + else { + error(&DAT_08102140); + iVar1 = RaceData[1].Outfit.OutfitID; + aVar2 = RaceData[1].Outfit.field_1; + } + *(int *)Race = iVar1; + *(anon_union_4_2_730cd3ca_for_TOutfit_2 *)(Race + 4) = aVar2; + TVar3.field_1 = aVar2; + TVar3.OutfitID = Race; + return TVar3; +} + + + +bool GetRaceNoSummon(int Race) + +{ + undefined1 uVar1; + + if (Race - 1U < 0x1ff) { + uVar1 = RaceData[Race].NoSummon; + } + else { + error(&DAT_08102180,Race); + uVar1 = 1; + } + return (bool)uVar1; +} + + + +bool GetRaceNoConvince(int Race) + +{ + undefined1 uVar1; + + if (Race - 1U < 0x1ff) { + uVar1 = RaceData[Race].NoConvince; + } + else { + error(&DAT_081021c0,Race); + uVar1 = 1; + } + return (bool)uVar1; +} + + + +bool GetRaceNoIllusion(int Race) + +{ + undefined1 uVar1; + + if (Race - 1U < 0x1ff) { + uVar1 = RaceData[Race].NoIllusion; + } + else { + error(&DAT_08102200,Race); + uVar1 = 1; + } + return (bool)uVar1; +} + + + +bool GetRaceNoParalyze(int Race) + +{ + undefined1 uVar1; + + if (Race - 1U < 0x1ff) { + uVar1 = RaceData[Race].NoParalyze; + } + else { + error(&DAT_08102240,Race); + uVar1 = 1; + } + return (bool)uVar1; +} + + + +int GetRaceSummonCost(int Race) + +{ + int iVar1; + + if (Race - 1U < 0x1ff) { + iVar1 = RaceData[Race].SummonCost; + } + else { + error(&DAT_08102280,Race); + iVar1 = 0; + } + return iVar1; +} + + + +int GetRacePoison(int Race) + +{ + int iVar1; + + if (Race - 1U < 0x1ff) { + iVar1 = RaceData[Race].Poison; + } + else { + error(&DAT_081022c0,Race); + iVar1 = 0; + } + return iVar1; +} + + + +bool GetRaceUnpushable(int Race) + +{ + undefined1 uVar1; + + if (Race - 1U < 0x1ff) { + uVar1 = RaceData[Race].Unpushable; + } + else { + error(&DAT_08102300,Race); + uVar1 = 1; + } + return (bool)uVar1; +} + + + +void LoadRace(char *FileName) + +{ + TReadScriptFile *pTVar1; + char cVar2; + char *pcVar3; + TSpellData *pTVar4; + TItemData *this; + ulong uVar5; + ulong *puVar6; + int iVar7; + TSkillData *pTVar8; + char *pcVar9; + int iVar10; + int iVar11; + int SkillNr; + char *pcVar12; + char *pcVar13; + undefined1 uVar14; + char *Impact; + TRaceData *R; + char *Shape; + TOutfit HelpOutfit; + ObjectType local_402c [4]; + char local_401c [4]; + char Ident [30]; + TReadScriptFile Script; + + uVar14 = &stack0x00000000 == (undefined1 *)0x406c; + pcVar3 = FileName; + // try { // try from 080a2768 to 080a277a has its CatchHandler @ 080a3a74 + print(); + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 080a2788 to 080a39ea has its CatchHandler @ 080a3a57 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),FileName,(int)pcVar3); + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar10 = 0xb; + pcVar9 = "racenumber"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar14 = *pcVar3 == *pcVar9; + pcVar3 = pcVar3 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar14); + if (!(bool)uVar14) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"race number expected"); + } + pcVar3 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar10 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + if (0x1fe < iVar10 - 1U) { + pcVar3 = "illegal race number"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"illegal race number"); + } + if (RaceData[iVar10].Name[0] != '\0') { + pcVar3 = "race already defined"; + // try { // try from 080a3a17 to 080a3a51 has its CatchHandler @ 080a3a57 + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"race already defined"); + } + RaceData[iVar10].Outfit.field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + RaceData[iVar10].Outfit.OutfitID = iVar10; + do { + do { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffc004 == 0) { + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)pcVar3); + // try { // try from 080a39f4 to 080a39f8 has its CatchHandler @ 080a3a74 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)pcVar3); + return; + } + uVar14 = stack0xffffc004 == 1; + if (!(bool)uVar14) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"identifier expected"); + } + pcVar3 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy(local_401c,pcVar3); + pcVar3 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar11 = 5; + pcVar9 = local_401c; + pcVar12 = "name"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pcVar3 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + strcpy(RaceData[iVar10].Name,pcVar3); + } + iVar11 = 8; + pcVar9 = local_401c; + pcVar12 = "article"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pcVar3 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + uVar14 = RaceData[iVar10].Article == (char *)0x0; + strcpy(RaceData[iVar10].Article,pcVar3); + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "outfit"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pcVar3 = Ident + 0x1c; + uVar14 = &RaceData[iVar10].Outfit == (TOutfit *)0x0; + TOutfit::load(&RaceData[iVar10].Outfit,(TReadScriptFile *)pcVar3); + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "corpse"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + ObjectType::setTypeID((ObjectType *)&HelpOutfit.field_1,iVar11); + ObjectType::setTypeID(&RaceData[iVar10].MaleCorpse,(int)HelpOutfit.field_1); + ObjectType::setTypeID(local_402c,RaceData[iVar10].MaleCorpse.TypeID); + uVar14 = &RaceData[iVar10].FemaleCorpse == (ObjectType *)0x0; + ObjectType::setTypeID(local_402c,RaceData[iVar10].MaleCorpse.TypeID); + ObjectType::setTypeID(&RaceData[iVar10].FemaleCorpse,local_402c[0].TypeID); + pcVar3 = (char *)RaceData[iVar10].FemaleCorpse.TypeID; + ObjectType::setTypeID((ObjectType *)&HelpOutfit.field_1,(int)pcVar3); + } + iVar11 = 8; + pcVar9 = local_401c; + pcVar12 = "corpses"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + ObjectType::setTypeID(local_402c,iVar11); + ObjectType::setTypeID(&RaceData[iVar10].MaleCorpse,local_402c[0].TypeID); + ObjectType::setTypeID + ((ObjectType *)&HelpOutfit.field_1,RaceData[iVar10].MaleCorpse.TypeID); + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + uVar14 = &RaceData[iVar10].FemaleCorpse == (ObjectType *)0x0; + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + ObjectType::setTypeID(local_402c,iVar11); + ObjectType::setTypeID(&RaceData[iVar10].FemaleCorpse,local_402c[0].TypeID); + pcVar3 = (char *)RaceData[iVar10].FemaleCorpse.TypeID; + ObjectType::setTypeID((ObjectType *)&HelpOutfit.field_1,(int)pcVar3); + } + iVar11 = 6; + pcVar9 = local_401c; + pcVar12 = "blood"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pcVar9 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar11 = 6; + pcVar12 = pcVar9; + pcVar13 = "blood"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Blood = BT_BLOOD; + } + else { + iVar11 = 6; + pcVar12 = pcVar9; + pcVar13 = "slime"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Blood = BT_SLIME; + } + else { + iVar11 = 6; + pcVar12 = pcVar9; + pcVar13 = "bones"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Blood = BT_BONES; + } + else { + iVar11 = 5; + pcVar12 = pcVar9; + pcVar13 = "fire"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Blood = BT_FIRE; + } + else { + iVar11 = 7; + pcVar12 = "energy"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Blood = BT_ENERGY; + } + else { + pcVar3 = "unknown blood type"; + TReadScriptFile::error + ((TReadScriptFile *)(Ident + 0x1c), + "unknown blood type"); + } + } + } + } + } + } + iVar11 = 0xb; + pcVar9 = local_401c; + pcVar12 = "experience"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].ExperiencePoints = iVar11; + } + iVar11 = 0xb; + pcVar9 = local_401c; + pcVar12 = "summoncost"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].SummonCost = iVar11; + } + iVar11 = 0xe; + pcVar9 = local_401c; + pcVar12 = "fleethreshold"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].FleeThreshold = iVar11; + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "attack"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].Attack = iVar11; + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "defend"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].Defend = iVar11; + } + iVar11 = 6; + pcVar9 = local_401c; + pcVar12 = "armor"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].Armor = iVar11; + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "poison"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].Poison = iVar11; + } + iVar11 = 0xb; + pcVar9 = local_401c; + pcVar12 = "losetarget"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + RaceData[iVar10].LoseTarget = iVar11; + } + iVar11 = 9; + pcVar9 = local_401c; + pcVar12 = "strategy"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = 0; + do { + if (iVar11 != 0) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + } + iVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + *(int *)(iVar10 * 0x150 + 0x81c47b8 + iVar11 * 4) = iVar7; + iVar11 = iVar11 + 1; + uVar14 = iVar11 == 3; + } while (iVar11 < 4); + pcVar3 = (char *)0x29; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')'); + } + iVar11 = 6; + pcVar9 = local_401c; + pcVar12 = "flags"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pcVar3 = (char *)0x7b; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + pcVar9 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar11 = 10; + pcVar12 = pcVar9; + pcVar13 = "kickboxes"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].KickBoxes = true; + } + iVar11 = 0xe; + pcVar12 = pcVar9; + pcVar13 = "kickcreatures"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].KickCreatures = true; + } + iVar11 = 0xd; + pcVar12 = pcVar9; + pcVar13 = "seeinvisible"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].SeeInvisible = true; + } + iVar11 = 0xb; + pcVar12 = pcVar9; + pcVar13 = "unpushable"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].Unpushable = true; + } + iVar11 = 0x11; + pcVar12 = pcVar9; + pcVar13 = "distancefighting"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].DistanceFighting = true; + } + iVar11 = 9; + pcVar12 = pcVar9; + pcVar13 = "nosummon"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoSummon = true; + } + iVar11 = 0xb; + pcVar12 = pcVar9; + pcVar13 = "noconvince"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoConvince = true; + } + iVar11 = 0xb; + pcVar12 = pcVar9; + pcVar13 = "noillusion"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoIllusion = true; + } + iVar11 = 10; + pcVar12 = pcVar9; + pcVar13 = "noburning"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoBurning = true; + } + iVar11 = 9; + pcVar12 = pcVar9; + pcVar13 = "nopoison"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoPoison = true; + } + iVar11 = 9; + pcVar12 = pcVar9; + pcVar13 = "noenergy"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoEnergy = true; + } + iVar11 = 6; + pcVar12 = pcVar9; + pcVar13 = "nohit"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoHit = true; + } + iVar11 = 0xc; + pcVar12 = pcVar9; + pcVar13 = "nolifedrain"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar12 == *pcVar13; + pcVar12 = pcVar12 + 1; + pcVar13 = pcVar13 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoLifeDrain = true; + } + iVar11 = 0xb; + pcVar12 = "noparalyze"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + RaceData[iVar10].NoParalyze = true; + } + cVar2 = TReadScriptFile::readSpecial((TReadScriptFile *)(Ident + 0x1c)); + uVar14 = cVar2 == '}'; + } while (!(bool)uVar14); + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "skills"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar11 = GetSkillByName(pcVar3); + if (iVar11 == -1) { + TReadScriptFile::error + ((TReadScriptFile *)(Ident + 0x1c),"unknown skill name"); + } + iVar7 = RaceData[iVar10].Skills + 1; + RaceData[iVar10].Skills = iVar7; + pTVar8 = vector::operator()(&RaceData[iVar10].Skill,iVar7); + pTVar8->Nr = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->Actual = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->Minimum = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->Maximum = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->NextLevel = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->FactorPercent = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar8->AddLevel = iVar11; + pcVar3 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + cVar2 = TReadScriptFile::readSpecial(pTVar1); + uVar14 = cVar2 == '}'; + } while (!(bool)uVar14); + } + iVar11 = 5; + pcVar9 = local_401c; + pcVar12 = "talk"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + RaceData[iVar10].Talks = RaceData[iVar10].Talks + 1; + pcVar3 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + uVar5 = AddDynamicString(pcVar3); + pcVar3 = (char *)RaceData[iVar10].Talks; + puVar6 = vector<>::operator()(&RaceData[iVar10].Talk,(int)pcVar3); + *puVar6 = uVar5; + cVar2 = TReadScriptFile::readSpecial((TReadScriptFile *)(Ident + 0x1c)); + uVar14 = cVar2 == '}'; + } while (!(bool)uVar14); + } + iVar11 = 10; + pcVar9 = local_401c; + pcVar12 = "inventory"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = RaceData[iVar10].Items + 1; + RaceData[iVar10].Items = iVar11; + this = vector::operator()(&RaceData[iVar10].Item,iVar11); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + ObjectType::setTypeID(local_402c,iVar11); + ObjectType::setTypeID(&this->Type,local_402c[0].TypeID); + ObjectType::setTypeID((ObjectType *)&HelpOutfit.field_1,(this->Type).TypeID); + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + this->Maximum = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + this->Probability = iVar11; + pcVar3 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + cVar2 = TReadScriptFile::readSpecial(pTVar1); + uVar14 = cVar2 == '}'; + } while (!(bool)uVar14); + } + iVar11 = 7; + pcVar9 = local_401c; + pcVar12 = "spells"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + } while (!(bool)uVar14); + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + iVar11 = RaceData[iVar10].Spells + 1; + uVar14 = iVar11 == 0; + RaceData[iVar10].Spells = iVar11; + pTVar4 = vector::operator()(&RaceData[iVar10].Spell,iVar11); + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar11 = 6; + pcVar9 = pcVar3; + pcVar12 = "actor"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Shape = SHAPE_ACTOR; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ShapeParam1 = iVar11; +LAB_080a2c00: + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')'); + } + else { + iVar11 = 7; + pcVar9 = pcVar3; + pcVar12 = "victim"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Shape = SHAPE_VICTIM; +LAB_080a2b8a: + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ShapeParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ShapeParam2 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ShapeParam3 = iVar11; + goto LAB_080a2c00; + } + iVar11 = 7; + pcVar9 = pcVar3; + pcVar12 = "origin"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Shape = SHAPE_ORIGIN; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ShapeParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ShapeParam2 = iVar11; + goto LAB_080a2c00; + } + iVar11 = 0xc; + pcVar9 = pcVar3; + pcVar12 = "destination"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Shape = SHAPE_DESTINATION; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ShapeParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ShapeParam2 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ShapeParam3 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ShapeParam4 = iVar11; + goto LAB_080a2c00; + } + iVar11 = 6; + pcVar9 = "angle"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar3 == *pcVar9; + pcVar3 = pcVar3 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Shape = SHAPE_ANGLE; + goto LAB_080a2b8a; + } + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"unknown spell shape"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'I'); + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar11 = 7; + pcVar9 = pcVar3; + pcVar12 = "damage"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_DAMAGE; + goto LAB_080a2f08; + } + iVar11 = 6; + pcVar9 = pcVar3; + pcVar12 = "field"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_FIELD; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam1 = iVar11; +LAB_080a2d71: + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')'); + } + else { + iVar11 = 8; + pcVar9 = pcVar3; + pcVar12 = "healing"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_HEALING; +LAB_080a2d18: + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam2 = iVar11; + goto LAB_080a2d71; + } + iVar11 = 6; + pcVar9 = pcVar3; + pcVar12 = "speed"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_SPEED; +LAB_080a2f08: + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ImpactParam2 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ImpactParam3 = iVar11; + goto LAB_080a2d71; + } + iVar11 = 8; + pcVar9 = pcVar3; + pcVar12 = "drunken"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_DRUNKEN; + goto LAB_080a2f08; + } + iVar11 = 9; + pcVar9 = pcVar3; + pcVar12 = "strength"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_STRENGTH; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam1 = iVar11; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ImpactParam2 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); + iVar11 = TReadScriptFile::readNumber(pTVar1); + pTVar4->ImpactParam3 = iVar11; + TReadScriptFile::readSymbol(pTVar1,','); +LAB_080a2e6c: + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam4 = iVar11; + goto LAB_080a2d71; + } + iVar11 = 7; + pcVar9 = pcVar3; + pcVar12 = "outfit"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar9 == *pcVar12; + pcVar9 = pcVar9 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_OUTFIT; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + TOutfit::load((TOutfit *)&Shape,(TReadScriptFile *)(Ident + 0x1c)); + pTVar4->ImpactParam1 = (int)Shape; + pTVar4->ImpactParam2 = (uint)(ushort)HelpOutfit.OutfitID; + pTVar4->ImpactParam3 = (uint)HelpOutfit.OutfitID._2_2_; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + goto LAB_080a2e6c; + } + iVar11 = 7; + pcVar9 = "summon"; + do { + if (iVar11 == 0) break; + iVar11 = iVar11 + -1; + uVar14 = *pcVar3 == *pcVar9; + pcVar3 = pcVar3 + 1; + pcVar9 = pcVar9 + 1; + } while ((bool)uVar14); + if ((bool)uVar14) { + pTVar4->Impact = IMPACT_SUMMON; + goto LAB_080a2d18; + } + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"unknown spell impact"); + } + pcVar3 = (char *)0x3a; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),':'); + iVar11 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + pTVar4->Delay = iVar11; + if (iVar11 == 0) { + pcVar3 = "zero spell delay"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"zero spell delay"); + } + cVar2 = TReadScriptFile::readSpecial((TReadScriptFile *)(Ident + 0x1c)); + } while (cVar2 != '}'); + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadRaces(void) + +{ + char *__s; + dirent *DirEntry; + DIR *__dirp; + dirent *pdVar1; + size_t sVar2; + undefined4 *puVar3; + int iVar4; + char *s; + char *pcVar5; + char *pcVar6; + bool bVar7; + DIR *WorkDir; + char FileName [4096]; + + __dirp = opendir(MONSTERPATH); + if (__dirp == (DIR *)0x0) { + error("LoadRaces: Unterverzeichnis %s nicht gefunden\n",MONSTERPATH); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "Cannot load races"; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); + } + do { + do { + pdVar1 = readdir(__dirp); + if (pdVar1 == (dirent *)0x0) { + closedir(__dirp); + return; + } + __s = pdVar1->d_name; + sVar2 = strlen(__s); + bVar7 = sVar2 == 4; + } while (sVar2 < 5); + iVar4 = 4; + pcVar5 = __s + (sVar2 - 4); + pcVar6 = ".mon"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar7 = *pcVar5 == *pcVar6; + pcVar5 = pcVar5 + 1; + pcVar6 = pcVar6 + 1; + } while (bVar7); + if (bVar7) { + sprintf((char *)&WorkDir,"%s/%s",MONSTERPATH,__s); + // try { // try from 080a3b22 to 080a3b7f has its CatchHandler @ 080a3b80 + LoadRace((char *)&WorkDir); + } + } while( true ); +} + + + +// DWARF original prototype: void TAttackWave(TAttackWave * this) + +void __thiscall TAttackWave::TAttackWave(TAttackWave *this) + +{ + vector::vector(&this->ExtraItem,1,5,5); + this->x = 0; + this->y = 0; + this->z = 0; + this->Spread = 0; + this->Race = -1; + this->MinCount = 0; + this->MaxCount = 0; + this->Radius = 0x7fffffff; + this->Lifetime = 0; + this->Message = 0; + this->ExtraItems = 0; + return; +} + + + +// DWARF original prototype: void TAttackWave(TAttackWave * this) + +void __thiscall TAttackWave::TAttackWave(TAttackWave *this) + +{ + vector::vector(&this->ExtraItem,1,5,5); + this->x = 0; + this->y = 0; + this->z = 0; + this->Spread = 0; + this->Race = -1; + this->MinCount = 0; + this->MaxCount = 0; + this->Radius = 0x7fffffff; + this->Lifetime = 0; + this->Message = 0; + this->ExtraItems = 0; + return; +} + + + +// DWARF original prototype: void ~TAttackWave(TAttackWave * this, int __in_chrg) + +void __thiscall TAttackWave::~TAttackWave(TAttackWave *this,int __in_chrg) + +{ + TItemData *pTVar1; + + if (this->Message != 0) { + DeleteDynamicString(this->Message); + } + pTVar1 = (this->ExtraItem).entry; + if (pTVar1 == (TItemData *)0x0) { + return; + } + operator_delete__(pTVar1); + return; +} + + + +// DWARF original prototype: void ~TAttackWave(TAttackWave * this, int __in_chrg) + +void __thiscall TAttackWave::~TAttackWave(TAttackWave *this,int __in_chrg) + +{ + TItemData *pTVar1; + + if (this->Message != 0) { + DeleteDynamicString(this->Message); + } + pTVar1 = (this->ExtraItem).entry; + if (pTVar1 == (TItemData *)0x0) { + return; + } + operator_delete__(pTVar1); + return; +} + + + +void LoadMonsterRaid(char *FileName,int Start,bool *Type,int *Date,int *Interval,int *Duration) + +{ + TReadScriptFile *pTVar1; + bool bVar2; + char cVar3; + char *pcVar4; + char *pcVar5; + TAttackWave *this; + TItemData *this_00; + ulong uVar6; + undefined4 *puVar7; + int End; + int iVar8; + int iVar9; + char *pcVar10; + undefined1 uVar11; + char *in_stack_ffffbfac; + int Delay; + TAttackWave *AttackWave; + ObjectType local_402c [4]; + char local_401c [4]; + char Ident [30]; + TReadScriptFile Script; + + if (FileName == (char *)0x0) { + pcVar4 = "LoadMonsterRaid: Dateiname ist NULL.\n"; +LAB_080a45c3: + // try { // try from 080a45c3 to 080a45f1 has its CatchHandler @ 080a4636 + error(pcVar4); + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = "cannot load monster raid"; + // WARNING: Subroutine does not return + __cxa_throw(puVar7,char_const*::typeinfo,0); + } + uVar11 = Start == 0; + if (Start < 0) { + if ((((Type == (bool *)0x0) || (Date == (int *)0x0)) || (Interval == (int *)0x0)) || + (uVar11 = Duration == (int *)0x0, (bool)uVar11)) { + pcVar4 = &DAT_08102420; + goto LAB_080a45c3; + } + *Date = 0; + *Interval = 0; + *Duration = 0; + } + else { + in_stack_ffffbfac = FileName; + // try { // try from 080a3d82 to 080a3d94 has its CatchHandler @ 080a4636 + print(); + } + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + // try { // try from 080a3da2 to 080a3ebd has its CatchHandler @ 080a4630 + TReadScriptFile::open(pTVar1,FileName,(int)in_stack_ffffbfac); + TReadScriptFile::nextToken(pTVar1); + pcVar4 = TReadScriptFile::getIdentifier(pTVar1); + iVar8 = 0xc; + pcVar5 = "description"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + } + pcVar4 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar8 = 5; + pcVar5 = "type"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while ((bool)uVar11); + if (!(bool)uVar11) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"type expected"); + } + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + uVar11 = Start == 0; + if (Start < 0) { + pcVar4 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar8 = 8; + pcVar5 = "bigraid"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while ((bool)uVar11); + *Type = (bool)uVar11; + } + TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + pcVar4 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar8 = 5; + pcVar5 = "date"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + pcVar4 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + uVar11 = Start == 0; + if (-1 < Start) goto LAB_080a3e84; + iVar8 = TReadScriptFile::getNumber((TReadScriptFile *)(Ident + 0x1c)); + } + else { + pcVar4 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar8 = 9; + pcVar5 = "interval"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar4 == *pcVar5; + pcVar4 = pcVar4 + 1; + pcVar5 = pcVar5 + 1; + } while ((bool)uVar11); + if (!(bool)uVar11) { + pcVar4 = "date or interval expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"date or interval expected"); + goto LAB_080a3e84; + } + pcVar4 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + uVar11 = Start == 0; + if (-1 < Start) goto LAB_080a3e84; + iVar8 = TReadScriptFile::getNumber((TReadScriptFile *)(Ident + 0x1c)); + Date = Interval; + } + *Date = iVar8; +LAB_080a3e84: + pcVar5 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar8 = 6; + pcVar10 = "delay"; + do { + if (iVar8 == 0) break; + iVar8 = iVar8 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if (!(bool)uVar11) { + pcVar4 = "delay expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"delay expected"); + } + do { + if (unique0x100007f5 != 1) { + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)pcVar4); + // try { // try from 080a3ec7 to 080a3ecb has its CatchHandler @ 080a4636 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)pcVar4); + return; + } + pcVar4 = (char *)0x3d; + // try { // try from 080a3eea to 080a3f08 has its CatchHandler @ 080a4630 + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar8 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this = (TAttackWave *)operator_new(0x54); + // try { // try from 080a3f0e to 080a3f12 has its CatchHandler @ 080a45fb + TAttackWave::TAttackWave(this); + // try { // try from 080a3f22 to 080a4573 has its CatchHandler @ 080a4630 + while (TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)), stack0xffffc004 != 0) + { + uVar11 = stack0xffffc004 == 1; + if (!(bool)uVar11) { + pcVar4 = "identifier expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"identifier expected"); + } + pcVar5 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar9 = 6; + pcVar10 = "delay"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) break; + pcVar4 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy(local_401c,pcVar4); + pcVar4 = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar9 = 9; + pcVar5 = local_401c; + pcVar10 = "location"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + } + iVar9 = 9; + pcVar5 = local_401c; + pcVar10 = "position"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + pcVar4 = (char *)this; + TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c)); + } + iVar9 = 7; + pcVar5 = local_401c; + pcVar10 = "spread"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this->Spread = iVar9; + } + iVar9 = 5; + pcVar5 = local_401c; + pcVar10 = "race"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this->Race = iVar9; + bVar2 = false; + if ((0 < this->Race) && (this->Race < 0x200)) { + bVar2 = true; + } + uVar11 = !bVar2; + if ((bool)uVar11) { + pcVar4 = "illegal race number"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"illegal race number"); + } + } + iVar9 = 6; + pcVar5 = local_401c; + pcVar10 = "count"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this->MinCount = iVar9; + pTVar1 = (TReadScriptFile *)(Ident + 0x1c); + TReadScriptFile::readSymbol(pTVar1,','); + iVar9 = TReadScriptFile::readNumber(pTVar1); + this->MaxCount = iVar9; + pcVar4 = (char *)0x29; + TReadScriptFile::readSymbol(pTVar1,')'); + if (this->MaxCount < this->MinCount) { + pcVar4 = "mincount greater than maxcount"; + TReadScriptFile::error(pTVar1,"mincount greater than maxcount"); + } + uVar11 = this->MinCount == 0; + if ((this->MinCount < 0) || (uVar11 = this->MaxCount == 0, this->MaxCount < 1)) { + pcVar4 = "illegal number of monsters"; + TReadScriptFile::error + ((TReadScriptFile *)(Ident + 0x1c),"illegal number of monsters"); + } + } + iVar9 = 7; + pcVar5 = local_401c; + pcVar10 = "radius"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this->Radius = iVar9; + } + iVar9 = 9; + pcVar5 = local_401c; + pcVar10 = "lifetime"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this->Lifetime = iVar9; + } + iVar9 = 8; + pcVar5 = local_401c; + pcVar10 = "message"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + pcVar5 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + uVar6 = AddDynamicString(pcVar5); + this->Message = uVar6; + } + iVar9 = 10; + pcVar5 = local_401c; + pcVar10 = "inventory"; + do { + if (iVar9 == 0) break; + iVar9 = iVar9 + -1; + uVar11 = *pcVar5 == *pcVar10; + pcVar5 = pcVar5 + 1; + pcVar10 = pcVar10 + 1; + } while ((bool)uVar11); + if ((bool)uVar11) { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'{'); + do { + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'('); + iVar9 = this->ExtraItems + 1; + this->ExtraItems = iVar9; + this_00 = vector::operator()(&this->ExtraItem,iVar9); + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + ObjectType::setTypeID((ObjectType *)&AttackWave,iVar9); + ObjectType::setTypeID(&this_00->Type,(int)AttackWave); + ObjectType::setTypeID(local_402c,(this_00->Type).TypeID); + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this_00->Maximum = iVar9; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),','); + iVar9 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this_00->Probability = iVar9; + pcVar4 = (char *)0x29; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')'); + cVar3 = TReadScriptFile::readSpecial((TReadScriptFile *)(Ident + 0x1c)); + } while (cVar3 != '}'); + } + } + if (this->x == 0) { + pcVar4 = "position expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"position expected"); + } + if (this->Race == -1) { + pcVar4 = "race expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"race expected"); + } + if (this->MaxCount == 0) { + pcVar4 = "count expected"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"count expected"); + } + if (Start < 0) { + iVar9 = iVar8 + this->Lifetime; + if (this->Lifetime == 0) { + iVar9 = iVar8 + 0xe10; + } + if (*Duration < iVar9) { + *Duration = iVar9; + } + if (this != (TAttackWave *)0x0) { + TAttackWave::~TAttackWave(this,(int)pcVar4); + operator_delete(this); + } + } + else { + pcVar4 = (char *)(Start + iVar8); + priority_queue<>::insert(&AttackWaveQueue); + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadMonsterRaids(void) + +{ + char *__s; + dirent *DirEntry; + time_t tVar1; + DIR *__dirp; + dirent *pdVar2; + size_t sVar3; + long lVar4; + undefined4 *puVar5; + int iVar6; + char *s; + int iVar7; + char *pcVar8; + byte *pbVar9; + bool bVar10; + bool bVar11; + int BigRaidDuration; + int TieBreaker; + DIR *WorkDir; + time_t Now; + int iStack_2030; + bool BigRaid; + int Date; + int Interval; + int Duration; + int Hour; + int Minute; + char FileName [4096]; + char BigRaidName [4096]; + + tVar1 = time((time_t *)0x0); + // try { // try from 080a4681 to 080a4a1b has its CatchHandler @ 080a4a20 + GetRealTime(&Duration,&Hour); + iVar7 = (((RebootTime - (Hour + Duration * 0x3c)) + 0x5a0) % 0x5a0) * 0x3c; + __dirp = opendir(MONSTERPATH); + if (__dirp == (DIR *)0x0) { + error("LoadMonsterRaids: Unterverzeichnis %s nicht gefunden.\n",MONSTERPATH); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = "Cannot load monster raids"; + // WARNING: Subroutine does not return + __cxa_throw(puVar5,char_const*::typeinfo,0); + } + FileName[0xffc] = '\0'; + BigRaidDuration = -1; + do { + do { + pdVar2 = readdir(__dirp); + if (pdVar2 == (dirent *)0x0) { + closedir(__dirp); + if (FileName[0xffc] != '\0') { + lVar4 = random(); + LoadMonsterRaid(FileName + 0xffc,lVar4 + RoundNr,(bool *)0x0,(int *)0x0, + (int *)0x0,(int *)0x0); + } + return; + } + __s = pdVar2->d_name; + sVar3 = strlen(__s); + bVar10 = sVar3 < 4; + bVar11 = sVar3 == 4; + } while (sVar3 < 5); + iVar6 = 4; + pcVar8 = __s + (sVar3 - 4); + pbVar9 = &DAT_080fe05c; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar10 = (byte)*pcVar8 < *pbVar9; + bVar11 = *pcVar8 == *pbVar9; + pcVar8 = pcVar8 + 1; + pbVar9 = pbVar9 + 1; + } while (bVar11); + if ((!bVar10 && !bVar11) == bVar10) { + sprintf((char *)&Minute,"%s/%s",MONSTERPATH,__s); + LoadMonsterRaid((char *)&Minute,-1,(bool *)((int)&Now + 3),&stack0xffffdfd0,&Date, + &Interval); + print(); + if (0 < iStack_2030) { + bVar10 = false; + if ((tVar1 <= iStack_2030) && (bVar10 = true, tVar1 + iVar7 < iStack_2030)) { + bVar10 = false; + } + if ((bVar10) && + (LoadMonsterRaid((char *)&Minute,(iStack_2030 + RoundNr) - tVar1,(bool *)0x0, + (int *)0x0,(int *)0x0,(int *)0x0), Now._3_1_ != '\0')) { + FileName[0xffc] = '\0'; + BigRaidDuration = 100; + } + } + if (((iStack_2030 == 0) && (Interval <= iVar7)) && (lVar4 = random(), lVar4 < iVar7)) { + if (Now._3_1_ == '\0') { + lVar4 = random(); + LoadMonsterRaid((char *)&Minute,lVar4 + RoundNr,(bool *)0x0,(int *)0x0, + (int *)0x0,(int *)0x0); + } + else { + lVar4 = random(); + if (BigRaidDuration < lVar4) { + strcpy(FileName + 0xffc,(char *)&Minute); + BigRaidDuration = lVar4; + } + } + } + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessMonsterRaids(void) + +{ + ulong uVar1; + undefined4 uVar2; + int iVar3; + TAttackWave *pTVar4; + int iVar5; + ulong *puVar6; + bool bVar7; + long lVar8; + long lVar9; + TItemData *pTVar10; + TCreature *pTVar11; + char *pcVar12; + priority_queue_entry<> *ppVar13; + int Count; + TAttackWave *AttackWave; + ulong *puVar14; + int i; + int i_1; + int iVar15; + undefined1 local_cc [36]; + int local_a8; + int j; + int Repeat; + int Amount; + TCreature *cr; + int Monsters; + TCreature___0_ *Monster; + uint local_8c; + ulong ExecutionRound; + int posx; + int posy; + int posz; + Object Obj; + ulong local_6c [4]; + ulong local_5c [4]; + ulong local_4c [4]; + ulong local_3c [4]; + ulong local_2c; + Object Bag; + + puVar6 = (ulong *)local_cc; + do { + puVar14 = puVar6; + if (AttackWaveQueue.Entries == 0) { + return; + } + puVar14[1] = 1; + *puVar14 = (ulong)AttackWaveQueue.Entry; + puVar14[-1] = 0x80a5040; + ppVar13 = vector<>::operator()((vector<> *)*puVar14,puVar14[1]); + local_8c = ppVar13->Key; + puVar14[1] = 1; + *puVar14 = (ulong)AttackWaveQueue.Entry; + puVar14[-1] = 0x80a505d; + ppVar13 = vector<>::operator()((vector<> *)*puVar14,puVar14[1]); + pTVar4 = ppVar13->Data; + if (RoundNr < local_8c) { + return; + } + Monster = (TCreature___0_ *)puVar14; + *puVar14 = (ulong)&AttackWaveQueue; + puVar14[-1] = 0x80a4a87; + priority_queue<>::deleteMin((priority_queue<> *)*puVar14); + uVar1 = pTVar4->Race; + *puVar14 = 2; + puVar14[1] = (ulong)"Angriff von Monstern der Rasse %d.\n"; + puVar14[2] = uVar1; + puVar14[-1] = 0x80a4aa2; + print(); + if (pTVar4->Message != 0) { + *puVar14 = pTVar4->Message; + puVar14[-1] = 0x80a5006; + pcVar12 = GetDynamicString(*puVar14); + *puVar14 = 0x13; + puVar14[2] = (ulong)pcVar12; + puVar14[1] = (ulong)&DAT_08102a6c; + puVar14[-1] = 0x80a501e; + BroadcastMessage(*puVar14,(char *)puVar14[1]); + } + puVar14[1] = pTVar4->MaxCount; + *puVar14 = pTVar4->MinCount; + puVar14[-1] = 0x80a4abf; + lVar8 = random(); + cr = (TCreature *)0x0; + iVar5 = -(lVar8 * 4 + 0xfU & 0xfffffff0); + Monsters = (int)puVar14 + iVar5 + 0x1c; + if (0 < lVar8) { + do { + *(int *)((int)puVar14 + iVar5 + 4) = pTVar4->Spread; + *(int *)((int)puVar14 + iVar5) = -pTVar4->Spread; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4b14; + lVar9 = random(); + ExecutionRound = lVar9 + pTVar4->x; + *(int *)((int)puVar14 + iVar5 + 4) = pTVar4->Spread; + *(int *)((int)puVar14 + iVar5) = -pTVar4->Spread; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4b32; + lVar9 = random(); + posx = lVar9 + pTVar4->y; + posy = pTVar4->z; + *(undefined4 *)((int)puVar14 + iVar5 + 0x14) = 0; + *(undefined4 *)((int)puVar14 + iVar5 + 0x10) = 0; + *(undefined4 *)((int)puVar14 + iVar5 + 0xc) = 1; + *(int **)((int)puVar14 + iVar5 + 8) = &posy; + *(int **)((int)puVar14 + iVar5 + 4) = &posx; + *(ulong **)((int)puVar14 + iVar5) = &ExecutionRound; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4b6e; + bVar7 = SearchFreeField(*(int **)((int)puVar14 + iVar5), + *(int **)((int)puVar14 + iVar5 + 4), + *(int **)((int)puVar14 + iVar5 + 8), + *(int *)((int)puVar14 + iVar5 + 0xc), + *(ushort *)((int)puVar14 + iVar5 + 0x10), + *(bool *)((int)puVar14 + iVar5 + 0x14)); + if (bVar7) { + *(int *)((int)puVar14 + iVar5 + 8) = posy; + *(int *)((int)puVar14 + iVar5 + 4) = posx; + *(ulong *)((int)puVar14 + iVar5) = ExecutionRound; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4f6c; + bVar7 = IsProtectionZone(); + if (!bVar7) { + *(undefined4 *)((int)puVar14 + iVar5 + 0x18) = 1; + *(undefined4 *)((int)puVar14 + iVar5 + 0x14) = 0; + *(undefined4 *)((int)puVar14 + iVar5 + 0x10) = 0; + *(int *)((int)puVar14 + iVar5 + 0xc) = posy; + *(int *)((int)puVar14 + iVar5 + 8) = posx; + *(ulong *)((int)puVar14 + iVar5 + 4) = ExecutionRound; + *(int *)((int)puVar14 + iVar5) = pTVar4->Race; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4faf; + pTVar11 = CreateMonster(*(int *)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4), + *(int *)((int)puVar14 + iVar5 + 8), + *(int *)((int)puVar14 + iVar5 + 0xc), + *(int *)((int)puVar14 + iVar5 + 0x10), + *(ulong *)((int)puVar14 + iVar5 + 0x14), + *(bool *)((int)puVar14 + iVar5 + 0x18)); + *(TCreature **)(Monsters + (int)cr * 4) = pTVar11; + if (pTVar11 != (TCreature *)0x0) { + if (pTVar4->Lifetime != 0) { + pTVar11->LifeEndRound = pTVar4->Lifetime + RoundNr; + } + *(int *)(*(int *)(Monsters + (int)cr * 4) + 0x288) = pTVar4->Radius; + cr = (TCreature *)((int)&cr->_vptr_TCreature + 1); + } + } + } + lVar8 = lVar8 + -1; + } while (lVar8 != 0); + } + iVar15 = 1; + if (0 < pTVar4->ExtraItems) { + do { + if ((int)cr < 1) break; + *(int *)((int)puVar14 + iVar5 + 4) = iVar15; + *(vector **)((int)puVar14 + iVar5) = &pTVar4->ExtraItem; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4b9c; + pTVar10 = vector::operator() + (*(vector **)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + *(undefined4 *)((int)puVar14 + iVar5) = 0; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 999; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4bb2; + lVar8 = random(); + pTVar11 = cr; + if (lVar8 <= pTVar10->Probability) { + *(undefined4 *)((int)puVar14 + iVar5) = 0; + *(undefined1 **)((int)puVar14 + iVar5 + 4) = + (undefined1 *)((int)&pTVar11[-1].Connection + 3); + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4bff; + lVar8 = random(); + Amount = *(int *)(Monsters + lVar8 * 4); + *(undefined4 *)((int)puVar14 + iVar5 + 8) = 3; + uVar2 = *(undefined4 *)(Amount + 0x208); + *(ulong **)((int)puVar14 + iVar5) = &local_2c; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = uVar2; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4c31; + GetBodyObject(*(ulong *)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + local_3c[0] = NONE.ObjectID; + if (local_2c == NONE.ObjectID) { + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0xe; + *(ulong **)((int)puVar14 + iVar5) = local_6c; + // try { // try from 080a4c4f to 080a4c9d has its CatchHandler @ 080a506a + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4c54; + GetSpecialObject(*(SPECIALMEANING *)((int)puVar14 + iVar5)); + *(undefined4 *)((int)puVar14 + iVar5 + 8) = 3; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = *(undefined4 *)(Amount + 0x208); + *(int **)((int)puVar14 + iVar5) = &posz; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4c7a; + GetBodyContainer(*(ulong *)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + *(undefined4 *)((int)puVar14 + iVar5 + 0xc) = 0; + *(ulong **)((int)puVar14 + iVar5 + 8) = local_6c; + *(int **)((int)puVar14 + iVar5 + 4) = &posz; + *(ulong **)((int)puVar14 + iVar5) = local_5c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4c9e; + Create(*(Object **)((int)puVar14 + iVar5), + *(ObjectType **)((int)puVar14 + iVar5 + 4), + *(ulong *)((int)puVar14 + iVar5 + 8)); + local_2c = local_5c[0]; + local_4c[0] = local_5c[0]; + } + iVar3 = pTVar10->Maximum; + *(undefined4 *)((int)puVar14 + iVar5) = 1; + *(int *)((int)puVar14 + iVar5 + 4) = iVar3; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4cbd; + Repeat = random(); + *(int *)((int)puVar14 + iVar5 + 0xc) = (pTVar10->Type).TypeID; + iVar3 = Repeat; + *(undefined4 *)((int)puVar14 + iVar5) = 2; + *(char **)((int)puVar14 + iVar5 + 4) = "Verteile %d Objekte vom Typ %d.\n"; + *(int *)((int)puVar14 + iVar5 + 8) = iVar3; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4ce7; + print(); + j = 1; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 6; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4d02; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + iVar3 = Repeat; + if (!bVar7) { + Repeat = 0; + j = iVar3; + } + local_a8 = 0; + if (0 < j) { + do { + posz = 0; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x37; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4d4b; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) { +LAB_080a4d67: + iVar3 = (pTVar10->Type).TypeID; + *(ulong **)((int)puVar14 + iVar5) = local_4c; + *(int *)((int)puVar14 + iVar5 + 4) = iVar3; + // try { // try from 080a4d73 to 080a4d9e has its CatchHandler @ 080a50b2 + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4d78; + ObjectType::setTypeID + (*(ObjectType **)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + local_3c[0] = local_2c; + *(undefined4 *)((int)puVar14 + iVar5 + 0xc) = 0; + *(ulong **)((int)puVar14 + iVar5 + 8) = local_4c; + *(ulong **)((int)puVar14 + iVar5 + 4) = local_3c; + *(ulong **)((int)puVar14 + iVar5) = local_5c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4d9f; + Create(*(Object **)((int)puVar14 + iVar5), + *(ObjectType **)((int)puVar14 + iVar5 + 4), + *(ulong *)((int)puVar14 + iVar5 + 8)); + } + else { + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x38; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4d5f; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x39; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4e88; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x3a; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4ea0; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x3b; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4eb8; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x36; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4ed0; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x34; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4ee8; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0x35; + *(TItemData **)((int)puVar14 + iVar5) = pTVar10; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4f00; + bVar7 = ObjectType::getFlag(*(ObjectType **)((int)puVar14 + iVar5), + *(FLAG *)((int)puVar14 + iVar5 + 4)); + if (bVar7) goto LAB_080a4d67; + iVar3 = (pTVar10->Type).TypeID; + *(ulong **)((int)puVar14 + iVar5) = local_4c; + *(int *)((int)puVar14 + iVar5 + 4) = iVar3; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4f19; + ObjectType::setTypeID + (*(ObjectType **)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + iVar3 = Repeat; + *(ulong **)((int)puVar14 + iVar5 + 8) = local_4c; + *(int *)((int)puVar14 + iVar5 + 0xc) = iVar3; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = + *(undefined4 *)(Amount + 0x208); + *(ulong **)((int)puVar14 + iVar5) = local_5c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4f45; + CreateAtCreature(*(ulong *)((int)puVar14 + iVar5), + *(ObjectType **)((int)puVar14 + iVar5 + 4), + *(ulong *)((int)puVar14 + iVar5 + 8)); + } + posz = local_5c[0]; + local_6c[0] = local_5c[0]; + *(int **)((int)puVar14 + iVar5 + 4) = &posz; + *(ulong **)((int)puVar14 + iVar5) = local_6c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4dbd; + Object::getContainer(*(Object **)((int)puVar14 + iVar5)); + *(ulong **)((int)puVar14 + iVar5 + 4) = local_6c; + *(ulong **)((int)puVar14 + iVar5) = local_5c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4dd2; + Object::getObjectType(*(Object **)((int)puVar14 + iVar5)); + if (local_5c[0] == 0) { + uVar2 = *(undefined4 *)(Amount + 0x280); + *(undefined **)((int)puVar14 + iVar5) = &DAT_081025a0; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = uVar2; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4e5a; + error(*(char **)((int)puVar14 + iVar5)); + local_5c[0] = posz; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0xffffffff; + *(ulong **)((int)puVar14 + iVar5) = local_5c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4e73; + Delete(*(Object **)((int)puVar14 + iVar5), + *(int *)((int)puVar14 + iVar5 + 4)); + } + local_a8 = local_a8 + 1; + } while (local_a8 < j); + } + local_6c[0] = local_2c; + *(ulong **)((int)puVar14 + iVar5 + 4) = local_6c; + *(int **)((int)puVar14 + iVar5) = &posz; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4e0c; + GetFirstContainerObject(*(Object **)((int)puVar14 + iVar5)); + local_5c[0] = NONE.ObjectID; + if (posz == NONE.ObjectID) { + local_4c[0] = local_2c; + *(undefined4 *)((int)puVar14 + iVar5 + 4) = 0xffffffff; + *(ulong **)((int)puVar14 + iVar5) = local_4c; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4e39; + Delete(*(Object **)((int)puVar14 + iVar5),*(int *)((int)puVar14 + iVar5 + 4) + ); + } + } + iVar15 = iVar15 + 1; + } while (iVar15 <= pTVar4->ExtraItems); + } + puVar6 = (ulong *)Monster; + if (pTVar4 != (TAttackWave *)0x0) { + *(TAttackWave **)((int)puVar14 + iVar5) = pTVar4; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4bde; + TAttackWave::~TAttackWave + (*(TAttackWave **)((int)puVar14 + iVar5),*(int *)((int)puVar14 + iVar5 + 4)); + *(TAttackWave **)((int)puVar14 + iVar5) = pTVar4; + *(undefined4 *)((int)puVar14 + iVar5 + -4) = 0x80a4be6; + operator_delete(*(void **)((int)puVar14 + iVar5)); + puVar6 = (ulong *)Monster; + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitCr(void) + +{ + int i; + matrix<> *this; + int iVar1; + + // try { // try from 080a5106 to 080a510a has its CatchHandler @ 080a51e0 + this = (matrix<> *)operator_new(0x14); + // try { // try from 080a5148 to 080a514c has its CatchHandler @ 080a51b0 + matrix<>::matrix(this,SectorXMin * 2,SectorXMax * 2 + 1,SectorYMin * 2,SectorYMax * 2 + 1,0); + NextCreatureID = 0x40000000; + FirstChainCreature = this; + // try { // try from 080a515d to 080a517c has its CatchHandler @ 080a51e0 + LoadRaces(); + LoadMonsterRaids(); + FirstFreeCreature = 0; + InitPlayer(); + InitCrskill(); + InitNonplayer(); + iVar1 = 0; + do { + KilledCreatures[iVar1] = 0; + KilledPlayers[iVar1] = 0; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x200); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitCr(void) + +{ + matrix<> *pmVar1; + + WriteKillStatistics(); + ExitPlayer(); + ExitNonplayer(); + ExitCrskill(); + pmVar1 = FirstChainCreature; + if (FirstChainCreature != (matrix<> *)0x0) { + if (FirstChainCreature->entry != (ulong *)0x0) { + operator_delete__(FirstChainCreature->entry); + } + operator_delete(pmVar1); + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (CreatureList.entry == (TCreature **)0x0) { + return; + } + operator_delete__(CreatureList.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + int *piVar1; + int *piVar2; + ulong *puVar3; + + puVar3 = &NextCreatureID; + piVar1 = KilledCreatures + 0x24; + while ((TRaceData *)puVar3 != RaceData) { + piVar2 = piVar1 + -0x54; + puVar3 = (ulong *)((int)puVar3 + -0x150); + if ((void *)piVar1[-0x2d] != (void *)0x0) { + operator_delete__((void *)piVar1[-0x2d]); + } + if ((void *)piVar1[-0x40] != (void *)0x0) { + operator_delete__((void *)piVar1[-0x40]); + } + if ((void *)piVar1[-0x4b] != (void *)0x0) { + operator_delete__((void *)piVar1[-0x4b]); + } + piVar1 = piVar2; + if ((void *)*piVar2 != (void *)0x0) { + operator_delete__((void *)*piVar2); + } + } + return; +} + + + +void __tcf_2(void *param_1) + +{ + vector<> *pvVar1; + + pvVar1 = ToDoQueue.Entry; + if (ToDoQueue.Entry != (vector<> *)0x0) { + if ((ToDoQueue.Entry)->entry != (priority_queue_entry<> *)0x0) { + operator_delete__((ToDoQueue.Entry)->entry); + } + operator_delete(pvVar1); + return; + } + return; +} + + + +void __tcf_3(void *param_1) + +{ + vector<> *pvVar1; + + pvVar1 = AttackWaveQueue.Entry; + if (AttackWaveQueue.Entry != (vector<> *)0x0) { + if ((AttackWaveQueue.Entry)->entry != (priority_queue_entry<> *)0x0) { + operator_delete__((AttackWaveQueue.Entry)->entry); + } + operator_delete(pvVar1); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_HashList(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: bool IsPeaceful(TCreature * this) + +bool __thiscall TCreature::IsPeaceful(TCreature *this) + +{ + return true; +} + + + +// DWARF original prototype: ulong GetMaster(TCreature * this) + +ulong __thiscall TCreature::GetMaster(TCreature *this) + +{ + return 0; +} + + + +// DWARF original prototype: void TalkStimulus(TCreature * this, ulong param_1, char * param_2) + +void __thiscall TCreature::TalkStimulus(TCreature *this,ulong param_1,char *param_2) + +{ + return; +} + + + +// DWARF original prototype: void DamageStimulus(TCreature * this, ulong param_1, int param_2, int +// param_3) + +void __thiscall TCreature::DamageStimulus(TCreature *this,ulong param_1,int param_2,int param_3) + +{ + return; +} + + + +// DWARF original prototype: void IdleStimulus(TCreature * this) + +void __thiscall TCreature::IdleStimulus(TCreature *this) + +{ + return; +} + + + +// DWARF original prototype: void AttackStimulus(TCreature * this, ulong param_1) + +void __thiscall TCreature::AttackStimulus(TCreature *this,ulong param_1) + +{ + return; +} + + + +// WARNING: Variable defined which should be unmapped: extend +// DWARF original prototype: TCreature * * operator()(vector * this, int i) + +TCreature ** __thiscall vector::operator()(vector *this,int i) + +{ + TCreature *pTVar1; + TCreature **ppTVar2; + int iVar3; + int iVar4; + int j_1; + int j; + int iVar5; + int extend_1; + TCreature **help; + int extend; + + iVar3 = this->start; + while (i < iVar3) { + help = (TCreature **)this->block; + if (help == (TCreature **)0x0) { + ppTVar2 = (TCreature **)this->space; + help = ppTVar2; + } + else { + ppTVar2 = (TCreature **)this->space; + } + ppTVar2 = (TCreature **)operator_new__(((int)help + (int)ppTVar2) * 4); + iVar3 = this->min; + if (this->min <= this->max) { + do { + iVar4 = iVar3 - this->start; + iVar5 = (int)help + iVar4; + pTVar1 = ppTVar2[iVar5]; + ppTVar2[iVar5] = this->entry[iVar4]; + iVar5 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (TCreature **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start - (int)help; + this->start = iVar3; + this->space = this->space + (int)help; + } + iVar4 = this->space; + iVar5 = iVar4 + iVar3; + while (iVar5 <= i) { + iVar5 = iVar4; + if (this->block != 0) { + iVar5 = this->block; + } + ppTVar2 = (TCreature **)operator_new__((iVar5 + iVar4) * 4); + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar4 = iVar3 - this->start; + pTVar1 = ppTVar2[iVar4]; + ppTVar2[iVar4] = this->entry[iVar4]; + iVar4 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (TCreature **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start; + iVar4 = iVar5 + this->space; + this->space = iVar4; + iVar5 = iVar4 + iVar3; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + this->entry[(iVar5 + -1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + this->entry[(iVar5 + 1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar3); +} + + + +// DWARF original prototype: void deleteMin(priority_queue * +// this) + +void __thiscall priority_queue<>::deleteMin(priority_queue<> *this) + +{ + ulong uVar1; + ulong uVar2; + ulong uVar3; + int iVar4; + priority_queue_entry<> *ppVar5; + priority_queue_entry<> *ppVar6; + int SmallerSon; + int i; + int local_18; + int Position; + + iVar4 = this->Entries; + if (iVar4 == 0) { + error("priority_queue::deleteMin: Warteschlange ist leer.\n"); + return; + } + if (1 < iVar4) { + ppVar5 = vector<>::operator()(this->Entry,1); + ppVar6 = vector<>::operator()(this->Entry,this->Entries); + uVar1 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar1; + local_18 = 1; + while( true ) { + iVar4 = this->Entries; + i = local_18 * 2; + if (iVar4 < i) break; + if (i < iVar4) { + ppVar5 = vector<>::operator()(this->Entry,i + 1); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar5->Key < ppVar6->Key) { + i = i + 1; + } + } + ppVar5 = vector<>::operator()(this->Entry,local_18); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar5->Key <= ppVar6->Key) { + iVar4 = this->Entries; + break; + } + ppVar5 = vector<>::operator()(this->Entry,local_18); + uVar1 = ppVar5->Key; + uVar2 = ppVar5->Data; + ppVar5 = vector<>::operator()(this->Entry,local_18); + ppVar6 = vector<>::operator()(this->Entry,i); + uVar3 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar3; + ppVar5 = vector<>::operator()(this->Entry,i); + ppVar5->Data = uVar2; + ppVar5->Key = uVar1; + local_18 = i; + } + } + this->Entries = iVar4 + -1; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TToDoEntry *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (TToDoEntry *)operator_new__(this->space * 0x18); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TSkillData *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (TSkillData *)operator_new__(this->space * 0x1c); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int +// block, ulong init) + +void __thiscall vector<>::vector(vector<> *this,int min,int max,int block,ulong init) + +{ + int iVar1; + ulong *puVar2; + + this->initialized = true; + this->min = min; + iVar1 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar1; + this->block = block; + this->init = init; + if (iVar1 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + puVar2 = (ulong *)operator_new__(this->space << 2); + iVar1 = 0; + this->entry = puVar2; + if (0 < this->space) { + do { + this->entry[iVar1] = init; + iVar1 = iVar1 + 1; + } while (iVar1 < this->space); + } + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TItemData *pTVar1; + int iVar2; + TItemData *this_00; + + ObjectType::setTypeID(&(this->init).Type,0); + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + iVar2 = this->space; + pTVar1 = (TItemData *)operator_new__(iVar2 * 0xc); + this_00 = pTVar1; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 080a59a1 to 080a59a5 has its CatchHandler @ 080a5a03 + ObjectType::setTypeID(&this_00->Type,0); + this_00 = this_00 + 1; + } + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TSpellData *pTVar1; + int iVar2; + + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + pTVar1 = (TSpellData *)operator_new__(this->space * 0x2c); + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: TSkillData * operator()(vector * this, int i) + +TSkillData * __thiscall vector::operator()(vector *this,int i) + +{ + int iVar1; + int iVar2; + int iVar3; + int iVar4; + int iVar5; + TSkillData *pTVar6; + TSkillData *pTVar7; + int iVar8; + int iVar9; + int iVar10; + int iVar11; + TSkillData *help_1; + int iVar12; + TSkillData *help; + int j; + int iVar13; + int local_40; + int extend; + uchar Help [28]; + + iVar9 = this->start; + while (i < iVar9) { + local_40 = this->block; + if (local_40 == 0) { + iVar9 = this->space; + local_40 = iVar9; + } + else { + iVar9 = this->space; + } + pTVar7 = (TSkillData *)operator_new__((iVar9 + local_40) * 0x1c); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar12 = (iVar9 - this->start) + local_40; + iVar11 = pTVar7[iVar12].Nr; + iVar1 = pTVar7[iVar12].Actual; + iVar2 = pTVar7[iVar12].Minimum; + iVar3 = pTVar7[iVar12].Maximum; + iVar4 = pTVar7[iVar12].NextLevel; + iVar5 = pTVar7[iVar12].FactorPercent; + iVar10 = pTVar7[iVar12].AddLevel; + iVar8 = iVar9 - this->start; + iVar12 = local_40 + iVar8; + pTVar6 = this->entry; + pTVar7[iVar12].Nr = pTVar6[iVar8].Nr; + pTVar7[iVar12].Actual = pTVar6[iVar8].Actual; + pTVar7[iVar12].Minimum = pTVar6[iVar8].Minimum; + pTVar7[iVar12].Maximum = pTVar6[iVar8].Maximum; + pTVar7[iVar12].NextLevel = pTVar6[iVar8].NextLevel; + pTVar7[iVar12].FactorPercent = pTVar6[iVar8].FactorPercent; + iVar13 = iVar9 + 1; + pTVar7[iVar12].AddLevel = pTVar6[iVar8].AddLevel; + iVar9 = iVar9 - this->start; + pTVar6 = this->entry; + pTVar6[iVar9].Nr = iVar11; + pTVar6[iVar9].Actual = iVar1; + pTVar6[iVar9].Minimum = iVar2; + pTVar6[iVar9].Maximum = iVar3; + pTVar6[iVar9].NextLevel = iVar4; + pTVar6[iVar9].FactorPercent = iVar5; + pTVar6[iVar9].AddLevel = iVar10; + iVar9 = iVar13; + } while (iVar13 <= this->max); + } + if (this->entry != (TSkillData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start - local_40; + this->start = iVar9; + this->space = this->space + local_40; + } + iVar11 = this->space; + iVar12 = iVar11 + iVar9; + while (iVar12 <= i) { + iVar12 = this->block; + if (this->block == 0) { + iVar12 = iVar11; + } + pTVar7 = (TSkillData *)operator_new__((iVar11 + iVar12) * 0x1c); + iVar9 = this->min; + if (iVar9 <= this->max) { + do { + iVar10 = iVar9 - this->start; + iVar11 = pTVar7[iVar10].Nr; + iVar1 = pTVar7[iVar10].Actual; + iVar2 = pTVar7[iVar10].Minimum; + iVar3 = pTVar7[iVar10].Maximum; + iVar4 = pTVar7[iVar10].NextLevel; + iVar5 = pTVar7[iVar10].FactorPercent; + iVar10 = pTVar7[iVar10].AddLevel; + pTVar6 = this->entry; + iVar8 = iVar9 - this->start; + pTVar7[iVar8].Nr = pTVar6[iVar8].Nr; + pTVar7[iVar8].Actual = pTVar6[iVar8].Actual; + pTVar7[iVar8].Minimum = pTVar6[iVar8].Minimum; + pTVar7[iVar8].Maximum = pTVar6[iVar8].Maximum; + pTVar7[iVar8].NextLevel = pTVar6[iVar8].NextLevel; + pTVar7[iVar8].FactorPercent = pTVar6[iVar8].FactorPercent; + pTVar7[iVar8].AddLevel = pTVar6[iVar8].AddLevel; + iVar8 = iVar9 + 1; + pTVar6 = this->entry; + iVar9 = iVar9 - this->start; + pTVar6[iVar9].Nr = iVar11; + pTVar6[iVar9].Actual = iVar1; + pTVar6[iVar9].Minimum = iVar2; + pTVar6[iVar9].Maximum = iVar3; + pTVar6[iVar9].NextLevel = iVar4; + pTVar6[iVar9].FactorPercent = iVar5; + pTVar6[iVar9].AddLevel = iVar10; + iVar9 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (TSkillData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar7; + iVar9 = this->start; + iVar11 = this->space + iVar12; + this->space = iVar11; + iVar12 = iVar11 + iVar9; + } + iVar12 = this->min; + while (i < iVar12) { + this->min = iVar12 + -1; + if (this->initialized != false) { + iVar9 = (iVar12 + -1) - iVar9; + pTVar7 = this->entry; + pTVar7[iVar9].Nr = (this->init).Nr; + pTVar7[iVar9].Actual = (this->init).Actual; + pTVar7[iVar9].Minimum = (this->init).Minimum; + pTVar7[iVar9].Maximum = (this->init).Maximum; + pTVar7[iVar9].NextLevel = (this->init).NextLevel; + pTVar7[iVar9].FactorPercent = (this->init).FactorPercent; + pTVar7[iVar9].AddLevel = (this->init).AddLevel; + iVar9 = this->start; + } + iVar12 = this->min; + } + iVar12 = this->max; + while (iVar12 < i) { + this->max = iVar12 + 1; + if (this->initialized != false) { + iVar9 = (iVar12 + 1) - iVar9; + pTVar7 = this->entry; + pTVar7[iVar9].Nr = (this->init).Nr; + pTVar7[iVar9].Actual = (this->init).Actual; + pTVar7[iVar9].Minimum = (this->init).Minimum; + pTVar7[iVar9].Maximum = (this->init).Maximum; + pTVar7[iVar9].NextLevel = (this->init).NextLevel; + pTVar7[iVar9].FactorPercent = (this->init).FactorPercent; + pTVar7[iVar9].AddLevel = (this->init).AddLevel; + iVar9 = this->start; + } + iVar12 = this->max; + } + return this->entry + (i - iVar9); +} + + + +// DWARF original prototype: TItemData * operator()(vector * this, int i) + +TItemData * __thiscall vector::operator()(vector *this,int i) + +{ + TItemData *pTVar1; + int iVar2; + int iVar3; + int j_1; + int iVar4; + int iVar5; + int j; + TItemData *pTVar6; + int extend_1; + int extend; + ObjectType local_2c; + uchar Help [12]; + + iVar3 = this->start; + while (i < iVar3) { + extend_1 = this->block; + if (extend_1 == 0) { + iVar3 = this->space; + extend_1 = iVar3; + } + else { + iVar3 = this->space; + } + iVar3 = extend_1 + iVar3; + pTVar1 = (TItemData *)operator_new__(iVar3 * 0xc); + pTVar6 = pTVar1; + while (iVar3 = iVar3 + -1, iVar3 != -1) { + // try { // try from 080a5f5b to 080a5f5f has its CatchHandler @ 080a6292 + ObjectType::setTypeID(&pTVar6->Type,0); + pTVar6 = pTVar6 + 1; + } + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar4 = (iVar3 - this->start) + extend_1; + local_2c.TypeID = pTVar1[iVar4].Type.TypeID; + Help._0_4_ = pTVar1[iVar4].Maximum; + Help._4_4_ = pTVar1[iVar4].Probability; + iVar2 = iVar3 - this->start; + iVar4 = extend_1 + iVar2; + pTVar6 = this->entry; + pTVar1[iVar4].Type.TypeID = pTVar6[iVar2].Type.TypeID; + pTVar1[iVar4].Maximum = pTVar6[iVar2].Maximum; + pTVar1[iVar4].Probability = pTVar6[iVar2].Probability; + iVar4 = iVar3 + 1; + iVar3 = iVar3 - this->start; + pTVar6 = this->entry; + pTVar6[iVar3].Type.TypeID = local_2c.TypeID; + pTVar6[iVar3].Maximum = Help._0_4_; + pTVar6[iVar3].Probability = Help._4_4_; + iVar3 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (TItemData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar1; + iVar3 = this->start - extend_1; + this->start = iVar3; + this->space = this->space + extend_1; + } + iVar2 = this->space; + iVar4 = iVar2 + iVar3; + while (iVar4 <= i) { + iVar4 = iVar2; + if (this->block != 0) { + iVar4 = this->block; + } + iVar2 = iVar4 + iVar2; + pTVar1 = (TItemData *)operator_new__(iVar2 * 0xc); + pTVar6 = pTVar1; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 080a608d to 080a6091 has its CatchHandler @ 080a62a4 + ObjectType::setTypeID(&pTVar6->Type,0); + pTVar6 = pTVar6 + 1; + } + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar2 = iVar3 - this->start; + local_2c.TypeID = pTVar1[iVar2].Type.TypeID; + Help._0_4_ = pTVar1[iVar2].Maximum; + Help._4_4_ = pTVar1[iVar2].Probability; + pTVar6 = this->entry; + iVar2 = iVar3 - this->start; + iVar5 = iVar3 + 1; + pTVar1[iVar2].Type.TypeID = pTVar6[iVar2].Type.TypeID; + pTVar1[iVar2].Maximum = pTVar6[iVar2].Maximum; + pTVar1[iVar2].Probability = pTVar6[iVar2].Probability; + pTVar6 = this->entry; + iVar3 = iVar3 - this->start; + pTVar6[iVar3].Type.TypeID = local_2c.TypeID; + pTVar6[iVar3].Maximum = Help._0_4_; + pTVar6[iVar3].Probability = Help._4_4_; + iVar3 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (TItemData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar1; + iVar3 = this->start; + iVar2 = iVar4 + this->space; + this->space = iVar2; + iVar4 = iVar2 + iVar3; + } + iVar4 = this->min; + while (i < iVar4) { + this->min = iVar4 + -1; + if (this->initialized != false) { + pTVar6 = this->entry + ((iVar4 + -1) - iVar3); + // try { // try from 080a6231 to 080a6255 has its CatchHandler @ 080a62b1 + ObjectType::setTypeID((ObjectType *)&extend,(this->init).Type.TypeID); + ObjectType::setTypeID(&pTVar6->Type,extend); + ObjectType::setTypeID(&local_2c,(pTVar6->Type).TypeID); + pTVar6->Maximum = (this->init).Maximum; + pTVar6->Probability = (this->init).Probability; + iVar3 = this->start; + } + iVar4 = this->min; + } + iVar4 = this->max; + while (iVar4 < i) { + this->max = iVar4 + 1; + if (this->initialized != false) { + pTVar6 = this->entry + ((iVar4 + 1) - iVar3); + // try { // try from 080a61db to 080a61ff has its CatchHandler @ 080a62b1 + ObjectType::setTypeID(&local_2c,(this->init).Type.TypeID); + ObjectType::setTypeID(&pTVar6->Type,local_2c.TypeID); + ObjectType::setTypeID((ObjectType *)&extend,(pTVar6->Type).TypeID); + pTVar6->Maximum = (this->init).Maximum; + pTVar6->Probability = (this->init).Probability; + iVar3 = this->start; + } + iVar4 = this->max; + } + return this->entry + (i - iVar3); +} + + + +// DWARF original prototype: TSpellData * operator()(vector * this, int i) + +TSpellData * __thiscall vector::operator()(vector *this,int i) + +{ + SpellShapeType SVar1; + int iVar2; + int iVar3; + int iVar4; + SpellImpactType SVar5; + int iVar6; + int iVar7; + int iVar8; + int iVar9; + TSpellData *pTVar10; + TSpellData *pTVar11; + int iVar12; + int iVar13; + int iVar14; + int iVar15; + int iVar16; + TSpellData *help_1; + TSpellData *help; + int j; + int local_50; + int extend; + uchar Help [44]; + + iVar13 = this->start; + while (i < iVar13) { + local_50 = this->block; + if (local_50 == 0) { + iVar13 = this->space; + local_50 = iVar13; + } + else { + iVar13 = this->space; + } + pTVar11 = (TSpellData *)operator_new__((local_50 + iVar13) * 0x2c); + iVar13 = this->min; + if (iVar13 <= this->max) { + do { + iVar12 = (iVar13 - this->start) + local_50; + SVar1 = pTVar11[iVar12].Shape; + iVar16 = pTVar11[iVar12].ShapeParam1; + iVar2 = pTVar11[iVar12].ShapeParam2; + iVar3 = pTVar11[iVar12].ShapeParam3; + iVar4 = pTVar11[iVar12].ShapeParam4; + SVar5 = pTVar11[iVar12].Impact; + iVar6 = pTVar11[iVar12].ImpactParam1; + iVar7 = pTVar11[iVar12].ImpactParam2; + iVar8 = pTVar11[iVar12].ImpactParam3; + iVar9 = pTVar11[iVar12].ImpactParam4; + iVar14 = pTVar11[iVar12].Delay; + pTVar10 = this->entry; + iVar15 = iVar13 - this->start; + iVar12 = local_50 + iVar15; + pTVar11[iVar12].Shape = pTVar10[iVar15].Shape; + pTVar11[iVar12].ShapeParam1 = pTVar10[iVar15].ShapeParam1; + pTVar11[iVar12].ShapeParam2 = pTVar10[iVar15].ShapeParam2; + pTVar11[iVar12].ShapeParam3 = pTVar10[iVar15].ShapeParam3; + pTVar11[iVar12].ShapeParam4 = pTVar10[iVar15].ShapeParam4; + pTVar11[iVar12].Impact = pTVar10[iVar15].Impact; + pTVar11[iVar12].ImpactParam1 = pTVar10[iVar15].ImpactParam1; + pTVar11[iVar12].ImpactParam2 = pTVar10[iVar15].ImpactParam2; + pTVar11[iVar12].ImpactParam3 = pTVar10[iVar15].ImpactParam3; + pTVar11[iVar12].ImpactParam4 = pTVar10[iVar15].ImpactParam4; + pTVar11[iVar12].Delay = pTVar10[iVar15].Delay; + iVar12 = iVar13 + 1; + iVar13 = iVar13 - this->start; + pTVar10 = this->entry; + pTVar10[iVar13].Shape = SVar1; + pTVar10[iVar13].ShapeParam1 = iVar16; + pTVar10[iVar13].ShapeParam2 = iVar2; + pTVar10[iVar13].ShapeParam3 = iVar3; + pTVar10[iVar13].ShapeParam4 = iVar4; + pTVar10[iVar13].Impact = SVar5; + pTVar10[iVar13].ImpactParam1 = iVar6; + pTVar10[iVar13].ImpactParam2 = iVar7; + pTVar10[iVar13].ImpactParam3 = iVar8; + pTVar10[iVar13].ImpactParam4 = iVar9; + pTVar10[iVar13].Delay = iVar14; + iVar13 = iVar12; + } while (iVar12 <= this->max); + } + if (this->entry != (TSpellData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar11; + iVar13 = this->start - local_50; + this->start = iVar13; + this->space = this->space + local_50; + } + iVar16 = this->space; + iVar12 = iVar16 + iVar13; + while (iVar12 <= i) { + iVar13 = this->block; + if (this->block == 0) { + iVar13 = iVar16; + } + pTVar11 = (TSpellData *)operator_new__((iVar13 + iVar16) * 0x2c); + iVar12 = this->min; + if (this->min <= this->max) { + do { + iVar14 = iVar12 - this->start; + SVar1 = pTVar11[iVar14].Shape; + iVar16 = pTVar11[iVar14].ShapeParam1; + iVar2 = pTVar11[iVar14].ShapeParam2; + iVar3 = pTVar11[iVar14].ShapeParam3; + iVar4 = pTVar11[iVar14].ShapeParam4; + SVar5 = pTVar11[iVar14].Impact; + iVar6 = pTVar11[iVar14].ImpactParam1; + iVar7 = pTVar11[iVar14].ImpactParam2; + iVar8 = pTVar11[iVar14].ImpactParam3; + iVar9 = pTVar11[iVar14].ImpactParam4; + iVar14 = pTVar11[iVar14].Delay; + pTVar10 = this->entry; + iVar15 = iVar12 - this->start; + pTVar11[iVar15].Shape = pTVar10[iVar15].Shape; + pTVar11[iVar15].ShapeParam1 = pTVar10[iVar15].ShapeParam1; + pTVar11[iVar15].ShapeParam2 = pTVar10[iVar15].ShapeParam2; + pTVar11[iVar15].ShapeParam3 = pTVar10[iVar15].ShapeParam3; + pTVar11[iVar15].ShapeParam4 = pTVar10[iVar15].ShapeParam4; + pTVar11[iVar15].Impact = pTVar10[iVar15].Impact; + pTVar11[iVar15].ImpactParam1 = pTVar10[iVar15].ImpactParam1; + pTVar11[iVar15].ImpactParam2 = pTVar10[iVar15].ImpactParam2; + pTVar11[iVar15].ImpactParam3 = pTVar10[iVar15].ImpactParam3; + pTVar11[iVar15].ImpactParam4 = pTVar10[iVar15].ImpactParam4; + pTVar11[iVar15].Delay = pTVar10[iVar15].Delay; + iVar15 = iVar12 + 1; + pTVar10 = this->entry; + iVar12 = iVar12 - this->start; + pTVar10[iVar12].Shape = SVar1; + pTVar10[iVar12].ShapeParam1 = iVar16; + pTVar10[iVar12].ShapeParam2 = iVar2; + pTVar10[iVar12].ShapeParam3 = iVar3; + pTVar10[iVar12].ShapeParam4 = iVar4; + pTVar10[iVar12].Impact = SVar5; + pTVar10[iVar12].ImpactParam1 = iVar6; + pTVar10[iVar12].ImpactParam2 = iVar7; + pTVar10[iVar12].ImpactParam3 = iVar8; + pTVar10[iVar12].ImpactParam4 = iVar9; + pTVar10[iVar12].Delay = iVar14; + iVar12 = iVar15; + } while (iVar15 <= this->max); + } + if (this->entry != (TSpellData *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar11; + iVar16 = this->space + iVar13; + this->space = iVar16; + iVar13 = this->start; + iVar12 = iVar16 + iVar13; + } + iVar12 = this->min; + while (i < iVar12) { + this->min = iVar12 + -1; + if (this->initialized != false) { + iVar13 = (iVar12 + -1) - iVar13; + pTVar11 = this->entry; + pTVar11[iVar13].Shape = (this->init).Shape; + pTVar11[iVar13].ShapeParam1 = (this->init).ShapeParam1; + pTVar11[iVar13].ShapeParam2 = (this->init).ShapeParam2; + pTVar11[iVar13].ShapeParam3 = (this->init).ShapeParam3; + pTVar11[iVar13].ShapeParam4 = (this->init).ShapeParam4; + pTVar11[iVar13].Impact = (this->init).Impact; + pTVar11[iVar13].ImpactParam1 = (this->init).ImpactParam1; + pTVar11[iVar13].ImpactParam2 = (this->init).ImpactParam2; + pTVar11[iVar13].ImpactParam3 = (this->init).ImpactParam3; + pTVar11[iVar13].ImpactParam4 = (this->init).ImpactParam4; + pTVar11[iVar13].Delay = (this->init).Delay; + iVar13 = this->start; + } + iVar12 = this->min; + } + iVar12 = this->max; + while (iVar12 < i) { + this->max = iVar12 + 1; + if (this->initialized != false) { + iVar13 = (iVar12 + 1) - iVar13; + pTVar11 = this->entry; + pTVar11[iVar13].Shape = (this->init).Shape; + pTVar11[iVar13].ShapeParam1 = (this->init).ShapeParam1; + pTVar11[iVar13].ShapeParam2 = (this->init).ShapeParam2; + pTVar11[iVar13].ShapeParam3 = (this->init).ShapeParam3; + pTVar11[iVar13].ShapeParam4 = (this->init).ShapeParam4; + pTVar11[iVar13].Impact = (this->init).Impact; + pTVar11[iVar13].ImpactParam1 = (this->init).ImpactParam1; + pTVar11[iVar13].ImpactParam2 = (this->init).ImpactParam2; + pTVar11[iVar13].ImpactParam3 = (this->init).ImpactParam3; + pTVar11[iVar13].ImpactParam4 = (this->init).ImpactParam4; + pTVar11[iVar13].Delay = (this->init).Delay; + iVar13 = this->start; + } + iVar12 = this->max; + } + return this->entry + (i - iVar13); +} + + + +// DWARF original prototype: void insert(priority_queue * this, +// ulong Key, TAttackWave * * Data) + +void __thiscall priority_queue<>::insert(priority_queue<> *this) + +{ + ulong uVar1; + TAttackWave *pTVar2; + ulong uVar3; + int iVar4; + priority_queue_entry<> *ppVar5; + priority_queue_entry<> *ppVar6; + int Father; + int i; + int Position; + ulong in_stack_00000008; + undefined4 *in_stack_0000000c; + + iVar4 = this->Entries + 1; + this->Entries = iVar4; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar5->Key = in_stack_00000008; + ppVar5 = vector<>::operator()(this->Entry,this->Entries); + ppVar5->Data = (TAttackWave *)*in_stack_0000000c; + iVar4 = this->Entries; + while( true ) { + if (iVar4 == 1) { + return; + } + i = iVar4 / 2; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar6->Key <= ppVar5->Key) break; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + uVar1 = ppVar5->Key; + pTVar2 = ppVar5->Data; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar6 = vector<>::operator()(this->Entry,i); + uVar3 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar3; + ppVar5 = vector<>::operator()(this->Entry,i); + ppVar5->Data = pTVar2; + ppVar5->Key = uVar1; + iVar4 = i; + } + return; +} + + + +// DWARF original prototype: void deleteMin(priority_queue * this) + +void __thiscall priority_queue<>::deleteMin(priority_queue<> *this) + +{ + ulong uVar1; + TAttackWave *pTVar2; + ulong uVar3; + int iVar4; + priority_queue_entry<> *ppVar5; + priority_queue_entry<> *ppVar6; + int SmallerSon; + int i; + int local_18; + int Position; + + iVar4 = this->Entries; + if (iVar4 == 0) { + error("priority_queue::deleteMin: Warteschlange ist leer.\n"); + return; + } + if (1 < iVar4) { + ppVar5 = vector<>::operator()(this->Entry,1); + ppVar6 = vector<>::operator()(this->Entry,this->Entries); + uVar1 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar1; + local_18 = 1; + while( true ) { + iVar4 = this->Entries; + i = local_18 * 2; + if (iVar4 < i) break; + if (i < iVar4) { + ppVar5 = vector<>::operator()(this->Entry,i + 1); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar5->Key < ppVar6->Key) { + i = i + 1; + } + } + ppVar5 = vector<>::operator()(this->Entry,local_18); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar5->Key <= ppVar6->Key) { + iVar4 = this->Entries; + break; + } + ppVar5 = vector<>::operator()(this->Entry,local_18); + uVar1 = ppVar5->Key; + pTVar2 = ppVar5->Data; + ppVar5 = vector<>::operator()(this->Entry,local_18); + ppVar6 = vector<>::operator()(this->Entry,i); + uVar3 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar3; + ppVar5 = vector<>::operator()(this->Entry,i); + ppVar5->Data = pTVar2; + ppVar5->Key = uVar1; + local_18 = i; + } + } + this->Entries = iVar4 + -1; + return; +} + + + +// DWARF original prototype: void matrix(matrix * this, int xmin, int xmax, int +// ymin, int ymax, ulong init) + +void __thiscall matrix<>::matrix(matrix<> *this,int xmin,int xmax,int ymin,int ymax,ulong init) + +{ + int iVar1; + ulong *puVar2; + int i; + int iVar3; + + iVar3 = (xmax - xmin) + 1; + iVar1 = (ymax - ymin) + 1; + this->dy = iVar1; + this->xmin = xmin; + this->ymin = ymin; + this->dx = iVar3; + if ((iVar3 < 1) || (iVar1 < 1)) { + error("matrix: Ungueltige Feldgroesse %d..%d, %d..%d.\n",xmin,xmax,ymin,ymax); + this->dx = 1; + this->dy = 1; + } + puVar2 = (ulong *)operator_new__(this->dy * this->dx * 4); + iVar1 = 0; + this->entry = puVar2; + if (0 < this->dy * this->dx) { + do { + this->entry[iVar1] = init; + iVar1 = iVar1 + 1; + } while (iVar1 < this->dy * this->dx); + } + return; +} + + + +// DWARF original prototype: priority_queue_entry * +// operator()(vector_> * this, int i) + +priority_queue_entry<> * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ulong uVar1; + ulong uVar2; + priority_queue_entry<> *ppVar3; + priority_queue_entry<> *ppVar4; + int iVar5; + int j_1; + int iVar6; + int iVar7; + int j; + int iVar8; + int extend_1; + priority_queue_entry<> *help; + int extend; + uchar Help_1 [8]; + uchar Help [8]; + + iVar5 = this->start; + while (i < iVar5) { + help = (priority_queue_entry<> *)this->block; + if (help == (priority_queue_entry<> *)0x0) { + ppVar4 = (priority_queue_entry<> *)this->space; + help = ppVar4; + } + else { + ppVar4 = (priority_queue_entry<> *)this->space; + } + ppVar4 = (priority_queue_entry<> *)operator_new__(((int)&ppVar4->Key + (int)&help->Key) * 8) + ; + iVar5 = this->min; + if (this->min <= this->max) { + do { + iVar6 = (iVar5 - this->start) + (int)help; + uVar1 = ppVar4[iVar6].Key; + uVar2 = ppVar4[iVar6].Data; + ppVar3 = this->entry; + iVar6 = iVar5 - this->start; + ppVar4[(int)help + iVar6].Key = ppVar3[iVar6].Key; + iVar8 = iVar5 + 1; + ppVar4[(int)help + iVar6].Data = ppVar3[iVar6].Data; + ppVar3 = this->entry; + iVar5 = iVar5 - this->start; + ppVar3[iVar5].Key = uVar1; + ppVar3[iVar5].Data = uVar2; + iVar5 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (priority_queue_entry<> *)0x0) { + operator_delete__(this->entry); + } + this->entry = ppVar4; + iVar5 = this->start - (int)help; + this->start = iVar5; + this->space = (int)&help->Key + this->space; + } + iVar8 = this->space; + iVar6 = iVar8 + iVar5; + while (iVar6 <= i) { + iVar6 = iVar8; + if (this->block != 0) { + iVar6 = this->block; + } + ppVar4 = (priority_queue_entry<> *)operator_new__((iVar6 + iVar8) * 8); + iVar5 = this->min; + if (iVar5 <= this->max) { + do { + iVar8 = iVar5 - this->start; + uVar1 = ppVar4[iVar8].Key; + uVar2 = ppVar4[iVar8].Data; + iVar8 = iVar5 - this->start; + ppVar3 = this->entry; + ppVar4[iVar8].Key = ppVar3[iVar8].Key; + iVar7 = iVar5 + 1; + ppVar4[iVar8].Data = ppVar3[iVar8].Data; + ppVar3 = this->entry; + iVar5 = iVar5 - this->start; + ppVar3[iVar5].Key = uVar1; + ppVar3[iVar5].Data = uVar2; + iVar5 = iVar7; + } while (iVar7 <= this->max); + } + if (this->entry != (priority_queue_entry<> *)0x0) { + operator_delete__(this->entry); + } + this->entry = ppVar4; + iVar5 = this->start; + iVar8 = iVar6 + this->space; + this->space = iVar8; + iVar6 = iVar8 + iVar5; + } + iVar6 = this->min; + while (i < iVar6) { + this->min = iVar6 + -1; + if (this->initialized != false) { + iVar5 = (iVar6 + -1) - iVar5; + ppVar4 = this->entry; + uVar1 = (this->init).Data; + ppVar4[iVar5].Key = (this->init).Key; + ppVar4[iVar5].Data = uVar1; + iVar5 = this->start; + } + iVar6 = this->min; + } + iVar6 = this->max; + while (iVar6 < i) { + this->max = iVar6 + 1; + if (this->initialized != false) { + iVar5 = (iVar6 + 1) - iVar5; + ppVar4 = this->entry; + uVar1 = (this->init).Data; + ppVar4[iVar5].Key = (this->init).Key; + ppVar4[iVar5].Data = uVar1; + iVar5 = this->start; + } + iVar6 = this->max; + } + return this->entry + (i - iVar5); +} + + + +// DWARF original prototype: priority_queue_entry * +// operator()(vector_> * this, int i) + +priority_queue_entry<> * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + ulong uVar1; + TAttackWave *pTVar2; + priority_queue_entry<> *ppVar3; + priority_queue_entry<> *ppVar4; + int iVar5; + int j_1; + int iVar6; + int iVar7; + int j; + int iVar8; + int extend_1; + priority_queue_entry<> *help; + int extend; + uchar Help_1 [8]; + uchar Help [8]; + + iVar5 = this->start; + while (i < iVar5) { + help = (priority_queue_entry<> *)this->block; + if (help == (priority_queue_entry<> *)0x0) { + ppVar4 = (priority_queue_entry<> *)this->space; + help = ppVar4; + } + else { + ppVar4 = (priority_queue_entry<> *)this->space; + } + ppVar4 = (priority_queue_entry<> *)operator_new__(((int)&ppVar4->Key + (int)&help->Key) * 8) + ; + iVar5 = this->min; + if (this->min <= this->max) { + do { + iVar6 = (iVar5 - this->start) + (int)help; + uVar1 = ppVar4[iVar6].Key; + pTVar2 = ppVar4[iVar6].Data; + ppVar3 = this->entry; + iVar6 = iVar5 - this->start; + ppVar4[(int)help + iVar6].Key = ppVar3[iVar6].Key; + iVar8 = iVar5 + 1; + ppVar4[(int)help + iVar6].Data = ppVar3[iVar6].Data; + ppVar3 = this->entry; + iVar5 = iVar5 - this->start; + ppVar3[iVar5].Key = uVar1; + ppVar3[iVar5].Data = pTVar2; + iVar5 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (priority_queue_entry<> *)0x0) { + operator_delete__(this->entry); + } + this->entry = ppVar4; + iVar5 = this->start - (int)help; + this->start = iVar5; + this->space = (int)&help->Key + this->space; + } + iVar8 = this->space; + iVar6 = iVar8 + iVar5; + while (iVar6 <= i) { + iVar5 = iVar8; + if (this->block != 0) { + iVar5 = this->block; + } + ppVar4 = (priority_queue_entry<> *)operator_new__((iVar5 + iVar8) * 8); + iVar6 = this->min; + if (iVar6 <= this->max) { + do { + iVar8 = iVar6 - this->start; + uVar1 = ppVar4[iVar8].Key; + pTVar2 = ppVar4[iVar8].Data; + iVar8 = iVar6 - this->start; + ppVar3 = this->entry; + ppVar4[iVar8].Key = ppVar3[iVar8].Key; + iVar7 = iVar6 + 1; + ppVar4[iVar8].Data = ppVar3[iVar8].Data; + ppVar3 = this->entry; + iVar6 = iVar6 - this->start; + ppVar3[iVar6].Key = uVar1; + ppVar3[iVar6].Data = pTVar2; + iVar6 = iVar7; + } while (iVar7 <= this->max); + } + if (this->entry != (priority_queue_entry<> *)0x0) { + operator_delete__(this->entry); + } + this->entry = ppVar4; + iVar8 = iVar5 + this->space; + iVar5 = this->start; + this->space = iVar8; + iVar6 = iVar8 + iVar5; + } + iVar6 = this->min; + while (i < iVar6) { + this->min = iVar6 + -1; + if (this->initialized != false) { + iVar5 = (iVar6 + -1) - iVar5; + ppVar4 = this->entry; + pTVar2 = (this->init).Data; + ppVar4[iVar5].Key = (this->init).Key; + ppVar4[iVar5].Data = pTVar2; + iVar5 = this->start; + } + iVar6 = this->min; + } + iVar6 = this->max; + while (iVar6 < i) { + this->max = iVar6 + 1; + if (this->initialized != false) { + iVar5 = (iVar6 + 1) - iVar5; + ppVar4 = this->entry; + pTVar2 = (this->init).Data; + ppVar4[iVar5].Key = (this->init).Key; + ppVar4[iVar5].Data = pTVar2; + iVar5 = this->start; + } + iVar6 = this->max; + } + return this->entry + (i - iVar5); +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + int i; + int iVar1; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + PlayerList.initialized = true; + PlayerList.max = 100; + PlayerList.space = 0x65; + PlayerList.block = 10; + PlayerList.start = 0; + PlayerList.min = 0; + PlayerList.init = (TPlayer *)0x0; + PlayerList.entry = (TPlayer **)operator_new__(0x194); + iVar1 = 0; + if (0 < PlayerList.space) { + do { + PlayerList.entry[iVar1] = (TPlayer *)0x0; + iVar1 = iVar1 + 1; + } while (iVar1 < PlayerList.space); + } + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + Semaphore::Semaphore(&PlayerMutex,1); + __cxa_atexit(__tcf_1,0,&__dso_handle); + Semaphore::Semaphore(&PlayerDataPoolMutex,1); + __cxa_atexit(__tcf_2,0,&__dso_handle); + PlayerIndexInternalNodes.Units = (list<> *)operator_new(8); + (PlayerIndexInternalNodes.Units)->firstNode = (listnode<> *)0x0; + (PlayerIndexInternalNodes.Units)->lastNode = (listnode<> *)0x0; + PlayerIndexInternalNodes.firstFreeItem = (storeitem<> *)0x0; + __cxa_atexit(__tcf_3,0,&__dso_handle); + PlayerIndexLeafNodes.Units = (list<> *)operator_new(8); + (PlayerIndexLeafNodes.Units)->firstNode = (listnode<> *)0x0; + (PlayerIndexLeafNodes.Units)->lastNode = (listnode<> *)0x0; + PlayerIndexLeafNodes.firstFreeItem = (storeitem<> *)0x0; + __cxa_atexit(__tcf_4,0,&__dso_handle); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +int GetNumberOfPlayers(void) + +{ + return FirstFreePlayer; +} + + + +TPlayer * GetPlayer(char *Name) + +{ + TPlayer *pTVar1; + TPlayer **ppTVar2; + int iVar3; + TPlayer *pl; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar2 = vector::operator()(&PlayerList,i_00); + pTVar1 = *ppTVar2; + iVar3 = stricmp((pTVar1->super_TCreature).Name,Name,-1); + if (iVar3 == 0) { + return pTVar1; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + return (TPlayer *)0x0; +} + + + +TPlayer * GetPlayer(ulong CharacterID) + +{ + TPlayer *pTVar1; + TPlayer *pTVar2; + + pTVar1 = (TPlayer *)GetCreature(CharacterID); + pTVar2 = (TPlayer *)0x0; + if ((pTVar1 != (TPlayer *)0x0) && (pTVar2 = pTVar1, (pTVar1->super_TCreature).Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar2 = (TPlayer *)0x0; + } + return pTVar2; +} + + + +bool IsPlayerOnline(char *Name) + +{ + TPlayer **ppTVar1; + int iVar2; + TPlayer *pTVar3; + TPlayer *pl; + int i; + int i_00; + + i_00 = 0; + Semaphore::down(&PlayerMutex); + if (0 < FirstFreePlayer) { + do { + ppTVar1 = vector::operator()(&PlayerList,i_00); + pTVar3 = *ppTVar1; + iVar2 = stricmp((pTVar3->super_TCreature).Name,Name,-1); + if (iVar2 == 0) goto LAB_080a7244; + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + pTVar3 = (TPlayer *)0x0; +LAB_080a7244: + Semaphore::up(&PlayerMutex); + return pTVar3 != (TPlayer *)0x0; +} + + + +// WARNING: Variable defined which should be unmapped: IgnoreGamemasters_local + +int IdentifyPlayer(char *Name,bool ExactMatch,bool IgnoreGamemasters,TPlayer **pl) + +{ + bool bVar1; + size_t sVar2; + TPlayer **ppTVar3; + int iVar4; + char *TestName; + int i; + int i_00; + char *pcVar5; + int local_18; + int Hits; + bool IgnoreGamemasters_local; + bool ExactMatch_local; + + Hits._3_1_ = ExactMatch; + if (Name == (char *)0x0) { + pcVar5 = "IdentifyPlayer: Name ist NULL.\n"; + } + else { + if (*Name != '\0') { + if (!ExactMatch) { + sVar2 = strlen(Name); + if (Name[sVar2 - 1] == '~') { + Name[sVar2 - 1] = '\0'; + } + else { + Hits._3_1_ = '\x01'; + } + } + local_18 = 0; + i_00 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar3 = vector::operator()(&PlayerList,i_00); + pcVar5 = ((*ppTVar3)->super_TCreature).Name; + iVar4 = stricmp(pcVar5,Name,-1); + if (iVar4 == 0) { + ppTVar3 = vector::operator()(&PlayerList,i_00); + *pl = *ppTVar3; + return 0; + } + if (Hits._3_1_ == '\0') { + sVar2 = strlen(Name); + iVar4 = stricmp(pcVar5,Name,sVar2); + if (iVar4 == 0) { + if (IgnoreGamemasters) { + ppTVar3 = vector::operator()(&PlayerList,i_00); + bVar1 = CheckRight(((*ppTVar3)->super_TCreature).ID,NO_STATISTICS); + if (bVar1) goto LAB_080a7356; + } + local_18 = local_18 + 1; + ppTVar3 = vector::operator()(&PlayerList,i_00); + *pl = *ppTVar3; + } + } +LAB_080a7356: + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + if (local_18 == 1) { + return 0; + } + return (local_18 < 2) - 2; + } + pcVar5 = "IdentifyPlayer: Name ist leer.\n"; + } + error(pcVar5); + return -1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LogoutAllPlayers(void) + +{ + TPlayer *pTVar1; + TPlayer **ppTVar2; + TPlayer *pl; + int i; + int i_00; + int iVar3; + + print(); + i_00 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar2 = vector::operator()(&PlayerList,i_00); + pTVar1 = *ppTVar2; + if (pTVar1 == (TPlayer *)0x0) { + iVar3 = i_00 + 1; + error("LogoutAllPlayers: Eintrag %d in der Playerlist ist NULL.\n",i_00); + } + else { + (*(pTVar1->super_TCreature)._vptr_TCreature[1])(pTVar1); + iVar3 = i_00; + } + i_00 = iVar3; + } while (iVar3 < FirstFreePlayer); + } + return; +} + + + +void CloseProcessedRequests(ulong CharacterID) + +{ + TPlayer *pTVar1; + TPlayer **ppTVar2; + TPlayer *pl; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar2 = vector::operator()(&PlayerList,i_00); + pTVar1 = *ppTVar2; + if (pTVar1 == (TPlayer *)0x0) { + error("CloseProcessedRequests: Spieler %d existiert nicht.\n",i_00); + } + else if ((pTVar1->Request != 0) && (pTVar1->RequestProcessingGamemaster == CharacterID)) + { + SendCloseRequest((pTVar1->super_TCreature).Connection); + pTVar1->Request = 0; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: CharacterID_local + +void NotifyBuddies(ulong CharacterID,char *Name,bool Login) + +{ + TPlayer *pTVar1; + TConnection *Name_00; + bool bVar2; + bool bVar3; + TPlayer **ppTVar4; + int iVar5; + TPlayerData *pTVar6; + TPlayer *Player; + int j; + int iVar7; + int iVar8; + int local_20; + int i; + bool Hide; + bool Login_local; + char *Name_local; + ulong CharacterID_local; + + if ((Name == (char *)0x0) || (*Name == '\0')) { + error("NotifyBuddies: Name existiert nicht.\n"); + return; + } + bVar2 = CheckRight(CharacterID,NO_STATISTICS); + local_20 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar4 = vector::operator()(&PlayerList,local_20); + pTVar1 = *ppTVar4; + if (((pTVar1->super_TCreature).Connection != (TConnection *)0x0) && + (pTVar6 = pTVar1->PlayerData, pTVar6 != (TPlayerData *)0x0)) { + if (bVar2) { + bVar3 = CheckRight((pTVar1->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + if (!bVar3) goto LAB_080a75da; + pTVar6 = pTVar1->PlayerData; + } + if (0 < pTVar6->Buddies) { + iVar8 = 0; + iVar7 = 0; + do { + if (pTVar6->Buddy[iVar7] == CharacterID) { + iVar5 = strcmp(pTVar6->BuddyName[0] + iVar8,Name); + if (iVar5 == 0) { + SendBuddyStatus((pTVar1->super_TCreature).Connection,CharacterID, + Login); + } + else { + Name_00 = (pTVar1->super_TCreature).Connection; + SendBuddyData((TConnection *)CharacterID,(ulong)Name_00, + (char *)Name_00,SUB41(CharacterID,0)); + strcpy(pTVar1->PlayerData->BuddyName[0] + iVar8,Name); + } + pTVar6 = pTVar1->PlayerData; + } + iVar7 = iVar7 + 1; + iVar8 = iVar8 + 0x1e; + } while (iVar7 < pTVar6->Buddies); + } + } +LAB_080a75da: + local_20 = local_20 + 1; + } while (local_20 < FirstFreePlayer); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Online_local + +void CreatePlayerList(bool Online) + +{ + TPlayer *pTVar1; + bool bVar2; + byte bVar3; + char *PlayerNames_00; + int *PlayerLevels_00; + int *PlayerProfessions_00; + TPlayer **ppTVar4; + time_t tVar5; + int iVar6; + TPlayer *Player; + int NumberOfPlayers; + int NumberOfPlayers_00; + int i; + int i_00; + char *local_24; + int *PlayerProfessions; + int *PlayerLevels; + char *PlayerNames; + bool Online_local; + + PlayerNames_00 = (char *)operator_new__(FirstFreePlayer * 0x1e); + PlayerLevels_00 = (int *)operator_new__(FirstFreePlayer << 2); + PlayerProfessions_00 = (int *)operator_new__(FirstFreePlayer << 2); + NumberOfPlayers_00 = Online - 1; + if ((Online) && (i_00 = 0, 0 < FirstFreePlayer)) { + local_24 = PlayerNames_00 + NumberOfPlayers_00 * 0x1e; + do { + ppTVar4 = vector::operator()(&PlayerList,i_00); + pTVar1 = *ppTVar4; + bVar2 = CheckRight((pTVar1->super_TCreature).ID,NO_STATISTICS); + if (!bVar2) { + strcpy(local_24,(pTVar1->super_TCreature).Name); + iVar6 = TSkill::Get((pTVar1->super_TCreature).super_TSkillBase.Skills[0]); + PlayerLevels_00[NumberOfPlayers_00] = iVar6; + bVar2 = CheckRight((pTVar1->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar2) { + bVar3 = (pTVar1->super_TCreature).Profession; + } + else { + bVar3 = (pTVar1->super_TCreature).Profession; + if (9 < bVar3) { + bVar3 = bVar3 - 10; + } + } + local_24 = local_24 + 0x1e; + PlayerProfessions_00[NumberOfPlayers_00] = (uint)bVar3; + NumberOfPlayers_00 = NumberOfPlayers_00 + 1; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + PlayerlistOrder(NumberOfPlayers_00,PlayerNames_00,PlayerLevels_00,PlayerProfessions_00); + if (Online) { + tVar5 = time((time_t *)0x0); + Log("load","%ld %d\n",tVar5,FirstFreePlayer); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void PrintPlayerPositions(void) + +{ + TPlayer *pTVar1; + bool bVar2; + byte bVar3; + TPlayer **ppTVar4; + int iVar5; + TPlayer *Player; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar4 = vector::operator()(&PlayerList,i_00); + pTVar1 = *ppTVar4; + bVar2 = CheckRight((pTVar1->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar2) { + bVar3 = (pTVar1->super_TCreature).Profession; + } + else { + bVar3 = (pTVar1->super_TCreature).Profession; + if (9 < bVar3) { + bVar3 = bVar3 - 10; + } + } + i_00 = i_00 + 1; + iVar5 = TSkill::Get((pTVar1->super_TCreature).super_TSkillBase.Skills[0]); + Log("players","[%d,%d,%d] %d %d\n",(pTVar1->super_TCreature).posx, + (pTVar1->super_TCreature).posy,(pTVar1->super_TCreature).posz,iVar5,(uint)bVar3); + } while (i_00 < FirstFreePlayer); + } + return; +} + + + +void LoadDepot(TPlayerData *PlayerData,int DepotNr,Object *Con) + +{ + bool bVar1; + undefined4 *puVar2; + char *Text; + undefined1 local_4c [4]; + TReadBuffer Buffer; + Object local_2c [7]; + + if (PlayerData == (TPlayerData *)0x0) { + Text = "LoadDepot: PlayerData ist NULL.\n"; + } + else { + // try { // try from 080a7923 to 080a79a9 has its CatchHandler @ 080a7ab8 + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + if ((uint)DepotNr < 9) { + if (PlayerData->Depot[DepotNr] == (uchar *)0x0) { + GetSpecialObject((SPECIALMEANING)&Buffer.Position); + local_4c = (undefined1 [4])Con->ObjectID; + Create(local_2c,(ObjectType *)local_4c,(ulong)&Buffer.Position); + } + else { + // try { // try from 080a79d6 to 080a79ee has its CatchHandler @ 080a7a4b + TReadBuffer::TReadBuffer + ((TReadBuffer *)local_4c,PlayerData->Depot[DepotNr], + PlayerData->DepotSize[DepotNr]); + Buffer.Position = Con->ObjectID; + LoadObjects((TReadStream *)local_4c,(Object *)&Buffer.Position); + } + return; + } + // try { // try from 080a79fc to 080a7a36 has its CatchHandler @ 080a7ab8 + error(&DAT_08102c20,DepotNr); + goto LAB_080a7a01; + } + Text = &DAT_08102c60; + } + else { + Text = &DAT_08102ca0; + } + } + error(Text); +LAB_080a7a01: + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +void SaveDepot(TPlayerData *PlayerData,int DepotNr,Object *Con) + +{ + bool bVar1; + uchar *__dest; + undefined4 *puVar2; + char *Text; + Object local_3c [4]; + undefined1 local_2c [4]; + TDynamicWriteBuffer HelpBuffer; + + if (PlayerData == (TPlayerData *)0x0) { + Text = "SaveDepot: PlayerData ist NULL.\n"; + } + else { + // try { // try from 080a7af0 to 080a7b21 has its CatchHandler @ 080a7ce0 + bVar1 = Object::exists(Con); + if (bVar1) { + Object::getObjectType((Object *)local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER); + if (bVar1) { + if ((uint)DepotNr < 9) { + PlayerData->Dirty = true; + if (PlayerData->Depot[DepotNr] != (uchar *)0x0) { + operator_delete__(PlayerData->Depot[DepotNr]); + PlayerData->Depot[DepotNr] = (uchar *)0x0; + } + // try { // try from 080a7b58 to 080a7b5c has its CatchHandler @ 080a7cc9 + TDynamicWriteBuffer::TDynamicWriteBuffer((TDynamicWriteBuffer *)local_2c,0x4000) + ; + // try { // try from 080a7b6f to 080a7ba2 has its CatchHandler @ 080a7c58 + GetFirstContainerObject(local_3c); + SaveObjects(local_3c,(TWriteStream *)local_2c,false); + PlayerData->DepotSize[DepotNr] = HelpBuffer.super_TWriteBuffer.Size; + __dest = (uchar *)operator_new__(HelpBuffer.super_TWriteBuffer.Size); + PlayerData->Depot[DepotNr] = __dest; + memcpy(__dest,HelpBuffer.super_TWriteBuffer.super_TWriteStream. + _vptr_TWriteStream,PlayerData->DepotSize[DepotNr]); + // try { // try from 080a7bd0 to 080a7bd4 has its CatchHandler @ 080a7cc9 + TDynamicWriteBuffer::~TDynamicWriteBuffer + ((TDynamicWriteBuffer *)local_2c, + (int)HelpBuffer.super_TWriteBuffer.super_TWriteStream. + _vptr_TWriteStream); + return; + } + // try { // try from 080a7c09 to 080a7c43 has its CatchHandler @ 080a7ce0 + error(&DAT_08102d60,DepotNr); + goto LAB_080a7c0e; + } + Text = &DAT_08102da0; + } + else { + Text = &DAT_08102de0; + } + } + error(Text); +LAB_080a7c0e: + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Variable defined which should be unmapped: Capitals_local + +void GetProfessionName(char *Buffer,int Profession,bool Article,bool Capitals) + +{ + char *__src; + bool Capitals_local; + + if (Article) { + if ((Profession == 0xb) || (Profession == 0xe)) { + builtin_strncpy(Buffer,"an ",4); + } + else { + Buffer[0] = 'a'; + Buffer[1] = ' '; + Buffer[2] = '\0'; + } + } + else { + *Buffer = '\0'; + } + switch(Profession) { + case 1: + __src = "Knight"; + break; + case 2: + __src = "Paladin"; + break; + case 3: + __src = "Sorcerer"; + break; + case 4: + __src = "Druid"; + break; + default: + error("GetProfessionName: Unbekannter Beruf %d.\n",Profession); + case 0: + __src = "None"; + break; + case 0xb: + __src = "Elite Knight"; + break; + case 0xc: + __src = "Royal Paladin"; + break; + case 0xd: + __src = "Master Sorcerer"; + break; + case 0xe: + __src = "Elder Druid"; + } + strcat(Buffer,__src); + if (Capitals) { + return; + } + strLower(Buffer); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Requests + +void SendExistingRequests(TConnection *Connection) + +{ + int iVar1; + TPlayer *pTVar2; + int iVar3; + TPlayer *pl; + char *pcVar4; + TPlayer **ppTVar5; + int j; + int iVar6; + int i; + int iVar7; + TPlayer___0_ *Player; + int i_1; + ulong uStack_40; + int local_20; + int local_1c; + undefined1 *local_18; + int local_14; + int Requests; + + local_18 = &stack0xffffffc4; + if (Connection == (TConnection *)0x0) { + uStack_40 = 0x80a7f50; + error("SendExistingRequests: Verbindung ist NULL.\n"); + } + else { + local_14 = 0; + iVar7 = 0; + iVar3 = -(FirstFreePlayer * 4 + 0xfU & 0xfffffff0); + if (0 < FirstFreePlayer) { + do { + *(int *)(&stack0xffffffc8 + iVar3) = iVar7; + *(vector **)(&stack0xffffffc4 + iVar3) = &PlayerList; + *(undefined4 *)((int)&uStack_40 + iVar3) = 0x80a7f00; + ppTVar5 = vector::operator() + (*(vector **)(&stack0xffffffc4 + iVar3), + *(int *)(&stack0xffffffc8 + iVar3)); + pTVar2 = *ppTVar5; + if (pTVar2 == (TPlayer *)0x0) { + *(int *)(&stack0xffffffc8 + iVar3) = iVar7; + *(char **)(&stack0xffffffc4 + iVar3) = + "SendExistingRequests: Spieler %d existiert nicht.\n"; + *(undefined4 *)((int)&uStack_40 + iVar3) = 0x80a7f42; + error(*(char **)(&stack0xffffffc4 + iVar3)); + } + else if ((pTVar2->Request != 0) && (pTVar2->RequestProcessingGamemaster == 0)) { + *(TPlayer **)(&stack0xffffffdc + local_14 * 4 + iVar3) = pTVar2; + local_14 = local_14 + 1; + } + iVar7 = iVar7 + 1; + } while (iVar7 < FirstFreePlayer); + } + iVar7 = 0; + local_1c = local_14 + -1; + if (0 < local_14 + -1) { + do { + iVar6 = iVar7 + 1; + local_20 = iVar6; + if (iVar6 < local_14) { + do { + iVar1 = *(int *)(&stack0xffffffdc + iVar7 * 4 + iVar3); + if (*(int *)(*(int *)(&stack0xffffffdc + iVar6 * 4 + iVar3) + 0x3c4) < + *(int *)(iVar1 + 0x3c4)) { + *(int *)(&stack0xffffffdc + iVar7 * 4 + iVar3) = + *(int *)(&stack0xffffffdc + iVar6 * 4 + iVar3); + *(int *)(&stack0xffffffdc + iVar6 * 4 + iVar3) = iVar1; + } + iVar6 = iVar6 + 1; + } while (iVar6 < local_14); + } + iVar7 = local_20; + } while (local_20 < local_1c); + } + iVar7 = 0; + if (0 < local_14) { + do { + *(undefined4 *)(&stack0xffffffc4 + iVar3) = + *(undefined4 *)(*(int *)(&stack0xffffffdc + iVar7 * 4 + iVar3) + 0x3c0); + *(undefined4 *)((int)&uStack_40 + iVar3) = 0x80a7ea1; + pcVar4 = GetDynamicString(*(ulong *)(&stack0xffffffc4 + iVar3)); + iVar6 = *(int *)(*(int *)(&stack0xffffffdc + iVar7 * 4 + iVar3) + 0x3c4); + *(undefined4 *)(&stack0xffffffd0 + iVar3) = 6; + *(char **)(&stack0xffffffd4 + iVar3) = pcVar4; + *(ulong *)(&stack0xffffffd8 + iVar3) = RoundNr - iVar6; + iVar6 = *(int *)(&stack0xffffffdc + iVar7 * 4 + iVar3); + iVar7 = iVar7 + 1; + *(undefined4 *)(&stack0xffffffc8 + iVar3) = 0; + *(int *)(&stack0xffffffcc + iVar3) = iVar6 + 0x214; + *(TConnection **)(&stack0xffffffc4 + iVar3) = Connection; + *(undefined4 *)((int)&uStack_40 + iVar3) = 0x80a7ee2; + SendTalk(*(TConnection **)(&stack0xffffffc4 + iVar3), + *(ulong *)(&stack0xffffffc8 + iVar3),*(char **)(&stack0xffffffcc + iVar3), + *(int *)(&stack0xffffffd0 + iVar3),*(char **)(&stack0xffffffd4 + iVar3), + *(int *)(&stack0xffffffd8 + iVar3)); + } while (iVar7 < local_14); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitPlayerPool(void) + +{ + TPlayerData *pTVar1; + + pTVar1 = PlayerDataPool; + do { + pTVar1->CharacterID = 0; + pTVar1 = pTVar1 + 1; + } while ((int)pTVar1 < 0x907a435); + return; +} + + + +void SavePlayerPoolSlot(TPlayerData *Slot) + +{ + if (Slot != (TPlayerData *)0x0) { + if (Slot->Dirty != false) { + SavePlayerData(Slot); + Slot->Dirty = false; + } + return; + } + error("SavePlayerPoolSlot: Slot existiert nicht.\n"); + return; +} + + + +void FreePlayerPoolSlot(TPlayerData *Slot) + +{ + __pid_t _Var1; + int i; + int iVar2; + + if (Slot == (TPlayerData *)0x0) { + Slot = (TPlayerData *)s_FreePlayerPoolSlot__Slot_ist_NUL_081030a0; +LAB_080a8015: + error((char *)Slot); + return; + } + print(); + if (Slot->CharacterID != 0) { + if (0 < Slot->Sticky) { + Slot = (TPlayerData *)&DAT_08102fe0; + goto LAB_080a8015; + } + if (Slot->Locked != 0) { + _Var1 = getpid(); + if (Slot->Locked != _Var1) { + Slot = (TPlayerData *)s_FreePlayerPoolSlot__Slot_ist_von_08103040; + goto LAB_080a8015; + } + } + if (Slot->Dirty != false) { + SavePlayerData(Slot); + Slot->Dirty = false; + } + if (Slot->Inventory != (uchar *)0x0) { + operator_delete__(Slot->Inventory); + } + iVar2 = 0; + do { + if (Slot->Depot[iVar2] != (uchar *)0x0) { + operator_delete__(Slot->Depot[iVar2]); + } + iVar2 = iVar2 + 1; + } while (iVar2 < 9); + Slot->CharacterID = 0; + } + return; +} + + + +TPlayerData * GetPlayerPoolSlot(ulong CharacterID) + +{ + int iVar1; + TPlayerData *pTVar2; + + if (CharacterID == 0) { + error("GetPlayerPoolSlot: CharacterID ist Null.\n"); + } + else { + pTVar2 = PlayerDataPool; + iVar1 = 0; + do { + if (pTVar2->CharacterID == CharacterID) { + return (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar1 + -0x4c); + } + pTVar2 = pTVar2 + 1; + iVar1 = iVar1 + 0x1dcc; + } while ((int)pTVar2 < 0x907a435); + } + return (TPlayerData *)0x0; +} + + + +// WARNING: Variable defined which should be unmapped: DontWait_local +// WARNING: Type propagation algorithm not settling + +TPlayerData * AssignPlayerPoolSlot(ulong CharacterID,bool DontWait) + +{ + bool bVar1; + int i; + TPlayerData *pTVar2; + __pid_t _Var3; + int iVar4; + uint uVar5; + TPlayerData *Slot; + int iVar6; + TPlayerData *pTVar7; + TPlayerData *local_1c; + bool DontWait_local; + + if (CharacterID == 0) { + error("AssignPlayerPoolSlot: CharacterID ist Null.\n"); + return (TPlayerData *)0x0; + } + print(); + while( true ) { + Semaphore::down(&PlayerDataPoolMutex); + pTVar2 = GetPlayerPoolSlot(CharacterID); + if (pTVar2 == (TPlayerData *)0x0) break; + if (pTVar2->Locked == 0) { + _Var3 = getpid(); + pTVar2->Locked = _Var3; + Semaphore::up(&PlayerDataPoolMutex); + return pTVar2; + } + if (DontWait) { + pTVar2->Sticky = pTVar2->Sticky + 1; + } + Semaphore::up(&PlayerDataPoolMutex); + if (DontWait) { + return pTVar2; + } + DelayThread(0,100); + } + iVar4 = 0; + iVar6 = 0; + while (*(int *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) != 0) { + iVar4 = iVar4 + 1; + iVar6 = iVar6 + 0x1dcc; + pTVar2 = (TPlayerData *)0x0; + if (1999 < iVar4) goto LAB_080a81ec; + } + pTVar2 = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c); + uVar5 = 0x1dcc; + pTVar7 = pTVar2; + if (((uint)pTVar2 & 4) != 0) { + pTVar7 = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48); + *(undefined4 *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = 0; + uVar5 = 0x1dc8; + } + for (uVar5 = uVar5 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) { + pTVar7->CharacterID = 0; + pTVar7 = (TPlayerData *)&pTVar7->Locked; + } + *(ulong *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = CharacterID; + _Var3 = getpid(); + *(__pid_t *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48) = _Var3; + *(undefined1 *)((int)PlayerDataPool[0].Actual + iVar6 + -0x40) = 0; + *(undefined4 *)((int)PlayerDataPool[0].Actual + iVar6 + -0x44) = 0; + Semaphore::up(&PlayerDataPoolMutex); +LAB_080a81ec: + if (pTVar2 != (TPlayerData *)0x0) { +LAB_080a81f0: + print(); + bVar1 = PlayerDataExists(CharacterID); + if (!bVar1) { + Log("game","Spieler %ld loggt sich zum ersten Mal ein.\n",CharacterID); + } + bVar1 = LoadPlayerData(pTVar2); + if (!bVar1) { + pTVar2->CharacterID = 0; + pTVar2->Locked = 0; + return (TPlayerData *)0x0; + } + return pTVar2; + } + iVar4 = 0; + iVar6 = 0; + while (((*(int *)((int)PlayerDataPool[0].Actual + iVar6 + -0x44) != 0 || + (*(char *)((int)PlayerDataPool[0].Actual + iVar6 + -0x40) != '\0')) || + (*(int *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48) != 0))) { + iVar4 = iVar4 + 1; + iVar6 = iVar6 + 0x1dcc; + if (1999 < iVar4) goto LAB_080a8292; + } + pTVar2 = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c); + FreePlayerPoolSlot(pTVar2); + uVar5 = 0x1dcc; + local_1c = pTVar2; + if (((uint)pTVar2 & 4) != 0) { + local_1c = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48); + uVar5 = 0x1dc8; + *(undefined4 *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = 0; + } + for (uVar5 = uVar5 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) { + local_1c->CharacterID = 0; + local_1c = (TPlayerData *)&local_1c->Locked; + } + *(ulong *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = CharacterID; + _Var3 = getpid(); + *(__pid_t *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48) = _Var3; + Semaphore::up(&PlayerDataPoolMutex); +LAB_080a8292: + if (pTVar2 != (TPlayerData *)0x0) goto LAB_080a81f0; + iVar4 = 0; + iVar6 = 0; + while ((*(int *)((int)PlayerDataPool[0].Actual + iVar6 + -0x44) != 0 || + (*(int *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48) != 0))) { + iVar4 = iVar4 + 1; + iVar6 = iVar6 + 0x1dcc; + if (1999 < iVar4) goto LAB_080a82c3; + } + pTVar2 = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c); + FreePlayerPoolSlot(pTVar2); + uVar5 = 0x1dcc; + local_1c = pTVar2; + if (((uint)pTVar2 & 4) != 0) { + local_1c = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48); + uVar5 = 0x1dc8; + *(undefined4 *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = 0; + } + for (uVar5 = uVar5 >> 2; uVar5 != 0; uVar5 = uVar5 - 1) { + local_1c->CharacterID = 0; + local_1c = (TPlayerData *)&local_1c->Locked; + } + *(ulong *)((int)PlayerDataPool[0].Actual + iVar6 + -0x4c) = CharacterID; + _Var3 = getpid(); + *(__pid_t *)((int)PlayerDataPool[0].Actual + iVar6 + -0x48) = _Var3; + Semaphore::up(&PlayerDataPoolMutex); +LAB_080a82c3: + if (pTVar2 == (TPlayerData *)0x0) { + error("AssignPlayerPoolSlot: Kein Slot mehr frei.\n"); + Semaphore::up(&PlayerDataPoolMutex); + return (TPlayerData *)0x0; + } + goto LAB_080a81f0; +} + + + +// WARNING: Variable defined which should be unmapped: DontWait_local + +TPlayerData * AttachPlayerPoolSlot(ulong CharacterID,bool DontWait) + +{ + TPlayerData *pTVar1; + __pid_t _Var2; + TPlayerData *Slot; + char *Text; + bool DontWait_local; + + if (CharacterID == 0) { + Text = "AttachPlayerPoolSlot: CharacterID ist Null.\n"; + } + else { + print(); + while( true ) { + Semaphore::down(&PlayerDataPoolMutex); + pTVar1 = GetPlayerPoolSlot(CharacterID); + if (pTVar1 == (TPlayerData *)0x0) break; + if (pTVar1->Locked == 0) { + _Var2 = getpid(); + pTVar1->Locked = _Var2; + Semaphore::up(&PlayerDataPoolMutex); + return pTVar1; + } + Semaphore::up(&PlayerDataPoolMutex); + if (DontWait) { + return (TPlayerData *)0x0; + } + DelayThread(0,100); + } + Semaphore::up(&PlayerDataPoolMutex); + Text = "AttachPlayerPoolSlot: Daten des Charakters sind nicht vorhanden.\n"; + } + error(Text); + return (TPlayerData *)0x0; +} + + + +// WARNING: Variable defined which should be unmapped: DontWait_local + +void AttachPlayerPoolSlot(TPlayerData *Slot,bool DontWait) + +{ + __pid_t _Var1; + bool DontWait_local; + + if (Slot == (TPlayerData *)0x0) { + error("AttachPlayerPoolSlot: Slot ist NULL.\n"); + return; + } + print(); + while( true ) { + Semaphore::down(&PlayerDataPoolMutex); + if (Slot->Locked == 0) { + _Var1 = getpid(); + Slot->Locked = _Var1; + Semaphore::up(&PlayerDataPoolMutex); + return; + } + Semaphore::up(&PlayerDataPoolMutex); + if (DontWait) break; + DelayThread(0,100); + } + return; +} + + + +void IncreasePlayerPoolSlotSticky(TPlayerData *Slot) + +{ + if (Slot != (TPlayerData *)0x0) { + Semaphore::down(&PlayerDataPoolMutex); + Slot->Sticky = Slot->Sticky + 1; + Semaphore::up(&PlayerDataPoolMutex); + return; + } + error("IncreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + return; +} + + + +void DecreasePlayerPoolSlotSticky(TPlayerData *Slot) + +{ + if (Slot != (TPlayerData *)0x0) { + Semaphore::down(&PlayerDataPoolMutex); + Slot->Sticky = Slot->Sticky + -1; + Semaphore::up(&PlayerDataPoolMutex); + return; + } + error("DecreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + return; +} + + + +void DecreasePlayerPoolSlotSticky(ulong CharacterID) + +{ + TPlayerData *Slot; + TPlayerData *pTVar1; + + if (CharacterID != 0) { + Semaphore::down(&PlayerDataPoolMutex); + pTVar1 = GetPlayerPoolSlot(CharacterID); + if (pTVar1 == (TPlayerData *)0x0) { + error("DecreasePlayerPoolSlotSticky: Slot von Spieler %ld nicht gefunden.\n",CharacterID + ); + } + else { + pTVar1->Sticky = pTVar1->Sticky + -1; + } + Semaphore::up(&PlayerDataPoolMutex); + return; + } + error("DecreasePlayerPoolSlotSticky: CharacterID ist Null.\n"); + return; +} + + + +void ReleasePlayerPoolSlot(TPlayerData *Slot) + +{ + __pid_t _Var1; + + if (Slot == (TPlayerData *)0x0) { + Slot = (TPlayerData *)s_ReleasePlayerPoolSlot__Slot_ist_N_08103520; + } + else { + print(); + if (Slot->Locked == 0) { + Slot = (TPlayerData *)s_ReleasePlayerPoolSlot__Slot_ist_n_081034e0; + } + else { + _Var1 = getpid(); + if (Slot->Locked == _Var1) { + Slot->Locked = 0; + return; + } + Slot = (TPlayerData *)s_ReleasePlayerPoolSlot__Slot_ist_v_08103480; + } + } + error((char *)Slot); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SavePlayerPoolSlots(void) + +{ + TPlayerData *Slot; + time_t tVar1; + __pid_t _Var2; + int iVar3; + TPlayerData *P; + int i; + int iVar4; + char *Text; + char *pcVar5; + + iVar3 = 0; + print(); + iVar4 = 1999; + do { + Slot = (TPlayerData *)((int)PlayerDataPool[0].Actual + iVar3 + -0x4c); + if ((((*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x4c) != 0) && + (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x44) < 1)) && + (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48) == 0)) && + (*(char *)((int)PlayerDataPool[0].Actual + iVar3 + -0x40) != '\0')) { + tVar1 = time((time_t *)0x0); + if (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x24) <= tVar1 + -900) { + pcVar5 = (char *)0x1; + AttachPlayerPoolSlot(Slot,true); + _Var2 = getpid(); + if (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48) == _Var2) { + if (Slot == (TPlayerData *)0x0) { + error("SavePlayerPoolSlot: Slot existiert nicht.\n"); + } + else if (*(char *)((int)PlayerDataPool[0].Actual + iVar3 + -0x40) != '\0') { + SavePlayerData(Slot); + *(undefined1 *)((int)PlayerDataPool[0].Actual + iVar3 + -0x40) = 0; + } + if (Slot == (TPlayerData *)0x0) { + Text = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; + } + else { + pcVar5 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48) == 0) { + Text = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + } + else { + _Var2 = getpid(); + if (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48) == _Var2) { + *(undefined4 *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48) = 0; + goto LAB_080a875a; + } + Text = + "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + } + } + error(Text,pcVar5); + } + } + } +LAB_080a875a: + iVar3 = iVar3 + 0x1dcc; + iVar4 = iVar4 + -1; + if (iVar4 < 0) { + return; + } + } while( true ); +} + + + +// WARNING: Variable defined which should be unmapped: i +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitPlayerPool(void) + +{ + int iVar1; + __pid_t _Var2; + TPlayerData *Slot; + int iVar3; + char *pcVar4; + char *pcVar5; + int local_14; + int i; + + local_14 = 0; + Slot = PlayerDataPool; + iVar3 = 0; + do { + if (*(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x4c) != 0) { + iVar1 = *(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48); + while (iVar1 != 0) { + print(); + DelayThread(1,0); + iVar1 = *(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x48); + } + iVar1 = *(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x44); + while (0 < iVar1) { + DelayThread(1,0); + pcVar5 = (char *)0x0; + AttachPlayerPoolSlot(Slot,false); + SendMails(Slot); + if (Slot == (TPlayerData *)0x0) { + error("DecreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + pcVar4 = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; +LAB_080a8977: + error(pcVar4,pcVar5); + } + else { + Semaphore::down(&PlayerDataPoolMutex); + Slot->Sticky = Slot->Sticky + -1; + Semaphore::up(&PlayerDataPoolMutex); + pcVar5 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (Slot->Locked == 0) { + pcVar4 = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + goto LAB_080a8977; + } + _Var2 = getpid(); + if (Slot->Locked != _Var2) { + pcVar4 = + "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + goto LAB_080a8977; + } + Slot->Locked = 0; + } + iVar1 = *(int *)((int)PlayerDataPool[0].Actual + iVar3 + -0x44); + } + pcVar5 = (char *)0x0; + AttachPlayerPoolSlot(Slot,false); + FreePlayerPoolSlot(Slot); + if (Slot == (TPlayerData *)0x0) { + pcVar4 = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; + } + else { + pcVar5 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (Slot->Locked == 0) { + pcVar4 = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + } + else { + _Var2 = getpid(); + if (Slot->Locked == _Var2) { + Slot->Locked = 0; + goto LAB_080a89db; + } + pcVar4 = "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + } + } + error(pcVar4,pcVar5); + } +LAB_080a89db: + local_14 = local_14 + 1; + Slot = Slot + 1; + iVar3 = iVar3 + 0x1dcc; + if (1999 < local_14) { + print(); + return; + } + } while( true ); +} + + + +int GetPlayerIndexEntryNumber(char *Name,int Position) + +{ + char cVar1; + size_t sVar2; + char c; + + if (Name == (char *)0x0) { + error("GetPlayerIndexEntryNumber: Name ist NULL.\n"); + } + else { + sVar2 = strlen(Name); + if ((int)sVar2 <= Position) { + return 0; + } + cVar1 = Name[Position]; + if ((byte)(cVar1 + 0xbfU) < 0x1a) { + return cVar1 + -0x40; + } + if ((byte)(cVar1 + 0x9fU) < 0x1a) { + return cVar1 + -0x60; + } + } + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: Node_local + +void InsertPlayerIndex(TPlayerIndexInternalNode *Node,int Position,char *Name,ulong CharacterID) + +{ + storeitem<> *psVar1; + TPlayerIndexEntry *pTVar2; + int i_1; + int iVar3; + int iVar4; + TPlayerIndexInternalNode *Node_00; + TPlayerIndexLeafNode *pTVar5; + TPlayerIndexLeafNode *Leaf; + TPlayerIndexEntry *pTVar6; + storeitem<> *psVar7; + int i; + int iVar8; + TPlayerIndexNode *Child; + char *local_2c; + int local_28; + int i_2; + int Number; + ulong CharacterID_local; + char *Name_local; + int Position_local; + TPlayerIndexInternalNode *Node_local; + + Position_local = (int)Node; + Name_local = (char *)Position; + do { + if (Position_local == 0) { + Node = (TPlayerIndexInternalNode *)s_InsertPlayerIndex__Node_ist_NULL_08103660; +LAB_080a8cca: + error((char *)Node); + return; + } + if (Name == (char *)0x0) { + Node = (TPlayerIndexInternalNode *)s_InsertPlayerIndex__Name_ist_NULL_08103620; + goto LAB_080a8cca; + } + iVar3 = GetPlayerIndexEntryNumber(Name,(int)Name_local); + psVar1 = *(storeitem<> **)(Position_local + 4 + iVar3 * 4); + if (psVar1 == (storeitem<> *)0x0) { + pTVar5 = store<>::getFreeItem(&PlayerIndexLeafNodes); + (pTVar5->super_TPlayerIndexNode).InternalNode = false; + strcpy(pTVar5->Entry[0].Name,Name); + pTVar5->Count = 1; + pTVar5->Entry[0].CharacterID = CharacterID; + *(TPlayerIndexLeafNode **)(Position_local + 4 + iVar3 * 4) = pTVar5; + return; + } + if ((psVar1->data).super_TPlayerIndexNode.InternalNode == false) { + if ((psVar1->data).Count < 1) { + iVar4 = (psVar1->data).Count; + } + else { + pTVar6 = (psVar1->data).Entry; + iVar8 = 0; + do { + iVar4 = strcmp(pTVar6->Name,Name); + if (iVar4 == 0) { + return; + } + iVar4 = (psVar1->data).Count; + iVar8 = iVar8 + 1; + pTVar6 = pTVar6 + 1; + } while (iVar8 < iVar4); + } + if (iVar4 < 10) { + strcpy((char *)((int)psVar1 + (psVar1->data).Count * 0x24 + 8),Name); + *(ulong *)((int)psVar1 + (psVar1->data).Count * 0x24 + 0x28) = CharacterID; + (psVar1->data).Count = (psVar1->data).Count + 1; + return; + } + Node_00 = store<>::getFreeItem(&PlayerIndexInternalNodes); + (Node_00->super_TPlayerIndexNode).InternalNode = true; + iVar4 = 0; + do { + Node_00->Child[iVar4] = (TPlayerIndexNode *)0x0; + iVar4 = iVar4 + 1; + } while (iVar4 < 0x1b); + *(TPlayerIndexInternalNode **)(Position_local + 4 + iVar3 * 4) = Node_00; + local_28 = 0; + if (0 < (psVar1->data).Count) { + psVar7 = psVar1; + do { + pTVar2 = (psVar7->data).Entry; + pTVar6 = (psVar7->data).Entry; + psVar7 = (storeitem<> *)((psVar7->data).Entry[0].Name + 0x1c); + InsertPlayerIndex(Node_00,(int)(Name_local + 1),pTVar6->Name,pTVar2->CharacterID + ); + local_28 = local_28 + 1; + } while (local_28 < (psVar1->data).Count); + } + local_2c = Name_local + 1; + psVar1->next = PlayerIndexLeafNodes.firstFreeItem; + Name_local = local_2c; + PlayerIndexLeafNodes.firstFreeItem = psVar1; + Position_local = (int)Node_00; + } + else { + Name_local = Name_local + 1; + Position_local = (int)psVar1; + } + } while( true ); +} + + + +TPlayerIndexEntry * SearchPlayerIndex(char *Name) + +{ + int iVar1; + int Position; + TPlayerIndexEntry *s1; + TPlayerIndexNode *Node; + TPlayerIndexInternalNode *pTVar2; + int i; + int iVar3; + + if (Name == (char *)0x0) { + error("SearchPlayerIndex: Name ist NULL.\n"); + } + else { + pTVar2 = &PlayerIndexHead; + iVar3 = 0; + if (PlayerIndexHead.super_TPlayerIndexNode.InternalNode != false) { + do { + iVar1 = GetPlayerIndexEntryNumber(Name,iVar3); + pTVar2 = (TPlayerIndexInternalNode *)pTVar2->Child[iVar1]; + if (pTVar2 == (TPlayerIndexInternalNode *)0x0) { + return (TPlayerIndexEntry *)0x0; + } + iVar3 = iVar3 + 1; + } while ((pTVar2->super_TPlayerIndexNode).InternalNode != false); + } + iVar3 = 0; + if (0 < (int)pTVar2->Child[0]) { + s1 = (TPlayerIndexEntry *)(pTVar2->Child + 1); + do { + iVar1 = stricmp(s1->Name,Name,-1); + if (iVar1 == 0) { + return s1; + } + iVar3 = iVar3 + 1; + s1 = s1 + 1; + } while (iVar3 < (int)pTVar2->Child[0]); + } + } + return (TPlayerIndexEntry *)0x0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitPlayerIndex(void) + +{ + int iVar1; + ulong MinimumCharacterID; + int iVar2; + TQueryManagerConnection *this; + char *MinimumCharacterID_00; + ulong *Name; + int i_1; + int iStack_53040; + int NumberOfPlayers; + ulong CharacterIDs [10000]; + char Names [10000] [30]; + + iVar2 = 0; + PlayerIndexHead.super_TPlayerIndexNode.InternalNode = true; + do { + PlayerIndexHead.Child[iVar2] = (TPlayerIndexNode *)0x0; + iVar2 = iVar2 + 1; + } while (iVar2 < 0x1b); + this = (TQueryManagerConnection *)operator_new(0x30); + // try { // try from 080a8dc5 to 080a8dc9 has its CatchHandler @ 080a8ece + TQueryManagerConnection::TQueryManagerConnection(this,0x57e47); + if (this->Socket < 0) { + error("InitPlayerIndex: Kann nicht zum Query-Manager verbinden.\n"); + } + else { + MinimumCharacterID_00 = (char *)0x0; + while( true ) { + iVar2 = TQueryManagerConnection::loadPlayers + (this,(ulong)MinimumCharacterID_00,&iStack_53040, + (char (*) [30])(CharacterIDs + 9999),(ulong *)&NumberOfPlayers); + if (iVar2 != 0) break; + if (0 < iStack_53040) { + iVar2 = 0; + Name = CharacterIDs + 9999; + do { + iVar1 = iVar2 + -1; + iVar2 = iVar2 + 1; + InsertPlayerIndex(&PlayerIndexHead,0,(char *)Name,CharacterIDs[iVar1]); + Name = (ulong *)((int)Name + 0x1e); + } while (iVar2 < iStack_53040); + } + MinimumCharacterID_00 = "%d Spielernamen geladen.\n"; + print(); + if (iStack_53040 < 10000) goto LAB_080a8e91; + MinimumCharacterID_00 = (char *)(CharacterIDs[0x270e] + 1); + } + error("InitPlayerIndex: Kann Spielerdaten nicht ermitteln.\n"); +LAB_080a8e91: + if (this != (TQueryManagerConnection *)0x0) { + TQueryManagerConnection::~TQueryManagerConnection(this,(int)MinimumCharacterID_00); + operator_delete(this); + } + } + return; +} + + + +bool PlayerExists(char *Name) + +{ + TPlayerIndexEntry *pTVar1; + bool bVar2; + + if (Name == (char *)0x0) { + error("PlayerExists: Name ist NULL.\n"); + bVar2 = false; + } + else { + pTVar1 = SearchPlayerIndex(Name); + bVar2 = pTVar1 != (TPlayerIndexEntry *)0x0; + } + return bVar2; +} + + + +ulong GetCharacterID(char *Name) + +{ + TPlayerIndexEntry *pTVar1; + ulong uVar2; + + if (Name == (char *)0x0) { + error("GetCharacterID: Name ist NULL.\n"); + uVar2 = 0; + } + else { + pTVar1 = SearchPlayerIndex(Name); + uVar2 = 0; + if (pTVar1 != (TPlayerIndexEntry *)0x0) { + uVar2 = pTVar1->CharacterID; + } + } + return uVar2; +} + + + +char * GetCharacterName(char *Name) + +{ + TPlayerIndexEntry *pTVar1; + + if (Name == (char *)0x0) { + error("GetCharacterName: Name ist NULL.\n"); + pTVar1 = (TPlayerIndexEntry *)0x0; + } + else { + pTVar1 = SearchPlayerIndex(Name); + if (pTVar1 == (TPlayerIndexEntry *)0x0) { + error("GetCharacterName: Spieler existiert nicht.\n"); + pTVar1 = (TPlayerIndexEntry *)0x8107675; + } + } + return pTVar1->Name; +} + + + +// DWARF original prototype: void TPlayer(TPlayer * this, TConnection * Connection, ulong +// CharacterID) + +void __thiscall TPlayer::TPlayer(TPlayer *this,TConnection *Connection,ulong CharacterID) + +{ + char *__dest; + TSkill **ppTVar1; + TSkill *pTVar2; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar3; + bool bVar4; + byte bVar5; + ushort HouseID; + int i; + Object *pOVar6; + uint uVar7; + TPlayerData *pTVar8; + char *__src; + time_t tVar9; + TPlayer **ppTVar10; + int iVar11; + TCreature *pTVar12; + tm *__tp; + int iVar13; + ulong id; + int i_1; + uchar *puVar14; + int *piVar15; + char local_ac [4]; + char TimeString [100]; + Object local_3c [4]; + ulong local_2c; + + TCreature::TCreature(&this->super_TCreature); + pOVar6 = this->OpenContainer; + (this->Depot).ObjectID = 0; + (this->TradeObject).ObjectID = 0; + iVar13 = 0xf; + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TPlayer_08127c68; + do { + pOVar6->ObjectID = 0; + iVar13 = iVar13 + -1; + pOVar6 = pOVar6 + 1; + } while (iVar13 != -1); + // try { // try from 080a9026 to 080a902a has its CatchHandler @ 080a9a43 + vector<>::vector(&this->AttackedPlayers,0,10,10); + // try { // try from 080a9052 to 080a9056 has its CatchHandler @ 080a9a3f + vector<>::vector(&this->FormerAttackedPlayers,0,10,10); + (this->super_TCreature).Profession = '\0'; + this->ConstructError = NOERROR; + (this->super_TCreature).Type = PLAYER; + (this->Depot).ObjectID = ::NONE.ObjectID; + local_3c[0] = ::NONE; + local_2c = ::NONE.ObjectID; + (this->TradeObject).ObjectID = ::NONE.ObjectID; + this->OldState = 0; + this->OpenContainer[0].ObjectID = 0; + this->OpenContainer[2].ObjectID = 0; + this->OpenContainer[4].ObjectID = 0; + this->OpenContainer[1].ObjectID = 0; + this->OpenContainer[5].ObjectID = 0; + this->OpenContainer[7].ObjectID = 0; + this->OpenContainer[6].ObjectID = 0; + this->OpenContainer[8].ObjectID = 0; + this->OpenContainer[10].ObjectID = 0; + this->OpenContainer[3].ObjectID = 0; + this->OpenContainer[9].ObjectID = 0; + this->OpenContainer[0xb].ObjectID = 0; + this->OpenContainer[0xe].ObjectID = 0; + this->OpenContainer[0xc].ObjectID = 0; + this->OpenContainer[0xd].ObjectID = 0; + this->OpenContainer[0xf].ObjectID = 0; + puVar14 = this->SpellList; + for (iVar13 = 0x40; iVar13 != 0; iVar13 = iVar13 + -1) { + puVar14[0] = '\0'; + puVar14[1] = '\0'; + puVar14[2] = '\0'; + puVar14[3] = '\0'; + puVar14 = puVar14 + 4; + } + uVar7 = 2000; + piVar15 = this->QuestValues; + if (((uint)piVar15 & 4) != 0) { + uVar7 = 0x7cc; + this->QuestValues[0] = 0; + piVar15 = this->QuestValues + 1; + } + for (uVar7 = uVar7 >> 2; uVar7 != 0; uVar7 = uVar7 - 1) { + *piVar15 = 0; + piVar15 = piVar15 + 1; + } + this->Request = 0; + this->RequestTimestamp = 0; + this->RequestProcessingGamemaster = 0; + this->TutorActivities = 0; + this->NumberOfAttackedPlayers = 0; + this->NumberOfFormerAttackedPlayers = 0; + this->PartyLeader = 0; + (this->super_TCreature).LoseInventory = 1; + iVar13 = 0; + this->Guild[0] = '\0'; + this->Rank[0] = '\0'; + this->Title[0] = '\0'; + this->Aggressor = false; + this->FormerAggressor = false; + this->TalkBufferFullTime = 0; + this->MutingEndRound = 0; + this->NumberOfMutings = 0; + do { + this->Addressees[iVar13] = 0; + iVar13 = iVar13 + 1; + } while (iVar13 < 0x14); + // try { // try from 080a91fa to 080a9232 has its CatchHandler @ 080a9a3b + pTVar8 = AttachPlayerPoolSlot(CharacterID,false); + this->PlayerData = pTVar8; + if (pTVar8 == (TPlayerData *)0x0) { + error("TPlayer::TPlayer: PlayerData-Slot nicht gefunden.\n"); + this->ConstructError = ERROR; + } + else { + SendMails(pTVar8); + pTVar8 = this->PlayerData; + __dest = (this->super_TCreature).Name; + (this->super_TCreature).Connection = Connection; + strcpy(__dest,pTVar8->Name); + // try { // try from 080a9266 to 080a99d8 has its CatchHandler @ 080a99f0 + TCreature::SetID(&this->super_TCreature,CharacterID); + InsertPlayerIndex(&PlayerIndexHead,0,__dest,CharacterID); + LoadData(this); + this->AccountID = this->PlayerData->AccountID; + __src = TConnection::GetIPAddress(Connection); + strcpy(this->IPAddress,__src); + pTVar8 = this->PlayerData; + *(undefined4 *)this->Rights = *(undefined4 *)pTVar8->Rights; + *(undefined4 *)(this->Rights + 4) = *(undefined4 *)(pTVar8->Rights + 4); + *(undefined4 *)(this->Rights + 8) = *(undefined4 *)(pTVar8->Rights + 8); + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + Log("game","Spieler besitzt Premium Account.\n"); + } + pTVar8 = this->PlayerData; + (this->super_TCreature).Sex = pTVar8->Sex; + strcpy(this->Guild,pTVar8->Guild); + strcpy(this->Rank,this->PlayerData->Rank); + strcpy(this->Title,this->PlayerData->Title); + pTVar8 = this->PlayerData; + this->Request = 0; + this->RequestTimestamp = 0; + this->RequestProcessingGamemaster = 0; + tVar9 = time((time_t *)0x0); + if (pTVar8->PlayerkillerEnd < tVar9) { + this->PlayerData->PlayerkillerEnd = 0; + } + CheckOutfit(this); + TCreature::SetInCrList(&this->super_TCreature); + Semaphore::down(&PlayerMutex); + ppTVar10 = vector::operator()(&PlayerList,FirstFreePlayer); + FirstFreePlayer = FirstFreePlayer + 1; + *ppTVar10 = this; + Semaphore::up(&PlayerMutex); + iVar13 = 1; + NotifyBuddies((this->super_TCreature).ID,__dest,true); + IncrementPlayersOnline(); + if ((this->super_TCreature).Profession == '\0') { + IncrementNewbiesOnline(); + } + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0x16]; + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + bVar4 = 9 < (this->super_TCreature).Profession; + } + else { + bVar4 = false; + } + iVar11 = 200; + if (!bVar4) { + iVar11 = 100; + } + pTVar2->Max = iVar11; + TSkill::Check((this->super_TCreature).super_TSkillBase.Skills[0x16]); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0x16]; + iVar11 = (*pTVar2->_vptr_TSkill[0xd])(pTVar2); + if (0xe < iVar11) { + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + bVar4 = 9 < (this->super_TCreature).Profession; + } + else { + bVar4 = false; + } + iVar13 = 0xf; + if (!bVar4) { + iVar13 = 0x78; + } + CharacterID = (iVar11 + -1) % iVar13 + 1; + iVar13 = (iVar11 + -1) / iVar13 + 1; + TSkillBase::SetTimer(&(this->super_TCreature).super_TSkillBase); + } + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[2]; + iVar11 = TSkill::Get(pTVar2); + if (iVar11 < 1) { + (*pTVar2->_vptr_TSkill[2])(pTVar2,pTVar2->Max,iVar13,CharacterID); + iVar13 = 0; + (this->super_TCreature).posx = (this->super_TCreature).startx; + (this->super_TCreature).posy = (this->super_TCreature).starty; + (this->super_TCreature).posz = (this->super_TCreature).startz; + do { + TSkillBase::DelTimer(&(this->super_TCreature).super_TSkillBase,(ushort)iVar13); + TSkill::SetMDAct((this->super_TCreature).super_TSkillBase.Skills[iVar13],0); + ppTVar1 = (this->super_TCreature).super_TSkillBase.Skills + iVar13; + iVar13 = iVar13 + 1; + (*ppTVar1)->DAct = 0; + } while (iVar13 < 0x19); + aVar3 = (this->super_TCreature).OrgOutfit.field_1; + (this->super_TCreature).Outfit.OutfitID = (this->super_TCreature).OrgOutfit.OutfitID; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[3]; + (this->super_TCreature).Outfit.field_1 = aVar3; + (*pTVar2->_vptr_TSkill[2]) + ((this->super_TCreature).super_TSkillBase.Skills[3],pTVar2->Max); + } + if (this->PlayerData->LastLoginTime == 0) { + bVar4 = CheckRight((this->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (bVar4) { + Log("game","Gamemaster-Charakter %s loggt zum ersten Mal ein -> Level 2 setzen.\n", + __dest); + (this->super_TCreature).super_TSkillBase.Skills[0]->Act = 2; + (this->super_TCreature).super_TSkillBase.Skills[0]->Exp = 100; + (this->super_TCreature).super_TSkillBase.Skills[0]->LastLevel = 100; + (this->super_TCreature).super_TSkillBase.Skills[0]->NextLevel = 200; + } + } + bVar4 = CoordinateFlag(); + if (bVar4) { + Regenerate(this); + } + HouseID = GetHouseID((this->super_TCreature).posx,(this->super_TCreature).posy, + (this->super_TCreature).posz); + if (HouseID != 0) { + bVar4 = IsInvited(HouseID,this,this->PlayerData->LastLogoutTime); + if (!bVar4) { + bVar4 = CheckRight((this->super_TCreature).ID,ENTER_HOUSES); + if (!bVar4) { + GetExitPosition(HouseID,&(this->super_TCreature).posx, + &(this->super_TCreature).posy,&(this->super_TCreature).posz); + } + } + } + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (!bVar4) { + bVar4 = IsPremiumArea((this->super_TCreature).startx,(this->super_TCreature).starty, + (this->super_TCreature).startz); + if (bVar4) { + Log("game",&DAT_08103880,__dest); + bVar5 = (this->super_TCreature).Profession; + if (9 < bVar5) { + bVar5 = bVar5 - 10; + } + GetStartPosition(&(this->super_TCreature).startx,&(this->super_TCreature).starty, + &(this->super_TCreature).startz,bVar5 == 0); + } + bVar4 = IsPremiumArea((this->super_TCreature).posx,(this->super_TCreature).posy, + (this->super_TCreature).posz); + if (bVar4) { + Log("game", + "Spieler %s wird aus PayArea geworfen und in seine Heimatstadt gesetzt.\n", + __dest); + (this->super_TCreature).posx = (this->super_TCreature).startx; + (this->super_TCreature).posy = (this->super_TCreature).starty; + (this->super_TCreature).posz = (this->super_TCreature).startz; + } + } + TCreature::SetOnMap(&this->super_TCreature); + TConnection::EnterGame(Connection); + SendInitGame((TConnection *)(this->super_TCreature).ID,id); + SendRights((this->super_TCreature).Connection); + SendFullScreen((this->super_TCreature).Connection); + local_3c[0].ObjectID = (this->super_TCreature).CrObject.ObjectID; + GraphicalEffect(local_3c,0xb); + LoadInventory(this,this->PlayerData->LastLoginTime == 0); + TCreature::NotifyChangeInventory(&this->super_TCreature); + SendAmbiente((this->super_TCreature).Connection); + pTVar12 = GetCreature((this->super_TCreature).ID); + if (pTVar12 == (TCreature *)0x0) { + error("TPlayer::TPlayer: Kreatur nicht korrekt angelegt.\n"); + } + else { + AnnounceChangedCreature((this->super_TCreature).ID,2); + } + SendPlayerSkills((this->super_TCreature).Connection); + this->OldState = 0; + CheckState(this); + if (this->PlayerData->LastLoginTime == 0) { + bVar4 = CheckRight((this->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (!bVar4) { + Log("game","Spieler %s loggt zum ersten Mal ein -> Outfitwahl.\n",__dest); + SendMessage((this->super_TCreature).Connection,0x14, + "Welcome to Tibia! Please choose your outfit."); + SendOutfit((this->super_TCreature).Connection); + } + } + SendBuddies(this); + pTVar8 = this->PlayerData; + if (pTVar8->LastLoginTime != 0) { + __tp = localtime(&pTVar8->LastLoginTime); + strftime(local_ac,100,"%d. %b %Y %X %Z",__tp); + SendMessage((this->super_TCreature).Connection,0x14,"Your last visit in Tibia: %s.", + local_ac); + pTVar8 = this->PlayerData; + } + tVar9 = time((time_t *)0x0); + pTVar8->LastLoginTime = tVar9; + } + return; +} + + + +// DWARF original prototype: void TPlayer(TPlayer * this, TConnection * Connection, ulong +// CharacterID) + +void __thiscall TPlayer::TPlayer(TPlayer *this,TConnection *Connection,ulong CharacterID) + +{ + char *__dest; + TSkill **ppTVar1; + TSkill *pTVar2; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar3; + bool bVar4; + byte bVar5; + ushort HouseID; + int i; + Object *pOVar6; + uint uVar7; + TPlayerData *pTVar8; + char *__src; + time_t tVar9; + TPlayer **ppTVar10; + int iVar11; + TCreature *pTVar12; + tm *__tp; + int iVar13; + ulong id; + int i_1; + uchar *puVar14; + int *piVar15; + char local_ac [4]; + char TimeString [100]; + Object local_3c [4]; + ulong local_2c; + + TCreature::TCreature(&this->super_TCreature); + pOVar6 = this->OpenContainer; + (this->Depot).ObjectID = 0; + (this->TradeObject).ObjectID = 0; + iVar13 = 0xf; + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TPlayer_08127c68; + do { + pOVar6->ObjectID = 0; + iVar13 = iVar13 + -1; + pOVar6 = pOVar6 + 1; + } while (iVar13 != -1); + // try { // try from 080a9ad6 to 080a9ada has its CatchHandler @ 080aa4f3 + vector<>::vector(&this->AttackedPlayers,0,10,10); + // try { // try from 080a9b02 to 080a9b06 has its CatchHandler @ 080aa4ef + vector<>::vector(&this->FormerAttackedPlayers,0,10,10); + (this->super_TCreature).Profession = '\0'; + this->ConstructError = NOERROR; + (this->super_TCreature).Type = PLAYER; + (this->Depot).ObjectID = ::NONE.ObjectID; + local_3c[0] = ::NONE; + local_2c = ::NONE.ObjectID; + (this->TradeObject).ObjectID = ::NONE.ObjectID; + this->OpenContainer[0].ObjectID = 0; + this->OldState = 0; + this->OpenContainer[3].ObjectID = 0; + this->OpenContainer[4].ObjectID = 0; + this->OpenContainer[2].ObjectID = 0; + this->OpenContainer[6].ObjectID = 0; + this->OpenContainer[7].ObjectID = 0; + this->OpenContainer[5].ObjectID = 0; + this->OpenContainer[9].ObjectID = 0; + this->OpenContainer[0xb].ObjectID = 0; + this->OpenContainer[1].ObjectID = 0; + this->OpenContainer[8].ObjectID = 0; + this->OpenContainer[0xc].ObjectID = 0; + this->OpenContainer[0xe].ObjectID = 0; + this->OpenContainer[10].ObjectID = 0; + this->OpenContainer[0xd].ObjectID = 0; + this->OpenContainer[0xf].ObjectID = 0; + puVar14 = this->SpellList; + for (iVar13 = 0x40; iVar13 != 0; iVar13 = iVar13 + -1) { + puVar14[0] = '\0'; + puVar14[1] = '\0'; + puVar14[2] = '\0'; + puVar14[3] = '\0'; + puVar14 = puVar14 + 4; + } + uVar7 = 2000; + piVar15 = this->QuestValues; + if (((uint)piVar15 & 4) != 0) { + piVar15 = this->QuestValues + 1; + uVar7 = 0x7cc; + this->QuestValues[0] = 0; + } + for (uVar7 = uVar7 >> 2; uVar7 != 0; uVar7 = uVar7 - 1) { + *piVar15 = 0; + piVar15 = piVar15 + 1; + } + this->Request = 0; + this->RequestTimestamp = 0; + this->RequestProcessingGamemaster = 0; + this->TutorActivities = 0; + (this->super_TCreature).LoseInventory = 1; + this->NumberOfAttackedPlayers = 0; + this->NumberOfFormerAttackedPlayers = 0; + this->NumberOfMutings = 0; + iVar13 = 0; + this->Guild[0] = '\0'; + this->Rank[0] = '\0'; + this->Title[0] = '\0'; + this->Aggressor = false; + this->FormerAggressor = false; + this->PartyLeader = 0; + this->TalkBufferFullTime = 0; + this->MutingEndRound = 0; + do { + this->Addressees[iVar13] = 0; + iVar13 = iVar13 + 1; + } while (iVar13 < 0x14); + // try { // try from 080a9caa to 080a9ce2 has its CatchHandler @ 080aa4eb + pTVar8 = AttachPlayerPoolSlot(CharacterID,false); + this->PlayerData = pTVar8; + if (pTVar8 == (TPlayerData *)0x0) { + error("TPlayer::TPlayer: PlayerData-Slot nicht gefunden.\n"); + this->ConstructError = ERROR; + } + else { + SendMails(pTVar8); + pTVar8 = this->PlayerData; + (this->super_TCreature).Connection = Connection; + __dest = (this->super_TCreature).Name; + strcpy(__dest,pTVar8->Name); + // try { // try from 080a9d16 to 080aa488 has its CatchHandler @ 080aa4a0 + TCreature::SetID(&this->super_TCreature,CharacterID); + InsertPlayerIndex(&PlayerIndexHead,0,__dest,CharacterID); + LoadData(this); + this->AccountID = this->PlayerData->AccountID; + __src = TConnection::GetIPAddress(Connection); + strcpy(this->IPAddress,__src); + pTVar8 = this->PlayerData; + *(undefined4 *)this->Rights = *(undefined4 *)pTVar8->Rights; + *(undefined4 *)(this->Rights + 4) = *(undefined4 *)(pTVar8->Rights + 4); + *(undefined4 *)(this->Rights + 8) = *(undefined4 *)(pTVar8->Rights + 8); + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + Log("game","Spieler besitzt Premium Account.\n"); + } + pTVar8 = this->PlayerData; + (this->super_TCreature).Sex = pTVar8->Sex; + strcpy(this->Guild,pTVar8->Guild); + strcpy(this->Rank,this->PlayerData->Rank); + strcpy(this->Title,this->PlayerData->Title); + pTVar8 = this->PlayerData; + this->Request = 0; + this->RequestTimestamp = 0; + this->RequestProcessingGamemaster = 0; + tVar9 = time((time_t *)0x0); + if (pTVar8->PlayerkillerEnd < tVar9) { + this->PlayerData->PlayerkillerEnd = 0; + } + CheckOutfit(this); + TCreature::SetInCrList(&this->super_TCreature); + Semaphore::down(&PlayerMutex); + ppTVar10 = vector::operator()(&PlayerList,FirstFreePlayer); + FirstFreePlayer = FirstFreePlayer + 1; + *ppTVar10 = this; + Semaphore::up(&PlayerMutex); + iVar13 = 1; + NotifyBuddies((this->super_TCreature).ID,__dest,true); + IncrementPlayersOnline(); + if ((this->super_TCreature).Profession == '\0') { + IncrementNewbiesOnline(); + } + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0x16]; + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + bVar4 = 9 < (this->super_TCreature).Profession; + } + else { + bVar4 = false; + } + iVar11 = 200; + if (!bVar4) { + iVar11 = 100; + } + pTVar2->Max = iVar11; + TSkill::Check((this->super_TCreature).super_TSkillBase.Skills[0x16]); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0x16]; + iVar11 = (*pTVar2->_vptr_TSkill[0xd])(pTVar2); + if (0xe < iVar11) { + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar4) { + bVar4 = 9 < (this->super_TCreature).Profession; + } + else { + bVar4 = false; + } + iVar13 = 0xf; + if (!bVar4) { + iVar13 = 0x78; + } + CharacterID = (iVar11 + -1) % iVar13 + 1; + iVar13 = (iVar11 + -1) / iVar13 + 1; + TSkillBase::SetTimer(&(this->super_TCreature).super_TSkillBase); + } + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[2]; + iVar11 = TSkill::Get(pTVar2); + if (iVar11 < 1) { + (*pTVar2->_vptr_TSkill[2])(pTVar2,pTVar2->Max,iVar13,CharacterID); + iVar13 = 0; + (this->super_TCreature).posx = (this->super_TCreature).startx; + (this->super_TCreature).posy = (this->super_TCreature).starty; + (this->super_TCreature).posz = (this->super_TCreature).startz; + do { + TSkillBase::DelTimer(&(this->super_TCreature).super_TSkillBase,(ushort)iVar13); + TSkill::SetMDAct((this->super_TCreature).super_TSkillBase.Skills[iVar13],0); + ppTVar1 = (this->super_TCreature).super_TSkillBase.Skills + iVar13; + iVar13 = iVar13 + 1; + (*ppTVar1)->DAct = 0; + } while (iVar13 < 0x19); + aVar3 = (this->super_TCreature).OrgOutfit.field_1; + (this->super_TCreature).Outfit.OutfitID = (this->super_TCreature).OrgOutfit.OutfitID; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[3]; + (this->super_TCreature).Outfit.field_1 = aVar3; + (*pTVar2->_vptr_TSkill[2]) + ((this->super_TCreature).super_TSkillBase.Skills[3],pTVar2->Max); + } + if (this->PlayerData->LastLoginTime == 0) { + bVar4 = CheckRight((this->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (bVar4) { + Log("game","Gamemaster-Charakter %s loggt zum ersten Mal ein -> Level 2 setzen.\n", + __dest); + (this->super_TCreature).super_TSkillBase.Skills[0]->Act = 2; + (this->super_TCreature).super_TSkillBase.Skills[0]->Exp = 100; + (this->super_TCreature).super_TSkillBase.Skills[0]->LastLevel = 100; + (this->super_TCreature).super_TSkillBase.Skills[0]->NextLevel = 200; + } + } + bVar4 = CoordinateFlag(); + if (bVar4) { + Regenerate(this); + } + HouseID = GetHouseID((this->super_TCreature).posx,(this->super_TCreature).posy, + (this->super_TCreature).posz); + if (HouseID != 0) { + bVar4 = IsInvited(HouseID,this,this->PlayerData->LastLogoutTime); + if (!bVar4) { + bVar4 = CheckRight((this->super_TCreature).ID,ENTER_HOUSES); + if (!bVar4) { + GetExitPosition(HouseID,&(this->super_TCreature).posx, + &(this->super_TCreature).posy,&(this->super_TCreature).posz); + } + } + } + bVar4 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (!bVar4) { + bVar4 = IsPremiumArea((this->super_TCreature).startx,(this->super_TCreature).starty, + (this->super_TCreature).startz); + if (bVar4) { + Log("game",&DAT_08103880,__dest); + bVar5 = (this->super_TCreature).Profession; + if (9 < bVar5) { + bVar5 = bVar5 - 10; + } + GetStartPosition(&(this->super_TCreature).startx,&(this->super_TCreature).starty, + &(this->super_TCreature).startz,bVar5 == 0); + } + bVar4 = IsPremiumArea((this->super_TCreature).posx,(this->super_TCreature).posy, + (this->super_TCreature).posz); + if (bVar4) { + Log("game", + "Spieler %s wird aus PayArea geworfen und in seine Heimatstadt gesetzt.\n", + __dest); + (this->super_TCreature).posx = (this->super_TCreature).startx; + (this->super_TCreature).posy = (this->super_TCreature).starty; + (this->super_TCreature).posz = (this->super_TCreature).startz; + } + } + TCreature::SetOnMap(&this->super_TCreature); + TConnection::EnterGame(Connection); + SendInitGame((TConnection *)(this->super_TCreature).ID,id); + SendRights((this->super_TCreature).Connection); + SendFullScreen((this->super_TCreature).Connection); + local_3c[0].ObjectID = (this->super_TCreature).CrObject.ObjectID; + GraphicalEffect(local_3c,0xb); + LoadInventory(this,this->PlayerData->LastLoginTime == 0); + TCreature::NotifyChangeInventory(&this->super_TCreature); + SendAmbiente((this->super_TCreature).Connection); + pTVar12 = GetCreature((this->super_TCreature).ID); + if (pTVar12 == (TCreature *)0x0) { + error("TPlayer::TPlayer: Kreatur nicht korrekt angelegt.\n"); + } + else { + AnnounceChangedCreature((this->super_TCreature).ID,2); + } + SendPlayerSkills((this->super_TCreature).Connection); + this->OldState = 0; + CheckState(this); + if (this->PlayerData->LastLoginTime == 0) { + bVar4 = CheckRight((this->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (!bVar4) { + Log("game","Spieler %s loggt zum ersten Mal ein -> Outfitwahl.\n",__dest); + SendMessage((this->super_TCreature).Connection,0x14, + "Welcome to Tibia! Please choose your outfit."); + SendOutfit((this->super_TCreature).Connection); + } + } + SendBuddies(this); + pTVar8 = this->PlayerData; + if (pTVar8->LastLoginTime != 0) { + __tp = localtime(&pTVar8->LastLoginTime); + strftime(local_ac,100,"%d. %b %Y %X %Z",__tp); + SendMessage((this->super_TCreature).Connection,0x14,"Your last visit in Tibia: %s.", + local_ac); + pTVar8 = this->PlayerData; + } + tVar9 = time((time_t *)0x0); + pTVar8->LastLoginTime = tVar9; + } + return; +} + + + +// DWARF original prototype: void ~TPlayer(TPlayer * this, int __in_chrg) + +void __thiscall TPlayer::~TPlayer(TPlayer *this,int __in_chrg) + +{ + ulong *puVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + TCreature *cr; + time_t tVar4; + TCreature *pTVar5; + __pid_t _Var6; + ulong uVar7; + TSkill *pTVar8; + int iVar9; + TPlayerData *pTVar10; + int i; + TCreature *pTVar11; + uint uVar12; + uchar *puVar13; + int *piVar14; + char *pcVar15; + char *in_stack_ffffffd8; + char *pcVar16; + char *local_14; + + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TPlayer_08127c68; + LogoutOrder(this); + if (this->ConstructError != NOERROR) { + DelInList(this); + goto LAB_080aa53c; + } + pTVar10 = this->PlayerData; + tVar4 = time((time_t *)0x0); + pTVar10->LastLogoutTime = tVar4; + SaveData(this); + if ((this->super_TCreature).IsDead == false) { + Log("game","Spieler %s loggt aus.\n",(this->super_TCreature).Name); + pcVar16 = (char *)(this->super_TCreature).posz; + GraphicalEffect(); + SaveInventory(this); + } + else { + pcVar16 = (this->super_TCreature).Name; + pcVar15 = pcVar16; + Log("game","Spieler %s ist gestorben.\n",pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("TPlayer::~TPlayer: PlayerData ist NULL.\n"); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) goto LAB_080aa5d9; + } + else { +LAB_080aa5d9: + if (pTVar10->Inventory != (uchar *)0x0) { + operator_delete__(pTVar10->Inventory); + this->PlayerData->Inventory = (uchar *)0x0; + } + } + if (((this->super_TCreature).Profession == '\0') || + (iVar9 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0]), 5 < iVar9)) { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; + if (pTVar8->Max < 1) goto LAB_080aa7f3; + pTVar10 = this->PlayerData; + pcVar16 = pcVar15; + } + else { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; +LAB_080aa7f3: + if (pTVar8->Max < 1) { + Log("game",&DAT_08103aa0,pcVar16); + } + Log("game",&DAT_08103a60,pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) { + uVar12 = 2000; + aVar2 = (pTVar10->OriginalOutfit).field_1; + (pTVar10->CurrentOutfit).OutfitID = (pTVar10->OriginalOutfit).OutfitID; + (pTVar10->CurrentOutfit).field_1 = aVar2; + this->PlayerData->startx = 0; + this->PlayerData->starty = 0; + this->PlayerData->startz = 0; + this->PlayerData->posx = 0; + this->PlayerData->posy = 0; + this->PlayerData->posz = 0; + this->PlayerData->Profession = 0; + puVar13 = this->PlayerData->SpellList; + for (iVar9 = 0x40; iVar9 != 0; iVar9 = iVar9 + -1) { + puVar13[0] = '\0'; + puVar13[1] = '\0'; + puVar13[2] = '\0'; + puVar13[3] = '\0'; + puVar13 = puVar13 + 4; + } + pTVar10 = this->PlayerData; + piVar14 = pTVar10->QuestValues; + if (((uint)piVar14 & 4) != 0) { + piVar14 = pTVar10->QuestValues + 1; + pTVar10->QuestValues[0] = 0; + uVar12 = 0x7cc; + } + iVar9 = 0; + for (uVar12 = uVar12 >> 2; uVar12 != 0; uVar12 = uVar12 - 1) { + *piVar14 = 0; + piVar14 = piVar14 + 1; + } + do { + this->PlayerData->Minimum[iVar9] = -0x80000000; + iVar9 = iVar9 + 1; + } while (iVar9 < 0x19); + pTVar10 = this->PlayerData; + } + (this->super_TCreature).LoseInventory = 2; + } + if (pTVar10->PlayerkillerEnd != 0) { + (this->super_TCreature).LoseInventory = 2; + } + bVar3 = CheckRight((this->super_TCreature).ID,KEEP_INVENTORY); + if (bVar3) { + (this->super_TCreature).LoseInventory = 0; + } + } + local_14 = (this->super_TCreature).Name; + in_stack_ffffffd8 = (char *)0xe; + bVar3 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + if (bVar3) { + CloseProcessedRequests((this->super_TCreature).ID); + } + if (this->Request != 0) { + if (this->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest(local_14); + } + else { + pTVar5 = GetCreature(this->RequestProcessingGamemaster); + pTVar11 = (TCreature *)0x0; + if ((pTVar5 != (TCreature *)0x0) && (pTVar11 = pTVar5, pTVar5->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar11 = (TCreature *)0x0; + } + if (pTVar11 != (TCreature *)0x0) { + SendFinishRequest(pTVar11->Connection,local_14); + in_stack_ffffffd8 = local_14; + } + } + this->Request = 0; + } + LeaveAllChannels((this->super_TCreature).ID); + if (this->PartyLeavingRound == 0) { + uVar7 = this->PartyLeader; + } + else { + uVar7 = 0; + } + if (uVar7 != 0) { + in_stack_ffffffd8 = (char *)0x1; + ::LeaveParty((this->super_TCreature).ID,true); + } + ClearPlayerkillingMarks(this); + DelInList(this); + this->PlayerData->Dirty = true; + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("DecreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + } + else { + Semaphore::down(&PlayerDataPoolMutex); + piVar14 = &pTVar10->Sticky; + *piVar14 = *piVar14 + -1; + Semaphore::up(&PlayerDataPoolMutex); + } + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; + } + else { + pcVar16 = (char *)pTVar10->CharacterID; + in_stack_ffffffd8 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (pTVar10->Locked == 0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + } + else { + _Var6 = getpid(); + if (pTVar10->Locked == _Var6) { + pTVar10->Locked = 0; + goto LAB_080aa53c; + } + pcVar15 = "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + } + } + error(pcVar15,in_stack_ffffffd8,pcVar16); +LAB_080aa53c: + puVar1 = (this->FormerAttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + puVar1 = (this->AttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + TCreature::~TCreature(&this->super_TCreature,(int)in_stack_ffffffd8); + return; +} + + + +// DWARF original prototype: void ~TPlayer(TPlayer * this, int __in_chrg) + +void __thiscall TPlayer::~TPlayer(TPlayer *this,int __in_chrg) + +{ + ulong *puVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + TCreature *cr; + time_t tVar4; + TCreature *pTVar5; + __pid_t _Var6; + ulong uVar7; + TSkill *pTVar8; + int iVar9; + TPlayerData *pTVar10; + int i; + TCreature *pTVar11; + uint uVar12; + uchar *puVar13; + int *piVar14; + char *pcVar15; + char *in_stack_ffffffd8; + char *pcVar16; + char *local_14; + + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TPlayer_08127c68; + LogoutOrder(this); + if (this->ConstructError != NOERROR) { + DelInList(this); + goto LAB_080aaa0c; + } + pTVar10 = this->PlayerData; + tVar4 = time((time_t *)0x0); + pTVar10->LastLogoutTime = tVar4; + SaveData(this); + if ((this->super_TCreature).IsDead == false) { + Log("game","Spieler %s loggt aus.\n",(this->super_TCreature).Name); + pcVar16 = (char *)(this->super_TCreature).posz; + GraphicalEffect(); + SaveInventory(this); + } + else { + pcVar16 = (this->super_TCreature).Name; + pcVar15 = pcVar16; + Log("game","Spieler %s ist gestorben.\n",pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("TPlayer::~TPlayer: PlayerData ist NULL.\n"); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) goto LAB_080aaaa9; + } + else { +LAB_080aaaa9: + if (pTVar10->Inventory != (uchar *)0x0) { + operator_delete__(pTVar10->Inventory); + this->PlayerData->Inventory = (uchar *)0x0; + } + } + if (((this->super_TCreature).Profession == '\0') || + (iVar9 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0]), 5 < iVar9)) { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; + if (pTVar8->Max < 1) goto LAB_080aacc3; + pTVar10 = this->PlayerData; + pcVar16 = pcVar15; + } + else { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; +LAB_080aacc3: + if (pTVar8->Max < 1) { + Log("game",&DAT_08103aa0,pcVar16); + } + Log("game",&DAT_08103a60,pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) { + uVar12 = 2000; + aVar2 = (pTVar10->OriginalOutfit).field_1; + (pTVar10->CurrentOutfit).OutfitID = (pTVar10->OriginalOutfit).OutfitID; + (pTVar10->CurrentOutfit).field_1 = aVar2; + this->PlayerData->startx = 0; + this->PlayerData->starty = 0; + this->PlayerData->startz = 0; + this->PlayerData->posx = 0; + this->PlayerData->posy = 0; + this->PlayerData->posz = 0; + this->PlayerData->Profession = 0; + puVar13 = this->PlayerData->SpellList; + for (iVar9 = 0x40; iVar9 != 0; iVar9 = iVar9 + -1) { + puVar13[0] = '\0'; + puVar13[1] = '\0'; + puVar13[2] = '\0'; + puVar13[3] = '\0'; + puVar13 = puVar13 + 4; + } + pTVar10 = this->PlayerData; + piVar14 = pTVar10->QuestValues; + if (((uint)piVar14 & 4) != 0) { + piVar14 = pTVar10->QuestValues + 1; + pTVar10->QuestValues[0] = 0; + uVar12 = 0x7cc; + } + iVar9 = 0; + for (uVar12 = uVar12 >> 2; uVar12 != 0; uVar12 = uVar12 - 1) { + *piVar14 = 0; + piVar14 = piVar14 + 1; + } + do { + this->PlayerData->Minimum[iVar9] = -0x80000000; + iVar9 = iVar9 + 1; + } while (iVar9 < 0x19); + pTVar10 = this->PlayerData; + } + (this->super_TCreature).LoseInventory = 2; + } + if (pTVar10->PlayerkillerEnd != 0) { + (this->super_TCreature).LoseInventory = 2; + } + bVar3 = CheckRight((this->super_TCreature).ID,KEEP_INVENTORY); + if (bVar3) { + (this->super_TCreature).LoseInventory = 0; + } + } + local_14 = (this->super_TCreature).Name; + in_stack_ffffffd8 = (char *)0xe; + bVar3 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + if (bVar3) { + CloseProcessedRequests((this->super_TCreature).ID); + } + if (this->Request != 0) { + if (this->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest(local_14); + } + else { + pTVar5 = GetCreature(this->RequestProcessingGamemaster); + pTVar11 = (TCreature *)0x0; + if ((pTVar5 != (TCreature *)0x0) && (pTVar11 = pTVar5, pTVar5->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar11 = (TCreature *)0x0; + } + if (pTVar11 != (TCreature *)0x0) { + SendFinishRequest(pTVar11->Connection,local_14); + in_stack_ffffffd8 = local_14; + } + } + this->Request = 0; + } + LeaveAllChannels((this->super_TCreature).ID); + if (this->PartyLeavingRound == 0) { + uVar7 = this->PartyLeader; + } + else { + uVar7 = 0; + } + if (uVar7 != 0) { + in_stack_ffffffd8 = (char *)0x1; + ::LeaveParty((this->super_TCreature).ID,true); + } + ClearPlayerkillingMarks(this); + DelInList(this); + this->PlayerData->Dirty = true; + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("DecreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + } + else { + Semaphore::down(&PlayerDataPoolMutex); + piVar14 = &pTVar10->Sticky; + *piVar14 = *piVar14 + -1; + Semaphore::up(&PlayerDataPoolMutex); + } + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; + } + else { + pcVar16 = (char *)pTVar10->CharacterID; + in_stack_ffffffd8 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (pTVar10->Locked == 0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + } + else { + _Var6 = getpid(); + if (pTVar10->Locked == _Var6) { + pTVar10->Locked = 0; + goto LAB_080aaa0c; + } + pcVar15 = "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + } + } + error(pcVar15,in_stack_ffffffd8,pcVar16); +LAB_080aaa0c: + puVar1 = (this->FormerAttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + puVar1 = (this->AttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + TCreature::~TCreature(&this->super_TCreature,(int)in_stack_ffffffd8); + return; +} + + + +// DWARF original prototype: void ~TPlayer(TPlayer * this, int __in_chrg) + +void __thiscall TPlayer::~TPlayer(TPlayer *this,int __in_chrg) + +{ + ulong *puVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + TCreature *cr; + time_t tVar4; + TCreature *pTVar5; + __pid_t _Var6; + ulong uVar7; + TSkill *pTVar8; + int iVar9; + TPlayerData *pTVar10; + int i; + TCreature *pTVar11; + uint uVar12; + uchar *puVar13; + int *piVar14; + char *pcVar15; + char *in_stack_ffffffd8; + char *pcVar16; + char *local_14; + + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TPlayer_08127c68; + LogoutOrder(this); + if (this->ConstructError != NOERROR) { + DelInList(this); + goto LAB_080aaedc; + } + pTVar10 = this->PlayerData; + tVar4 = time((time_t *)0x0); + pTVar10->LastLogoutTime = tVar4; + SaveData(this); + if ((this->super_TCreature).IsDead == false) { + Log("game","Spieler %s loggt aus.\n",(this->super_TCreature).Name); + pcVar16 = (char *)(this->super_TCreature).posz; + GraphicalEffect(); + SaveInventory(this); + } + else { + pcVar16 = (this->super_TCreature).Name; + pcVar15 = pcVar16; + Log("game","Spieler %s ist gestorben.\n",pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("TPlayer::~TPlayer: PlayerData ist NULL.\n"); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) goto LAB_080aaf79; + } + else { +LAB_080aaf79: + if (pTVar10->Inventory != (uchar *)0x0) { + operator_delete__(pTVar10->Inventory); + this->PlayerData->Inventory = (uchar *)0x0; + } + } + if (((this->super_TCreature).Profession == '\0') || + (iVar9 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0]), 5 < iVar9)) { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; + if (pTVar8->Max < 1) goto LAB_080ab193; + pTVar10 = this->PlayerData; + pcVar16 = pcVar15; + } + else { + pTVar8 = (this->super_TCreature).super_TSkillBase.Skills[2]; +LAB_080ab193: + if (pTVar8->Max < 1) { + Log("game",&DAT_08103aa0,pcVar16); + } + Log("game",&DAT_08103a60,pcVar16); + pTVar10 = this->PlayerData; + if (pTVar10 != (TPlayerData *)0x0) { + uVar12 = 2000; + aVar2 = (pTVar10->OriginalOutfit).field_1; + (pTVar10->CurrentOutfit).OutfitID = (pTVar10->OriginalOutfit).OutfitID; + (pTVar10->CurrentOutfit).field_1 = aVar2; + this->PlayerData->startx = 0; + this->PlayerData->starty = 0; + this->PlayerData->startz = 0; + this->PlayerData->posx = 0; + this->PlayerData->posy = 0; + this->PlayerData->posz = 0; + this->PlayerData->Profession = 0; + puVar13 = this->PlayerData->SpellList; + for (iVar9 = 0x40; iVar9 != 0; iVar9 = iVar9 + -1) { + puVar13[0] = '\0'; + puVar13[1] = '\0'; + puVar13[2] = '\0'; + puVar13[3] = '\0'; + puVar13 = puVar13 + 4; + } + pTVar10 = this->PlayerData; + piVar14 = pTVar10->QuestValues; + if (((uint)piVar14 & 4) != 0) { + piVar14 = pTVar10->QuestValues + 1; + pTVar10->QuestValues[0] = 0; + uVar12 = 0x7cc; + } + iVar9 = 0; + for (uVar12 = uVar12 >> 2; uVar12 != 0; uVar12 = uVar12 - 1) { + *piVar14 = 0; + piVar14 = piVar14 + 1; + } + do { + this->PlayerData->Minimum[iVar9] = -0x80000000; + iVar9 = iVar9 + 1; + } while (iVar9 < 0x19); + pTVar10 = this->PlayerData; + } + (this->super_TCreature).LoseInventory = 2; + } + if (pTVar10->PlayerkillerEnd != 0) { + (this->super_TCreature).LoseInventory = 2; + } + bVar3 = CheckRight((this->super_TCreature).ID,KEEP_INVENTORY); + if (bVar3) { + (this->super_TCreature).LoseInventory = 0; + } + } + local_14 = (this->super_TCreature).Name; + in_stack_ffffffd8 = (char *)0xe; + bVar3 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + if (bVar3) { + CloseProcessedRequests((this->super_TCreature).ID); + } + if (this->Request != 0) { + if (this->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest(local_14); + } + else { + pTVar5 = GetCreature(this->RequestProcessingGamemaster); + pTVar11 = (TCreature *)0x0; + if ((pTVar5 != (TCreature *)0x0) && (pTVar11 = pTVar5, pTVar5->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar11 = (TCreature *)0x0; + } + if (pTVar11 != (TCreature *)0x0) { + SendFinishRequest(pTVar11->Connection,local_14); + in_stack_ffffffd8 = local_14; + } + } + this->Request = 0; + } + LeaveAllChannels((this->super_TCreature).ID); + if (this->PartyLeavingRound == 0) { + uVar7 = this->PartyLeader; + } + else { + uVar7 = 0; + } + if (uVar7 != 0) { + in_stack_ffffffd8 = (char *)0x1; + ::LeaveParty((this->super_TCreature).ID,true); + } + ClearPlayerkillingMarks(this); + DelInList(this); + this->PlayerData->Dirty = true; + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + error("DecreasePlayerPoolSlotSticky: Slot ist NULL.\n"); + } + else { + Semaphore::down(&PlayerDataPoolMutex); + piVar14 = &pTVar10->Sticky; + *piVar14 = *piVar14 + -1; + Semaphore::up(&PlayerDataPoolMutex); + } + pTVar10 = this->PlayerData; + if (pTVar10 == (TPlayerData *)0x0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist NULL.\n"; + } + else { + pcVar16 = (char *)pTVar10->CharacterID; + in_stack_ffffffd8 = "Gebe Slot von Spieler %ld frei.\n"; + print(); + if (pTVar10->Locked == 0) { + pcVar15 = "ReleasePlayerPoolSlot: Slot ist nicht gesperrt.\n"; + } + else { + _Var6 = getpid(); + if (pTVar10->Locked == _Var6) { + pTVar10->Locked = 0; + goto LAB_080aaedc; + } + pcVar15 = "ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"; + } + } + error(pcVar15,in_stack_ffffffd8,pcVar16); +LAB_080aaedc: + puVar1 = (this->FormerAttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + puVar1 = (this->AttackedPlayers).entry; + if (puVar1 != (ulong *)0x0) { + operator_delete__(puVar1); + } + TCreature::~TCreature(&this->super_TCreature,(int)in_stack_ffffffd8); + operator_delete(this); + return; +} + + + +// DWARF original prototype: void SetInList(TPlayer * this) + +void __thiscall TPlayer::SetInList(TPlayer *this) + +{ + TPlayer **ppTVar1; + + TCreature::SetInCrList(&this->super_TCreature); + Semaphore::down(&PlayerMutex); + ppTVar1 = vector::operator()(&PlayerList,FirstFreePlayer); + FirstFreePlayer = FirstFreePlayer + 1; + *ppTVar1 = this; + Semaphore::up(&PlayerMutex); + NotifyBuddies((this->super_TCreature).ID,(this->super_TCreature).Name,true); + IncrementPlayersOnline(); + if ((this->super_TCreature).Profession != '\0') { + return; + } + IncrementNewbiesOnline(); + return; +} + + + +// DWARF original prototype: void DelInList(TPlayer * this) + +void __thiscall TPlayer::DelInList(TPlayer *this) + +{ + TPlayer **ppTVar1; + TPlayer **ppTVar2; + int i; + int i_00; + + i_00 = 0; + NotifyBuddies((this->super_TCreature).ID,(this->super_TCreature).Name,false); + if (0 < FirstFreePlayer) { + do { + ppTVar1 = vector::operator()(&PlayerList,i_00); + if (*ppTVar1 == this) { + Semaphore::down(&PlayerMutex); + ppTVar1 = vector::operator()(&PlayerList,i_00); + ppTVar2 = vector::operator()(&PlayerList,FirstFreePlayer + -1); + *ppTVar1 = *ppTVar2; + ppTVar1 = vector::operator()(&PlayerList,FirstFreePlayer + -1); + *ppTVar1 = (TPlayer *)0x0; + FirstFreePlayer = FirstFreePlayer + -1; + Semaphore::up(&PlayerMutex); + DecrementPlayersOnline(); + if ((this->super_TCreature).Profession != '\0') { + return; + } + DecrementNewbiesOnline(); + return; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreePlayer); + } + return; +} + + + +// DWARF original prototype: void ClearConnection(TPlayer * this) + +void __thiscall TPlayer::ClearConnection(TPlayer *this) + +{ + int GamemasterID; + TCreature *pTVar1; + TCreature *pTVar2; + + (this->super_TCreature).Connection = (TConnection *)0x0; + if (this->Request != 0) { + if (this->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest((this->super_TCreature).Name); + } + else { + pTVar1 = GetCreature(this->RequestProcessingGamemaster); + pTVar2 = (TCreature *)0x0; + if ((pTVar1 != (TCreature *)0x0) && (pTVar2 = pTVar1, pTVar1->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar2 = (TCreature *)0x0; + } + if (pTVar2 != (TCreature *)0x0) { + SendFinishRequest(pTVar2->Connection,(this->super_TCreature).Name); + } + } + this->Request = 0; + } + return; +} + + + +// DWARF original prototype: void LoadData(TPlayer * this) + +void __thiscall TPlayer::LoadData(TPlayer *this) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + uint uVar2; + int iVar3; + TPlayerData *pTVar4; + uchar *puVar5; + int *piVar6; + int SkillNr; + uchar *puVar7; + int *piVar8; + + pTVar4 = this->PlayerData; + if (pTVar4 != (TPlayerData *)0x0) { + (this->super_TCreature).Race = pTVar4->Race; + aVar1 = (pTVar4->OriginalOutfit).field_1; + (this->super_TCreature).OrgOutfit.OutfitID = (pTVar4->OriginalOutfit).OutfitID; + (this->super_TCreature).OrgOutfit.field_1 = aVar1; + GetStartPosition(&(this->super_TCreature).startx,&(this->super_TCreature).starty, + &(this->super_TCreature).startz,true); + (this->super_TCreature).posx = (this->super_TCreature).startx; + (this->super_TCreature).posy = (this->super_TCreature).starty; + (this->super_TCreature).posz = (this->super_TCreature).startz; + (this->super_TCreature).Direction = 2; + TSkillBase::SetSkills + (&(this->super_TCreature).super_TSkillBase,(this->super_TCreature).Race); + pTVar4 = this->PlayerData; + aVar1 = (pTVar4->CurrentOutfit).field_1; + (this->super_TCreature).Outfit.OutfitID = (pTVar4->CurrentOutfit).OutfitID; + (this->super_TCreature).Outfit.field_1 = aVar1; + if (pTVar4->startx != 0) { + (this->super_TCreature).startx = pTVar4->startx; + (this->super_TCreature).starty = pTVar4->starty; + (this->super_TCreature).startz = pTVar4->startz; + } + if (pTVar4->posx != 0) { + (this->super_TCreature).posx = pTVar4->posx; + (this->super_TCreature).posy = pTVar4->posy; + (this->super_TCreature).posz = pTVar4->posz; + } + uVar2 = 2000; + (this->super_TCreature).Profession = (uchar)pTVar4->Profession; + puVar5 = pTVar4->SpellList; + puVar7 = this->SpellList; + for (iVar3 = 0x40; iVar3 != 0; iVar3 = iVar3 + -1) { + *(undefined4 *)puVar7 = *(undefined4 *)puVar5; + puVar5 = puVar5 + 4; + puVar7 = puVar7 + 4; + } + piVar8 = this->QuestValues; + pTVar4 = this->PlayerData; + piVar6 = pTVar4->QuestValues; + if (((uint)piVar8 & 4) != 0) { + piVar8 = this->QuestValues + 1; + piVar6 = pTVar4->QuestValues + 1; + this->QuestValues[0] = pTVar4->QuestValues[0]; + uVar2 = 0x7cc; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + *piVar8 = *piVar6; + piVar6 = piVar6 + 1; + piVar8 = piVar8 + 1; + } + pTVar4 = this->PlayerData; + iVar3 = 0; + do { + if (pTVar4->Minimum[iVar3] != -0x80000000) { + TSkill::Load((this->super_TCreature).super_TSkillBase.Skills[iVar3]); + pTVar4 = this->PlayerData; + } + iVar3 = iVar3 + 1; + } while (iVar3 < 0x19); + (this->super_TCreature).EarliestYellRound = pTVar4->EarliestYellRound; + (this->super_TCreature).EarliestTradeChannelRound = pTVar4->EarliestTradeChannelRound; + (this->super_TCreature).EarliestSpellTime = pTVar4->EarliestSpellTime; + (this->super_TCreature).EarliestMultiuseTime = pTVar4->EarliestMultiuseTime; + this->TalkBufferFullTime = pTVar4->TalkBufferFullTime; + this->MutingEndRound = pTVar4->MutingEndRound; + this->NumberOfMutings = pTVar4->NumberOfMutings; + return; + } + error("TPlayer::LoadData: PlayerData ist NULL.\n"); + return; +} + + + +// DWARF original prototype: void SaveData(TPlayer * this) + +void __thiscall TPlayer::SaveData(TPlayer *this) + +{ + TPlayerData *pTVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + uint uVar3; + int iVar4; + int SkillNr; + uchar *puVar5; + int *piVar6; + uchar *puVar7; + int *piVar8; + + pTVar1 = this->PlayerData; + if (pTVar1 != (TPlayerData *)0x0) { + aVar2 = (this->super_TCreature).OrgOutfit.field_1; + (pTVar1->OriginalOutfit).OutfitID = (this->super_TCreature).OrgOutfit.OutfitID; + (pTVar1->OriginalOutfit).field_1 = aVar2; + pTVar1 = this->PlayerData; + aVar2 = (this->super_TCreature).Outfit.field_1; + (pTVar1->CurrentOutfit).OutfitID = (this->super_TCreature).Outfit.OutfitID; + (pTVar1->CurrentOutfit).field_1 = aVar2; + this->PlayerData->startx = (this->super_TCreature).startx; + this->PlayerData->starty = (this->super_TCreature).starty; + this->PlayerData->startz = (this->super_TCreature).startz; + this->PlayerData->posx = (this->super_TCreature).posx; + this->PlayerData->posy = (this->super_TCreature).posy; + this->PlayerData->posz = (this->super_TCreature).posz; + uVar3 = 2000; + this->PlayerData->Profession = (uint)(this->super_TCreature).Profession; + puVar5 = this->SpellList; + puVar7 = this->PlayerData->SpellList; + for (iVar4 = 0x40; iVar4 != 0; iVar4 = iVar4 + -1) { + *(undefined4 *)puVar7 = *(undefined4 *)puVar5; + puVar5 = puVar5 + 4; + puVar7 = puVar7 + 4; + } + piVar6 = this->QuestValues; + pTVar1 = this->PlayerData; + piVar8 = pTVar1->QuestValues; + if (((uint)piVar8 & 4) != 0) { + piVar8 = pTVar1->QuestValues + 1; + piVar6 = this->QuestValues + 1; + pTVar1->QuestValues[0] = this->QuestValues[0]; + uVar3 = 0x7cc; + } + for (uVar3 = uVar3 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) { + *piVar8 = *piVar6; + piVar6 = piVar6 + 1; + piVar8 = piVar8 + 1; + } + iVar4 = 0; + do { + if ((this->super_TCreature).super_TSkillBase.Skills[iVar4] == (TSkill *)0x0) { + this->PlayerData->Minimum[iVar4] = -0x80000000; + } + else { + TSkill::Save((this->super_TCreature).super_TSkillBase.Skills[iVar4]); + } + iVar4 = iVar4 + 1; + } while (iVar4 < 0x19); + this->PlayerData->EarliestYellRound = (this->super_TCreature).EarliestYellRound; + this->PlayerData->EarliestTradeChannelRound = + (this->super_TCreature).EarliestTradeChannelRound; + this->PlayerData->EarliestSpellTime = (this->super_TCreature).EarliestSpellTime; + this->PlayerData->EarliestMultiuseTime = (this->super_TCreature).EarliestMultiuseTime; + this->PlayerData->TalkBufferFullTime = this->TalkBufferFullTime; + this->PlayerData->MutingEndRound = this->MutingEndRound; + this->PlayerData->NumberOfMutings = this->NumberOfMutings; + return; + } + error("TPlayer::SaveData: PlayerData ist NULL.\n"); + return; +} + + + +// DWARF original prototype: void LoadInventory(TPlayer * this, bool SetStandardInventory) + +void __thiscall TPlayer::LoadInventory(TPlayer *this,bool SetStandardInventory) + +{ + TPlayerData *pTVar1; + bool bVar2; + byte bVar3; + RESULT r; + int Position; + undefined1 local_5c [4]; + TReadBuffer Buffer; + Object Con; + Object local_3c [4]; + Object local_2c [7]; + + pTVar1 = this->PlayerData; + if (pTVar1 == (TPlayerData *)0x0) { + error("TPlayer::LoadInventory: PlayerData ist NULL.\n"); + } + else if (pTVar1->Inventory == (uchar *)0x0) { + if ((this->super_TCreature).Profession == '\0') { + bVar2 = CheckRight((this->super_TCreature).ID,ZERO_CAPACITY); + if ((!bVar2) && (SetStandardInventory)) { + // try { // try from 080abb37 to 080abca5 has its CatchHandler @ 080abd71 + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)&Buffer.Position,(this->super_TCreature).ID); + Create(local_2c,(ObjectType *)&Buffer.Position,(ulong)local_3c); + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)local_2c,(this->super_TCreature).ID); + Create((Object *)&Buffer.Position,(ObjectType *)local_2c,(ulong)local_3c); + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)local_2c,(this->super_TCreature).ID); + Create((Object *)&Buffer.Position,(ObjectType *)local_2c,(ulong)local_3c); + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)local_2c,(this->super_TCreature).ID); + Create((Object *)&Buffer.Position,(ObjectType *)local_2c,(ulong)local_3c); + GetSpecialObject((SPECIALMEANING)local_2c); + local_5c = (undefined1 [4])Buffer.Position; + Create(local_3c,(ObjectType *)local_5c,(ulong)local_2c); + } + } + } + else { + // try { // try from 080abcca to 080abd5a has its CatchHandler @ 080abdb0 + TReadBuffer::TReadBuffer((TReadBuffer *)local_5c,pTVar1->Inventory,pTVar1->InventorySize); + while( true ) { + bVar3 = TReadBuffer::readByte((TReadBuffer *)local_5c); + if (bVar3 == 0xff) break; + GetBodyContainer((ulong)&Buffer.Position,(this->super_TCreature).ID); + LoadObjects((TReadStream *)local_5c,(Object *)&Buffer.Position); + GetBodyObject((ulong)&Buffer.Position,(this->super_TCreature).ID); + local_3c[0] = (Object)::NONE.ObjectID; + local_2c[0].ObjectID = local_3c[0].ObjectID; + if (Buffer.Position != ::NONE.ObjectID) { + local_2c[0].ObjectID = Buffer.Position; + SendSetInventory((this->super_TCreature).Connection,(uint)bVar3,local_2c); + } + } + } + return; +} + + + +// DWARF original prototype: void SaveInventory(TPlayer * this) + +void __thiscall TPlayer::SaveInventory(TPlayer *this) + +{ + bool bVar1; + TPlayerData *pTVar2; + uchar *puVar3; + int con; + int iVar4; + TDynamicWriteBuffer *Position; + Object local_4c [4]; + undefined1 local_3c [4]; + TDynamicWriteBuffer HelpBuffer; + Object Obj; + + pTVar2 = this->PlayerData; + if (pTVar2 == (TPlayerData *)0x0) { + error("TPlayer::SaveInventory: PlayerData ist NULL.\n"); + } + else { + if (pTVar2->Inventory != (uchar *)0x0) { + operator_delete__(pTVar2->Inventory); + this->PlayerData->Inventory = (uchar *)0x0; + pTVar2 = this->PlayerData; + } + pTVar2->InventorySize = 0; + HelpBuffer.super_TWriteBuffer.Position = (this->super_TCreature).CrObject.ObjectID; + local_3c = (undefined1 [4])::NONE.ObjectID; + if (HelpBuffer.super_TWriteBuffer.Position != ::NONE.ObjectID) { + // try { // try from 080abe5b to 080abe5f has its CatchHandler @ 080abfb1 + TDynamicWriteBuffer::TDynamicWriteBuffer((TDynamicWriteBuffer *)local_3c,0x4000); + iVar4 = 1; + do { + Position = (TDynamicWriteBuffer *)(this->super_TCreature).ID; + // try { // try from 080abe79 to 080abecf has its CatchHandler @ 080abf72 + GetBodyObject((ulong)&HelpBuffer.super_TWriteBuffer.Position,(int)Position); + bVar1 = Object::exists((Object *)&HelpBuffer.super_TWriteBuffer.Position); + if (bVar1) { + // try { // try from 080abf14 to 080abf35 has its CatchHandler @ 080abf72 + TDynamicWriteBuffer::writeByte((TDynamicWriteBuffer *)local_3c,(uchar)iVar4); + local_4c[0].ObjectID = HelpBuffer.super_TWriteBuffer.Position; + Position = (TDynamicWriteBuffer *)local_3c; + SaveObjects(local_4c,(TWriteStream *)local_3c,false); + } + iVar4 = iVar4 + 1; + } while (iVar4 < 0xb); + if (HelpBuffer.super_TWriteBuffer.Size != 0) { + TDynamicWriteBuffer::writeByte((TDynamicWriteBuffer *)local_3c,0xff); + this->PlayerData->InventorySize = HelpBuffer.super_TWriteBuffer.Size; + pTVar2 = this->PlayerData; + puVar3 = (uchar *)operator_new__(pTVar2->InventorySize); + pTVar2->Inventory = puVar3; + memcpy(this->PlayerData->Inventory, + HelpBuffer.super_TWriteBuffer.super_TWriteStream._vptr_TWriteStream, + this->PlayerData->InventorySize); + Position = (TDynamicWriteBuffer *) + HelpBuffer.super_TWriteBuffer.super_TWriteStream._vptr_TWriteStream; + } + // try { // try from 080abefe to 080abf02 has its CatchHandler @ 080abfb1 + TDynamicWriteBuffer::~TDynamicWriteBuffer((TDynamicWriteBuffer *)local_3c,(int)Position) + ; + } + } + return; +} + + + +// DWARF original prototype: void StartCoordinates(TPlayer * this) + +void __thiscall TPlayer::StartCoordinates(TPlayer *this) + +{ + GetStartPosition(&(this->super_TCreature).startx,&(this->super_TCreature).starty, + &(this->super_TCreature).startz,true); + return; +} + + + +// DWARF original prototype: void TakeOver(TPlayer * this, TConnection * Connection) + +void __thiscall TPlayer::TakeOver(TPlayer *this,TConnection *Connection) + +{ + char *__dest; + Object OVar1; + bool bVar2; + TCreature *cr; + TPlayerData *pTVar3; + __pid_t _Var4; + char *__src; + TCreature *pTVar5; + TPlayer *pTVar6; + TCreature *pTVar7; + ulong extraout_EDX; + ulong id; + ulong extraout_EDX_00; + TPlayerData *PlayerData; + Object *pOVar8; + uint Window; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + + __dest = (this->super_TCreature).Name; + Log("game",&DAT_08103d40,__dest); + (this->super_TCreature).LoggingOut = false; + (this->super_TCreature).LogoutAllowed = false; + (this->super_TCreature).Connection = Connection; + TConnection::EnterGame(Connection); + pTVar3 = GetPlayerPoolSlot((this->super_TCreature).ID); + if (pTVar3 == (TPlayerData *)0x0) { + error("TPlayer::TakeOver: PlayerData-Slot nicht gefunden.\n"); + } + else { + _Var4 = getpid(); + if (pTVar3->Locked != _Var4) { + error("TPlayer::TakeOver: PlayerData-Slot ist nicht korrekt gesperrt (%d).\n", + pTVar3->Locked); + } + if (pTVar3->Sticky < 2) { + error("TPlayer::TakeOver: Falscher Sticky-Wert %d.\n",pTVar3->Sticky); + } + else { + Semaphore::down(&PlayerDataPoolMutex); + pTVar3->Sticky = pTVar3->Sticky + -1; + Semaphore::up(&PlayerDataPoolMutex); + } + strcpy(__dest,pTVar3->Name); + InsertPlayerIndex(&PlayerIndexHead,0,__dest,(this->super_TCreature).ID); + __src = TConnection::GetIPAddress(Connection); + strcpy(this->IPAddress,__src); + *(undefined4 *)this->Rights = *(undefined4 *)pTVar3->Rights; + *(undefined4 *)(this->Rights + 4) = *(undefined4 *)(pTVar3->Rights + 4); + *(undefined4 *)(this->Rights + 8) = *(undefined4 *)(pTVar3->Rights + 8); + (this->super_TCreature).Sex = pTVar3->Sex; + strcpy(this->Guild,pTVar3->Guild); + strcpy(this->Rank,pTVar3->Rank); + pOVar8 = this->OpenContainer; + strcpy(this->Title,pTVar3->Title); + CheckOutfit(this); + Window = 0; + do { + if (Window < 0x10) { + local_2c = pOVar8->ObjectID; + } + else { + error(&DAT_08103de0); + local_2c = ::NONE.ObjectID; + } + local_3c = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if (local_2c != ::NONE.ObjectID) { + SetOpenContainer(this,Window,local_4c); + SendCloseContainer((this->super_TCreature).Connection,Window); + } + Window = Window + 1; + pOVar8 = pOVar8 + 1; + } while ((int)Window < 0x10); + TCombat::StopAttack(&(this->super_TCreature).Combat,0); + LeaveAllChannels((this->super_TCreature).ID); + if (this->Request != 0) { + if (this->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest(__dest); + } + else { + pTVar5 = GetCreature(this->RequestProcessingGamemaster); + pTVar7 = (TCreature *)0x0; + if ((pTVar5 != (TCreature *)0x0) && (pTVar7 = pTVar5, pTVar5->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar7 = (TCreature *)0x0; + } + if (pTVar7 != (TCreature *)0x0) { + SendFinishRequest(pTVar7->Connection,__dest); + } + } + this->Request = 0; + } + this->RequestTimestamp = 0; + this->RequestProcessingGamemaster = 0; + local_4c[0] = ::NONE; + if ((this->TradeObject).ObjectID != ::NONE.ObjectID) { + local_3c = ::NONE.ObjectID; + (this->TradeObject).ObjectID = ::NONE.ObjectID; + pTVar6 = GetPlayer(this->TradePartner); + OVar1 = ::NONE; + if (pTVar6 != (TPlayer *)0x0) { + local_4c[0] = (Object)::NONE.ObjectID; + bVar2 = false; + if (((pTVar6->TradeObject).ObjectID != ::NONE.ObjectID) && + (pTVar6->TradePartner == (this->super_TCreature).ID)) { + bVar2 = true; + } + local_3c = local_4c[0].ObjectID; + if (bVar2) { + local_2c = ::NONE.ObjectID; + (pTVar6->TradeObject).ObjectID = ::NONE.ObjectID; + local_3c = OVar1.ObjectID; + SendCloseTrade((pTVar6->super_TCreature).Connection); + SendMessage((pTVar6->super_TCreature).Connection,0x17,"Trade cancelled."); + } + } + } + bVar2 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + id = extraout_EDX; + if (bVar2) { + CloseProcessedRequests((this->super_TCreature).ID); + id = extraout_EDX_00; + } + SendInitGame((TConnection *)(this->super_TCreature).ID,id); + SendRights((this->super_TCreature).Connection); + SendFullScreen((this->super_TCreature).Connection); + SendBodyInventory((this->super_TCreature).Connection,(this->super_TCreature).ID); + SendAmbiente((this->super_TCreature).Connection); + SendPlayerData((this->super_TCreature).Connection); + SendPlayerSkills((this->super_TCreature).Connection); + this->OldState = 0; + CheckState(this); + SendBuddies(this); + } + return; +} + + + +// DWARF original prototype: void Death(TPlayer * this) + +void __thiscall TPlayer::Death(TPlayer *this) + +{ + TConnection *Connection; + TSkill *pTVar1; + bool bVar2; + int iVar3; + undefined4 uVar4; + TSkill *sk; + uint uVar5; + int Percent; + int iVar6; + + bVar2 = CheckRight((this->super_TCreature).ID,INVULNERABLE); + if (bVar2) { + error("TPlayer::Death: Aha, so geht das aber nicht!! Goetter kann man nicht toeten!!\n"); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[2]; + (*pTVar1->_vptr_TSkill[2])((this->super_TCreature).super_TSkillBase.Skills[2],pTVar1->Max); + } + else { + Connection = (this->super_TCreature).Connection; + if (Connection != (TConnection *)0x0) { + SendPlayerData(Connection); + SendMessage((this->super_TCreature).Connection,0x13,"You are dead.\n"); + TConnection::Die((this->super_TCreature).Connection); + } + TCreature::Death(&this->super_TCreature); + if (WorldType == PVP_ENFORCED) { + TCombat::DistributeExperiencePoints + (&(this->super_TCreature).Combat, + (this->super_TCreature).super_TSkillBase.Skills[0]->Exp / 0x14); + } + bVar2 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar2) { + bVar2 = 9 < (this->super_TCreature).Profession; + } + else { + bVar2 = false; + } + uVar5 = 0x65; + iVar6 = (uint)!bVar2 * 3 + 7; + do { + if (uVar5 < 500) { + print(); + iVar3 = this->QuestValues[uVar5]; + } + else { + error(&DAT_08103ea0); + iVar3 = 0; + } + if (iVar3 != 0) { + iVar6 = iVar6 + -1; + if (uVar5 < 500) { + print(); + this->QuestValues[uVar5] = 0; + } + else { + error(&DAT_08103ee0); + } + } + uVar5 = uVar5 + 1; + } while ((int)uVar5 < 0x6a); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[8]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[10]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[9]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[7]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0xb]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[6]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[1]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0xd]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0]; + uVar4 = __divdi3((longlong)pTVar1->Exp * (longlong)iVar6,100,0); + (*pTVar1->_vptr_TSkill[4])(pTVar1,uVar4); + } + return; +} + + + +// DWARF original prototype: void AttackStimulus(TPlayer * this, ulong param_1) + +void __thiscall TPlayer::AttackStimulus(TPlayer *this,ulong param_1) + +{ + if ((this->super_TCreature).IsDead == false) { + TCreature::BlockLogout(&this->super_TCreature,0x3c,false); + } + return; +} + + + +// DWARF original prototype: void DamageStimulus(TPlayer * this, ulong param_1, int param_2, int +// param_3) + +void __thiscall TPlayer::DamageStimulus(TPlayer *this,ulong param_1,int param_2,int param_3) + +{ + if ((this->super_TCreature).IsDead != false) { + return; + } + TCreature::BlockLogout(&this->super_TCreature,0x3c,false); + return; +} + + + +// DWARF original prototype: void IdleStimulus(TPlayer * this) + +void __thiscall TPlayer::IdleStimulus(TPlayer *this) + +{ + RESULT r; + + if ((this->super_TCreature).Combat.AttackDest != 0) { + // try { // try from 080ac866 to 080ac872 has its CatchHandler @ 080ac875 + TCreature::ToDoAttack(&this->super_TCreature); + TCreature::ToDoStart(&this->super_TCreature); + } + return; +} + + + +// DWARF original prototype: void SetOpenContainer(TPlayer * this, int Window, Object * Con) + +void __thiscall TPlayer::SetOpenContainer(TPlayer *this,int Window,Object *Con) + +{ + bool bVar1; + bool bVar2; + char *Text; + Object local_3c [4]; + ulong local_2c; + + if (0xf < (uint)Window) { + Text = &DAT_08104040; + goto LAB_080ac947; + } + bVar1 = false; + local_2c = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (Con->ObjectID != ::NONE.ObjectID) { + bVar2 = Object::exists(Con); + if (bVar2) { + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar2) goto LAB_080ac914; + } + bVar1 = true; + } +LAB_080ac914: + if (!bVar1) { + this->OpenContainer[Window].ObjectID = Con->ObjectID; + return; + } + Text = "TPlayer::SetOpenContainer: Container existiert nicht.\n"; +LAB_080ac947: + error(Text); + return; +} + + + +// DWARF original prototype: Object GetOpenContainer(TPlayer * this, int Window) + +Object __thiscall TPlayer::GetOpenContainer(TPlayer *this,int Window) + +{ + Object OVar1; + uint in_stack_0000000c; + + if (in_stack_0000000c < 0x10) { + OVar1.ObjectID = (ulong)*(_func_int_varargs ***)(Window + 0xca0 + in_stack_0000000c * 4); + } + else { + error(&DAT_08103de0); + OVar1 = ::NONE; + } + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)OVar1.ObjectID; + return (Object)(ulong)this; +} + + + +// DWARF original prototype: void CloseAllContainers(TPlayer * this) + +void __thiscall TPlayer::CloseAllContainers(TPlayer *this) + +{ + Object *pOVar1; + int i; + uint Window; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + + pOVar1 = this->OpenContainer; + Window = 0; + do { + if (Window < 0x10) { + local_2c = pOVar1->ObjectID; + } + else { + error(&DAT_08103de0); + local_2c = ::NONE.ObjectID; + } + local_3c = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if (local_2c != ::NONE.ObjectID) { + SetOpenContainer(this,Window,local_4c); + SendCloseContainer((this->super_TCreature).Connection,Window); + } + Window = Window + 1; + pOVar1 = pOVar1 + 1; + } while ((int)Window < 0x10); + return; +} + + + +// DWARF original prototype: Object InspectTrade(TPlayer * this, bool OwnOffer, int Position) + +Object __thiscall TPlayer::InspectTrade(TPlayer *this,bool OwnOffer,int Position) + +{ + TSkill *pTVar1; + bool bVar2; + TCreature *cr; + TCreature *pTVar3; + int iVar4; + TCreature *pTVar5; + undefined3 in_stack_00000009; + int in_stack_00000010; + Object local_4c [4]; + Object local_3c [4]; + TSkill *local_2c; + Object Obj; + + if (*(TSkill **)(_OwnOffer + 0x3b0) == (TSkill *)::NONE.ObjectID) { +LAB_080acaaf: + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)::NONE.ObjectID; + return (Object)(ulong)this; + } + local_2c = (TSkill *)0x0; + pTVar1 = *(TSkill **)(_OwnOffer + 0x3b0); + if ((char)Position == '\0') { + if (*(ulong *)(_OwnOffer + 0x3b4) == 0) goto LAB_080acaaf; + pTVar3 = GetCreature(*(ulong *)(_OwnOffer + 0x3b4)); + pTVar5 = (TCreature *)0x0; + if ((pTVar3 != (TCreature *)0x0) && (pTVar5 = pTVar3, pTVar3->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar5 = (TCreature *)0x0; + } + local_2c = (TSkill *)::NONE.ObjectID; + if (pTVar5 == (TCreature *)0x0) goto LAB_080acb9b; + bVar2 = false; + pTVar1 = pTVar5[1].super_TSkillBase.TimerList[0xb]; + if ((pTVar1 == (TSkill *)::NONE.ObjectID) || + (pTVar5[1].super_TSkillBase.TimerList[0xc] != *(TSkill **)(_OwnOffer + 0x208))) { + bVar2 = true; + } + if (bVar2) goto LAB_080acaaf; + } + while( true ) { + local_2c = pTVar1; + bVar2 = false; + if ((local_2c != (TSkill *)::NONE.ObjectID) && (0 < in_stack_00000010)) { + bVar2 = true; + } + if (!bVar2) break; + local_4c[0].ObjectID = (ulong)local_2c; + local_3c[0].ObjectID = ::NONE.ObjectID; + iVar4 = CountObjects(local_4c); + if (in_stack_00000010 < iVar4) { + in_stack_00000010 = in_stack_00000010 + -1; + GetFirstContainerObject(local_3c); + } + else { + in_stack_00000010 = in_stack_00000010 - iVar4; + Object::getNextObject(local_3c); + } + pTVar1 = (TSkill *)local_3c[0].ObjectID; + } +LAB_080acb9b: + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)local_2c; + return (Object)(ulong)this; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void AcceptTrade(TPlayer * this) + +void __thiscall TPlayer::AcceptTrade(TPlayer *this) + +{ + Object *Obj_00; + TPlayer *pTVar1; + TSkill *this_00; + bool bVar2; + bool bVar3; + TCreature *cr; + TCreature *pTVar4; + int iVar5; + int iVar6; + ulong uVar7; + int iVar8; + undefined4 *puVar9; + ulong uVar10; + RESULT r; + int NewWeight; + bool bVar11; + int Step; + bool local_bd; + bool invert; + int iStack_bc; + bool first; + int pos; + TSkill *sk; + int p; + TPlayer *Player [2]; + Object local_8c; + ObjectType Type0; + Object local_7c; + ObjectType Type1; + Object local_6c [4]; + Object local_5c; + Object Help; + Object local_4c [4]; + ulong local_3c; + Object Con [2]; + Object Obj [2]; + + if ((this->TradeObject).ObjectID != ::NONE.ObjectID) { + pTVar4 = GetCreature(this->TradePartner); + p = 0; + if ((pTVar4 != (TCreature *)0x0) && (p = (int)pTVar4, pTVar4->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + p = 0; + } + if (p != 0) { + bVar2 = false; + if ((*(ulong *)(p + 0x3b0) == ::NONE.ObjectID) || + (*(ulong *)(p + 0x3b4) != (this->super_TCreature).ID)) { + bVar2 = true; + } + if ((!bVar2) && (this->TradeAccepted = true, *(char *)(p + 0x3b8) != '\0')) { + pTVar1 = (TPlayer *)(this->TradeObject).ObjectID; + sk = (TSkill *)0x0; + Player[0] = (TPlayer *)p; + Obj[0].ObjectID = *(ulong *)(p + 0x3b0); + local_3c = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + Con[0] = ::NONE; + local_5c.ObjectID = ::NONE.ObjectID; + do { + local_5c.ObjectID = Obj[(int)((int)&sk[-1].AddLevel + 3)].ObjectID; + // try { // try from 080acd0a to 080ace9d has its CatchHandler @ 080ad450 + bVar2 = ObjectAccessible((Player[(int)((int)&sk[-1].AddLevel + 3)]-> + super_TCreature).ID,&local_5c,1); + if (!bVar2) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 1; + goto LAB_080acf89; + } + Object::getObjectType(&local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_5c,UNMOVE); + if (bVar2) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 2; + goto LAB_080acf89; + } + Object::getObjectType(&local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_5c,TAKE); + if (!bVar2) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 3; + goto LAB_080acf89; + } + iVar8 = -(int)sk; + bVar2 = CheckRight((Player[iVar8]->super_TCreature).ID,ZERO_CAPACITY); + if (bVar2) { +LAB_080ad379: + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 8; +LAB_080acf89: + // WARNING: Subroutine does not return + // try { // try from 080acf9c to 080acfa0 has its CatchHandler @ 080ad450 + __cxa_throw(puVar9,&RESULT::typeinfo,0); + } + bVar2 = CheckRight((Player[iVar8]->super_TCreature).ID,UNLIMITED_CAPACITY); + if (!bVar2) { + this_00 = (Player[iVar8]->super_TCreature).super_TSkillBase.Skills[5]; + if (this_00 == (TSkill *)0x0) { + error("TPlayer::AcceptTrade: Skill CARRYSTRENGTH existiert nicht.\n"); + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0xffffffff; + goto LAB_080acf89; + } + iVar5 = GetInventoryWeight((Player[iVar8]->super_TCreature).ID); + local_5c.ObjectID = Obj[(int)((int)&sk[-1].AddLevel + 3)].ObjectID; + iVar6 = GetCompleteWeight(&local_5c); + iVar5 = iVar5 + iVar6; + local_5c.ObjectID = Obj[iVar8].ObjectID; + uVar7 = GetObjectCreatureID(&local_5c); + if (uVar7 == (Player[iVar8]->super_TCreature).ID) { + local_4c[0].ObjectID = Obj[iVar8].ObjectID; + // try { // try from 080ad3a1 to 080ad3b8 has its CatchHandler @ 080ad450 + iVar8 = GetCompleteWeight(local_4c); + iVar5 = iVar5 - iVar8; + } + iVar8 = TSkill::Get(this_00); + if (iVar8 * 100 < iVar5) goto LAB_080ad379; + } + local_bd = true; + iStack_bc = 0; + Object::getObjectType(&local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)&local_5c,MOVEMENTEVENT); + while( true ) { + iStack_bc = iStack_bc + 1; + iVar8 = -(int)sk; + uVar7 = (Player[iVar8]->super_TCreature).ID; + iVar5 = iStack_bc; + // try { // try from 080acedf to 080acee3 has its CatchHandler @ 080ad430 + GetBodyObject((ulong)&local_5c,uVar7); + if ((local_bd != bVar2) && + (local_4c[0].ObjectID = ::NONE.ObjectID, + local_5c.ObjectID == ::NONE.ObjectID)) { + local_6c[0].ObjectID = Obj[iVar8].ObjectID; + GetBodyContainer((ulong)&local_7c,(Player[iVar8]->super_TCreature).ID); + Object::getObjectType(&local_8c); + CheckInventoryPlace((ObjectType *)&local_8c,&local_7c,local_6c); + uVar7 = (Player[iVar8]->super_TCreature).ID; + iVar5 = iStack_bc; + GetBodyContainer((ulong)&local_7c,uVar7); + local_8c.ObjectID = local_7c.ObjectID; + Con[iVar8].ObjectID = local_7c.ObjectID; + } + bVar11 = false; + if (local_bd == bVar2) { + local_8c = (Object)::NONE.ObjectID; + local_7c.ObjectID = ::NONE.ObjectID; + if (local_5c.ObjectID != ::NONE.ObjectID) { + Object::getObjectType(&local_7c); + uVar7 = 4; + bVar3 = ObjectType::getFlag((ObjectType *)&local_7c,CONTAINER); + if (bVar3) { + local_7c.ObjectID = Obj[-(int)sk].ObjectID; + local_6c[0].ObjectID = local_7c.ObjectID; + if (local_5c.ObjectID != local_7c.ObjectID) { + bVar11 = true; + } + } + } + } + if (bVar11) { + // try { // try from 080ad1d2 to 080ad365 has its CatchHandler @ 080ad430 + Object::getContainer(local_6c); + bVar11 = local_6c[0].ObjectID == local_5c.ObjectID; + local_4c[0].ObjectID = local_5c.ObjectID; + local_6c[0].ObjectID = local_5c.ObjectID; + iVar8 = CountObjectsInContainer(local_6c); + Object::getObjectType(local_4c); + uVar7 = 1; + uVar10 = ObjectType::getAttribute((ObjectType *)local_4c,CAPACITY); + if ((int)uVar10 <= (int)(iVar8 - (uint)bVar11)) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 10; + // WARNING: Subroutine does not return + __cxa_throw(puVar9,&RESULT::typeinfo,0); + } + local_4c[0].ObjectID = local_5c.ObjectID; + Con[-(int)sk].ObjectID = local_5c.ObjectID; + local_6c[0].ObjectID = local_5c.ObjectID; + } + local_8c.ObjectID = ::NONE.ObjectID; + if (Con[-(int)sk].ObjectID != ::NONE.ObjectID) break; + if (9 < iStack_bc) { + if (local_bd == false) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4,uVar7,iVar5); + *puVar9 = 4; + goto LAB_080acf89; + } + local_bd = false; + iStack_bc = 0; + } + } + sk = (TSkill *)((int)&sk->_vptr_TSkill + 1); + } while ((int)sk < 2); + (this->TradeObject).ObjectID = ::NONE.ObjectID; + local_8c = ::NONE; + local_7c.ObjectID = ::NONE.ObjectID; + *(ulong *)(p + 0x3b0) = ::NONE.ObjectID; + SendCloseTrade((this->super_TCreature).Connection); + SendCloseTrade(*(TConnection **)(p + 0x318)); + Object::getObjectType(&local_8c); + Object::getObjectType(&local_7c); + local_6c[0].ObjectID = ::NONE.ObjectID; + local_4c[0].ObjectID = (Player[0]->super_TCreature).CrObject.ObjectID; + // try { // try from 080ad052 to 080ad1a1 has its CatchHandler @ 080ad501 + GetMapContainer(&local_5c); + Obj_00 = (Object *)(Player + 1); + Player[1] = pTVar1; + Move(0,Obj_00,&local_5c,-1,true,local_6c); + Player[1] = (TPlayer *)::NONE.ObjectID; + local_5c.ObjectID = (this->super_TCreature).CrObject.ObjectID; + GetMapContainer(local_6c); + local_4c[0].ObjectID = Obj[0].ObjectID; + Move(0,local_4c,local_6c,-1,true,Obj_00); + Player[1] = (TPlayer *)::NONE.ObjectID; + local_6c[0].ObjectID = Con[0].ObjectID; + local_5c.ObjectID = (ulong)pTVar1; + Move(0,&local_5c,local_6c,-1,true,Obj_00); + Player[1] = (TPlayer *)::NONE.ObjectID; + local_6c[0].ObjectID = local_3c; + local_5c.ObjectID = Obj[0].ObjectID; + Move(0,&local_5c,local_6c,-1,true,Obj_00); + } + } + } + return; +} + + + +// DWARF original prototype: void RejectTrade(TPlayer * this) + +void __thiscall TPlayer::RejectTrade(TPlayer *this) + +{ + bool bVar1; + TCreature *cr; + TCreature *pTVar2; + TCreature *pTVar3; + + if ((this->TradeObject).ObjectID != ::NONE.ObjectID) { + (this->TradeObject).ObjectID = ::NONE.ObjectID; + pTVar2 = GetCreature(this->TradePartner); + pTVar3 = (TCreature *)0x0; + if ((pTVar2 != (TCreature *)0x0) && (pTVar3 = pTVar2, pTVar2->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar3 = (TCreature *)0x0; + } + if (pTVar3 != (TCreature *)0x0) { + bVar1 = false; + if ((pTVar3[1].super_TSkillBase.TimerList[0xb] != (TSkill *)::NONE.ObjectID) && + (pTVar3[1].super_TSkillBase.TimerList[0xc] == (TSkill *)(this->super_TCreature).ID)) + { + bVar1 = true; + } + if (bVar1) { + pTVar3[1].super_TSkillBase.TimerList[0xb] = (TSkill *)::NONE.ObjectID; + SendCloseTrade(pTVar3->Connection); + SendMessage(pTVar3->Connection,0x17,"Trade cancelled."); + } + } + } + return; +} + + + +// DWARF original prototype: void ClearProfession(TPlayer * this) + +void __thiscall TPlayer::ClearProfession(TPlayer *this) + +{ + if ((this->super_TCreature).Profession == '\0') { + return; + } + (this->super_TCreature).Profession = '\0'; + TCombat::CheckCombatValues(&(this->super_TCreature).Combat); + IncrementNewbiesOnline(); + return; +} + + + +// WARNING: Variable defined which should be unmapped: prof_local +// DWARF original prototype: void SetProfession(TPlayer * this, uchar prof) + +void __thiscall TPlayer::SetProfession(TPlayer *this,uchar prof) + +{ + byte bVar1; + int Rest; + TSkill *pTVar2; + int iVar3; + _func_int_varargs **pp_Var4; + undefined4 uVar5; + uchar prof_local; + + if (prof == '\n') { + bVar1 = (this->super_TCreature).Profession; + if (bVar1 == 0) { + this = (TPlayer *)&DAT_08104220; + } + else { + if (bVar1 < 10) { + (this->super_TCreature).Profession = bVar1 + 10; + TCombat::CheckCombatValues(&(this->super_TCreature).Combat); + (this->super_TCreature).super_TSkillBase.Skills[0x16]->Max = 200; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0x16]; + iVar3 = (*pTVar2->_vptr_TSkill[0xd])(pTVar2); + if (0xe < iVar3) { + TSkillBase::SetTimer(&(this->super_TCreature).super_TSkillBase); + } + return; + } + this = (TPlayer *)s_TPlayer__SetProfession__Spieler_h_081041c0; + } + error((char *)this); + return; + } + if ((this->super_TCreature).Profession != '\0') { + this = (TPlayer *)s_TPlayer__SetProfession__Player___08104180; + goto LAB_080ad750; + } + if (prof == '\x02') { + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[8]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x4b0,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[10]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x4b0,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[9]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x4b0,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0xb]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x4b0,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[7]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,0x1e); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[6]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,100); + (this->super_TCreature).super_TSkillBase.Skills[2]->AddLevel = 10; + (this->super_TCreature).super_TSkillBase.Skills[5]->AddLevel = 0x14; + (this->super_TCreature).super_TSkillBase.Skills[3]->AddLevel = 0xf; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[1]; + pp_Var4 = pTVar2->_vptr_TSkill; + uVar5 = 0x578; + goto LAB_080ad830; + } + if (prof < 3) { + if (prof == '\x01') { + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[8]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[10]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[9]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0xb]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[7]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x578,0x1e); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[6]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x44c,100); + (this->super_TCreature).super_TSkillBase.Skills[2]->AddLevel = 0xf; + (this->super_TCreature).super_TSkillBase.Skills[5]->AddLevel = 0x19; + (this->super_TCreature).super_TSkillBase.Skills[3]->AddLevel = 5; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[1]; + pp_Var4 = pTVar2->_vptr_TSkill; + uVar5 = 3000; + goto LAB_080ad830; + } +LAB_080ad742: + this = (TPlayer *)s_TPlayer__SetProfession__Beruf__d_08104140; +LAB_080ad750: + error((char *)this); + return; + } + if (prof == '\x03') { + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[8]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,2000,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[10]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,2000,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[9]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,2000,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0xb]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x5dc,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[7]; + pp_Var4 = pTVar2->_vptr_TSkill; + uVar5 = 2000; + } + else { + if (prof != '\x04') goto LAB_080ad742; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[8]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x708,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[10]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x708,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[9]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x708,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[0xb]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x5dc,0x32); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[7]; + pp_Var4 = pTVar2->_vptr_TSkill; + uVar5 = 0x708; + } + (*pp_Var4[7])(pTVar2,uVar5,0x1e); + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[6]; + (*pTVar2->_vptr_TSkill[7])(pTVar2,0x5dc,100); + (this->super_TCreature).super_TSkillBase.Skills[2]->AddLevel = 5; + (this->super_TCreature).super_TSkillBase.Skills[5]->AddLevel = 10; + (this->super_TCreature).super_TSkillBase.Skills[3]->AddLevel = 0x1e; + pTVar2 = (this->super_TCreature).super_TSkillBase.Skills[1]; + pp_Var4 = pTVar2->_vptr_TSkill; + uVar5 = 0x44c; +LAB_080ad830: + (*pp_Var4[7])(pTVar2,uVar5,0x640); + (this->super_TCreature).Profession = prof; + TCombat::CheckCombatValues(&(this->super_TCreature).Combat); + DecrementNewbiesOnline(); + return; +} + + + +// DWARF original prototype: uchar GetRealProfession(TPlayer * this) + +uchar __thiscall TPlayer::GetRealProfession(TPlayer *this) + +{ + return (this->super_TCreature).Profession; +} + + + +// DWARF original prototype: uchar GetEffectiveProfession(TPlayer * this) + +uchar __thiscall TPlayer::GetEffectiveProfession(TPlayer *this) + +{ + byte bVar1; + + bVar1 = (this->super_TCreature).Profession; + if (9 < bVar1) { + bVar1 = bVar1 - 10; + } + return bVar1; +} + + + +// DWARF original prototype: uchar GetActiveProfession(TPlayer * this) + +uchar __thiscall TPlayer::GetActiveProfession(TPlayer *this) + +{ + bool bVar1; + byte bVar2; + + bVar1 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar1) { + bVar2 = (this->super_TCreature).Profession; + } + else { + bVar2 = (this->super_TCreature).Profession; + if (9 < bVar2) { + bVar2 = bVar2 - 10; + } + } + return bVar2; +} + + + +// DWARF original prototype: bool GetActivePromotion(TPlayer * this) + +bool __thiscall TPlayer::GetActivePromotion(TPlayer *this) + +{ + bool bVar1; + + bVar1 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar1) { + bVar1 = 9 < (this->super_TCreature).Profession; + } + else { + bVar1 = false; + } + return bVar1; +} + + + +// DWARF original prototype: bool SpellKnown(TPlayer * this, int SpellNumber) + +bool __thiscall TPlayer::SpellKnown(TPlayer *this,int SpellNumber) + +{ + bool bVar1; + + if ((uint)SpellNumber < 0x100) { + bVar1 = this->SpellList[SpellNumber] != '\0'; + } + else { + error(&DAT_08104280,SpellNumber); + bVar1 = false; + } + return bVar1; +} + + + +// DWARF original prototype: void LearnSpell(TPlayer * this, int SpellNumber) + +void __thiscall TPlayer::LearnSpell(TPlayer *this,int SpellNumber) + +{ + if (0xff < (uint)SpellNumber) { + error(&DAT_08104300); + return; + } + if (this->SpellList[SpellNumber] == '\0') { + this->SpellList[SpellNumber] = '\x01'; + return; + } + error("TPlayer::LearnSpell: Der Spieler kennt den Spruch schon.\n"); + return; +} + + + +// DWARF original prototype: int GetQuestValue(TPlayer * this, int Number) + +int __thiscall TPlayer::GetQuestValue(TPlayer *this,int Number) + +{ + int iVar1; + + if ((uint)Number < 500) { + print(); + iVar1 = this->QuestValues[Number]; + } + else { + error(&DAT_08103ea0,Number); + iVar1 = 0; + } + return iVar1; +} + + + +// DWARF original prototype: void SetQuestValue(TPlayer * this, int Number, int Value) + +void __thiscall TPlayer::SetQuestValue(TPlayer *this,int Number,int Value) + +{ + if (499 < (uint)Number) { + error(&DAT_08103ee0); + return; + } + print(); + this->QuestValues[Number] = Value; + return; +} + + + +// DWARF original prototype: void CheckOutfit(TPlayer * this) + +void __thiscall TPlayer::CheckOutfit(TPlayer *this) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + int iVar2; + bool bVar3; + + bVar3 = CheckRight((this->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (bVar3) { + if ((this->super_TCreature).OrgOutfit.OutfitID == 0x4b) { + return; + } + (this->super_TCreature).OrgOutfit.field_1.Colors[0] = '\0'; + (this->super_TCreature).OrgOutfit.OutfitID = 0x4b; + (this->super_TCreature).OrgOutfit.field_1.Colors[1] = '\0'; + (this->super_TCreature).OrgOutfit.field_1.Colors[2] = '\0'; + (this->super_TCreature).OrgOutfit.field_1.Colors[3] = '\0'; + } + else { + if ((this->super_TCreature).Sex == 1) { + iVar2 = (this->super_TCreature).OrgOutfit.OutfitID; + bVar3 = false; + if ((0x7f < iVar2) && (iVar2 < 0x87)) { + bVar3 = true; + } + if (bVar3) { + return; + } + (this->super_TCreature).OrgOutfit.OutfitID = 0x80; + } + else { + iVar2 = (this->super_TCreature).OrgOutfit.OutfitID; + bVar3 = false; + if ((0x87 < iVar2) && (iVar2 < 0x8f)) { + bVar3 = true; + } + if (bVar3) { + return; + } + (this->super_TCreature).OrgOutfit.OutfitID = 0x88; + } + builtin_memcpy(&(this->super_TCreature).OrgOutfit.field_1,"NE:L",4); + } + aVar1 = (this->super_TCreature).OrgOutfit.field_1; + (this->super_TCreature).Outfit.OutfitID = (this->super_TCreature).OrgOutfit.OutfitID; + (this->super_TCreature).Outfit.field_1 = aVar1; + return; +} + + + +// DWARF original prototype: void CheckState(TPlayer * this) + +void __thiscall TPlayer::CheckState(TPlayer *this) + +{ + TSkill *pTVar1; + uint uVar2; + int iVar3; + int iVar4; + int NewState; + uint uVar5; + + if ((this->super_TCreature).Connection != (TConnection *)0x0) { + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x11]; + iVar3 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x12]; + iVar4 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x13]; + uVar5 = (uint)(0 < iVar3); + if (0 < iVar4) { + uVar5 = 0 < iVar3 | 2; + } + iVar3 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x14]; + if (0 < iVar3) { + uVar5 = uVar5 | 4; + } + iVar3 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if (0 < iVar3) { + iVar3 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0x14]); + if (iVar3 == 0) { + uVar5 = uVar5 | 8; + } + } + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0x15]; + iVar3 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if ((0 < iVar3) || + (iVar3 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0x15]), 0 < iVar3)) + { + uVar5 = uVar5 | 0x10; + } + uVar2 = (this->super_TCreature).super_TSkillBase.Skills[4]->MDAct; + if (0x7fffffff < uVar2) { + uVar5 = uVar5 | 0x20; + } + if (0 < (int)uVar2) { + uVar5 = uVar5 | 0x40; + } + if (RoundNr < (this->super_TCreature).EarliestLogoutRound) { + uVar5 = uVar5 | 0x80; + } + if (uVar5 != this->OldState) { + SendPlayerState((this->super_TCreature).Connection,(uchar)uVar5); + this->OldState = uVar5; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Execute_local +// DWARF original prototype: bool MovePossible(TPlayer * this, int x, int y, int z, bool Execute, +// bool Jump) + +bool __thiscall TPlayer::MovePossible(TPlayer *this,int x,int y,int z,bool Execute,bool Jump) + +{ + bool bVar1; + bool bVar2; + ushort HouseID; + ushort HouseID_00; + undefined4 *puVar3; + int iVar4; + int iVar5; + bool Execute_local; + + if (Jump) { + bVar2 = JumpPossible(x,y,z,false); + } + else { + bVar2 = false; + // try { // try from 080adffe to 080ae18e has its CatchHandler @ 080ae196 + bVar1 = CoordinateFlag(); + if (bVar1) { + bVar2 = CoordinateFlag(); + bVar2 = !bVar2; + } + } + bVar1 = false; + if (bVar2 != false) { + if (Execute) { + if ((RoundNr < (this->super_TCreature).EarliestProtectionZoneRound) && + (bVar2 = IsProtectionZone(), bVar2)) { + iVar5 = (this->super_TCreature).posz; + iVar4 = (this->super_TCreature).posy; + bVar2 = IsProtectionZone(); + if (!bVar2) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4,iVar4,iVar5); + *puVar3 = 0x30; + goto LAB_080ae0ab; + } + } + HouseID_00 = GetHouseID(x,y,z); + if (((HouseID_00 != 0) && (bVar2 = IsInvited(HouseID_00,this,0x7fffffff), !bVar2)) && + (bVar2 = CheckRight((this->super_TCreature).ID,ENTER_HOUSES), !bVar2)) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x32; +LAB_080ae0ab: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + } + else { + bVar2 = CoordinateFlag(); + if (bVar2) { + return false; + } + } + bVar1 = true; + } + return bVar1; +} + + + +// DWARF original prototype: void AddBuddy(TPlayer * this, char * Name) + +void __thiscall TPlayer::AddBuddy(TPlayer *this,char *Name) + +{ + int *piVar1; + bool bVar2; + TPlayerIndexEntry *Entry; + TConnection *pTVar3; + int iVar4; + TPlayerIndexEntry *pTVar5; + ulong CharacterID_00; + ulong CharacterID_01; + ulong extraout_EDX; + ulong extraout_EDX_00; + ulong CharacterID; + char *pcVar6; + TPlayer *pTStack_40; + bool Online; + TPlayer *pl; + char RealName [30]; + + if (Name == (char *)0x0) { + pcVar6 = "TPlayer::AddBuddy: Name ist NULL.\n"; + } + else { + if (this->PlayerData != (TPlayerData *)0x0) { + if (((this->PlayerData->Buddies < 100) && + ((bVar2 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL), bVar2 || + (this->PlayerData->Buddies < 100)))) && + ((bVar2 = CheckRight((this->super_TCreature).ID,PREMIUM_ACCOUNT), bVar2 || + (this->PlayerData->Buddies < 0x14)))) { + iVar4 = IdentifyPlayer(Name,true,true,&stack0xffffffc0); + if (iVar4 == 0) { + CharacterID_00 = (pTStack_40->super_TCreature).ID; + strcpy((char *)&pl,(pTStack_40->super_TCreature).Name); + bVar2 = true; + } + else { + if (Name == (char *)0x0) { + error("GetCharacterID: Name ist NULL.\n"); + CharacterID_00 = 0; + } + else { + pTVar5 = SearchPlayerIndex(Name); + CharacterID_00 = 0; + if (pTVar5 != (TPlayerIndexEntry *)0x0) { + CharacterID_00 = pTVar5->CharacterID; + } + } + if (CharacterID_00 == 0) { + SendResult((this->super_TCreature).Connection,PLAYERNOTEXISTING); + return; + } + if (Name == (char *)0x0) { + error("GetCharacterName: Name ist NULL.\n"); + pTVar5 = (TPlayerIndexEntry *)0x0; + } + else { + pTVar5 = SearchPlayerIndex(Name); + if (pTVar5 == (TPlayerIndexEntry *)0x0) { + error("GetCharacterName: Spieler existiert nicht.\n"); + pTVar5 = (TPlayerIndexEntry *)0x8107675; + } + } + strcpy((char *)&pl,pTVar5->Name); + bVar2 = false; + } + iVar4 = 0; + CharacterID_01 = this->PlayerData->Buddies; + if (0 < (int)CharacterID_01) { + do { + if (this->PlayerData->Buddy[iVar4] == CharacterID_00) { + pTVar3 = (this->super_TCreature).Connection; + pcVar6 = "This player is already in your list."; + goto LAB_080ae24e; + } + iVar4 = iVar4 + 1; + } while (iVar4 < (int)CharacterID_01); + } + if ((bVar2) && + (bVar2 = CheckRight(CharacterID_00,NO_STATISTICS), CharacterID_01 = extraout_EDX, + bVar2)) { + CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + CharacterID_01 = extraout_EDX_00; + } + pTVar3 = (this->super_TCreature).Connection; + SendBuddyData(pTVar3,CharacterID_01,(char *)pTVar3,SUB41(CharacterID_00,0)); + AddBuddyOrder(&this->super_TCreature,CharacterID_00); + this->PlayerData->Buddy[this->PlayerData->Buddies] = CharacterID_00; + strcpy(this->PlayerData->BuddyName[this->PlayerData->Buddies],(char *)&pl); + piVar1 = &this->PlayerData->Buddies; + *piVar1 = *piVar1 + 1; + return; + } + pTVar3 = (this->super_TCreature).Connection; + pcVar6 = "You cannot add more buddies."; +LAB_080ae24e: + SendMessage(pTVar3,0x17,pcVar6); + return; + } + pcVar6 = "TPlayer::AddBuddy: PlayerData ist NULL.\n"; + } + error(pcVar6); + return; +} + + + +// DWARF original prototype: void RemoveBuddy(TPlayer * this, ulong CharacterID) + +void __thiscall TPlayer::RemoveBuddy(TPlayer *this,ulong CharacterID) + +{ + int *piVar1; + TPlayerData *pTVar2; + int i; + int iVar3; + int Position; + int iVar4; + + pTVar2 = this->PlayerData; + if (pTVar2 == (TPlayerData *)0x0) { + error("TPlayer::RemoveBuddy: PlayerData ist NULL.\n"); + return; + } + iVar3 = 0; + iVar4 = -1; + if (0 < pTVar2->Buddies) { + do { + iVar4 = iVar3; + if (pTVar2->Buddy[iVar3] == CharacterID) break; + iVar3 = iVar3 + 1; + iVar4 = -1; + } while (iVar3 < pTVar2->Buddies); + } + if (iVar4 == -1) { + return; + } + pTVar2->Buddy[iVar4] = pTVar2->Buddy[pTVar2->Buddies + -1]; + pTVar2 = this->PlayerData; + strcpy(pTVar2->BuddyName[iVar4],pTVar2->BuddyName[pTVar2->Buddies + -1]); + piVar1 = &this->PlayerData->Buddies; + *piVar1 = *piVar1 + -1; + RemoveBuddyOrder(&this->super_TCreature,CharacterID); + return; +} + + + +// WARNING: Variable defined which should be unmapped: ViewAll +// DWARF original prototype: void SendBuddies(TPlayer * this) + +void __thiscall TPlayer::SendBuddies(TPlayer *this) + +{ + bool bVar1; + TCreature *cr; + TPlayerData *pTVar2; + TCreature *pTVar3; + TConnection *Connection; + TPlayerData *extraout_EDX; + TPlayerData *extraout_EDX_00; + TPlayerData *extraout_EDX_01; + int i; + int iVar4; + TConnection *Name; + TCreature *local_18; + bool ViewAll; + + if (this->PlayerData != (TPlayerData *)0x0) { + bVar1 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + pTVar2 = this->PlayerData; + if (0 < pTVar2->Buddies) { + iVar4 = 0; + do { + pTVar3 = GetCreature(pTVar2->Buddy[iVar4]); + local_18 = (TCreature *)0x0; + pTVar2 = extraout_EDX; + if ((pTVar3 != (TCreature *)0x0) && (local_18 = pTVar3, pTVar3->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + local_18 = (TCreature *)0x0; + pTVar2 = extraout_EDX_01; + } + if (local_18 == (TCreature *)0x0) { + Name = (this->super_TCreature).Connection; + pTVar2 = this->PlayerData; + Connection = (TConnection *)pTVar2->Buddy[iVar4]; + } + else { + if (!bVar1) { + CheckRight(local_18->ID,NO_STATISTICS); + pTVar2 = extraout_EDX_00; + } + Name = (this->super_TCreature).Connection; + Connection = (TConnection *)this->PlayerData->Buddy[iVar4]; + } + SendBuddyData(Connection,(ulong)pTVar2,(char *)Name,SUB41(Connection,0)); + iVar4 = iVar4 + 1; + pTVar2 = this->PlayerData; + } while (iVar4 < pTVar2->Buddies); + } + return; + } + error("TPlayer::SendBuddies: PlayerData ist NULL.\n"); + return; +} + + + +// DWARF original prototype: void Regenerate(TPlayer * this) + +void __thiscall TPlayer::Regenerate(TPlayer *this) + +{ + TSkill *pTVar1; + bool bVar2; + RESULT r; + ulong uVar3; + int iVar4; + int iVar5; + time_t tVar6; + int Fed; + int Regeneration; + int iVar7; + time_t OfflineTime; + char *pcVar8; + Object *pOVar9; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Bed; + + iVar4 = (this->super_TCreature).posz; + iVar7 = (this->super_TCreature).posy; + pOVar9 = (Object *)(this->super_TCreature).posx; + GetFirstObject(); + local_3c[0].ObjectID = ::NONE.ObjectID; + if (local_2c.ObjectID != ::NONE.ObjectID) { + do { + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_4c); + pOVar9 = (Object *)0x14; + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,BED); + if (bVar2) break; + pOVar9 = &local_2c; + Object::getNextObject(local_3c); + local_2c.ObjectID = local_3c[0].ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + } while (local_2c.ObjectID != ::NONE.ObjectID); + } + local_4c[0].ObjectID = ::NONE.ObjectID; + if (local_2c.ObjectID == ::NONE.ObjectID) { + pcVar8 = "TPlayer::Regenerate: Bett nicht gefunden.\n"; + } + else { + Object::getObjectType(local_4c); + pOVar9 = (Object *)0x18; + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,TEXT); + if (bVar2) { + uVar3 = Object::getAttribute(&local_2c,TEXTSTRING); + if (uVar3 == 0) { + return; + } + uVar3 = Object::getAttribute(&local_2c,TEXTSTRING); + pcVar8 = GetDynamicString(uVar3); + iVar4 = stricmp(pcVar8,(this->super_TCreature).Name,-1); + if (iVar4 != 0) { + return; + } + if ((this->PlayerData == (TPlayerData *)0x0) || (this->PlayerData->LastLogoutTime == 0)) + { + iVar4 = 0; + } + else { + tVar6 = time((time_t *)0x0); + iVar4 = tVar6 - this->PlayerData->LastLogoutTime; + } + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0xe]; + iVar5 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + iVar7 = iVar4 / 0xf; + if (iVar5 / 3 < iVar4 / 0xf) { + iVar7 = iVar5 / 3; + } + if (0 < iVar7) { + iVar5 = iVar7 + 3; + if (-1 < iVar7) { + iVar5 = iVar7; + } + TSkill::Change((this->super_TCreature).super_TSkillBase.Skills[2],iVar5 >> 2); + TSkill::Change((this->super_TCreature).super_TSkillBase.Skills[3],iVar7); + pTVar1 = (this->super_TCreature).super_TSkillBase.Skills[0xe]; + (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + TSkillBase::SetTimer(&(this->super_TCreature).super_TSkillBase); + } + if (899 < iVar4) { + TSkill::Change((this->super_TCreature).super_TSkillBase.Skills[0x16],iVar4 / 900); + } + local_4c[0].ObjectID = local_2c.ObjectID; + local_3c[0].ObjectID = local_2c.ObjectID; + // try { // try from 080ae8eb to 080ae8ef has its CatchHandler @ 080ae94d + UseObjects(0,local_3c,local_4c); + return; + } + pcVar8 = &DAT_081044c0; + } + error(pcVar8,pOVar9,iVar7,iVar4); + return; +} + + + +// WARNING: Variable defined which should be unmapped: CheckFormer_local +// DWARF original prototype: bool IsAttacker(TPlayer * this, ulong Victim, bool CheckFormer) + +bool __thiscall TPlayer::IsAttacker(TPlayer *this,ulong Victim,bool CheckFormer) + +{ + ulong *puVar1; + int i; + int iVar2; + bool CheckFormer_local; + + iVar2 = 0; + if (0 < this->NumberOfAttackedPlayers) { + do { + puVar1 = vector<>::operator()(&this->AttackedPlayers,iVar2); + if (*puVar1 == Victim) { + return true; + } + iVar2 = iVar2 + 1; + } while (iVar2 < this->NumberOfAttackedPlayers); + } + if (((CheckFormer) && (RoundNr <= this->FormerLogoutRound + 5)) && + (iVar2 = 0, 0 < this->NumberOfFormerAttackedPlayers)) { + do { + puVar1 = vector<>::operator()(&this->FormerAttackedPlayers,iVar2); + if (*puVar1 == Victim) { + return true; + } + iVar2 = iVar2 + 1; + } while (iVar2 < this->NumberOfFormerAttackedPlayers); + } + return false; +} + + + +// DWARF original prototype: bool IsAggressor(TPlayer * this, bool CheckFormer) + +bool __thiscall TPlayer::IsAggressor(TPlayer *this,bool CheckFormer) + +{ + bool bVar1; + + if ((this->Aggressor != false) || + (((CheckFormer && (RoundNr <= this->FormerLogoutRound + 5)) && + (this->FormerAggressor != false)))) { + bVar1 = true; + } + else { + bVar1 = false; + } + return bVar1; +} + + + +// DWARF original prototype: bool IsAttackJustified(TPlayer * this, ulong Victim) + +bool __thiscall TPlayer::IsAttackJustified(TPlayer *this,ulong Victim) + +{ + bool bVar1; + TPlayer *pTVar2; + TPlayer *this_00; + ulong uVar3; + ulong uVar4; + + pTVar2 = (TPlayer *)GetCreature(Victim); + this_00 = (TPlayer *)0x0; + if ((pTVar2 != (TPlayer *)0x0) && (this_00 = pTVar2, (pTVar2->super_TCreature).Type != PLAYER)) + { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + this_00 = (TPlayer *)0x0; + } + if (this_00 == (TPlayer *)0x0) { + error("TPlayer::IsAttackJustified: Opfer existiert nicht.\n"); + } + else if ((WorldType != PVP_ENFORCED) && (this_00->PlayerData->PlayerkillerEnd == 0)) { + if ((this_00->Aggressor == false) && + ((this_00->FormerLogoutRound + 5 < RoundNr || (this_00->FormerAggressor == false)))) { + bVar1 = false; + } + else { + bVar1 = true; + } + if (!bVar1) { + uVar4 = this->PartyLeavingRound; + if ((uVar4 == 0) || (RoundNr <= uVar4 + 5)) { + uVar3 = this->PartyLeader; + } + else { + uVar3 = 0; + } + if (uVar3 != 0) { + if ((uVar4 == 0) || (RoundNr <= uVar4 + 5)) { + uVar4 = this->PartyLeader; + } + else { + uVar4 = 0; + } + if ((this_00->PartyLeavingRound == 0) || (RoundNr <= this_00->PartyLeavingRound + 5) + ) { + uVar3 = this_00->PartyLeader; + } + else { + uVar3 = 0; + } + if (uVar4 == uVar3) { + return true; + } + } + bVar1 = IsAttacker(this_00,(this->super_TCreature).ID,true); + return bVar1; + } + } + return true; +} + + + +// DWARF original prototype: void RecordAttack(TPlayer * this, ulong Victim) + +void __thiscall TPlayer::RecordAttack(TPlayer *this,ulong Victim) + +{ + TConnection *this_00; + bool bVar1; + TCreature *cr; + TPlayer *pTVar2; + ulong *puVar3; + KNOWNCREATURESTATE KVar4; + ulong uVar5; + ulong uVar6; + TPlayer *this_01; + + if (WorldType != NORMAL) { + return; + } + if (Victim == (this->super_TCreature).ID) { + return; + } + pTVar2 = (TPlayer *)GetCreature(Victim); + this_01 = (TPlayer *)0x0; + if ((pTVar2 != (TPlayer *)0x0) && (this_01 = pTVar2, (pTVar2->super_TCreature).Type != PLAYER)) + { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + this_01 = (TPlayer *)0x0; + } + if (this_01 == (TPlayer *)0x0) { + error("TPlayer::RecordAttack: Opfer existiert nicht.\n"); + return; + } + bVar1 = IsAttacker(this_01,(this->super_TCreature).ID,true); + if ((!bVar1) && (bVar1 = IsAttacker(this,Victim,false), !bVar1)) { + uVar6 = this->PartyLeavingRound; + if ((uVar6 == 0) || (RoundNr <= uVar6 + 5)) { + uVar5 = this->PartyLeader; + } + else { + uVar5 = 0; + } + if (uVar5 != 0) { + if ((uVar6 == 0) || (RoundNr <= uVar6 + 5)) { + uVar6 = this->PartyLeader; + } + else { + uVar6 = 0; + } + if ((this_01->PartyLeavingRound == 0) || (RoundNr <= this_01->PartyLeavingRound + 5)) { + uVar5 = this_01->PartyLeader; + } + else { + uVar5 = 0; + } + if (uVar6 == uVar5) goto LAB_080aec5e; + } + puVar3 = vector<>::operator()(&this->AttackedPlayers,this->NumberOfAttackedPlayers); + *puVar3 = Victim; + this->NumberOfAttackedPlayers = this->NumberOfAttackedPlayers + 1; + print(); + this_00 = (this_01->super_TCreature).Connection; + if ((this_00 != (TConnection *)0x0) && + (KVar4 = TConnection::KnownCreature(this_00,(this->super_TCreature).ID,false), + KVar4 == KNOWNCREATURE_UPTODATE)) { + SendCreatureSkull((this_01->super_TCreature).Connection,(this->super_TCreature).ID); + } + } +LAB_080aec5e: + bVar1 = IsAttackJustified(this,Victim); + if ((!bVar1) && (this->Aggressor == false)) { + this->Aggressor = true; + print(); + AnnounceChangedCreature((this->super_TCreature).ID,5); + return; + } + return; +} + + + +// DWARF original prototype: void RecordMurder(TPlayer * this, ulong Victim) + +void __thiscall TPlayer::RecordMurder(TPlayer *this,ulong Victim) + +{ + TPlayerData *pTVar1; + int iVar2; + bool bVar3; + TCreature *cr; + TCreature *pTVar4; + time_t tVar5; + int i; + int iVar6; + TCreature *pTVar7; + int Playerkilling; + + if (((WorldType == NORMAL) && (Victim != (this->super_TCreature).ID)) && + (bVar3 = IsAttackJustified(this,Victim), !bVar3)) { + pTVar4 = GetCreature(Victim); + pTVar7 = (TCreature *)0x0; + if ((pTVar4 != (TCreature *)0x0) && (pTVar7 = pTVar4, pTVar4->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar7 = (TCreature *)0x0; + } + if (pTVar7 == (TCreature *)0x0) { + error("TPlayer::RecordMurder: Opfer existiert nicht.\n"); + return; + } + print(); + iVar6 = 1; + do { + this->PlayerData->MurderTimestamps[iVar6 + -1] = + this->PlayerData->MurderTimestamps[iVar6]; + iVar6 = iVar6 + 1; + } while (iVar6 < 0x14); + pTVar1 = this->PlayerData; + tVar5 = time((time_t *)0x0); + pTVar1->MurderTimestamps[0x13] = tVar5; + SendMessage((this->super_TCreature).Connection,0x12, + "Warning! The murder of %s was not justified.",pTVar7->Name); + iVar6 = CheckPlayerkilling(this); + if (iVar6 != 0) { + pTVar1 = this->PlayerData; + iVar2 = pTVar1->PlayerkillerEnd; + tVar5 = time((time_t *)0x0); + pTVar1->PlayerkillerEnd = tVar5 + 0x278d00; + if (iVar2 == 0) { + print(); + AnnounceChangedCreature((this->super_TCreature).ID,5); + } + if (iVar6 == 2) { + PunishmentOrder((TCreature *)0x0,(this->super_TCreature).Name,this->IPAddress,0x1c,2 + ,"Exceeding the limit of unjustified kills by 100%.",0, + (vector<> *)0x0,0,false); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: LastMonth +// DWARF original prototype: int CheckPlayerkilling(TPlayer * this) + +int __thiscall TPlayer::CheckPlayerkilling(TPlayer *this) + +{ + int iVar1; + int iVar2; + int Now; + time_t tVar3; + int i; + int iVar4; + int LastDay; + int iVar5; + int LastWeek; + int iVar6; + int local_14; + int LastMonth; + + local_14 = 0; + tVar3 = time((time_t *)0x0); + iVar4 = 0; + iVar5 = 0; + iVar6 = 0; + do { + iVar1 = this->PlayerData->MurderTimestamps[iVar4]; + iVar2 = local_14; + if (iVar1 != 0) { + if (tVar3 + -0x15180 < iVar1) { + iVar5 = iVar5 + 1; + } + if (tVar3 + -0x93a80 < iVar1) { + iVar6 = iVar6 + 1; + } + iVar2 = local_14 + 1; + if (iVar1 <= tVar3 + -0x278d00) { + iVar2 = local_14; + } + } + local_14 = iVar2; + iVar4 = iVar4 + 1; + } while (iVar4 < 0x14); + if (((iVar5 < 6) && (iVar6 < 10)) && (local_14 < 0x14)) { + if (((2 < iVar5) || (4 < iVar6)) || (iVar5 = 0, 9 < local_14)) { + iVar5 = 1; + } + } + else { + iVar5 = 2; + } + return iVar5; +} + + + +// WARNING: Variable defined which should be unmapped: Victim_local +// DWARF original prototype: void ClearAttacker(TPlayer * this, ulong Victim) + +void __thiscall TPlayer::ClearAttacker(TPlayer *this,ulong Victim) + +{ + vector<> *this_00; + TCreature *cr; + ulong *puVar1; + ulong *puVar2; + TCreature *pTVar3; + KNOWNCREATURESTATE KVar4; + int i; + int i_00; + TCreature *pTVar5; + ulong Victim_local; + + i_00 = 0; + if (0 < this->NumberOfAttackedPlayers) { + this_00 = &this->AttackedPlayers; + do { + puVar1 = vector<>::operator()(this_00,i_00); + if (*puVar1 == Victim) { + puVar1 = vector<>::operator()(this_00,i_00); + puVar2 = vector<>::operator()(this_00,this->NumberOfAttackedPlayers + -1); + *puVar1 = *puVar2; + this->NumberOfAttackedPlayers = this->NumberOfAttackedPlayers + -1; + pTVar3 = GetCreature(Victim); + pTVar5 = (TCreature *)0x0; + if ((pTVar3 != (TCreature *)0x0) && (pTVar5 = pTVar3, pTVar3->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar5 = (TCreature *)0x0; + } + if (pTVar5 == (TCreature *)0x0) { + return; + } + print(); + if (pTVar5->Connection == (TConnection *)0x0) { + return; + } + KVar4 = TConnection::KnownCreature + (pTVar5->Connection,(this->super_TCreature).ID,false); + if (KVar4 != KNOWNCREATURE_UPTODATE) { + return; + } + SendCreatureSkull(pTVar5->Connection,(this->super_TCreature).ID); + return; + } + i_00 = i_00 + 1; + } while (i_00 < this->NumberOfAttackedPlayers); + } + return; +} + + + +// DWARF original prototype: void ClearPlayerkillingMarks(TPlayer * this) + +void __thiscall TPlayer::ClearPlayerkillingMarks(TPlayer *this) + +{ + char cVar1; + TCreature *cr; + ulong *puVar2; + ulong *puVar3; + TCreature *pTVar4; + KNOWNCREATURESTATE KVar5; + TPlayer **ppTVar6; + TPlayer *pl; + int i_2; + int iVar7; + int i; + int iVar8; + int iVar9; + TCreature *pTVar10; + + print(); + iVar7 = this->NumberOfAttackedPlayers; + this->FormerLogoutRound = RoundNr; + cVar1 = this->Aggressor; + this->NumberOfFormerAttackedPlayers = iVar7; + this->FormerAggressor = (bool)cVar1; + if (0 < iVar7) { + iVar9 = 0; + do { + puVar2 = vector<>::operator()(&this->FormerAttackedPlayers,iVar9); + iVar8 = iVar9 + 1; + puVar3 = vector<>::operator()(&this->AttackedPlayers,iVar9); + *puVar2 = *puVar3; + iVar7 = this->NumberOfAttackedPlayers; + iVar9 = iVar8; + } while (iVar8 < iVar7); + cVar1 = this->Aggressor; + } + if (cVar1 != '\0') { + this->Aggressor = false; + this->NumberOfAttackedPlayers = 0; + print(); + AnnounceChangedCreature((this->super_TCreature).ID,5); + iVar7 = this->NumberOfAttackedPlayers; + } + if ((0 < iVar7) && (this->NumberOfAttackedPlayers = 0, 0 < iVar7)) { + iVar9 = 0; + do { + puVar2 = vector<>::operator()(&this->AttackedPlayers,iVar9); + pTVar4 = GetCreature(*puVar2); + pTVar10 = (TCreature *)0x0; + if ((pTVar4 != (TCreature *)0x0) && (pTVar10 = pTVar4, pTVar4->Type != PLAYER)) { + error("GetPlayer: Kreatur ist kein Spieler.\n"); + pTVar10 = (TCreature *)0x0; + } + if (pTVar10 != (TCreature *)0x0) { + print(); + if ((pTVar10->Connection != (TConnection *)0x0) && + (KVar5 = TConnection::KnownCreature + (pTVar10->Connection,(this->super_TCreature).ID,false), + KVar5 == KNOWNCREATURE_UPTODATE)) { + SendCreatureSkull(pTVar10->Connection,(this->super_TCreature).ID); + } + } + iVar9 = iVar9 + 1; + } while (iVar9 < iVar7); + } + iVar7 = 0; + if (0 < FirstFreePlayer) { + do { + ppTVar6 = vector::operator()(&PlayerList,iVar7); + if (*ppTVar6 == (TPlayer *)0x0) { + error("TPlayer::ClearPlayerkillingMarks: Spieler %d existiert nicht.\n",iVar7); + } + else { + ClearAttacker(*ppTVar6,(this->super_TCreature).ID); + } + iVar7 = iVar7 + 1; + } while (iVar7 < FirstFreePlayer); + } + return; +} + + + +// DWARF original prototype: int GetPlayerkillingMark(TPlayer * this, TPlayer * Observer) + +int __thiscall TPlayer::GetPlayerkillingMark(TPlayer *this,TPlayer *Observer) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + + if (WorldType == NORMAL) { + if (Observer != (TPlayer *)0x0) { + if (this->PlayerData->PlayerkillerEnd != 0) { + return 4; + } + if (this->Aggressor != false) { + return 3; + } + uVar2 = 0; + if (this->PartyLeavingRound == 0) { + uVar2 = this->PartyLeader; + } + if (uVar2 != 0) { + uVar2 = 0; + if (this->PartyLeavingRound == 0) { + uVar2 = this->PartyLeader; + } + if (Observer->PartyLeavingRound == 0) { + uVar3 = Observer->PartyLeader; + } + else { + uVar3 = 0; + } + if (uVar2 == uVar3) { + return 2; + } + } + bVar1 = IsAttacker(this,(Observer->super_TCreature).ID,false); + return (uint)bVar1; + } + error("TPlayer::GetPlayerkillingMark: Beobachter existiert nicht.\n"); + } + return 0; +} + + + +// DWARF original prototype: ulong GetPartyLeader(TPlayer * this, bool CheckFormer) + +ulong __thiscall TPlayer::GetPartyLeader(TPlayer *this,bool CheckFormer) + +{ + if (this->PartyLeavingRound != 0) { + if (!CheckFormer) { + return 0; + } + if (this->PartyLeavingRound + 5 < RoundNr) { + return 0; + } + } + return this->PartyLeader; +} + + + +// DWARF original prototype: void JoinParty(TPlayer * this, ulong Leader) + +void __thiscall TPlayer::JoinParty(TPlayer *this,ulong Leader) + +{ + this->PartyLeavingRound = 0; + this->PartyLeader = Leader; + return; +} + + + +// DWARF original prototype: void LeaveParty(TPlayer * this) + +void __thiscall TPlayer::LeaveParty(TPlayer *this) + +{ + this->PartyLeavingRound = RoundNr; + return; +} + + + +// DWARF original prototype: int GetPartyMark(TPlayer * this, TPlayer * Observer) + +int __thiscall TPlayer::GetPartyMark(TPlayer *this,TPlayer *Observer) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + ulong uVar4; + ulong Guest; + ulong local_18; + + if (Observer == (TPlayer *)0x0) { + error("TPlayer::GetPartyMark: Beobachter existiert nicht.\n"); + } + else { + uVar2 = Observer->PartyLeavingRound; + uVar3 = 0; + if (uVar2 == 0) { + uVar3 = Observer->PartyLeader; + } + Guest = (this->super_TCreature).ID; + if (Guest == uVar3) { + return 4; + } + uVar4 = 0; + uVar3 = this->PartyLeavingRound; + if (uVar3 == 0) { + uVar4 = this->PartyLeader; + } + if (uVar4 != 0) { + local_18 = 0; + if (uVar3 == 0) { + local_18 = this->PartyLeader; + } + uVar4 = 0; + if (uVar2 == 0) { + uVar4 = Observer->PartyLeader; + } + if (local_18 == uVar4) { + return 3; + } + } + uVar4 = 0; + if (uVar2 == 0) { + uVar4 = Observer->PartyLeader; + } + uVar2 = (Observer->super_TCreature).ID; + if (uVar2 == uVar4) { + bVar1 = IsInvitedToParty(Guest,uVar2); + if (bVar1) { + return 2; + } + Guest = (this->super_TCreature).ID; + uVar3 = this->PartyLeavingRound; + } + uVar2 = 0; + if (uVar3 == 0) { + uVar2 = this->PartyLeader; + } + if ((Guest == uVar2) && + (bVar1 = IsInvitedToParty((Observer->super_TCreature).ID,Guest), bVar1)) { + return 1; + } + } + return 0; +} + + + +// DWARF original prototype: int RecordTalk(TPlayer * this) + +int __thiscall TPlayer::RecordTalk(TPlayer *this) + +{ + uint uVar1; + uint uVar2; + ulong uVar3; + int iVar4; + + uVar3 = RoundNr; + uVar1 = this->TalkBufferFullTime; + uVar2 = ServerMilliseconds; + if ((ServerMilliseconds < uVar1) && (uVar2 = uVar1, ServerMilliseconds < uVar1 - 0x1d4c)) { + iVar4 = this->NumberOfMutings + 1; + this->NumberOfMutings = iVar4; + iVar4 = iVar4 * iVar4 * 5; + this->MutingEndRound = uVar3 + iVar4; + } + else { + this->TalkBufferFullTime = uVar2 + 0x9c4; + iVar4 = 0; + } + return iVar4; +} + + + +// DWARF original prototype: int RecordMessage(TPlayer * this, ulong Addressee) + +int __thiscall TPlayer::RecordMessage(TPlayer *this,ulong Addressee) + +{ + ulong uVar1; + int i; + int iVar2; + int FreeSlot; + int iVar3; + + uVar1 = RoundNr; + iVar2 = 0; + iVar3 = -1; + do { + if (this->Addressees[iVar2] == Addressee) { + this->AddresseesTimes[iVar2] = RoundNr; + goto LAB_080af797; + } + if ((this->Addressees[iVar2] == 0) || (this->AddresseesTimes[iVar2] < RoundNr - 600)) { + iVar3 = iVar2; + } + iVar2 = iVar2 + 1; + } while (iVar2 < 0x14); + if (iVar3 < 0) { + iVar3 = this->NumberOfMutings + 1; + this->NumberOfMutings = iVar3; + iVar3 = iVar3 * iVar3 * 5; + this->MutingEndRound = uVar1 + iVar3; + } + else { + this->Addressees[iVar3] = Addressee; + this->AddresseesTimes[iVar3] = RoundNr; +LAB_080af797: + iVar3 = 0; + } + return iVar3; +} + + + +// DWARF original prototype: int CheckForMuting(TPlayer * this) + +int __thiscall TPlayer::CheckForMuting(TPlayer *this) + +{ + int iVar1; + + iVar1 = 0; + if (RoundNr < this->MutingEndRound) { + iVar1 = this->MutingEndRound - RoundNr; + } + return iVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitPlayer(void) + +{ + TPlayerData *pTVar1; + + FirstFreePlayer = 0; + pTVar1 = PlayerDataPool; + do { + pTVar1->CharacterID = 0; + pTVar1 = pTVar1 + 1; + } while ((int)pTVar1 < 0x907a435); + // try { // try from 080af836 to 080af83f has its CatchHandler @ 080af842 + CreatePlayerList(true); + InitPlayerIndex(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitPlayer(void) + +{ + ExitPlayerPool(); + CreatePlayerList(false); + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (PlayerList.entry == (TPlayer **)0x0) { + return; + } + operator_delete__(PlayerList.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&PlayerMutex,in_stack_00000008); + return; +} + + + +void __tcf_2(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&PlayerDataPoolMutex,in_stack_00000008); + return; +} + + + +void __tcf_3(void *param_1) + +{ + listnode<> *plVar1; + list<> *plVar2; + listnode<> *plVar3; + + plVar2 = PlayerIndexInternalNodes.Units; + if (PlayerIndexInternalNodes.Units != (list<> *)0x0) { + plVar1 = (PlayerIndexInternalNodes.Units)->firstNode; + while (plVar1 != (listnode<> *)0x0) { + plVar3 = plVar1->prev; + if (plVar3 == (listnode<> *)0x0) { + plVar2->firstNode = plVar1->next; + plVar3 = plVar1->prev; + } + else { + plVar3->next = plVar1->next; + } + if (plVar1->next == (listnode<> *)0x0) { + plVar2->lastNode = plVar3; + } + else { + plVar1->next->prev = plVar3; + } + operator_delete(plVar1); + plVar1 = plVar2->firstNode; + } + operator_delete(plVar2); + return; + } + return; +} + + + +void __tcf_4(void *param_1) + +{ + listnode<> *plVar1; + list<> *plVar2; + listnode<> *plVar3; + + plVar2 = PlayerIndexLeafNodes.Units; + if (PlayerIndexLeafNodes.Units != (list<> *)0x0) { + plVar1 = (PlayerIndexLeafNodes.Units)->firstNode; + while (plVar1 != (listnode<> *)0x0) { + plVar3 = plVar1->prev; + if (plVar3 == (listnode<> *)0x0) { + plVar2->firstNode = plVar1->next; + plVar3 = plVar1->prev; + } + else { + plVar3->next = plVar1->next; + } + if (plVar1->next == (listnode<> *)0x0) { + plVar2->lastNode = plVar3; + } + else { + plVar1->next->prev = plVar3; + } + operator_delete(plVar1); + plVar1 = plVar2->firstNode; + } + operator_delete(plVar2); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_PlayerList(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// WARNING: Variable defined which should be unmapped: extend +// DWARF original prototype: TPlayer * * operator()(vector * this, int i) + +TPlayer ** __thiscall vector::operator()(vector *this,int i) + +{ + TPlayer *pTVar1; + TPlayer **ppTVar2; + int iVar3; + int iVar4; + int j_1; + int j; + int iVar5; + int extend_1; + TPlayer **help; + int extend; + + iVar3 = this->start; + while (i < iVar3) { + help = (TPlayer **)this->block; + if (help == (TPlayer **)0x0) { + ppTVar2 = (TPlayer **)this->space; + help = ppTVar2; + } + else { + ppTVar2 = (TPlayer **)this->space; + } + ppTVar2 = (TPlayer **)operator_new__(((int)help + (int)ppTVar2) * 4); + iVar3 = this->min; + if (this->min <= this->max) { + do { + iVar4 = iVar3 - this->start; + iVar5 = (int)help + iVar4; + pTVar1 = ppTVar2[iVar5]; + ppTVar2[iVar5] = this->entry[iVar4]; + iVar5 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (TPlayer **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start - (int)help; + this->start = iVar3; + this->space = this->space + (int)help; + } + iVar4 = this->space; + iVar5 = iVar4 + iVar3; + while (iVar5 <= i) { + iVar5 = iVar4; + if (this->block != 0) { + iVar5 = this->block; + } + ppTVar2 = (TPlayer **)operator_new__((iVar5 + iVar4) * 4); + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar4 = iVar3 - this->start; + pTVar1 = ppTVar2[iVar4]; + ppTVar2[iVar4] = this->entry[iVar4]; + iVar4 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (TPlayer **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start; + iVar4 = iVar5 + this->space; + this->space = iVar4; + iVar5 = iVar4 + iVar3; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + this->entry[(iVar5 + -1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + this->entry[(iVar5 + 1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar3); +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: TPlayerIndexLeafNode * getFreeItem(store * +// this) + +TPlayerIndexLeafNode * __thiscall store<>::getFreeItem(store<> *this) + +{ + int iVar1; + listnode<> *plVar2; + storeitem<> *psVar3; + storeunit<> *psVar4; + int iVar5; + int local_1c; + storeunit<> *local_18; + int local_14; + int i; + + psVar3 = this->firstFreeItem; + if (psVar3 == (storeitem<> *)0x0) { + plVar2 = list<>::append(this->Units); + local_14 = 0; + local_1c = 0; + iVar5 = 0; + do { + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + local_18 = (storeunit<> *)0x0; + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + local_18 = &plVar2->data; + psVar4 = &plVar2->data; + } + iVar1 = local_1c + 0x170; + local_1c = local_1c + 0x170; + *(int *)((int)local_18->item + iVar5) = (int)psVar4->item + iVar1; + local_14 = local_14 + 1; + iVar5 = iVar5 + 0x170; + } while (local_14 < 99); + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + psVar4 = &plVar2->data; + } + psVar4->item[99].next = (storeitem<> *)0x0; + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar3 = (storeitem<> *)0x0; + } + else { + psVar3 = (plVar2->data).item; + } + this->firstFreeItem = psVar3; + } + this->firstFreeItem = psVar3->next; + return (TPlayerIndexLeafNode *)psVar3; +} + + + +// DWARF original prototype: TPlayerIndexInternalNode * +// getFreeItem(store * this) + +TPlayerIndexInternalNode * __thiscall store<>::getFreeItem(store<> *this) + +{ + int iVar1; + listnode<> *plVar2; + storeitem<> *psVar3; + storeunit<> *psVar4; + int i; + int iVar5; + int local_1c; + int local_18; + storeunit<> *local_14; + + psVar3 = this->firstFreeItem; + if (psVar3 == (storeitem<> *)0x0) { + plVar2 = list<>::append(this->Units); + local_18 = 0; + local_1c = 0; + iVar5 = 0x62; + do { + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + local_14 = (storeunit<> *)0x0; + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + local_14 = &plVar2->data; + psVar4 = &plVar2->data; + } + iVar1 = local_18 + 0x70; + local_18 = local_18 + 0x70; + *(int *)((int)local_14->item + local_1c) = (int)psVar4->item + iVar1; + local_1c = local_1c + 0x70; + iVar5 = iVar5 + -1; + } while (-1 < iVar5); + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + psVar4 = &plVar2->data; + } + psVar4->item[99].next = (storeitem<> *)0x0; + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar3 = (storeitem<> *)0x0; + } + else { + psVar3 = (plVar2->data).item; + } + this->firstFreeItem = psVar3; + } + this->firstFreeItem = psVar3->next; + return (TPlayerIndexInternalNode *)psVar3; +} + + + +// DWARF original prototype: listnode_> * +// append(list_> * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x8fc8); + uVar2 = 0x8fc8; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x8fc4; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +// DWARF original prototype: listnode_> * +// append(list_> * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x2bc8); + uVar2 = 0x2bc8; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x2bc4; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + int i; + int iVar1; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + NonplayerList.initialized = true; + NonplayerList.max = 10000; + NonplayerList.min = 0; + NonplayerList.space = 0x2711; + NonplayerList.init = (TNonplayer *)0x0; + NonplayerList.start = 0; + NonplayerList.block = 1000; + NonplayerList.entry = (TNonplayer **)operator_new__(0x9c44); + iVar1 = 0; + if (0 < NonplayerList.space) { + do { + NonplayerList.entry[iVar1] = (TNonplayer *)0x0; + iVar1 = iVar1 + 1; + } while (iVar1 < NonplayerList.space); + } + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + Monsterhome.initialized = false; + Monsterhome.space = 5000; + Monsterhome.min = 1; + Monsterhome.max = 5000; + Monsterhome.start = 1; + Monsterhome.block = 1000; + Monsterhome.entry = (TMonsterhome *)operator_new__(180000); + __cxa_atexit(__tcf_1,0,&__dso_handle); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TNode * NewNode(void) + +{ + TNode *Node; + TNode *pTVar1; + int in_stack_00000004; + TNode *in_stack_00000008; + TNode *in_stack_0000000c; + + pTVar1 = store::getFreeItem(NodeTable); + pTVar1->Type = in_stack_00000004; + pTVar1->Left = in_stack_00000008; + pTVar1->Right = in_stack_0000000c; + return pTVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TNode * NewNode(void) + +{ + TNode *Node; + TNode *pTVar1; + int in_stack_00000004; + int in_stack_00000008; + + pTVar1 = store::getFreeItem(NodeTable); + pTVar1->Type = in_stack_00000004; + pTVar1->Left = (TNode *)0x0; + pTVar1->Right = (TNode *)0x0; + pTVar1->Data = in_stack_00000008; + return pTVar1; +} + + + +void DeleteNode(TNode *Node) + +{ + store *psVar1; + + if (Node != (TNode *)0x0) { + DeleteNode(Node->Left); + DeleteNode(Node->Right); + psVar1 = NodeTable; + Node->Type = (int)NodeTable->firstFreeItem; + psVar1->firstFreeItem = (storeitem *)Node; + } + return; +} + + + +// DWARF original prototype: bool set(TCondition * this, int Type, void * Data) + +bool __thiscall TCondition::set(TCondition *this,int Type,void *Data) + +{ + ulong uVar1; + int iVar2; + char *pcVar3; + char *pcVar4; + bool bVar5; + + if ((Type != 5) && (Data == (void *)0x0)) { + error("TCondition::set: Data ist NULL.\n"); + this->Type = 0; + return false; + } + this->Type = Type; + bVar5 = Type == 5; + switch(Type) { + default: + error(&DAT_08104a80,Type); + return false; + case 1: + uVar1 = AddDynamicString((char *)Data); + this->Text = uVar1; + break; + case 2: + this->Property = 0; + iVar2 = 8; + pcVar3 = (char *)Data; + pcVar4 = "address"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 1; + } + iVar2 = 5; + pcVar3 = (char *)Data; + pcVar4 = "busy"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 2; + } + iVar2 = 7; + pcVar3 = (char *)Data; + pcVar4 = "vanish"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 3; + } + iVar2 = 5; + pcVar3 = (char *)Data; + pcVar4 = "male"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 4; + } + iVar2 = 7; + pcVar3 = (char *)Data; + pcVar4 = "female"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 5; + } + iVar2 = 7; + pcVar3 = (char *)Data; + pcVar4 = "knight"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 6; + } + iVar2 = 8; + pcVar3 = (char *)Data; + pcVar4 = "paladin"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 7; + } + iVar2 = 9; + pcVar3 = (char *)Data; + pcVar4 = "sorcerer"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 8; + } + iVar2 = 6; + pcVar3 = (char *)Data; + pcVar4 = "druid"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 9; + } + iVar2 = 8; + pcVar3 = (char *)Data; + pcVar4 = "premium"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 10; + } + iVar2 = 9; + pcVar3 = (char *)Data; + pcVar4 = "promoted"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 0xb; + } + iVar2 = 8; + pcVar3 = (char *)Data; + pcVar4 = "pzblock"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 0xc; + } + iVar2 = 7; + pcVar3 = (char *)Data; + pcVar4 = "nonpvp"; + do { + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *pcVar3 == *pcVar4; + pcVar3 = pcVar3 + 1; + pcVar4 = pcVar4 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 0xd; + } + iVar2 = 0xc; + pcVar3 = "pvpenforced"; + do { + // WARNING: Load size is inaccurate + if (iVar2 == 0) break; + iVar2 = iVar2 + -1; + bVar5 = *Data == *pcVar3; + Data = (char *)((int)Data + 1); + pcVar3 = pcVar3 + 1; + } while (bVar5); + if (bVar5) { + this->Property = 0xe; + } + if (this->Property == 0) { + return false; + } + return true; + case 3: + // WARNING: Load size is inaccurate + this->Number = *Data; + break; + case 4: + this->Expression = (TNode *)Data; + break; + case 5: + break; + } + return true; +} + + + +// DWARF original prototype: void clear(TCondition * this) + +void __thiscall TCondition::clear(TCondition *this) + +{ + storeitem *psVar1; + store *psVar2; + int iVar3; + + iVar3 = this->Type; + if ((iVar3 == 4) && + (psVar1 = (storeitem *)this->Expression, psVar1 != (storeitem *)0x0)) { + DeleteNode((psVar1->data).Left); + DeleteNode((psVar1->data).Right); + psVar2 = NodeTable; + psVar1->next = NodeTable->firstFreeItem; + psVar2->firstFreeItem = psVar1; + iVar3 = this->Type; + } + if (iVar3 == 1) { + DeleteDynamicString(this->Text); + } + this->Type = 0; + return; +} + + + +// DWARF original prototype: bool set(TAction * this, int Type, void * Data, void * Data2, void * +// Data3, void * Data4) + +bool __thiscall TAction::set(TAction *this) + +{ + int iVar1; + ulong uVar2; + int in_stack_00000008; + int *in_stack_0000000c; + TNode *in_stack_00000010; + TNode *in_stack_00000014; + TNode *in_stack_00000018; + + this->Type = in_stack_00000008; + switch(in_stack_00000008) { + default: + error(&DAT_08104b00); + return false; + case 1: + uVar2 = AddDynamicString((char *)in_stack_0000000c); + this->Text = uVar2; + break; + case 2: + case 3: + case 5: + iVar1 = *in_stack_0000000c; + this->Expression = in_stack_00000010; + this->Number = iVar1; + break; + case 4: + case 8: + iVar1 = *in_stack_0000000c; + this->Expression2 = in_stack_00000014; + this->Expression = in_stack_00000010; + this->Number = iVar1; + break; + case 6: + case 7: + this->Number = *in_stack_0000000c; + break; + case 9: + break; + case 10: + iVar1 = *in_stack_0000000c; + this->Expression2 = in_stack_00000014; + this->Expression = in_stack_00000010; + this->Number = iVar1; + this->Expression3 = in_stack_00000018; + } + return true; +} + + + +// DWARF original prototype: void clear(TAction * this) + +void __thiscall TAction::clear(TAction *this) + +{ + storeitem *psVar1; + store *psVar2; + int iVar3; + + iVar3 = this->Type; + if ((((iVar3 - 2U < 4) || (iVar3 == 8)) || (iVar3 == 10)) && + (psVar1 = (storeitem *)this->Expression, psVar1 != (storeitem *)0x0)) { + DeleteNode((psVar1->data).Left); + DeleteNode((psVar1->data).Right); + psVar2 = NodeTable; + psVar1->next = NodeTable->firstFreeItem; + psVar2->firstFreeItem = psVar1; + iVar3 = this->Type; + } + if (((iVar3 == 4) || (iVar3 == 8)) || (iVar3 == 10)) { + psVar1 = (storeitem *)this->Expression2; + if (psVar1 != (storeitem *)0x0) { + DeleteNode((psVar1->data).Left); + DeleteNode((psVar1->data).Right); + psVar2 = NodeTable; + psVar1->next = NodeTable->firstFreeItem; + psVar2->firstFreeItem = psVar1; + iVar3 = this->Type; + } + if ((iVar3 == 10) && + (psVar1 = (storeitem *)this->Expression3, psVar1 != (storeitem *)0x0)) { + DeleteNode((psVar1->data).Left); + DeleteNode((psVar1->data).Right); + psVar2 = NodeTable; + psVar1->next = NodeTable->firstFreeItem; + psVar2->firstFreeItem = psVar1; + iVar3 = this->Type; + } + } + if (iVar3 == 1) { + DeleteDynamicString(this->Text); + } + this->Type = 0; + return; +} + + + +// DWARF original prototype: void TBehaviour(TBehaviour * this) + +void __thiscall TBehaviour::TBehaviour(TBehaviour *this) + +{ + vector::vector(&this->Condition,0,5,5); + // try { // try from 080b051d to 080b0521 has its CatchHandler @ 080b0540 + vector::vector(&this->Action,0,5,5); + this->Conditions = 0; + this->Actions = 0; + return; +} + + + +// DWARF original prototype: void TBehaviour(TBehaviour * this) + +void __thiscall TBehaviour::TBehaviour(TBehaviour *this) + +{ + vector::vector(&this->Condition,0,5,5); + // try { // try from 080b05ad to 080b05b1 has its CatchHandler @ 080b05d0 + vector::vector(&this->Action,0,5,5); + this->Conditions = 0; + this->Actions = 0; + return; +} + + + +// DWARF original prototype: void ~TBehaviour(TBehaviour * this, int __in_chrg) + +void __thiscall TBehaviour::~TBehaviour(TBehaviour *this,int __in_chrg) + +{ + TAction *pTVar1; + TCondition *pTVar2; + int i; + int iVar3; + int iVar4; + + iVar3 = 0; + if (0 < this->Conditions) { + do { + iVar4 = iVar3 + 1; + pTVar2 = vector::operator()(&this->Condition,iVar3); + TCondition::clear(pTVar2); + iVar3 = iVar4; + } while (iVar4 < this->Conditions); + } + if (0 < this->Actions) { + iVar3 = 0; + do { + iVar4 = iVar3 + 1; + pTVar1 = vector::operator()(&this->Action,iVar3); + TAction::clear(pTVar1); + iVar3 = iVar4; + } while (iVar4 < this->Actions); + } + pTVar1 = (this->Action).entry; + if (pTVar1 != (TAction *)0x0) { + operator_delete__(pTVar1); + } + pTVar2 = (this->Condition).entry; + if (pTVar2 != (TCondition *)0x0) { + operator_delete__(pTVar2); + return; + } + return; +} + + + +// DWARF original prototype: void ~TBehaviour(TBehaviour * this, int __in_chrg) + +void __thiscall TBehaviour::~TBehaviour(TBehaviour *this,int __in_chrg) + +{ + TAction *pTVar1; + TCondition *pTVar2; + int i; + int iVar3; + int iVar4; + + iVar3 = 0; + if (0 < this->Conditions) { + do { + iVar4 = iVar3 + 1; + pTVar2 = vector::operator()(&this->Condition,iVar3); + TCondition::clear(pTVar2); + iVar3 = iVar4; + } while (iVar4 < this->Conditions); + } + if (0 < this->Actions) { + iVar3 = 0; + do { + iVar4 = iVar3 + 1; + pTVar1 = vector::operator()(&this->Action,iVar3); + TAction::clear(pTVar1); + iVar3 = iVar4; + } while (iVar4 < this->Actions); + } + pTVar1 = (this->Action).entry; + if (pTVar1 != (TAction *)0x0) { + operator_delete__(pTVar1); + } + pTVar2 = (this->Condition).entry; + if (pTVar2 != (TCondition *)0x0) { + operator_delete__(pTVar2); + return; + } + return; +} + + + +// DWARF original prototype: bool addCondition(TBehaviour * this, int Type, void * Data) + +bool __thiscall TBehaviour::addCondition(TBehaviour *this) + +{ + bool bVar1; + TCondition *this_00; + int in_stack_00000008; + void *in_stack_0000000c; + + this_00 = vector::operator()(&this->Condition,this->Conditions); + bVar1 = TCondition::set(this_00,in_stack_00000008,in_stack_0000000c); + if (bVar1) { + this->Conditions = this->Conditions + 1; + } + return bVar1; +} + + + +// DWARF original prototype: bool addAction(TBehaviour * this, int Type, void * Data, void * Data2, +// void * Data3, void * Data4) + +bool __thiscall TBehaviour::addAction(TBehaviour *this) + +{ + bool bVar1; + TAction *this_00; + + this_00 = vector::operator()(&this->Action,this->Actions); + bVar1 = TAction::set(this_00); + if (bVar1) { + this->Actions = this->Actions + 1; + } + return bVar1; +} + + + +// WARNING: Variable defined which should be unmapped: Nr +// DWARF original prototype: void TBehaviourDatabase(TBehaviourDatabase * this, TReadScriptFile * +// Script) + +void __thiscall +TBehaviourDatabase::TBehaviourDatabase(TBehaviourDatabase *this,TReadScriptFile *Script) + +{ + char cVar1; + bool bVar2; + TNode *Node; + TNode *pTVar3; + TNode *pTVar4; + TBehaviour *pTVar5; + TCondition *pTVar6; + TAction *pTVar7; + undefined4 uVar8; + TOKEN TVar9; + int iVar10; + bool Success; + char *pcVar11; + TNode *Right; + char *pcVar12; + undefined1 uVar13; + char *pcVar14; + TNode *local_4c; + TNode *Left_6; + TNode *local_44; + TNode *Left_10; + TNode *Left_8; + TNode *Left_16; + TNode *Left_14; + TNode *Left_12; + TNode *Left_4; + undefined4 local_28; + int Type; + TNode *Left_2; + int Operator; + TNode *Left; + int Data; + int Nr; + + // try { // try from 080b07f7 to 080b07fb has its CatchHandler @ 080b1d30 + vector::vector(&this->Behaviour,0,0x32,0x19); + this->Behaviours = 0; + // try { // try from 080b0815 to 080b0824 has its CatchHandler @ 080b1d20 + TReadScriptFile::readSymbol(Script,'{'); + TReadScriptFile::nextToken(Script); +LAB_080b0825: + TVar9 = Script->Token; + if (TVar9 != SPECIAL) goto LAB_080b0833; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 == '}') { + return; + } + TVar9 = Script->Token; + if (TVar9 != SPECIAL) goto LAB_080b0833; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != 'I') { +LAB_080b0ae0: + TVar9 = Script->Token; +LAB_080b0833: + bVar2 = false; + if (TVar9 == STRING) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pcVar14 = TReadScriptFile::getString(Script); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,1,pcVar14); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + if (TVar9 == IDENTIFIER) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pcVar14 = TReadScriptFile::getIdentifier(Script); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,2,pcVar14); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + if (TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 == '!') { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,5,(void *)0x0); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + else { + TVar9 = Script->Token; + } + if ((TVar9 == SPECIAL) && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '%')) { + Data = TReadScriptFile::readNumber(Script); + if (2 < Data - 1U) { + TReadScriptFile::error(Script,"illegal ordinal number"); + } + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,3,&Data); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + } + } + if (!bVar2) { + // try { // try from 080b0865 to 080b08ad has its CatchHandler @ 080b1bd0 + Operator = (int)readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = (TNode *)Operator; + pTVar4->Right = pTVar3; + Operator = (int)pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b093c; + // try { // try from 080b08cf to 080b0921 has its CatchHandler @ 080b1c4a + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if (Script->Token == SPECIAL) goto LAB_080b094f; + goto LAB_080b093c; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = (TNode *)Operator; + TVar9 = Script->Token; + Operator = (int)pTVar4; + } while( true ); + } + TReadScriptFile::nextToken(Script); + goto LAB_080b0ac1; + } + goto LAB_080b0b09; +LAB_080b093c: + // try { // try from 080b094a to 080b0986 has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,"relational operator expected"); +LAB_080b094f: + Left_2 = (TNode *)0x0; + cVar1 = TReadScriptFile::getSpecial(Script); + switch(cVar1) { + case '<': + Left_2 = (TNode *)0x1; + break; + case '=': + Left_2 = (TNode *)0x3; + break; + case '>': + Left_2 = (TNode *)0x2; + break; + default: + TReadScriptFile::error(Script,"relational operator expected"); + break; + case 'G': + Left_2 = (TNode *)0x6; + break; + case 'L': + Left_2 = (TNode *)0x5; + break; + case 'N': + Left_2 = (TNode *)0x4; + } + TReadScriptFile::nextToken(Script); + // try { // try from 080b0994 to 080b09d9 has its CatchHandler @ 080b1c5b + Type = (int)readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = (TNode *)Type; + pTVar4->Right = pTVar3; + Type = (int)pTVar4; + } + // try { // try from 080b09fb to 080b0a4d has its CatchHandler @ 080b1c70 + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = (TNode *)Type; + TVar9 = Script->Token; + Type = (int)pTVar4; + } + // try { // try from 080b0a68 to 080b0f5a has its CatchHandler @ 080b1d20 + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (int)Left_2; + pTVar3->Left = (TNode *)Operator; + pTVar3->Right = (TNode *)Type; + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,4,pTVar3); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } +LAB_080b0ac1: + if (Script->Token != SPECIAL) goto LAB_080b0af6; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != ',') goto LAB_080b0aea; + TReadScriptFile::nextToken(Script); + goto LAB_080b0ae0; +LAB_080b0aea: + if ((Script->Token != SPECIAL) || (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != 'I')) { +LAB_080b0af6: + TReadScriptFile::error(Script,"\'->\' expected"); + } +LAB_080b0b09: + TReadScriptFile::nextToken(Script); + TVar9 = Script->Token; + if (TVar9 == STRING) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + TReadScriptFile::getString(Script); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + goto LAB_080b0be1; + } + uVar13 = TVar9 == IDENTIFIER; + if ((bool)uVar13) { + pcVar14 = TReadScriptFile::getIdentifier(Script); + local_28 = 0xffffffff; + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "topic"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "price"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "amount"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "type"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "data"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 3; + pcVar11 = pcVar14; + pcVar12 = "hp"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 3; + } + iVar10 = 8; + pcVar11 = pcVar14; + pcVar12 = "burning"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 8; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "poison"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 8; + } + iVar10 = 0xe; + pcVar11 = pcVar14; + pcVar12 = "setquestvalue"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 4; + } + iVar10 = 9; + pcVar11 = pcVar14; + pcVar12 = "effectme"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 10; + pcVar11 = pcVar14; + pcVar12 = "effectopp"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xb; + pcVar11 = pcVar14; + pcVar12 = "profession"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xb; + pcVar11 = pcVar14; + pcVar12 = "teachspell"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "summon"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "create"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "delete"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xc; + pcVar11 = pcVar14; + pcVar12 = "createmoney"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 0xc; + pcVar11 = pcVar14; + pcVar12 = "deletemoney"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "queue"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 9; + pcVar11 = pcVar14; + pcVar12 = "teleport"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 10; + } + iVar10 = 0xe; + pcVar11 = pcVar14; + pcVar12 = "startposition"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 10; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "idle"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 7; + } + iVar10 = 4; + pcVar11 = "nop"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar14 == *pcVar11; + pcVar14 = pcVar14 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar13); + uVar8 = 0; + if (!(bool)uVar13) { + uVar8 = local_28; + } + switch(uVar8) { + case 0: + goto switchD_080b0f21_caseD_0; + default: + pcVar14 = "unknown identifier"; + goto LAB_080b0b38; + case 2: + case 3: + TReadScriptFile::readSymbol(Script,'='); + TReadScriptFile::nextToken(Script); + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + // try { // try from 080b0f68 to 080b0fb0 has its CatchHandler @ 080b1c72 + Left_12 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_12; + pTVar4->Right = pTVar3; + Left_12 = pTVar4; + } + // try { // try from 080b0fd2 to 080b1024 has its CatchHandler @ 080b1c87 + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_12; + TVar9 = Script->Token; + Left_12 = pTVar4; + } + // try { // try from 080b1049 to 080b10cb has its CatchHandler @ 080b1d20 + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + goto LAB_080b0b43; + case 4: + case 8: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b12a9 to 080b12f1 has its CatchHandler @ 080b1cd1 + Left_10 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_10; + pTVar4->Right = pTVar3; + Left_10 = pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b1384; + // try { // try from 080b1313 to 080b1365 has its CatchHandler @ 080b1ce6 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) + goto LAB_080b1397; + goto LAB_080b1384; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_10; + TVar9 = Script->Token; + Left_10 = pTVar4; + } while( true ); + case 5: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + // try { // try from 080b10dc to 080b1124 has its CatchHandler @ 080b1d05 + local_4c = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = local_4c; + pTVar4->Right = pTVar3; + local_4c = pTVar4; + } + // try { // try from 080b1146 to 080b1198 has its CatchHandler @ 080b1c4a + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = local_4c; + TVar9 = Script->Token; + local_4c = pTVar4; + } + // try { // try from 080b11bd to 080b129b has its CatchHandler @ 080b1d20 + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + if ((Script->Token != SPECIAL) || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != ')')) { + TReadScriptFile::error(Script,") expected"); + } + goto LAB_080b0be1; + case 6: + case 7: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + goto LAB_080b0bcc; + case 10: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b1538 to 080b1580 has its CatchHandler @ 080b1c89 + Left_14 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_14; + pTVar4->Right = pTVar3; + Left_14 = pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b1613; + // try { // try from 080b15a2 to 080b15f4 has its CatchHandler @ 080b1c9e + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) + goto LAB_080b1626; + goto LAB_080b1613; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_14; + TVar9 = Script->Token; + Left_14 = pTVar4; + } while( true ); + } + } + if ((TVar9 == SPECIAL) && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '*')) { + iVar10 = this->Behaviours; + if (iVar10 == 0) { + TReadScriptFile::error(Script,"no previous pattern"); + iVar10 = this->Behaviours; + } + pTVar5 = vector::operator()(&this->Behaviour,iVar10); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + goto LAB_080b0bcc; + } + pcVar14 = "illegal action"; +LAB_080b0b38: + TReadScriptFile::error(Script,pcVar14); + goto LAB_080b0b43; +LAB_080b1613: + // try { // try from 080b1621 to 080b1630 has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,", expected"); +LAB_080b1626: + TReadScriptFile::nextToken(Script); + // try { // try from 080b163e to 080b1686 has its CatchHandler @ 080b1ca0 + Left_16 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_16; + pTVar4->Right = pTVar3; + Left_16 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b16a8 to 080b16fa has its CatchHandler @ 080b1cb5 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) goto LAB_080b172c; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_16; + TVar9 = Script->Token; + Left_16 = pTVar4; + } while( true ); + // try { // try from 080b1727 to 080b1736 has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,", expected"); +LAB_080b172c: + TReadScriptFile::nextToken(Script); + // try { // try from 080b1744 to 080b178c has its CatchHandler @ 080b1cb7 + Left_8 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_8; + pTVar4->Right = pTVar3; + Left_8 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b17ae to 080b1800 has its CatchHandler @ 080b1ccc + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b182e; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_8; + TVar9 = Script->Token; + Left_8 = pTVar4; + } while( true ); + // try { // try from 080b1829 to 080b1bb7 has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,") expected"); +LAB_080b182e: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } +switchD_080b0f21_caseD_0: + goto LAB_080b0be1; +LAB_080b1384: + // try { // try from 080b1392 to 080b13a1 has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,", expected"); +LAB_080b1397: + TReadScriptFile::nextToken(Script); + // try { // try from 080b13af to 080b13f7 has its CatchHandler @ 080b1ceb + local_44 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = local_44; + pTVar4->Right = pTVar3; + local_44 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b1419 to 080b146b has its CatchHandler @ 080b1d00 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b1499; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = local_44; + TVar9 = Script->Token; + local_44 = pTVar4; + } while( true ); + // try { // try from 080b1494 to 080b152a has its CatchHandler @ 080b1d20 + TReadScriptFile::error(Script,") expected"); +LAB_080b1499: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); +LAB_080b0bcc: + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } +LAB_080b0be1: + TReadScriptFile::nextToken(Script); +LAB_080b0b43: + if ((Script->Token != SPECIAL) || (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != ',')) + goto LAB_080b0b57; + goto LAB_080b0b09; +LAB_080b0b57: + this->Behaviours = this->Behaviours + 1; + goto LAB_080b0825; +} + + + +// WARNING: Variable defined which should be unmapped: Nr +// DWARF original prototype: void TBehaviourDatabase(TBehaviourDatabase * this, TReadScriptFile * +// Script) + +void __thiscall +TBehaviourDatabase::TBehaviourDatabase(TBehaviourDatabase *this,TReadScriptFile *Script) + +{ + char cVar1; + bool bVar2; + TNode *Node; + TNode *pTVar3; + TNode *pTVar4; + TBehaviour *pTVar5; + TCondition *pTVar6; + TAction *pTVar7; + undefined4 uVar8; + TOKEN TVar9; + int iVar10; + bool Success; + char *pcVar11; + TNode *Right; + char *pcVar12; + undefined1 uVar13; + char *pcVar14; + TNode *local_4c; + TNode *Left_6; + TNode *local_44; + TNode *Left_10; + TNode *Left_8; + TNode *Left_16; + TNode *Left_14; + TNode *Left_12; + TNode *Left_4; + undefined4 local_28; + int Type; + TNode *Left_2; + int Operator; + TNode *Left; + int Data; + int Nr; + + // try { // try from 080b1d77 to 080b1d7b has its CatchHandler @ 080b32b0 + vector::vector(&this->Behaviour,0,0x32,0x19); + this->Behaviours = 0; + // try { // try from 080b1d95 to 080b1da4 has its CatchHandler @ 080b32a0 + TReadScriptFile::readSymbol(Script,'{'); + TReadScriptFile::nextToken(Script); +LAB_080b1da5: + TVar9 = Script->Token; + if (TVar9 != SPECIAL) goto LAB_080b1db3; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 == '}') { + return; + } + TVar9 = Script->Token; + if (TVar9 != SPECIAL) goto LAB_080b1db3; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != 'I') { +LAB_080b2060: + TVar9 = Script->Token; +LAB_080b1db3: + bVar2 = false; + if (TVar9 == STRING) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pcVar14 = TReadScriptFile::getString(Script); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,1,pcVar14); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + if (TVar9 == IDENTIFIER) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pcVar14 = TReadScriptFile::getIdentifier(Script); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,2,pcVar14); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + if (TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 == '!') { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,5,(void *)0x0); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + TVar9 = Script->Token; + } + else { + TVar9 = Script->Token; + } + if ((TVar9 == SPECIAL) && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '%')) { + Data = TReadScriptFile::readNumber(Script); + if (2 < Data - 1U) { + TReadScriptFile::error(Script,"illegal ordinal number"); + } + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,3,&Data); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } + } + } + if (!bVar2) { + // try { // try from 080b1de5 to 080b1e2d has its CatchHandler @ 080b3150 + Operator = (int)readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = (TNode *)Operator; + pTVar4->Right = pTVar3; + Operator = (int)pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b1ebc; + // try { // try from 080b1e4f to 080b1ea1 has its CatchHandler @ 080b31ca + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if (Script->Token == SPECIAL) goto LAB_080b1ecf; + goto LAB_080b1ebc; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = (TNode *)Operator; + TVar9 = Script->Token; + Operator = (int)pTVar4; + } while( true ); + } + TReadScriptFile::nextToken(Script); + goto LAB_080b2041; + } + goto LAB_080b2089; +LAB_080b1ebc: + // try { // try from 080b1eca to 080b1f06 has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,"relational operator expected"); +LAB_080b1ecf: + Left_2 = (TNode *)0x0; + cVar1 = TReadScriptFile::getSpecial(Script); + switch(cVar1) { + case '<': + Left_2 = (TNode *)0x1; + break; + case '=': + Left_2 = (TNode *)0x3; + break; + case '>': + Left_2 = (TNode *)0x2; + break; + default: + TReadScriptFile::error(Script,"relational operator expected"); + break; + case 'G': + Left_2 = (TNode *)0x6; + break; + case 'L': + Left_2 = (TNode *)0x5; + break; + case 'N': + Left_2 = (TNode *)0x4; + } + TReadScriptFile::nextToken(Script); + // try { // try from 080b1f14 to 080b1f59 has its CatchHandler @ 080b31db + Type = (int)readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = (TNode *)Type; + pTVar4->Right = pTVar3; + Type = (int)pTVar4; + } + // try { // try from 080b1f7b to 080b1fcd has its CatchHandler @ 080b31f0 + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = (TNode *)Type; + TVar9 = Script->Token; + Type = (int)pTVar4; + } + // try { // try from 080b1fe8 to 080b24da has its CatchHandler @ 080b32a0 + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (int)Left_2; + pTVar3->Left = (TNode *)Operator; + pTVar3->Right = (TNode *)Type; + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar6 = vector::operator()(&pTVar5->Condition,pTVar5->Conditions); + bVar2 = TCondition::set(pTVar6,4,pTVar3); + if (bVar2) { + pTVar5->Conditions = pTVar5->Conditions + 1; + } +LAB_080b2041: + if (Script->Token != SPECIAL) goto LAB_080b2076; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != ',') goto LAB_080b206a; + TReadScriptFile::nextToken(Script); + goto LAB_080b2060; +LAB_080b206a: + if ((Script->Token != SPECIAL) || (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != 'I')) { +LAB_080b2076: + TReadScriptFile::error(Script,"\'->\' expected"); + } +LAB_080b2089: + TReadScriptFile::nextToken(Script); + TVar9 = Script->Token; + if (TVar9 == STRING) { + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + TReadScriptFile::getString(Script); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + goto LAB_080b2161; + } + uVar13 = TVar9 == IDENTIFIER; + if ((bool)uVar13) { + pcVar14 = TReadScriptFile::getIdentifier(Script); + local_28 = 0xffffffff; + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "topic"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "price"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "amount"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "type"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "data"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 2; + } + iVar10 = 3; + pcVar11 = pcVar14; + pcVar12 = "hp"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 3; + } + iVar10 = 8; + pcVar11 = pcVar14; + pcVar12 = "burning"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 8; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "poison"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 8; + } + iVar10 = 0xe; + pcVar11 = pcVar14; + pcVar12 = "setquestvalue"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 4; + } + iVar10 = 9; + pcVar11 = pcVar14; + pcVar12 = "effectme"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 10; + pcVar11 = pcVar14; + pcVar12 = "effectopp"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xb; + pcVar11 = pcVar14; + pcVar12 = "profession"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xb; + pcVar11 = pcVar14; + pcVar12 = "teachspell"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "summon"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "create"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 7; + pcVar11 = pcVar14; + pcVar12 = "delete"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 5; + } + iVar10 = 0xc; + pcVar11 = pcVar14; + pcVar12 = "createmoney"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 0xc; + pcVar11 = pcVar14; + pcVar12 = "deletemoney"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 6; + pcVar11 = pcVar14; + pcVar12 = "queue"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 6; + } + iVar10 = 9; + pcVar11 = pcVar14; + pcVar12 = "teleport"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 10; + } + iVar10 = 0xe; + pcVar11 = pcVar14; + pcVar12 = "startposition"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 10; + } + iVar10 = 5; + pcVar11 = pcVar14; + pcVar12 = "idle"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar11 == *pcVar12; + pcVar11 = pcVar11 + 1; + pcVar12 = pcVar12 + 1; + } while ((bool)uVar13); + if ((bool)uVar13) { + local_28 = 7; + } + iVar10 = 4; + pcVar11 = "nop"; + do { + if (iVar10 == 0) break; + iVar10 = iVar10 + -1; + uVar13 = *pcVar14 == *pcVar11; + pcVar14 = pcVar14 + 1; + pcVar11 = pcVar11 + 1; + } while ((bool)uVar13); + uVar8 = 0; + if (!(bool)uVar13) { + uVar8 = local_28; + } + switch(uVar8) { + case 0: + goto switchD_080b24a1_caseD_0; + default: + pcVar14 = "unknown identifier"; + goto LAB_080b20b8; + case 2: + case 3: + TReadScriptFile::readSymbol(Script,'='); + TReadScriptFile::nextToken(Script); + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + // try { // try from 080b24e8 to 080b2530 has its CatchHandler @ 080b31f2 + Left_12 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_12; + pTVar4->Right = pTVar3; + Left_12 = pTVar4; + } + // try { // try from 080b2552 to 080b25a4 has its CatchHandler @ 080b3207 + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_12; + TVar9 = Script->Token; + Left_12 = pTVar4; + } + // try { // try from 080b25c9 to 080b264b has its CatchHandler @ 080b32a0 + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + goto LAB_080b20c3; + case 4: + case 8: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b2829 to 080b2871 has its CatchHandler @ 080b3251 + Left_10 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_10; + pTVar4->Right = pTVar3; + Left_10 = pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b2904; + // try { // try from 080b2893 to 080b28e5 has its CatchHandler @ 080b3266 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) + goto LAB_080b2917; + goto LAB_080b2904; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_10; + TVar9 = Script->Token; + Left_10 = pTVar4; + } while( true ); + case 5: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + // try { // try from 080b265c to 080b26a4 has its CatchHandler @ 080b3285 + local_4c = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = local_4c; + pTVar4->Right = pTVar3; + local_4c = pTVar4; + } + // try { // try from 080b26c6 to 080b2718 has its CatchHandler @ 080b31ca + while ((TVar9 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = local_4c; + TVar9 = Script->Token; + local_4c = pTVar4; + } + // try { // try from 080b273d to 080b281b has its CatchHandler @ 080b32a0 + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } + if ((Script->Token != SPECIAL) || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != ')')) { + TReadScriptFile::error(Script,") expected"); + } + goto LAB_080b2161; + case 6: + case 7: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + goto LAB_080b214c; + case 10: + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b2ab8 to 080b2b00 has its CatchHandler @ 080b3209 + Left_14 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_14; + pTVar4->Right = pTVar3; + Left_14 = pTVar4; + } + do { + if (TVar9 != SPECIAL) goto LAB_080b2b93; + // try { // try from 080b2b22 to 080b2b74 has its CatchHandler @ 080b321e + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) + goto LAB_080b2ba6; + goto LAB_080b2b93; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_14; + TVar9 = Script->Token; + Left_14 = pTVar4; + } while( true ); + } + } + if ((TVar9 == SPECIAL) && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '*')) { + iVar10 = this->Behaviours; + if (iVar10 == 0) { + TReadScriptFile::error(Script,"no previous pattern"); + iVar10 = this->Behaviours; + } + pTVar5 = vector::operator()(&this->Behaviour,iVar10); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + goto LAB_080b214c; + } + pcVar14 = "illegal action"; +LAB_080b20b8: + TReadScriptFile::error(Script,pcVar14); + goto LAB_080b20c3; +LAB_080b2b93: + // try { // try from 080b2ba1 to 080b2bb0 has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,", expected"); +LAB_080b2ba6: + TReadScriptFile::nextToken(Script); + // try { // try from 080b2bbe to 080b2c06 has its CatchHandler @ 080b3220 + Left_16 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_16; + pTVar4->Right = pTVar3; + Left_16 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b2c28 to 080b2c7a has its CatchHandler @ 080b3235 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) goto LAB_080b2cac; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_16; + TVar9 = Script->Token; + Left_16 = pTVar4; + } while( true ); + // try { // try from 080b2ca7 to 080b2cb6 has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,", expected"); +LAB_080b2cac: + TReadScriptFile::nextToken(Script); + // try { // try from 080b2cc4 to 080b2d0c has its CatchHandler @ 080b3237 + Left_8 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = Left_8; + pTVar4->Right = pTVar3; + Left_8 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b2d2e to 080b2d80 has its CatchHandler @ 080b324c + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b2dae; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = Left_8; + TVar9 = Script->Token; + Left_8 = pTVar4; + } while( true ); + // try { // try from 080b2da9 to 080b3137 has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,") expected"); +LAB_080b2dae: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } +switchD_080b24a1_caseD_0: + goto LAB_080b2161; +LAB_080b2904: + // try { // try from 080b2912 to 080b2921 has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,", expected"); +LAB_080b2917: + TReadScriptFile::nextToken(Script); + // try { // try from 080b292f to 080b2977 has its CatchHandler @ 080b326b + local_44 = readValue(this,Script); + while (TVar9 = Script->Token, TVar9 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar9 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = local_44; + pTVar4->Right = pTVar3; + local_44 = pTVar4; + } + do { + if (TVar9 != SPECIAL) break; + // try { // try from 080b2999 to 080b29eb has its CatchHandler @ 080b3280 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b2a19; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar3 = readFactor(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = (cVar1 != '+') + 7; + pTVar4->Right = pTVar3; + pTVar4->Left = local_44; + TVar9 = Script->Token; + local_44 = pTVar4; + } while( true ); + // try { // try from 080b2a14 to 080b2aaa has its CatchHandler @ 080b32a0 + TReadScriptFile::error(Script,") expected"); +LAB_080b2a19: + pTVar5 = vector::operator()(&this->Behaviour,this->Behaviours); + pTVar7 = vector::operator()(&pTVar5->Action,pTVar5->Actions); +LAB_080b214c: + bVar2 = TAction::set(pTVar7); + if (bVar2) { + pTVar5->Actions = pTVar5->Actions + 1; + } +LAB_080b2161: + TReadScriptFile::nextToken(Script); +LAB_080b20c3: + if ((Script->Token != SPECIAL) || (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != ',')) + goto LAB_080b20d7; + goto LAB_080b2089; +LAB_080b20d7: + this->Behaviours = this->Behaviours + 1; + goto LAB_080b1da5; +} + + + +// WARNING: Variable defined which should be unmapped: Left +// DWARF original prototype: TNode * readValue(TBehaviourDatabase * this, TReadScriptFile * Script) + +TNode * __thiscall TBehaviourDatabase::readValue(TBehaviourDatabase *this,TReadScriptFile *Script) + +{ + char cVar1; + TNode *Node_1; + TNode *pTVar2; + TNode *pTVar3; + TOKEN TVar4; + int iVar5; + TNode *Left_1; + TNode *Right; + char *pcVar6; + undefined1 uVar7; + char *pcVar8; + TNode *local_2c; + TNode *Node; + TNode *Left_10; + TNode *Left_8; + TNode *Left_6; + TNode *Left_4; + TNode *Left_2; + TNode *Left; + + local_2c = (TNode *)0x0; + TVar4 = Script->Token; + if (TVar4 == NUMBER) { + iVar5 = TReadScriptFile::getNumber(Script); + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xb; +LAB_080b3db2: + local_2c->Data = iVar5; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + goto LAB_080b3310; + } + if ((int)TVar4 < 3) { + uVar7 = TVar4 == IDENTIFIER; + if (!(bool)uVar7) goto LAB_080b3300; + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 6; + pcVar6 = "topic"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xc; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 6; + pcVar6 = "price"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xd; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 7; + pcVar6 = "amount"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xe; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 6; + pcVar6 = "level"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xf; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 9; + pcVar6 = "maglevel"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xf; + local_2c->Data = 1; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 3; + pcVar6 = "hp"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xf; + local_2c->Data = 2; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 8; + pcVar6 = "burning"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xf; + local_2c->Data = 0x12; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 7; + pcVar6 = "poison"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0xf; + local_2c->Data = 0x11; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 6; + pcVar6 = "count"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b347a to 080b34b9 has its CatchHandler @ 080b3de7 + Left_2 = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Left_2; + pTVar3->Right = pTVar2; + Left_2 = pTVar3; + } + // try { // try from 080b34d5 to 080b3522 has its CatchHandler @ 080b3e00 + while ((TVar4 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Left_2; + TVar4 = Script->Token; + Left_2 = pTVar3; + } + // try { // try from 080b353d to 080b360e has its CatchHandler @ 080b3e50 + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x10; + } + else { + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 0xb; + pcVar6 = "countmoney"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x11; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 5; + pcVar6 = "type"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x12; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 5; + pcVar6 = "data"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x13; + local_2c->Data = 0; + local_2c->Left = (TNode *)0x0; + local_2c->Right = (TNode *)0x0; + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 0xb; + pcVar6 = "spellknown"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b3619 to 080b3658 has its CatchHandler @ 080b3e0b + Left_4 = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Left_4; + pTVar3->Right = pTVar2; + Left_4 = pTVar3; + } + // try { // try from 080b3674 to 080b36c1 has its CatchHandler @ 080b3e16 + while ((TVar4 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Left_4; + TVar4 = Script->Token; + Left_4 = pTVar3; + } + // try { // try from 080b36dc to 080b3725 has its CatchHandler @ 080b3e50 + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x14; + Left_2 = Left_4; + } + else { + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 0xb; + pcVar6 = "spelllevel"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b3730 to 080b376f has its CatchHandler @ 080b3e18 + Left_6 = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Left_6; + pTVar3->Right = pTVar2; + Left_6 = pTVar3; + } + // try { // try from 080b378b to 080b37d8 has its CatchHandler @ 080b3e23 + while ((TVar4 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Left_6; + TVar4 = Script->Token; + Left_6 = pTVar3; + } + // try { // try from 080b37f3 to 080b383c has its CatchHandler @ 080b3e50 + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x15; + Left_2 = Left_6; + } + else { + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 7; + pcVar6 = "random"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b3847 to 080b3886 has its CatchHandler @ 080b3e25 + Left_8 = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Left_8; + pTVar3->Right = pTVar2; + Left_8 = pTVar3; + } + do { + if (TVar4 != SPECIAL) goto LAB_080b390b; + // try { // try from 080b38a2 to 080b38ef has its CatchHandler @ 080b3e30 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ',')) + goto LAB_080b391b; + goto LAB_080b390b; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Left_8; + TVar4 = Script->Token; + Left_8 = pTVar3; + } while( true ); + } + pcVar8 = TReadScriptFile::getIdentifier(Script); + iVar5 = 0xb; + pcVar6 = "questvalue"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if (!(bool)uVar7) goto LAB_080b3310; + TReadScriptFile::readSymbol(Script,'('); + TReadScriptFile::nextToken(Script); + // try { // try from 080b3a88 to 080b3ac7 has its CatchHandler @ 080b3e3f + Node = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Node; + pTVar3->Right = pTVar2; + Node = pTVar3; + } + // try { // try from 080b3ae3 to 080b3b30 has its CatchHandler @ 080b3e00 + while ((TVar4 == SPECIAL && + ((cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '+' || + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == '-'))))) { + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Node; + TVar4 = Script->Token; + Node = pTVar3; + } + // try { // try from 080b3b4b to 080b3dde has its CatchHandler @ 080b3e50 + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x17; + Left_2 = Node; + } + } + } + local_2c->Left = Left_2; + local_2c->Right = (TNode *)0x0; + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b3310; + pcVar8 = ") expected"; + } + else { + if (TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '%') { + TReadScriptFile::error(Script,"illegal character"); + } + iVar5 = TReadScriptFile::readNumber(Script); + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 10; + goto LAB_080b3db2; + } +LAB_080b3300: + pcVar8 = "illegal value"; + } + // try { // try from 080b330b to 080b346f has its CatchHandler @ 080b3e50 + TReadScriptFile::error(Script,pcVar8); +LAB_080b3310: + if (local_2c == (TNode *)0x0) { + TReadScriptFile::error(Script,"unknown value"); + } + TReadScriptFile::nextToken(Script); + return local_2c; +LAB_080b390b: + // try { // try from 080b3916 to 080b3922 has its CatchHandler @ 080b3e50 + TReadScriptFile::error(Script,", expected"); +LAB_080b391b: + TReadScriptFile::nextToken(Script); + // try { // try from 080b392d to 080b396c has its CatchHandler @ 080b3e32 + Left_10 = readValue(this,Script); + while (TVar4 = Script->Token, TVar4 == SPECIAL) { + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') { + TVar4 = Script->Token; + break; + } + TReadScriptFile::nextToken(Script); + pTVar2 = readValue(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = 9; + pTVar3->Left = Left_10; + pTVar3->Right = pTVar2; + Left_10 = pTVar3; + } + do { + if (TVar4 != SPECIAL) break; + // try { // try from 080b3988 to 080b39d5 has its CatchHandler @ 080b3e3d + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + if ((Script->Token == SPECIAL) && + (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 == ')')) goto LAB_080b39fd; + break; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + pTVar2 = readFactor(this,Script); + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar2; + pTVar3->Left = Left_10; + TVar4 = Script->Token; + Left_10 = pTVar3; + } while( true ); + // try { // try from 080b39f8 to 080b3a7d has its CatchHandler @ 080b3e50 + TReadScriptFile::error(Script,") expected"); +LAB_080b39fd: + local_2c = store::getFreeItem(NodeTable); + local_2c->Type = 0x16; + local_2c->Left = Left_8; + local_2c->Right = Left_10; + goto LAB_080b3310; +} + + + +// WARNING: Variable defined which should be unmapped: Right +// DWARF original prototype: TNode * readFactor(TBehaviourDatabase * this, TReadScriptFile * Script) + +TNode * __thiscall TBehaviourDatabase::readFactor(TBehaviourDatabase *this,TReadScriptFile *Script) + +{ + char cVar1; + TNode *Node; + TNode *pTVar2; + TNode *pTVar3; + TNode *pTVar4; + TNode *Left; + TNode *Right; + + // try { // try from 080b3e7c to 080b3eb7 has its CatchHandler @ 080b3ed8 + pTVar2 = readValue(this,Script); + while( true ) { + if (Script->Token != SPECIAL) { + return pTVar2; + } + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') break; + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar4 = store::getFreeItem(NodeTable); + pTVar4->Type = 9; + pTVar4->Left = pTVar2; + pTVar4->Right = pTVar3; + pTVar2 = pTVar4; + } + return pTVar2; +} + + + +// WARNING: Variable defined which should be unmapped: Right +// DWARF original prototype: TNode * readTerm(TBehaviourDatabase * this, TReadScriptFile * Script) + +TNode * __thiscall TBehaviourDatabase::readTerm(TBehaviourDatabase *this,TReadScriptFile *Script) + +{ + char cVar1; + char cVar2; + TNode *Node; + TNode *pTVar3; + TNode *pTVar4; + TNode *pTVar5; + TOKEN TVar6; + TNode *pTVar7; + TNode *Left; + TNode *Right_1; + TNode *Left_2; + int Operator; + TNode *Right; + + // try { // try from 080b3f0c to 080b3f49 has its CatchHandler @ 080b4030 + pTVar3 = readValue(this,Script); + while( true ) { + TVar6 = Script->Token; + pTVar4 = pTVar3; + if (TVar6 != SPECIAL) goto LAB_080b3f5d; + cVar1 = TReadScriptFile::getSpecial(Script); + if (cVar1 != '*') break; + TReadScriptFile::nextToken(Script); + pTVar4 = readValue(this,Script); + pTVar5 = store::getFreeItem(NodeTable); + pTVar5->Type = 9; + pTVar5->Left = pTVar3; + pTVar5->Right = pTVar4; + pTVar3 = pTVar5; + } + while( true ) { + TVar6 = Script->Token; + pTVar4 = pTVar3; +LAB_080b3f5d: + if (TVar6 != SPECIAL) break; + // try { // try from 080b3f69 to 080b3fa0 has its CatchHandler @ 080b4048 + cVar1 = TReadScriptFile::getSpecial(Script); + if ((cVar1 != '+') && (cVar1 = TReadScriptFile::getSpecial(Script), cVar1 != '-')) { + return pTVar4; + } + cVar1 = TReadScriptFile::getSpecial(Script); + TReadScriptFile::nextToken(Script); + // try { // try from 080b3fa8 to 080b3fe4 has its CatchHandler @ 080b4030 + pTVar5 = readValue(this,Script); + while ((Script->Token == SPECIAL && + (cVar2 = TReadScriptFile::getSpecial(Script), cVar2 == '*'))) { + TReadScriptFile::nextToken(Script); + pTVar3 = readValue(this,Script); + pTVar7 = store::getFreeItem(NodeTable); + pTVar7->Type = 9; + pTVar7->Left = pTVar5; + pTVar7->Right = pTVar3; + pTVar5 = pTVar7; + } + // try { // try from 080b4001 to 080b4005 has its CatchHandler @ 080b4048 + pTVar3 = store::getFreeItem(NodeTable); + pTVar3->Left = pTVar4; + pTVar3->Type = (cVar1 != '+') + 7; + pTVar3->Right = pTVar5; + } + return pTVar4; +} + + + +// DWARF original prototype: int evaluate(TBehaviourDatabase * this, TNPC * npc, TNode * Node, int * +// Number) + +int __thiscall +TBehaviourDatabase::evaluate(TBehaviourDatabase *this,TNPC *npc,TNode *Node,int *Number) + +{ + TSkill *pTVar1; + bool bVar2; + TPlayer *this_00; + uint uVar3; + int iVar4; + int iVar5; + TPlayer *Opp; + char *pcVar6; + ObjectType local_2c [7]; + + if (Node == (TNode *)0x0) { + pcVar6 = "TBehaviourDatabase::evaluate: Knoten existiert nicht.\n"; +LAB_080b4560: + error(pcVar6); + goto LAB_080b4130; + } + if (Number == (int *)0x0) { + pcVar6 = "TBehaviourDatabase::evaluate: Zahlen existieren nicht.\n"; + goto LAB_080b4560; + } + if (npc == (TNPC *)0x0) { + pcVar6 = "TBehaviourDatabase::evaluate: NPC existiert nicht.\n"; + goto LAB_080b4560; + } + this_00 = GetPlayer(npc->Interlocutor); + if (this_00 == (TPlayer *)0x0) { + pcVar6 = &DAT_08104c40; + goto LAB_080b4560; + } + iVar5 = Node->Type; + switch(iVar5) { + default: + pcVar6 = &DAT_08104b40; + goto LAB_080b412b; + case 1: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar5 < iVar4; + goto LAB_080b4100; + case 2: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar4 < iVar5; + goto LAB_080b4100; + case 3: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar5 == iVar4; + goto LAB_080b4100; + case 4: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar5 == iVar4; + goto LAB_080b41fb; + case 5: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar5 <= iVar4; + goto LAB_080b4100; + case 6: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + bVar2 = iVar4 <= iVar5; + goto LAB_080b4100; + case 7: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + uVar3 = iVar4 + iVar5; + break; + case 8: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + uVar3 = iVar5 - iVar4; + break; + case 9: + iVar5 = evaluate(this,npc,Node->Left,Number); + iVar4 = evaluate(this,npc,Node->Right,Number); + uVar3 = iVar4 * iVar5; + break; + case 10: + iVar5 = Node->Data; + if (iVar5 - 1U < 3) { + if (-1 < Number[iVar5 + -1]) { + return Number[iVar5 + -1]; + } + pcVar6 = "TBehaviourDatabase::evaluate: Zahl-Parameter %d nicht belegt.\n"; + } + else { + pcVar6 = &DAT_08104bc0; + } + goto LAB_080b412b; + case 0xb: + uVar3 = Node->Data; + break; + case 0xc: + uVar3 = npc->Topic; + break; + case 0xd: + uVar3 = npc->Price; + break; + case 0xe: + uVar3 = npc->Amount; + break; + case 0xf: + iVar5 = Node->Data; + if (-1 < iVar5) { + if (iVar5 < 3) { + iVar5 = TSkill::Get((this_00->super_TCreature).super_TSkillBase.Skills[iVar5]); + return iVar5; + } + if (iVar5 - 0x11U < 2) { + pTVar1 = (this_00->super_TCreature).super_TSkillBase.Skills[iVar5]; + iVar5 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + return iVar5; + } + } + pcVar6 = &DAT_08104c00; +LAB_080b412b: + error(pcVar6,iVar5); +LAB_080b4130: + uVar3 = 0; + break; + case 0x10: + iVar5 = evaluate(this,npc,Node->Left,Number); + ObjectType::setTypeID(local_2c,iVar5); + uVar3 = CountInventoryObjects(npc->Interlocutor,local_2c,npc->Data); + break; + case 0x11: + uVar3 = CountInventoryMoney(npc->Interlocutor); + break; + case 0x12: + uVar3 = npc->TypeID; + break; + case 0x13: + uVar3 = npc->Data; + break; + case 0x14: + iVar5 = evaluate(this,npc,Node->Left,Number); + bVar2 = TPlayer::SpellKnown(this_00,iVar5); + bVar2 = !bVar2; +LAB_080b41fb: + bVar2 = !bVar2; +LAB_080b4100: + uVar3 = (uint)bVar2; + break; + case 0x15: + iVar5 = evaluate(this,npc,Node->Left,Number); + uVar3 = GetSpellLevel(iVar5); + break; + case 0x16: + evaluate(this,npc,Node->Right,Number); + evaluate(this,npc,Node->Left,Number); + uVar3 = random(); + break; + case 0x17: + iVar5 = evaluate(this,npc,Node->Left,Number); + uVar3 = TPlayer::GetQuestValue(this_00,iVar5); + } + return uVar3; +} + + + +// DWARF original prototype: void react(TBehaviourDatabase * this, TNPC * npc, char * Text, +// SITUATION Situation) + +void __thiscall +TBehaviourDatabase::react(TBehaviourDatabase *this,TNPC *npc,char *Text,SITUATION Situation) + +{ + char cVar1; + TSkill *pTVar2; + byte bVar3; + uchar uVar4; + RESULT r_1; + TPlayer *this_00; + TBehaviour *pTVar5; + TAction *pTVar6; + size_t sVar7; + ulong uVar8; + TMonster *this_01; + int iVar9; + int iVar10; + int iVar11; + TCondition *pTVar12; + undefined4 uVar13; + uint *puVar14; + uint *puVar15; + RESULT r; + uint uVar16; + uint uVar17; + TPlayer *pTVar18; + int Value3; + TAction *A; + uint uVar19; + int Value; + bool bVar20; + bool bVar21; + char *pcVar22; + char *pcVar23; + ObjectType *Type; + TNPC *pTVar24; + int Crystal; + int Value2; + char *AText; + int j; + TBehaviour *B; + int TalkDelay; + int iStack_1cc; + bool StartToDo; + int j_1; + bool fulfilled; + TBehaviour *B_1; + int i; + int bestPattern; + int maxConditions; + TPlayer *Opp; + int local_1ac; + int local_1a8; + int local_1a4; + int Hour; + int Minute; + char Help [50]; + char acStack_15f [3]; + uint local_15c; + char Response [300]; + int local_2c; + int Numbers [3]; + + if (npc == (TNPC *)0x0) { + pcVar22 = "TBehaviourDatabase::react: NPC existiert nicht.\n"; + } + else { + if (Text != (char *)0x0) { + this_00 = GetPlayer(npc->Interlocutor); + if (this_00 == (TPlayer *)0x0) { + error(&DAT_08105220,Text,Situation); + return; + } + local_2c = -1; + Numbers[0] = -1; + bestPattern = -1; + i = -1; + Numbers[1] = -1; + B_1 = (TBehaviour *)0x0; + if (0 < this->Behaviours) { + do { + pTVar5 = vector::operator()(&this->Behaviour,(int)B_1); + iStack_1cc = 0; + bVar21 = true; + iVar9 = pTVar5->Conditions; + pcVar22 = Text; + if (iVar9 < 1) { +LAB_080b5354: + if ((bVar21) && (bestPattern < iVar9)) { + i = (int)B_1; + bestPattern = iVar9; + } + } + else { + do { + pTVar12 = vector::operator()(&pTVar5->Condition,iStack_1cc); + switch(pTVar12->Type) { + case 1: + pcVar23 = GetDynamicString(pTVar12->Text); + pcVar23 = SearchForWord(pcVar23,pcVar22); + if (pcVar23 == (char *)0x0) { +LAB_080b5379: + bVar21 = false; + } + else { + pcVar22 = GetDynamicString(pTVar12->Text); + sVar7 = strlen(pcVar22); + pcVar22 = pcVar23 + sVar7; + } + break; + case 2: + iVar9 = pTVar12->Property; + if (((iVar9 == 1) && (Situation != ADDRESS)) && + (Situation != ADDRESSQUEUE)) { + bVar21 = false; + } + if ((iVar9 == 2) && (Situation != BUSY)) { + bVar21 = false; + } + if ((iVar9 == 3) && (Situation != VANISH)) { + bVar21 = false; + } + if ((iVar9 == 4) && ((this_00->super_TCreature).Sex != 1)) { + bVar21 = false; + } + if ((iVar9 == 5) && ((this_00->super_TCreature).Sex != 2)) { + bVar21 = false; + } + if (iVar9 == 6) { + uVar4 = TPlayer::GetEffectiveProfession(this_00); + if (uVar4 != '\x01') { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if (iVar9 == 7) { + uVar4 = TPlayer::GetEffectiveProfession(this_00); + if (uVar4 != '\x02') { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if (iVar9 == 8) { + uVar4 = TPlayer::GetEffectiveProfession(this_00); + if (uVar4 != '\x03') { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if (iVar9 == 9) { + uVar4 = TPlayer::GetEffectiveProfession(this_00); + if (uVar4 != '\x04') { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if (iVar9 == 10) { + bVar20 = CheckRight((this_00->super_TCreature).ID, + PREMIUM_ACCOUNT); + if (!bVar20) { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if (iVar9 == 0xb) { + bVar3 = TPlayer::GetRealProfession(this_00); + if (bVar3 < 10) { + bVar21 = false; + } + iVar9 = pTVar12->Property; + } + if ((iVar9 == 0xc) && + ((this_00->super_TCreature).EarliestProtectionZoneRound <= + RoundNr)) { + bVar21 = false; + } + if ((iVar9 == 0xd) && (WorldType != NON_PVP)) { + bVar21 = false; + } + if ((iVar9 == 0xe) && (WorldType != PVP_ENFORCED)) + goto LAB_080b5379; + break; + case 3: + pcVar23 = SearchForNumber(pTVar12->Number,pcVar22); + if (pcVar23 == (char *)0x0) goto LAB_080b5379; + iVar9 = pTVar12->Number; + uVar13 = __strtol_internal(pcVar23,0,10,0); + *(undefined4 *)(Response + iVar9 * 4 + 0x128) = uVar13; + if (500 < *(int *)(Response + pTVar12->Number * 4 + 0x128)) { + pcVar22 = Response + pTVar12->Number * 4 + 0x128; + pcVar22[0] = -0xc; + pcVar22[1] = '\x01'; + pcVar22[2] = '\0'; + pcVar22[3] = '\0'; + } + pcVar22 = pcVar23 + 1; + break; + case 4: + iVar9 = evaluate(this,npc,pTVar12->Expression,&local_2c); + if (iVar9 == 0) goto LAB_080b5379; + break; + case 5: + i = (int)B_1; + goto LAB_080b4622; + } + iStack_1cc = iStack_1cc + 1; + iVar9 = pTVar5->Conditions; + if (iVar9 <= iStack_1cc) goto LAB_080b5354; + } while (bVar21); + } + B_1 = (TBehaviour *)((int)&(B_1->Condition).min + 1); + } while ((int)B_1 < this->Behaviours); + } + if (bestPattern == -1) { + return; + } +LAB_080b4622: + if (Situation != BUSY) { + npc->Topic = 0; + } + bVar21 = false; + B = (TBehaviour *)0x3e8; +LAB_080b4645: + pTVar5 = vector::operator()(&this->Behaviour,i); + AText = (char *)0x0; + if (pTVar5->Actions < 1) { +LAB_080b479b: + if (!bVar21) { + return; + } + TCreature::ToDoWait((TCreature *)npc,(int)B); + TCreature::ToDoStart((TCreature *)npc); + if (Situation == BUSY) { + return; + } + npc->LastTalk = (int)B / 1000 + RoundNr; + return; + } + do { + pTVar24 = (TNPC *)AText; + pTVar6 = vector::operator()(&pTVar5->Action,(int)AText); + switch(pTVar6->Type) { + case 1: + puVar15 = &local_15c; + for (iVar9 = 0x4b; iVar9 != 0; iVar9 = iVar9 + -1) { + *puVar15 = 0; + puVar15 = puVar15 + 1; + } + pcVar22 = GetDynamicString(pTVar6->Text); + for (uVar19 = 0; sVar7 = strlen(pcVar22), uVar19 < sVar7; uVar19 = uVar19 + 1) { + if (pcVar22[uVar19] == '%') { + uVar19 = uVar19 + 1; + cVar1 = pcVar22[uVar19]; + if (cVar1 == 'N') { + strcpy((char *)&Minute,(this_00->super_TCreature).Name); + } + else if (cVar1 < 'O') { + if (cVar1 == 'A') { + iVar9 = npc->Amount; +LAB_080b4856: + sprintf((char *)&Minute,"%d",iVar9); + } + else { +LAB_080b4814: + Minute = Minute & 0xffffff00; + } + } + else { + if (cVar1 == 'P') { + iVar9 = npc->Price; + goto LAB_080b4856; + } + if (cVar1 != 'T') goto LAB_080b4814; + GetTime(&local_1a4,&Hour); + if (local_1a4 < 0xc) { + pcVar23 = "%d:%.2d am"; + } + else { + pcVar23 = "%d:%.2d pm"; + } + sprintf((char *)&Minute,pcVar23,(local_1a4 + 0xb) % 0xc + 1,Hour); + } + strcat((char *)&local_15c,(char *)&Minute); + } + else { + puVar15 = &local_15c; + do { + puVar14 = puVar15; + uVar16 = *puVar14 + 0xfefefeff & ~*puVar14; + uVar17 = uVar16 & 0x80808080; + puVar15 = puVar14 + 1; + } while (uVar17 == 0); + bVar20 = (uVar16 & 0x8080) == 0; + if (bVar20) { + uVar17 = uVar17 >> 0x10; + } + if (bVar20) { + puVar15 = (uint *)((int)puVar14 + 6); + } + acStack_15f + [(int)puVar15 + + (-(int)&local_15c - (uint)CARRY1((byte)uVar17,(byte)uVar17))] = + pcVar22[uVar19]; + } + if (Response[0xfc] != '\0') goto LAB_080b4755; + } + if (Response[0xfc] == '\0') { + TCreature::ToDoWait((TCreature *)npc,(int)B); + TCreature::ToDoTalk((TCreature *)npc); + puVar15 = &local_15c; + do { + puVar14 = puVar15; + uVar17 = *puVar14 + 0xfefefeff & ~*puVar14; + uVar19 = uVar17 & 0x80808080; + puVar15 = puVar14 + 1; + } while (uVar19 == 0); + bVar21 = (uVar17 & 0x8080) == 0; + if (bVar21) { + uVar19 = uVar19 >> 0x10; + } + if (bVar21) { + puVar15 = (uint *)((int)puVar14 + 6); + } + B = (TBehaviour *) + ((int)&B[0x1c].Action + + ((int)puVar15 + + ((-3 - (uint)CARRY1((byte)uVar19,(byte)uVar19)) - (int)&local_15c) >> 1 + ) * 100 + 0x1c); +LAB_080b49eb: + bVar21 = true; + } + else { +LAB_080b4755: + Response[0x10] = '\0'; + puVar15 = &local_15c; + pcVar22 = + "TBehaviourDatabase::react: Text von NPC %s wird zu lang (%s...).\n"; +LAB_080b4779: + error(pcVar22,(npc->super_TNonplayer).super_TCreature.Name,puVar15); + } + break; + case 2: + pTVar24 = npc; + uVar8 = evaluate(this,npc,pTVar6->Expression,&local_2c); + switch(pTVar6->Number) { + default: + pcVar22 = &DAT_08104dc0; + goto LAB_080b4a67; + case 1: + npc->Topic = uVar8; + break; + case 2: + npc->Price = uVar8; + break; + case 3: + npc->Amount = uVar8; + break; + case 4: + npc->TypeID = uVar8; + break; + case 6: + npc->Data = uVar8; + } + break; + case 3: + pTVar24 = npc; + iVar9 = evaluate(this,npc,pTVar6->Expression,&local_2c); + if (pTVar6->Number != 2) { + pcVar22 = &DAT_08104e00; + goto LAB_080b4a67; + } + (*(this_00->super_TCreature).super_TSkillBase.Skills[2]->_vptr_TSkill[2]) + ((this_00->super_TCreature).super_TSkillBase.Skills[2],iVar9); + iVar9 = TSkill::Get((this_00->super_TCreature).super_TSkillBase.Skills[2]); + if (iVar9 < 1) { + error(&DAT_08104e40,(npc->super_TNonplayer).super_TCreature.Name); + (*(this_00->super_TCreature)._vptr_TCreature[2])(this_00); + } + break; + case 4: + iVar9 = evaluate(this,npc,pTVar6->Expression,&local_2c); + pTVar24 = npc; + iVar10 = evaluate(this,npc,pTVar6->Expression2,&local_2c); + if (pTVar6->Number != 3) { + pcVar22 = &DAT_08104e80; + goto LAB_080b4a67; + } + TPlayer::SetQuestValue(this_00,iVar9,iVar10); + break; + case 5: + pTVar24 = npc; + iVar9 = evaluate(this,npc,pTVar6->Expression,&local_2c); + switch(pTVar6->Number) { + default: + pcVar22 = &DAT_08104ec0; + goto LAB_080b4a67; + case 1: + pTVar18 = (TPlayer *)npc; + goto LAB_080b4bb8; + case 2: + pTVar18 = this_00; +LAB_080b4bb8: + Minute = (pTVar18->super_TCreature).CrObject.ObjectID; + GraphicalEffect((Object *)&Minute,iVar9); + break; + case 3: + TPlayer::SetProfession(this_00,(uchar)iVar9); + break; + case 4: + TPlayer::LearnSpell(this_00,iVar9); + break; + case 5: + Opp = (TPlayer *)(npc->super_TNonplayer).super_TCreature.posx; + local_1ac = (npc->super_TNonplayer).super_TCreature.posy; + local_1a8 = (npc->super_TNonplayer).super_TCreature.posz; + if (iVar9 - 1U < 0x1ff) { + if (RaceData[iVar9].Name[0] != '\0') { + SearchFreeField((int *)&Opp,&local_1ac,&local_1a8,2,0,false); + this_01 = (TMonster *)operator_new(0x32c); + // try { // try from 080b4cfc to 080b4d00 has its CatchHandler @ 080b5666 + TMonster::TMonster(this_01); + GraphicalEffect(); + break; + } + pcVar22 = &DAT_08104f00; + } + else { + pcVar22 = &DAT_08104f40; + } + error(pcVar22,iVar9); + break; + case 6: + Type = (ObjectType *)&Minute; + ObjectType::setTypeID((ObjectType *)&Minute,iVar9); + iVar9 = npc->Amount; +LAB_080b4d73: + TNPC::GiveTo(npc,Type,iVar9); + break; + case 7: + ObjectType::setTypeID((ObjectType *)&Minute,iVar9); + iVar9 = npc->Amount; + if (iVar9 != 0) { + pcVar22 = ObjectType::getName((ObjectType *)&Minute); + Log("npc","%s <- %ld: %d %s\n", + (npc->super_TNonplayer).super_TCreature.Name,npc->Interlocutor,iVar9 + ,pcVar22); + // try { // try from 080b4e01 to 080b4e28 has its CatchHandler @ 080b5678 + ObjectType::setTypeID((ObjectType *)(Help + 0xc),Minute); + DeleteAtCreature(npc->Interlocutor,(ObjectType *)(Help + 0xc),iVar9, + npc->Data); + } + } + break; + case 6: + iVar9 = pTVar6->Number; + if (iVar9 != 2) { + if (iVar9 < 3) { + if (iVar9 == 1) { + iVar10 = npc->Price; + iVar9 = iVar10 % 100; + Type = (ObjectType *)(Help + 0xc); + GetSpecialObject((SPECIALMEANING)Type); + TNPC::GiveTo(npc,Type,iVar10 / 10000); + GetSpecialObject((SPECIALMEANING)Type); + TNPC::GiveTo(npc,Type,(iVar10 % 10000) / 100); + GetSpecialObject((SPECIALMEANING)Type); + goto LAB_080b4d73; + } + } + else if (iVar9 == 3) { + if (Situation != BUSY) { + error(&DAT_08104fc0); + } + TNPC::Enqueue(npc,npc->Interlocutor,Text); + break; + } + pcVar22 = &DAT_08104f80; + goto LAB_080b4a67; + } + TNPC::GetMoney(npc,npc->Price); + break; + case 7: + if (!bVar21) { + (npc->super_TNonplayer).State = pTVar6->Number; + if (Situation == ADDRESSQUEUE) { + pcVar22 = + "TBehaviourDatabase::react: NPC %s reagiert nicht auf Anrede %s.\n"; + puVar15 = (uint *)Text; + goto LAB_080b4779; + } + goto LAB_080b49eb; + } + iVar9 = pTVar6->Number; + if (iVar9 == 1) { + (npc->super_TNonplayer).State = LEAVING; + iVar9 = pTVar6->Number; + } + TCreature::ToDoChangeState((TCreature *)npc,iVar9); + break; + case 8: + iVar9 = evaluate(this,npc,pTVar6->Expression,&local_2c); + pTVar24 = npc; + evaluate(this,npc,pTVar6->Expression2,&local_2c); + if (1 < pTVar6->Number - 0x11U) { + pcVar22 = &DAT_08105080; + goto LAB_080b4a67; + } + if ((iVar9 == 0) || + (pTVar2 = (this_00->super_TCreature).super_TSkillBase.Skills[pTVar6->Number], + iVar10 = (*pTVar2->_vptr_TSkill[0xd])(pTVar2), iVar10 < iVar9)) { + TSkillBase::SetTimer(&(this_00->super_TCreature).super_TSkillBase); + if (pTVar6->Number == 0x12) { + (this_00->super_TCreature).FireDamageOrigin = 0; + } + else { + (this_00->super_TCreature).PoisonDamageOrigin = 0; + } + } + break; + case 9: + if (i != 0) goto LAB_080b50d7; + pcVar22 = "TBehaviourDatabase::react (9): Kein vorheriges Muster.\n"; +LAB_080b4a67: + error(pcVar22,pTVar24); + break; + case 10: + iVar9 = evaluate(this,npc,pTVar6->Expression,&local_2c); + iVar10 = evaluate(this,npc,pTVar6->Expression2,&local_2c); + pTVar24 = npc; + iVar11 = evaluate(this,npc,pTVar6->Expression3,&local_2c); + if (pTVar6->Number != 1) { + if (pTVar6->Number == 2) { + pTVar24 = (TNPC *)&DAT_08105140; + print(); + if ((this_00->super_TCreature).Type == PLAYER) { + (this_00->super_TCreature).startx = iVar9; + (this_00->super_TCreature).startz = iVar11; + (this_00->super_TCreature).starty = iVar10; + TPlayer::SaveData(this_00); + break; + } + pcVar22 = &DAT_08105180; + } + else { + pcVar22 = &DAT_08105100; + } + goto LAB_080b4a67; + } + print(); + Help[0xc] = (undefined1)::NONE.ObjectID; + Help[0xd] = ::NONE.ObjectID._1_1_; + Help[0xe] = ::NONE.ObjectID._2_1_; + Help[0xf] = ::NONE.ObjectID._3_1_; + // try { // try from 080b5218 to 080b5265 has its CatchHandler @ 080b56be + GetMapContainer((int)&Minute,iVar9,iVar10); + Help._28_4_ = (this_00->super_TCreature).CrObject.ObjectID; + Move(0,(Object *)(Help + 0x1c),(Object *)&Minute,-1,false,(Object *)(Help + 0xc) + ); + } + AText = AText + 1; + if (pTVar5->Actions <= (int)AText) goto LAB_080b479b; + } while( true ); + } + pcVar22 = &DAT_08105280; + } + error(pcVar22); + return; +LAB_080b50d7: + i = i + -1; + goto LAB_080b4645; +} + + + +void StartMonsterhomeTimer(int nr) + +{ + TMonsterhome *pTVar1; + long lVar2; + int NumberOfPlayers; + TMonsterhome *MH; + int PlayerAdjustedTime; + + if ((nr < 1) || (Monsterhomes < nr)) { + error(&DAT_08105380,nr); + } + else { + pTVar1 = vector<>::operator()(&Monsterhome,nr); + if (0 < pTVar1->Timer) { + error(&DAT_081053c0); + return; + } + if (pTVar1->ActMonsters < pTVar1->MaxMonsters) { + GetNumberOfPlayers(); + lVar2 = random(); + pTVar1->Timer = lVar2; + } + else { + error("StartMonsterhomeTimer: Maximale Monsterzahl schon erreicht.\n"); + error("# Monsterhome mit Rasse %d an [%d,%d,%d]\n",pTVar1->Race,pTVar1->x,pTVar1->y, + pTVar1->z); + } + } + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080b5ba0) +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void LoadMonsterhomes(void) + +{ + bool bVar1; + int r; + int iVar2; + TMonsterhome *pTVar3; + TMonster *this; + int *piVar4; + int Race; + TMonsterhome *MH; + char *Text; + char *pcVar5; + int local_5024; + int j; + int i; + int local_5018; + int local_5014; + int local_5010; + int x; + int y; + int z; + int local_5000; + undefined1 local_4ffc [4]; + TReadScriptFile Script; + char local_101c [4]; + char FileName [4096]; + + // try { // try from 080b5821 to 080b5851 has its CatchHandler @ 080b5c40 + print(); + pcVar5 = DATAPATH; + sprintf(local_101c,"%s/monster.db"); + TReadScriptFile::TReadScriptFile((TReadScriptFile *)local_4ffc); + // try { // try from 080b5859 to 080b5955 has its CatchHandler @ 080b5c33 + TReadScriptFile::open((TReadScriptFile *)local_4ffc,local_101c,(int)pcVar5); + Monsterhomes = 0; + while (iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc), iVar2 != 0) { + Monsterhomes = Monsterhomes + 1; + pTVar3 = vector<>::operator()(&Monsterhome,Monsterhomes); + pTVar3->Race = iVar2; + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->x = iVar2; + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->y = iVar2; + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->z = iVar2; + bVar1 = IsOnMap(pTVar3->x,pTVar3->y,iVar2); + if (!bVar1) { + print(); + } + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->Radius = iVar2; + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->MaxMonsters = iVar2; + pTVar3->ActMonsters = 0; + iVar2 = TReadScriptFile::readNumber((TReadScriptFile *)local_4ffc); + pTVar3->RegenerationTime = iVar2; + pTVar3->Timer = 0; + } + pcVar5 = "%d Monsterhomes geladen.\n"; + print(); + TReadScriptFile::close((TReadScriptFile *)local_4ffc,(int)pcVar5); + j = 1; + if (0 < Monsterhomes) { + do { + pcVar5 = (char *)j; + // try { // try from 080b5994 to 080b5b4d has its CatchHandler @ 080b5c33 + pTVar3 = vector<>::operator()(&Monsterhome,j); + local_5024 = 0; + iVar2 = pTVar3->MaxMonsters; + if (0 < iVar2) { + do { + local_5010 = pTVar3->x; + x = pTVar3->y; + y = pTVar3->z; + if (local_5024 == 0) { + local_5000 = 1; + piVar4 = &local_5000; + if (pTVar3->Radius < 1) { + piVar4 = &pTVar3->Radius; + } + iVar2 = *piVar4; + } + else { + z = 10; + piVar4 = &z; + if (pTVar3->Radius < 10) { + piVar4 = &pTVar3->Radius; + } + iVar2 = -*piVar4; + } + pcVar5 = (char *)&x; + bVar1 = SearchSpawnField(&local_5010,(int *)pcVar5,&y,iVar2,false); + if (bVar1) { + pcVar5 = (char *)pTVar3->Race; + i = local_5010; + local_5018 = x; + local_5014 = y; + if ((int)pcVar5 - 1U < 0x1ff) { + if (RaceData[(int)pcVar5].Name[0] == '\0') { + Text = &DAT_08104f00; + goto LAB_080b5a8b; + } + SearchFreeField(&i,&local_5018,&local_5014,2,0,false); + this = (TMonster *)operator_new(0x32c); + // try { // try from 080b5b91 to 080b5b95 has its CatchHandler @ 080b5c04 + TMonster::TMonster(this); + } + else { + Text = &DAT_08104f40; +LAB_080b5a8b: + error(Text); + } + pTVar3->ActMonsters = pTVar3->ActMonsters + 1; + } + local_5024 = local_5024 + 1; + iVar2 = pTVar3->MaxMonsters; + } while (local_5024 < iVar2); + } + if (pTVar3->Timer < 1) { + if (pTVar3->ActMonsters < iVar2) { + StartMonsterhomeTimer(j); + } + } + else { + pcVar5 = (char *)pTVar3->Race; + error(&DAT_08105500,pcVar5,pTVar3->x,pTVar3->y,pTVar3->z); + } + j = j + 1; + } while (j <= Monsterhomes); + } + // try { // try from 080b5971 to 080b5975 has its CatchHandler @ 080b5c40 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)local_4ffc,(int)pcVar5); + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080b5f11) +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessMonsterhomes(void) + +{ + bool bVar1; + int r; + TMonsterhome *pTVar2; + int iVar3; + int *piVar4; + ulong id; + TCreature *pTVar5; + uint uVar6; + TMonster *this; + int iVar7; + TCreature *cr; + uint uVar8; + TMonsterhome *MH; + int i; + int i_00; + char *Text; + int local_78; + int local_74; + int local_70; + int local_6c; + int x; + int y; + int z; + int local_5c [3]; + int MaxRadius; + undefined1 local_4c [4]; + TFindCreatures Search; + + i_00 = 1; + if (0 < Monsterhomes) { + do { + pTVar2 = vector<>::operator()(&Monsterhome,i_00); + if ((pTVar2->Timer != 0) && + (iVar3 = pTVar2->Timer + -1, pTVar2->Timer = iVar3, iVar3 < 1)) { + local_6c = pTVar2->x; + x = pTVar2->y; + y = pTVar2->z; + MaxRadius = 10; + piVar4 = &MaxRadius; + if (pTVar2->Radius < 10) { + piVar4 = &pTVar2->Radius; + } + local_5c[2] = *piVar4; + iVar3 = 1; + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_4c,local_5c[2] + 9,local_5c[2] + 7,local_6c,x,1); +LAB_080b5d00: + while (id = TFindCreatures::getNext((TFindCreatures *)local_4c), id != 0) { + pTVar5 = GetCreature(id); + if (pTVar5 == (TCreature *)0x0) { + error("ProcessMonsterhomes: Kreatur existiert nicht.\n"); + break; + } + if (pTVar5->posz < 8) goto LAB_080b5d8f; + if ((y - pTVar5->posz) + 2U < 5) goto LAB_080b5d39; + } + if (pTVar2->ActMonsters == 0) { + z = 1; + piVar4 = &z; + if (pTVar2->Radius < 1) { + piVar4 = &pTVar2->Radius; + } + iVar7 = *piVar4; + } + else { + iVar7 = -local_5c[2]; + } + if ((-1 < local_5c[2]) && + (bVar1 = SearchSpawnField(&local_6c,&x,&y,iVar7,false), bVar1)) { + iVar7 = pTVar2->Race; + local_78 = local_6c; + local_74 = x; + local_70 = y; + if (iVar7 - 1U < 0x1ff) { + if (RaceData[iVar7].Name[0] == '\0') { + Text = &DAT_08104f00; + goto LAB_080b5e43; + } + SearchFreeField(&local_78,&local_74,&local_70,2,0,false); + this = (TMonster *)operator_new(0x32c); + iVar3 = i_00; + // try { // try from 080b5f02 to 080b5f06 has its CatchHandler @ 080b5f53 + TMonster::TMonster(this); + } + else { + Text = &DAT_08104f40; +LAB_080b5e43: + error(Text,iVar7); + } + pTVar2->ActMonsters = pTVar2->ActMonsters + 1; + if (0 < pTVar2->Timer) { + error(&DAT_08105580,pTVar2->Race,local_6c,x,y,iVar3); + goto LAB_080b5c95; + } + } + if (pTVar2->ActMonsters < pTVar2->MaxMonsters) { + StartMonsterhomeTimer(i_00); + } + } +LAB_080b5c95: + i_00 = i_00 + 1; + } while (i_00 <= Monsterhomes); + } + return; +LAB_080b5d8f: + if (y < 8) { +LAB_080b5d39: + uVar8 = pTVar5->posx - local_6c; + if (0x7fffffff < uVar8) { + uVar8 = -uVar8; + } + uVar6 = pTVar5->posy - x; + local_5c[1] = uVar8 - 9; + if (0x7fffffff < uVar6) { + uVar6 = -uVar6; + } + local_5c[0] = uVar6 - 7; + piVar4 = local_5c; + if ((int)(uVar6 - 7) <= (int)(uVar8 - 9)) { + piVar4 = local_5c + 1; + } + if (local_5c[2] <= *piVar4) { + piVar4 = local_5c + 2; + } + local_5c[2] = *piVar4; + } + goto LAB_080b5d00; +} + + + +void NotifyMonsterhomeOfDeath(int nr) + +{ + TMonsterhome *pTVar1; + int iVar2; + TMonsterhome *MH; + + if ((nr < 1) || (Monsterhomes < nr)) { + error(&DAT_081055e0,nr); + } + else { + pTVar1 = vector<>::operator()(&Monsterhome,nr); + if (pTVar1->ActMonsters < 1) { + error("NotifyMonsterhomeOfDeath: Monsterhome hat keine lebenden Kreaturen.\n"); + return; + } + iVar2 = pTVar1->ActMonsters + -1; + pTVar1->ActMonsters = iVar2; + if (iVar2 < pTVar1->MaxMonsters) { + if (pTVar1->Timer == 0) { + StartMonsterhomeTimer(nr); + return; + } + } + else { + error("NotifyMonsterhomeOfDeath: Monsterhome %d hatte zu viele Monster (%d statt %d).\n" + ,nr,pTVar1->ActMonsters + 1,pTVar1->MaxMonsters); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool MonsterhomeInRange(void) + +{ + TMonsterhome *pTVar1; + uint uVar2; + TMonsterhome *MH; + bool bVar3; + int in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + bVar3 = true; + if (in_stack_00000004 != 0) { + if ((in_stack_00000004 < 1) || (Monsterhomes < in_stack_00000004)) { + error(&DAT_081056e0); + bVar3 = false; + } + else { + pTVar1 = vector<>::operator()(&Monsterhome,in_stack_00000004); + uVar2 = in_stack_00000010 - pTVar1->z; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + bVar3 = false; + if ((int)uVar2 < 3) { + uVar2 = in_stack_00000008 - pTVar1->x; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + bVar3 = false; + if ((int)uVar2 <= pTVar1->Radius) { + uVar2 = in_stack_0000000c - pTVar1->y; + if (0x7fffffff < uVar2) { + uVar2 = -uVar2; + } + bVar3 = (int)uVar2 <= pTVar1->Radius; + } + } + } + } + return bVar3; +} + + + +// DWARF original prototype: void TNonplayer(TNonplayer * this) + +void __thiscall TNonplayer::TNonplayer(TNonplayer *this) + +{ + TCreature::TCreature(&this->super_TCreature); + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TNonplayer_08127d28; + this->State = SLEEPING; + return; +} + + + +// DWARF original prototype: void TNonplayer(TNonplayer * this) + +void __thiscall TNonplayer::TNonplayer(TNonplayer *this) + +{ + TCreature::TCreature(&this->super_TCreature); + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TNonplayer_08127d28; + this->State = SLEEPING; + return; +} + + + +// DWARF original prototype: void ~TNonplayer(TNonplayer * this, int __in_chrg) + +void __thiscall TNonplayer::~TNonplayer(TNonplayer *this,int __in_chrg) + +{ + TNonplayer **ppTVar1; + TNonplayer **ppTVar2; + int i; + int i_00; + bool bVar3; + int in_stack_ffffffe8; + + i_00 = 0; + bVar3 = 0 < FirstFreeNonplayer; + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TNonplayer_08127d28; + if (bVar3) { + do { + in_stack_ffffffe8 = i_00; + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + if (*ppTVar1 == this) { + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + ppTVar2 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer + -1); + *ppTVar1 = *ppTVar2; + in_stack_ffffffe8 = FirstFreeNonplayer + -1; + ppTVar1 = vector<>::operator()(&NonplayerList,in_stack_ffffffe8); + FirstFreeNonplayer = FirstFreeNonplayer + -1; + *ppTVar1 = (TNonplayer *)0x0; + goto LAB_080b6169; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeNonplayer); + } + error("TNonplayer::DelInList: Kreatur nicht gefunden.\n"); +LAB_080b6169: + TCreature::~TCreature(&this->super_TCreature,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TNonplayer(TNonplayer * this, int __in_chrg) + +void __thiscall TNonplayer::~TNonplayer(TNonplayer *this,int __in_chrg) + +{ + TNonplayer **ppTVar1; + TNonplayer **ppTVar2; + int i; + int i_00; + bool bVar3; + int in_stack_ffffffe8; + + i_00 = 0; + bVar3 = 0 < FirstFreeNonplayer; + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TNonplayer_08127d28; + if (bVar3) { + do { + in_stack_ffffffe8 = i_00; + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + if (*ppTVar1 == this) { + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + ppTVar2 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer + -1); + *ppTVar1 = *ppTVar2; + in_stack_ffffffe8 = FirstFreeNonplayer + -1; + ppTVar1 = vector<>::operator()(&NonplayerList,in_stack_ffffffe8); + FirstFreeNonplayer = FirstFreeNonplayer + -1; + *ppTVar1 = (TNonplayer *)0x0; + goto LAB_080b6219; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeNonplayer); + } + error("TNonplayer::DelInList: Kreatur nicht gefunden.\n"); +LAB_080b6219: + TCreature::~TCreature(&this->super_TCreature,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TNonplayer(TNonplayer * this, int __in_chrg) + +void __thiscall TNonplayer::~TNonplayer(TNonplayer *this,int __in_chrg) + +{ + TNonplayer **ppTVar1; + TNonplayer **ppTVar2; + int i; + int i_00; + bool bVar3; + int in_stack_ffffffe8; + + i_00 = 0; + bVar3 = 0 < FirstFreeNonplayer; + (this->super_TCreature)._vptr_TCreature = (_func_int_varargs **)&PTR__TNonplayer_08127d28; + if (bVar3) { + do { + in_stack_ffffffe8 = i_00; + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + if (*ppTVar1 == this) { + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + ppTVar2 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer + -1); + *ppTVar1 = *ppTVar2; + in_stack_ffffffe8 = FirstFreeNonplayer + -1; + ppTVar1 = vector<>::operator()(&NonplayerList,in_stack_ffffffe8); + FirstFreeNonplayer = FirstFreeNonplayer + -1; + *ppTVar1 = (TNonplayer *)0x0; + goto LAB_080b62c9; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeNonplayer); + } + error("TNonplayer::DelInList: Kreatur nicht gefunden.\n"); +LAB_080b62c9: + TCreature::~TCreature(&this->super_TCreature,in_stack_ffffffe8); + operator_delete(this); + return; +} + + + +// DWARF original prototype: void SetInList(TNonplayer * this) + +void __thiscall TNonplayer::SetInList(TNonplayer *this) + +{ + TNonplayer **ppTVar1; + + TCreature::SetInCrList(&this->super_TCreature); + ppTVar1 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer); + *ppTVar1 = this; + FirstFreeNonplayer = FirstFreeNonplayer + 1; + return; +} + + + +// DWARF original prototype: void DelInList(TNonplayer * this) + +void __thiscall TNonplayer::DelInList(TNonplayer *this) + +{ + TNonplayer **ppTVar1; + TNonplayer **ppTVar2; + int i; + int i_00; + + i_00 = 0; + if (0 < FirstFreeNonplayer) { + do { + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + if (*ppTVar1 == this) { + ppTVar1 = vector<>::operator()(&NonplayerList,i_00); + ppTVar2 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer + -1); + *ppTVar1 = *ppTVar2; + ppTVar1 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer + -1); + *ppTVar1 = (TNonplayer *)0x0; + FirstFreeNonplayer = FirstFreeNonplayer + -1; + return; + } + i_00 = i_00 + 1; + } while (i_00 < FirstFreeNonplayer); + } + error("TNonplayer::DelInList: Kreatur nicht gefunden.\n"); + return; +} + + + +// DWARF original prototype: void TNPC(TNPC * this, char * FileName) + +void __thiscall TNPC::TNPC(TNPC *this,char *FileName) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + bool bVar2; + int GoStrength; + char *pcVar3; + TBehaviourDatabase *this_00; + undefined4 *puVar4; + TOutfit *this_01; + TNonplayer **ppTVar5; + int iVar6; + TSkillBase *this_02; + char *pcVar7; + char *pcVar8; + undefined1 uVar9; + int *__oflag; + int *piVar10; + char local_401c [4]; + char Ident [30]; + TReadScriptFile Script; + + // try { // try from 080b643b to 080b643f has its CatchHandler @ 080b6ae0 + TCreature::TCreature((TCreature *)this); + (this->super_TNonplayer).State = SLEEPING; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TNPC_08127ce8; + // try { // try from 080b6477 to 080b647b has its CatchHandler @ 080b6ad8 + vector<>::vector(&this->QueuedPlayers,0,9,10); + piVar10 = (int *)0xa; + // try { // try from 080b64a5 to 080b64a9 has its CatchHandler @ 080b6ad2 + vector<>::vector(&this->QueuedAddresses,0,9,10); + __oflag = (int *)FileName; + // try { // try from 080b64bd to 080b6560 has its CatchHandler @ 080b6acc + print(); + (this->super_TNonplayer).super_TCreature.Type = NPC; + (this->super_TNonplayer).super_TCreature.Sex = 1; + (this->super_TNonplayer).super_TCreature.Race = 0; + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID = 0; + (this->super_TNonplayer).super_TCreature.Outfit.field_1 = + (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + (this->super_TNonplayer).super_TCreature.posz = 0xff; + this->Behaviour = (TBehaviourDatabase *)0x0; + this->Topic = 0; + this->Amount = 1; + this->Price = 0; + this->TypeID = 0; + this->Data = 0; + (this->super_TNonplayer).super_TCreature.Name[0] = '\0'; + this->LastTalk = 0; + this->QueueLength = 0; + (this->super_TNonplayer).super_TCreature.Direction = 2; + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 080b656e to 080b66f8 has its CatchHandler @ 080b6ac6 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),FileName,(int)__oflag); + while( true ) { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffc004 == 0) break; + uVar9 = stack0xffffc004 == 1; + if (!(bool)uVar9) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"identifier expected"); + } + pcVar3 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy(local_401c,pcVar3); + FileName = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "name"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + pcVar3 = (this->super_TNonplayer).super_TCreature.Name; + uVar9 = pcVar3 == (char *)0x0; + strcpy(pcVar3,FileName); + } + iVar6 = 4; + pcVar3 = local_401c; + pcVar7 = "sex"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + (this->super_TNonplayer).super_TCreature.Sex = 0xff; + iVar6 = 5; + pcVar7 = pcVar3; + pcVar8 = "male"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar7 == *pcVar8; + pcVar7 = pcVar7 + 1; + pcVar8 = pcVar8 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + (this->super_TNonplayer).super_TCreature.Sex = 1; + } + iVar6 = 7; + pcVar7 = "female"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + (this->super_TNonplayer).super_TCreature.Sex = 2; + } + uVar9 = (this->super_TNonplayer).super_TCreature.Sex == 0xff; + if ((bool)uVar9) { + FileName = "unknown constant"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"unknown constant"); + } + } + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "race"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = (char *)TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this_02 = &(this->super_TNonplayer).super_TCreature.super_TSkillBase; + uVar9 = this_02 == (TSkillBase *)0x0; + (this->super_TNonplayer).super_TCreature.Race = (int)FileName; + TSkillBase::SetSkills(this_02,(int)FileName); + } + iVar6 = 7; + pcVar3 = local_401c; + pcVar7 = "outfit"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = Ident + 0x1c; + this_01 = &(this->super_TNonplayer).super_TCreature.Outfit; + uVar9 = this_01 == (TOutfit *)0x0; + TOutfit::load(this_01,(TReadScriptFile *)FileName); + } + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "home"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c)); + piVar10 = &(this->super_TNonplayer).super_TCreature.startz; + __oflag = &(this->super_TNonplayer).super_TCreature.starty; + FileName = (char *)&(this->super_TNonplayer).super_TCreature.startx; + uVar9 = (int *)FileName == (int *)0x0; + TReadScriptFile::getCoordinate((TReadScriptFile *)(Ident + 0x1c)); + } + iVar6 = 7; + pcVar3 = local_401c; + pcVar7 = "radius"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + iVar6 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + (this->super_TNonplayer).super_TCreature.Radius = iVar6; + } + iVar6 = 0xb; + pcVar3 = local_401c; + pcVar7 = "gostrength"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + uVar9 = (this->super_TNonplayer).super_TCreature.Race == 0; + if ((bool)uVar9) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,FileName,__oflag,piVar10); + *puVar4 = "gostrength before race in npc-script-file"; + goto LAB_080b6737; + } + iVar6 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + (this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[4]->Act = iVar6; + (this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[4]->Max = iVar6; + } + iVar6 = 10; + pcVar3 = local_401c; + pcVar7 = "behaviour"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + if (this->Behaviour != (TBehaviourDatabase *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,FileName,__oflag,piVar10); + *puVar4 = "behaviour database specified twice for NPC"; + goto LAB_080b6737; + } + this_00 = (TBehaviourDatabase *)operator_new(0x8c); + FileName = Ident + 0x1c; + // try { // try from 080b670c to 080b6710 has its CatchHandler @ 080b6a60 + TBehaviourDatabase::TBehaviourDatabase(this_00,(TReadScriptFile *)FileName); + this->Behaviour = this_00; + } + } + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)FileName); + if ((this->super_TNonplayer).super_TCreature.Name[0] == '\0') { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no name specified for NPC"; +LAB_080b6737: + // WARNING: Subroutine does not return + // try { // try from 080b674a to 080b696e has its CatchHandler @ 080b6ac6 + __cxa_throw(puVar4,char_const*::typeinfo,0); + } + iVar6 = (this->super_TNonplayer).super_TCreature.posz; + if (iVar6 == 0xff) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no startpoint specified for NPC"; + goto LAB_080b6737; + } + if (this->Behaviour == (TBehaviourDatabase *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no behaviour database specified for NPC"; + goto LAB_080b6737; + } + bVar2 = IsOnMap((this->super_TNonplayer).super_TCreature.posx, + (this->super_TNonplayer).super_TCreature.posy,iVar6); + if (bVar2) { + aVar1 = (this->super_TNonplayer).super_TCreature.Outfit.field_1; + (this->super_TNonplayer).super_TCreature.OrgOutfit.OutfitID = + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID; + (this->super_TNonplayer).super_TCreature.OrgOutfit.field_1 = aVar1; + // try { // try from 080b69b0 to 080b6a0c has its CatchHandler @ 080b6ac6 + TCreature::SetID((TCreature *)this,0); + TCreature::SetInCrList((TCreature *)this); + pcVar3 = (char *)FirstFreeNonplayer; + ppTVar5 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer); + FirstFreeNonplayer = FirstFreeNonplayer + 1; + *ppTVar5 = &this->super_TNonplayer; + bVar2 = TCreature::SetOnMap((TCreature *)this); + if (bVar2) { + TCreature::ToDoYield((TCreature *)this); + goto LAB_080b6978; + } + pcVar3 = "WARNUNG: Kann NPC \'%s\' nicht setzen.\n"; + } + else { + pcVar3 = &DAT_08105800; + } + print(); +LAB_080b6978: + // try { // try from 080b6978 to 080b697c has its CatchHandler @ 080b6acc + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)pcVar3); + return; +} + + + +// DWARF original prototype: void TNPC(TNPC * this, char * FileName) + +void __thiscall TNPC::TNPC(TNPC *this,char *FileName) + +{ + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar1; + bool bVar2; + int GoStrength; + char *pcVar3; + TBehaviourDatabase *this_00; + undefined4 *puVar4; + TOutfit *this_01; + TNonplayer **ppTVar5; + int iVar6; + TSkillBase *this_02; + char *pcVar7; + char *pcVar8; + undefined1 uVar9; + int *__oflag; + int *piVar10; + char local_401c [4]; + char Ident [30]; + TReadScriptFile Script; + + // try { // try from 080b6b0b to 080b6b0f has its CatchHandler @ 080b71b0 + TCreature::TCreature((TCreature *)this); + (this->super_TNonplayer).State = SLEEPING; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TNPC_08127ce8; + // try { // try from 080b6b47 to 080b6b4b has its CatchHandler @ 080b71a8 + vector<>::vector(&this->QueuedPlayers,0,9,10); + piVar10 = (int *)0xa; + // try { // try from 080b6b75 to 080b6b79 has its CatchHandler @ 080b71a2 + vector<>::vector(&this->QueuedAddresses,0,9,10); + __oflag = (int *)FileName; + // try { // try from 080b6b8d to 080b6c30 has its CatchHandler @ 080b719c + print(); + (this->super_TNonplayer).super_TCreature.Type = NPC; + (this->super_TNonplayer).super_TCreature.Sex = 1; + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID = 0; + (this->super_TNonplayer).super_TCreature.Race = 0; + (this->super_TNonplayer).super_TCreature.Outfit.field_1 = + (anon_union_4_2_730cd3ca_for_TOutfit_2)0x0; + (this->super_TNonplayer).super_TCreature.posz = 0xff; + this->Topic = 0; + this->Behaviour = (TBehaviourDatabase *)0x0; + this->Amount = 1; + this->Price = 0; + this->TypeID = 0; + this->Data = 0; + (this->super_TNonplayer).super_TCreature.Name[0] = '\0'; + this->LastTalk = 0; + this->QueueLength = 0; + (this->super_TNonplayer).super_TCreature.Direction = 2; + TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c)); + // try { // try from 080b6c3e to 080b6dc8 has its CatchHandler @ 080b7196 + TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),FileName,(int)__oflag); + while( true ) { + TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c)); + if (stack0xffffc004 == 0) break; + uVar9 = stack0xffffc004 == 1; + if (!(bool)uVar9) { + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"identifier expected"); + } + pcVar3 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c)); + strcpy(local_401c,pcVar3); + FileName = (char *)0x3d; + TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'='); + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "name"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c)); + pcVar3 = (this->super_TNonplayer).super_TCreature.Name; + uVar9 = pcVar3 == (char *)0x0; + strcpy(pcVar3,FileName); + } + iVar6 = 4; + pcVar3 = local_401c; + pcVar7 = "sex"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + pcVar3 = TReadScriptFile::readIdentifier((TReadScriptFile *)(Ident + 0x1c)); + iVar6 = 5; + (this->super_TNonplayer).super_TCreature.Sex = 0xff; + pcVar7 = pcVar3; + pcVar8 = "male"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar7 == *pcVar8; + pcVar7 = pcVar7 + 1; + pcVar8 = pcVar8 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + (this->super_TNonplayer).super_TCreature.Sex = 1; + } + iVar6 = 7; + pcVar7 = "female"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + (this->super_TNonplayer).super_TCreature.Sex = 2; + } + uVar9 = (this->super_TNonplayer).super_TCreature.Sex == 0xff; + if ((bool)uVar9) { + FileName = "unknown constant"; + TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"unknown constant"); + } + } + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "race"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = (char *)TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + this_02 = &(this->super_TNonplayer).super_TCreature.super_TSkillBase; + uVar9 = this_02 == (TSkillBase *)0x0; + (this->super_TNonplayer).super_TCreature.Race = (int)FileName; + TSkillBase::SetSkills(this_02,(int)FileName); + } + iVar6 = 7; + pcVar3 = local_401c; + pcVar7 = "outfit"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + FileName = Ident + 0x1c; + this_01 = &(this->super_TNonplayer).super_TCreature.Outfit; + uVar9 = this_01 == (TOutfit *)0x0; + TOutfit::load(this_01,(TReadScriptFile *)FileName); + } + iVar6 = 5; + pcVar3 = local_401c; + pcVar7 = "home"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c)); + piVar10 = &(this->super_TNonplayer).super_TCreature.startz; + __oflag = &(this->super_TNonplayer).super_TCreature.starty; + FileName = (char *)&(this->super_TNonplayer).super_TCreature.startx; + uVar9 = (int *)FileName == (int *)0x0; + TReadScriptFile::getCoordinate((TReadScriptFile *)(Ident + 0x1c)); + } + iVar6 = 7; + pcVar3 = local_401c; + pcVar7 = "radius"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + iVar6 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + (this->super_TNonplayer).super_TCreature.Radius = iVar6; + } + iVar6 = 0xb; + pcVar3 = local_401c; + pcVar7 = "gostrength"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + uVar9 = (this->super_TNonplayer).super_TCreature.Race == 0; + if ((bool)uVar9) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,FileName,__oflag,piVar10); + *puVar4 = "gostrength before race in npc-script-file"; + goto LAB_080b6e07; + } + iVar6 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c)); + (this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[4]->Act = iVar6; + (this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[4]->Max = iVar6; + } + iVar6 = 10; + pcVar3 = local_401c; + pcVar7 = "behaviour"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar9 = *pcVar3 == *pcVar7; + pcVar3 = pcVar3 + 1; + pcVar7 = pcVar7 + 1; + } while ((bool)uVar9); + if ((bool)uVar9) { + if (this->Behaviour != (TBehaviourDatabase *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,FileName,__oflag,piVar10); + *puVar4 = "behaviour database specified twice for NPC"; + goto LAB_080b6e07; + } + this_00 = (TBehaviourDatabase *)operator_new(0x8c); + FileName = Ident + 0x1c; + // try { // try from 080b6ddc to 080b6de0 has its CatchHandler @ 080b7130 + TBehaviourDatabase::TBehaviourDatabase(this_00,(TReadScriptFile *)FileName); + this->Behaviour = this_00; + } + } + TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)FileName); + if ((this->super_TNonplayer).super_TCreature.Name[0] == '\0') { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no name specified for NPC"; +LAB_080b6e07: + // WARNING: Subroutine does not return + // try { // try from 080b6e1a to 080b703e has its CatchHandler @ 080b7196 + __cxa_throw(puVar4,char_const*::typeinfo,0); + } + iVar6 = (this->super_TNonplayer).super_TCreature.posz; + if (iVar6 == 0xff) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no startpoint specified for NPC"; + goto LAB_080b6e07; + } + if (this->Behaviour == (TBehaviourDatabase *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "no behaviour database specified for NPC"; + goto LAB_080b6e07; + } + bVar2 = IsOnMap((this->super_TNonplayer).super_TCreature.posx, + (this->super_TNonplayer).super_TCreature.posy,iVar6); + if (bVar2) { + aVar1 = (this->super_TNonplayer).super_TCreature.Outfit.field_1; + (this->super_TNonplayer).super_TCreature.OrgOutfit.OutfitID = + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID; + (this->super_TNonplayer).super_TCreature.OrgOutfit.field_1 = aVar1; + // try { // try from 080b7080 to 080b70dc has its CatchHandler @ 080b7196 + TCreature::SetID((TCreature *)this,0); + TCreature::SetInCrList((TCreature *)this); + pcVar3 = (char *)FirstFreeNonplayer; + ppTVar5 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer); + FirstFreeNonplayer = FirstFreeNonplayer + 1; + *ppTVar5 = &this->super_TNonplayer; + bVar2 = TCreature::SetOnMap((TCreature *)this); + if (bVar2) { + TCreature::ToDoYield((TCreature *)this); + goto LAB_080b7048; + } + pcVar3 = "WARNUNG: Kann NPC \'%s\' nicht setzen.\n"; + } + else { + pcVar3 = &DAT_08105800; + } + print(); +LAB_080b7048: + // try { // try from 080b7048 to 080b704c has its CatchHandler @ 080b719c + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)(Ident + 0x1c),(int)pcVar3); + return; +} + + + +// DWARF original prototype: void ~TNPC(TNPC * this, int __in_chrg) + +void __thiscall TNPC::~TNPC(TNPC *this,int __in_chrg) + +{ + TBehaviourDatabase *pTVar1; + TBehaviour *pTVar2; + ulong *puVar3; + TBehaviour *pTVar4; + int in_stack_ffffffe8; + + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TNPC_08127ce8; + pTVar1 = this->Behaviour; + if (pTVar1 != (TBehaviourDatabase *)0x0) { + pTVar4 = (pTVar1->Behaviour).entry; + if (pTVar4 != (TBehaviour *)0x0) { + pTVar4 = pTVar4 + pTVar4[-1].Actions; + while (pTVar2 = (pTVar1->Behaviour).entry, pTVar2 != pTVar4) { + pTVar4 = pTVar4 + -1; + TBehaviour::~TBehaviour(pTVar4,in_stack_ffffffe8); + } + operator_delete__(&pTVar2[-1].Actions); + } + TBehaviour::~TBehaviour(&(pTVar1->Behaviour).init,in_stack_ffffffe8); + operator_delete(pTVar1); + } + puVar3 = (this->QueuedAddresses).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + puVar3 = (this->QueuedPlayers).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TNPC(TNPC * this, int __in_chrg) + +void __thiscall TNPC::~TNPC(TNPC *this,int __in_chrg) + +{ + TBehaviourDatabase *pTVar1; + TBehaviour *pTVar2; + ulong *puVar3; + TBehaviour *pTVar4; + int in_stack_ffffffe8; + + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TNPC_08127ce8; + pTVar1 = this->Behaviour; + if (pTVar1 != (TBehaviourDatabase *)0x0) { + pTVar4 = (pTVar1->Behaviour).entry; + if (pTVar4 != (TBehaviour *)0x0) { + pTVar4 = pTVar4 + pTVar4[-1].Actions; + while (pTVar2 = (pTVar1->Behaviour).entry, pTVar2 != pTVar4) { + pTVar4 = pTVar4 + -1; + TBehaviour::~TBehaviour(pTVar4,in_stack_ffffffe8); + } + operator_delete__(&pTVar2[-1].Actions); + } + TBehaviour::~TBehaviour(&(pTVar1->Behaviour).init,in_stack_ffffffe8); + operator_delete(pTVar1); + } + puVar3 = (this->QueuedAddresses).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + puVar3 = (this->QueuedPlayers).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TNPC(TNPC * this, int __in_chrg) + +void __thiscall TNPC::~TNPC(TNPC *this,int __in_chrg) + +{ + TBehaviourDatabase *pTVar1; + TBehaviour *pTVar2; + ulong *puVar3; + TBehaviour *pTVar4; + int in_stack_ffffffe8; + + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TNPC_08127ce8; + pTVar1 = this->Behaviour; + if (pTVar1 != (TBehaviourDatabase *)0x0) { + pTVar4 = (pTVar1->Behaviour).entry; + if (pTVar4 != (TBehaviour *)0x0) { + pTVar4 = pTVar4 + pTVar4[-1].Actions; + while (pTVar2 = (pTVar1->Behaviour).entry, pTVar2 != pTVar4) { + pTVar4 = pTVar4 + -1; + TBehaviour::~TBehaviour(pTVar4,in_stack_ffffffe8); + } + operator_delete__(&pTVar2[-1].Actions); + } + TBehaviour::~TBehaviour(&(pTVar1->Behaviour).init,in_stack_ffffffe8); + operator_delete(pTVar1); + } + puVar3 = (this->QueuedAddresses).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + puVar3 = (this->QueuedPlayers).entry; + if (puVar3 != (ulong *)0x0) { + operator_delete__(puVar3); + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + operator_delete(this); + return; +} + + + +// DWARF original prototype: void TalkStimulus(TNPC * this, ulong Speaker, char * Text) + +void __thiscall TNPC::TalkStimulus(TNPC *this,ulong Speaker,char *Text) + +{ + ulong uVar1; + uchar Dir; + TCreature *Opp; + TCreature *pTVar2; + int iVar3; + int dy; + int iVar4; + int iVar5; + int iVar6; + + if (Speaker != (this->super_TNonplayer).super_TCreature.ID) { + if (Text == (char *)0x0) { + this = (TNPC *)&DAT_08105920; +LAB_080b757a: + error((char *)this); + return; + } + if (((this->super_TNonplayer).State == TALKING) || (this->QueueLength != 0)) { + uVar1 = this->Interlocutor; + if (Speaker == uVar1) { + this->LastTalk = RoundNr; + TBehaviourDatabase::react(this->Behaviour,this,Text,DEFAULT); + } + else { + this->Interlocutor = Speaker; + TBehaviourDatabase::react(this->Behaviour,this,Text,BUSY); + this->Interlocutor = uVar1; + } + } + else { + TCreature::ToDoClear((TCreature *)this); + (this->super_TNonplayer).State = TALKING; + uVar1 = RoundNr; + this->Interlocutor = Speaker; + this->LastTalk = uVar1; + TBehaviourDatabase::react(this->Behaviour,this,Text,ADDRESS); + if ((this->super_TNonplayer).State == TALKING) { + pTVar2 = GetCreature(this->Interlocutor); + if (pTVar2 != (TCreature *)0x0) { + iVar5 = pTVar2->posx - (this->super_TNonplayer).super_TCreature.posx; + iVar4 = pTVar2->posy - (this->super_TNonplayer).super_TCreature.posy; + iVar3 = -iVar5; + if (-1 < iVar5) { + iVar3 = iVar5; + } + iVar6 = -iVar4; + if (-1 < iVar4) { + iVar6 = iVar4; + } + if (iVar3 < iVar6) { + Dir = ((char)~(byte)((uint)iVar4 >> 0x18) >> 7) * -2; + } + else { + Dir = (char)(iVar5 >> 0x1f) * -2 + '\x01'; + } + TCreature::Rotate((TCreature *)this,Dir); + return; + } + this = (TNPC *)&DAT_081058e0; + goto LAB_080b757a; + } + } + } + return; +} + + + +// DWARF original prototype: void IdleStimulus(TNPC * this) + +void __thiscall TNPC::IdleStimulus(TNPC *this) + +{ + vector<> *this_00; + vector<> *this_01; + uchar Dir; + int dir; + ulong *puVar1; + TCreature *pTVar2; + ulong uVar3; + int iVar4; + ulong *puVar5; + char *Text; + STATE SVar6; + int dy; + int destX; + int iVar7; + int destY; + int iVar8; + int Try; + int iVar9; + undefined1 local_4c [4]; + TFindCreatures Search; + + SVar6 = (this->super_TNonplayer).State; + if (SVar6 == TALKING) { + if (RoundNr <= this->LastTalk + 0x1e) { + TCreature::ToDoWait((TCreature *)this,2000); +LAB_080b7808: + TCreature::ToDoStart((TCreature *)this); + return; + } + TBehaviourDatabase::react(this->Behaviour,this,"",VANISH); + (this->super_TNonplayer).State = IDLE; + SVar6 = IDLE; + } + if (SVar6 == IDLE) { + if (0 < this->QueueLength) { + this_00 = &this->QueuedPlayers; + this_01 = &this->QueuedAddresses; + do { + (this->super_TNonplayer).State = TALKING; + TCreature::ToDoClear((TCreature *)this); + puVar1 = vector<>::operator()(this_00,0); + uVar3 = *puVar1; + this->Interlocutor = uVar3; + pTVar2 = GetCreature(uVar3); + if (pTVar2 == (TCreature *)0x0) { + error(&DAT_08105960); + (this->super_TNonplayer).State = IDLE; + } + else { + puVar1 = vector<>::operator()(this_01,0); + Text = GetDynamicString(*puVar1); + TBehaviourDatabase::react(this->Behaviour,this,Text,ADDRESSQUEUE); + } + puVar1 = vector<>::operator()(this_01,0); + DeleteDynamicString(*puVar1); + iVar9 = this->QueueLength; + iVar7 = 1; + if (1 < iVar9) { + do { + puVar1 = vector<>::operator()(this_00,iVar7 + -1); + puVar5 = vector<>::operator()(this_00,iVar7); + *puVar1 = *puVar5; + puVar1 = vector<>::operator()(this_01,iVar7 + -1); + iVar8 = iVar7 + 1; + puVar5 = vector<>::operator()(this_01,iVar7); + *puVar1 = *puVar5; + iVar9 = this->QueueLength; + iVar7 = iVar8; + } while (iVar8 < iVar9); + } + SVar6 = (this->super_TNonplayer).State; + this->QueueLength = iVar9 + -1; + if (SVar6 == TALKING) { + pTVar2 = GetCreature(this->Interlocutor); + if (pTVar2 == (TCreature *)0x0) { + error(&DAT_081058e0); + } + else { + iVar8 = pTVar2->posx - (this->super_TNonplayer).super_TCreature.posx; + iVar7 = pTVar2->posy - (this->super_TNonplayer).super_TCreature.posy; + iVar9 = -iVar8; + if (-1 < iVar8) { + iVar9 = iVar8; + } + iVar4 = -iVar7; + if (-1 < iVar7) { + iVar4 = iVar7; + } + if (iVar9 < iVar4) { + Dir = ((char)~(byte)((uint)iVar7 >> 0x18) >> 7) * -2; + } + else { + Dir = (char)(iVar8 >> 0x1f) * -2 + '\x01'; + } + TCreature::Rotate((TCreature *)this,Dir); + } + this->LastTalk = RoundNr; + return; + } + } while (0 < iVar9 + -1); + } + if ((this->super_TNonplayer).super_TCreature.LockToDo == false) { + TFindCreatures::TFindCreatures + ((TFindCreatures *)local_4c,10,10,(this->super_TNonplayer).super_TCreature.ID, + 1); + iVar9 = 0; + uVar3 = TFindCreatures::getNext((TFindCreatures *)local_4c); + if (uVar3 == 0) { + (this->super_TNonplayer).State = SLEEPING; + } + else { + do { + iVar9 = iVar9 + 1; + iVar7 = (this->super_TNonplayer).super_TCreature.posx; + iVar8 = (this->super_TNonplayer).super_TCreature.posy; + if (10 < iVar9) { + TCreature::ToDoWait((TCreature *)this,2000); + goto LAB_080b7808; + } + iVar4 = rand(); + iVar4 = iVar4 % 4; + if (iVar4 == 1) { + iVar7 = iVar7 + 1; + } + else if (iVar4 < 2) { + if (iVar4 == 0) { + iVar7 = iVar7 + -1; + } + } + else if (iVar4 == 2) { + iVar8 = iVar8 + -1; + } + else if (iVar4 == 3) { + iVar8 = iVar8 + 1; + } + iVar4 = (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[3]) + (this,iVar7,iVar8, + (this->super_TNonplayer).super_TCreature.posz,1,0); + } while ((char)iVar4 == '\0'); + // try { // try from 080b77aa to 080b77cc has its CatchHandler @ 080b79ac + TCreature::ToDoGo((TCreature *)this,iVar7,iVar8, + (this->super_TNonplayer).super_TCreature.posz,true,0x7fffffff); + TCreature::ToDoWait((TCreature *)this,2000); + TCreature::ToDoStart((TCreature *)this); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: this_local +// DWARF original prototype: void CreatureMoveStimulus(TNPC * this, ulong CreatureID, int Type) + +void __thiscall TNPC::CreatureMoveStimulus(TNPC *this,ulong CreatureID,int Type) + +{ + uchar Dir; + TCreature *Opp; + vector<> *this_00; + ulong *puVar1; + TCreature *pTVar2; + uint uVar3; + ulong uVar4; + TCreature *pTVar5; + int iVar6; + vector<> *this_01; + ulong *puVar7; + int dy; + int iVar8; + int dx; + int iVar9; + TCreature *cr; + int j; + int iVar10; + int local_20; + int i; + int Type_local; + ulong CreatureID_local; + TNPC *this_local; + + if ((0 < this->QueueLength) && (local_20 = 0, 0 < this->QueueLength)) { + this_00 = &this->QueuedPlayers; + do { + puVar1 = vector<>::operator()(this_00,local_20); + if ((CreatureID == *puVar1) || + (CreatureID == (this->super_TNonplayer).super_TCreature.ID)) { + puVar1 = vector<>::operator()(this_00,local_20); + pTVar2 = GetCreature(*puVar1); + if (Type != 0) { + uVar3 = pTVar2->posx - (this->super_TNonplayer).super_TCreature.posx; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if ((int)uVar3 < 5) { + uVar3 = pTVar2->posy - (this->super_TNonplayer).super_TCreature.posy; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if (((int)uVar3 < 4) && + (pTVar2->posz == (this->super_TNonplayer).super_TCreature.posz)) + goto LAB_080b7a5c; + } + } + this_01 = &this->QueuedAddresses; + puVar1 = vector<>::operator()(this_01,local_20); + DeleteDynamicString(*puVar1); + iVar6 = this->QueueLength; + iVar8 = local_20 + 1; + if (local_20 + 1 < iVar6) { + do { + puVar1 = vector<>::operator()(this_00,iVar8 + -1); + puVar7 = vector<>::operator()(this_00,iVar8); + *puVar1 = *puVar7; + puVar1 = vector<>::operator()(this_01,iVar8 + -1); + iVar9 = iVar8 + 1; + puVar7 = vector<>::operator()(this_01,iVar8); + *puVar1 = *puVar7; + iVar6 = this->QueueLength; + iVar8 = iVar9; + } while (iVar9 < iVar6); + } + this->QueueLength = iVar6 + -1; + local_20 = local_20 + -1; + } +LAB_080b7a5c: + local_20 = local_20 + 1; + } while (local_20 < this->QueueLength); + } + if ((this->super_TNonplayer).State - TALKING < 2) { + if ((CreatureID == this->Interlocutor) || + (CreatureID == (this->super_TNonplayer).super_TCreature.ID)) { + pTVar2 = GetCreature(this->Interlocutor); + if (pTVar2 == (TCreature *)0x0) { + error(&DAT_081059e0); + (this->super_TNonplayer).State = IDLE; + goto LAB_080b7ac2; + } + if (Type != 0) { + pTVar5 = GetCreature(this->Interlocutor); + if (pTVar5 == (TCreature *)0x0) { + error(&DAT_081058e0); + } + else { + iVar9 = pTVar5->posx - (this->super_TNonplayer).super_TCreature.posx; + iVar8 = pTVar5->posy - (this->super_TNonplayer).super_TCreature.posy; + iVar6 = -iVar9; + if (-1 < iVar9) { + iVar6 = iVar9; + } + iVar10 = -iVar8; + if (-1 < iVar8) { + iVar10 = iVar8; + } + if (iVar6 < iVar10) { + Dir = ((char)~(byte)((uint)iVar8 >> 0x18) >> 7) * -2; + } + else { + Dir = (char)(iVar9 >> 0x1f) * -2 + '\x01'; + } + TCreature::Rotate((TCreature *)this,Dir); + } + } + if ((this->super_TNonplayer).State != LEAVING) { + if (Type != 0) { + uVar3 = pTVar2->posx - (this->super_TNonplayer).super_TCreature.posx; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if ((int)uVar3 < 5) { + uVar3 = pTVar2->posy - (this->super_TNonplayer).super_TCreature.posy; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if (((int)uVar3 < 4) && + (pTVar2->posz == (this->super_TNonplayer).super_TCreature.posz)) + goto LAB_080b7b9c; + } + } + TBehaviourDatabase::react(this->Behaviour,this,"",VANISH); + (this->super_TNonplayer).State = IDLE; + TCreature::ToDoYield((TCreature *)this); + } + uVar4 = (this->super_TNonplayer).super_TCreature.ID; + goto LAB_080b7b8e; + } + } + else { +LAB_080b7b9c: + uVar4 = (this->super_TNonplayer).super_TCreature.ID; +LAB_080b7b8e: + if (CreatureID == uVar4) { + return; + } + } + if (((this->super_TNonplayer).State != SLEEPING) || (Type == 0)) { + return; + } + (this->super_TNonplayer).State = IDLE; +LAB_080b7ac2: + TCreature::ToDoYield((TCreature *)this); + return; +} + + + +// DWARF original prototype: void DamageStimulus(TNPC * this, ulong param_1, int param_2, int +// param_3) + +void __thiscall TNPC::DamageStimulus(TNPC *this,ulong param_1,int param_2,int param_3) + +{ + return; +} + + + +// DWARF original prototype: bool MovePossible(TNPC * this, int x, int y, int z, bool param_4, bool +// param_5) + +bool __thiscall TNPC::MovePossible(TNPC *this,int x,int y,int z,bool param_4,bool param_5) + +{ + int iVar1; + bool bVar2; + bool bVar3; + uint uVar4; + + bVar3 = false; + // try { // try from 080b7dbd to 080b7e8a has its CatchHandler @ 080b7ea0 + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar3 = CoordinateFlag(); + bVar3 = !bVar3; + } + if ((bVar3) && (bVar3 = CoordinateFlag(), !bVar3)) { + uVar4 = x - (this->super_TNonplayer).super_TCreature.startx; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + iVar1 = (this->super_TNonplayer).super_TCreature.Radius; + if ((int)uVar4 <= iVar1) { + uVar4 = y - (this->super_TNonplayer).super_TCreature.starty; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if (((int)uVar4 <= iVar1) && (z == (this->super_TNonplayer).super_TCreature.startz)) { + bVar3 = IsHouse(x,y,z); + return !bVar3; + } + } + } + return false; +} + + + +// DWARF original prototype: void GiveTo(TNPC * this, ObjectType * Type, int Amount) + +void __thiscall TNPC::GiveTo(TNPC *this,ObjectType *Type,int Amount) + +{ + bool bVar1; + char *pcVar2; + RESULT r; + int i; + int *piVar3; + int iVar4; + int local_44 [2]; + ObjectType local_3c [4]; + ObjectType local_2c [7]; + + if (Amount != 0) { + bVar1 = false; + ObjectType::setTypeID(local_2c,0); + if ((Type->TypeID == local_2c[0].TypeID) || + (pcVar2 = ObjectType::getName(Type), pcVar2 == (char *)0x0)) { + bVar1 = true; + } + if (bVar1) { + error("TNPC::GiveTo: %s will Objekte vom Typ %d erschaffen.\n", + (this->super_TNonplayer).super_TCreature.Name,Type->TypeID); + } + else { + pcVar2 = ObjectType::getName(Type); + Log("npc","%s -> %ld: %d %s\n",(this->super_TNonplayer).super_TCreature.Name, + this->Interlocutor,Amount,pcVar2); + // try { // try from 080b7f85 to 080b8057 has its CatchHandler @ 080b8083 + bVar1 = ObjectType::getFlag(Type,CUMULATIVE); + if (bVar1) { + for (; 0 < Amount; Amount = Amount - *piVar3) { + local_44[1] = 100; + ObjectType::setTypeID(local_3c,Type->TypeID); + CreateAtCreature((ulong)local_2c,(ObjectType *)this->Interlocutor, + (ulong)local_3c); + local_44[0] = 100; + piVar3 = local_44; + if (Amount < 0x65) { + piVar3 = &Amount; + } + } + } + else { + iVar4 = 0; + if (0 < Amount) { + do { + ObjectType::setTypeID(local_2c,Type->TypeID); + CreateAtCreature((ulong)local_3c,(ObjectType *)this->Interlocutor, + (ulong)local_2c); + iVar4 = iVar4 + 1; + } while (iVar4 < Amount); + } + } + } + } + return; +} + + + +// DWARF original prototype: void GetFrom(TNPC * this, ObjectType * Type, int Amount) + +void __thiscall TNPC::GetFrom(TNPC *this,ObjectType *Type,int Amount) + +{ + char *pcVar1; + RESULT r; + ObjectType local_2c [7]; + + if (Amount != 0) { + pcVar1 = ObjectType::getName(Type); + Log("npc","%s <- %ld: %d %s\n",(this->super_TNonplayer).super_TCreature.Name, + this->Interlocutor,Amount,pcVar1); + // try { // try from 080b814f to 080b8176 has its CatchHandler @ 080b8180 + ObjectType::setTypeID(local_2c,Type->TypeID); + DeleteAtCreature(this->Interlocutor,local_2c,Amount,this->Data); + } + return; +} + + + +// DWARF original prototype: void GiveMoney(TNPC * this, int Amount) + +void __thiscall TNPC::GiveMoney(TNPC *this,int Amount) + +{ + int Crystal; + int Platinum; + + GetSpecialObject((SPECIALMEANING)&Platinum); + GiveTo(this,(ObjectType *)&Platinum,Amount / 10000); + GetSpecialObject((SPECIALMEANING)&Platinum); + GiveTo(this,(ObjectType *)&Platinum,(Amount % 10000) / 100); + GetSpecialObject((SPECIALMEANING)&Platinum); + GiveTo(this,(ObjectType *)&Platinum,Amount % 100); + return; +} + + + +// DWARF original prototype: void GetMoney(TNPC * this, int Amount) + +void __thiscall TNPC::GetMoney(TNPC *this,int Amount) + +{ + int local_28; + int Gold; + int Platinum; + int Crystal; + + GetSpecialObject((SPECIALMEANING)&Crystal); + Platinum = CountInventoryObjects(this->Interlocutor,(ObjectType *)&Crystal,0); + GetSpecialObject((SPECIALMEANING)&Crystal); + Gold = CountInventoryObjects(this->Interlocutor,(ObjectType *)&Crystal,0); + GetSpecialObject((SPECIALMEANING)&Crystal); + local_28 = CountInventoryObjects(this->Interlocutor,(ObjectType *)&Crystal,0); + CalculateChange(Amount,&local_28,&Gold,&Platinum); + if (0 < local_28) { + GetSpecialObject((SPECIALMEANING)&Crystal); + GetFrom(this,(ObjectType *)&Crystal,local_28); + } + if (0 < Gold) { + GetSpecialObject((SPECIALMEANING)&Crystal); + GetFrom(this,(ObjectType *)&Crystal,Gold); + } + if (0 < Platinum) { + GetSpecialObject((SPECIALMEANING)&Crystal); + GetFrom(this,(ObjectType *)&Crystal,Platinum); + } + if (local_28 < 0) { + GetSpecialObject((SPECIALMEANING)&Crystal); + GiveTo(this,(ObjectType *)&Crystal,-local_28); + } + if (Gold < 0) { + GetSpecialObject((SPECIALMEANING)&Crystal); + GiveTo(this,(ObjectType *)&Crystal,-Gold); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Interlocutor_local +// DWARF original prototype: void Enqueue(TNPC * this, ulong Interlocutor, char * Text) + +void __thiscall TNPC::Enqueue(TNPC *this,ulong Interlocutor,char *Text) + +{ + ulong *puVar1; + int i_00; + ulong uVar2; + int i; + int i_01; + char *Text_local; + ulong Interlocutor_local; + + if (Interlocutor == 0) { + this = (TNPC *)&DAT_08105ac0; + } + else { + if (Text != (char *)0x0) { + i_00 = this->QueueLength; + i_01 = 0; + if (0 < i_00) { + do { + puVar1 = vector<>::operator()(&this->QueuedPlayers,i_01); + if (*puVar1 == Interlocutor) { + return; + } + i_00 = this->QueueLength; + i_01 = i_01 + 1; + } while (i_01 < i_00); + } + puVar1 = vector<>::operator()(&this->QueuedPlayers,i_00); + *puVar1 = Interlocutor; + uVar2 = AddDynamicString(Text); + puVar1 = vector<>::operator()(&this->QueuedAddresses,this->QueueLength); + *puVar1 = uVar2; + this->QueueLength = this->QueueLength + 1; + return; + } + this = (TNPC *)s_TNPC__Enqueue__Text_ist_NULL__08105aa0; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: void TurnToInterlocutor(TNPC * this) + +void __thiscall TNPC::TurnToInterlocutor(TNPC *this) + +{ + uchar Dir; + TCreature *Opp; + TCreature *pTVar1; + int iVar2; + int dy; + int iVar3; + int iVar4; + int dx; + int iVar5; + + pTVar1 = GetCreature(this->Interlocutor); + if (pTVar1 != (TCreature *)0x0) { + iVar5 = pTVar1->posx - (this->super_TNonplayer).super_TCreature.posx; + iVar3 = pTVar1->posy - (this->super_TNonplayer).super_TCreature.posy; + iVar4 = -iVar5; + if (-1 < iVar5) { + iVar4 = iVar5; + } + iVar2 = -iVar3; + if (-1 < iVar3) { + iVar2 = iVar3; + } + if (iVar4 < iVar2) { + Dir = ((char)~(byte)((uint)iVar3 >> 0x18) >> 7) * -2; + } + else { + Dir = (char)(iVar5 >> 0x1f) * -2 + '\x01'; + } + TCreature::Rotate((TCreature *)this,Dir); + return; + } + error(&DAT_081058e0); + return; +} + + + +// DWARF original prototype: void ChangeState(TNPC * this, STATE NewState, bool Stimulus) + +void __thiscall TNPC::ChangeState(TNPC *this,STATE NewState,bool Stimulus) + +{ + (this->super_TNonplayer).State = NewState; + if (!Stimulus) { + return; + } + TCreature::ToDoYield((TCreature *)this); + return; +} + + + +void ChangeNPCState(TCreature *npc,int NewState,bool Stimulus) + +{ + if (npc == (TCreature *)0x0) { + npc = (TCreature *)s_ChangeNPCState__npc_ist_NULL__08105b40; + } + else { + if (npc->Type == NPC) { + npc[1]._vptr_TCreature = (_func_int_varargs **)NewState; + if (!Stimulus) { + return; + } + TCreature::ToDoYield(npc); + return; + } + npc = (TCreature *)s_ChangeNPCState__npc_ist_kein_NPC_08105b00; + } + error((char *)npc); + return; +} + + + +// DWARF original prototype: void TMonster(TMonster * this, int Race, int x, int y, int z, int Home, +// ulong Father) + +void __thiscall TMonster::TMonster(TMonster *this) + +{ + int iVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + TCreature *pTVar4; + TNonplayer **ppTVar5; + TItemData *this_00; + long lVar6; + long lVar7; + TCombat *this_01; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + ulong in_stack_0000001c; + char *Text; + Object *this_02; + int local_88; + int j; + int Repeat; + int i; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Obj; + ulong local_3c [4]; + Object local_2c; + Object Bag; + + TCreature::TCreature((TCreature *)this); + (this->super_TNonplayer).super_TCreature.Type = MONSTER; + (this->super_TNonplayer).State = IDLE; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TMonster_08127ca8; + (this->super_TNonplayer).super_TCreature.Race = in_stack_00000008; + (this->super_TNonplayer).super_TCreature.startx = in_stack_0000000c; + (this->super_TNonplayer).super_TCreature.posx = in_stack_0000000c; + this->Home = in_stack_00000018; + (this->super_TNonplayer).super_TCreature.starty = in_stack_00000010; + (this->super_TNonplayer).super_TCreature.posy = in_stack_00000010; + (this->super_TNonplayer).super_TCreature.startz = in_stack_00000014; + (this->super_TNonplayer).super_TCreature.posz = in_stack_00000014; + this->Target = 0; + this->Master = in_stack_0000001c; + do { + if (this->Master == 0) { +LAB_080b873a: + if (RaceData[in_stack_00000008].Article[0] == '\0') { + strcpy((this->super_TNonplayer).super_TCreature.Name, + RaceData[in_stack_00000008].Name); + } + else { + snprintf((this->super_TNonplayer).super_TCreature.Name,0x1e,"%s %s", + in_stack_00000008 * 0x150 + 0x81c477e,RaceData + in_stack_00000008); + } + TSkillBase::SetSkills + (&(this->super_TNonplayer).super_TCreature.super_TSkillBase,in_stack_00000008) + ; + iVar1 = RaceData[in_stack_00000008].Outfit.OutfitID; + aVar2 = RaceData[in_stack_00000008].Outfit.field_1; + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID = iVar1; + (this->super_TNonplayer).super_TCreature.Outfit.field_1 = aVar2; + (this->super_TNonplayer).super_TCreature.OrgOutfit.OutfitID = iVar1; + (this->super_TNonplayer).super_TCreature.OrgOutfit.field_1 = aVar2; + TCreature::SetID((TCreature *)this,0); + TCreature::SetInCrList((TCreature *)this); + ppTVar5 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer); + FirstFreeNonplayer = FirstFreeNonplayer + 1; + *ppTVar5 = &this->super_TNonplayer; + bVar3 = TCreature::SetOnMap((TCreature *)this); + if (bVar3) { + if ((this->Master == 0) && (0 < RaceData[in_stack_00000008].Items)) { + // try { // try from 080b8836 to 080b8904 has its CatchHandler @ 080b8c3e + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)&local_4c,(this->super_TNonplayer).super_TCreature.ID); + Create(&local_2c,(ObjectType *)&local_4c,(ulong)local_3c); + Repeat = 1; + if (0 < RaceData[in_stack_00000008].Items) { + do { + this_00 = vector::operator() + (&RaceData[in_stack_00000008].Item,Repeat); + lVar6 = random(); + if (lVar6 <= this_00->Probability) { + lVar7 = random(); + j = 1; + bVar3 = ObjectType::getFlag(&this_00->Type,CUMULATIVE); + lVar6 = lVar7; + if (!bVar3) { + lVar6 = 0; + j = lVar7; + } + local_88 = 0; + if (0 < j) { + do { + local_4c.ObjectID = 0; + bVar3 = ObjectType::getFlag(&this_00->Type,WEAPON); + if (((((bVar3) || + (bVar3 = ObjectType::getFlag(&this_00->Type,SHIELD), + bVar3)) || + (bVar3 = ObjectType::getFlag(&this_00->Type,BOW), bVar3 + )) || ((bVar3 = ObjectType::getFlag(&this_00->Type, + THROW), bVar3 || + (bVar3 = ObjectType::getFlag(&this_00->Type,WAND + ), bVar3)))) || + ((bVar3 = ObjectType::getFlag(&this_00->Type,WEAROUT), + bVar3 || ((bVar3 = ObjectType::getFlag(&this_00->Type, + EXPIRE), bVar3 || + (bVar3 = ObjectType::getFlag(&this_00->Type, + EXPIRESTOP), + bVar3)))))) { + // try { // try from 080b8a02 to 080b8a2d has its CatchHandler @ 080b8bd5 + ObjectType::setTypeID + ((ObjectType *)local_6c,(this_00->Type).TypeID + ); + lVar7 = 0; + this_02 = local_6c; + i = local_2c.ObjectID; + Create(local_5c,(ObjectType *)&i,(ulong)this_02); + local_4c.ObjectID = local_5c[0].ObjectID; + local_3c[0] = local_5c[0].ObjectID; + } + else { + this_02 = local_5c; + ObjectType::setTypeID + ((ObjectType *)this_02,(this_00->Type).TypeID) + ; + lVar7 = lVar6; + CreateAtCreature((ulong)local_6c, + (ObjectType *) + (this->super_TNonplayer). + super_TCreature.ID,(ulong)this_02); + i = local_6c[0].ObjectID; + local_4c.ObjectID = i; + } + // try { // try from 080b8a44 to 080b8b6d has its CatchHandler @ 080b8c3e + Object::getContainer((Object *)&i); + Object::getObjectType(local_6c); + if (local_6c[0].ObjectID == 0) { + error(&DAT_08105bc0,in_stack_00000008,this_02,lVar7); + local_6c[0].ObjectID = local_4c.ObjectID; + Delete(local_6c,-1); + } + local_88 = local_88 + 1; + } while (local_88 < j); + } + } + Repeat = Repeat + 1; + } while (Repeat <= RaceData[in_stack_00000008].Items); + } + local_6c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject((Object *)&i); + local_5c[0].ObjectID = ::NONE.ObjectID; + if (i == ::NONE.ObjectID) { + local_4c.ObjectID = local_2c.ObjectID; + // try { // try from 080b8970 to 080b89ed has its CatchHandler @ 080b8c3e + Delete(&local_4c,-1); + } + } + this_01 = &(this->super_TNonplayer).super_TCreature.Combat; + // try { // try from 080b8921 to 080b8953 has its CatchHandler @ 080b8c50 + TCombat::CheckCombatValues(this_01); + TCombat::SetAttackMode(this_01,'\x02'); + TCreature::ToDoWait((TCreature *)this,0); + TCreature::ToDoStart((TCreature *)this); + } + else { + Text = "TMonster::TMonster: Kann Monster nicht auf die Karte setzen.\n"; +LAB_080b8b89: + // try { // try from 080b8b89 to 080b8b8d has its CatchHandler @ 080b8c50 + error(Text); + } + return; + } + // try { // try from 080b86e6 to 080b87f7 has its CatchHandler @ 080b8c50 + pTVar4 = GetCreature(this->Master); + if (pTVar4 == (TCreature *)0x0) { + Text = "TMonster::TMonster: Master existiert nicht.\n"; + goto LAB_080b8b89; + } + if ((pTVar4->Type != MONSTER) || (pTVar4[1].super_TSkillBase.Skills[1] == (TSkill *)0x0)) { + pTVar4->SummonedCreatures = pTVar4->SummonedCreatures + 1; + (this->super_TNonplayer).super_TCreature.LifeEndRound = pTVar4->LifeEndRound; + goto LAB_080b873a; + } + error(&DAT_08105b60); + this->Master = (ulong)pTVar4[1].super_TSkillBase.Skills[1]; + } while( true ); +} + + + +// DWARF original prototype: void TMonster(TMonster * this, int Race, int x, int y, int z, int Home, +// ulong Father) + +void __thiscall TMonster::TMonster(TMonster *this) + +{ + int iVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + TCreature *pTVar4; + TNonplayer **ppTVar5; + TItemData *this_00; + long lVar6; + long lVar7; + TCombat *this_01; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + ulong in_stack_0000001c; + char *Text; + Object *this_02; + int local_88; + int j; + int Repeat; + int i; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c; + Object Obj; + ulong local_3c [4]; + Object local_2c; + Object Bag; + + TCreature::TCreature((TCreature *)this); + (this->super_TNonplayer).super_TCreature.Type = MONSTER; + (this->super_TNonplayer).State = IDLE; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TMonster_08127ca8; + (this->super_TNonplayer).super_TCreature.Race = in_stack_00000008; + (this->super_TNonplayer).super_TCreature.startx = in_stack_0000000c; + (this->super_TNonplayer).super_TCreature.posx = in_stack_0000000c; + this->Home = in_stack_00000018; + (this->super_TNonplayer).super_TCreature.starty = in_stack_00000010; + (this->super_TNonplayer).super_TCreature.posy = in_stack_00000010; + (this->super_TNonplayer).super_TCreature.startz = in_stack_00000014; + (this->super_TNonplayer).super_TCreature.posz = in_stack_00000014; + this->Target = 0; + this->Master = in_stack_0000001c; + do { + if (this->Master == 0) { +LAB_080b8d5a: + if (RaceData[in_stack_00000008].Article[0] == '\0') { + strcpy((this->super_TNonplayer).super_TCreature.Name, + RaceData[in_stack_00000008].Name); + } + else { + snprintf((this->super_TNonplayer).super_TCreature.Name,0x1e,"%s %s", + in_stack_00000008 * 0x150 + 0x81c477e,RaceData + in_stack_00000008); + } + TSkillBase::SetSkills + (&(this->super_TNonplayer).super_TCreature.super_TSkillBase,in_stack_00000008) + ; + iVar1 = RaceData[in_stack_00000008].Outfit.OutfitID; + aVar2 = RaceData[in_stack_00000008].Outfit.field_1; + (this->super_TNonplayer).super_TCreature.Outfit.OutfitID = iVar1; + (this->super_TNonplayer).super_TCreature.Outfit.field_1 = aVar2; + (this->super_TNonplayer).super_TCreature.OrgOutfit.OutfitID = iVar1; + (this->super_TNonplayer).super_TCreature.OrgOutfit.field_1 = aVar2; + TCreature::SetID((TCreature *)this,0); + TCreature::SetInCrList((TCreature *)this); + ppTVar5 = vector<>::operator()(&NonplayerList,FirstFreeNonplayer); + FirstFreeNonplayer = FirstFreeNonplayer + 1; + *ppTVar5 = &this->super_TNonplayer; + bVar3 = TCreature::SetOnMap((TCreature *)this); + if (bVar3) { + if ((this->Master == 0) && (0 < RaceData[in_stack_00000008].Items)) { + // try { // try from 080b8e56 to 080b8f24 has its CatchHandler @ 080b925e + GetSpecialObject((SPECIALMEANING)local_3c); + GetBodyContainer((ulong)&local_4c,(this->super_TNonplayer).super_TCreature.ID); + Create(&local_2c,(ObjectType *)&local_4c,(ulong)local_3c); + Repeat = 1; + if (0 < RaceData[in_stack_00000008].Items) { + do { + this_00 = vector::operator() + (&RaceData[in_stack_00000008].Item,Repeat); + lVar6 = random(); + if (lVar6 <= this_00->Probability) { + lVar7 = random(); + j = 1; + bVar3 = ObjectType::getFlag(&this_00->Type,CUMULATIVE); + lVar6 = lVar7; + if (!bVar3) { + lVar6 = 0; + j = lVar7; + } + local_88 = 0; + if (0 < j) { + do { + local_4c.ObjectID = 0; + bVar3 = ObjectType::getFlag(&this_00->Type,WEAPON); + if (((((bVar3) || + (bVar3 = ObjectType::getFlag(&this_00->Type,SHIELD), + bVar3)) || + (bVar3 = ObjectType::getFlag(&this_00->Type,BOW), bVar3 + )) || ((bVar3 = ObjectType::getFlag(&this_00->Type, + THROW), bVar3 || + (bVar3 = ObjectType::getFlag(&this_00->Type,WAND + ), bVar3)))) || + ((bVar3 = ObjectType::getFlag(&this_00->Type,WEAROUT), + bVar3 || ((bVar3 = ObjectType::getFlag(&this_00->Type, + EXPIRE), bVar3 || + (bVar3 = ObjectType::getFlag(&this_00->Type, + EXPIRESTOP), + bVar3)))))) { + // try { // try from 080b9022 to 080b904d has its CatchHandler @ 080b91f5 + ObjectType::setTypeID + ((ObjectType *)local_6c,(this_00->Type).TypeID + ); + lVar7 = 0; + this_02 = local_6c; + i = local_2c.ObjectID; + Create(local_5c,(ObjectType *)&i,(ulong)this_02); + local_4c.ObjectID = local_5c[0].ObjectID; + local_3c[0] = local_5c[0].ObjectID; + } + else { + this_02 = local_5c; + ObjectType::setTypeID + ((ObjectType *)this_02,(this_00->Type).TypeID) + ; + lVar7 = lVar6; + CreateAtCreature((ulong)local_6c, + (ObjectType *) + (this->super_TNonplayer). + super_TCreature.ID,(ulong)this_02); + i = local_6c[0].ObjectID; + local_4c.ObjectID = i; + } + // try { // try from 080b9064 to 080b918d has its CatchHandler @ 080b925e + Object::getContainer((Object *)&i); + Object::getObjectType(local_6c); + if (local_6c[0].ObjectID == 0) { + error(&DAT_08105bc0,in_stack_00000008,this_02,lVar7); + local_6c[0].ObjectID = local_4c.ObjectID; + Delete(local_6c,-1); + } + local_88 = local_88 + 1; + } while (local_88 < j); + } + } + Repeat = Repeat + 1; + } while (Repeat <= RaceData[in_stack_00000008].Items); + } + local_6c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject((Object *)&i); + local_5c[0].ObjectID = ::NONE.ObjectID; + if (i == ::NONE.ObjectID) { + local_4c.ObjectID = local_2c.ObjectID; + // try { // try from 080b8f90 to 080b900d has its CatchHandler @ 080b925e + Delete(&local_4c,-1); + } + } + this_01 = &(this->super_TNonplayer).super_TCreature.Combat; + // try { // try from 080b8f41 to 080b8f73 has its CatchHandler @ 080b9270 + TCombat::CheckCombatValues(this_01); + TCombat::SetAttackMode(this_01,'\x02'); + TCreature::ToDoWait((TCreature *)this,0); + TCreature::ToDoStart((TCreature *)this); + } + else { + Text = "TMonster::TMonster: Kann Monster nicht auf die Karte setzen.\n"; +LAB_080b91a9: + // try { // try from 080b91a9 to 080b91ad has its CatchHandler @ 080b9270 + error(Text); + } + return; + } + // try { // try from 080b8d06 to 080b8e17 has its CatchHandler @ 080b9270 + pTVar4 = GetCreature(this->Master); + if (pTVar4 == (TCreature *)0x0) { + Text = "TMonster::TMonster: Master existiert nicht.\n"; + goto LAB_080b91a9; + } + if ((pTVar4->Type != MONSTER) || (pTVar4[1].super_TSkillBase.Skills[1] == (TSkill *)0x0)) { + pTVar4->SummonedCreatures = pTVar4->SummonedCreatures + 1; + (this->super_TNonplayer).super_TCreature.LifeEndRound = pTVar4->LifeEndRound; + goto LAB_080b8d5a; + } + error(&DAT_08105b60); + this->Master = (ulong)pTVar4[1].super_TSkillBase.Skills[1]; + } while( true ); +} + + + +// DWARF original prototype: void ~TMonster(TMonster * this, int __in_chrg) + +void __thiscall TMonster::~TMonster(TMonster *this,int __in_chrg) + +{ + bool bVar1; + TCreature *pTVar2; + TCreature *master; + ulong in_stack_ffffffe8; + + bVar1 = (this->super_TNonplayer).super_TCreature.IsDead; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TMonster_08127ca8; + if (bVar1 == false) { + in_stack_ffffffe8 = (this->super_TNonplayer).super_TCreature.posy; + GraphicalEffect(); + } + else if (this->Master == 0) { + in_stack_ffffffe8 = RaceData[(this->super_TNonplayer).super_TCreature.Race].ExperiencePoints + ; + TCombat::DistributeExperiencePoints + (&(this->super_TNonplayer).super_TCreature.Combat,in_stack_ffffffe8); + } + if (this->Home != 0) { + NotifyMonsterhomeOfDeath(this->Home); + } + if (this->Master != 0) { + pTVar2 = GetCreature(this->Master); + if ((pTVar2 != (TCreature *)0x0) && (0 < pTVar2->SummonedCreatures)) { + pTVar2->SummonedCreatures = pTVar2->SummonedCreatures + -1; + } + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TMonster(TMonster * this, int __in_chrg) + +void __thiscall TMonster::~TMonster(TMonster *this,int __in_chrg) + +{ + bool bVar1; + TCreature *pTVar2; + TCreature *master; + ulong in_stack_ffffffe8; + + bVar1 = (this->super_TNonplayer).super_TCreature.IsDead; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TMonster_08127ca8; + if (bVar1 == false) { + in_stack_ffffffe8 = (this->super_TNonplayer).super_TCreature.posy; + GraphicalEffect(); + } + else if (this->Master == 0) { + in_stack_ffffffe8 = RaceData[(this->super_TNonplayer).super_TCreature.Race].ExperiencePoints + ; + TCombat::DistributeExperiencePoints + (&(this->super_TNonplayer).super_TCreature.Combat,in_stack_ffffffe8); + } + if (this->Home != 0) { + NotifyMonsterhomeOfDeath(this->Home); + } + if (this->Master != 0) { + pTVar2 = GetCreature(this->Master); + if ((pTVar2 != (TCreature *)0x0) && (0 < pTVar2->SummonedCreatures)) { + pTVar2->SummonedCreatures = pTVar2->SummonedCreatures + -1; + } + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + return; +} + + + +// DWARF original prototype: void ~TMonster(TMonster * this, int __in_chrg) + +void __thiscall TMonster::~TMonster(TMonster *this,int __in_chrg) + +{ + bool bVar1; + TCreature *pTVar2; + TCreature *master; + ulong in_stack_ffffffe8; + + bVar1 = (this->super_TNonplayer).super_TCreature.IsDead; + (this->super_TNonplayer).super_TCreature._vptr_TCreature = + (_func_int_varargs **)&PTR__TMonster_08127ca8; + if (bVar1 == false) { + in_stack_ffffffe8 = (this->super_TNonplayer).super_TCreature.posy; + GraphicalEffect(); + } + else if (this->Master == 0) { + in_stack_ffffffe8 = RaceData[(this->super_TNonplayer).super_TCreature.Race].ExperiencePoints + ; + TCombat::DistributeExperiencePoints + (&(this->super_TNonplayer).super_TCreature.Combat,in_stack_ffffffe8); + } + if (this->Home != 0) { + NotifyMonsterhomeOfDeath(this->Home); + } + if (this->Master != 0) { + pTVar2 = GetCreature(this->Master); + if ((pTVar2 != (TCreature *)0x0) && (0 < pTVar2->SummonedCreatures)) { + pTVar2->SummonedCreatures = pTVar2->SummonedCreatures + -1; + } + } + TNonplayer::~TNonplayer(&this->super_TNonplayer,in_stack_ffffffe8); + operator_delete(this); + return; +} + + + +// WARNING: Globals starting with '_' overlap smaller symbols at the same address +// DWARF original prototype: void IdleStimulus(TMonster * this) + +void __thiscall TMonster::IdleStimulus(TMonster *this) + +{ + TSkill *id; + TOutfit _Outfit; + bool bVar1; + bool bVar2; + int dir; + TCreature *pTVar3; + uint uVar4; + int iVar5; + int iVar6; + uint uVar7; + uint uVar8; + uint uVar9; + TSpellData *pTVar10; + long lVar11; + ulong uVar12; + TCreature *pTVar13; + ulong *puVar14; + char *pcVar15; + TCreature *master; + STATE SVar16; + int *piVar17; + uint uVar18; + int dy_1; + int destX; + TCombat *this_00; + ulong uVar19; + int destY; + int iVar20; + TDamageImpact *this_01; + int Try; + TMonster *i; + int iVar21; + uint uVar22; + TMonster *pTVar23; + TCreature *target; + TCreature *target_1; + int Strategy; + int TieBreaker; + int Goodness; + int iStack_74; + bool Sleep; + int local_70; + int local_6c; + int x; + int y; + int z; + int x_1; + int y_1; + int z_1; + TOutfit HelpOutfit; + TFindCreatures Search; + + if ((this->super_TNonplayer).super_TCreature.LockToDo != false) { + return; + } + if ((this->super_TNonplayer).super_TCreature.LoggingOut != false) { + return; + } + uVar18 = (this->super_TNonplayer).super_TCreature.LifeEndRound; + if ((uVar18 != 0) && (uVar18 <= RoundNr)) { + print(); + TCreature::StartLogout((TCreature *)this,true,true); + goto LAB_080b97c3; + } + if (this->Master != 0) { + pTVar3 = GetCreature(this->Master); + if (pTVar3 == (TCreature *)0x0) { + if (0x3fffffff < this->Master) { + pcVar15 = (this->super_TNonplayer).super_TCreature.Name; + print(); + (*(this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[2]->_vptr_TSkill + [2])((this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[2],0,pcVar15 + ); + (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[2])(this); + goto LAB_080b961e; + } + print(); +LAB_080b9665: + TCreature::StartLogout((TCreature *)this,true,true); + } + else { + uVar18 = this->Master; + if ((uVar18 < 0x40000000) && (pTVar3->SummonedCreatures == 0)) { + print(); + TCreature::StartLogout((TCreature *)this,true,true); + goto LAB_080bac12; + } + if (pTVar3 == (TCreature *)0x0) { + iVar5 = (this->super_TNonplayer).super_TCreature.posz; + iVar20 = _DAT_00000278; +LAB_080b96b4: + if ((iVar5 == iVar20) || (uVar18 < 0x40000000)) { + if ((pTVar3 == (TCreature *)0x0) || ((pTVar3->Combat).Following != false)) { + uVar12 = 0; + } + else { + uVar12 = (pTVar3->Combat).AttackDest; + } + this->Target = uVar12; + if ((uVar12 == 0) || (uVar12 == (this->super_TNonplayer).super_TCreature.ID)) { + this->Target = uVar18; + } + goto LAB_080b96fc; + } + } + else { + iVar5 = (this->super_TNonplayer).super_TCreature.posz; + uVar4 = iVar5 - pTVar3->posz; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if ((int)uVar4 < 2) { + uVar4 = (this->super_TNonplayer).super_TCreature.posx - pTVar3->posx; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if ((int)uVar4 < 0x1f) { + uVar4 = (this->super_TNonplayer).super_TCreature.posy - pTVar3->posy; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + iVar20 = pTVar3->posz; + if ((int)uVar4 < 0x1f) goto LAB_080b96b4; + } + } + if (uVar18 < 0x40000000) { + print(); + goto LAB_080b9665; + } + } + (*(this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[2]->_vptr_TSkill[2]) + ((this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[2],0); + (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[2])(this); + print(); + } +LAB_080b961e: + (this->super_TNonplayer).State = SLEEPING; + return; + } + bVar1 = MonsterhomeInRange(); + if (!bVar1) { + vector<>::operator()(&Monsterhome,this->Home); + vector<>::operator()(&Monsterhome,this->Home); + vector<>::operator()(&Monsterhome,this->Home); + print(); + TCreature::StartLogout((TCreature *)this,true,true); +LAB_080bac12: + (this->super_TNonplayer).State = SLEEPING; + return; + } +LAB_080b96fc: + if (this->Target == 0) { + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } + else { + pTVar3 = GetCreature(this->Target); + if (pTVar3 == (TCreature *)0x0) { +LAB_080baa94: + this->Target = 0; + } + else { + uVar18 = (this->super_TNonplayer).super_TCreature.posx - pTVar3->posx; + if (0x7fffffff < uVar18) { + uVar18 = -uVar18; + } + if (10 < (int)uVar18) goto LAB_080baa94; + uVar18 = (this->super_TNonplayer).super_TCreature.posy - pTVar3->posy; + if (0x7fffffff < uVar18) { + uVar18 = -uVar18; + } + if ((10 < (int)uVar18) || + ((this->super_TNonplayer).super_TCreature.posz != pTVar3->posz)) goto LAB_080baa94; + } + if (pTVar3 == (TCreature *)0x0) { + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } + else { + bVar1 = IsProtectionZone(); + if (bVar1) { + this->Target = 0; + } + bVar1 = IsHouse(pTVar3->posx,pTVar3->posy,pTVar3->posz); + if (bVar1) { + this->Target = 0; + } + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + if (RaceData[iVar5].SeeInvisible == false) { + bVar1 = false; + if (((pTVar3->Outfit).OutfitID == 0) && ((pTVar3->Outfit).field_1.ObjectType == 0)) + { + bVar1 = true; + } + if (bVar1) { + this->Target = 0; + } + } + } + if (this->Master == 0) { + lVar11 = random(); + if (lVar11 < RaceData[iVar5].LoseTarget) { + this->Target = 0; + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } + else { + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } + } + } + SVar16 = (this->super_TNonplayer).State; + if ((SVar16 != PANIC) && (SVar16 != UNDERATTACK)) { + (this->super_TNonplayer).State = IDLE; + } + if ((0 < RaceData[iVar5].Talks) && (iVar5 = rand(), iVar5 == (iVar5 / 0x32) * 0x32)) { + iVar5 = rand(); + puVar14 = vector<>::operator() + (&RaceData[(this->super_TNonplayer).super_TCreature.Race].Talk, + iVar5 % RaceData[(this->super_TNonplayer).super_TCreature.Race].Talks + + 1); + pcVar15 = GetDynamicString(*puVar14); + if (*pcVar15 == '#') { + pcVar15 = pcVar15 + 3; + iVar5 = 0x11; + uVar12 = (this->super_TNonplayer).super_TCreature.ID; + } + else { + iVar5 = 0x10; + uVar12 = (this->super_TNonplayer).super_TCreature.ID; + } + // try { // try from 080baa0a to 080baa0e has its CatchHandler @ 080bade6 + Talk(uVar12,iVar5,(char *)0x0,pcVar15,false); + } + uVar12 = this->Target; + if (uVar12 == 0) { + bVar1 = true; + if (this->Master == 0) { + TieBreaker = -0x80000000; + iVar5 = 0; + Strategy = 0; + target_1 = (TCreature *)0x0; + lVar11 = random(); + do { + piVar17 = RaceData[(this->super_TNonplayer).super_TCreature.Race].Strategy + iVar5; + if (lVar11 < *piVar17) break; + target_1 = (TCreature *)((int)&target_1->_vptr_TCreature + 1); + iVar5 = iVar5 + 1; + lVar11 = lVar11 - *piVar17; + } while (iVar5 < 3); + TFindCreatures::TFindCreatures + ((TFindCreatures *)&HelpOutfit.field_1,0xc,0xc, + (this->super_TNonplayer).super_TCreature.ID,5); + uVar12 = TFindCreatures::getNext((TFindCreatures *)&HelpOutfit.field_1); + if (uVar12 == 0) { + uVar12 = this->Target; + } + else { + do { + pTVar3 = GetCreature(uVar12); + if (pTVar3 == (TCreature *)0x0) { + error("TMonster::IdleStimulus: Kreatur existiert nicht.\n"); + uVar12 = this->Target; + goto LAB_080b9794; + } + if ((pTVar3->Type != MONSTER) || + (((id = pTVar3[1].super_TSkillBase.Skills[1], id != (TSkill *)0x0 && + (pTVar13 = GetCreature((ulong)id), pTVar13 != (TCreature *)0x0)) && + (pTVar13->Type == PLAYER)))) { + iVar5 = pTVar3->posz; + if (iVar5 < 8) { + iVar20 = (this->super_TNonplayer).super_TCreature.posz; + if (iVar20 < 8) { +LAB_080ba913: + bVar1 = false; + } + } + else { + iVar20 = (this->super_TNonplayer).super_TCreature.posz; + if ((iVar20 - iVar5) + 2U < 5) goto LAB_080ba913; + } + if ((iVar20 == iVar5) && + ((pTVar3->Type != PLAYER || + (bVar2 = CheckRight(pTVar3->ID,IGNORED_BY_MONSTERS), !bVar2)))) { + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].SeeInvisible + == false) { + bVar2 = false; + if (((pTVar3->Outfit).OutfitID == 0) && + ((pTVar3->Outfit).field_1.ObjectType == 0)) { + bVar2 = true; + } + if (bVar2) goto LAB_080ba73a; + } + bVar2 = IsProtectionZone(); + if ((!bVar2) && + (bVar2 = IsHouse(pTVar3->posx,pTVar3->posy,pTVar3->posz), !bVar2)) { + uVar18 = (this->super_TNonplayer).super_TCreature.posx - + pTVar3->posx; + if (0x7fffffff < uVar18) { + uVar18 = -uVar18; + } + uVar4 = (this->super_TNonplayer).super_TCreature.posy - pTVar3->posy + ; + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if (((int)uVar18 < 0xb) && ((int)uVar4 < 0xb)) { + if (target_1 == (TCreature *)0x1) { + iVar5 = TSkill::Get((pTVar3->super_TSkillBase).Skills[2]); +LAB_080ba8dc: + uVar19 = -iVar5; + } + else if ((int)target_1 < 2) { + if (target_1 == (TCreature *)0x0) { + iVar5 = uVar4 + uVar18; + goto LAB_080ba8dc; + } +LAB_080ba860: + uVar19 = 0; + error("TMonster::IdleStimulus: Unbekannte Strategie %d.\n", + target_1); + } + else if (target_1 == (TCreature *)0x2) { + uVar19 = TCombat::GetDamageByCreature + (&(this->super_TNonplayer). + super_TCreature.Combat,pTVar3->ID); + } + else { + uVar19 = 0; + if (target_1 != (TCreature *)0x3) goto LAB_080ba860; + } + lVar11 = random(); + if ((TieBreaker < (int)uVar19) || + ((uVar19 == TieBreaker && (Strategy < lVar11)))) { + this->Target = uVar12; + Strategy = lVar11; + TieBreaker = uVar19; + } + } + } + } + } +LAB_080ba73a: + uVar12 = TFindCreatures::getNext((TFindCreatures *)&HelpOutfit.field_1); + } while (uVar12 != 0); + uVar12 = this->Target; + } + } +LAB_080b9794: + if (uVar12 == 0) { + if (bVar1) { + SVar16 = (this->super_TNonplayer).State; + if ((SVar16 != UNDERATTACK) && (SVar16 != PANIC)) { + if (this->Master == 0) { +LAB_080b97c3: + (this->super_TNonplayer).State = SLEEPING; + return; + } + TCreature::ToDoWait((TCreature *)this,1000); + goto LAB_080b97e9; + } + } + else { + SVar16 = (this->super_TNonplayer).State; + } + } + else { + SVar16 = (this->super_TNonplayer).State; + } + if ((uVar12 == 0) && (SVar16 == PANIC)) { + SVar16 = IDLE; + (this->super_TNonplayer).State = IDLE; + } + if (SVar16 == UNDERATTACK) { + (this->super_TNonplayer).State = IDLE; + } + } + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + if (0 < RaceData[iVar5].Spells) { + if (uVar12 == 0) { + target = (TCreature *)0x0; + } + else { + target = GetCreature(uVar12); + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } + i = (TMonster *)0x1; + if (RaceData[iVar5].Spells < 1) { + uVar12 = this->Target; + } + else { + do { + pTVar23 = i; + pTVar10 = vector::operator()(&RaceData[iVar5].Spell,(int)i); + iVar5 = rand(); + if (iVar5 % pTVar10->Delay == 0) { + if ((this->Master == 0) && + (iVar5 = TSkill::Get((this->super_TNonplayer).super_TCreature. + super_TSkillBase.Skills[2]), + iVar5 <= RaceData[(this->super_TNonplayer).super_TCreature.Race]. + FleeThreshold)) { + pTVar23 = (TMonster *)0x3; + lVar11 = random(); + if (lVar11 != 1) goto LAB_080ba242; + } + this_01 = (TDamageImpact *)0x0; + switch(pTVar10->Impact) { + case IMPACT_DAMAGE: + this_01 = (TDamageImpact *)operator_new(0x14); + // try { // try from 080ba1ca to 080ba1f0 has its CatchHandler @ 080bae1e + iVar5 = ComputeDamage((TCreature *)this,0,pTVar10->ImpactParam2, + pTVar10->ImpactParam3); + pTVar23 = this; + TDamageImpact::TDamageImpact + (this_01,(TCreature *)this,pTVar10->ImpactParam1,iVar5,true); + break; + case IMPACT_FIELD: + this_01 = (TDamageImpact *)operator_new(0xc); + pTVar23 = this; + // try { // try from 080ba3a9 to 080ba3ad has its CatchHandler @ 080bae30 + TFieldImpact::TFieldImpact + ((TFieldImpact *)this_01,(TCreature *)this,pTVar10->ImpactParam1); + break; + case IMPACT_HEALING: + this_01 = (TDamageImpact *)operator_new(0xc); + // try { // try from 080ba3dd to 080ba3f4 has its CatchHandler @ 080bae32 + iVar5 = ComputeDamage((TCreature *)this,0,pTVar10->ImpactParam1, + pTVar10->ImpactParam2); + pTVar23 = this; + THealingImpact::THealingImpact + ((THealingImpact *)this_01,(TCreature *)this,iVar5); + break; + case IMPACT_SPEED: + this_01 = (TDamageImpact *)operator_new(0x10); + // try { // try from 080ba424 to 080ba442 has its CatchHandler @ 080bae34 + ComputeDamage((TCreature *)this,0,pTVar10->ImpactParam1, + pTVar10->ImpactParam2); + pTVar23 = this; + TSpeedImpact::TSpeedImpact((TSpeedImpact *)this_01); + break; + case IMPACT_DRUNKEN: + this_01 = (TDamageImpact *)operator_new(0x10); + // try { // try from 080ba472 to 080ba490 has its CatchHandler @ 080bae36 + iVar5 = ComputeDamage((TCreature *)this,0,pTVar10->ImpactParam1, + pTVar10->ImpactParam2); + pTVar23 = this; + TDrunkenImpact::TDrunkenImpact + ((TDrunkenImpact *)this_01,(TCreature *)this,iVar5, + pTVar10->ImpactParam3); + break; + case IMPACT_STRENGTH: + this_01 = (TDamageImpact *)operator_new(0x14); + // try { // try from 080ba4c0 to 080ba4e5 has its CatchHandler @ 080bae38 + ComputeDamage((TCreature *)this,0,pTVar10->ImpactParam2, + pTVar10->ImpactParam3); + pTVar23 = this; + TStrengthImpact::TStrengthImpact((TStrengthImpact *)this_01); + break; + case IMPACT_OUTFIT: + z_1 = pTVar10->ImpactParam1; + uVar18 = pTVar10->ImpactParam2; + if (0x7fffffff < uVar18) { + uVar18 = uVar18 + 0xff; + } + uVar4 = pTVar10->ImpactParam3; + if (0x7fffffff < uVar4) { + uVar4 = uVar4 + 0xff; + } + HelpOutfit.OutfitID = + CONCAT13((char)(uVar4 >> 8), + CONCAT12((char)pTVar10->ImpactParam3, + CONCAT11((char)(uVar18 >> 8), + (char)pTVar10->ImpactParam2))); + this_01 = (TDamageImpact *)operator_new(0x14); + _Outfit.field_1 = (anon_union_4_2_730cd3ca_for_TOutfit_2)HelpOutfit.OutfitID + ; + _Outfit.OutfitID = z_1; + pTVar23 = this; + // try { // try from 080ba554 to 080ba558 has its CatchHandler @ 080bae3a + TOutfitImpact::TOutfitImpact + ((TOutfitImpact *)this_01,(TCreature *)this,_Outfit, + pTVar10->ImpactParam4); + break; + case IMPACT_SUMMON: + if (this->Master == 0) { + this_01 = (TDamageImpact *)operator_new(0x10); + pTVar23 = this; + // try { // try from 080ba595 to 080ba599 has its CatchHandler @ 080bae1e + TSummonImpact::TSummonImpact + ((TSummonImpact *)this_01,(TCreature *)this, + pTVar10->ImpactParam1,pTVar10->ImpactParam2); + } + } + if (this_01 != (TDamageImpact *)0x0) { + iVar5 = (*(this_01->super_TImpact)._vptr_TImpact[2])(this_01,pTVar23); + if (((char)iVar5 == '\0') || + ((this->Target != 0 && (this->Target != this->Master)))) { + switch(pTVar10->Shape) { + case SHAPE_ACTOR: + ActorShapeSpell((TCreature *)this,&this_01->super_TImpact, + pTVar10->ShapeParam1); + break; + case SHAPE_VICTIM: + if (target != (TCreature *)0x0) { + TCreature::Rotate((TCreature *)this,target); + VictimShapeSpell((TCreature *)this,target,pTVar10->ShapeParam1, + pTVar10->ShapeParam2,&this_01->super_TImpact, + pTVar10->ShapeParam3); + } + break; + case SHAPE_ORIGIN: + OriginShapeSpell((TCreature *)this,pTVar10->ShapeParam1, + &this_01->super_TImpact,pTVar10->ShapeParam2); + break; + case SHAPE_DESTINATION: + if (target != (TCreature *)0x0) { + TCreature::Rotate((TCreature *)this,target); + DestinationShapeSpell + ((TCreature *)this,target,pTVar10->ShapeParam1, + pTVar10->ShapeParam2,pTVar10->ShapeParam3, + &this_01->super_TImpact,pTVar10->ShapeParam4); + } + break; + case SHAPE_ANGLE: + if (target != (TCreature *)0x0) { + TCreature::Rotate((TCreature *)this,target); + } + AngleShapeSpell((TCreature *)this,pTVar10->ShapeParam1, + pTVar10->ShapeParam2,&this_01->super_TImpact, + pTVar10->ShapeParam3); + } + } + operator_delete(this_01); + } + } +LAB_080ba242: + i = (TMonster *)((int)&(i->super_TNonplayer).super_TCreature._vptr_TCreature + 1); + iVar5 = (this->super_TNonplayer).super_TCreature.Race; + } while ((int)i <= RaceData[iVar5].Spells); + uVar12 = this->Target; + } + } + if (uVar12 == 0) { + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + iVar20 = (this->super_TNonplayer).super_TCreature.posy; + } + else { + pTVar3 = GetCreature(uVar12); + if (pTVar3 == (TCreature *)0x0) { + error("TMonster::IdleStimulus: Kreatur existiert nicht.\n"); + this->Target = 0; +LAB_080ba0e7: + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + iVar20 = (this->super_TNonplayer).super_TCreature.posy; + } + else { + uVar12 = this->Master; + if (uVar12 == 0) { + iVar5 = TSkill::Get((this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills + [2]); + if (iVar5 <= RaceData[(this->super_TNonplayer).super_TCreature.Race].FleeThreshold) + { + bVar1 = SearchFlightField(); + if (bVar1) { + TCreature::ToDoGo((TCreature *)this,z,x_1,y_1,true,0x7fffffff); + goto LAB_080b97e9; + } + goto LAB_080ba0e7; + } + uVar12 = this->Master; + } + if (this->Target != uVar12) { + // try { // try from 080b99d7 to 080ba124 has its CatchHandler @ 080bae3c + iVar5 = TSkill::Get((this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills + [0xb]); + if (iVar5 < 1) { + SVar16 = (this->super_TNonplayer).State; + } + else { + SVar16 = (this->super_TNonplayer).State; + if (SVar16 != PANIC) { + SVar16 = ATTACKING; + (this->super_TNonplayer).State = ATTACKING; + } + } + if (SVar16 - ATTACKING < 2) { + this_00 = &(this->super_TNonplayer).super_TCreature.Combat; + TCombat::SetAttackDest(this_00,this->Target,false); + TCombat::SetChaseMode(this_00,'\0'); + } + if (((RaceData[(this->super_TNonplayer).super_TCreature.Race].DistanceFighting == + false) || (this->Target == this->Master)) || + (bVar1 = ThrowPossible((this->super_TNonplayer).super_TCreature.posx, + (this->super_TNonplayer).super_TCreature.posy, + (this->super_TNonplayer).super_TCreature.posz,pTVar3->posx + ,pTVar3->posy,pTVar3->posz,0), !bVar1)) { + TCombat::SetChaseMode(&(this->super_TNonplayer).super_TCreature.Combat,'\x01'); + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + if (((iVar5 - pTVar3->posx) + 1U < 3) && + (iVar20 = (this->super_TNonplayer).super_TCreature.posy, + (iVar20 - pTVar3->posy) + 1U < 3)) { + iVar21 = rand(); + iVar21 = iVar21 % 5; + if (iVar21 == 1) { + iVar5 = iVar5 + 1; + } + else if (iVar21 < 2) { + if (iVar21 == 0) { + iVar5 = iVar5 + -1; + } + } + else if (iVar21 == 2) { + iVar20 = iVar20 + -1; + } + else if (iVar21 == 3) { + iVar20 = iVar20 + 1; + } + if (((iVar21 < 4) && + (iVar21 = (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[3]) + (this,iVar5,iVar20, + (this->super_TNonplayer).super_TCreature.posz,1,0), + (char)iVar21 != '\0')) && + (((iVar5 - pTVar3->posx) + 1U < 3 && ((iVar20 - pTVar3->posy) + 1U < 3))) + ) { + TCreature::ToDoGo((TCreature *)this,iVar5,iVar20, + (this->super_TNonplayer).super_TCreature.posz,true, + 0x7fffffff); + } + SVar16 = (this->super_TNonplayer).State; + if (SVar16 == PANIC) { + SVar16 = ATTACKING; + (this->super_TNonplayer).State = ATTACKING; + } + } + else { + SVar16 = (this->super_TNonplayer).State; + if (1 < SVar16 - ATTACKING) { + iVar5 = 3; + goto LAB_080b9ba0; + } + } + } + else { + HelpOutfit.field_1 = + (anon_union_4_2_730cd3ca_for_TOutfit_2)(pTVar3->CrObject).ObjectID; + Search.endy = (this->super_TNonplayer).super_TCreature.CrObject.ObjectID; + iVar5 = ObjectDistance((Object *)&Search.endy,(Object *)&HelpOutfit.field_1); + if (iVar5 < 4) { + bVar1 = SearchFlightField(); + if (!bVar1) { + TCreature::ToDoWait((TCreature *)this,1000); + SVar16 = (this->super_TNonplayer).State; + goto LAB_080b9afc; + } + TCreature::ToDoGo((TCreature *)this,local_6c,x,y,true,0x7fffffff); + } + else if (iVar5 == 4) { + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + iVar20 = (this->super_TNonplayer).super_TCreature.posy; + iVar21 = rand(); + iVar21 = iVar21 % 5; + if (iVar21 == 1) { + iVar5 = iVar5 + 1; + } + else if (iVar21 < 2) { + if (iVar21 == 0) { + iVar5 = iVar5 + -1; + } + } + else if (iVar21 == 2) { + iVar20 = iVar20 + -1; + } + else if (iVar21 == 3) { + iVar20 = iVar20 + 1; + } + if ((iVar21 < 4) && + (iVar21 = (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[3]) + (this,iVar5,iVar20, + (this->super_TNonplayer).super_TCreature.posz,1,0), + (char)iVar21 != '\0')) { + iVar21 = iVar5 - pTVar3->posx; + local_70 = -iVar21; + if (-1 < iVar21) { + local_70 = iVar21; + } + iVar21 = iVar20 - pTVar3->posy; + iStack_74 = -iVar21; + if (-1 < iVar21) { + iStack_74 = iVar21; + } + piVar17 = &stack0xffffff8c; + if (iStack_74 <= local_70) { + piVar17 = &local_70; + } + if (*piVar17 == 4) { + TCreature::ToDoGo((TCreature *)this,iVar5,iVar20, + (this->super_TNonplayer).super_TCreature.posz,true + ,0x7fffffff); + } + } + TCreature::ToDoWait((TCreature *)this,1000); + } + else { + iVar5 = iVar5 + -4; +LAB_080b9ba0: + TCreature::ToDoGo((TCreature *)this,pTVar3->posx,pTVar3->posy,pTVar3->posz, + false,iVar5); + } + SVar16 = (this->super_TNonplayer).State; + } +LAB_080b9afc: + if (SVar16 - ATTACKING < 2) { + pTVar3 = GetCreature(this->Target); + TCreature::Rotate((TCreature *)this,pTVar3); + if ((this->Master == 0) || + (uVar12 = (this->super_TNonplayer).super_TCreature.Combat.AttackDest, + uVar12 != this->Master)) { + TCreature::ToDoAttack((TCreature *)this); + } + else { + error("TMonster::IdleStimulus: %s greift Master %lu an (St=%d, T: %lu).\n", + (this->super_TNonplayer).super_TCreature.Name,uVar12, + (this->super_TNonplayer).State,this->Target); + } + } + else { + TCreature::ToDoWait((TCreature *)this,1000); + } + goto LAB_080b97e9; + } + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + iVar20 = (this->super_TNonplayer).super_TCreature.posy; + uVar22 = pTVar3->posx - iVar5; + uVar4 = pTVar3->posy - iVar20; + uVar7 = -uVar22; + uVar18 = uVar7; + if (-1 < (int)uVar22) { + uVar18 = uVar22; + } + uVar8 = -uVar4; + uVar9 = uVar8; + if (-1 < (int)uVar4) { + uVar9 = uVar4; + } + if (1 < (int)(uVar18 + uVar9)) { + uVar18 = uVar7; + if (-1 < (int)uVar22) { + uVar18 = uVar22; + } + uVar9 = uVar8; + if (-1 < (int)uVar4) { + uVar9 = uVar4; + } + if (uVar18 + uVar9 == 2) { + TCreature::ToDoWait((TCreature *)this,1000); + } + else { + if (0x7fffffff < uVar22) { + uVar22 = uVar7; + } + if (0x7fffffff < uVar4) { + uVar4 = uVar8; + } + if (uVar4 + uVar22 == 3) { + TCreature::ToDoWait((TCreature *)this,1000); + } + TCreature::ToDoGo((TCreature *)this,pTVar3->posx,pTVar3->posy,pTVar3->posz,false + ,3); + } + TCreature::ToDoStart((TCreature *)this); + return; + } + } + } + iVar21 = 0; + while (iVar21 = iVar21 + 1, iVar21 < 0xb) { + iVar6 = rand(); + iVar6 = iVar6 % 4; + if (iVar6 == 1) { + iVar5 = iVar5 + 1; + } + else if (iVar6 < 2) { + if (iVar6 == 0) { + iVar5 = iVar5 + -1; + } + } + else if (iVar6 == 2) { + iVar20 = iVar20 + -1; + } + else if (iVar6 == 3) { + iVar20 = iVar20 + 1; + } + // try { // try from 080b98ef to 080b98f1 has its CatchHandler @ 080baea0 + iVar6 = (*(this->super_TNonplayer).super_TCreature._vptr_TCreature[3]) + (this,iVar5,iVar20,(this->super_TNonplayer).super_TCreature.posz,1,0); + if ((char)iVar6 != '\0') { + // try { // try from 080b9932 to 080b9951 has its CatchHandler @ 080baeca + TCreature::ToDoGo((TCreature *)this,iVar5,iVar20, + (this->super_TNonplayer).super_TCreature.posz,true,0x7fffffff); + TCreature::ToDoWait((TCreature *)this,1000); + TCreature::ToDoStart((TCreature *)this); + return; + } + iVar5 = (this->super_TNonplayer).super_TCreature.posx; + iVar20 = (this->super_TNonplayer).super_TCreature.posy; + } + TCreature::ToDoWait((TCreature *)this,1000); +LAB_080b97e9: + TCreature::ToDoStart((TCreature *)this); + return; +} + + + +// DWARF original prototype: void CreatureMoveStimulus(TMonster * this, ulong CreatureID, int Type) + +void __thiscall TMonster::CreatureMoveStimulus(TMonster *this,ulong CreatureID,int Type) + +{ + TSkill *id; + TCreature *cr; + TCreature *pTVar1; + + if (CreatureID == (this->super_TNonplayer).super_TCreature.ID) { + if (((this->super_TNonplayer).State == SLEEPING) && (Type != 0)) { + (this->super_TNonplayer).State = IDLE; + TCreature::ToDoYield((TCreature *)this); + return; + } + return; + } + if (((this->super_TNonplayer).State == SLEEPING) && (Type != 0)) { + pTVar1 = GetCreature(CreatureID); + if (pTVar1 == (TCreature *)0x0) { + error("TMonster::CreatureMoveStimulus: Kreatur %d existiert nicht.\n"); + return; + } + if (pTVar1->Type == NPC) { + return; + } + if (pTVar1->Type == MONSTER) { + id = pTVar1[1].super_TSkillBase.Skills[1]; + if (id == (TSkill *)0x0) { + return; + } + pTVar1 = GetCreature((ulong)id); + if (pTVar1 == (TCreature *)0x0) { + return; + } + if (pTVar1->Type != PLAYER) { + return; + } + } + (this->super_TNonplayer).State = IDLE; + TCreature::ToDoYield((TCreature *)this); + } + TCreature::CreatureMoveStimulus((TCreature *)this,CreatureID,Type); + return; +} + + + +// DWARF original prototype: void DamageStimulus(TMonster * this, ulong Attacker, int Damage, int +// param_3) + +void __thiscall TMonster::DamageStimulus(TMonster *this,ulong Attacker,int Damage,int param_3) + +{ + STATE SVar1; + + if ((Attacker != 0) && (Damage != 0)) { + SVar1 = (this->super_TNonplayer).State; + if (SVar1 == SLEEPING) { + (this->super_TNonplayer).State = (uint)(this->Target == 0) * 4 + UNDERATTACK; + TCreature::ToDoYield((TCreature *)this); + return; + } + if (SVar1 == IDLE) { + (this->super_TNonplayer).State = UNDERATTACK; + } + if (this->Target == 0) { + (this->super_TNonplayer).State = PANIC; + } + } + return; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: bool MovePossible(TMonster * this, int x, int y, int z, bool Execute, +// bool param_5) + +bool __thiscall TMonster::MovePossible(TMonster *this,int x,int y,int z,bool Execute,bool param_5) + +{ + bool bVar1; + bool bVar2; + TCreature *master_1; + int iVar3; + TCreature *pTVar4; + undefined4 *puVar5; + ulong uVar6; + TMonster *pTVar7; + uint uVar8; + TCreature *master; + int *piVar9; + STATE SVar10; + uint uVar11; + TCreature *Obstacle; + ulong *puVar12; + Object *local_64; + int local_60; + int Try; + int iStack_54; + bool Execute_local; + int local_50; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + iVar3 = (this->super_TNonplayer).super_TCreature.posz; + if (iVar3 == z) { + SVar10 = (this->super_TNonplayer).State; + if (1 < SVar10 - ATTACKING) { + bVar1 = MonsterhomeInRange(); + if (!bVar1) { + return false; + } + SVar10 = (this->super_TNonplayer).State; + } + if (1 < SVar10 - ATTACKING) { + iVar3 = x - (this->super_TNonplayer).super_TCreature.startx; + local_50 = -iVar3; + if (-1 < iVar3) { + local_50 = iVar3; + } + iVar3 = y - (this->super_TNonplayer).super_TCreature.starty; + iStack_54 = -iVar3; + if (-1 < iVar3) { + iStack_54 = iVar3; + } + piVar9 = &stack0xffffffac; + if (iStack_54 <= local_50) { + piVar9 = &local_50; + } + if ((this->super_TNonplayer).super_TCreature.Radius < *piVar9) { + return false; + } + } + if (-1 < (this->super_TNonplayer).super_TCreature.super_TSkillBase.Skills[4]->Act) { + bVar1 = IsProtectionZone(); + if (bVar1) { + return false; + } + bVar1 = IsHouse(x,y,z); + if (bVar1) { + return false; + } + if (((((Execute) && (this->Master != 0)) && + (SVar10 = (this->super_TNonplayer).State, SVar10 != ATTACKING)) && + ((SVar10 != PANIC && + (pTVar4 = GetCreature(this->Master), pTVar4 != (TCreature *)0x0)))) && + (pTVar4->posz == (this->super_TNonplayer).super_TCreature.posz)) { + uVar11 = pTVar4->posx - (this->super_TNonplayer).super_TCreature.posx; + if (0x7fffffff < uVar11) { + uVar11 = -uVar11; + } + uVar8 = pTVar4->posy - (this->super_TNonplayer).super_TCreature.posy; + if (0x7fffffff < uVar8) { + uVar8 = -uVar8; + } + if (1 < (int)(uVar11 + uVar8)) { + uVar11 = pTVar4->posx - x; + if (0x7fffffff < uVar11) { + uVar11 = -uVar11; + } + uVar8 = pTVar4->posy - y; + if (0x7fffffff < uVar8) { + uVar8 = -uVar8; + } + if ((int)(uVar11 + uVar8) < 2) { + return false; + } + } + } + local_60 = 0; +LAB_080bb1d4: + local_60 = local_60 + 1; + if (local_60 < 0x65) { + GetFirstObject(); + bVar1 = false; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (local_2c != ::NONE.ObjectID) { + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,BANK); + if (bVar2) goto LAB_080bb216; + } + bVar1 = true; +LAB_080bb216: + if (bVar1) { + return false; + } + if (local_2c == ::NONE.ObjectID) { + return true; + } + do { + local_64 = local_4c; + puVar12 = &local_2c; + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_64); + if (local_4c[0].ObjectID == 99) { + if (1 < (this->super_TNonplayer).State - ATTACKING) { + return false; + } + if (this->Target == 0) { + return false; + } + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].KickCreatures == + false) { + return false; + } + local_4c[0].ObjectID = local_2c; + pTVar4 = GetCreature(local_64); + if (pTVar4 == (TCreature *)0x0) { + error("TMonster::MovePossible: Kann Hindernis-Kreatur nicht identifizieren.\n" + ,puVar12); + return false; + } + if (RaceData[pTVar4->Race].Unpushable != false) { + return false; + } + if (pTVar4->Type == NPC) { + return false; + } + if (pTVar4->Type == PLAYER) { + if (this->Master != 0) { + return false; + } + bVar1 = CheckRight(pTVar4->ID,IGNORED_BY_MONSTERS); + if (bVar1) { + return false; + } + } + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].SeeInvisible == + false) { + bVar1 = false; + if (((pTVar4->Outfit).OutfitID == 0) && + ((pTVar4->Outfit).field_1.ObjectType == 0)) { + bVar1 = true; + } + if (bVar1) { + return false; + } + } + if (pTVar4->ID == this->Master) { + return false; + } + if (pTVar4->ID == this->Target) { + return false; + } + if (Execute) goto LAB_080bb399; + } + else { + Object::getObjectType(local_64); + bVar1 = ObjectType::getFlag((ObjectType *)local_64,UNPASS); + if (bVar1) { + Object::getObjectType(local_64); + bVar1 = ObjectType::getFlag((ObjectType *)local_64,UNMOVE); + if (bVar1) { + return false; + } + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].KickBoxes == + false) { + bVar1 = false; + if (this->Master != 0) { + pTVar7 = (TMonster *)GetCreature(this->Master); + if ((pTVar7 == (TMonster *)0x0) || + ((pTVar7->super_TNonplayer).super_TCreature.Type != MONSTER)) + { + bVar1 = false; + } + else { + bVar1 = CanKickBoxes(pTVar7); + } + } + } + else { + bVar1 = true; + } + if (bVar1 == false) { + return false; + } + if (!Execute) goto LAB_080bb4af; +LAB_080bb5cf: + local_4c[0].ObjectID = local_2c; + KickBoxes(this,local_4c); + goto LAB_080bb1d4; + } +LAB_080bb4af: + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,AVOID); + if (bVar1) { + if ((this->super_TNonplayer).State == PANIC) { + Object::getObjectType(local_4c); + uVar6 = ObjectType::getAttribute + ((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar6 != 0) goto LAB_080bb357; + } + iVar3 = (this->super_TNonplayer).super_TCreature.Race; + if (RaceData[iVar3].NoBurning != false) { + Object::getObjectType(local_4c); + uVar6 = ObjectType::getAttribute + ((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar6 == 4) goto LAB_080bb357; + iVar3 = (this->super_TNonplayer).super_TCreature.Race; + } + if (RaceData[iVar3].NoPoison != false) { + Object::getObjectType(local_4c); + uVar6 = ObjectType::getAttribute + ((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar6 == 2) goto LAB_080bb357; + iVar3 = (this->super_TNonplayer).super_TCreature.Race; + } + if (RaceData[iVar3].NoEnergy != false) { + Object::getObjectType(local_4c); + uVar6 = ObjectType::getAttribute + ((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar6 == 8) goto LAB_080bb357; + } + Object::getObjectType(local_4c); + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,UNMOVE); + if (bVar1) { + return false; + } + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].KickBoxes == + false) { + bVar1 = false; + if (this->Master != 0) { + pTVar7 = (TMonster *)GetCreature(this->Master); + if ((pTVar7 == (TMonster *)0x0) || + ((pTVar7->super_TNonplayer).super_TCreature.Type != MONSTER)) + { + bVar1 = false; + } + else { + bVar1 = CanKickBoxes(pTVar7); + } + } + } + else { + bVar1 = true; + } + if (bVar1 == false) { + return false; + } + if (Execute) goto LAB_080bb5cf; + } + } +LAB_080bb357: + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + if (local_3c[0].ObjectID == ::NONE.ObjectID) { + return true; + } + } while( true ); + } + error(&DAT_08106140,(this->super_TNonplayer).super_TCreature.Name,x,y,z); + goto LAB_080bb3b7; + } + error("TMonster::MovePossible: Monster %s an [%d,%d,%d] darf sich nicht bewegen.\n", + (this->super_TNonplayer).super_TCreature.Name, + (this->super_TNonplayer).super_TCreature.posx, + (this->super_TNonplayer).super_TCreature.posy, + (this->super_TNonplayer).super_TCreature.posz); + } + else { + // try { // try from 080bb0ca to 080bb83f has its CatchHandler @ 080bb855 + error(&DAT_08106080,(this->super_TNonplayer).super_TCreature.posx, + (this->super_TNonplayer).super_TCreature.posy,iVar3,x,y,z); + } + return false; +LAB_080bb399: + if (pTVar4->Type == PLAYER) { + this->Target = 0; + goto LAB_080bb3b7; + } + bVar1 = KickCreature(this,pTVar4); + if (!bVar1) { +LAB_080bb3b7: + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x31; + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + } + goto LAB_080bb1d4; +} + + + +// DWARF original prototype: bool IsPeaceful(TMonster * this) + +bool __thiscall TMonster::IsPeaceful(TMonster *this) + +{ + return this->Master != 0 && this->Master < 0x40000000; +} + + + +// DWARF original prototype: bool CanKickBoxes(TMonster * this) + +bool __thiscall TMonster::CanKickBoxes(TMonster *this) + +{ + bool bVar1; + TCreature *master; + TMonster *this_00; + + if (RaceData[(this->super_TNonplayer).super_TCreature.Race].KickBoxes == false) { + bVar1 = false; + if (this->Master != 0) { + this_00 = (TMonster *)GetCreature(this->Master); + if ((this_00 == (TMonster *)0x0) || + ((this_00->super_TNonplayer).super_TCreature.Type != MONSTER)) { + bVar1 = false; + } + else { + bVar1 = CanKickBoxes(this_00); + } + } + } + else { + bVar1 = true; + } + return bVar1; +} + + + +// DWARF original prototype: void KickBoxes(TMonster * this, Object * Obj) + +void __thiscall TMonster::KickBoxes(TMonster *this,Object *Obj) + +{ + bool bVar1; + bool bVar2; + int iVar3; + ulong CreatureID; + RESULT r; + Object *Obj_00; + Object *Ignore; + int local_58; + int x; + int y; + int z; + Object local_3c [4]; + Object local_2c [7]; + + bVar1 = Object::exists(Obj); + if (!bVar1) { + error(&DAT_08106200); + return; + } + local_2c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_2c,&local_58,&x,&y); + iVar3 = (this->super_TNonplayer).super_TCreature.posy; + if (x + -1 != iVar3) { + bVar1 = false; + // try { // try from 080bb98b to 080bbc66 has its CatchHandler @ 080bbc80 + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + local_2c[0].ObjectID = ::NONE.ObjectID; + GetMapContainer((int)local_3c,local_58,x + -1); + Ignore = local_2c; + Obj_00 = (Object *)&z; + z = Obj->ObjectID; + CreatureID = (this->super_TNonplayer).super_TCreature.ID; + goto LAB_080bbb13; + } + iVar3 = (this->super_TNonplayer).super_TCreature.posy; + } + if (x + 1 == iVar3) { +LAB_080bb9ec: + iVar3 = (this->super_TNonplayer).super_TCreature.posx; + if (local_58 + -1 != iVar3) { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (bVar1) { + z = ::NONE.ObjectID; + local_58 = local_58 + -1; + goto LAB_080bbad4; + } + iVar3 = (this->super_TNonplayer).super_TCreature.posx; + } + if (local_58 + 1 == iVar3) { +LAB_080bba7c: + z = Obj->ObjectID; + GraphicalEffect((Object *)&z,4); + z = Obj->ObjectID; + Delete((Object *)&z,-1); + return; + } + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (!bVar1) goto LAB_080bba7c; + z = ::NONE.ObjectID; + local_58 = local_58 + 1; + } + else { + bVar1 = false; + bVar2 = CoordinateFlag(); + if (bVar2) { + bVar1 = CoordinateFlag(); + bVar1 = !bVar1; + } + if (!bVar1) goto LAB_080bb9ec; + z = ::NONE.ObjectID; + x = x + 1; + } +LAB_080bbad4: + Ignore = (Object *)&z; + ::NONE.ObjectID = z; + GetMapContainer((int)local_3c,local_58,x); + local_2c[0] = (Object)Obj->ObjectID; + Obj_00 = local_2c; + CreatureID = (this->super_TNonplayer).super_TCreature.ID; +LAB_080bbb13: + Move(CreatureID,Obj_00,local_3c,-1,false,Ignore); + return; +} + + + +// DWARF original prototype: bool KickCreature(TMonster * this, TCreature * Obstacle) + +bool __thiscall TMonster::KickCreature(TMonster *this,TCreature *Obstacle) + +{ + int iVar1; + TSkill *pTVar2; + bool bVar3; + RESULT r; + int iVar4; + int iVar5; + int iVar6; + Object *Obj_00; + int iVar7; + int x; + char *Text; + Object *Ignore; + int z; + int y; + ushort HelpY; + ushort HelpX; + Object local_4c; + Object Obj; + Object local_3c [4]; + Object local_2c [7]; + + if (Obstacle == (TCreature *)0x0) { + Text = &DAT_08106360; +LAB_080bbd4d: + error(Text); + return false; + } + if (Obstacle->Type != MONSTER) { + Text = "TMonster::KickCreature: Zu verschiebende Kreatur ist kein Monster.\n"; + goto LAB_080bbd4d; + } + print(); + iVar6 = Obstacle->posy; + iVar5 = Obstacle->posx; + iVar1 = Obstacle->posz; + iVar7 = iVar6 + -1; + iVar4 = (this->super_TNonplayer).super_TCreature.posy; + if (iVar7 != iVar4) { + // try { // try from 080bbde8 to 080bc0cf has its CatchHandler @ 080bc0f3 + iVar4 = (*Obstacle->_vptr_TCreature[3])(Obstacle,iVar5,iVar7,iVar1,1,0); + if (((char)iVar4 != '\0') && (bVar3 = CoordinateFlag(), !bVar3)) { + local_2c[0].ObjectID = ::NONE.ObjectID; + GetMapContainer((int)local_3c,iVar5,iVar7); + local_4c.ObjectID = (Obstacle->CrObject).ObjectID; + Obj_00 = &local_4c; + Ignore = local_2c; + goto LAB_080bbfb2; + } + iVar4 = (this->super_TNonplayer).super_TCreature.posy; + } + iVar7 = iVar6 + 1; + if (((iVar7 != iVar4) && + (iVar4 = (*Obstacle->_vptr_TCreature[3])(Obstacle,iVar5,iVar7,iVar1,1,0), + (char)iVar4 != '\0')) && (bVar3 = CoordinateFlag(), !bVar3)) { + local_4c.ObjectID = ::NONE.ObjectID; + GetMapContainer((int)local_3c,iVar5,iVar7); + local_2c[0].ObjectID = (Obstacle->CrObject).ObjectID; + Obj_00 = local_2c; + Ignore = &local_4c; + goto LAB_080bbfb2; + } + iVar4 = iVar5 + -1; + iVar7 = (this->super_TNonplayer).super_TCreature.posx; + if (iVar4 == iVar7) { +LAB_080bbe7e: + iVar4 = iVar5 + 1; + if (((iVar4 == iVar7) || + (iVar5 = (*Obstacle->_vptr_TCreature[3])(Obstacle,iVar4,iVar6,iVar1,1,0), + (char)iVar5 == '\0')) || (bVar3 = CoordinateFlag(), bVar3)) { + print(); + local_4c.ObjectID = (Obstacle->CrObject).ObjectID; + GraphicalEffect(&local_4c,4); + iVar6 = TSkill::Get((Obstacle->super_TSkillBase).Skills[2]); + TCombat::AddDamageToCombatList + (&Obstacle->Combat,(this->super_TNonplayer).super_TCreature.ID,(ushort)iVar6); + pTVar2 = (Obstacle->super_TSkillBase).Skills[2]; + (*pTVar2->_vptr_TSkill[2])(pTVar2,0); + (*Obstacle->_vptr_TCreature[2])(Obstacle); + return false; + } + } + else { + iVar7 = (*Obstacle->_vptr_TCreature[3])(Obstacle,iVar4,iVar6,iVar1,1,0); + if (((char)iVar7 == '\0') || (bVar3 = CoordinateFlag(), bVar3)) { + iVar7 = (this->super_TNonplayer).super_TCreature.posx; + goto LAB_080bbe7e; + } + } + local_4c.ObjectID = ::NONE.ObjectID; + GetMapContainer((int)local_3c,iVar4,iVar6); + local_2c[0].ObjectID = (Obstacle->CrObject).ObjectID; + Ignore = &local_4c; + Obj_00 = local_2c; +LAB_080bbfb2: + Move((this->super_TNonplayer).super_TCreature.ID,Obj_00,local_3c,-1,false,Ignore); + return true; +} + + + +// DWARF original prototype: void Convince(TMonster * this, TCreature * newMaster) + +void __thiscall TMonster::Convince(TMonster *this,TCreature *newMaster) + +{ + TCreature *oldMaster; + TCreature *pTVar1; + + if (this->Home != 0) { + NotifyMonsterhomeOfDeath(this->Home); + } + this->Home = 0; + if (this->Master != 0) { + pTVar1 = GetCreature(this->Master); + if (pTVar1 != (TCreature *)0x0) { + pTVar1->SummonedCreatures = pTVar1->SummonedCreatures + -1; + } + } + this->Master = newMaster->ID; + newMaster->SummonedCreatures = newMaster->SummonedCreatures + 1; + TCreature::ToDoClear((TCreature *)this); + TCreature::ToDoWait((TCreature *)this,100); + TCreature::ToDoStart((TCreature *)this); + return; +} + + + +// DWARF original prototype: void SetTarget(TMonster * this, TCreature * NewTarget) + +void __thiscall TMonster::SetTarget(TMonster *this,TCreature *NewTarget) + +{ + if (NewTarget == (TCreature *)0x0) { + error("TMonster::SetTarget: NewTarget ist NULL.\n"); + return; + } + if (this->Master != 0) { + return; + } + TCreature::Rotate((TCreature *)this,NewTarget); + this->Target = NewTarget->ID; + TCreature::ToDoYield((TCreature *)this); + return; +} + + + +// WARNING: Variable defined which should be unmapped: ShowEffect_local + +TCreature * CreateMonster(int Race,int x,int y,int z,int Home,ulong Father,bool ShowEffect) + +{ + bool bVar1; + TMonster *this; + char *Text; + bool ShowEffect_local; + + bVar1 = ShowEffect; + if (Race - 1U < 0x1ff) { + if (RaceData[Race].Name[0] != '\0') { + SearchFreeField(&x,&y,&z,2,0,false); + this = (TMonster *)operator_new(0x32c); + // try { // try from 080bc3ec to 080bc3f0 has its CatchHandler @ 080bc431 + TMonster::TMonster(this); + if (!bVar1) { + return (TCreature *)this; + } + GraphicalEffect(); + return (TCreature *)this; + } + Text = &DAT_08104f00; + } + else { + Text = &DAT_08104f40; + } + error(Text,Race); + return (TCreature *)0x0; +} + + + +void ConvinceMonster(TCreature *Master,TCreature *Slave) + +{ + if (Master == (TCreature *)0x0) { + Master = (TCreature *)s_ConvinceMonster__Master_existier_08106520; + } + else if (Slave == (TCreature *)0x0) { + Master = (TCreature *)s_ConvinceMonster__Slave_existiert_081064e0; + } + else { + if (Slave->Type == MONSTER) { + TMonster::Convince((TMonster *)Slave,Master); + return; + } + Master = (TCreature *)s_ConvinceMonster__Slave_ist_kein_M_081064a0; + } + error((char *)Master); + return; +} + + + +void ChallengeMonster(TCreature *Challenger,TCreature *Monster) + +{ + if (Challenger == (TCreature *)0x0) { + Challenger = (TCreature *)s_ChallengeMonster__Herausforderer_081065e0; + } + else if (Monster == (TCreature *)0x0) { + Challenger = (TCreature *)s_ChallengeMonster__Monster_existi_081065a0; + } + else { + if (Monster->Type == MONSTER) { + if (Monster[1].super_TSkillBase.Skills[1] != (TSkill *)0x0) { + return; + } + TCreature::Rotate(Monster,Challenger); + Monster[1].super_TSkillBase.Skills[2] = (TSkill *)Challenger->ID; + TCreature::ToDoYield(Monster); + return; + } + Challenger = (TCreature *)s_ChallengeMonster__Monster_ist_ke_08106560; + } + error((char *)Challenger); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitNPCs(void) + +{ + char *__s; + dirent *DirEntry; + DIR *__dirp; + dirent *pdVar1; + size_t sVar2; + TNPC *this; + undefined4 *puVar3; + int iVar4; + char *s; + char *pcVar5; + char *pcVar6; + bool bVar7; + DIR *WorkDir; + char FileName [4096]; + + __dirp = opendir(NPCPATH); + if (__dirp == (DIR *)0x0) { + // try { // try from 080bc5fd to 080bc62b has its CatchHandler @ 080bc649 + error("InitNPCs: Unterverzeichnis %s nicht gefunden\n",NPCPATH); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "Cannot init NPCs"; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); + } + do { + do { + pdVar1 = readdir(__dirp); + if (pdVar1 == (dirent *)0x0) { + closedir(__dirp); + return; + } + __s = pdVar1->d_name; + sVar2 = strlen(__s); + bVar7 = sVar2 == 4; + } while (sVar2 < 5); + iVar4 = 4; + pcVar5 = __s + (sVar2 - 4); + pcVar6 = ".npc"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + bVar7 = *pcVar5 == *pcVar6; + pcVar5 = pcVar5 + 1; + pcVar6 = pcVar6 + 1; + } while (bVar7); + if (bVar7) { + sprintf((char *)&WorkDir,"%s/%s",NPCPATH,__s); + // try { // try from 080bc5c0 to 080bc5c4 has its CatchHandler @ 080bc649 + this = (TNPC *)operator_new(900); + // try { // try from 080bc5ce to 080bc5d2 has its CatchHandler @ 080bc62c + TNPC::TNPC(this,(char *)&WorkDir); + } + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitNonplayer(void) + +{ + store *psVar1; + list<> *plVar2; + + // try { // try from 080bc67e to 080bc69e has its CatchHandler @ 080bc710 + print(); + FirstFreeNonplayer = 0; + CurrentNonplayer = 0; + psVar1 = (store *)operator_new(8); + // try { // try from 080bc6a8 to 080bc6ac has its CatchHandler @ 080bc6e0 + plVar2 = (list<> *)operator_new(8); + plVar2->firstNode = (listnode<> *)0x0; + plVar2->lastNode = (listnode<> *)0x0; + psVar1->Units = plVar2; + psVar1->firstFreeItem = (storeitem *)0x0; + NodeTable = psVar1; + // try { // try from 080bc6c9 to 080bc6d2 has its CatchHandler @ 080bc710 + InitNPCs(); + LoadMonsterhomes(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitNonplayer(void) + +{ + TNonplayer *pTVar1; + list<> *this; + listnode<> *__filename; + store *psVar2; + TNonplayer **ppTVar3; + + if (0 < FirstFreeNonplayer) { + do { + ppTVar3 = vector<>::operator()(&NonplayerList,0); + pTVar1 = *ppTVar3; + if (pTVar1 != (TNonplayer *)0x0) { + (*(pTVar1->super_TCreature)._vptr_TCreature[1])(pTVar1); + } + } while (0 < FirstFreeNonplayer); + } + psVar2 = NodeTable; + if (NodeTable != (store *)0x0) { + this = NodeTable->Units; + if (this != (list<> *)0x0) { + __filename = this->firstNode; + while (__filename != (listnode<> *)0x0) { + list<>::remove(this,(char *)__filename); + __filename = this->firstNode; + } + operator_delete(this); + } + operator_delete(psVar2); + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + if (NonplayerList.entry == (TNonplayer **)0x0) { + return; + } + operator_delete__(NonplayerList.entry); + return; +} + + + +void __tcf_1(void *param_1) + +{ + if (Monsterhome.entry == (TMonsterhome *)0x0) { + return; + } + operator_delete__(Monsterhome.entry); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_NonplayerList(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: ulong GetMaster(TMonster * this) + +ulong __thiscall TMonster::GetMaster(TMonster *this) + +{ + return this->Master; +} + + + +// DWARF original prototype: TNode * getFreeItem(store * this) + +TNode * __thiscall store::getFreeItem(store *this) + +{ + listnode<> *plVar1; + storeitem *psVar2; + storeunit *psVar3; + int i; + int iVar4; + int iVar5; + storeunit *local_14; + + psVar2 = this->firstFreeItem; + if (psVar2 == (storeitem *)0x0) { + plVar1 = list<>::append(this->Units); + iVar4 = 0; + do { + if (plVar1 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + local_14 = (storeunit *)0x0; + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar3 = (storeunit *)0x0; + } + else { + local_14 = &plVar1->data; + psVar3 = &plVar1->data; + } + iVar5 = iVar4 + 1; + local_14->item[iVar4].next = psVar3->item + iVar4 + 1; + iVar4 = iVar5; + } while (iVar5 < 0xff); + if (plVar1 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar3 = (storeunit *)0x0; + } + else { + psVar3 = &plVar1->data; + } + psVar3->item[0xff].next = (storeitem *)0x0; + if (plVar1 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar2 = (storeitem *)0x0; + } + else { + psVar2 = (plVar1->data).item; + } + this->firstFreeItem = psVar2; + } + this->firstFreeItem = psVar2->next; + return (TNode *)psVar2; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TCondition *pTVar1; + int iVar2; + TCondition *pTVar3; + + iVar2 = (max - min) + 1; + (this->init).Type = 0; + (this->init).Text = 0; + this->min = min; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + iVar2 = this->space; + pTVar1 = (TCondition *)operator_new__(iVar2 * 0x14); + pTVar3 = pTVar1; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + pTVar3->Type = 0; + pTVar3->Text = 0; + pTVar3 = pTVar3 + 1; + } + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + TAction *pTVar1; + int iVar2; + TAction *pTVar3; + + iVar2 = (max - min) + 1; + (this->init).Type = 0; + (this->init).Text = 0; + this->min = min; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + iVar2 = this->space; + pTVar1 = (TAction *)operator_new__(iVar2 * 0x18); + pTVar3 = pTVar1; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + pTVar3->Type = 0; + pTVar3->Text = 0; + pTVar3 = pTVar3 + 1; + } + this->entry = pTVar1; + return; +} + + + +// DWARF original prototype: TCondition * operator()(vector * this, int i) + +TCondition * __thiscall vector::operator()(vector *this,int i) + +{ + ulong uVar1; + TNode *pTVar2; + int iVar3; + TCondition *pTVar4; + TCondition *pTVar5; + int iVar6; + int iVar7; + int iVar8; + int iVar9; + int iVar10; + int j_1; + int j; + int local_40; + int extend; + uchar Help [20]; + + iVar8 = this->start; + while (i < iVar8) { + local_40 = this->block; + if (local_40 == 0) { + iVar8 = this->space; + local_40 = iVar8; + } + else { + iVar8 = this->space; + } + iVar8 = local_40 + iVar8; + pTVar4 = (TCondition *)operator_new__(iVar8 * 0x14); + pTVar5 = pTVar4; + while (iVar8 = iVar8 + -1, iVar8 != -1) { + pTVar5->Type = 0; + pTVar5->Text = 0; + pTVar5 = pTVar5 + 1; + } + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar6 = (iVar8 - this->start) + local_40; + iVar10 = pTVar4[iVar6].Type; + uVar1 = pTVar4[iVar6].Text; + pTVar2 = pTVar4[iVar6].Expression; + iVar3 = pTVar4[iVar6].Property; + iVar9 = pTVar4[iVar6].Number; + iVar7 = iVar8 - this->start; + iVar6 = local_40 + iVar7; + pTVar5 = this->entry; + pTVar4[iVar6].Type = pTVar5[iVar7].Type; + pTVar4[iVar6].Text = pTVar5[iVar7].Text; + pTVar4[iVar6].Expression = pTVar5[iVar7].Expression; + pTVar4[iVar6].Property = pTVar5[iVar7].Property; + pTVar4[iVar6].Number = pTVar5[iVar7].Number; + iVar6 = iVar8 + 1; + iVar8 = iVar8 - this->start; + pTVar5 = this->entry; + pTVar5[iVar8].Type = iVar10; + pTVar5[iVar8].Text = uVar1; + pTVar5[iVar8].Expression = pTVar2; + pTVar5[iVar8].Property = iVar3; + pTVar5[iVar8].Number = iVar9; + iVar8 = iVar6; + } while (iVar6 <= this->max); + } + if (this->entry != (TCondition *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start - local_40; + this->start = iVar8; + this->space = this->space + local_40; + } + iVar10 = this->space; + iVar6 = iVar10 + iVar8; + while (iVar6 <= i) { + iVar6 = this->block; + if (this->block == 0) { + iVar6 = iVar10; + } + iVar10 = iVar6 + iVar10; + pTVar4 = (TCondition *)operator_new__(iVar10 * 0x14); + pTVar5 = pTVar4; + while (iVar10 = iVar10 + -1, iVar10 != -1) { + pTVar5->Type = 0; + pTVar5->Text = 0; + pTVar5 = pTVar5 + 1; + } + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + iVar10 = pTVar4[iVar9].Type; + uVar1 = pTVar4[iVar9].Text; + pTVar2 = pTVar4[iVar9].Expression; + iVar3 = pTVar4[iVar9].Property; + iVar9 = pTVar4[iVar9].Number; + pTVar5 = this->entry; + iVar7 = iVar8 - this->start; + pTVar4[iVar7].Type = pTVar5[iVar7].Type; + pTVar4[iVar7].Text = pTVar5[iVar7].Text; + pTVar4[iVar7].Expression = pTVar5[iVar7].Expression; + pTVar4[iVar7].Property = pTVar5[iVar7].Property; + pTVar4[iVar7].Number = pTVar5[iVar7].Number; + iVar7 = iVar8 + 1; + pTVar5 = this->entry; + iVar8 = iVar8 - this->start; + pTVar5[iVar8].Type = iVar10; + pTVar5[iVar8].Text = uVar1; + pTVar5[iVar8].Expression = pTVar2; + pTVar5[iVar8].Property = iVar3; + pTVar5[iVar8].Number = iVar9; + iVar8 = iVar7; + } while (iVar7 <= this->max); + } + if (this->entry != (TCondition *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar4; + iVar8 = this->start; + iVar10 = this->space + iVar6; + this->space = iVar10; + iVar6 = iVar10 + iVar8; + } + iVar6 = this->min; + while (i < iVar6) { + this->min = iVar6 + -1; + if (this->initialized != false) { + iVar8 = (iVar6 + -1) - iVar8; + pTVar5 = this->entry; + pTVar5[iVar8].Type = (this->init).Type; + pTVar5[iVar8].Text = (this->init).Text; + pTVar5[iVar8].Expression = (this->init).Expression; + pTVar5[iVar8].Property = (this->init).Property; + pTVar5[iVar8].Number = (this->init).Number; + iVar8 = this->start; + } + iVar6 = this->min; + } + iVar6 = this->max; + while (iVar6 < i) { + this->max = iVar6 + 1; + if (this->initialized != false) { + iVar8 = (iVar6 + 1) - iVar8; + pTVar5 = this->entry; + pTVar5[iVar8].Type = (this->init).Type; + pTVar5[iVar8].Text = (this->init).Text; + pTVar5[iVar8].Expression = (this->init).Expression; + pTVar5[iVar8].Property = (this->init).Property; + pTVar5[iVar8].Number = (this->init).Number; + iVar8 = this->start; + } + iVar6 = this->max; + } + return this->entry + (i - iVar8); +} + + + +// DWARF original prototype: TAction * operator()(vector * this, int i) + +TAction * __thiscall vector::operator()(vector *this,int i) + +{ + ulong uVar1; + int iVar2; + TNode *pTVar3; + TNode *pTVar4; + TNode *pTVar5; + TAction *pTVar6; + TAction *pTVar7; + int iVar8; + int iVar9; + int iVar10; + int iVar11; + int j_1; + int j; + int local_40; + int extend; + uchar Help [24]; + + iVar10 = this->start; + while (i < iVar10) { + local_40 = this->block; + if (local_40 == 0) { + iVar10 = this->space; + local_40 = iVar10; + } + else { + iVar10 = this->space; + } + iVar10 = local_40 + iVar10; + pTVar6 = (TAction *)operator_new__(iVar10 * 0x18); + pTVar7 = pTVar6; + while (iVar10 = iVar10 + -1, iVar10 != -1) { + pTVar7->Type = 0; + pTVar7->Text = 0; + pTVar7 = pTVar7 + 1; + } + iVar10 = this->min; + if (iVar10 <= this->max) { + do { + iVar8 = (iVar10 - this->start) + local_40; + iVar11 = pTVar6[iVar8].Type; + uVar1 = pTVar6[iVar8].Text; + iVar2 = pTVar6[iVar8].Number; + pTVar3 = pTVar6[iVar8].Expression; + pTVar4 = pTVar6[iVar8].Expression2; + pTVar5 = pTVar6[iVar8].Expression3; + iVar9 = iVar10 - this->start; + iVar8 = local_40 + iVar9; + pTVar7 = this->entry; + pTVar6[iVar8].Type = pTVar7[iVar9].Type; + pTVar6[iVar8].Text = pTVar7[iVar9].Text; + pTVar6[iVar8].Number = pTVar7[iVar9].Number; + pTVar6[iVar8].Expression = pTVar7[iVar9].Expression; + pTVar6[iVar8].Expression2 = pTVar7[iVar9].Expression2; + pTVar6[iVar8].Expression3 = pTVar7[iVar9].Expression3; + iVar8 = iVar10 + 1; + iVar10 = iVar10 - this->start; + pTVar7 = this->entry; + pTVar7[iVar10].Type = iVar11; + pTVar7[iVar10].Text = uVar1; + pTVar7[iVar10].Number = iVar2; + pTVar7[iVar10].Expression = pTVar3; + pTVar7[iVar10].Expression2 = pTVar4; + pTVar7[iVar10].Expression3 = pTVar5; + iVar10 = iVar8; + } while (iVar8 <= this->max); + } + if (this->entry != (TAction *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar10 = this->start - local_40; + this->start = iVar10; + this->space = this->space + local_40; + } + iVar11 = this->space; + iVar8 = iVar11 + iVar10; + while (iVar8 <= i) { + iVar8 = this->block; + if (this->block == 0) { + iVar8 = iVar11; + } + iVar11 = iVar8 + iVar11; + pTVar6 = (TAction *)operator_new__(iVar11 * 0x18); + pTVar7 = pTVar6; + while (iVar11 = iVar11 + -1, iVar11 != -1) { + pTVar7->Type = 0; + pTVar7->Text = 0; + pTVar7 = pTVar7 + 1; + } + iVar10 = this->min; + if (iVar10 <= this->max) { + do { + iVar9 = iVar10 - this->start; + iVar11 = pTVar6[iVar9].Type; + uVar1 = pTVar6[iVar9].Text; + iVar2 = pTVar6[iVar9].Number; + pTVar3 = pTVar6[iVar9].Expression; + pTVar4 = pTVar6[iVar9].Expression2; + pTVar5 = pTVar6[iVar9].Expression3; + pTVar7 = this->entry; + iVar9 = iVar10 - this->start; + pTVar6[iVar9].Type = pTVar7[iVar9].Type; + pTVar6[iVar9].Text = pTVar7[iVar9].Text; + pTVar6[iVar9].Number = pTVar7[iVar9].Number; + pTVar6[iVar9].Expression = pTVar7[iVar9].Expression; + pTVar6[iVar9].Expression2 = pTVar7[iVar9].Expression2; + pTVar6[iVar9].Expression3 = pTVar7[iVar9].Expression3; + iVar9 = iVar10 + 1; + pTVar7 = this->entry; + iVar10 = iVar10 - this->start; + pTVar7[iVar10].Type = iVar11; + pTVar7[iVar10].Text = uVar1; + pTVar7[iVar10].Number = iVar2; + pTVar7[iVar10].Expression = pTVar3; + pTVar7[iVar10].Expression2 = pTVar4; + pTVar7[iVar10].Expression3 = pTVar5; + iVar10 = iVar9; + } while (iVar9 <= this->max); + } + if (this->entry != (TAction *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar10 = this->start; + iVar11 = this->space + iVar8; + this->space = iVar11; + iVar8 = iVar11 + iVar10; + } + iVar8 = this->min; + while (i < iVar8) { + this->min = iVar8 + -1; + if (this->initialized != false) { + iVar10 = (iVar8 + -1) - iVar10; + pTVar7 = this->entry; + pTVar7[iVar10].Type = (this->init).Type; + pTVar7[iVar10].Text = (this->init).Text; + pTVar7[iVar10].Number = (this->init).Number; + pTVar7[iVar10].Expression = (this->init).Expression; + pTVar7[iVar10].Expression2 = (this->init).Expression2; + pTVar7[iVar10].Expression3 = (this->init).Expression3; + iVar10 = this->start; + } + iVar8 = this->min; + } + iVar8 = this->max; + while (iVar8 < i) { + this->max = iVar8 + 1; + if (this->initialized != false) { + iVar10 = (iVar8 + 1) - iVar10; + pTVar7 = this->entry; + pTVar7[iVar10].Type = (this->init).Type; + pTVar7[iVar10].Text = (this->init).Text; + pTVar7[iVar10].Number = (this->init).Number; + pTVar7[iVar10].Expression = (this->init).Expression; + pTVar7[iVar10].Expression2 = (this->init).Expression2; + pTVar7[iVar10].Expression3 = (this->init).Expression3; + iVar10 = this->start; + } + iVar8 = this->max; + } + return this->entry + (i - iVar10); +} + + + +// DWARF original prototype: void vector(vector * this, int min, int max, int block) + +void __thiscall vector::vector(vector *this,int min,int max,int block) + +{ + int *piVar1; + int iVar2; + TBehaviour *this_00; + + TBehaviour::TBehaviour(&this->init); + this->min = min; + iVar2 = (max - min) + 1; + this->max = max; + this->start = min; + this->space = iVar2; + this->block = block; + this->initialized = false; + if (iVar2 < 1) { + error("vector: Ungueltige Feldgroesse %d bis %d.\n",min,max); + this->max = max; + this->space = 1; + } + if (block < 0) { + // try { // try from 080bd30f to 080bd330 has its CatchHandler @ 080bd388 + error("vector: Ungueltige Blockgroesse %d.\n",block); + this->block = 0; + } + iVar2 = this->space; + // try { // try from 080bd2b8 to 080bd2bc has its CatchHandler @ 080bd388 + piVar1 = (int *)operator_new__(iVar2 * 0x6c + 4); + *piVar1 = iVar2; + this_00 = (TBehaviour *)(piVar1 + 1); + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 080bd2d3 to 080bd2d7 has its CatchHandler @ 080bd340 + TBehaviour::TBehaviour(this_00); + this_00 = this_00 + 1; + } + this->entry = (TBehaviour *)(piVar1 + 1); + return; +} + + + +// DWARF original prototype: TBehaviour * operator()(vector * this, int i) + +TBehaviour * __thiscall vector::operator()(vector *this,int i) + +{ + int j; + int *piVar1; + int iVar2; + int iVar3; + int iVar4; + TBehaviour *pTVar5; + int iVar6; + TBehaviour *pTVar7; + TBehaviour *pTVar8; + int in_stack_ffffff48; + int extend_1; + int local_90; + int extend; + uchar Help [108]; + + iVar2 = this->start; + while (i < iVar2) { + local_90 = this->block; + if (local_90 == 0) { + iVar2 = this->space; + local_90 = iVar2; + } + else { + iVar2 = this->space; + } + iVar2 = local_90 + iVar2; + piVar1 = (int *)operator_new__(iVar2 * 0x6c + 4); + *piVar1 = iVar2; + pTVar8 = (TBehaviour *)(piVar1 + 1); + pTVar5 = pTVar8; + while (iVar2 = iVar2 + -1, iVar2 != -1) { + // try { // try from 080bd40f to 080bd413 has its CatchHandler @ 080bd750 + TBehaviour::TBehaviour(pTVar5); + pTVar5 = pTVar5 + 1; + } + iVar2 = this->min; + if (iVar2 <= this->max) { + do { + pTVar5 = pTVar8 + (iVar2 - this->start) + local_90; + piVar1 = &extend; + for (iVar3 = 0x1b; iVar3 != 0; iVar3 = iVar3 + -1) { + *piVar1 = (pTVar5->Condition).min; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + piVar1 = piVar1 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar7 = pTVar8 + local_90 + iVar6; + for (iVar3 = 0x1b; iVar3 != 0; iVar3 = iVar3 + -1) { + (pTVar7->Condition).min = (pTVar5->Condition).min; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + pTVar7 = (TBehaviour *)&(pTVar7->Condition).max; + } + iVar3 = iVar2 + 1; + piVar1 = &extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + (pTVar5->Condition).min = *piVar1; + piVar1 = piVar1 + 1; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + } + iVar2 = iVar3; + } while (iVar3 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TBehaviour *)0x0) { + pTVar7 = pTVar5 + pTVar5[-1].Actions; + while (pTVar5 != pTVar7) { + pTVar7 = pTVar7 + -1; + TBehaviour::~TBehaviour(pTVar7,in_stack_ffffff48); + pTVar5 = this->entry; + } + operator_delete__(&pTVar5[-1].Actions); + } + this->entry = pTVar8; + iVar2 = this->start - local_90; + this->start = iVar2; + this->space = this->space + local_90; + } + iVar6 = this->space; + iVar3 = iVar6 + iVar2; + while (iVar3 <= i) { + iVar3 = iVar6; + if (this->block != 0) { + iVar3 = this->block; + } + iVar6 = iVar3 + iVar6; + piVar1 = (int *)operator_new__(iVar6 * 0x6c + 4); + *piVar1 = iVar6; + pTVar8 = (TBehaviour *)(piVar1 + 1); + pTVar5 = pTVar8; + while (iVar6 = iVar6 + -1, iVar6 != -1) { + // try { // try from 080bd593 to 080bd597 has its CatchHandler @ 080bd7b4 + TBehaviour::TBehaviour(pTVar5); + pTVar5 = pTVar5 + 1; + } + if (this->min <= this->max) { + iVar2 = this->min; + do { + pTVar5 = pTVar8 + (iVar2 - this->start); + piVar1 = &extend; + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + *piVar1 = (pTVar5->Condition).min; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + piVar1 = piVar1 + 1; + } + iVar6 = iVar2 - this->start; + pTVar5 = this->entry + iVar6; + pTVar7 = pTVar8 + iVar6; + for (iVar4 = 0x1b; iVar4 != 0; iVar4 = iVar4 + -1) { + (pTVar7->Condition).min = (pTVar5->Condition).min; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + pTVar7 = (TBehaviour *)&(pTVar7->Condition).max; + } + iVar6 = iVar2 + 1; + piVar1 = &extend; + pTVar5 = this->entry + (iVar2 - this->start); + for (iVar4 = 0x1b; iVar4 != 0; iVar4 = iVar4 + -1) { + (pTVar5->Condition).min = *piVar1; + piVar1 = piVar1 + 1; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + } + iVar2 = iVar6; + } while (iVar6 <= this->max); + } + pTVar5 = this->entry; + if (pTVar5 != (TBehaviour *)0x0) { + pTVar7 = pTVar5 + pTVar5[-1].Actions; + while (pTVar5 != pTVar7) { + pTVar7 = pTVar7 + -1; + TBehaviour::~TBehaviour(pTVar7,in_stack_ffffff48); + pTVar5 = this->entry; + } + operator_delete__(&pTVar5[-1].Actions); + } + iVar2 = this->start; + this->entry = pTVar8; + iVar6 = iVar3 + this->space; + this->space = iVar6; + iVar3 = iVar6 + iVar2; + } + iVar3 = this->min; + while (i < iVar3) { + this->min = iVar3 + -1; + if (this->initialized != false) { + pTVar8 = &this->init; + pTVar5 = this->entry + ((iVar3 + -1) - iVar2); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + (pTVar5->Condition).min = (pTVar8->Condition).min; + pTVar8 = (TBehaviour *)&(pTVar8->Condition).max; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + } + iVar2 = this->start; + } + iVar3 = this->min; + } + iVar3 = this->max; + while (iVar3 < i) { + this->max = iVar3 + 1; + if (this->initialized != false) { + pTVar8 = &this->init; + pTVar5 = this->entry + ((iVar3 + 1) - iVar2); + for (iVar6 = 0x1b; iVar6 != 0; iVar6 = iVar6 + -1) { + (pTVar5->Condition).min = (pTVar8->Condition).min; + pTVar8 = (TBehaviour *)&(pTVar8->Condition).max; + pTVar5 = (TBehaviour *)&(pTVar5->Condition).max; + } + iVar2 = this->start; + } + iVar3 = this->max; + } + return this->entry + (i - iVar2); +} + + + +// DWARF original prototype: TMonsterhome * operator()(vector * this, int i) + +TMonsterhome * __thiscall vector<>::operator()(vector<> *this,int i) + +{ + int iVar1; + int iVar2; + int iVar3; + int iVar4; + int iVar5; + int iVar6; + int iVar7; + TMonsterhome *pTVar8; + TMonsterhome *pTVar9; + int iVar10; + int iVar11; + int iVar12; + int iVar13; + TMonsterhome *help_1; + int iVar14; + TMonsterhome *help; + int j; + int local_50; + int extend; + uchar Help [36]; + + iVar11 = this->start; + while (i < iVar11) { + local_50 = this->block; + if (local_50 == 0) { + iVar11 = this->space; + local_50 = iVar11; + } + else { + iVar11 = this->space; + } + pTVar9 = (TMonsterhome *)operator_new__((local_50 + iVar11) * 0x24); + iVar11 = this->min; + if (iVar11 <= this->max) { + do { + iVar14 = (iVar11 - this->start) + local_50; + iVar13 = pTVar9[iVar14].Race; + iVar1 = pTVar9[iVar14].x; + iVar2 = pTVar9[iVar14].y; + iVar3 = pTVar9[iVar14].z; + iVar4 = pTVar9[iVar14].Radius; + iVar5 = pTVar9[iVar14].MaxMonsters; + iVar6 = pTVar9[iVar14].ActMonsters; + iVar7 = pTVar9[iVar14].RegenerationTime; + iVar12 = pTVar9[iVar14].Timer; + iVar10 = iVar11 - this->start; + iVar14 = local_50 + iVar10; + pTVar8 = this->entry; + pTVar9[iVar14].Race = pTVar8[iVar10].Race; + pTVar9[iVar14].x = pTVar8[iVar10].x; + pTVar9[iVar14].y = pTVar8[iVar10].y; + pTVar9[iVar14].z = pTVar8[iVar10].z; + pTVar9[iVar14].Radius = pTVar8[iVar10].Radius; + pTVar9[iVar14].MaxMonsters = pTVar8[iVar10].MaxMonsters; + pTVar9[iVar14].ActMonsters = pTVar8[iVar10].ActMonsters; + pTVar9[iVar14].RegenerationTime = pTVar8[iVar10].RegenerationTime; + pTVar9[iVar14].Timer = pTVar8[iVar10].Timer; + iVar14 = iVar11 + 1; + iVar11 = iVar11 - this->start; + pTVar8 = this->entry; + pTVar8[iVar11].Race = iVar13; + pTVar8[iVar11].x = iVar1; + pTVar8[iVar11].y = iVar2; + pTVar8[iVar11].z = iVar3; + pTVar8[iVar11].Radius = iVar4; + pTVar8[iVar11].MaxMonsters = iVar5; + pTVar8[iVar11].ActMonsters = iVar6; + pTVar8[iVar11].RegenerationTime = iVar7; + pTVar8[iVar11].Timer = iVar12; + iVar11 = iVar14; + } while (iVar14 <= this->max); + } + if (this->entry != (TMonsterhome *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar9; + iVar11 = this->start - local_50; + this->start = iVar11; + this->space = this->space + local_50; + } + iVar13 = this->space; + iVar14 = iVar13 + iVar11; + while (iVar14 <= i) { + iVar14 = this->block; + if (this->block == 0) { + iVar14 = iVar13; + } + pTVar9 = (TMonsterhome *)operator_new__((iVar14 + iVar13) * 0x24); + iVar11 = this->min; + if (iVar11 <= this->max) { + do { + iVar12 = iVar11 - this->start; + iVar13 = pTVar9[iVar12].Race; + iVar1 = pTVar9[iVar12].x; + iVar2 = pTVar9[iVar12].y; + iVar3 = pTVar9[iVar12].z; + iVar4 = pTVar9[iVar12].Radius; + iVar5 = pTVar9[iVar12].MaxMonsters; + iVar6 = pTVar9[iVar12].ActMonsters; + iVar7 = pTVar9[iVar12].RegenerationTime; + iVar12 = pTVar9[iVar12].Timer; + pTVar8 = this->entry; + iVar10 = iVar11 - this->start; + pTVar9[iVar10].Race = pTVar8[iVar10].Race; + pTVar9[iVar10].x = pTVar8[iVar10].x; + pTVar9[iVar10].y = pTVar8[iVar10].y; + pTVar9[iVar10].z = pTVar8[iVar10].z; + pTVar9[iVar10].Radius = pTVar8[iVar10].Radius; + pTVar9[iVar10].MaxMonsters = pTVar8[iVar10].MaxMonsters; + pTVar9[iVar10].ActMonsters = pTVar8[iVar10].ActMonsters; + pTVar9[iVar10].RegenerationTime = pTVar8[iVar10].RegenerationTime; + pTVar9[iVar10].Timer = pTVar8[iVar10].Timer; + iVar10 = iVar11 + 1; + pTVar8 = this->entry; + iVar11 = iVar11 - this->start; + pTVar8[iVar11].Race = iVar13; + pTVar8[iVar11].x = iVar1; + pTVar8[iVar11].y = iVar2; + pTVar8[iVar11].z = iVar3; + pTVar8[iVar11].Radius = iVar4; + pTVar8[iVar11].MaxMonsters = iVar5; + pTVar8[iVar11].ActMonsters = iVar6; + pTVar8[iVar11].RegenerationTime = iVar7; + pTVar8[iVar11].Timer = iVar12; + iVar11 = iVar10; + } while (iVar10 <= this->max); + } + if (this->entry != (TMonsterhome *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar9; + iVar11 = this->start; + iVar13 = this->space + iVar14; + this->space = iVar13; + iVar14 = iVar13 + iVar11; + } + iVar14 = this->min; + while (i < iVar14) { + this->min = iVar14 + -1; + if (this->initialized != false) { + iVar11 = (iVar14 + -1) - iVar11; + pTVar9 = this->entry; + pTVar9[iVar11].Race = (this->init).Race; + pTVar9[iVar11].x = (this->init).x; + pTVar9[iVar11].y = (this->init).y; + pTVar9[iVar11].z = (this->init).z; + pTVar9[iVar11].Radius = (this->init).Radius; + pTVar9[iVar11].MaxMonsters = (this->init).MaxMonsters; + pTVar9[iVar11].ActMonsters = (this->init).ActMonsters; + pTVar9[iVar11].RegenerationTime = (this->init).RegenerationTime; + pTVar9[iVar11].Timer = (this->init).Timer; + iVar11 = this->start; + } + iVar14 = this->min; + } + iVar14 = this->max; + while (iVar14 < i) { + this->max = iVar14 + 1; + if (this->initialized != false) { + iVar11 = (iVar14 + 1) - iVar11; + pTVar9 = this->entry; + pTVar9[iVar11].Race = (this->init).Race; + pTVar9[iVar11].x = (this->init).x; + pTVar9[iVar11].y = (this->init).y; + pTVar9[iVar11].z = (this->init).z; + pTVar9[iVar11].Radius = (this->init).Radius; + pTVar9[iVar11].MaxMonsters = (this->init).MaxMonsters; + pTVar9[iVar11].ActMonsters = (this->init).ActMonsters; + pTVar9[iVar11].RegenerationTime = (this->init).RegenerationTime; + pTVar9[iVar11].Timer = (this->init).Timer; + iVar11 = this->start; + } + iVar14 = this->max; + } + return this->entry + (i - iVar11); +} + + + +// WARNING: Variable defined which should be unmapped: extend +// DWARF original prototype: TNonplayer * * operator()(vector * this, int i) + +TNonplayer ** __thiscall vector<>::operator()(vector<> *this,int i) + +{ + TNonplayer *pTVar1; + TNonplayer **ppTVar2; + int iVar3; + int iVar4; + int j_1; + int j; + int iVar5; + int extend_1; + TNonplayer **help; + int extend; + + iVar3 = this->start; + while (i < iVar3) { + help = (TNonplayer **)this->block; + if (help == (TNonplayer **)0x0) { + ppTVar2 = (TNonplayer **)this->space; + help = ppTVar2; + } + else { + ppTVar2 = (TNonplayer **)this->space; + } + ppTVar2 = (TNonplayer **)operator_new__(((int)help + (int)ppTVar2) * 4); + iVar3 = this->min; + if (this->min <= this->max) { + do { + iVar4 = iVar3 - this->start; + iVar5 = (int)help + iVar4; + pTVar1 = ppTVar2[iVar5]; + ppTVar2[iVar5] = this->entry[iVar4]; + iVar5 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar5; + } while (iVar5 <= this->max); + } + if (this->entry != (TNonplayer **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start - (int)help; + this->start = iVar3; + this->space = this->space + (int)help; + } + iVar4 = this->space; + iVar5 = iVar4 + iVar3; + while (iVar5 <= i) { + iVar5 = iVar4; + if (this->block != 0) { + iVar5 = this->block; + } + ppTVar2 = (TNonplayer **)operator_new__((iVar5 + iVar4) * 4); + iVar3 = this->min; + if (iVar3 <= this->max) { + do { + iVar4 = iVar3 - this->start; + pTVar1 = ppTVar2[iVar4]; + ppTVar2[iVar4] = this->entry[iVar4]; + iVar4 = iVar3 + 1; + this->entry[iVar3 - this->start] = pTVar1; + iVar3 = iVar4; + } while (iVar4 <= this->max); + } + if (this->entry != (TNonplayer **)0x0) { + operator_delete__(this->entry); + } + this->entry = ppTVar2; + iVar3 = this->start; + iVar4 = iVar5 + this->space; + this->space = iVar4; + iVar5 = iVar4 + iVar3; + } + iVar5 = this->min; + while (i < iVar5) { + this->min = iVar5 + -1; + if (this->initialized != false) { + this->entry[(iVar5 + -1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->min; + } + iVar5 = this->max; + while (iVar5 < i) { + this->max = iVar5 + 1; + if (this->initialized != false) { + this->entry[(iVar5 + 1) - iVar3] = this->init; + iVar3 = this->start; + } + iVar5 = this->max; + } + return this->entry + (i - iVar3); +} + + + +// DWARF original prototype: void remove(list_> * this, +// listnode_> * node) + +int __thiscall list<>::remove(list<> *this,char *__filename) + +{ + int iVar1; + int extraout_EAX; + listnode<> *plVar2; + + if (__filename != (char *)0x0) { + plVar2 = *(listnode<> **)(__filename + 4); + if (plVar2 == (listnode<> *)0x0) { + this->firstNode = *(listnode<> **)__filename; + plVar2 = *(listnode<> **)(__filename + 4); + } + else { + plVar2->next = *(listnode<> **)__filename; + } + iVar1 = *(int *)__filename; + if (iVar1 == 0) { + this->lastNode = plVar2; + } + else { + *(listnode<> **)(iVar1 + 4) = plVar2; + } + operator_delete(__filename); + return iVar1; + } + error("list::remove: node ist NULL.\n"); + return extraout_EAX; +} + + + +// DWARF original prototype: listnode_> * append(list_> +// * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x1008); + uVar2 = 0x1008; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x1004; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +// DWARF original prototype: void TShortway(TShortway * this, TCreature * cr, int VisibleX, int +// VisibleY) + +void __thiscall TShortway::TShortway(TShortway *this,TCreature *cr,int VisibleX,int VisibleY) + +{ + matrix<> *this_00; + + this->Map = (matrix<> *)0x0; + if (cr == (TCreature *)0x0) { + error(&DAT_08106b80); + return; + } + if ((((0 < VisibleX) && (0 < VisibleY)) && (VisibleX < 0x65)) && (VisibleY < 0x65)) { + this->cr = cr; + this->VisibleX = VisibleX; + this->VisibleY = VisibleY; + this->StartX = cr->posx; + this->StartY = cr->posy; + this->StartZ = cr->posz; + this_00 = (matrix<> *)operator_new(0x14); + // try { // try from 080bdfe3 to 080bdfe7 has its CatchHandler @ 080be019 + matrix<>::matrix(this_00,~VisibleX,VisibleX + 1,~VisibleY,VisibleY + 1); + this->Map = this_00; + FillMap(this); + return; + } + error(&DAT_08106b40); + return; +} + + + +// DWARF original prototype: void TShortway(TShortway * this, TCreature * cr, int VisibleX, int +// VisibleY) + +void __thiscall TShortway::TShortway(TShortway *this,TCreature *cr,int VisibleX,int VisibleY) + +{ + matrix<> *this_00; + + this->Map = (matrix<> *)0x0; + if (cr == (TCreature *)0x0) { + error(&DAT_08106b80); + return; + } + if ((((0 < VisibleX) && (0 < VisibleY)) && (VisibleX < 0x65)) && (VisibleY < 0x65)) { + this->cr = cr; + this->VisibleX = VisibleX; + this->VisibleY = VisibleY; + this->StartX = cr->posx; + this->StartY = cr->posy; + this->StartZ = cr->posz; + this_00 = (matrix<> *)operator_new(0x14); + // try { // try from 080be0f3 to 080be0f7 has its CatchHandler @ 080be129 + matrix<>::matrix(this_00,~VisibleX,VisibleX + 1,~VisibleY,VisibleY + 1); + this->Map = this_00; + FillMap(this); + return; + } + error(&DAT_08106b40); + return; +} + + + +// DWARF original prototype: void ~TShortway(TShortway * this, int __in_chrg) + +void __thiscall TShortway::~TShortway(TShortway *this,int __in_chrg) + +{ + matrix<> *pmVar1; + + pmVar1 = this->Map; + if (pmVar1 != (matrix<> *)0x0) { + if (pmVar1->entry != (TShortwayPoint *)0x0) { + operator_delete__(pmVar1->entry); + } + operator_delete(pmVar1); + return; + } + return; +} + + + +// DWARF original prototype: void ~TShortway(TShortway * this, int __in_chrg) + +void __thiscall TShortway::~TShortway(TShortway *this,int __in_chrg) + +{ + matrix<> *pmVar1; + + pmVar1 = this->Map; + if (pmVar1 != (matrix<> *)0x0) { + if (pmVar1->entry != (TShortwayPoint *)0x0) { + operator_delete__(pmVar1->entry); + } + operator_delete(pmVar1); + return; + } + return; +} + + + +// DWARF original prototype: void FillMap(TShortway * this) + +void __thiscall TShortway::FillMap(TShortway *this) + +{ + matrix<> *pmVar1; + bool bVar2; + int iVar3; + int iVar4; + TShortwayPoint *pTVar5; + ulong uVar6; + uint uVar7; + int iVar8; + uint uVar9; + int x_1; + uint uVar10; + int y; + int iVar11; + ulong local_44; + int Waypoints; + int x; + Object local_2c; + Object Obj; + + this->MinWaypoints = 1000; + uVar7 = this->VisibleX; + Waypoints = -uVar7; + if (-uVar7 == uVar7 || SBORROW4(Waypoints,uVar7) != (int)(uVar7 * -2) < 0) { + uVar9 = this->VisibleY; + do { + iVar11 = -uVar9; + if (-uVar9 == uVar9 || iVar11 < (int)uVar9) { + do { + local_44 = 0xffffffff; + iVar4 = this->StartZ; + GetFirstObject(); + bVar2 = Object::exists(&local_2c); + if (bVar2) { + Object::getObjectType((Object *)&x); + bVar2 = ObjectType::getFlag((ObjectType *)&x,BANK); + if (bVar2) { + Object::getObjectType((Object *)&x); + bVar2 = ObjectType::getFlag((ObjectType *)&x,UNPASS); + if (!bVar2) { + Object::getObjectType((Object *)&x); + local_44 = ObjectType::getAttribute((ObjectType *)&x,WAYPOINTS); + if (local_44 == 0) { + Object::getObjectType((Object *)&x); + error(&DAT_08106bc0,0,x); + local_44 = 0xffffffff; + } + iVar4 = this->StartZ; + iVar3 = (*this->cr->_vptr_TCreature[3]) + (this->cr,Waypoints + this->StartX, + this->StartY + iVar11,iVar4,0,0); + uVar6 = 0xffffffff; + if ((char)iVar3 != '\0') { + uVar6 = local_44; + } + local_44 = uVar6; + if ((0 < (int)uVar6) && ((int)uVar6 < this->MinWaypoints)) { + this->MinWaypoints = uVar6; + } + } + } + } + pmVar1 = this->Map; + iVar3 = iVar11 - pmVar1->ymin; + iVar8 = Waypoints - pmVar1->xmin; + if ((((iVar8 < 0) || (pmVar1->dx <= iVar8)) || (iVar3 < 0)) || + (pmVar1->dy <= iVar3)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar8 + pmVar1->xmin, + iVar3 + pmVar1->ymin,iVar4); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar3 * pmVar1->dx + iVar8; + } + pTVar5->Waypoints = local_44; + pmVar1 = this->Map; + iVar3 = iVar11 - pmVar1->ymin; + iVar8 = Waypoints - pmVar1->xmin; + if (((iVar8 < 0) || (pmVar1->dx <= iVar8)) || + ((iVar3 < 0 || (pmVar1->dy <= iVar3)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar8 + pmVar1->xmin, + iVar3 + pmVar1->ymin,iVar4); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar3 * pmVar1->dx + iVar8; + } + pTVar5->x = Waypoints; + pmVar1 = this->Map; + iVar4 = iVar11 - pmVar1->ymin; + iVar3 = Waypoints - pmVar1->xmin; + if (((iVar3 < 0) || (pmVar1->dx <= iVar3)) || + ((iVar4 < 0 || (pmVar1->dy <= iVar4)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar3 + pmVar1->xmin, + iVar4 + pmVar1->ymin); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar4 * pmVar1->dx + iVar3; + } + pTVar5->y = iVar11; + iVar11 = iVar11 + 1; + uVar9 = this->VisibleY; + } while (iVar11 <= (int)uVar9); + uVar7 = this->VisibleX; + } + Waypoints = Waypoints + 1; + } while (Waypoints <= (int)uVar7); + } + else { + uVar9 = this->VisibleY; + } + uVar10 = ~uVar7; + if ((int)uVar10 <= (int)(uVar7 + 1)) { + while( true ) { + pmVar1 = this->Map; + iVar11 = ~uVar9 - pmVar1->ymin; + iVar4 = uVar10 - pmVar1->xmin; + if ((((iVar4 < 0) || (pmVar1->dx <= iVar4)) || (iVar11 < 0)) || (pmVar1->dy <= iVar11)) + { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar11 + pmVar1->ymin); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar11 * pmVar1->dx + iVar4; + } + pTVar5->Waypoints = -1; + pmVar1 = this->Map; + iVar11 = (this->VisibleY + 1) - pmVar1->ymin; + iVar4 = uVar10 - pmVar1->xmin; + if (((iVar4 < 0) || (pmVar1->dx <= iVar4)) || ((iVar11 < 0 || (pmVar1->dy <= iVar11)))) + { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar11 + pmVar1->ymin); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar11 * pmVar1->dx + iVar4; + } + pTVar5->Waypoints = -1; + uVar10 = uVar10 + 1; + uVar7 = this->VisibleX; + if ((int)(uVar7 + 1) < (int)uVar10) break; + uVar9 = this->VisibleY; + } + uVar9 = this->VisibleY; + } + iVar11 = -uVar9; + if (-uVar9 == uVar9 || iVar11 < (int)uVar9) { + while( true ) { + pmVar1 = this->Map; + iVar4 = iVar11 - pmVar1->ymin; + iVar3 = ~uVar7 - pmVar1->xmin; + if (((iVar3 < 0) || (pmVar1->dx <= iVar3)) || ((iVar4 < 0 || (pmVar1->dy <= iVar4)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar3 + pmVar1->xmin, + iVar4 + pmVar1->ymin); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar4 * pmVar1->dx + iVar3; + } + pTVar5->Waypoints = -1; + pmVar1 = this->Map; + iVar4 = iVar11 - pmVar1->ymin; + iVar3 = (this->VisibleX + 1) - pmVar1->xmin; + if ((((iVar3 < 0) || (pmVar1->dx <= iVar3)) || (iVar4 < 0)) || (pmVar1->dy <= iVar4)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar3 + pmVar1->xmin, + iVar4 + pmVar1->ymin); + pTVar5 = pmVar1->entry; + } + else { + pTVar5 = pmVar1->entry + iVar4 * pmVar1->dx + iVar3; + } + pTVar5->Waypoints = -1; + iVar11 = iVar11 + 1; + if (this->VisibleY < iVar11) break; + uVar7 = this->VisibleX; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: x +// DWARF original prototype: void ClearMap(TShortway * this) + +void __thiscall TShortway::ClearMap(TShortway *this) + +{ + matrix<> *pmVar1; + int iVar2; + TShortwayPoint *pTVar3; + int iVar4; + int y; + int iVar5; + int local_14; + int x; + + iVar2 = this->VisibleX; + local_14 = -iVar2; + if (-iVar2 == iVar2 || SBORROW4(local_14,iVar2) != iVar2 * -2 < 0) { + iVar4 = this->VisibleY; + do { + iVar5 = -iVar4; + if (-iVar4 == iVar4 || iVar5 < iVar4) { + do { + pmVar1 = this->Map; + iVar2 = iVar5 - pmVar1->ymin; + iVar4 = local_14 - pmVar1->xmin; + if ((((iVar4 < 0) || (pmVar1->dx <= iVar4)) || (iVar2 < 0)) || + (pmVar1->dy <= iVar2)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar2 + pmVar1->ymin); + pTVar3 = pmVar1->entry; + } + else { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar4; + } + pTVar3->Predecessor = (TShortwayPoint *)0x0; + pmVar1 = this->Map; + iVar2 = iVar5 - pmVar1->ymin; + iVar4 = local_14 - pmVar1->xmin; + if (((iVar4 < 0) || (pmVar1->dx <= iVar4)) || + ((iVar2 < 0 || (pmVar1->dy <= iVar2)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar2 + pmVar1->ymin); + pTVar3 = pmVar1->entry; + } + else { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar4; + } + pTVar3->NextToExpand = (TShortwayPoint *)0x0; + pmVar1 = this->Map; + iVar2 = iVar5 - pmVar1->ymin; + iVar4 = local_14 - pmVar1->xmin; + if (((iVar4 < 0) || (pmVar1->dx <= iVar4)) || + ((iVar2 < 0 || (pmVar1->dy <= iVar2)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar2 + pmVar1->ymin); + pTVar3 = pmVar1->entry; + } + else { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar4; + } + pTVar3->Waylength = 0x7fffffff; + pmVar1 = this->Map; + iVar2 = iVar5 - pmVar1->ymin; + iVar4 = local_14 - pmVar1->xmin; + if ((((iVar4 < 0) || (pmVar1->dx <= iVar4)) || (iVar2 < 0)) || + (pmVar1->dy <= iVar2)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar4 + pmVar1->xmin, + iVar2 + pmVar1->ymin); + pTVar3 = pmVar1->entry; + } + else { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar4; + } + pTVar3->Heuristic = 0x7fffffff; + iVar5 = iVar5 + 1; + iVar4 = this->VisibleY; + } while (iVar5 <= iVar4); + iVar2 = this->VisibleX; + } + local_14 = local_14 + 1; + } while (local_14 <= iVar2); + } + this->FirstToExpand = (TShortwayPoint *)0x0; + return; +} + + + +// DWARF original prototype: bool Calculate(TShortway * this, int DestX, int DestY, bool MustReach, +// int MaxSteps) + +bool __thiscall +TShortway::Calculate(TShortway *this,int DestX,int DestY,bool MustReach,int MaxSteps) + +{ + matrix<> *pmVar1; + int iVar2; + int iVar3; + int iVar4; + TCreature *this_00; + bool bVar5; + int iVar6; + int iVar7; + int iVar8; + TShortwayPoint *pTVar9; + TToDoEntry *pTVar10; + int iVar11; + TShortwayPoint *pTVar12; + TShortwayPoint *local_4c; + TShortwayPoint *Search; + int dy; + int dx; + bool MustReach_local; + TToDoEntry TD; + + if (this->Map == (matrix<> *)0x0) { + error("TShortway::Calculate: Karte existiert nicht.\n"); + } + else { + iVar6 = DestX - this->StartX; + iVar7 = DestY - this->StartY; + iVar8 = -iVar6; + if (-1 < iVar6) { + iVar8 = iVar6; + } + if (iVar8 <= this->VisibleX) { + iVar8 = -iVar7; + if (-1 < iVar7) { + iVar8 = iVar7; + } + if (iVar8 <= this->VisibleY) { + if ((iVar6 == 0) && (iVar7 == 0)) { + return true; + } + ClearMap(this); + pmVar1 = this->Map; + iVar8 = iVar7 - pmVar1->ymin; + iVar11 = iVar6 - pmVar1->xmin; + if ((((iVar11 < 0) || (pmVar1->dx <= iVar11)) || (iVar8 < 0)) || + (pmVar1->dy <= iVar8)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar11 + pmVar1->xmin, + iVar8 + pmVar1->ymin); + pTVar9 = pmVar1->entry; + } + else { + pTVar9 = pmVar1->entry + iVar8 * pmVar1->dx + iVar11; + } + pTVar9->Waylength = 0; + pmVar1 = this->Map; + iVar8 = iVar7 - pmVar1->ymin; + iVar11 = iVar6 - pmVar1->xmin; + if (((iVar11 < 0) || (pmVar1->dx <= iVar11)) || + ((iVar8 < 0 || (pmVar1->dy <= iVar8)))) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar11 + pmVar1->xmin, + iVar8 + pmVar1->ymin); + pTVar9 = pmVar1->entry; + } + else { + pTVar9 = pmVar1->entry + iVar8 * pmVar1->dx + iVar11; + } + this->FirstToExpand = pTVar9; + while (pTVar9 != (TShortwayPoint *)0x0) { + Expand(this,pTVar9); + pTVar9 = this->FirstToExpand; + } + pmVar1 = this->Map; + iVar11 = -pmVar1->xmin; + iVar8 = -pmVar1->ymin; + if (((pmVar1->xmin < 1) && (iVar11 < pmVar1->dx)) && + ((pmVar1->ymin < 1 && (iVar8 < pmVar1->dy)))) { + pTVar9 = pmVar1->entry + iVar8 * pmVar1->dx + iVar11; + } + else { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar11 + pmVar1->xmin,0); + pTVar9 = pmVar1->entry; + } + if (pTVar9->Waylength != 0x7fffffff) { + pmVar1 = this->Map; + iVar11 = -pmVar1->xmin; + iVar8 = -pmVar1->ymin; + if ((((pmVar1->xmin < 1) && (iVar11 < pmVar1->dx)) && (pmVar1->ymin < 1)) && + (iVar8 < pmVar1->dy)) { + local_4c = pmVar1->entry + iVar8 * pmVar1->dx + iVar11; + } + else { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar11 + pmVar1->xmin + ,0); + local_4c = pmVar1->entry; + } + if ((local_4c->Predecessor != (TShortwayPoint *)0x0) && + (pTVar9 = local_4c->Predecessor, 0 < MaxSteps)) { + while ((pTVar12 = pTVar9, MustReach || + ((2 < (local_4c->x - iVar6) + 1U || (2 < (local_4c->y - iVar7) + 1U)) + ))) { + iVar8 = pTVar12->x; + iVar11 = this->StartX; + iVar2 = this->StartY; + iVar3 = pTVar12->y; + iVar4 = this->StartZ; + this_00 = this->cr; + if ((this_00->LockToDo != false) && + ((bVar5 = TCreature::ToDoClear(this_00), bVar5 && + (this_00->Type == PLAYER)))) { + SendSnapback(this_00->Connection); + } + pTVar10 = vector::operator() + (&this_00->ToDoList,this_00->NrToDo); + pTVar10->Code = TDGo; + (pTVar10->field_1).Go.x = iVar8 + iVar11; + (pTVar10->field_1).Go.y = iVar3 + iVar2; + (pTVar10->field_1).Go.z = iVar4; + (pTVar10->field_1).Move.z = TD.field_1.Go.z; + (pTVar10->field_1).Move.Count = TD.field_1.Move.z; + this_00->NrToDo = this_00->NrToDo + 1; + MaxSteps = MaxSteps + -1; + if (pTVar12->Predecessor == (TShortwayPoint *)0x0) { + return true; + } + pTVar9 = pTVar12->Predecessor; + local_4c = pTVar12; + if (MaxSteps < 1) { + return true; + } + } + } + return true; + } + } + } + } + return false; +} + + + +// WARNING: Variable defined which should be unmapped: this_local +// DWARF original prototype: void Expand(TShortway * this, TShortwayPoint * Node) + +void __thiscall TShortway::Expand(TShortway *this,TShortwayPoint *Node) + +{ + matrix<> *pmVar1; + int iVar2; + TShortwayPoint *pTVar3; + uint uVar4; + TShortwayPoint *Search_1; + TShortwayPoint *pTVar5; + TShortwayPoint *Search; + int iVar6; + int iVar7; + TShortwayPoint *pTVar8; + uint uVar9; + int Waylength; + int iVar10; + int local_24; + int y; + int x; + int BasicWaylength; + TShortwayPoint *Node_local; + TShortway *this_local; + + if (Node == (TShortwayPoint *)0x0) { + error(&DAT_08106c80); + return; + } + this->FirstToExpand = Node->NextToExpand; + iVar6 = Node->Waypoints + Node->Waylength; + pmVar1 = this->Map; + iVar7 = -pmVar1->xmin; + iVar2 = -pmVar1->ymin; + if ((((pmVar1->xmin < 1) && (iVar7 < pmVar1->dx)) && (pmVar1->ymin < 1)) && (iVar2 < pmVar1->dy) + ) { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar7; + } + else { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar7 + pmVar1->xmin,0); + pTVar3 = pmVar1->entry; + } + if (iVar6 < pTVar3->Waylength) { + y = -1; + do { + local_24 = -1; + do { + if ((y != 0) || (local_24 != 0)) { + pmVar1 = this->Map; + iVar2 = (local_24 + Node->y) - pmVar1->ymin; + iVar7 = (y + Node->x) - pmVar1->xmin; + if (((iVar7 < 0) || ((pmVar1->dx <= iVar7 || (iVar2 < 0)))) || + (pmVar1->dy <= iVar2)) { + error("matrix::operator(): Ungueltiger Index %d/%d.\n",iVar7 + pmVar1->xmin, + iVar2 + pmVar1->ymin); + pTVar3 = pmVar1->entry; + } + else { + pTVar3 = pmVar1->entry + iVar2 * pmVar1->dx + iVar7; + } + iVar2 = -y; + if (-1 < y) { + iVar2 = y; + } + iVar7 = -local_24; + if (-1 < local_24) { + iVar7 = local_24; + } + iVar10 = iVar6; + if (iVar2 + iVar7 != 1) { + iVar10 = iVar6 + Node->Waypoints * 2; + } + if (iVar10 < pTVar3->Waylength) { + pTVar3->Waylength = iVar10; + uVar9 = pTVar3->x; + pTVar3->Predecessor = Node; + if (((uVar9 != 0) || (pTVar3->y != 0)) && + (iVar2 = pTVar3->Waypoints, iVar2 != -1)) { + if (pTVar3->Heuristic != 0x7fffffff) { + pTVar5 = this->FirstToExpand; + if (pTVar5 == pTVar3) { + this->FirstToExpand = pTVar3->NextToExpand; + } + else { + for (pTVar8 = pTVar5->NextToExpand; + pTVar8 != (TShortwayPoint *)0x0; + pTVar8 = pTVar8->NextToExpand) { + if (pTVar8 == pTVar3) { + if (pTVar8 != (TShortwayPoint *)0x0) { + pTVar5->NextToExpand = pTVar3->NextToExpand; + goto LAB_080bedc6; + } + break; + } + pTVar5 = pTVar8; + } + error( + "TShortway::Expand: Knoten steht nicht in der ExpandList.\n" + ); + } + uVar9 = pTVar3->x; + iVar2 = pTVar3->Waypoints; + } +LAB_080bedc6: + uVar4 = pTVar3->y; + if (0x7fffffff < uVar9) { + uVar9 = -uVar9; + } + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + iVar2 = ((uVar4 - 1) + uVar9) * this->MinWaypoints + iVar2 + iVar10; + pTVar3->Heuristic = iVar2; + pTVar5 = this->FirstToExpand; + if ((pTVar5 == (TShortwayPoint *)0x0) || (iVar2 <= pTVar5->Heuristic)) { + pTVar3->NextToExpand = pTVar5; + this->FirstToExpand = pTVar3; + } + else { + pTVar8 = pTVar5->NextToExpand; + if ((pTVar8 != (TShortwayPoint *)0x0) && (pTVar8->Heuristic < iVar2) + ) { + do { + pTVar5 = pTVar8; + pTVar8 = pTVar5->NextToExpand; + if (pTVar8 == (TShortwayPoint *)0x0) break; + } while (pTVar8->Heuristic < pTVar3->Heuristic); + } + pTVar3->NextToExpand = pTVar8; + pTVar5->NextToExpand = pTVar3; + } + } + } + } + local_24 = local_24 + 1; + } while (local_24 < 2); + y = y + 1; + } while (y < 2); + } + return; +} + + + +// DWARF original prototype: bool SetOnMap(TCreature * this) + +bool __thiscall TCreature::SetOnMap(TCreature *this) + +{ + int *z; + int *y; + int *x; + bool bVar1; + bool bVar2; + ushort HouseID; + ushort HouseID_00; + bool NoRoom; + ObjectType local_5c [4]; + ObjectType local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + z = &this->posz; + y = &this->posy; + x = &this->posx; + bVar1 = SearchLoginField(x,y,z,1,this->Type == PLAYER); + bVar1 = !bVar1; + if (bVar1) { + bVar2 = IsHouse(this->posx,this->posy,this->posz); + if (bVar2) { + HouseID_00 = GetHouseID(this->posx,this->posy,this->posz); + GetExitPosition(HouseID_00,x,y,z); + bVar1 = SearchLoginField(x,y,z,1,this->Type == PLAYER); + bVar1 = !bVar1; + } + if (bVar1) { + this->posx = this->startx; + this->posy = this->starty; + this->posz = this->startz; + } + } + GetMapContainer((int)&local_2c,this->posx,this->posy); + bVar1 = local_2c != ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (bVar1) { + // try { // try from 080befa5 to 080befcc has its CatchHandler @ 080bf0a5 + ObjectType::setTypeID(local_4c,99); + local_5c[0].TypeID = local_2c; + Create(local_3c,local_5c,(ulong)local_4c); + } + else { + error(&DAT_08106cc0,this->posx,this->posy,this->posz); + } + return bVar1; +} + + + +// DWARF original prototype: bool DelOnMap(TCreature * this) + +bool __thiscall TCreature::DelOnMap(TCreature *this) + +{ + RESULT r; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + Object Help; + + local_3c = ::NONE.ObjectID; + local_4c[0].ObjectID = (this->CrObject).ObjectID; + if (local_4c[0].ObjectID != ::NONE.ObjectID) { + (this->CrObject).ObjectID = ::NONE.ObjectID; + local_2c = local_4c[0].ObjectID; + // try { // try from 080bf180 to 080bf184 has its CatchHandler @ 080bf187 + Delete(local_4c,-1); + } + return true; +} + + + +// DWARF original prototype: void Go(TCreature * this, int x, int y, int z) + +void __thiscall TCreature::Go(TCreature *this,int x,int y,int z) + +{ + TSkill *pTVar1; + bool bVar2; + uint uVar3; + int iVar4; + CreatureType CVar5; + undefined4 *puVar6; + int iVar7; + int iVar8; + int iVar9; + int *piVar10; + int iVar11; + int Delay; + int dy; + int local_54; + int local_50; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + if (z == this->posz) { + uVar3 = x - this->posx; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if ((int)uVar3 < 2) { + uVar3 = y - this->posy; + if (0x7fffffff < uVar3) { + uVar3 = -uVar3; + } + if ((int)uVar3 < 2) { + pTVar1 = (this->super_TSkillBase).Skills[0x14]; + if (((pTVar1 != (TSkill *)0x0) && + (iVar8 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1), 0 < iVar8)) && + (iVar8 = TSkill::Get((this->super_TSkillBase).Skills[0x14]), iVar8 == 0)) { + iVar8 = rand(); + pTVar1 = (this->super_TSkillBase).Skills[0x14]; + iVar9 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if (iVar8 % (7 - iVar9) == 0) { + Delay = 0; + iVar9 = 0; + iVar8 = rand(); + iVar8 = iVar8 % 4; + if (iVar8 == 1) { + iVar9 = -1; + } + else if (iVar8 < 2) { + if (iVar8 == 0) { + iVar9 = 1; + } + } + else if (iVar8 == 2) { + Delay = 1; + iVar9 = 0; + } + else if (iVar8 == 3) { + Delay = -1; + iVar9 = 0; + } + x = iVar9 + this->posx; + y = Delay + this->posy; + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + ToDoTalk(this); + if (this->NrToDo != 0) { + this->LockToDo = true; + this->ActToDo = 0; + local_50 = CalculateDelay(this); + local_54 = 1; + piVar10 = &local_54; + if (0 < local_50) { + piVar10 = &local_50; + } + iVar8 = *piVar10; + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar8 + ServerMilliseconds; + } + } + } + // try { // try from 080bf247 to 080bf65d has its CatchHandler @ 080bf6b8 + iVar9 = x; + iVar8 = y; + iVar11 = z; + iVar4 = (*this->_vptr_TCreature[3])(this,x,y,z,1,0); + if ((char)iVar4 != '\0') goto LAB_080bf2f7; + if (this->Type == PLAYER) { + CVar5 = PLAYER; + if (0 < z) { + iVar8 = this->posz; + iVar9 = this->posy; + iVar4 = GetHeight(); + if (0x17 < iVar4) { + if (this->posx == x) { + iVar4 = this->posy; + } + else { + iVar4 = this->posy; + if (iVar4 != y) goto LAB_080bf2a4; + } + iVar11 = 0; + iVar7 = z + -1; + iVar8 = iVar7; + bVar2 = CoordinateFlag(); + iVar9 = iVar4; + if (!bVar2) { + iVar11 = 0x20; + iVar9 = this->posy; + iVar8 = iVar7; + bVar2 = CoordinateFlag(); + if ((!bVar2) && + (iVar9 = x, iVar8 = y, iVar11 = iVar7, + iVar4 = (*this->_vptr_TCreature[3])(this,x,y,iVar7,1,1), + (char)iVar4 != '\0')) { + z = iVar7; + } + } + } +LAB_080bf2a4: + CVar5 = this->Type; + } + if ((CVar5 == PLAYER) && (z < 0xf)) { + iVar4 = z + 1; + iVar9 = y; + iVar8 = iVar4; + iVar7 = GetHeight(); + if ((0x17 < iVar7) && ((this->posx == x || (this->posy == y)))) { + iVar11 = 0; + iVar9 = y; + iVar8 = z; + bVar2 = CoordinateFlag(); + if (!bVar2) { + iVar11 = 0x20; + iVar9 = y; + iVar8 = z; + bVar2 = CoordinateFlag(); + if ((!bVar2) && + (iVar9 = x, iVar8 = y, iVar11 = iVar4, + iVar7 = (*this->_vptr_TCreature[3])(this,x,y,iVar4,1,1), + (char)iVar7 != '\0')) { + z = iVar4; + } + } + } + } + } + if ((z != this->posz) && + (iVar9 = x, iVar8 = y, iVar4 = (*this->_vptr_TCreature[3])(this,x,y,z,1,1), + iVar11 = z, (char)iVar4 != '\0')) { +LAB_080bf2f7: + local_2c[0].ObjectID = ::NONE.ObjectID; + GetMapContainer((int)local_3c,x,y); + local_4c[0].ObjectID = (this->CrObject).ObjectID; + ::Move(this->ID,local_4c,local_3c,-1,false,local_2c); + return; + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4,iVar9,iVar8,iVar11); + *puVar6 = 0x34; + goto LAB_080bf372; + } + } + } + puVar6 = (undefined4 *)__cxa_allocate_exception(4); + *puVar6 = 1; +LAB_080bf372: + // WARNING: Subroutine does not return + __cxa_throw(puVar6,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void Rotate(TCreature * this, uchar Dir) + +void __thiscall TCreature::Rotate(TCreature *this,uchar Dir) + +{ + Object local_1c [6]; + + local_1c[0].ObjectID = (this->CrObject).ObjectID; + this->Direction = (uint)Dir; + AnnounceChangedObject(local_1c,2); + return; +} + + + +// DWARF original prototype: void Rotate(TCreature * this, TCreature * Target) + +void __thiscall TCreature::Rotate(TCreature *this,TCreature *Target) + +{ + uint uVar1; + int dy; + uint uVar2; + int iVar3; + int dx; + int iVar4; + Object local_1c [4]; + + if (Target == (TCreature *)0x0) { + error("TCreature::Rotate: Target ist NULL.\n"); + } + else { + iVar4 = Target->posx - this->posx; + uVar2 = Target->posy - this->posy; + iVar3 = -iVar4; + if (-1 < iVar4) { + iVar3 = iVar4; + } + uVar1 = -uVar2; + if (-1 < (int)uVar2) { + uVar1 = uVar2; + } + if (iVar3 < (int)uVar1) { + uVar2 = ((int)~uVar2 >> 0x1f) * -2; + } + else { + uVar2 = (iVar4 >> 0x1f) * -2 + 1; + } + local_1c[0].ObjectID = (this->CrObject).ObjectID; + this->Direction = uVar2 & 0xff; + AnnounceChangedObject(local_1c,2); + } + return; +} + + + +// DWARF original prototype: void Move(TCreature * this, Object * Obj, int zx, int zy, int zz, uchar +// Count) + +void __thiscall TCreature::Move(TCreature *this,Object *Obj,int zx,int zy,int zz,uchar Count) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + undefined4 *puVar4; + int *piVar5; + int Delay; + uint Count_00; + Object *Obj_00; + Object *pOVar6; + int iVar7; + int local_a0; + int b_1; + int b; + int iStack_94; + uchar Count_local; + int local_90; + Object local_8c [4]; + Object local_7c [4]; + Object local_6c; + Object DestCon; + Object local_5c; + Object DestObj; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Dest; + + b._3_1_ = Count; + // try { // try from 080bf7d5 to 080bfb3a has its CatchHandler @ 080c01e0 + bVar1 = Object::exists(Obj); + if (bVar1) { + local_2c.ObjectID = (this->CrObject).ObjectID; + if (Obj->ObjectID == local_2c.ObjectID) { + Go(this,zx,zy,zz); + return; + } + Object::getObjectType(&local_2c); + if (local_2c.ObjectID == 99) { + TCombat::DelayAttack(&this->Combat,2000); + } + Object::getObjectType(&local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)&local_2c,CUMULATIVE); + // try { // try from 080bfff5 to 080c0037 has its CatchHandler @ 080c01e0 + if ((bVar1) && (uVar3 = Object::getAttribute(Obj,AMOUNT), uVar3 < Count)) { + uVar3 = Object::getAttribute(Obj,AMOUNT); + b._3_1_ = (byte)uVar3; + } + if (zx == 0xffff) { + if (zy == 0) { + b_1 = 1; + iVar7 = b_1; + do { + b_1 = iVar7; + local_6c = (Object)Obj->ObjectID; + // try { // try from 080bfb73 to 080bfb94 has its CatchHandler @ 080c003d + GetBodyContainer((ulong)&local_5c,this->ID); + CheckInventoryDestination(&local_6c,&local_5c,false); + if ((1 < b_1 - 5U) && (b_1 != 10)) break; + iVar7 = b_1 + 1; + } while (b_1 + 1 < 0xb); + zy = b_1; + if (b_1 == 0) { + local_a0 = 1; + do { + pOVar6 = (Object *)this->ID; + iVar7 = local_a0; + // try { // try from 080bfbe3 to 080bfc4b has its CatchHandler @ 080c01e0 + GetBodyObject((ulong)&local_6c,(int)pOVar6); + local_5c.ObjectID = ::NONE.ObjectID; + if (local_6c.ObjectID != ::NONE.ObjectID) { + Object::getObjectType(&local_5c); + pOVar6 = (Object *)0x4; + bVar1 = ObjectType::getFlag((ObjectType *)&local_5c,CONTAINER); + if (bVar1) { + pOVar6 = &local_5c; + local_5c.ObjectID = local_6c.ObjectID; + local_4c[0] = (Object)Obj->ObjectID; + // try { // try from 080bffcb to 080bffcf has its CatchHandler @ 080c0067 + CheckContainerDestination(local_4c,pOVar6); + b_1 = local_a0; + } + } + local_a0 = local_a0 + 1; + } while (local_a0 < 0xb); + zy = b_1; + if (b_1 == 0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4,pOVar6,iVar7); + *puVar4 = 4; + goto LAB_080bfb23; + } + } + } + if (((0 < zy) && (0x34 < zy - 0xbU)) && (zy < 0x50)) { + pOVar6 = &local_6c; + Obj_00 = (Object *)this->ID; + GetBodyContainer((ulong)pOVar6,(int)Obj_00); + local_5c.ObjectID = ::NONE.ObjectID; + if (zy < 0x40) { + Obj_00 = (Object *)this->ID; + GetBodyObject((ulong)local_3c,(int)Obj_00); + local_5c.ObjectID = local_3c[0].ObjectID; + } + else { + if (zz < 0xfe) { + ObjectType::setTypeID((ObjectType *)&local_2c,0); + Obj_00 = (Object *)this->ID; + GetObject((ulong)local_3c,(int)Obj_00,0xffff,zy,zz,(ObjectType *)zz); + local_5c.ObjectID = local_3c[0].ObjectID; + } + if (zz == 0xfe) { + local_4c[0].ObjectID = ::NONE.ObjectID; + if (local_6c.ObjectID == ::NONE.ObjectID) goto LAB_080bfeb5; + Object::getContainer(local_3c); + local_6c.ObjectID = local_3c[0].ObjectID; + Obj_00 = pOVar6; + } + } + bVar1 = false; + if (local_5c.ObjectID != ::NONE.ObjectID) { + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_3c); + Obj_00 = (Object *)0x4; + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + } + if (bVar1) { + local_6c.ObjectID = local_5c.ObjectID; + local_5c.ObjectID = ::NONE.ObjectID; + local_2c.ObjectID = ::NONE.ObjectID; + } + bVar1 = false; + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (local_5c.ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_3c); + Obj_00 = (Object *)0x6; + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar2) { + Object::getObjectType(local_3c); + Obj_00 = &local_5c; + Object::getObjectType(&local_2c); + if (local_3c[0].ObjectID == local_2c.ObjectID) { + bVar1 = true; + } + } + } + if (bVar1) { + Count_00 = (uint)b._3_1_; + Obj_00 = (Object *)0x2; + // try { // try from 080bfd46 to 080bfd4a has its CatchHandler @ 080c01e0 + uVar3 = Object::getAttribute(&local_5c,AMOUNT); + if (100 < uVar3 + Count_00) { + Obj_00 = (Object *)0x2; + // try { // try from 080bfdd1 to 080bffa7 has its CatchHandler @ 080c01e0 + uVar3 = Object::getAttribute(&local_5c,AMOUNT); + Count_00 = 100 - uVar3; + } + if (0 < (int)Count_00) { + Obj_00 = local_8c; + local_2c.ObjectID = ::NONE.ObjectID; + local_7c[0].ObjectID = local_5c.ObjectID; + local_8c[0] = (Object)Obj->ObjectID; + // try { // try from 080bfd98 to 080bfd9c has its CatchHandler @ 080c0082 + Merge(this->ID,Obj_00,local_7c,Count_00,&local_2c); + b._3_1_ = b._3_1_ - (char)Count_00; + if (b._3_1_ == 0) { + return; + } + } + local_7c[0] = (Object)::NONE.ObjectID; + local_5c.ObjectID = local_7c[0].ObjectID; + } + local_8c[0].ObjectID = ::NONE.ObjectID; + if (local_6c.ObjectID != ::NONE.ObjectID) { + local_7c[0].ObjectID = local_6c.ObjectID; + local_8c[0].ObjectID = local_5c.ObjectID; + local_4c[0] = (Object)Obj->ObjectID; + // try { // try from 080bfd13 to 080bfd17 has its CatchHandler @ 080c00b2 + ::Move(this->ID,local_4c,local_7c,(uint)b._3_1_,false,local_8c); + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4,Obj_00); + *puVar4 = 5; + goto LAB_080bfb23; + } + error(&DAT_08106e00,zy); + } + else { + GetMapContainer((int)&local_2c,zx,zy); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,HANG); + if (bVar1) { + bVar1 = false; + bVar2 = CoordinateFlag(); + if ((bVar2) || (bVar2 = CoordinateFlag(), bVar2)) { + bVar1 = true; + } + if (bVar1) { + local_3c[0].ObjectID = local_2c.ObjectID; + bVar1 = ObjectInRange(this->ID,local_3c,1); + if (!bVar1) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + local_4c[0] = (Object)Obj->ObjectID; + uVar3 = GetObjectCreatureID(local_4c); + if (uVar3 != this->ID) { + local_5c = (Object)Obj->ObjectID; + ToDoMove(this,&local_5c,0xffff,0,0,'\x01'); + } + ToDoGo(this,zx,zy,zz,false,0x7fffffff); + local_5c = (Object)Obj->ObjectID; + ToDoMove(this,&local_5c,zx,zy,zz,'\x01'); + if (this->NrToDo == 0) { + return; + } + this->LockToDo = true; + this->ActToDo = 0; + local_90 = CalculateDelay(this); + iStack_94 = 1; + piVar5 = &stack0xffffff6c; + if (0 < local_90) { + piVar5 = &local_90; + } + iVar7 = *piVar5; + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar7 + ServerMilliseconds; + return; + } + } + } + local_5c.ObjectID = ::NONE.ObjectID; + local_4c[0].ObjectID = local_2c.ObjectID; + local_6c = (Object)Obj->ObjectID; + ::Move(this->ID,&local_6c,local_4c,(uint)b._3_1_,false,&local_5c); + return; + } + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; + } + else { +LAB_080bfeb5: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + } +LAB_080bfb23: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void Trade(TCreature * this, Object * Obj, ulong PartnerID) + +void __thiscall TCreature::Trade(TCreature *this,Object *Obj,ulong PartnerID) + +{ + Object OVar1; + bool bVar2; + TPlayer *pTVar3; + int iVar4; + undefined4 *puVar5; + TPlayer *Partner; + TConnection *Connection; + char *Name; + Object local_5c; + Object Help_1; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Help; + + if (this->Type == PLAYER) { + // try { // try from 080c0226 to 080c05fa has its CatchHandler @ 080c0612 + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c = (Object)Obj->ObjectID; + bVar2 = ObjectAccessible(this->ID,&local_2c,1); + if (bVar2) { + if (this->ID == PartnerID) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 9; + } + else { + pTVar3 = GetPlayer(PartnerID); + if ((pTVar3 == (TPlayer *)0x0) || ((pTVar3->super_TCreature).Type != PLAYER)) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x1b; + } + else { + local_2c.ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (this[1].super_TSkillBase.TimerList[0xb] == (TSkill *)::NONE.ObjectID) { + local_3c[0] = (Object)Obj->ObjectID; + iVar4 = CountObjects(local_3c); + if (iVar4 < 0x65) { + local_3c[0].ObjectID = (pTVar3->super_TCreature).CrObject.ObjectID; + local_2c.ObjectID = (this->CrObject).ObjectID; + iVar4 = ObjectDistance(&local_2c,local_3c); + if (iVar4 < 3) { + bVar2 = ThrowPossible(this->posx,this->posy,this->posz, + (pTVar3->super_TCreature).posx, + (pTVar3->super_TCreature).posy, + (pTVar3->super_TCreature).posz,0); + if (bVar2) { + bVar2 = false; + local_3c[0].ObjectID = ::NONE.ObjectID; + local_2c.ObjectID = ::NONE.ObjectID; + if (((pTVar3->TradeObject).ObjectID != ::NONE.ObjectID) && + (pTVar3->TradePartner != this->ID)) { + bVar2 = true; + } + if (!bVar2) { + OVar1.ObjectID = (pTVar3->TradeObject).ObjectID; + if (OVar1.ObjectID != ::NONE.ObjectID) { + while (local_2c.ObjectID = OVar1.ObjectID, + Object::getObjectType(local_4c), + local_4c[0].ObjectID != 0) { + local_4c[0] = (Object)Obj->ObjectID; + if (local_2c.ObjectID == local_4c[0].ObjectID) + goto LAB_080c03c7; + Object::getContainer(&local_5c); + local_4c[0].ObjectID = local_5c.ObjectID; + local_2c.ObjectID = local_5c.ObjectID; + OVar1.ObjectID = local_2c.ObjectID; + } + local_5c = (Object)Obj->ObjectID; + while (Object::getObjectType(local_4c), + local_4c[0].ObjectID != 0) { + local_4c[0].ObjectID = local_5c.ObjectID; + if ((pTVar3->TradeObject).ObjectID == + local_5c.ObjectID) goto LAB_080c03c7; + Object::getContainer(&local_2c); + local_4c[0].ObjectID = local_2c.ObjectID; + local_5c.ObjectID = local_2c.ObjectID; + } + } + local_4c[0] = (Object)Obj->ObjectID; + this[1].super_TSkillBase.TimerList[0xb] = + (TSkill *)local_4c[0].ObjectID; + this[1].super_TSkillBase.TimerList[0xc] = + (TSkill *)PartnerID; + *(undefined1 *) + (this[1].super_TSkillBase.TimerList + 0xd) = 0; + local_5c.ObjectID = ::NONE.ObjectID; + bVar2 = (pTVar3->TradeObject).ObjectID != + ::NONE.ObjectID; + if (bVar2) { + SendTradeOffer((pTVar3->super_TCreature).Connection, + this->Name,false,local_4c); + local_4c[0].ObjectID = + (ulong)this[1].super_TSkillBase.TimerList[0xb]; + SendTradeOffer(this->Connection,this->Name,true, + local_4c); + local_4c[0].ObjectID = + (pTVar3->TradeObject).ObjectID; + Name = (pTVar3->super_TCreature).Name; + Connection = this->Connection; + } + else { + Name = this->Name; + SendMessage((pTVar3->super_TCreature).Connection, + 0x16,"%s wants to trade with you.",Name) + ; + local_4c[0].ObjectID = + (ulong)this[1].super_TSkillBase.TimerList[0xb]; + Connection = this->Connection; + } + SendTradeOffer(Connection,Name,!bVar2,local_4c); + return; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x36; + } + else { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 7; + } + } + else { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 5; + } + } + else { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x37; + } + } + else { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x35; + } + } + } + goto LAB_080c03d9; + } + } +LAB_080c03c7: + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 1; + } + else { + error(&DAT_08106e40); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + } +LAB_080c03d9: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void Use(TCreature * this, Object * Obj1, Object * Obj2, uchar Dummy) + +void __thiscall TCreature::Use(TCreature *this,Object *Obj1,Object *Obj2,uchar Dummy) + +{ + int iVar1; + bool bVar2; + undefined4 *puVar3; + ulong uVar4; + int *piVar5; + int Delay; + bool bVar6; + int iStack_70; + uchar Dummy_local; + int local_6c; + int local_68; + int x; + int y; + int z; + Object local_4c [4]; + ulong local_3c; + Object local_2c [7]; + + // try { // try from 080c0652 to 080c098c has its CatchHandler @ 080c09a0 + bVar2 = Object::exists(Obj1); + if (bVar2) { + bVar2 = false; + local_2c[0].ObjectID = ::NONE.ObjectID; + local_3c = ::NONE.ObjectID; + if ((Obj2->ObjectID != ::NONE.ObjectID) && (bVar6 = Object::exists(Obj2), !bVar6)) { + bVar2 = true; + } + if (!bVar2) { + bVar2 = false; + local_3c = ::NONE.ObjectID; + local_2c[0].ObjectID = ::NONE.ObjectID; + local_4c[0] = (Object)Obj2->ObjectID; + if (local_4c[0].ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_2c); + bVar6 = ObjectType::getFlag((ObjectType *)local_2c,DISTUSE); + if (!bVar6) { + local_2c[0] = (Object)Obj2->ObjectID; + bVar6 = ObjectInRange(this->ID,local_2c,1); + if (!bVar6) { + bVar2 = true; + } + } + local_4c[0] = (Object)Obj2->ObjectID; + } + if (bVar2) { + GetObjectCoordinates(local_4c,&local_68,&x,&y); + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + local_4c[0] = (Object)Obj1->ObjectID; + uVar4 = GetObjectCreatureID(local_4c); + if (uVar4 != this->ID) { + z = Obj1->ObjectID; + ToDoMove(this,(Object *)&z,0xffff,0,0,'\x01'); + } + ToDoGo(this,local_68,x,y,false,0x7fffffff); + z = Obj2->ObjectID; + local_4c[0] = (Object)Obj1->ObjectID; + ToDoUse(this,'\x02',local_4c,(Object *)&z); + if (this->NrToDo != 0) { + this->LockToDo = true; + this->ActToDo = 0; + local_6c = CalculateDelay(this); + iStack_70 = 1; + piVar5 = &stack0xffffff90; + if (0 < local_6c) { + piVar5 = &local_6c; + } + iVar1 = *piVar5; + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar1 + ServerMilliseconds; + } + return; + } + bVar2 = false; + z = ::NONE.ObjectID; + bVar6 = local_4c[0].ObjectID != ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if (bVar6) { + Object::getObjectType(local_4c); + bVar6 = ObjectType::getFlag((ObjectType *)local_4c,DISTUSE); + if (bVar6) { + local_4c[0] = (Object)Obj2->ObjectID; + bVar6 = ObjectInRange(this->ID,local_4c,7); + if (!bVar6) { + bVar2 = true; + } + } + } + if (!bVar2) { + z = Obj2->ObjectID; + if (z != ::NONE.ObjectID) { + this->EarliestMultiuseTime = ServerMilliseconds + 1000; + z = Obj2->ObjectID; + } + local_4c[0] = (Object)Obj1->ObjectID; + ::Use(this->ID,local_4c,(Object *)&z,Dummy); + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 5; + goto LAB_080c0733; + } + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x1f; +LAB_080c0733: + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void Turn(TCreature * this, Object * Obj) + +void __thiscall TCreature::Turn(TCreature *this,Object *Obj) + +{ + bool bVar1; + undefined4 *puVar2; + Object local_1c [5]; + + // try { // try from 080c09cf to 080c0a25 has its CatchHandler @ 080c0a26 + bVar1 = Object::exists(Obj); + if (bVar1) { + local_1c[0] = (Object)Obj->ObjectID; + ::Turn(this->ID,local_1c); + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x1f; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void Attack(TCreature * this) + +void __thiscall TCreature::Attack(TCreature *this) + +{ + // try { // try from 080c0a51 to 080c0a55 has its CatchHandler @ 080c0a60 + TCombat::Attack(&this->Combat); + return; +} + + + +// DWARF original prototype: void NotifyGo(TCreature * this) + +void __thiscall TCreature::NotifyGo(TCreature *this) + +{ + int iVar1; + int iVar2; + TConnection *Connection; + bool bVar3; + bool bVar4; + bool bVar5; + int Waypoints; + int iVar6; + CreatureType CVar7; + ulong uVar8; + int iVar9; + TPlayer *pTVar10; + int dx; + uint uVar11; + TCreature *Window; + int dy; + uint uVar12; + TCreature *Obj_00; + TCreature *Con_00; + TPlayer *Partner; + bool DiagonalMove; + int dz; + int local_68; + int x; + int y; + int z; + Object Obj; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Con; + + local_2c.ObjectID = (this->CrObject).ObjectID; + GetObjectCoordinates(&local_2c,&local_68,&x,&y); + iVar9 = this->posx; + uVar11 = local_68 - iVar9; + iVar1 = this->posy; + uVar12 = x - iVar1; + iVar2 = this->posz; + bVar3 = false; + iVar6 = y - iVar2; + if (((iVar6 == 0) && (uVar11 != 0)) && (uVar12 != 0)) { + bVar3 = true; + } + MoveChainCreature(this,local_68,x); + CVar7 = this->Type; + if ((CVar7 == PLAYER) && (Connection = this->Connection, Connection != (TConnection *)0x0)) { + if (((iVar6 + 1U < 3) && (uVar11 + 1 < 3)) && (uVar12 + 1 < 3)) { + if (iVar6 == 1) { + this->posz = this->posz + 1; + this->posx = this->posx + -1; + this->posy = this->posy + -1; + SendFloors(Connection,false); + uVar11 = uVar11 + 1; + uVar12 = uVar12 + 1; + } + if (iVar6 == -1) { + this->posz = this->posz + -1; + uVar11 = uVar11 - 1; + this->posx = this->posx + 1; + uVar12 = uVar12 - 1; + this->posy = this->posy + 1; + SendFloors(this->Connection,true); + } + for (; 0 < (int)uVar11; uVar11 = uVar11 - 1) { + this->posx = this->posx + 1; + SendRow(this->Connection,1); + } + for (; (int)uVar11 < 0; uVar11 = uVar11 + 1) { + this->posx = this->posx + -1; + SendRow(this->Connection,3); + } + for (; 0 < (int)uVar12; uVar12 = uVar12 - 1) { + this->posy = this->posy + 1; + SendRow(this->Connection,2); + } + for (; (int)uVar12 < 0; uVar12 = uVar12 + 1) { + this->posy = this->posy + -1; + SendRow(this->Connection,0); + } + } + else { + this->posx = this->posx + uVar11; + this->posy = this->posy + uVar12; + this->posz = this->posz + iVar6; + SendFullScreen(Connection); + } + CVar7 = this->Type; + } + else { + this->posx = this->posx + uVar11; + this->posy = this->posy + uVar12; + this->posz = this->posz + iVar6; + } + if (CVar7 != PLAYER) goto LAB_080c0c2d; + Window = (TCreature *)0x0; + do { + Obj_00 = this; + Con_00 = Window; + TPlayer::GetOpenContainer((TPlayer *)&local_2c,(int)this); + local_3c[0].ObjectID = ::NONE.ObjectID; + if (local_2c.ObjectID != ::NONE.ObjectID) { + bVar4 = Object::exists(&local_2c); + if (bVar4) { + Con_00 = (TCreature *)0x1; + Obj_00 = (TCreature *)local_3c; + local_3c[0].ObjectID = local_2c.ObjectID; + bVar4 = ObjectAccessible(this->ID,(Object *)Obj_00,1); + if (bVar4) goto LAB_080c0c07; + local_4c[0] = (Object)::NONE.ObjectID; + Con_00 = (TCreature *)local_4c; + } + else { + error("TCreature::NotifyGo: OpenContainer existiert nicht. (%s, [%d,%d,%d]->[%d,%d,%d])\n" + ,this->Name,iVar9,iVar1,iVar2,this->posx,this->posy,this->posz); + local_3c[0].ObjectID = ::NONE.ObjectID; + Con_00 = (TCreature *)local_3c; + } + TPlayer::SetOpenContainer((TPlayer *)this,(int)Window,(Object *)Con_00); + Obj_00 = Window; + SendCloseContainer(this->Connection,(int)Window); + } +LAB_080c0c07: + Window = (TCreature *)((int)&Window->_vptr_TCreature + 1); + } while ((int)Window < 0x10); + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (this[1].super_TSkillBase.TimerList[0xb] == (TSkill *)::NONE.ObjectID) goto LAB_080c0c2d; + pTVar10 = GetPlayer((ulong)this[1].super_TSkillBase.TimerList[0xc]); + bVar4 = Object::exists((Object *)(this[1].super_TSkillBase.TimerList + 0xb)); + if (!bVar4) { + error("TCreature::NotifyGo: Handelsobjekt existiert nicht mehr.\n",Obj_00,Con_00); + error(&DAT_081072f3,this->Name,this->posx,this->posy,this->posz); + if (pTVar10 != (TPlayer *)0x0) { + error("# Partner %s an [%d,%d,%d]\n",(pTVar10->super_TCreature).Name, + (pTVar10->super_TCreature).posx,(pTVar10->super_TCreature).posy, + (pTVar10->super_TCreature).posz); + } + } + bVar4 = false; + if (pTVar10 == (TPlayer *)0x0) { +LAB_080c0dba: + bVar4 = true; + } + else { + local_3c[0].ObjectID = (ulong)this[1].super_TSkillBase.TimerList[0xb]; + bVar5 = ObjectAccessible(this->ID,local_3c,1); + if (!bVar5) goto LAB_080c0dba; + local_2c.ObjectID = (pTVar10->super_TCreature).CrObject.ObjectID; + z = (this->CrObject).ObjectID; + iVar9 = ObjectDistance((Object *)&z,&local_2c); + if ((2 < iVar9) || + (bVar5 = ThrowPossible(this->posx,this->posy,this->posz,(pTVar10->super_TCreature).posx, + (pTVar10->super_TCreature).posy,(pTVar10->super_TCreature).posz,0) + , !bVar5)) goto LAB_080c0dba; + } + if (bVar4) { + SendCloseTrade(this->Connection); + SendMessage(this->Connection,0x17,"Trade cancelled."); + TPlayer::RejectTrade((TPlayer *)this); + } +LAB_080c0c2d: + GetFirstObject(); + while( true ) { + Object::getObjectType(local_4c); + bVar4 = ObjectType::getFlag((ObjectType *)local_4c,BANK); + if (bVar4) break; + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (z == ::NONE.ObjectID) break; + Object::getNextObject(local_3c); + z = local_3c[0].ObjectID; + local_4c[0].ObjectID = z; + } + local_4c[0] = (Object)::NONE.ObjectID; + if (z == ::NONE.ObjectID) { + error("TCreature::NotifyGo: Auf Feld [%d,%d,%d] befindet sich kein Bank.\n",this->posx, + this->posy,this->posz); + } + else { + Object::getObjectType(local_4c); + uVar8 = ObjectType::getAttribute((ObjectType *)local_4c,WAYPOINTS); + if (bVar3) { + uVar8 = uVar8 * 3; + } + iVar9 = GetSpeed(this); + this->EarliestWalkTime = + ((Beat + -1 + (int)(uVar8 * 1000) / iVar9) / Beat) * Beat + ServerMilliseconds; + } + return; +} + + + +// DWARF original prototype: void NotifyTurn(TCreature * this, Object * DestCon) + +void __thiscall TCreature::NotifyTurn(TCreature *this,Object *DestCon) + +{ + int dy; + int iVar1; + int local_28; + int x; + int y; + int z; + + z = DestCon->ObjectID; + GetObjectCoordinates((Object *)&z,&local_28,&x,&y); + local_28 = local_28 - this->posx; + iVar1 = x - this->posy; + if (local_28 < 1) { + if (local_28 < 0) { + this->Direction = 3; + } + else if (iVar1 < 0) { + this->Direction = 0; + } + else if (x != this->posy && -1 < iVar1) { + this->Direction = 2; + } + } + else { + this->Direction = 1; + } + return; +} + + + +// DWARF original prototype: void NotifyDelete(TCreature * this) + +void __thiscall TCreature::NotifyDelete(TCreature *this) + +{ + CreatureType CVar1; + + if (this->Type == PLAYER) { + CVar1 = PLAYER; + if (this->Connection != (TConnection *)0x0) { + TConnection::Logout(this->Connection,0x1e,true); + CVar1 = this->Type; + this->LoggingOut = true; + } + if (CVar1 == PLAYER) { + TPlayer::RejectTrade((TPlayer *)this); + } + } + DeleteChainCreature(this); + return; +} + + + +// DWARF original prototype: void NotifyCreate(TCreature * this) + +void __thiscall TCreature::NotifyCreate(TCreature *this) + +{ + InsertChainCreature(this,0,0); + return; +} + + + +// DWARF original prototype: void NotifyChangeInventory(TCreature * this) + +void __thiscall TCreature::NotifyChangeInventory(TCreature *this) + +{ + TSkill *pTVar1; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar2; + bool bVar3; + bool bVar4; + int i; + int iVar5; + int iVar6; + ulong uVar7; + ulong uVar8; + bool SkillsChanged; + int i_1; + int b; + ulong uVar9; + int SkillNr; + ulong local_ac; + int iStack_9c; + int NewDelta [25]; + ulong local_2c; + Object Obj; + + local_2c = ::NONE.ObjectID; + if ((this->CrObject).ObjectID != ::NONE.ObjectID) { + bVar3 = Object::exists(&this->CrObject); + if (bVar3) { + TCombat::CheckCombatValues(&this->Combat); + if (this->Type == PLAYER) { + iVar5 = 0; + do { + NewDelta[iVar5 + -1] = 0; + iVar5 = iVar5 + 1; + } while (iVar5 < 0x19); + uVar9 = 1; + do { + bVar3 = false; + GetBodyObject((ulong)&local_2c,this->ID); + local_ac = ::NONE.ObjectID; + if (local_2c == ::NONE.ObjectID) { +LAB_080c12f2: + bVar3 = true; + } + else { + Object::getObjectType((Object *)&SkillNr); + bVar4 = ObjectType::getFlag((ObjectType *)&SkillNr,SKILLBOOST); + if (!bVar4) goto LAB_080c12f2; + } + if (!bVar3) { + Object::getObjectType((Object *)&SkillNr); + bVar3 = ObjectType::getFlag((ObjectType *)&SkillNr,CLOTHES); + if (bVar3) { + Object::getObjectType((Object *)&SkillNr); + uVar7 = ObjectType::getAttribute((ObjectType *)&SkillNr,BODYPOSITION); + if (uVar7 == uVar9) { + Object::getObjectType((Object *)&SkillNr); + uVar7 = ObjectType::getAttribute((ObjectType *)&SkillNr,SKILLNUMBER) + ; + if ((int)uVar7 < 0x19) { + Object::getObjectType((Object *)&SkillNr); + uVar8 = ObjectType::getAttribute + ((ObjectType *)&SkillNr,SKILLMODIFICATION); + if (0x7fff < (int)uVar8) { + uVar8 = uVar8 - 0x10000; + } + NewDelta[uVar7 - 1] = NewDelta[uVar7 - 1] + uVar8; + } + else { + Object::getObjectType((Object *)&SkillNr); + error(&DAT_08107080,SkillNr,uVar7); + } + } + } + else { + Object::getObjectType((Object *)&SkillNr); + error("TCreature::NotifyChangeInventory: Objekt %d hat SKILLBOOST, aber nicht CLOTHES.\n" + ,SkillNr); + } + } + uVar9 = uVar9 + 1; + } while ((int)uVar9 < 0xb); + bVar3 = false; + iVar5 = 0; + do { + pTVar1 = (this->super_TSkillBase).Skills[iVar5]; + if (pTVar1->DAct != NewDelta[iVar5 + -1]) { + pTVar1->DAct = NewDelta[iVar5 + -1]; + if (iVar5 == 4) { + AnnounceChangedCreature(this->ID,4); + } + if (iVar5 == 0x10) { + if (NewDelta[0xf] < 1) { + pTVar1 = (this->super_TSkillBase).Skills[0x10]; + iVar6 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); + if (iVar6 == 0) { + aVar2 = (this->OrgOutfit).field_1; + (this->Outfit).OutfitID = (this->OrgOutfit).OutfitID; + (this->Outfit).field_1 = aVar2; + } + } + else { + bVar3 = false; + if (((this->Outfit).OutfitID == 0) && + ((this->Outfit).field_1.ObjectType == 0)) { + bVar3 = true; + } + if ((!bVar3) && + (pTVar1 = (this->super_TSkillBase).Skills[0x10], + iVar6 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1), iVar6 != 0)) { + TSkillBase::SetTimer(&this->super_TSkillBase); + } + (this->Outfit).OutfitID = 0; + (this->Outfit).field_1.ObjectType = 0; + } + AnnounceChangedCreature(this->ID,3); + } + bVar3 = true; + } + iVar5 = iVar5 + 1; + } while (iVar5 < 0x19); + if (bVar3) { + SendPlayerSkills(this->Connection); + TPlayer::CheckState((TPlayer *)this); + } + SendPlayerData(this->Connection); + } + } + else { + error("TCreature::NotifyChangeInventory: Kreatur-Objekt existiert nicht.\n"); + error("# Kreatur: %s, Position: %d/%d/%d.\n",this->Name,this->posx,this->posy,this->posz + ); + } + } + return; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void CreatureMoveStimulus(TCreature * this, ulong CreatureID, int Type) + +void __thiscall TCreature::CreatureMoveStimulus(TCreature *this,ulong CreatureID,int Type) + +{ + vector *this_00; + uint uVar1; + bool bVar2; + TToDoEntry *pTVar3; + TCreature *pTVar4; + int iVar5; + int *piVar6; + int Delay_1; + int Delay; + int local_64; + int local_60; + undefined1 local_5c [4]; + TToDoEntry TD; + Object local_3c [4]; + Object local_2c [7]; + + if (((((CreatureID != this->ID) && (CreatureID != 0)) && + (CreatureID == (this->Combat).AttackDest)) && ((Type == 2 && (this->LockToDo != false)))) + && ((this->IsDead == false && (this->ActToDo < this->NrToDo)))) { + this_00 = &this->ToDoList; + pTVar3 = vector::operator()(this_00,this->ActToDo); + if ((pTVar3->Code == TDAttack) && ((this->Combat).ChaseMode == '\x01')) { + uVar1 = (this->Combat).EarliestAttackTime; + if ((ServerMilliseconds < uVar1) && (200 < (int)(uVar1 - ServerMilliseconds))) { + pTVar4 = GetCreature((this->Combat).AttackDest); + if (pTVar4 != (TCreature *)0x0) { + local_2c[0].ObjectID = (pTVar4->CrObject).ObjectID; + local_3c[0].ObjectID = (this->CrObject).ObjectID; + iVar5 = ObjectDistance(local_3c,local_2c); + if (1 < iVar5) { + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + local_5c = (undefined1 [4])0x0; + TD.Code = ServerMilliseconds + 200; + if (this->LockToDo != false) { + // try { // try from 080c16d0 to 080c16fb has its CatchHandler @ 080c19b4 + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + // try { // try from 080c184b to 080c184f has its CatchHandler @ 080c19b4 + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(this_00,this->NrToDo); + pTVar3->Code = (ToDoType)local_5c; + (pTVar3->field_1).Move.Obj = TD.Code; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar3->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + // try { // try from 080c1728 to 080c17c0 has its CatchHandler @ 080c1868 + TCombat::CanToDoAttack(&this->Combat); + iVar5 = TCombat::GetDistance(&this->Combat); + if (iVar5 != 1) { + local_5c = (undefined1 [4])0x0; + TD.Code = ServerMilliseconds + 100; + if (this->LockToDo != false) { + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + // try { // try from 080c1838 to 080c183c has its CatchHandler @ 080c1868 + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(this_00,this->NrToDo); + pTVar3->Code = (ToDoType)local_5c; + (pTVar3->field_1).Move.Obj = TD.Code; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar3->field_1 + 4))->Time + = (ulong)TD.field_1.Wait.Time; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + } + local_5c = (undefined1 [4])0x7; + ToDoAdd(this,(TToDoEntry *)local_5c); + if (this->NrToDo != 0) { + this->LockToDo = true; + this->ActToDo = 0; + // try { // try from 080c17e1 to 080c181c has its CatchHandler @ 080c19b4 + local_60 = CalculateDelay(this); + local_64 = 1; + piVar6 = &local_64; + if (0 < local_60) { + piVar6 = &local_60; + } + iVar5 = *piVar6; + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar5 + ServerMilliseconds; + } + } + } + } + } + } + return; +} + + + +// DWARF original prototype: int CalculateDelay(TCreature * this) + +int __thiscall TCreature::CalculateDelay(TCreature *this) + +{ + ToDoType TVar1; + uint uVar2; + TToDoEntry *pTVar3; + ToDoType TVar4; + int *piVar5; + uint uVar6; + int local_34; + int local_30 [2]; + TToDoEntry TD; + + pTVar3 = vector::operator()(&this->ToDoList,this->ActToDo); + TVar1 = pTVar3->Code; + TD.Code = (pTVar3->field_1).Move.Obj; + TD.field_1.Wait.Time = (anon_struct_4_1_898373eb_for_Wait)(pTVar3->field_1).Go.y; + TD.field_1.Go.y = (pTVar3->field_1).Go.z; + TD.field_1.Go.z = (pTVar3->field_1).Move.z; + TD.field_1.Move.z = (pTVar3->field_1).Move.Count; + if ((TVar1 == TDGo) && (ServerMilliseconds < this->EarliestWalkTime)) { + return this->EarliestWalkTime - ServerMilliseconds; + } + if (((TVar1 != TDUse) || (TD.field_1.Go.x == 0)) || + (TVar4 = this->EarliestMultiuseTime, TVar4 <= ServerMilliseconds)) { + if (TVar1 == TDAttack) { + uVar2 = (this->Combat).EarliestAttackTime; + if (ServerMilliseconds < uVar2) { + uVar6 = this->EarliestSpellTime; +LAB_080c1a7f: + local_30[0] = uVar2 - ServerMilliseconds; + local_34 = uVar6 - ServerMilliseconds; + piVar5 = &local_34; + if ((int)(uVar6 - ServerMilliseconds) <= local_30[0]) { + piVar5 = local_30; + } + return *piVar5; + } + uVar6 = this->EarliestSpellTime; + if (ServerMilliseconds < uVar6) goto LAB_080c1a7f; + } + if ((TVar1 != TDWait) || + ((this->EarliestWalkTime <= ServerMilliseconds && (TD.Code <= ServerMilliseconds)))) { + return 0; + } + pTVar3 = &TD; + if (TD.Code <= this->EarliestWalkTime) { + pTVar3 = (TToDoEntry *)&this->EarliestWalkTime; + } + TVar4 = pTVar3->Code; + } + return TVar4 - ServerMilliseconds; +} + + + +// DWARF original prototype: void Execute(TCreature * this) + +void __thiscall TCreature::Execute(TCreature *this) + +{ + bool bVar1; + int iVar2; + TToDoEntry *pTVar3; + undefined4 *puVar4; + char *Addressee; + int Delay; + int Delay_1; + char *pcVar5; + bool SnapbackNecessary; + TToDoEntry TD_1; + Object local_5c [4]; + Object local_4c [4]; + ToDoType local_3c; + TToDoEntry TD; + + do { + if (this->LockToDo == false) { + return; + } + if (this->IsDead != false) { + return; + } + if (ServerMilliseconds < this->NextWakeup) { + return; + } + if (this->NrToDo <= this->ActToDo) { + ToDoClear(this); + (*this->_vptr_TCreature[8])(this); + return; + } + iVar2 = CalculateDelay(this); + if (0 < iVar2) { + if (this->Stop == false) { + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar2 + ServerMilliseconds; + return; + } + ToDoClear(this); + if (this->Type != PLAYER) { + return; + } + SendSnapback(this->Connection); + return; + } + pTVar3 = vector::operator()(&this->ToDoList,this->ActToDo); + local_3c = pTVar3->Code; + TD.Code = (pTVar3->field_1).Move.Obj; + TD.field_1.Wait.Time = + (anon_struct_4_1_898373eb_for_Wait)*(ToDoType *)((int)&pTVar3->field_1 + 4); + TD.field_1.Go.y = *(int *)((int)&pTVar3->field_1 + 8); + TD.field_1.Go.z = *(int *)((int)&pTVar3->field_1 + 0xc); + TD.field_1.Move.z = *(int *)((int)&pTVar3->field_1 + 0x10); + this->ActToDo = this->ActToDo + 1; + switch(local_3c) { + case TDGo: + // try { // try from 080c1bb6 to 080c1ca3 has its CatchHandler @ 080c2050 + Go(this,TD.Code,TD.field_1.Go.x,TD.field_1.Go.y); + break; + case TDRotate: + local_4c[0].ObjectID = (this->CrObject).ObjectID; + this->Direction = TD.Code & 0xff; + AnnounceChangedObject(local_4c,2); + break; + case TDMove: + local_4c[0].ObjectID = TD.Code; + Move(this,local_4c,TD.field_1.Go.x,TD.field_1.Go.y,TD.field_1.Go.z, + (uchar)TD.field_1.Move.z); + break; + case TDTrade: + local_4c[0].ObjectID = TD.Code; + Trade(this,local_4c,TD.field_1.Move.Obj); + break; + case TDUse: + local_5c[0].ObjectID = TD.Code; + local_4c[0].ObjectID = (ulong)TD.field_1.Wait.Time; + Use(this,local_5c,local_4c,(uchar)TD.field_1.Trade.Partner); + break; + case TDTurn: + local_5c[0].ObjectID = TD.Code; + // try { // try from 080c1cb5 to 080c1d07 has its CatchHandler @ 080c1e43 + bVar1 = Object::exists(local_5c); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1f; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); + } + local_4c[0].ObjectID = local_5c[0].ObjectID; + ::Turn(this->ID,local_4c); + break; + case TDAttack: + // try { // try from 080c1d11 to 080c1d15 has its CatchHandler @ 080c1e43 + TCombat::Attack(&this->Combat); + break; + case TDTalk: + if (TD.Code == TDWait) { + pcVar5 = "TCreature::Execute: TD.Text ist Null bei %s.\n"; +LAB_080c1d33: + // try { // try from 080c1d33 to 080c1dc3 has its CatchHandler @ 080c2050 + error(pcVar5,this->Name); + } + else { + pcVar5 = GetDynamicString(TD.Code); + if (pcVar5 == (char *)0x0) { + pcVar5 = "TCreature::Execute: Text ist NULL bei %s.\n"; + goto LAB_080c1d33; + } + } + pcVar5 = GetDynamicString(TD.Code); + Addressee = GetDynamicString(TD.field_1.Trade.Partner); + Talk(this->ID,TD.field_1.Go.x,Addressee,pcVar5,SUB41(TD.field_1.Go.z,0)); + break; + case TDChangeState: + if (this->Type == NPC) { + ChangeNPCState(this,TD.Code,true); + } + } + if (this->Stop != false) { + ToDoClear(this); + if (this->Type == PLAYER) { + SendSnapback(this->Connection); + } + return; + } + } while( true ); +} + + + +// WARNING: Variable defined which should be unmapped: SnapbackNecessary +// DWARF original prototype: bool ToDoClear(TCreature * this) + +bool __thiscall TCreature::ToDoClear(TCreature *this) + +{ + TToDoEntry *pTVar1; + TToDoEntry *TD; + int i; + int i_00; + bool local_11; + bool SnapbackNecessary; + + local_11 = false; + if (0 < this->NrToDo) { + i_00 = 0; + do { + pTVar1 = vector::operator()(&this->ToDoList,i_00); + switch(pTVar1->Code) { + case TDGo: + if (this->ActToDo <= i_00) { + local_11 = true; + } + break; + case TDTalk: + DeleteDynamicString((pTVar1->field_1).Move.Obj); + DeleteDynamicString((pTVar1->field_1).Talk.Addressee); + break; + case TDChangeState: + if ((this->ActToDo <= i_00) && (this->Type == NPC)) { + ChangeNPCState(this,(pTVar1->field_1).Go.x,false); + } + } + i_00 = i_00 + 1; + } while (i_00 < this->NrToDo); + } + this->LockToDo = false; + this->ActToDo = 0; + this->NrToDo = 0; + this->Stop = false; + return local_11; +} + + + +// DWARF original prototype: void ToDoStop(TCreature * this) + +void __thiscall TCreature::ToDoStop(TCreature *this) + +{ + if (this->LockToDo == false) { + if (this->Type == PLAYER) { + SendSnapback(this->Connection); + return; + } + } + else { + this->Stop = true; + } + return; +} + + + +// DWARF original prototype: void ToDoAdd(TCreature * this, TToDoEntry * TD) + +void __thiscall TCreature::ToDoAdd(TCreature *this,TToDoEntry *TD) + +{ + bool bVar1; + TToDoEntry *pTVar2; + + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = TD->Code; + (pTVar2->field_1).Wait.Time = (TD->field_1).Wait.Time; + (pTVar2->field_1).Go.y = (TD->field_1).Go.y; + (pTVar2->field_1).Go.z = (TD->field_1).Go.z; + (pTVar2->field_1).Move.z = (TD->field_1).Move.z; + (pTVar2->field_1).Move.Count = (TD->field_1).Move.Count; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// DWARF original prototype: void ToDoStart(TCreature * this) + +void __thiscall TCreature::ToDoStart(TCreature *this) + +{ + int iVar1; + int *piVar2; + int Delay; + int local_14; + int local_10; + + if (this->NrToDo != 0) { + this->LockToDo = true; + this->ActToDo = 0; + local_10 = CalculateDelay(this); + piVar2 = &local_14; + if (0 < local_10) { + piVar2 = &local_10; + } + local_14 = 1; + iVar1 = *piVar2; + priority_queue<>::insert(&ToDoQueue); + this->NextWakeup = iVar1 + ServerMilliseconds; + } + return; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoYield(TCreature * this) + +void __thiscall TCreature::ToDoYield(TCreature *this) + +{ + ulong uVar1; + TToDoEntry *pTVar2; + TToDoEntry TD; + + uVar1 = ServerMilliseconds; + if (this->LockToDo == false) { + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = TDWait; + (pTVar2->field_1).Move.Obj = uVar1; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar2->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar2->field_1).Go.z = TD.field_1.Go.y; + (pTVar2->field_1).Move.z = TD.field_1.Go.z; + (pTVar2->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + ToDoStart(this); + } + return; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoWait(TCreature * this, int Delay) + +void __thiscall TCreature::ToDoWait(TCreature *this,int Delay) + +{ + bool bVar1; + int iVar2; + TToDoEntry *pTVar3; + TToDoEntry TD; + + iVar2 = Delay + ServerMilliseconds; + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = TDWait; + (pTVar3->field_1).Go.x = iVar2; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar3->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// DWARF original prototype: void ToDoTalk(TCreature * this, int Mode, char * Addressee, char * +// Text, bool CheckSpamming) + +void __thiscall TCreature::ToDoTalk(TCreature *this) + +{ + bool bVar1; + ulong uVar2; + TToDoEntry *pTVar3; + int in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + undefined1 in_stack_00000014; + TToDoEntry TD; + + if (in_stack_0000000c == (char *)0x0) { + TD.field_1.Go.y = 0; + } + else { + TD.field_1.Trade.Partner = AddDynamicString(in_stack_0000000c); + } + TD.field_1.Go.z._0_1_ = in_stack_00000014; + if (in_stack_00000010 == (char *)0x0) { + error("TCreature::ToDoTalk: Text ist NULL bei %s.\n",this->Name); + } + uVar2 = AddDynamicString(in_stack_00000010); + if (uVar2 == 0) { + error("TCreature::ToDoTalk: TD.Text ist Null bei %s.\n",this->Name); + } + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = TDTalk; + (pTVar3->field_1).Move.Obj = uVar2; + (pTVar3->field_1).Go.y = in_stack_00000008; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoChangeState(TCreature * this, int NewState) + +void __thiscall TCreature::ToDoChangeState(TCreature *this,int NewState) + +{ + bool bVar1; + TToDoEntry *pTVar2; + TToDoEntry TD; + + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = TDChangeState; + (pTVar2->field_1).Go.x = NewState; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar2->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar2->field_1).Go.z = TD.field_1.Go.y; + (pTVar2->field_1).Move.z = TD.field_1.Go.z; + (pTVar2->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// DWARF original prototype: void ToDoGo(TCreature * this, int DestX, int DestY, int DestZ, bool +// Dest, int MaxSteps) + +void __thiscall +TCreature::ToDoGo(TCreature *this,int DestX,int DestY,int DestZ,bool Dest,int MaxSteps) + +{ + vector *this_00; + bool bVar1; + undefined4 *puVar2; + TToDoEntry *pTVar3; + int dx; + uint uVar4; + int dy; + uint uVar5; + undefined1 local_6c [3]; + bool Dest_local; + TShortway Shortway; + TToDoEntry TD; + + if (this->posz < DestZ) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x18; + } + else { + if (this->posz <= DestZ) { + if (this->LockToDo != false) { + this_00 = &this->ToDoList; + pTVar3 = vector::operator()(this_00,this->NrToDo + -1); + if ((((pTVar3->Code == TDGo) && + (pTVar3 = vector::operator()(this_00,this->NrToDo + -1), + (pTVar3->field_1).Go.x == DestX)) && + (pTVar3 = vector::operator()(this_00,this->NrToDo + -1), + (pTVar3->field_1).Go.y == DestY)) && + (pTVar3 = vector::operator()(this_00,this->NrToDo + -1), + (pTVar3->field_1).Go.z == DestZ)) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0; + goto LAB_080c2810; + } + } + uVar5 = DestY - this->posy; + uVar4 = DestX - this->posx; + if (((uVar4 != 0) || (uVar5 != 0)) && ((Dest || ((2 < uVar4 + 1 || (2 < uVar5 + 1)))))) + { + if (0x7fffffff < uVar4) { + uVar4 = -uVar4; + } + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + if (uVar5 + uVar4 == 1) { + if (((this->LockToDo != false) && (bVar1 = ToDoClear(this), bVar1)) && + (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + // try { // try from 080c272a to 080c2827 has its CatchHandler @ 080c2870 + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = TDGo; + (pTVar3->field_1).Go.x = DestX; + (pTVar3->field_1).Go.y = DestY; + (pTVar3->field_1).Go.z = DestZ; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + } + else { + // try { // try from 080c2660 to 080c2664 has its CatchHandler @ 080c2870 + TShortway::TShortway + ((TShortway *)local_6c,this,(uint)(this->Type != PLAYER) * 3 + 7, + (uint)(this->Type != PLAYER) * 3 + 7); + // try { // try from 080c2685 to 080c26f4 has its CatchHandler @ 080c2850 + bVar1 = TShortway::Calculate((TShortway *)local_6c,DestX,DestY,Dest,MaxSteps); + if (!bVar1) { + ToDoClear(this); + if (this->Type == PLAYER) { + SendSnapback(this->Connection); + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x2c; + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); + } + TShortway::~TShortway((TShortway *)local_6c,DestX); + } + } + return; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = 0x17; + } +LAB_080c2810: + // WARNING: Subroutine does not return + __cxa_throw(puVar2,&RESULT::typeinfo,0); +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoRotate(TCreature * this, int Direction) + +void __thiscall TCreature::ToDoRotate(TCreature *this,int Direction) + +{ + bool bVar1; + TToDoEntry *pTVar2; + undefined4 *puVar3; + TToDoEntry TD; + + if (Direction < 4) { + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + // try { // try from 080c28c4 to 080c294f has its CatchHandler @ 080c2950 + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = TDRotate; + (pTVar2->field_1).Go.x = Direction; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar2->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar2->field_1).Go.z = TD.field_1.Go.y; + (pTVar2->field_1).Move.z = TD.field_1.Go.z; + (pTVar2->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0xffffffff; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void ToDoMove(TCreature * this, int sx, int sy, int sz, ObjectType * +// Type, uchar RNum, int zx, int zy, int zz, uchar Count) + +void __thiscall +TCreature::ToDoMove(TCreature *this,int sx,int sy,int sz,ObjectType *Type,uchar RNum,int zx,int zy, + int zz,uchar Count) + +{ + bool bVar1; + TCreature *pTVar2; + int iVar3; + TToDoEntry *pTVar4; + undefined4 *puVar5; + ObjectType *Type_00; + ulong x; + int iVar6; + int iVar7; + Object *pOVar8; + uchar Count_local; + TToDoEntry TD; + Object local_4c [4]; + Object local_3c; + Object Dest; + Object local_2c; + Object Obj; + + // try { // try from 080c299f to 080c2c56 has its CatchHandler @ 080c2c90 + ObjectType::setTypeID((ObjectType *)&local_3c,Type->TypeID); + Type_00 = (ObjectType *)(uint)RNum; + x = this->ID; + iVar3 = sx; + iVar6 = sy; + iVar7 = sz; + pOVar8 = &local_3c; + GetObject((ulong)&local_2c,x,sx,sy,sz,Type_00); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + if (sx != 0xffff) { + if (this->posz < sz) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x18; + goto LAB_080c2be8; + } + if (sz < this->posz) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x17; + goto LAB_080c2be8; + } + local_3c.ObjectID = local_2c.ObjectID; + bVar1 = ObjectInRange(this->ID,&local_3c,1); + if (!bVar1) { + Type_00 = (ObjectType *)0x7fffffff; + iVar7 = 0; + ToDoGo(this,sx,sy,sz,false,0x7fffffff); + } + } + Object::getObjectType(&local_3c); + if (local_3c.ObjectID != 99) { + iVar3 = 100; +LAB_080c2b08: + ToDoWait(this,iVar3); + if (((this->LockToDo != false) && (bVar1 = ToDoClear(this), bVar1)) && + (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + pTVar4 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar4->Code = TDMove; + (pTVar4->field_1).Wait.Time = local_2c.ObjectID; + (pTVar4->field_1).Go.y = zx; + (pTVar4->field_1).Go.z = zy; + (pTVar4->field_1).Move.z = zz; + *(uint *)((int)&pTVar4->field_1 + 0x10) = (uint)Count; + this->NrToDo = this->NrToDo + 1; + return; + } + x = zx; + iVar3 = zy; + iVar6 = zz; + GetFirstObject(); + bVar1 = Object::exists(&local_3c); + if (bVar1) { + Object::getObjectType(local_4c); + x = 0; + bVar1 = ObjectType::getFlag((ObjectType *)local_4c,BANK); + if (bVar1) { + Object::getObjectType(local_4c); + ObjectType::getAttribute((ObjectType *)local_4c,WAYPOINTS); + local_4c[0].ObjectID = local_2c.ObjectID; + pTVar2 = GetCreature(local_4c); + if (pTVar2 != (TCreature *)0x0) { + if (ServerMilliseconds < pTVar2->EarliestWalkTime) { + iVar3 = (pTVar2->EarliestWalkTime - ServerMilliseconds) + 1000; + } + else { + iVar3 = 1000; + } + goto LAB_080c2b08; + } + error("TCreature::ToDoMove: Kreatur existiert nicht.\n"); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + goto LAB_080c2be8; + } + } + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4,x,iVar3,iVar6,iVar7,Type_00,pOVar8); + *puVar5 = 1; +LAB_080c2be8: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoMove(TCreature * this, Object * Obj, int zx, int zy, int zz, +// uchar Count) + +void __thiscall TCreature::ToDoMove(TCreature *this,Object *Obj,int zx,int zy,int zz,uchar Count) + +{ + bool bVar1; + TToDoEntry *pTVar2; + undefined4 *puVar3; + int Delay; + int iStack_68; + uchar Count_local; + int x; + int y; + int z; + TToDoEntry TD; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 080c2cd2 to 080c2e61 has its CatchHandler @ 080c2e62 + bVar1 = Object::exists(Obj); + if (!bVar1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); + } + local_2c[0] = (Object)Obj->ObjectID; + bVar1 = ObjectInRange(this->ID,local_2c,1); + if (!bVar1) { + local_3c[0] = (Object)Obj->ObjectID; + GetObjectCoordinates(local_3c,&stack0xffffff98,&x,&y); + ToDoGo(this,iStack_68,x,y,false,0x7fffffff); + } + Object::getObjectType(local_3c); + Delay = 1000; + if (local_3c[0].ObjectID != 99) { + Delay = 100; + } + ToDoWait(this,Delay); + z = 3; + TD.Code = Obj->ObjectID; + TD.field_1.Move.z = (int)Count; + TD.field_1.Go.x = zx; + TD.field_1.Go.y = zy; + TD.field_1.Go.z = zz; + if (((this->LockToDo != false) && (bVar1 = ToDoClear(this), bVar1)) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = z; + (pTVar2->field_1).Move.Obj = TD.Code; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar2->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar2->field_1).Go.z = TD.field_1.Go.y; + (pTVar2->field_1).Move.z = TD.field_1.Go.z; + (pTVar2->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// DWARF original prototype: void ToDoTrade(TCreature * this, int x, int y, int z, ObjectType * +// Type, uchar RNum, ulong TradePartner) + +void __thiscall +TCreature::ToDoTrade + (TCreature *this,int x,int y,int z,ObjectType *Type,uchar RNum,ulong TradePartner) + +{ + bool bVar1; + TCreature *pTVar2; + TToDoEntry *pTVar3; + undefined4 *puVar4; + char *Text; + Object *this_00; + TToDoEntry TD; + Object local_3c [4]; + Object local_2c; + Object Obj; + + this_00 = &local_2c; + // try { // try from 080c2ea5 to 080c3132 has its CatchHandler @ 080c3185 + ObjectType::setTypeID((ObjectType *)local_3c,Type->TypeID); + GetObject((ulong)this_00,this->ID,x,y,z,(ObjectType *)(uint)RNum); + bVar1 = Object::exists(this_00); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + goto LAB_080c30bb; + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,UNMOVE); + if (bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 2; + goto LAB_080c30bb; + } + Object::getObjectType(local_3c); + bVar1 = ObjectType::getFlag((ObjectType *)local_3c,TAKE); + if (!bVar1) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 3; + goto LAB_080c30bb; + } + Object::getObjectType(local_3c); + if (local_3c[0].ObjectID == 99) { + Text = "TCreature::ToDoTrade: Objekt ist eine Kreatur.\n"; +LAB_080c312e: + error(Text,this_00); + } + else { + if (TradePartner == 0) { + Text = "TCreature::ToDoTrade: Handelspartner ist Null.\n"; + goto LAB_080c312e; + } + pTVar2 = GetCreature(TradePartner); + if (pTVar2 == (TCreature *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x1b; + goto LAB_080c30bb; + } + if (pTVar2->Type == PLAYER) { + if (x == 0xffff) { +LAB_080c2fd4: + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = TDTrade; + (pTVar3->field_1).Wait.Time = local_2c.ObjectID; + (pTVar3->field_1).Trade.Partner = TradePartner; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; + } + if (this->posz < z) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x18; + } + else { + if (this->posz <= z) { + local_3c[0].ObjectID = local_2c.ObjectID; + bVar1 = ObjectInRange(this->ID,local_3c,1); + if (!bVar1) { + ToDoGo(this,x,y,z,false,0x7fffffff); + } + goto LAB_080c2fd4; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0x17; + } + goto LAB_080c30bb; + } + error("TCreature::ToDoTrade: Handelspartner von %s ist kein Spieler.\n",this->Name); + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 0xffffffff; +LAB_080c30bb: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void ToDoUse(TCreature * this, uchar Count, int x1, int y1, int z1, +// ObjectType * Type1, uchar RNum1, uchar Dummy, int x2, int y2, int z2, ObjectType * Type2, uchar +// RNum2) + +void __thiscall +TCreature::ToDoUse(TCreature *this,uchar Count,int x1,int y1,int z1,ObjectType *Type1,uchar RNum1, + uchar Dummy,int x2,int y2,int z2,ObjectType *Type2,uchar RNum2) + +{ + Object OVar1; + Object OVar2; + bool bVar3; + TToDoEntry *pTVar4; + undefined4 *puVar5; + uchar RNum2_local; + uchar Dummy_local; + uchar Count_local; + TToDoEntry TD; + Object local_6c [4]; + ulong local_5c [4]; + ObjectType local_4c [4]; + Object local_3c; + Object Obj2; + Object local_2c; + Object Obj1; + + local_3c.ObjectID = 0; + local_2c.ObjectID = 0; + // try { // try from 080c31ee to 080c3453 has its CatchHandler @ 080c3473 + ObjectType::setTypeID((ObjectType *)local_6c,Type1->TypeID); + GetObject((ulong)local_5c,this->ID,x1,y1,z1,(ObjectType *)(uint)RNum1); + local_2c.ObjectID = local_5c[0]; + local_4c[0].TypeID = local_5c[0]; + bVar3 = Object::exists(&local_2c); + if (bVar3) { + if (Count < 2) { + local_5c[0] = ::NONE.ObjectID; + local_3c.ObjectID = ::NONE.ObjectID; + local_6c[0].ObjectID = ::NONE.ObjectID; + } + else { + ObjectType::setTypeID(local_4c,Type2->TypeID); + GetObject((ulong)local_5c,this->ID,x2,y2,z2,(ObjectType *)(uint)RNum2); + local_3c.ObjectID = local_5c[0]; + local_6c[0].ObjectID = local_5c[0]; + bVar3 = Object::exists(&local_3c); + if (!bVar3) goto LAB_080c345c; + } + if (x1 == 0xffff) { +LAB_080c32b4: + ToDoWait(this,100); + OVar2.ObjectID = local_2c.ObjectID; + OVar1.ObjectID = local_3c.ObjectID; + if (this->LockToDo != false) { + bVar3 = ToDoClear(this); + if ((bVar3) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar4 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar4->Code = TDUse; + (pTVar4->field_1).Wait.Time = OVar2.ObjectID; + (pTVar4->field_1).Go.y = OVar1.ObjectID; + *(uint *)((int)&pTVar4->field_1 + 8) = (uint)Dummy; + (pTVar4->field_1).Move.z = TD.field_1.Go.z; + (pTVar4->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; + } + if (this->posz < z1) { + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x18; + } + else { + if (this->posz <= z1) { + local_6c[0].ObjectID = local_2c.ObjectID; + bVar3 = ObjectInRange(this->ID,local_6c,1); + if (!bVar3) { + ToDoGo(this,x1,y1,z1,false,0x7fffffff); + } + goto LAB_080c32b4; + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x17; + } + } + else { +LAB_080c345c: + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 1; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoUse(TCreature * this, uchar Count, Object * Obj1, Object * +// Obj2) + +void __thiscall TCreature::ToDoUse(TCreature *this,uchar Count,Object *Obj1,Object *Obj2) + +{ + Object OVar1; + bool bVar2; + TToDoEntry *pTVar3; + undefined4 *puVar4; + int iStack_68; + uchar Count_local; + int x; + int y; + int z; + TToDoEntry TD; + Object local_3c [4]; + Object local_2c [7]; + + // try { // try from 080c34b5 to 080c3640 has its CatchHandler @ 080c3641 + bVar2 = Object::exists(Obj1); + OVar1 = ::NONE; + if (bVar2) { + if (Count < 2) { + Obj2->ObjectID = (ulong)::NONE; + local_2c[0].ObjectID = OVar1.ObjectID; + } + else { + bVar2 = Object::exists(Obj2); + if (!bVar2) goto LAB_080c3617; + } + local_3c[0] = (Object)Obj1->ObjectID; + bVar2 = ObjectInRange(this->ID,local_3c,1); + if (!bVar2) { + local_2c[0] = (Object)Obj1->ObjectID; + GetObjectCoordinates(local_2c,&stack0xffffff98,&x,&y); + ToDoGo(this,iStack_68,x,y,false,0x7fffffff); + } + ToDoWait(this,100); + z = 5; + TD.Code = Obj1->ObjectID; + TD.field_1.Go.y = (int)Count; + TD.field_1.Wait.Time = (anon_struct_4_1_898373eb_for_Wait)Obj2->ObjectID; + if (this->LockToDo != false) { + bVar2 = ToDoClear(this); + if ((bVar2) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = z; + (pTVar3->field_1).Move.Obj = TD.Code; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar3->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; + } +LAB_080c3617: + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = 1; + // WARNING: Subroutine does not return + __cxa_throw(puVar4,&RESULT::typeinfo,0); +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoTurn(TCreature * this, int x, int y, int z, ObjectType * Type, +// uchar RNum) + +void __thiscall TCreature::ToDoTurn(TCreature *this,int x,int y,int z,ObjectType *Type,uchar RNum) + +{ + bool bVar1; + TToDoEntry *pTVar2; + undefined4 *puVar3; + TToDoEntry TD; + Object local_3c [4]; + Object local_2c; + Object Obj; + + // try { // try from 080c3685 to 080c382e has its CatchHandler @ 080c3857 + ObjectType::setTypeID((ObjectType *)local_3c,Type->TypeID); + GetObject((ulong)&local_2c,this->ID,x,y,z,(ObjectType *)(uint)RNum); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + if (x == 0xffff) { +LAB_080c3721: + ToDoWait(this,100); + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar2 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar2->Code = TDTurn; + (pTVar2->field_1).Wait.Time = local_2c.ObjectID; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar2->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar2->field_1).Go.z = TD.field_1.Go.y; + (pTVar2->field_1).Move.z = TD.field_1.Go.z; + (pTVar2->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; + } + if (this->posz < z) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x18; + } + else { + if (this->posz <= z) { + local_3c[0].ObjectID = local_2c.ObjectID; + bVar1 = ObjectInRange(this->ID,local_3c,1); + if (!bVar1) { + ToDoGo(this,x,y,z,false,0x7fffffff); + } + goto LAB_080c3721; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 0x17; + } + } + else { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = 1; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar3,&RESULT::typeinfo,0); +} + + + +// WARNING: Type propagation algorithm not settling +// DWARF original prototype: void ToDoAttack(TCreature * this) + +void __thiscall TCreature::ToDoAttack(TCreature *this) + +{ + bool bVar1; + int iVar2; + TToDoEntry *pTVar3; + TToDoEntry TD; + + // try { // try from 080c3888 to 080c3928 has its CatchHandler @ 080c3930 + TCombat::CanToDoAttack(&this->Combat); + iVar2 = TCombat::GetDistance(&this->Combat); + if (iVar2 != 1) { + ToDoWait(this,100); + } + if (this->LockToDo != false) { + bVar1 = ToDoClear(this); + if ((bVar1) && (this->Type == PLAYER)) { + SendSnapback(this->Connection); + } + } + pTVar3 = vector::operator()(&this->ToDoList,this->NrToDo); + pTVar3->Code = TDAttack; + (pTVar3->field_1).Move.Obj = TD.Code; + ((anon_struct_4_1_898373eb_for_Wait *)((int)&pTVar3->field_1 + 4))->Time = + (ulong)TD.field_1.Wait.Time; + (pTVar3->field_1).Go.z = TD.field_1.Go.y; + (pTVar3->field_1).Move.z = TD.field_1.Go.z; + (pTVar3->field_1).Move.Count = TD.field_1.Move.z; + this->NrToDo = this->NrToDo + 1; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__ZN9TShortwayC2EP9TCreatureii(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void matrix(matrix * this, int xmin, int xmax, int +// ymin, int ymax) + +void __thiscall matrix<>::matrix(matrix<> *this,int xmin,int xmax,int ymin,int ymax) + +{ + int iVar1; + TShortwayPoint *pTVar2; + TShortwayPoint *pTVar3; + int iVar4; + + iVar4 = (xmax - xmin) + 1; + iVar1 = (ymax - ymin) + 1; + this->xmin = xmin; + this->ymin = ymin; + this->dx = iVar4; + this->dy = iVar1; + if ((iVar4 < 1) || (iVar1 < 1)) { + error("matrix: Ungueltige Feldgroesse %d..%d, %d..%d.\n",xmin,xmax,ymin,ymax); + iVar4 = this->dx; + if (iVar4 < 1) { + this->dx = 1; + iVar4 = 1; + } + iVar1 = this->dy; + if (iVar1 < 1) { + this->dy = 1; + iVar1 = 1; + } + } + iVar4 = iVar4 * iVar1; + pTVar2 = (TShortwayPoint *)operator_new__(iVar4 * 0x1c); + pTVar3 = pTVar2; + while (iVar4 = iVar4 + -1, iVar4 != -1) { + pTVar3->Waylength = -1; + pTVar3->Heuristic = -1; + pTVar3->Predecessor = (TShortwayPoint *)0x0; + pTVar3->NextToExpand = (TShortwayPoint *)0x0; + pTVar3 = pTVar3 + 1; + } + this->entry = pTVar2; + return; +} + + + +// DWARF original prototype: TToDoEntry * operator()(vector * this, int i) + +TToDoEntry * __thiscall vector::operator()(vector *this,int i) + +{ + ToDoType TVar1; + ulong uVar2; + int iVar3; + int iVar4; + TToDoEntry *pTVar5; + TToDoEntry *pTVar6; + int iVar7; + int iVar8; + int iVar9; + int iVar10; + TToDoEntry *help_1; + int iVar11; + TToDoEntry *help; + int j; + int local_40; + int extend; + uchar Help [24]; + + iVar8 = this->start; + while (i < iVar8) { + local_40 = this->block; + if (local_40 == 0) { + iVar8 = this->space; + local_40 = iVar8; + } + else { + iVar8 = this->space; + } + pTVar6 = (TToDoEntry *)operator_new__((local_40 + iVar8) * 0x18); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar11 = (iVar8 - this->start) + local_40; + TVar1 = pTVar6[iVar11].Code; + uVar2 = pTVar6[iVar11].field_1.Wait.Time; + iVar10 = pTVar6[iVar11].field_1.Go.y; + iVar3 = pTVar6[iVar11].field_1.Go.z; + iVar4 = pTVar6[iVar11].field_1.Move.z; + iVar9 = pTVar6[iVar11].field_1.Move.Count; + iVar7 = iVar8 - this->start; + iVar11 = local_40 + iVar7; + pTVar5 = this->entry; + pTVar6[iVar11].Code = pTVar5[iVar7].Code; + pTVar6[iVar11].field_1.Wait.Time = pTVar5[iVar7].field_1.Wait.Time; + pTVar6[iVar11].field_1.Go.y = pTVar5[iVar7].field_1.Go.y; + pTVar6[iVar11].field_1.Go.z = pTVar5[iVar7].field_1.Go.z; + pTVar6[iVar11].field_1.Move.z = pTVar5[iVar7].field_1.Move.z; + pTVar6[iVar11].field_1.Move.Count = pTVar5[iVar7].field_1.Move.Count; + iVar11 = iVar8 + 1; + iVar8 = iVar8 - this->start; + pTVar5 = this->entry; + pTVar5[iVar8].Code = TVar1; + pTVar5[iVar8].field_1.Wait.Time = uVar2; + pTVar5[iVar8].field_1.Go.y = iVar10; + pTVar5[iVar8].field_1.Go.z = iVar3; + pTVar5[iVar8].field_1.Move.z = iVar4; + pTVar5[iVar8].field_1.Move.Count = iVar9; + iVar8 = iVar11; + } while (iVar11 <= this->max); + } + if (this->entry != (TToDoEntry *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar8 = this->start - local_40; + this->start = iVar8; + this->space = this->space + local_40; + } + iVar10 = this->space; + iVar11 = iVar10 + iVar8; + while (iVar11 <= i) { + iVar11 = this->block; + if (this->block == 0) { + iVar11 = iVar10; + } + pTVar6 = (TToDoEntry *)operator_new__((iVar11 + iVar10) * 0x18); + iVar8 = this->min; + if (iVar8 <= this->max) { + do { + iVar9 = iVar8 - this->start; + TVar1 = pTVar6[iVar9].Code; + uVar2 = pTVar6[iVar9].field_1.Wait.Time; + iVar10 = pTVar6[iVar9].field_1.Go.y; + iVar3 = pTVar6[iVar9].field_1.Go.z; + iVar4 = pTVar6[iVar9].field_1.Move.z; + iVar9 = pTVar6[iVar9].field_1.Move.Count; + pTVar5 = this->entry; + iVar7 = iVar8 - this->start; + pTVar6[iVar7].Code = pTVar5[iVar7].Code; + pTVar6[iVar7].field_1.Wait.Time = pTVar5[iVar7].field_1.Wait.Time; + pTVar6[iVar7].field_1.Go.y = pTVar5[iVar7].field_1.Go.y; + pTVar6[iVar7].field_1.Go.z = pTVar5[iVar7].field_1.Go.z; + pTVar6[iVar7].field_1.Move.z = pTVar5[iVar7].field_1.Move.z; + pTVar6[iVar7].field_1.Move.Count = pTVar5[iVar7].field_1.Move.Count; + iVar7 = iVar8 + 1; + pTVar5 = this->entry; + iVar8 = iVar8 - this->start; + pTVar5[iVar8].Code = TVar1; + pTVar5[iVar8].field_1.Wait.Time = uVar2; + pTVar5[iVar8].field_1.Go.y = iVar10; + pTVar5[iVar8].field_1.Go.z = iVar3; + pTVar5[iVar8].field_1.Move.z = iVar4; + pTVar5[iVar8].field_1.Move.Count = iVar9; + iVar8 = iVar7; + } while (iVar7 <= this->max); + } + if (this->entry != (TToDoEntry *)0x0) { + operator_delete__(this->entry); + } + this->entry = pTVar6; + iVar8 = this->start; + iVar10 = this->space + iVar11; + this->space = iVar10; + iVar11 = iVar10 + iVar8; + } + iVar11 = this->min; + while (i < iVar11) { + this->min = iVar11 + -1; + if (this->initialized != false) { + iVar8 = (iVar11 + -1) - iVar8; + pTVar6 = this->entry; + pTVar6[iVar8].Code = (this->init).Code; + pTVar6[iVar8].field_1.Wait.Time = (this->init).field_1.Wait.Time; + pTVar6[iVar8].field_1.Go.y = (this->init).field_1.Go.y; + pTVar6[iVar8].field_1.Go.z = (this->init).field_1.Go.z; + pTVar6[iVar8].field_1.Move.z = (this->init).field_1.Move.z; + pTVar6[iVar8].field_1.Move.Count = (this->init).field_1.Move.Count; + iVar8 = this->start; + } + iVar11 = this->min; + } + iVar11 = this->max; + while (iVar11 < i) { + this->max = iVar11 + 1; + if (this->initialized != false) { + iVar8 = (iVar11 + 1) - iVar8; + pTVar6 = this->entry; + pTVar6[iVar8].Code = (this->init).Code; + pTVar6[iVar8].field_1.Wait.Time = (this->init).field_1.Wait.Time; + pTVar6[iVar8].field_1.Go.y = (this->init).field_1.Go.y; + pTVar6[iVar8].field_1.Go.z = (this->init).field_1.Go.z; + pTVar6[iVar8].field_1.Move.z = (this->init).field_1.Move.z; + pTVar6[iVar8].field_1.Move.Count = (this->init).field_1.Move.Count; + iVar8 = this->start; + } + iVar11 = this->max; + } + return this->entry + (i - iVar8); +} + + + +// DWARF original prototype: void insert(priority_queue * this, +// ulong Key, ulong * Data) + +void __thiscall priority_queue<>::insert(priority_queue<> *this) + +{ + ulong uVar1; + ulong uVar2; + ulong uVar3; + int iVar4; + priority_queue_entry<> *ppVar5; + priority_queue_entry<> *ppVar6; + int Father; + int i; + int Position; + ulong in_stack_00000008; + ulong *in_stack_0000000c; + + iVar4 = this->Entries + 1; + this->Entries = iVar4; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar5->Key = in_stack_00000008; + ppVar5 = vector<>::operator()(this->Entry,this->Entries); + ppVar5->Data = *in_stack_0000000c; + iVar4 = this->Entries; + while( true ) { + if (iVar4 == 1) { + return; + } + i = iVar4 / 2; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar6 = vector<>::operator()(this->Entry,i); + if (ppVar6->Key <= ppVar5->Key) break; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + uVar1 = ppVar5->Key; + uVar2 = ppVar5->Data; + ppVar5 = vector<>::operator()(this->Entry,iVar4); + ppVar6 = vector<>::operator()(this->Entry,i); + uVar3 = ppVar6->Key; + ppVar5->Data = ppVar6->Data; + ppVar5->Key = uVar3; + ppVar5 = vector<>::operator()(this->Entry,i); + ppVar5->Data = uVar2; + ppVar5->Key = uVar1; + iVar4 = i; + } + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +// DWARF original prototype: void TCombat(TCombat * this) + +void __thiscall TCombat::TCombat(TCombat *this) + +{ + int iVar1; + TCombatEntry *pTVar2; + + (this->Shield).ObjectID = 0; + (this->Close).ObjectID = 0; + (this->Missile).ObjectID = 0; + (this->Throw).ObjectID = 0; + (this->Wand).ObjectID = 0; + (this->Ammo).ObjectID = 0; + this->Master = (TCreature *)0x0; + this->AttackDest = 0; + this->EarliestAttackTime = 0; + this->EarliestDefendTime = 0; + this->LastDefendTime = 0; + this->LatestAttackTime = 0; + pTVar2 = this->CombatList; + for (iVar1 = 0x3c; iVar1 != 0; iVar1 = iVar1 + -1) { + pTVar2->ID = 0; + pTVar2 = (TCombatEntry *)&pTVar2->Damage; + } + this->ActCombatEntry = 0; + this->CombatDamage = 0; + this->LearningPoints = 0; + (this->Missile).ObjectID = ::NONE.ObjectID; + (this->Wand).ObjectID = ::NONE.ObjectID; + (this->Close).ObjectID = ::NONE.ObjectID; + (this->Shield).ObjectID = ::NONE.ObjectID; + (this->Throw).ObjectID = ::NONE.ObjectID; + (this->Ammo).ObjectID = ::NONE.ObjectID; + this->Fist = false; + this->AttackMode = '\x02'; + this->ChaseMode = '\0'; + this->SecureMode = '\x01'; + return; +} + + + +// DWARF original prototype: void TCombat(TCombat * this) + +void __thiscall TCombat::TCombat(TCombat *this) + +{ + int iVar1; + TCombatEntry *pTVar2; + + (this->Shield).ObjectID = 0; + (this->Close).ObjectID = 0; + (this->Missile).ObjectID = 0; + (this->Throw).ObjectID = 0; + (this->Wand).ObjectID = 0; + (this->Ammo).ObjectID = 0; + this->Master = (TCreature *)0x0; + this->AttackDest = 0; + this->EarliestAttackTime = 0; + this->EarliestDefendTime = 0; + this->LastDefendTime = 0; + this->LatestAttackTime = 0; + pTVar2 = this->CombatList; + for (iVar1 = 0x3c; iVar1 != 0; iVar1 = iVar1 + -1) { + pTVar2->ID = 0; + pTVar2 = (TCombatEntry *)&pTVar2->Damage; + } + this->ActCombatEntry = 0; + this->CombatDamage = 0; + this->LearningPoints = 0; + (this->Missile).ObjectID = ::NONE.ObjectID; + (this->Wand).ObjectID = ::NONE.ObjectID; + (this->Close).ObjectID = ::NONE.ObjectID; + (this->Shield).ObjectID = ::NONE.ObjectID; + (this->Throw).ObjectID = ::NONE.ObjectID; + (this->Ammo).ObjectID = ::NONE.ObjectID; + this->Fist = false; + this->AttackMode = '\x02'; + this->ChaseMode = '\0'; + this->SecureMode = '\x01'; + return; +} + + + +// DWARF original prototype: void CanToDoAttack(TCombat * this) + +void __thiscall TCombat::CanToDoAttack(TCombat *this) + +{ + char cVar1; + bool bVar2; + int Distance; + TCreature *pTVar3; + int iVar4; + TConnection *Connection; + undefined4 *puVar5; + byte bVar6; + int Mode; + TPlayer *this_00; + TCreature *pTVar7; + TCreature *dfd; + int local_48; + int x; + int y; + int z; + Object local_2c [7]; + + if (this->AttackDest == 0) { + return; + } + // try { // try from 080c40e9 to 080c43eb has its CatchHandler @ 080c4403 + pTVar3 = GetCreature(this->AttackDest); + if (pTVar3 == (TCreature *)0x0) { +LAB_080c428d: + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + Connection = this->Master->Connection; +LAB_080c42a6: + SendClearTarget(Connection); + } + } + else { + this_00 = (TPlayer *)this->Master; + if (this_00 == (TPlayer *)0x0) { + error("TCombat::CanAttack: Kein Master gesetzt!\n"); + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0xffffffff; + goto LAB_080c42c0; + } + if (((this_00->super_TCreature).Type != PLAYER) || (pTVar3->Type == PLAYER)) { +LAB_080c413c: + if (this->Following == false) { + cVar1 = '\0'; + if (((((this_00->super_TCreature).Type == PLAYER) && (pTVar3->Type == PLAYER)) && + (this->SecureMode == '\x01')) && (WorldType == NORMAL)) { + bVar2 = TPlayer::IsAttackJustified(this_00,pTVar3->ID); + if (!bVar2) { + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x3a; + goto LAB_080c42c0; + } + cVar1 = this->Following; + this_00 = (TPlayer *)this->Master; + } + if ((cVar1 == '\0') && (WorldType == NON_PVP)) { + iVar4 = (*(this_00->super_TCreature)._vptr_TCreature[4])(this_00); + if (((char)iVar4 != '\0') && + (iVar4 = (*pTVar3->_vptr_TCreature[4])(pTVar3), (char)iVar4 != '\0')) { + pTVar7 = this->Master; + if (pTVar7->Type == PLAYER) { + bVar2 = CheckRight(pTVar7->ID,ATTACK_EVERYWHERE); + if (bVar2) goto LAB_080c42e4; + pTVar7 = this->Master; + } + this->AttackDest = 0; + if (pTVar7->Type == PLAYER) { + SendClearTarget(pTVar7->Connection); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x2b; + goto LAB_080c42c0; + } +LAB_080c42e4: + this_00 = (TPlayer *)this->Master; + } + } + local_2c[0].ObjectID = (pTVar3->CrObject).ObjectID; + z = (this_00->super_TCreature).CrObject.ObjectID; + iVar4 = ObjectDistance((Object *)&z,local_2c); + if (iVar4 < 9) { + if (this->Following == false) { + bVar6 = this->ChaseMode; + } + else { + bVar6 = 1; + } + if (bVar6 == 1) { + if (iVar4 < 2) { + return; + } + iVar4 = 3; + } + else { + if (bVar6 < 2) { + return; + } + if (bVar6 != 2) { + return; + } + if (iVar4 < 4) { + bVar2 = SearchFlightField(); + if (!bVar2) { + return; + } + iVar4 = 0x7fffffff; + bVar2 = true; + goto LAB_080c4201; + } + if (iVar4 < 5) { + return; + } + iVar4 = iVar4 + -4; + } + bVar2 = false; + y = pTVar3->posz; + x = pTVar3->posy; + local_48 = pTVar3->posx; +LAB_080c4201: + TCreature::ToDoGo(this->Master,local_48,x,y,bVar2,iVar4); + return; + } + goto LAB_080c428d; + } + bVar2 = false; + if (((pTVar3->Outfit).OutfitID == 0) && ((pTVar3->Outfit).field_1.ObjectType == 0)) { + bVar2 = true; + } + if (!bVar2) goto LAB_080c413c; + this->AttackDest = 0; + if ((this_00->super_TCreature).Type == PLAYER) { + Connection = (this_00->super_TCreature).Connection; + goto LAB_080c42a6; + } + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x25; +LAB_080c42c0: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: int GetDistance(TCombat * this) + +int __thiscall TCombat::GetDistance(TCombat *this) + +{ + bool bVar1; + int range; + int iVar2; + + bVar1 = false; + iVar2 = 0; + if (((this->Close).ObjectID != ::NONE.ObjectID) || (this->Fist != false)) { + bVar1 = true; + } + if (bVar1) { + iVar2 = 1; + } + else if ((this->Throw).ObjectID == ::NONE.ObjectID) { + bVar1 = false; + if (((this->Missile).ObjectID != ::NONE.ObjectID) || + ((this->Wand).ObjectID != ::NONE.ObjectID)) { + bVar1 = true; + } + if (bVar1) { + iVar2 = 3; + } + } + else { + iVar2 = 2; + } + return iVar2; +} + + + +// DWARF original prototype: void Attack(TCombat * this) + +void __thiscall TCombat::Attack(TCombat *this) + +{ + bool bVar1; + uchar uVar2; + TCreature *this_00; + TConnection *pTVar3; + int iVar4; + int iVar5; + int iVar6; + undefined4 *puVar7; + ulong *puVar8; + int disty; + TPlayer *pTVar9; + uint uVar10; + TCreature *dfd; + int iVar11; + int distx; + int range; + int distance; + uint local_40; + Object local_3c [4]; + Object local_2c [7]; + + if (this->AttackDest == 0) { + return; + } + if (this->Following != false) { + return; + } + // try { // try from 080c44d3 to 080c495b has its CatchHandler @ 080c4961 + this_00 = GetCreature(this->AttackDest); + if (this_00 == (TCreature *)0x0) { +LAB_080c4892: + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + pTVar3 = this->Master->Connection; +LAB_080c48ab: + SendClearTarget(pTVar3); + } +LAB_080c48b3: + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x25; + goto LAB_080c4776; + } + pTVar9 = (TPlayer *)this->Master; + if (pTVar9 == (TPlayer *)0x0) { + error("TCombat::CanAttack: Kein Master gesetzt!\n"); +LAB_080c478e: + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0xffffffff; + goto LAB_080c4776; + } + if ((this->LatestAttackTime != 0) && (this->LatestAttackTime < RoundNr)) { + this->AttackDest = 0; + if ((pTVar9->super_TCreature).Type != PLAYER) { + return; + } + pTVar3 = (pTVar9->super_TCreature).Connection; + goto LAB_080c4514; + } + if (((pTVar9->super_TCreature).Type == PLAYER) && (this_00->Type != PLAYER)) { + bVar1 = false; + if (((this_00->Outfit).OutfitID == 0) && ((this_00->Outfit).field_1.ObjectType == 0)) { + bVar1 = true; + } + if (!bVar1) goto LAB_080c4558; + this->AttackDest = 0; + if ((pTVar9->super_TCreature).Type == PLAYER) { + pTVar3 = (pTVar9->super_TCreature).Connection; + goto LAB_080c48ab; + } + goto LAB_080c48b3; + } +LAB_080c4558: + if (((((pTVar9->super_TCreature).Type == PLAYER) && (this_00->Type == PLAYER)) && + (this->SecureMode == '\x01')) && (WorldType == NORMAL)) { + bVar1 = TPlayer::IsAttackJustified(pTVar9,this_00->ID); + if (!bVar1) { + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x3a; + goto LAB_080c4776; + } + pTVar9 = (TPlayer *)this->Master; + } + local_2c[0].ObjectID = (this_00->CrObject).ObjectID; + local_3c[0].ObjectID = (pTVar9->super_TCreature).CrObject.ObjectID; + iVar4 = ObjectDistance(local_3c,local_2c); + iVar5 = GetDistance(this); + if (8 < iVar4) goto LAB_080c4892; + pTVar9 = (TPlayer *)this->Master; + if (((pTVar9->super_TCreature).Type == PLAYER) && (this_00->Type == PLAYER)) { + uVar2 = TPlayer::GetRealProfession(pTVar9); + if ((uVar2 != '\0') || (bVar1 = CheckRight(this->Master->ID,ATTACK_EVERYWHERE), bVar1)) { + pTVar9 = (TPlayer *)this->Master; + goto LAB_080c45cc; + } +LAB_080c4829: + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x2b; + goto LAB_080c4776; + } +LAB_080c45cc: + if ((pTVar9->super_TCreature).Type == PLAYER) { + bVar1 = CheckRight((pTVar9->super_TCreature).ID,NO_ATTACK); + if (bVar1) goto LAB_080c4829; + pTVar9 = (TPlayer *)this->Master; + } + iVar11 = (pTVar9->super_TCreature).posz; + iVar6 = this->Master->posy; + bVar1 = IsProtectionZone(); + if (!bVar1) { + iVar11 = this_00->posz; + iVar6 = this_00->posy; + bVar1 = IsProtectionZone(); + if (!bVar1) { + iVar11 = this->Master->posx - this_00->posx; + iVar6 = -iVar11; + if (-1 < iVar11) { + iVar6 = iVar11; + } + uVar10 = this->Master->posy - this_00->posy; + if (0x7fffffff < uVar10) { + uVar10 = -uVar10; + } + TCreature::BlockLogout(this->Master,0x3c,this_00->Type == PLAYER); + TCreature::BlockLogout(this_00,0x3c,false); + if (((((TPlayer *)this->Master)->super_TCreature).Type == PLAYER) && + (this_00->Type == PLAYER)) { + TPlayer::RecordAttack((TPlayer *)this->Master,this_00->ID); + } + local_40 = ServerMilliseconds + 200; + puVar8 = &local_40; + if (ServerMilliseconds + 200 <= this->EarliestAttackTime) { + puVar8 = &this->EarliestAttackTime; + } + this->EarliestAttackTime = *puVar8; + if (iVar5 == 1) { + if (1 < iVar4) { +LAB_080c4764: + puVar7 = (undefined4 *)__cxa_allocate_exception(4); + *puVar7 = 0x29; + goto LAB_080c4776; + } + CloseAttack(this,this_00); + } + else { + if ((iVar5 < 1) || (3 < iVar5)) goto LAB_080c478e; + if ((7 < iVar6) || (5 < (int)uVar10)) goto LAB_080c4764; + RangeAttack(this,this_00); + } + distance = ServerMilliseconds + 2000; + puVar8 = (ulong *)&distance; + if (ServerMilliseconds + 2000 <= this->EarliestAttackTime) { + puVar8 = &this->EarliestAttackTime; + } + this->EarliestAttackTime = *puVar8; + if (this_00->IsDead == false) { + return; + } + this->AttackDest = 0; + if (this->Master->Type != PLAYER) { + return; + } + pTVar3 = this->Master->Connection; +LAB_080c4514: + SendClearTarget(pTVar3); + return; + } + } + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar7 = (undefined4 *)__cxa_allocate_exception(4,iVar6,iVar11); + *puVar7 = 0x2f; +LAB_080c4776: + // WARNING: Subroutine does not return + __cxa_throw(puVar7,&RESULT::typeinfo,0); +} + + + +// DWARF original prototype: void SetAttackDest(TCombat * this, ulong dfd, bool Follow) + +void __thiscall TCombat::SetAttackDest(TCombat *this,ulong dfd,bool Follow) + +{ + bool bVar1; + uchar uVar2; + TCreature *pTVar3; + int iVar4; + undefined4 *puVar5; + TConnection *pTVar6; + TPlayer *this_00; + int iVar7; + TCreature *cr; + Object OStack_3c; + bool Follow_local; + Object local_2c [7]; + + if ((this->AttackDest == dfd) && (this->Following == Follow)) { + return; + } + if (dfd == 0) { + pTVar3 = this->Master; + } + else { + pTVar3 = this->Master; + if (dfd != pTVar3->ID) { + // try { // try from 080c49be to 080c4e17 has its CatchHandler @ 080c4e52 + pTVar3 = GetCreature(dfd); + if (pTVar3 == (TCreature *)0x0) { + this->AttackDest = 0; + if (this->Master->Type != PLAYER) { + return; + } + pTVar6 = this->Master->Connection; + goto LAB_080c4e10; + } + if (Follow) { + this_00 = (TPlayer *)this->Master; + } + else { + this_00 = (TPlayer *)this->Master; + if (((((this_00->super_TCreature).Type == PLAYER) && (pTVar3->Type == PLAYER)) && + (this->SecureMode == '\x01')) && (WorldType == NORMAL)) { + bVar1 = TPlayer::IsAttackJustified(this_00,pTVar3->ID); + if (!bVar1) { + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x3a; + goto LAB_080c4ba7; + } + this_00 = (TPlayer *)this->Master; + } + if (!Follow) { + if ((this_00->super_TCreature).Type == PLAYER) { + bVar1 = CheckRight((this_00->super_TCreature).ID,ATTACK_EVERYWHERE); + if (!bVar1) { + iVar4 = pTVar3->posz; + iVar7 = pTVar3->posy; + bVar1 = IsProtectionZone(); + if (!bVar1) { + iVar4 = this->Master->posz; + iVar7 = this->Master->posy; + bVar1 = IsProtectionZone(); + if (!bVar1) goto LAB_080c4cec; + } + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4,iVar7,iVar4); + *puVar5 = 0x2f; + goto LAB_080c4ba7; + } +LAB_080c4cec: + this_00 = (TPlayer *)this->Master; + } + if (!Follow) { + if ((this_00->super_TCreature).Type == PLAYER) { + bVar1 = CheckRight((this_00->super_TCreature).ID,NO_ATTACK); + if (!bVar1) { + this_00 = (TPlayer *)this->Master; + goto LAB_080c4a23; + } +LAB_080c4c8f: + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + pTVar6 = this->Master->Connection; +LAB_080c4bef: + SendClearTarget(pTVar6); + } +LAB_080c4bf7: + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x2b; + goto LAB_080c4ba7; + } +LAB_080c4a23: + if (!Follow) { + if (((this_00->super_TCreature).Type == PLAYER) && + (pTVar3->Type == PLAYER)) { + uVar2 = TPlayer::GetRealProfession(this_00); + if ((uVar2 == '\0') && + (bVar1 = CheckRight(this->Master->ID,ATTACK_EVERYWHERE), !bVar1)) + goto LAB_080c4c8f; + this_00 = (TPlayer *)this->Master; + } + if (!Follow) { + if (WorldType == NON_PVP) { + iVar4 = (*(this_00->super_TCreature)._vptr_TCreature[4]) + (this_00); + if (((char)iVar4 == '\0') || + (iVar4 = (*pTVar3->_vptr_TCreature[4])(pTVar3), + (char)iVar4 == '\0')) { +LAB_080c4c1c: + this_00 = (TPlayer *)this->Master; + goto LAB_080c4a57; + } + this_00 = (TPlayer *)this->Master; + if ((this_00->super_TCreature).Type == PLAYER) { + bVar1 = CheckRight((this_00->super_TCreature).ID, + ATTACK_EVERYWHERE); + if (bVar1) goto LAB_080c4c1c; + this_00 = (TPlayer *)this->Master; + } + } + else { +LAB_080c4a57: + if ((Follow) || (pTVar3->Type != NPC)) goto LAB_080c4a6d; + } + this->AttackDest = 0; + if ((this_00->super_TCreature).Type == PLAYER) { + pTVar6 = (this_00->super_TCreature).Connection; + goto LAB_080c4bef; + } + goto LAB_080c4bf7; + } + } + } + } + } +LAB_080c4a6d: + if (((this_00->super_TCreature).Type == PLAYER) && (pTVar3->Type != PLAYER)) { + bVar1 = false; + if (((pTVar3->Outfit).OutfitID == 0) && ((pTVar3->Outfit).field_1.ObjectType == 0)) + { + bVar1 = true; + } + if (!bVar1) goto LAB_080c4aa8; + this->AttackDest = 0; + if ((this_00->super_TCreature).Type == PLAYER) { + pTVar6 = (this_00->super_TCreature).Connection; + goto LAB_080c4b8d; + } + } + else { +LAB_080c4aa8: + local_2c[0].ObjectID = (pTVar3->CrObject).ObjectID; + OStack_3c.ObjectID = (this_00->super_TCreature).CrObject.ObjectID; + iVar4 = ObjectDistance(&stack0xffffffc4,local_2c); + if (iVar4 < 9) { + this->AttackDest = dfd; + this->Following = Follow; + if (Follow) { + return; + } + (*pTVar3->_vptr_TCreature[10])(pTVar3,this->Master->ID); + TCreature::BlockLogout(this->Master,0x3c,pTVar3->Type == PLAYER); + if (((((TPlayer *)this->Master)->super_TCreature).Type == PLAYER) && + (pTVar3->Type == PLAYER)) { + TPlayer::RecordAttack((TPlayer *)this->Master,pTVar3->ID); + } + this->LatestAttackTime = 0; + return; + } + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + pTVar6 = this->Master->Connection; +LAB_080c4b8d: + SendClearTarget(pTVar6); + } + } + puVar5 = (undefined4 *)__cxa_allocate_exception(4); + *puVar5 = 0x25; +LAB_080c4ba7: + // WARNING: Subroutine does not return + __cxa_throw(puVar5,&RESULT::typeinfo,0); + } + } + this->AttackDest = 0; + if (pTVar3->Type != PLAYER) { + return; + } + pTVar6 = pTVar3->Connection; +LAB_080c4e10: + SendClearTarget(pTVar6); + return; +} + + + +// DWARF original prototype: void SetAttackMode(TCombat * this, uchar b) + +void __thiscall TCombat::SetAttackMode(TCombat *this,uchar b) + +{ + uint uVar1; + ulong *puVar2; + uint local_10; + + if ((byte)(b - 1) < 3) { + if (b != this->AttackMode) { + local_10 = ServerMilliseconds + 2000; + puVar2 = &local_10; + if (ServerMilliseconds + 2000 <= this->EarliestAttackTime) { + puVar2 = &this->EarliestAttackTime; + } + uVar1 = *puVar2; + this->AttackMode = b; + this->EarliestAttackTime = uVar1; + } + } + else { + error(&DAT_081073c0,b); + } + return; +} + + + +// DWARF original prototype: void SetChaseMode(TCombat * this, uchar b) + +void __thiscall TCombat::SetChaseMode(TCombat *this,uchar b) + +{ + if (b < 2) { + this->ChaseMode = b; + return; + } + error(&DAT_08107400); + return; +} + + + +// DWARF original prototype: void SetSecureMode(TCombat * this, uchar b) + +void __thiscall TCombat::SetSecureMode(TCombat *this,uchar b) + +{ + if (b < 2) { + this->SecureMode = b; + return; + } + error(&DAT_08107440); + return; +} + + + +// DWARF original prototype: void StopAttack(TCombat * this, int Delay) + +void __thiscall TCombat::StopAttack(TCombat *this,int Delay) + +{ + if (Delay == 0) { + this->AttackDest = 0; + if (this->Master->Type == PLAYER) { + SendClearTarget(this->Master->Connection); + return; + } + } + else { + this->LatestAttackTime = Delay + RoundNr; + } + return; +} + + + +// DWARF original prototype: void DelayAttack(TCombat * this, int Milliseconds) + +void __thiscall TCombat::DelayAttack(TCombat *this,int Milliseconds) + +{ + ulong *puVar1; + uint local_c; + + local_c = ServerMilliseconds + Milliseconds; + puVar1 = &local_c; + if (ServerMilliseconds + Milliseconds <= this->EarliestAttackTime) { + puVar1 = &this->EarliestAttackTime; + } + this->EarliestAttackTime = *puVar1; + return; +} + + + +// DWARF original prototype: void CheckCombatValues(TCombat * this) + +void __thiscall TCombat::CheckCombatValues(TCombat *this) + +{ + bool bVar1; + ulong uVar2; + ulong uVar3; + ulong uVar4; + ulong uVar5; + ulong uVar6; + bool bVar7; + ulong *puVar8; + uint uStack_e0; + bool OldFist; + ulong local_dc; + ulong local_cc; + ulong local_bc; + ulong local_ac; + ulong local_9c; + ulong local_8c; + ulong local_7c; + ulong local_6c; + Object OldAmmo; + Object OldThrow; + Object OldShield; + Object OldClose; + Object OldWand; + Object OldMissile; + + uVar2 = (this->Missile).ObjectID; + uVar3 = (this->Wand).ObjectID; + uVar4 = (this->Close).ObjectID; + uVar5 = (this->Shield).ObjectID; + uVar6 = (this->Throw).ObjectID; + local_6c = (this->Ammo).ObjectID; + bVar1 = this->Fist; + GetWeapon(this); + GetAmmo(this); + local_7c = (this->Missile).ObjectID; + bVar7 = false; + local_8c = local_7c; + if (uVar2 == local_7c) { + local_8c = (this->Wand).ObjectID; + local_9c = local_8c; + if (uVar3 == local_8c) { + local_9c = (this->Close).ObjectID; + local_ac = local_9c; + if (uVar4 == local_9c) { + local_ac = (this->Shield).ObjectID; + local_bc = local_ac; + if (uVar5 == local_ac) { + local_bc = (this->Throw).ObjectID; + local_cc = local_bc; + if (uVar6 == local_bc) { + local_cc = (this->Ammo).ObjectID; + local_dc = local_cc; + if ((local_6c == local_cc) && (bVar1 == this->Fist)) goto LAB_080c5092; + } + } + } + } + } + bVar7 = true; +LAB_080c5092: + if (bVar7) { + uStack_e0 = ServerMilliseconds + 2000; + puVar8 = &stack0xffffff20; + if (ServerMilliseconds + 2000 <= this->EarliestAttackTime) { + puVar8 = &this->EarliestAttackTime; + } + this->EarliestAttackTime = *puVar8; + } + return; +} + + + +// DWARF original prototype: ushort GetArmorStrength(TCombat * this) + +ushort __thiscall TCombat::GetArmorStrength(TCombat *this) + +{ + bool bVar1; + uint uVar2; + int iVar3; + ulong uVar4; + int i; + ulong uVar5; + uint local_40; + ushort Value; + Object local_2c; + Object Obj; + + uVar5 = 1; + local_40 = 0; + do { + GetBodyObject((ulong)&local_2c,this->Master->ID); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + Object::getObjectType((Object *)&Value); + bVar1 = ObjectType::getFlag((ObjectType *)&Value,CLOTHES); + if (bVar1) { + Object::getObjectType((Object *)&Value); + uVar4 = ObjectType::getAttribute((ObjectType *)&Value,BODYPOSITION); + if (uVar4 == uVar5) { + Object::getObjectType((Object *)&Value); + bVar1 = ObjectType::getFlag((ObjectType *)&Value,ARMOR); + if (bVar1) { + Object::getObjectType((Object *)&Value); + uVar4 = ObjectType::getAttribute((ObjectType *)&Value,ARMORVALUE); + local_40 = uVar4 + local_40 & 0xffff; + } + } + } + } + uVar5 = uVar5 + 1; + } while ((int)uVar5 < 0xb); + uVar2 = (ushort)RaceData[this->Master->Race].Armor + local_40; + local_40 = uVar2 & 0xffff; + if (1 < (ushort)uVar2) { + iVar3 = rand(); + local_40 = (local_40 >> 1) + iVar3 % (int)(local_40 >> 1) & 0xffff; + } + return (ushort)local_40; +} + + + +// DWARF original prototype: void AddDamageToCombatList(TCombat * this, ulong atk, ushort Damage) + +void __thiscall TCombat::AddDamageToCombatList(TCombat *this,ulong atk,ushort Damage) + +{ + ulong *puVar1; + ulong uVar2; + TCombat *pTVar3; + int iVar4; + int i; + int iVar5; + uint uVar6; + + uVar2 = RoundNr; + iVar5 = 0; + uVar6 = (uint)Damage; + this->CombatDamage = this->CombatDamage + uVar6; + pTVar3 = this; + do { + if (pTVar3->CombatList[0].ID == atk) { + puVar1 = &pTVar3->CombatList[0].Damage; + *puVar1 = *puVar1 + uVar6; + pTVar3->CombatList[0].TimeStamp = uVar2; + return; + } + iVar5 = iVar5 + 1; + pTVar3 = (TCombat *)&pTVar3->LastDefendTime; + } while (iVar5 < 0x14); + this->CombatList[this->ActCombatEntry].ID = atk; + this->CombatList[this->ActCombatEntry].Damage = uVar6; + this->CombatList[this->ActCombatEntry].TimeStamp = RoundNr; + iVar4 = this->ActCombatEntry + 1; + iVar5 = 0; + if (iVar4 != 0x14) { + iVar5 = iVar4; + } + this->ActCombatEntry = iVar5; + return; +} + + + +// DWARF original prototype: void DistributeExperiencePoints(TCombat * this, ulong Exp) + +void __thiscall TCombat::DistributeExperiencePoints(TCombat *this,ulong Exp) + +{ + TSkill *pTVar1; + bool bVar2; + TPlayer *this_00; + uint uVar3; + int iVar4; + uint uVar5; + char *pcVar6; + ulong uVar7; + ulong uVar8; + int iVar9; + int iVar10; + int LevelMurderer; + int Rest; + uint uVar11; + int Amount; + TCombat *pTVar12; + TCreature *cr; + char *pcVar13; + char *pcVar14; + int Interval; + int LevelVictim; + int local_30; + int i; + + pcVar13 = "%s ist gestorben. Verteile %ld EXP...\n"; + pcVar14 = this->Master->Name; + uVar11 = Exp; + print(); + if (this->CombatDamage != 0) { + local_30 = 0x13; + pTVar12 = this; + do { + this_00 = (TPlayer *)GetCreature(pTVar12->CombatList[0].ID); + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).IsDead == false)) { + uVar3 = (Exp * pTVar12->CombatList[0].Damage) / this->CombatDamage; + if (((((TPlayer *)this->Master)->super_TCreature).Type == PLAYER) && + ((this_00->super_TCreature).Type == PLAYER)) { + pcVar13 = (char *)0x1; + uVar7 = TPlayer::GetPartyLeader((TPlayer *)this->Master,true); + if (uVar7 != 0) { + uVar7 = TPlayer::GetPartyLeader((TPlayer *)this->Master,true); + pcVar13 = (char *)0x1; + uVar8 = TPlayer::GetPartyLeader(this_00,true); + if (uVar7 == uVar8) goto LAB_080c536f; + } + iVar9 = TSkill::Get((this->Master->super_TSkillBase).Skills[0]); + iVar10 = TSkill::Get((this_00->super_TCreature).super_TSkillBase.Skills[0]); + iVar4 = (iVar9 * 0xb) / 10; + if (iVar4 <= iVar10) goto LAB_080c536f; + pcVar13 = &DAT_08107558; + pcVar14 = (this_00->super_TCreature).Name; + uVar3 = (int)((iVar4 - iVar10) * uVar3) / iVar9; + uVar11 = uVar3; + print(); + } + if (uVar3 != 0) { + pcVar6 = pcVar14; + if ((this_00->super_TCreature).Type == PLAYER) { + iVar4 = TSkill::Get((this_00->super_TCreature).super_TSkillBase.Skills[0]); + pcVar6 = pcVar14; + if (iVar4 <= (int)uVar3) { + bVar2 = TPlayer::GetActivePromotion(this_00); + uVar5 = 0x78; + if (bVar2) { + uVar5 = 0xf; + } + pcVar6 = (char *)(0xf0 / (ulonglong)(longlong)(int)uVar5); + pTVar1 = (this_00->super_TCreature).super_TSkillBase.Skills[0x16]; + iVar4 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1,pcVar13,pcVar14,uVar11); + uVar11 = iVar4 % (int)uVar5; + if (iVar4 % (int)uVar5 == 0) { + uVar11 = uVar5; + } + TSkillBase::SetTimer(&(this_00->super_TCreature).super_TSkillBase); + } + } + (*(this_00->super_TCreature).super_TSkillBase.Skills[0]->_vptr_TSkill[3]) + ((this_00->super_TCreature).super_TSkillBase.Skills[0],uVar3,pcVar6, + uVar11); + pcVar13 = (char *)0xd7; + pcVar14 = "%d"; + TextualEffect(); + uVar11 = uVar3; + } + } +LAB_080c536f: + pTVar12 = (TCombat *)&pTVar12->LastDefendTime; + local_30 = local_30 + -1; + } while (-1 < local_30); + } + return; +} + + + +// DWARF original prototype: ulong GetDamageByCreature(TCombat * this, ulong CreatureID) + +ulong __thiscall TCombat::GetDamageByCreature(TCombat *this,ulong CreatureID) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + if (this->CombatList[0].ID == CreatureID) { + return this->CombatList[0].Damage; + } + iVar1 = iVar1 + 1; + this = (TCombat *)&this->LastDefendTime; + } while (iVar1 < 0x14); + return 0; +} + + + +// DWARF original prototype: ulong GetMostDangerousAttacker(TCombat * this) + +ulong __thiscall TCombat::GetMostDangerousAttacker(TCombat *this) + +{ + uint uVar1; + int i; + int iVar2; + int Limitation; + ulong MaximumDamage; + uint uVar3; + ulong Attacker; + ulong uVar4; + + iVar2 = 0x13; + uVar4 = 0; + uVar3 = 0; + do { + if (((int)(RoundNr - 0x3c) < this->CombatList[0].TimeStamp) && + (uVar1 = this->CombatList[0].Damage, uVar3 < uVar1)) { + uVar4 = this->CombatList[0].ID; + uVar3 = uVar1; + } + this = (TCombat *)&this->LastDefendTime; + iVar2 = iVar2 + -1; + } while (-1 < iVar2); + return uVar4; +} + + + +// DWARF original prototype: int TypeToSkill(TCombat * this, int type) + +int __thiscall TCombat::TypeToSkill(TCombat *this,int type) + +{ + int iVar1; + + iVar1 = 0xb; + switch(type) { + case 0: + iVar1 = 0xb; + break; + case 1: + iVar1 = 8; + break; + case 2: + iVar1 = 9; + break; + case 3: + iVar1 = 10; + break; + case 4: + iVar1 = 6; + break; + case 5: + case 6: + iVar1 = 7; + } + return iVar1; +} + + + +// DWARF original prototype: void GetWeapon(TCombat * this) + +void __thiscall TCombat::GetWeapon(TCombat *this) + +{ + bool bVar1; + byte bVar2; + int iVar3; + ulong uVar4; + int local_50; + int Hand; + Object local_3c; + Object Obj; + Object local_2c [7]; + + (this->Missile).ObjectID = ::NONE.ObjectID; + (this->Wand).ObjectID = ::NONE.ObjectID; + (this->Close).ObjectID = ::NONE.ObjectID; + (this->Shield).ObjectID = ::NONE.ObjectID; + (this->Throw).ObjectID = ::NONE.ObjectID; + local_2c[0].ObjectID = ::NONE.ObjectID; + (this->Ammo).ObjectID = ::NONE.ObjectID; + this->Fist = true; + local_3c.ObjectID = (this->Master->CrObject).ObjectID; + bVar1 = Object::exists(&local_3c); + if (bVar1) { + local_50 = 5; + do { + GetBodyObject((ulong)&local_3c,this->Master->ID); + local_2c[0].ObjectID = ::NONE.ObjectID; + if (local_3c.ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTLEVEL); + if (bVar1) { + iVar3 = TSkill::Get((this->Master->super_TSkillBase).Skills[0]); + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,MINIMUMLEVEL); + if (iVar3 < (int)uVar4) goto LAB_080c5626; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,RESTRICTPROFESSION); + if ((bVar1) && (this->Master->Type == PLAYER)) { + Object::getObjectType(local_2c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_2c,PROFESSIONS); + bVar2 = TPlayer::GetEffectiveProfession((TPlayer *)this->Master); + if ((1 << (bVar2 & 0x1f) & uVar4) == 0) goto LAB_080c5626; + } + Object::getObjectType(local_2c); + bVar1 = ObjectType::getFlag((ObjectType *)local_2c,SHIELD); + if (bVar1) { + Hand = local_3c.ObjectID; + (this->Shield).ObjectID = local_3c.ObjectID; + local_2c[0].ObjectID = local_3c.ObjectID; + } + Object::getObjectType((Object *)&Hand); + bVar1 = ObjectType::getFlag((ObjectType *)&Hand,BOW); + if (bVar1) { + local_2c[0].ObjectID = local_3c.ObjectID; + (this->Missile).ObjectID = local_3c.ObjectID; + Hand = local_3c.ObjectID; + this->Fist = false; + } + Object::getObjectType((Object *)&Hand); + bVar1 = ObjectType::getFlag((ObjectType *)&Hand,WAND); + if (bVar1) { + local_2c[0].ObjectID = local_3c.ObjectID; + (this->Wand).ObjectID = local_3c.ObjectID; + Hand = local_3c.ObjectID; + this->Fist = false; + } + Object::getObjectType((Object *)&Hand); + bVar1 = ObjectType::getFlag((ObjectType *)&Hand,THROW); + if (bVar1) { + local_2c[0].ObjectID = local_3c.ObjectID; + (this->Throw).ObjectID = local_3c.ObjectID; + Hand = local_3c.ObjectID; + this->Fist = false; + } + Object::getObjectType((Object *)&Hand); + bVar1 = ObjectType::getFlag((ObjectType *)&Hand,WEAPON); + if (bVar1) { + Hand = local_3c.ObjectID; + (this->Close).ObjectID = local_3c.ObjectID; + this->Fist = false; + local_2c[0].ObjectID = Hand; + } + } +LAB_080c5626: + local_50 = local_50 + 1; + } while (local_50 < 7); + } + else { + error("TCombat::GetWeapon: Kreatur-Objekt existiert nicht.\n"); + } + return; +} + + + +// DWARF original prototype: void GetAmmo(TCombat * this) + +void __thiscall TCombat::GetAmmo(TCombat *this) + +{ + bool bVar1; + bool bVar2; + ulong uVar3; + ulong uVar4; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + + local_2c = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if ((this->Missile).ObjectID == ::NONE.ObjectID) { + uVar3 = (this->Throw).ObjectID; + if (uVar3 != ::NONE.ObjectID) { + (this->Ammo).ObjectID = uVar3; + return; + } + uVar3 = (this->Wand).ObjectID; + if (uVar3 == ::NONE.ObjectID) { + return; + } + (this->Ammo).ObjectID = uVar3; + return; + } + GetBodyObject((ulong)local_4c,this->Master->ID); + (this->Ammo).ObjectID = local_4c[0].ObjectID; + bVar1 = false; + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if ((this->Ammo).ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,AMMO); + if (bVar2) { + Object::getObjectType(local_3c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_3c,AMMOTYPE); + Object::getObjectType(local_3c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_3c,BOWAMMOTYPE); + if (uVar3 == uVar4) goto LAB_080c58ea; + } + bVar1 = true; + } +LAB_080c58ea: + if (bVar1) { + (this->Ammo).ObjectID = ::NONE.ObjectID; + } + return; +} + + + +// DWARF original prototype: void CloseAttack(TCombat * this, TCreature * dfd) + +void __thiscall TCombat::CloseAttack(TCombat *this,TCreature *dfd) + +{ + TSkill *pTVar1; + bool bVar2; + bool bVar3; + short sVar4; + int Poison; + int iVar5; + int iVar6; + long Damage_00; + ulong uVar7; + int Damage; + int Attack; + int iVar8; + int Defend; + Object local_4c [4]; + ulong local_3c; + ushort local_20; + short local_1e; + ushort Type; + short Value; + + // try { // try from 080c59a6 to 080c5bf2 has its CatchHandler @ 080c5c88 + GetAttackValue(this); + pTVar1 = (this->Master->super_TSkillBase).Skills[local_20]; + if (this->AttackMode == '\x01') { + local_1e = (short)((local_1e * 2) / 10) + local_1e; + } + else if (this->AttackMode == '\x03') { + local_1e = local_1e - (short)((local_1e * 4) / 10); + } + iVar5 = (*pTVar1->_vptr_TSkill[8])(pTVar1,(int)local_1e,(uint)(0 < this->LearningPoints)); + local_1e = (short)iVar5; + if (0 < this->LearningPoints) { + this->LearningPoints = this->LearningPoints + -1; + } + iVar8 = (int)local_1e; + sVar4 = GetDefendDamage(&dfd->Combat); + iVar5 = iVar8 - sVar4; + if (iVar5 < 0) { + iVar5 = 0; + } + iVar5 = TCreature::Damage(dfd,this->Master,iVar5,1); + if (0 < iVar5) { + this->LearningPoints = 0x1e; + } + iVar6 = GetRacePoison(this->Master->Race); + if ((iVar6 != 0) && + ((0 < iVar5 || ((sVar4 < iVar8 && (iVar5 = rand(), iVar5 == (iVar5 / 5) * 5)))))) { + GetRacePoison(this->Master->Race); + GetRacePoison(this->Master->Race); + Damage_00 = random(); + if ((0 < Damage_00) && + (TCreature::Damage(dfd,this->Master,Damage_00,0x20), dfd->Type == PLAYER)) { + SendMessage(dfd->Connection,0x15,"You are poisoned."); + } + } + bVar2 = false; + local_3c = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if ((this->Close).ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_4c); + bVar3 = ObjectType::getFlag((ObjectType *)local_4c,WEAROUT); + if (bVar3) { + bVar2 = true; + } + } + if (bVar2) { + uVar7 = Object::getAttribute(&this->Close,REMAININGUSES); + if (uVar7 < 2) { + Object::getObjectType((Object *)&Defend); + uVar7 = ObjectType::getAttribute((ObjectType *)&Defend,WEAROUTTARGET); + ObjectType::setTypeID((ObjectType *)local_4c,uVar7); + Defend = (this->Close).ObjectID; + Change((Object *)&Defend,(ObjectType *)local_4c,0); + CheckCombatValues(this); + } + else { + uVar7 = Object::getAttribute(&this->Close,REMAININGUSES); + local_4c[0].ObjectID = (this->Close).ObjectID; + Change(local_4c,REMAININGUSES,uVar7 - 1); + } + } + return; +} + + + +// DWARF original prototype: void RangeAttack(TCombat * this, TCreature * dfd) + +void __thiscall TCombat::RangeAttack(TCombat *this,TCreature *dfd) + +{ + TSkill *pTVar1; + Object OVar2; + bool bVar3; + bool bVar4; + int Damage; + int iVar5; + ulong uVar6; + uint uVar7; + long lVar8; + undefined4 *puVar9; + ulong uVar10; + ulong uVar11; + int *piVar12; + RESULT r; + int Attack; + Object *this_00; + TYPEATTRIBUTE Attribute; + undefined4 uVar13; + char local_f1; + ulong uStack_f0; + bool Hit; + int EffectStrength; + int SpecialEffect; + int Fragility; + int AnimType; + int DamageType; + int DiffLvl; + int local_d4; + int local_d0; + int x; + int y; + int z; + int local_c0; + int local_bc; + int local_b8; + int local_b4; + int local_b0; + undefined1 local_ac [4]; + TDamageImpact Impact; + ushort local_80; + short local_7e; + ushort Type; + short Value; + Object local_6c [4]; + Object local_5c [4]; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + Object Drop; + + local_2c = 0; + local_3c = ::NONE.ObjectID; + local_5c[0].ObjectID = (this->Wand).ObjectID; + if (local_5c[0].ObjectID == ::NONE.ObjectID) { + local_5c[0].ObjectID = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if ((this->Missile).ObjectID == ::NONE.ObjectID) { + _Type = ::NONE.ObjectID; + this_00 = local_6c; + local_6c[0].ObjectID = ::NONE.ObjectID; + uVar6 = (this->Throw).ObjectID; + if (uVar6 == ::NONE.ObjectID) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0xffffffff; + goto LAB_080c66b1; + } + DamageType = 0x4b; + (this->Ammo).ObjectID = uVar6; + iVar5 = this->Master->posx - dfd->posx; + local_c0 = -iVar5; + if (-1 < iVar5) { + local_c0 = iVar5; + } + iVar5 = this->Master->posy - dfd->posy; + z = -iVar5; + if (-1 < iVar5) { + z = iVar5; + } + piVar12 = &z; + if (z <= local_c0) { + piVar12 = &local_c0; + } + local_6c[0].ObjectID = uVar6; + local_4c[0].ObjectID = uVar6; + // try { // try from 080c5d84 to 080c5edd has its CatchHandler @ 080c6b00 + Object::getObjectType(this_00); + uVar6 = ObjectType::getAttribute((ObjectType *)this_00,THROWRANGE); + if ((int)uVar6 < *piVar12) goto LAB_080c66c9; + Object::getObjectType(this_00); + Fragility = ObjectType::getAttribute((ObjectType *)this_00,THROWMISSILE); + Object::getObjectType(this_00); + SpecialEffect = ObjectType::getAttribute((ObjectType *)this_00,THROWFRAGILITY); + Object::getObjectType(this_00); + EffectStrength = ObjectType::getAttribute((ObjectType *)this_00,THROWSPECIALEFFECT); + Object::getObjectType(this_00); + Attribute = THROWEFFECTSTRENGTH; + } + else { + uVar13 = 10; + DamageType = 0x5a; + uVar6 = this->Master->ID; + GetBodyObject((ulong)local_6c,uVar6); + (this->Ammo).ObjectID = local_6c[0].ObjectID; + bVar3 = false; + local_6c[0].ObjectID = ::NONE.ObjectID; + local_4c[0].ObjectID = ::NONE.ObjectID; + if ((this->Ammo).ObjectID != ::NONE.ObjectID) { + Object::getObjectType(local_4c); + uVar6 = 0x3c; + bVar4 = ObjectType::getFlag((ObjectType *)local_4c,AMMO); + if (bVar4) { + Object::getObjectType(local_4c); + uVar10 = ObjectType::getAttribute((ObjectType *)local_4c,AMMOTYPE); + Object::getObjectType(local_4c); + uVar6 = 0x27; + uVar11 = ObjectType::getAttribute((ObjectType *)local_4c,BOWAMMOTYPE); + if (uVar10 == uVar11) goto LAB_080c6742; + } + bVar3 = true; + } +LAB_080c6742: + OVar2.ObjectID = ::NONE.ObjectID; + if (bVar3) { + _Type = ::NONE.ObjectID; + (this->Ammo).ObjectID = ::NONE.ObjectID; + local_4c[0].ObjectID = OVar2.ObjectID; + } + bVar3 = Object::exists(&this->Ammo); + if (!bVar3) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4,uVar6,uVar13); + *puVar9 = 0x26; + goto LAB_080c66b1; + } + iVar5 = this->Master->posx - dfd->posx; + local_b8 = -iVar5; + if (-1 < iVar5) { + local_b8 = iVar5; + } + iVar5 = this->Master->posy - dfd->posy; + local_bc = -iVar5; + if (-1 < iVar5) { + local_bc = iVar5; + } + piVar12 = &local_bc; + if (local_bc <= local_b8) { + piVar12 = &local_b8; + } + Object::getObjectType((Object *)&Type); + uVar6 = ObjectType::getAttribute((ObjectType *)&Type,BOWRANGE); + if ((int)uVar6 < *piVar12) goto LAB_080c66c9; + Object::getObjectType((Object *)&Type); + Fragility = ObjectType::getAttribute((ObjectType *)&Type,AMMOMISSILE); + SpecialEffect = 100; + Object::getObjectType((Object *)&Type); + EffectStrength = ObjectType::getAttribute((ObjectType *)&Type,AMMOSPECIALEFFECT); + Object::getObjectType((Object *)&Type); + this_00 = (Object *)&Type; + Attribute = AMMOEFFECTSTRENGTH; + } + AnimType = 1; + uStack_f0 = ObjectType::getAttribute((ObjectType *)this_00,Attribute); + } + else { + DamageType = 0; + (this->Ammo).ObjectID = local_5c[0].ObjectID; + iVar5 = this->Master->posx - dfd->posx; + local_b0 = -iVar5; + if (-1 < iVar5) { + local_b0 = iVar5; + } + iVar5 = this->Master->posy - dfd->posy; + local_b4 = -iVar5; + if (-1 < iVar5) { + local_b4 = iVar5; + } + piVar12 = &local_b4; + if (local_b4 <= local_b0) { + piVar12 = &local_b0; + } + local_4c[0].ObjectID = local_5c[0].ObjectID; + Object::getObjectType(local_5c); + uVar6 = ObjectType::getAttribute((ObjectType *)local_5c,WANDRANGE); + if ((int)uVar6 < *piVar12) { +LAB_080c66c9: + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0x29; + goto LAB_080c66b1; + } + Object::getObjectType(local_5c); + AnimType = ObjectType::getAttribute((ObjectType *)local_5c,WANDDAMAGETYPE); + Object::getObjectType(local_5c); + Fragility = ObjectType::getAttribute((ObjectType *)local_5c,WANDMISSILE); + SpecialEffect = 0; + EffectStrength = 0; + uStack_f0 = 0; + } + _Type = (dfd->CrObject).ObjectID; + GetObjectCoordinates((Object *)&Type,&local_d0,&x,&y); + bVar3 = ThrowPossible(this->Master->posx,this->Master->posy,this->Master->posz,local_d0,x,y,0); + if (!bVar3) { + puVar9 = (undefined4 *)__cxa_allocate_exception(4); + *puVar9 = 0x2a; +LAB_080c66b1: + // WARNING: Subroutine does not return + __cxa_throw(puVar9,&RESULT::typeinfo,0); + } + _Type = ::NONE.ObjectID; + local_6c[0].ObjectID = ::NONE.ObjectID; + if ((this->Wand).ObjectID == ::NONE.ObjectID) { + iVar5 = this->Master->posx - dfd->posx; + local_d4 = -iVar5; + if (-1 < iVar5) { + local_d4 = iVar5; + } + iVar5 = this->Master->posy - dfd->posy; + DiffLvl = -iVar5; + if (-1 < iVar5) { + DiffLvl = iVar5; + } + piVar12 = &DiffLvl; + if (DiffLvl <= local_d4) { + piVar12 = &local_d4; + } + iVar5 = *piVar12; + if (iVar5 < 2) { + iVar5 = 5; + } + iVar5 = (*(this->Master->super_TSkillBase).Skills[7]->_vptr_TSkill[9]) + ((this->Master->super_TSkillBase).Skills[7],iVar5 * 0xf,DamageType, + (uint)(0 < this->LearningPoints)); + local_f1 = (char)iVar5; + if (0 < this->LearningPoints) { + this->LearningPoints = this->LearningPoints + -1; + } + } + else { + // try { // try from 080c5f0a to 080c5f42 has its CatchHandler @ 080c6a3c + Object::getObjectType(local_6c); + uVar6 = ObjectType::getAttribute((ObjectType *)local_6c,WANDMANACONSUMPTION); + CheckMana(this->Master,uVar6,0,0); + local_f1 = '\x01'; + } + _Type = ::NONE.ObjectID; + local_6c[0].ObjectID = ::NONE.ObjectID; + if ((this->Wand).ObjectID == ::NONE.ObjectID) { + if (local_f1 != '\0') { + local_4c[0].ObjectID = (dfd->CrObject).ObjectID; + GetMapContainer(local_5c); + local_2c = local_5c[0].ObjectID; + local_6c[0].ObjectID = local_5c[0].ObjectID; + GetObjectCoordinates(local_6c,&local_d0,&x,&y); + GetAttackValue(this); + pTVar1 = (this->Master->super_TSkillBase).Skills[local_80]; + if (this->AttackMode == '\x01') { + local_7e = (short)((local_7e * 2) / 10) + local_7e; + } + else if (this->AttackMode == '\x03') { + local_7e = local_7e - (short)(((int)local_7e << 2) / 10); + } + iVar5 = (*pTVar1->_vptr_TSkill[8]) + (pTVar1,(int)local_7e,(uint)(0 < this->LearningPoints)); + if (0 < this->LearningPoints) { + this->LearningPoints = this->LearningPoints + -1; + } + local_6c[0].ObjectID = ::NONE.ObjectID; + local_5c[0].ObjectID = ::NONE.ObjectID; + if ((this->Shield).ObjectID != ::NONE.ObjectID) { + GetDefendDamage(&dfd->Combat); + } + iVar5 = TCreature::Damage(dfd,this->Master,(int)(short)iVar5,AnimType); + if (0 < iVar5) { + this->LearningPoints = 0x1e; + } + goto LAB_080c60be; + } + local_6c[0].ObjectID = (dfd->CrObject).ObjectID; + // try { // try from 080c5f9b to 080c60ea has its CatchHandler @ 080c6b00 + GetObjectCoordinates(local_6c,&local_d0,&x,&y); + uVar7 = this->Master->posx - dfd->posx; + if (0x7fffffff < uVar7) { + uVar7 = -uVar7; + } + if ((int)uVar7 < 2) { + uVar7 = this->Master->posy - dfd->posy; + if (0x7fffffff < uVar7) { + uVar7 = -uVar7; + } + if (1 < (int)uVar7) goto LAB_080c5fc4; + } + else { +LAB_080c5fc4: + iVar5 = rand(); + local_d0 = iVar5 % 3 + local_d0 + -1; + iVar5 = rand(); + x = iVar5 % 3 + x + -1; + } + bVar3 = false; + bVar4 = CoordinateFlag(); + if (bVar4) { + bVar3 = CoordinateFlag(); + bVar3 = !bVar3; + } + if ((!bVar3) || + (bVar3 = ThrowPossible(this->Master->posx,this->Master->posy,this->Master->posz,local_d0, + x,y,0), !bVar3)) { + local_d0 = dfd->posx; + x = dfd->posy; + y = dfd->posz; + } + GetMapContainer((int)local_5c,local_d0,x); + } + else { + Object::getObjectType(local_6c); + uVar6 = ObjectType::getAttribute((ObjectType *)local_6c,WANDATTACKSTRENGTH); + Object::getObjectType(local_6c); + ObjectType::getAttribute((ObjectType *)local_6c,WANDATTACKVARIATION); + Object::getObjectType(local_6c); + ObjectType::getAttribute((ObjectType *)local_6c,WANDATTACKVARIATION); + lVar8 = random(); + iVar5 = TCreature::Damage(dfd,this->Master,lVar8 + uVar6,AnimType); + if (0 < iVar5) { + this->LearningPoints = 0x1e; + } + local_4c[0].ObjectID = (dfd->CrObject).ObjectID; + GetMapContainer(local_5c); + } + local_2c = local_5c[0].ObjectID; +LAB_080c60be: + _Type = local_2c; + local_6c[0].ObjectID = (this->Master->CrObject).ObjectID; + Missile(local_6c,(Object *)&Type,Fragility); + if (EffectStrength == 1) { + if (local_f1 != '\0') { + TCreature::Damage(dfd,this->Master,uStack_f0,0x20); + } + } + else if (EffectStrength == 2) { + // try { // try from 080c61e3 to 080c6a18 has its CatchHandler @ 080c6b00 + iVar5 = ComputeDamage(this->Master,0,uStack_f0,uStack_f0); + TDamageImpact::TDamageImpact((TDamageImpact *)local_ac,this->Master,1,iVar5,false); + _Type = local_2c; + GetObjectCoordinates((Object *)&Type,&local_d0,&x,&y); + CircleShapeSpell(this->Master,local_d0,x,y,0x7fffffff,0,2,(TImpact *)local_ac,7); + } + _Type = ::NONE.ObjectID; + if ((this->Wand).ObjectID == ::NONE.ObjectID) { + // try { // try from 080c6129 to 080c614e has its CatchHandler @ 080c6aab + lVar8 = random(); + if (lVar8 < SpecialEffect) { + local_6c[0].ObjectID = (this->Ammo).ObjectID; + Delete(local_6c,1); + } + else { + local_6c[0].ObjectID = ::NONE.ObjectID; + local_5c[0].ObjectID = local_2c; + local_4c[0].ObjectID = (this->Ammo).ObjectID; + // try { // try from 080c61c1 to 080c61c5 has its CatchHandler @ 080c6aab + Move(0,local_4c,local_5c,1,false,local_6c); + } + if (local_f1 == '\0') { + // try { // try from 080c617d to 080c6181 has its CatchHandler @ 080c6b00 + GraphicalEffect(); + } + } + return; +} + + + +// DWARF original prototype: void GetAttackValue(TCombat * this, short * Value, ushort * Skill) + +void __thiscall TCombat::GetAttackValue(TCombat *this) + +{ + ulong uVar1; + undefined2 uVar2; + Object *this_00; + ushort Type; + uint uVar3; + undefined2 *in_stack_00000008; + undefined2 *in_stack_0000000c; + TYPEATTRIBUTE Attribute; + Object local_6c [4]; + ulong local_5c; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + + this_00 = local_3c; + *in_stack_00000008 = 0; + local_2c = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if ((this->Close).ObjectID == ::NONE.ObjectID) { + this_00 = local_4c; + local_4c[0].ObjectID = ::NONE.ObjectID; + if ((this->Throw).ObjectID != ::NONE.ObjectID) { + uVar3 = 6; + Object::getObjectType(this_00); + Attribute = THROWATTACKVALUE; + goto LAB_080c6c20; + } + if ((this->Wand).ObjectID != ::NONE.ObjectID) { + uVar3 = 0; + *in_stack_00000008 = 0; + goto LAB_080c6b79; + } + local_5c = ::NONE.ObjectID; + this_00 = local_6c; + local_6c[0].ObjectID = ::NONE.ObjectID; + if ((this->Missile).ObjectID != ::NONE.ObjectID) { + Object::getObjectType(this_00); + Attribute = AMMOATTACKVALUE; + uVar3 = 5; + goto LAB_080c6c20; + } + uVar3 = 0; + uVar2 = (undefined2)RaceData[this->Master->Race].Attack; + } + else { + Object::getObjectType(this_00); + uVar1 = ObjectType::getAttribute((ObjectType *)this_00,WEAPONTYPE); + uVar3 = uVar1 & 0xffff; + Object::getObjectType(this_00); + Attribute = WEAPONATTACKVALUE; +LAB_080c6c20: + uVar1 = ObjectType::getAttribute((ObjectType *)this_00,Attribute); + uVar2 = (undefined2)uVar1; + } + *in_stack_00000008 = uVar2; +LAB_080c6b79: + uVar2 = 0xb; + switch(uVar3) { + case 0: + uVar2 = 0xb; + break; + case 1: + uVar2 = 8; + break; + case 2: + uVar2 = 9; + break; + case 3: + uVar2 = 10; + break; + case 4: + uVar2 = 6; + break; + case 5: + case 6: + uVar2 = 7; + } + *in_stack_0000000c = uVar2; + return; +} + + + +// DWARF original prototype: void GetDefendValue(TCombat * this, short * Value, ushort * Skill) + +void __thiscall TCombat::GetDefendValue(TCombat *this) + +{ + ulong uVar1; + undefined2 uVar2; + Object *this_00; + ushort Type; + uint uVar3; + undefined2 *in_stack_00000008; + undefined2 *in_stack_0000000c; + TYPEATTRIBUTE Attribute; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + + this_00 = local_3c; + *in_stack_00000008 = 0; + local_2c = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if ((this->Shield).ObjectID == ::NONE.ObjectID) { + this_00 = local_4c; + local_4c[0].ObjectID = ::NONE.ObjectID; + if ((this->Close).ObjectID != ::NONE.ObjectID) { + Object::getObjectType(this_00); + uVar1 = ObjectType::getAttribute((ObjectType *)this_00,WEAPONTYPE); + uVar3 = uVar1 & 0xffff; + Object::getObjectType(this_00); + Attribute = WEAPONDEFENDVALUE; + goto LAB_080c6d9c; + } + this_00 = local_5c; + local_5c[0].ObjectID = ::NONE.ObjectID; + if ((this->Throw).ObjectID != ::NONE.ObjectID) { + uVar3 = 6; + Object::getObjectType(this_00); + Attribute = THROWDEFENDVALUE; + goto LAB_080c6d9c; + } + if ((this->Missile).ObjectID != ::NONE.ObjectID) { + uVar3 = 5; + *in_stack_00000008 = 0; + goto LAB_080c6d01; + } + uVar3 = 0; + uVar2 = (undefined2)RaceData[this->Master->Race].Defend; + } + else { + uVar3 = 4; + Object::getObjectType(this_00); + Attribute = SHIELDDEFENDVALUE; +LAB_080c6d9c: + uVar1 = ObjectType::getAttribute((ObjectType *)this_00,Attribute); + uVar2 = (undefined2)uVar1; + } + *in_stack_00000008 = uVar2; +LAB_080c6d01: + uVar2 = 0xb; + switch(uVar3) { + case 0: + uVar2 = 0xb; + break; + case 1: + uVar2 = 8; + break; + case 2: + uVar2 = 9; + break; + case 3: + uVar2 = 10; + break; + case 4: + uVar2 = 6; + break; + case 5: + case 6: + uVar2 = 7; + } + *in_stack_0000000c = uVar2; + return; +} + + + +// WARNING: Variable defined which should be unmapped: Type +// DWARF original prototype: short GetAttackDamage(TCombat * this) + +short __thiscall TCombat::GetAttackDamage(TCombat *this) + +{ + TSkill *pTVar1; + int iVar2; + TSkill *sk; + ushort local_14; + short local_12; + ushort Type; + short Value; + + GetAttackValue(this); + pTVar1 = (this->Master->super_TSkillBase).Skills[local_14]; + if (this->AttackMode == '\x01') { + local_12 = (short)((local_12 * 2) / 10) + local_12; + } + else if (this->AttackMode == '\x03') { + local_12 = local_12 - (short)((local_12 * 4) / 10); + } + iVar2 = (*pTVar1->_vptr_TSkill[8])(pTVar1,(int)local_12,(uint)(0 < this->LearningPoints)); + if (0 < this->LearningPoints) { + this->LearningPoints = this->LearningPoints + -1; + } + return (short)iVar2; +} + + + +// DWARF original prototype: short GetDefendDamage(TCombat * this) + +short __thiscall TCombat::GetDefendDamage(TCombat *this) + +{ + Object *this_00; + TSkill *pTVar1; + short sVar2; + uchar Tac; + uchar uVar3; + bool bVar4; + bool bVar5; + int iVar6; + ulong uVar7; + undefined4 uVar8; + TSkill *sk; + Object local_5c [4]; + ulong local_4c; + Object local_3c [7]; + undefined4 local_20; + ushort Type; + short Value; + + if (ServerMilliseconds < this->EarliestDefendTime) { + return 0; + } + this->EarliestDefendTime = this->LastDefendTime + 2000; + this->LastDefendTime = ServerMilliseconds; + GetDefendValue(this); + pTVar1 = (this->Master->super_TSkillBase).Skills[local_20 & 0xffff]; + if (((this->Following == false) && (this->AttackDest != 0)) || + (ServerMilliseconds < this->EarliestAttackTime)) { + uVar3 = this->AttackMode; + } + else { + uVar3 = '\x03'; + } + sVar2 = (short)local_20; + if (uVar3 == '\x01') { + local_20 = CONCAT22(local_20._2_2_ - (short)(((int)local_20._2_2_ << 2) / 10), + (short)local_20); + } + else if (uVar3 == '\x03') { + local_20 = CONCAT22((short)(((int)local_20._2_2_ << 3) / 10) + local_20._2_2_, + (short)local_20); + } + if (sVar2 != 0) { + uVar8 = 0; + local_3c[0].ObjectID = ::NONE.ObjectID; + local_4c = ::NONE.ObjectID; + if (((this->Shield).ObjectID != ::NONE.ObjectID) && (0 < this->LearningPoints)) { + uVar8 = 1; + } + iVar6 = (*pTVar1->_vptr_TSkill[8])(pTVar1,(int)local_20._2_2_,uVar8); + bVar4 = false; + local_20 = CONCAT22((short)iVar6,(short)local_20); + uVar7 = (this->Shield).ObjectID; + if ((uVar7 != ::NONE.ObjectID) && (0 < this->LearningPoints)) { + bVar4 = true; + } + if (bVar4) { + this->LearningPoints = this->LearningPoints + -1; + } + bVar4 = false; + this_00 = &this->Shield; + local_4c = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + if (uVar7 != ::NONE.ObjectID) { + Object::getObjectType(local_3c); + bVar5 = ObjectType::getFlag((ObjectType *)local_3c,WEAROUT); + if (bVar5) { + bVar4 = true; + } + } + if (bVar4) { + uVar7 = Object::getAttribute(this_00,REMAININGUSES); + if (uVar7 < 2) { + Object::getObjectType(local_5c); + uVar7 = ObjectType::getAttribute((ObjectType *)local_5c,WEAROUTTARGET); + ObjectType::setTypeID((ObjectType *)local_3c,uVar7); + local_5c[0].ObjectID = (this->Shield).ObjectID; + Change(local_5c,(ObjectType *)local_3c,0); + bVar4 = Object::exists(this_00); + if (bVar4) { + Object::getObjectType(local_5c); + bVar4 = ObjectType::getFlag((ObjectType *)local_5c,SHIELD); + if (bVar4) goto LAB_080c7009; + } + CheckCombatValues(this); + } + else { + uVar7 = Object::getAttribute(this_00,REMAININGUSES); + local_3c[0].ObjectID = (this->Shield).ObjectID; + Change(local_3c,REMAININGUSES,uVar7 - 1); + } + } + } +LAB_080c7009: + return local_20._2_2_; +} + + + +// DWARF original prototype: void ActivateLearning(TCombat * this) + +void __thiscall TCombat::ActivateLearning(TCombat *this) + +{ + this->LearningPoints = 0x1e; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__ZN7TCombatC2Ev(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +int GetSkillByName(char *Name) + +{ + int iVar1; + byte *pbVar2; + byte *pbVar3; + bool bVar4; + bool bVar5; + bool bVar6; + + iVar1 = 6; + bVar4 = &stack0xfffffffc < (undefined1 *)0xc; + bVar6 = &stack0x00000000 == (undefined1 *)0x10; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)0x80f09da; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar4 = *pbVar2 < *pbVar3; + bVar6 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar6); + iVar1 = 0; + bVar5 = (!bVar4 && !bVar6) < bVar4; + bVar4 = (!bVar4 && !bVar6) == bVar4; + if (!bVar4) { + iVar1 = 0xb; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"magiclevel"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 1; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 10; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"hitpoints"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 2; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 5; + pbVar2 = (byte *)Name; + pbVar3 = &DAT_081075e9; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 3; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 0xb; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"gostrength"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 4; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 0xe; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"carrystrength"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 5; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 10; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"shielding"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 6; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 0x11; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"distancefighting"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 7; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 0xe; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"swordfighting"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 8; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 0xd; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"clubfighting"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 9; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 0xc; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"axefighting"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 10; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 0xd; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"fistfighting"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0xb; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 0xd; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"magicdefense"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0xc; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 8; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"fishing"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0xd; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 7; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"eating"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0xe; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 8; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"shining"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0xf; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 9; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)0x81028c5; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x10; + bVar5 = (!bVar6 && !bVar4) < + bVar6; + bVar4 = (!bVar6 && !bVar4) == + bVar6; + if (!bVar4) { + iVar1 = 7; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)0x81028da; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < * + pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x11; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 8; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)0x81028d0; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x12; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 7; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)0x81028e3; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x13; + bVar6 = (!bVar5 && !bVar4) < bVar5; + bVar4 = (!bVar5 && !bVar4) == bVar5; + if (!bVar4) { + iVar1 = 8; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"drunken"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x14; + bVar5 = (!bVar6 && !bVar4) < bVar6; + bVar4 = (!bVar6 && !bVar4) == bVar6; + if (!bVar4) { + iVar1 = 0xb; + pbVar2 = (byte *)Name; + pbVar3 = (byte *)"manashield"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar5 = *pbVar2 < *pbVar3; + bVar4 = *pbVar2 == *pbVar3; + pbVar2 = pbVar2 + 1; + pbVar3 = pbVar3 + 1; + } while (bVar4); + iVar1 = 0x15; + bVar6 = (!bVar5 && !bVar4) < bVar5 + ; + bVar4 = (!bVar5 && !bVar4) == + bVar5; + if (!bVar4) { + iVar1 = 0xb; + pbVar2 = (byte *)"soulpoints"; + do { + if (iVar1 == 0) break; + iVar1 = iVar1 + -1; + bVar6 = (byte)*Name < + *pbVar2; + bVar4 = *Name == *pbVar2; + Name = (char *)((byte *) + Name + 1); + pbVar2 = pbVar2 + 1; + } while (bVar4); + iVar1 = 0x16; + if ((!bVar6 && !bVar4) != bVar6) { + iVar1 = -1; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return iVar1; +} + + + +// DWARF original prototype: void TSkillBase(TSkillBase * this) + +void __thiscall TSkillBase::TSkillBase(TSkillBase *this) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + this->Skills[iVar1] = (TSkill *)0x0; + this->TimerList[iVar1] = (TSkill *)0x0; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x1a); + this->FirstFreeTimer = 0; + return; +} + + + +// DWARF original prototype: void TSkillBase(TSkillBase * this) + +void __thiscall TSkillBase::TSkillBase(TSkillBase *this) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + this->Skills[iVar1] = (TSkill *)0x0; + this->TimerList[iVar1] = (TSkill *)0x0; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x1a); + this->FirstFreeTimer = 0; + return; +} + + + +// DWARF original prototype: void ~TSkillBase(TSkillBase * this, int __in_chrg) + +void __thiscall TSkillBase::~TSkillBase(TSkillBase *this,int __in_chrg) + +{ + TSkill *pTVar1; + int i; + int iVar2; + + iVar2 = 0; + do { + pTVar1 = this->Skills[iVar2]; + if (pTVar1 != (TSkill *)0x0) { + (*pTVar1->_vptr_TSkill[1])(pTVar1); + } + iVar2 = iVar2 + 1; + } while (iVar2 < 0x19); + return; +} + + + +// DWARF original prototype: void ~TSkillBase(TSkillBase * this, int __in_chrg) + +void __thiscall TSkillBase::~TSkillBase(TSkillBase *this,int __in_chrg) + +{ + TSkill *pTVar1; + int i; + int iVar2; + + iVar2 = 0; + do { + pTVar1 = this->Skills[iVar2]; + if (pTVar1 != (TSkill *)0x0) { + (*pTVar1->_vptr_TSkill[1])(pTVar1); + } + iVar2 = iVar2 + 1; + } while (iVar2 < 0x19); + return; +} + + + +// DWARF original prototype: void DelTimer(TSkillBase * this, ushort SkNr) + +void __thiscall TSkillBase::DelTimer(TSkillBase *this,ushort SkNr) + +{ + ushort uVar1; + TSkill *pTVar2; + int i; + int iVar3; + TSkill *sk; + + if (0x18 < SkNr) { + error("TSkillBase::DelTimer: Ungueltige SkNr: %d\n"); + return; + } + pTVar2 = this->Skills[SkNr]; + if (pTVar2 != (TSkill *)0x0) { + (*pTVar2->_vptr_TSkill[0xc])(pTVar2); + iVar3 = 0; + uVar1 = this->FirstFreeTimer; + if (uVar1 != 0) { + do { + if (this->TimerList[iVar3] == pTVar2) { + this->TimerList[iVar3] = this->Skills[uVar1 + 0x18]; + this->FirstFreeTimer = uVar1 - 1; + return; + } + iVar3 = iVar3 + 1; + } while (iVar3 < (int)(uint)uVar1); + } + } + return; +} + + + +// DWARF original prototype: bool SetTimer(TSkillBase * this, ushort SkNr, int cyc, int cou, int +// maxcou, int additionalvalue) + +bool __thiscall TSkillBase::SetTimer(TSkillBase *this) + +{ + ushort uVar1; + TSkill *pTVar2; + int iVar3; + bool bVar4; + TSkill *sk; + ushort in_stack_00000008; + undefined4 in_stack_0000000c; + undefined4 in_stack_00000010; + undefined4 in_stack_00000014; + undefined4 in_stack_00000018; + + if (in_stack_00000008 < 0x19) { + pTVar2 = this->Skills[in_stack_00000008]; + DelTimer(this,in_stack_00000008); + iVar3 = (*pTVar2->_vptr_TSkill[0xb]) + (pTVar2,in_stack_0000000c,in_stack_00000010,in_stack_00000014, + in_stack_00000018); + bVar4 = false; + if ((char)iVar3 != '\0') { + uVar1 = this->FirstFreeTimer; + bVar4 = true; + this->TimerList[uVar1] = pTVar2; + this->FirstFreeTimer = uVar1 + 1; + } + } + else { + error("TSkillBase::SetTimer: Ungueltige SkNr: %d\n",(uint)in_stack_00000008); + bVar4 = false; + } + return bVar4; +} + + + +// DWARF original prototype: void ProcessSkills(TSkillBase * this) + +void __thiscall TSkillBase::ProcessSkills(TSkillBase *this) + +{ + TSkill *pTVar1; + ushort uVar2; + int iVar3; + TSkill *sk; + int i; + int iVar4; + + iVar4 = 0; + uVar2 = this->FirstFreeTimer; + if (uVar2 != 0) { + do { + pTVar1 = this->TimerList[iVar4]; + if (pTVar1 == (TSkill *)0x0) { + iVar4 = iVar4 + 1; + } + else { + iVar3 = (*pTVar1->_vptr_TSkill[10])(pTVar1); + if ((char)iVar3 == '\0') { + uVar2 = this->FirstFreeTimer; + iVar4 = iVar4 + 1; + } + else { + uVar2 = this->FirstFreeTimer - 1; + this->FirstFreeTimer = uVar2; + this->TimerList[iVar4] = this->TimerList[uVar2]; + this->TimerList[uVar2] = (TSkill *)0x0; + } + } + } while (iVar4 < (int)(uint)uVar2); + } + return; +} + + + +// DWARF original prototype: bool NewSkill(TSkillBase * this, ushort SkillNo, TCreature * cr) + +bool __thiscall TSkillBase::NewSkill(TSkillBase *this,ushort SkillNo,TCreature *cr) + +{ + bool bVar1; + TSkill *pTVar2; + uint uVar3; + + uVar3 = (uint)SkillNo; + if (SkillNo < 0x19) { + pTVar2 = this->Skills[uVar3]; + if (pTVar2 != (TSkill *)0x0) { + (*pTVar2->_vptr_TSkill[1])(pTVar2); + this->Skills[uVar3] = (TSkill *)0x0; + } + switch(uVar3) { + case 0: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillLevel_08128268; + break; + case 1: + case 6: + case 7: + case 8: + case 9: + case 10: + case 0xb: + case 0xd: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillProbe_08128208; + break; + case 2: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillHitpoints_08127f08; + break; + case 3: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillMana_08127ea8; + break; + case 4: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillGoStrength_08127de8; + break; + case 5: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillCarryStrength_08127d88; + break; + default: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + break; + case 0xe: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillFed_08128028; + break; + case 0xf: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillLight_08127f68; + break; + case 0x10: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillIllusion_08127fc8; + break; + case 0x11: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillPoison_08128148; + break; + case 0x12: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillBurning_081280e8; + break; + case 0x13: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillEnergy_08128088; + break; + case 0x16: + pTVar2 = (TSkill *)operator_new(0x48); + pTVar2->Act = 0; + pTVar2->Max = 0x7fffffff; + pTVar2->Min = 0; + pTVar2->DAct = 0; + pTVar2->MDAct = 0; + pTVar2->FactorPercent = 1000; + pTVar2->LastLevel = 0; + pTVar2->NextLevel = 0x7fffffff; + pTVar2->Exp = 0; + pTVar2->Delta = 0x7fffffff; + pTVar2->Cycle = 0; + pTVar2->MaxCycle = 0; + pTVar2->Count = 0; + pTVar2->MaxCount = 0; + pTVar2->AddLevel = 0; + pTVar2->SkNr = SkillNo; + pTVar2->Master = cr; + pTVar2->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkillSoulpoints_08127e48; + } + this->Skills[uVar3] = pTVar2; + bVar1 = true; + } + else { + error("TSkillBase::NewSkill: unbekannte SkillNummer %d\n",uVar3); + bVar1 = false; + } + return bVar1; +} + + + +// DWARF original prototype: bool SetSkills(TSkillBase * this, int Race) + +bool __thiscall TSkillBase::SetSkills(TSkillBase *this,int Race) + +{ + TSkill *pTVar1; + bool bVar2; + TSkillData *S; + TSkillData *pTVar3; + TSkill *sk; + int i; + int iVar4; + int iVar5; + + if (Race - 1U < 0x1ff) { + if (0 < RaceData[Race].Skills) { + iVar4 = 1; + do { + iVar5 = iVar4 + 1; + pTVar3 = vector::operator()(&RaceData[Race].Skill,iVar4); + pTVar1 = this->Skills[pTVar3->Nr]; + pTVar1->Act = pTVar3->Actual; + pTVar1->Min = pTVar3->Minimum; + iVar4 = pTVar3->Maximum; + pTVar1->LastLevel = 0; + pTVar1->Max = iVar4; + pTVar1->NextLevel = pTVar3->NextLevel; + pTVar1->Delta = pTVar3->NextLevel; + pTVar1->FactorPercent = pTVar3->FactorPercent; + iVar4 = pTVar3->AddLevel; + pTVar1->MaxCount = 0; + pTVar1->AddLevel = iVar4; + iVar4 = iVar5; + } while (iVar5 <= RaceData[Race].Skills); + } + bVar2 = true; + } + else { + error(&DAT_081077c0,Race); + bVar2 = false; + } + return bVar2; +} + + + +// DWARF original prototype: void TSkill(TSkill * this, int nr, TCreature * cr) + +void __thiscall TSkill::TSkill(TSkill *this) + +{ + ushort in_stack_00000008; + TCreature *in_stack_0000000c; + + this->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + this->SkNr = in_stack_00000008; + this->Act = 0; + this->Max = 0x7fffffff; + this->Min = 0; + this->DAct = 0; + this->MDAct = 0; + this->FactorPercent = 1000; + this->LastLevel = 0; + this->NextLevel = 0x7fffffff; + this->Exp = 0; + this->Delta = 0x7fffffff; + this->Cycle = 0; + this->MaxCycle = 0; + this->Count = 0; + this->MaxCount = 0; + this->AddLevel = 0; + this->Master = in_stack_0000000c; + return; +} + + + +// DWARF original prototype: void TSkill(TSkill * this, int nr, TCreature * cr) + +void __thiscall TSkill::TSkill(TSkill *this) + +{ + ushort in_stack_00000008; + TCreature *in_stack_0000000c; + + this->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + this->SkNr = in_stack_00000008; + this->Act = 0; + this->Max = 0x7fffffff; + this->Min = 0; + this->DAct = 0; + this->MDAct = 0; + this->FactorPercent = 1000; + this->LastLevel = 0; + this->NextLevel = 0x7fffffff; + this->Exp = 0; + this->Delta = 0x7fffffff; + this->Cycle = 0; + this->MaxCycle = 0; + this->Count = 0; + this->MaxCount = 0; + this->AddLevel = 0; + this->Master = in_stack_0000000c; + return; +} + + + +// DWARF original prototype: void ~TSkill(TSkill * this, int __in_chrg) + +void __thiscall TSkill::~TSkill(TSkill *this,int __in_chrg) + +{ + this->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (this->Master != (TCreature *)0x0) { + TSkillBase::DelTimer(&this->Master->super_TSkillBase,this->SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkill(TSkill * this, int __in_chrg) + +void __thiscall TSkill::~TSkill(TSkill *this,int __in_chrg) + +{ + this->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (this->Master != (TCreature *)0x0) { + TSkillBase::DelTimer(&this->Master->super_TSkillBase,this->SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkill(TSkill * this, int __in_chrg) + +void __thiscall TSkill::~TSkill(TSkill *this,int __in_chrg) + +{ + this->_vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (this->Master != (TCreature *)0x0) { + TSkillBase::DelTimer(&this->Master->super_TSkillBase,this->SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void Reset(TSkill * this) + +void __thiscall TSkill::Reset(TSkill *this) + +{ + this->Act = 0; + this->Max = 0x7fffffff; + this->Min = 0; + this->DAct = 0; + this->MDAct = 0; + this->FactorPercent = 1000; + this->LastLevel = 0; + this->NextLevel = 0x7fffffff; + this->Exp = 0; + this->Delta = 0x7fffffff; + this->Cycle = 0; + this->MaxCycle = 0; + this->Count = 0; + this->MaxCount = 0; + this->AddLevel = 0; + return; +} + + + +// DWARF original prototype: void Load(TSkill * this, int act, int max, int min, int dact, int +// mdact, int cyc, int maxcyc, int cnt, int maxcnt, int addlvl, int exp, int fp, int nextlvl, int +// delta) + +void __thiscall TSkill::Load(TSkill *this) + +{ + ushort uVar1; + TCreature *pTVar2; + int iVar3; + int iVar4; + int iVar5; + TSkill *pTVar6; + int iVar7; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + int in_stack_00000018; + int in_stack_0000001c; + int in_stack_00000020; + int in_stack_00000024; + int in_stack_00000028; + int in_stack_0000002c; + int in_stack_00000030; + int in_stack_00000034; + int in_stack_00000038; + int in_stack_0000003c; + + this->Max = in_stack_0000000c; + this->Act = in_stack_00000008; + this->Min = in_stack_00000010; + this->DAct = in_stack_00000014; + this->MDAct = in_stack_00000018; + this->Cycle = in_stack_0000001c; + this->MaxCycle = in_stack_00000020; + this->Count = in_stack_00000024; + this->MaxCount = in_stack_00000028; + this->AddLevel = in_stack_0000002c; + this->Exp = in_stack_00000030; + this->FactorPercent = in_stack_00000034; + this->NextLevel = in_stack_00000038; + this->Delta = in_stack_0000003c; + iVar7 = (*this->_vptr_TSkill[5])(this); + this->LastLevel = iVar7; + pTVar2 = this->Master; + if ((pTVar2 != (TCreature *)0x0) && (iVar7 = this->Cycle, iVar7 != 0)) { + iVar3 = this->Count; + uVar1 = this->SkNr; + iVar4 = this->MaxCount; + iVar5 = this->FactorPercent; + if (uVar1 < 0x19) { + pTVar6 = (pTVar2->super_TSkillBase).Skills[uVar1]; + TSkillBase::DelTimer(&pTVar2->super_TSkillBase,uVar1); + iVar7 = (*pTVar6->_vptr_TSkill[0xb])(pTVar6,iVar7,iVar3,iVar4,iVar5); + if ((char)iVar7 != '\0') { + uVar1 = (pTVar2->super_TSkillBase).FirstFreeTimer; + (pTVar2->super_TSkillBase).TimerList[uVar1] = pTVar6; + (pTVar2->super_TSkillBase).FirstFreeTimer = uVar1 + 1; + } + } + else { + error("TSkillBase::SetTimer: Ungueltige SkNr: %d\n",(uint)uVar1); + } + } + return; +} + + + +// DWARF original prototype: void Save(TSkill * this, int * act, int * max, int * min, int * dact, +// int * mdact, int * cyc, int * maxcyc, int * cnt, int * maxcnt, int * addlvl, int * exp, int * fp, +// int * nextlvl, int * delta) + +void __thiscall TSkill::Save(TSkill *this) + +{ + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + int *in_stack_00000014; + int *in_stack_00000018; + int *in_stack_0000001c; + int *in_stack_00000020; + int *in_stack_00000024; + int *in_stack_00000028; + int *in_stack_0000002c; + int *in_stack_00000030; + int *in_stack_00000034; + int *in_stack_00000038; + int *in_stack_0000003c; + + *in_stack_00000008 = this->Act; + *in_stack_0000000c = this->Max; + *in_stack_00000010 = this->Min; + *in_stack_00000014 = this->DAct; + *in_stack_00000018 = this->MDAct; + *in_stack_0000001c = this->Cycle; + *in_stack_00000020 = this->MaxCycle; + *in_stack_00000024 = this->Count; + *in_stack_00000028 = this->MaxCount; + *in_stack_0000002c = this->AddLevel; + *in_stack_00000030 = this->Exp; + *in_stack_00000034 = this->FactorPercent; + *in_stack_00000038 = this->NextLevel; + *in_stack_0000003c = this->Delta; + return; +} + + + +// DWARF original prototype: void Event(TSkill * this, int param_1) + +void __thiscall TSkill::Event(TSkill *this,int param_1) + +{ + return; +} + + + +// DWARF original prototype: bool Jump(TSkill * this, int param_1) + +bool __thiscall TSkill::Jump(TSkill *this,int param_1) + +{ + return true; +} + + + +// DWARF original prototype: int Get(TSkill * this) + +int __thiscall TSkill::Get(TSkill *this) + +{ + int a; + int iVar1; + + iVar1 = this->Act; + if (this->Act < this->Min) { + iVar1 = this->Min; + } + return iVar1 + this->MDAct + this->DAct; +} + + + +// DWARF original prototype: int GetProgress(TSkill * this) + +int __thiscall TSkill::GetProgress(TSkill *this) + +{ + int iVar1; + int iVar2; + bool bVar3; + int Percent; + int iVar4; + uint uVar5; + char *pcVar6; + int iVar7; + + iVar7 = this->NextLevel; + iVar1 = this->LastLevel; + iVar4 = 0; + if (iVar1 < iVar7) { + iVar2 = this->Exp; + uVar5 = iVar2 - iVar1; + iVar4 = (((int)uVar5 >> 0x1f) << 2 | uVar5 >> 0x1e) + ((int)uVar5 >> 0x1f) + + (uint)CARRY4(uVar5 * 4,uVar5); + bVar3 = false; + iVar4 = __divdi3(uVar5 * 100, + ((iVar4 * 4 | uVar5 * 5 >> 0x1e) + iVar4 + + (uint)CARRY4(uVar5 * 0x14,uVar5 * 5)) * 4 | uVar5 * 0x19 >> 0x1e, + iVar7 - iVar1,iVar7 - iVar1 >> 0x1f); + if ((-1 < iVar4) && (iVar4 < 100)) { + bVar3 = true; + } + if (!bVar3) { + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n", + iVar2,iVar1,iVar7,iVar4); + pcVar6 = "(Unknown"; + if (this->Master != (TCreature *)0x0) { + pcVar6 = this->Master->Name; + } + error("# Spieler %s - Skill %d\n",pcVar6,(uint)this->SkNr,iVar7,iVar4); + iVar4 = 0; + } + } + return iVar4; +} + + + +// DWARF original prototype: void SetMDAct(TSkill * this, int value) + +void __thiscall TSkill::SetMDAct(TSkill *this,int value) + +{ + TPlayer *this_00; + + this->MDAct = value; + if (((this->SkNr == 4) && (this_00 = (TPlayer *)this->Master, this_00 != (TPlayer *)0x0)) && + ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + return; + } + return; +} + + + +// DWARF original prototype: void Set(TSkill * this, int a) + +void __thiscall TSkill::Set(TSkill *this,int a) + +{ + this->Act = a; + if (this->Max < a) { + this->Act = this->Max; + } + return; +} + + + +// DWARF original prototype: void Change(TSkill * this, int a) + +void __thiscall TSkill::Change(TSkill *this,int a) + +{ + (*this->_vptr_TSkill[2])(this,this->Act + a); + if (this->Max < this->Act) { + this->Act = this->Max; + } + return; +} + + + +// DWARF original prototype: void Check(TSkill * this) + +void __thiscall TSkill::Check(TSkill *this) + +{ + if (this->Max < this->Act) { + this->Act = this->Max; + } + return; +} + + + +// DWARF original prototype: bool Process(TSkill * this) + +bool __thiscall TSkill::Process(TSkill *this) + +{ + int iVar1; + int iVar2; + TPlayer *this_00; + bool bVar3; + int Range; + + iVar2 = this->Cycle; + if (iVar2 == 0) { + this_00 = (TPlayer *)this->Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + bVar3 = true; + } + else { + if (this->Count < 1) { + this->Count = this->MaxCount; + iVar1 = (uint)(iVar2 < 1) * 2 + -1; + this->Cycle = iVar2 + iVar1; + (*this->_vptr_TSkill[0xf])(this,iVar1); + } + else { + this->Count = this->Count + -1; + } + bVar3 = false; + } + return bVar3; +} + + + +// DWARF original prototype: bool SetTimer(TSkill * this, int cyc, int cou, int maxcou, int param_4) + +bool __thiscall TSkill::SetTimer(TSkill *this) + +{ + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + this->Cycle = in_stack_00000008; + this->Count = in_stack_0000000c; + this->MaxCount = in_stack_00000010; + this_00 = (TPlayer *)this->Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + return true; +} + + + +// DWARF original prototype: bool DelTimer(TSkill * this) + +bool __thiscall TSkill::DelTimer(TSkill *this) + +{ + TPlayer *this_00; + + this->Cycle = 0; + this->Count = 0; + this->MaxCount = 0; + this_00 = (TPlayer *)this->Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + return true; +} + + + +// DWARF original prototype: int GetExpForLevel(TSkillLevel * this, int Level) + +int __thiscall TSkillLevel::GetExpForLevel(TSkillLevel *this,int Level) + +{ + int iVar1; + char *Text; + + if (Level < 1) { + Text = &DAT_08107900; + } + else { + iVar1 = (this->super_TSkill).Delta; + if (0 < iVar1) { + if (Level < 0x1f5) { + return ((((Level + -6) * Level + 0x11) * Level + -0xc) / 6) * iVar1; + } + error(&DAT_08107860,Level); + return -1; + } + Text = &DAT_081078c0; + Level = iVar1; + } + error(Text,Level); + return 0; +} + + + +// DWARF original prototype: void Increase(TSkillLevel * this, int Amount) + +void __thiscall TSkillLevel::Increase(TSkillLevel *this,int Amount) + +{ + TCreature *pTVar1; + int iVar2; + int Range; + int iVar3; + + if (Amount < 0) { + error("TSkillLevel::Increase: Amount negativ (%d).\n"); + return; + } + iVar3 = 0; + iVar2 = Amount + (this->super_TSkill).Exp; + (this->super_TSkill).Exp = iVar2; + if ((this->super_TSkill).NextLevel <= iVar2) { + do { + iVar2 = (this->super_TSkill).Act; + (this->super_TSkill).Act = iVar2 + 1; + iVar2 = (*(this->super_TSkill)._vptr_TSkill[5])(this,iVar2 + 2); + (this->super_TSkill).NextLevel = iVar2; + iVar2 = (*(this->super_TSkill)._vptr_TSkill[5])(this,(this->super_TSkill).Act); + (this->super_TSkill).LastLevel = iVar2; + iVar2 = (this->super_TSkill).NextLevel; + if (iVar2 < 0) { + error(&DAT_08107980,((this->super_TSkill).Master)->Name, + (uint)(this->super_TSkill).SkNr); + iVar2 = (this->super_TSkill).Exp; + (this->super_TSkill).NextLevel = iVar2; + (this->super_TSkill).Exp = iVar2 + -1000000; + break; + } + iVar3 = iVar3 + 1; + } while (iVar2 <= (this->super_TSkill).Exp); + } + if (iVar3 != 0) { + (*(this->super_TSkill)._vptr_TSkill[0xe])(this,iVar3); + } + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 == (TCreature *)0x0) { + error("TSkillLevel::Increase: GetMaster liefert NULL zurueck.\n"); + return; + } + if (pTVar1->Type == PLAYER) { + SendPlayerData(pTVar1->Connection); + return; + } + return; +} + + + +// DWARF original prototype: void Decrease(TSkillLevel * this, int Amount) + +void __thiscall TSkillLevel::Decrease(TSkillLevel *this,int Amount) + +{ + TCreature *pTVar1; + TCreature *cr; + int iVar2; + int Range; + int iVar3; + + if (Amount < 0) { + this = (TSkillLevel *)s_TSkillLevel__Decrease__Amount_ne_08107a80; + } + else { + iVar2 = (this->super_TSkill).Exp; + if ((Amount <= iVar2) || (iVar2 < 0x186a1)) { + iVar3 = 0; + if (Amount < iVar2) { + (this->super_TSkill).Exp = iVar2 - Amount; + } + else { + (this->super_TSkill).Exp = 0; + iVar3 = 0; + } + while( true ) { + iVar2 = (*(this->super_TSkill)._vptr_TSkill[5])(this,(this->super_TSkill).Act); + if (iVar2 <= (this->super_TSkill).Exp) break; + (this->super_TSkill).NextLevel = iVar2; + iVar3 = iVar3 + -1; + iVar2 = (this->super_TSkill).Act + -1; + (this->super_TSkill).Act = iVar2; + iVar2 = (*(this->super_TSkill)._vptr_TSkill[5])(this,iVar2); + (this->super_TSkill).LastLevel = iVar2; + } + if (iVar3 != 0) { + (*(this->super_TSkill)._vptr_TSkill[0xe])(this,iVar3); + } + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 != (TCreature *)0x0) { + if (pTVar1->Type != PLAYER) { + return; + } + SendPlayerData(pTVar1->Connection); + return; + } + error("TSkillLevel::Decrease: GetMaster liefert NULL zurueck.\n"); + return; + } + this = (TSkillLevel *)s_TSkillLevel__Decrease__Amount_zu_08107a40; + } + error((char *)this); + return; +} + + + +// DWARF original prototype: bool Jump(TSkillLevel * this, int Range) + +bool __thiscall TSkillLevel::Jump(TSkillLevel *this,int Range) + +{ + TCreature *pTVar1; + TSkill *pTVar2; + int iVar3; + int a; + int iVar4; + int iVar5; + TSkill *sk; + TConnection *Connection; + TCreature *cr; + int iVar6; + char *Text; + + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 == (TCreature *)0x0) { + error("TSkillLevel::Jump: GetMaster liefert NULL zurueck!\n"); + return false; + } + pTVar2 = (pTVar1->super_TSkillBase).Skills[2]; + (*pTVar2->_vptr_TSkill[6])(pTVar2,Range); + pTVar2 = (pTVar1->super_TSkillBase).Skills[3]; + (*pTVar2->_vptr_TSkill[6])(pTVar2,Range); + pTVar2 = (pTVar1->super_TSkillBase).Skills[5]; + (*pTVar2->_vptr_TSkill[6])(pTVar2,Range); + pTVar2 = (pTVar1->super_TSkillBase).Skills[4]; + (*pTVar2->_vptr_TSkill[6])(pTVar2,Range); + AnnounceChangedCreature(pTVar1->ID,4); + TCombat::CheckCombatValues(&pTVar1->Combat); + iVar3 = (this->super_TSkill).Act; + iVar5 = (this->super_TSkill).Min; + iVar4 = iVar5; + if (iVar5 <= iVar3) { + iVar4 = iVar3; + } + iVar6 = (this->super_TSkill).MDAct + (this->super_TSkill).DAct; + if (Range < 1) { + if (pTVar1->Type != PLAYER) { + return true; + } + Connection = pTVar1->Connection; + Text = "You were downgraded from Level %d to Level %d."; + if (iVar5 <= iVar3) { + iVar5 = iVar3; + } + } + else { + if (pTVar1->Type != PLAYER) { + return true; + } + Connection = pTVar1->Connection; + Text = "You advanced from Level %d to Level %d."; + if (iVar5 <= iVar3) { + iVar5 = iVar3; + } + } + SendMessage(Connection,0x13,Text,(iVar6 + iVar4) - Range,iVar5 + iVar6); + return true; +} + + + +// DWARF original prototype: bool SetTimer(TSkillProbe * this, int cyc, int cou, int maxcou, int +// param_4) + +bool __thiscall TSkillProbe::SetTimer(TSkillProbe *this) + +{ + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + (this->super_TSkill).Cycle = in_stack_00000008; + (this->super_TSkill).Count = in_stack_0000000c; + (this->super_TSkill).MaxCount = in_stack_00000010; + this_00 = (TPlayer *)(this->super_TSkill).Master; + if (this_00 != (TPlayer *)0x0) { + if ((this_00->super_TCreature).Type == PLAYER) { + TPlayer::CheckState(this_00); + this_00 = (TPlayer *)(this->super_TSkill).Master; + } + if (this_00 != (TPlayer *)0x0) { + if ((this_00->super_TCreature).Type == PLAYER) { + SendPlayerData((this_00->super_TCreature).Connection); + } + return true; + } + } + error("TSkillProbe::SetTimer: GetMaster liefert NULL zurueck!\n"); + return false; +} + + + +// DWARF original prototype: void Event(TSkillProbe * this, int param_1) + +void __thiscall TSkillProbe::Event(TSkillProbe *this,int param_1) + +{ + TPlayer *this_00; + TCreature *cr; + + if ((this->super_TSkill).Cycle == 0) { + this_00 = (TPlayer *)(this->super_TSkill).Master; + if (this_00 == (TPlayer *)0x0) { + error("TSkillProbe::Event: GetMaster liefert NULL zurueck!\n"); + return; + } + (this->super_TSkill).MDAct = 0; + if ((this->super_TSkill).SkNr == 4) { + if ((this_00->super_TCreature).Type != PLAYER) { + return; + } + TPlayer::CheckState(this_00); + } + if ((this_00->super_TCreature).Type == PLAYER) { + SendPlayerSkills((this_00->super_TCreature).Connection); + return; + } + } + return; +} + + + +// DWARF original prototype: bool Jump(TSkillProbe * this, int Range) + +bool __thiscall TSkillProbe::Jump(TSkillProbe *this,int Range) + +{ + TCreature *pTVar1; + int iVar2; + TConnection *Connection; + int a; + int iVar3; + TCreature *cr; + char *Text; + + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 == (TCreature *)0x0) { + error("TSkillProbe::Jump: GetMaster liefert NULL zurueck!\n"); + return false; + } + if (pTVar1->Type != PLAYER) { + return true; + } + if ((this->super_TSkill).SkNr == 1) { + SendPlayerData(pTVar1->Connection); + } + else { + SendPlayerSkills(pTVar1->Connection); + } + if (Range < 0) { + return true; + } + switch((this->super_TSkill).SkNr) { + default: + goto LAB_080c8c45; + case 1: + iVar2 = (this->super_TSkill).Min; + iVar3 = (this->super_TSkill).Act; + if (iVar3 < iVar2) { + iVar3 = iVar2; + } + SendMessage(pTVar1->Connection,0x13,"You advanced to magic level %d.", + iVar3 + (this->super_TSkill).MDAct + (this->super_TSkill).DAct); + return true; + case 6: + Connection = pTVar1->Connection; + Text = "You advanced in shielding."; + break; + case 7: + Connection = pTVar1->Connection; + Text = "You advanced in distance fighting."; + break; + case 8: + Connection = pTVar1->Connection; + Text = "You advanced in sword fighting."; + break; + case 9: + Connection = pTVar1->Connection; + Text = "You advanced in club fighting."; + break; + case 10: + Connection = pTVar1->Connection; + Text = "You advanced in axe fighting."; + break; + case 0xb: + Connection = pTVar1->Connection; + Text = "You advanced in fist fighting."; + break; + case 0xd: + Connection = pTVar1->Connection; + Text = "You advanced in fishing."; + } + SendMessage(Connection,0x13,Text); +LAB_080c8c45: + return true; +} + + + +// DWARF original prototype: int GetExpForLevel(TSkillProbe * this, int Level) + +int __thiscall TSkillProbe::GetExpForLevel(TSkillProbe *this,int Level) + +{ + double __x; + uint __n; + int iVar1; + longdouble __value; + double dVar2; + char *Text; + double FP; + ushort __cwtmp; + ushort __cw; + + if ((Level < 0) || (Level < (this->super_TSkill).Min)) { + Text = &DAT_08107d00; + } + else { + if (0 < (this->super_TSkill).Delta) { + iVar1 = (this->super_TSkill).FactorPercent; + if (iVar1 < 1000) { + error(&DAT_08107da0); + iVar1 = (this->super_TSkill).FactorPercent; + } + if (iVar1 - 0x3e9U < 0x31) { + error(&DAT_08107d40); + iVar1 = (this->super_TSkill).FactorPercent; + } + if (iVar1 < 0x41a) { + return (Level - (this->super_TSkill).Min) * (this->super_TSkill).Delta; + } + __x = (double)iVar1 / 1000.0; + __n = Level - (this->super_TSkill).Min; + if ((int)__n < 0) { + dVar2 = __cmath_power(__x,-__n); + dVar2 = 1.0 / dVar2; + } + else { + dVar2 = __cmath_power(__x,__n); + } + return (int)ROUND(ROUND((double)(this->super_TSkill).Delta * + ((dVar2 - 1.0) / (__x - 1.0)))); + } + Text = &DAT_08107e00; + } + error(Text); + return 0; +} + + + +// WARNING: Variable defined which should be unmapped: Amount_local +// DWARF original prototype: void Increase(TSkillProbe * this, int Amount) + +void __thiscall TSkillProbe::Increase(TSkillProbe *this,int Amount) + +{ + TCreature *pTVar1; + int iVar2; + TCreature *pTVar3; + bool bVar4; + int iVar5; + uint uVar6; + char *pcVar7; + int iVar8; + int Percent; + int iVar9; + int local_3c; + int local_38; + TCreature *cr; + int local_1c; + int local_18; + int Range; + int Amount_local; + + if (Amount < 0) { + error("TSkillProbe::Increase: Amount negativ (%d).\n"); + return; + } + local_18 = 0; + local_38 = (this->super_TSkill).NextLevel; + iVar8 = (this->super_TSkill).LastLevel; + if (iVar8 < local_38) { + local_3c = (this->super_TSkill).Exp; + uVar6 = local_3c - iVar8; + iVar9 = (((int)uVar6 >> 0x1f) << 2 | uVar6 >> 0x1e) + ((int)uVar6 >> 0x1f) + + (uint)CARRY4(uVar6 * 4,uVar6); + bVar4 = false; + local_1c = __divdi3(uVar6 * 100, + ((iVar9 * 4 | uVar6 * 5 >> 0x1e) + iVar9 + + (uint)CARRY4(uVar6 * 0x14,uVar6 * 5)) * 4 | uVar6 * 0x19 >> 0x1e, + local_38 - iVar8,local_38 - iVar8 >> 0x1f); + if ((-1 < local_1c) && (bVar4 = true, 99 < local_1c)) { + bVar4 = false; + } + if (bVar4) goto LAB_080c8eaf; + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n", + local_3c,iVar8,local_38,local_1c); + pTVar1 = (this->super_TSkill).Master; + pcVar7 = "(Unknown"; + if (pTVar1 != (TCreature *)0x0) { + pcVar7 = pTVar1->Name; + } + error("# Spieler %s - Skill %d\n",pcVar7,(uint)(this->super_TSkill).SkNr,local_38,local_1c); + local_38 = (this->super_TSkill).NextLevel; + } + local_1c = 0; + local_3c = (this->super_TSkill).Exp; +LAB_080c8eaf: + (this->super_TSkill).Exp = local_3c + Amount; + if (local_38 <= local_3c + Amount) { + do { + iVar8 = (this->super_TSkill).Act; + (this->super_TSkill).Act = iVar8 + 1; + iVar8 = (*(this->super_TSkill)._vptr_TSkill[5])(this,iVar8 + 2); + (this->super_TSkill).NextLevel = iVar8; + iVar8 = (*(this->super_TSkill)._vptr_TSkill[5])(this,(this->super_TSkill).Act); + (this->super_TSkill).LastLevel = iVar8; + iVar8 = (this->super_TSkill).NextLevel; + if (iVar8 < 0) { + error(&DAT_08107e40,((this->super_TSkill).Master)->Name, + (uint)(this->super_TSkill).SkNr); + iVar8 = (this->super_TSkill).Exp; + (this->super_TSkill).NextLevel = iVar8; + (this->super_TSkill).Exp = iVar8 + -1000; + break; + } + local_18 = local_18 + 1; + } while (iVar8 <= (this->super_TSkill).Exp); + } + if (local_18 == 0) { + pTVar1 = (this->super_TSkill).Master; + if ((pTVar1 != (TCreature *)0x0) && (pTVar1->Type == PLAYER)) { + iVar8 = (this->super_TSkill).NextLevel; + iVar5 = 0; + iVar9 = (this->super_TSkill).LastLevel; + if (iVar9 < iVar8) { + iVar2 = (this->super_TSkill).Exp; + uVar6 = iVar2 - iVar9; + iVar5 = (((int)uVar6 >> 0x1f) << 2 | uVar6 >> 0x1e) + ((int)uVar6 >> 0x1f) + + (uint)CARRY4(uVar6 * 4,uVar6); + bVar4 = false; + iVar5 = __divdi3(uVar6 * 100, + ((iVar5 * 4 | uVar6 * 5 >> 0x1e) + iVar5 + + (uint)CARRY4(uVar6 * 0x14,uVar6 * 5)) * 4 | uVar6 * 0x19 >> 0x1e, + iVar8 - iVar9,iVar8 - iVar9 >> 0x1f); + if ((-1 < iVar5) && (bVar4 = true, 99 < iVar5)) { + bVar4 = false; + } + if (!bVar4) { + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n" + ,iVar2,iVar9,iVar8,iVar5); + pTVar3 = (this->super_TSkill).Master; + pcVar7 = "(Unknown"; + if (pTVar3 != (TCreature *)0x0) { + pcVar7 = pTVar3->Name; + } + error("# Spieler %s - Skill %d\n",pcVar7,(uint)(this->super_TSkill).SkNr,iVar8, + iVar5); + iVar5 = 0; + } + } + if (iVar5 != local_1c) { + if ((this->super_TSkill).SkNr == 1) { + SendPlayerData(pTVar1->Connection); + return; + } + SendPlayerSkills(pTVar1->Connection); + return; + } + } + } + else { + (*(this->super_TSkill)._vptr_TSkill[0xe])(this,local_18); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Amount_local +// DWARF original prototype: void Decrease(TSkillProbe * this, int Amount) + +void __thiscall TSkillProbe::Decrease(TSkillProbe *this,int Amount) + +{ + TCreature *pTVar1; + TCreature *pTVar2; + bool bVar3; + int PreviousLevel; + uint uVar4; + int iVar5; + char *pcVar6; + int iVar7; + int Percent; + int iVar8; + int iVar9; + TCreature *cr; + int local_1c; + int local_18; + int Range; + int Amount_local; + + if (Amount < 0) { + error("TSkillProbe::Decrease: Amount negativ (%d).\n"); + return; + } + local_18 = 0; + iVar7 = (this->super_TSkill).NextLevel; + iVar8 = (this->super_TSkill).LastLevel; + if (iVar8 < iVar7) { + iVar5 = (this->super_TSkill).Exp; + uVar4 = iVar5 - iVar8; + iVar9 = (((int)uVar4 >> 0x1f) << 2 | uVar4 >> 0x1e) + ((int)uVar4 >> 0x1f) + + (uint)CARRY4(uVar4 * 4,uVar4); + bVar3 = false; + local_1c = __divdi3(uVar4 * 100, + ((iVar9 * 4 | uVar4 * 5 >> 0x1e) + iVar9 + + (uint)CARRY4(uVar4 * 0x14,uVar4 * 5)) * 4 | uVar4 * 0x19 >> 0x1e, + iVar7 - iVar8,iVar7 - iVar8 >> 0x1f); + if ((-1 < local_1c) && (bVar3 = true, 99 < local_1c)) { + bVar3 = false; + } + if (bVar3) goto LAB_080c922c; + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n",iVar5 + ,iVar8,iVar7,local_1c); + pTVar1 = (this->super_TSkill).Master; + pcVar6 = "(Unknown"; + if (pTVar1 != (TCreature *)0x0) { + pcVar6 = pTVar1->Name; + } + error("# Spieler %s - Skill %d\n",pcVar6,(uint)(this->super_TSkill).SkNr,iVar7,local_1c); + } + local_1c = 0; + iVar5 = (this->super_TSkill).Exp; +LAB_080c922c: + if (Amount < iVar5) { + (this->super_TSkill).Exp = iVar5 - Amount; + } + else { + (this->super_TSkill).Exp = 0; + } + iVar7 = (this->super_TSkill).Act; + if ((this->super_TSkill).Min < iVar7) { + do { + iVar7 = (*(this->super_TSkill)._vptr_TSkill[5])(this,iVar7); + if (iVar7 <= (this->super_TSkill).Exp) break; + iVar8 = (this->super_TSkill).Act + -1; + (this->super_TSkill).Act = iVar8; + local_18 = local_18 + -1; + (this->super_TSkill).NextLevel = iVar7; + iVar8 = (*(this->super_TSkill)._vptr_TSkill[5])(this,iVar8); + iVar7 = (this->super_TSkill).Act; + (this->super_TSkill).LastLevel = iVar8; + } while ((this->super_TSkill).Min < iVar7); + } + if (local_18 == 0) { + pTVar1 = (this->super_TSkill).Master; + if ((pTVar1 != (TCreature *)0x0) && (pTVar1->Type == PLAYER)) { + iVar7 = (this->super_TSkill).NextLevel; + iVar5 = 0; + iVar8 = (this->super_TSkill).LastLevel; + if (iVar8 < iVar7) { + iVar9 = (this->super_TSkill).Exp; + uVar4 = iVar9 - iVar8; + iVar5 = (((int)uVar4 >> 0x1f) << 2 | uVar4 >> 0x1e) + ((int)uVar4 >> 0x1f) + + (uint)CARRY4(uVar4 * 4,uVar4); + bVar3 = false; + iVar5 = __divdi3(uVar4 * 100, + ((iVar5 * 4 | uVar4 * 5 >> 0x1e) + iVar5 + + (uint)CARRY4(uVar4 * 0x14,uVar4 * 5)) * 4 | uVar4 * 0x19 >> 0x1e, + iVar7 - iVar8,iVar7 - iVar8 >> 0x1f); + if ((-1 < iVar5) && (bVar3 = true, 99 < iVar5)) { + bVar3 = false; + } + if (!bVar3) { + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n" + ,iVar9,iVar8,iVar7,iVar5); + pTVar2 = (this->super_TSkill).Master; + pcVar6 = "(Unknown"; + if (pTVar2 != (TCreature *)0x0) { + pcVar6 = pTVar2->Name; + } + error("# Spieler %s - Skill %d\n",pcVar6,(uint)(this->super_TSkill).SkNr,iVar7, + iVar5); + iVar5 = 0; + } + } + if (iVar5 != local_1c) { + if ((this->super_TSkill).SkNr == 1) { + SendPlayerData(pTVar1->Connection); + return; + } + SendPlayerSkills(pTVar1->Connection); + return; + } + } + } + else { + (*(this->super_TSkill)._vptr_TSkill[0xe])(this,local_18); + } + return; +} + + + +// DWARF original prototype: bool Probe(TSkillProbe * this, int Diff, int Prob, bool _Increase) + +bool __thiscall TSkillProbe::Probe(TSkillProbe *this,int Diff,int Prob,bool _Increase) + +{ + bool bVar1; + int iVar2; + int Result; + + if (_Increase) { + (*(this->super_TSkill)._vptr_TSkill[3])(this,1); + } + bVar1 = true; + if (Diff != 0) { + iVar2 = rand(); + if ((this->super_TSkill).Act < iVar2 % Diff) { + bVar1 = false; + } + else { + iVar2 = rand(); + bVar1 = iVar2 % 100 <= Prob; + } + } + return bVar1; +} + + + +// DWARF original prototype: int ProbeValue(TSkillProbe * this, int max, bool _Increase) + +int __thiscall TSkillProbe::ProbeValue(TSkillProbe *this,int max,bool _Increase) + +{ + int iVar1; + int iVar2; + int a; + int iVar3; + int iVar4; + int iVar5; + int Result; + undefined8 local_1c; + int iStack_18; + + if (_Increase) { + (*(this->super_TSkill)._vptr_TSkill[3])(this,1); + } + iVar4 = (this->super_TSkill).Min; + iVar3 = (this->super_TSkill).Act; + iVar1 = (this->super_TSkill).DAct; + iVar2 = (this->super_TSkill).MDAct; + if (iVar3 < iVar4) { + iVar3 = iVar4; + } + iVar4 = rand(); + iVar5 = rand(); + return (((iVar5 % 100 + iVar4 + ((iStack_18 >> 5) - (iVar4 >> 0x1f)) * -100) / 2) * + max * ((iVar3 + iVar2 + iVar1) * 5 + 0x32)) / 10000; +} + + + +// DWARF original prototype: void ChangeSkill(TSkillProbe * this, int fp, int delta) + +void __thiscall TSkillProbe::ChangeSkill(TSkillProbe *this,int fp,int delta) + +{ + int iVar1; + int iVar2; + TCreature *pTVar3; + double __x; + uint uVar4; + TCreature *cr; + double ExpNecessary; + longdouble __value; + double dVar5; + double FP; + double Progress; + ushort __cwtmp; + ushort __cw; + + stack0xffffffc4 = 0.0; + iVar1 = (this->super_TSkill).NextLevel; + iVar2 = (this->super_TSkill).LastLevel; + if (iVar2 < iVar1) { + unique0x100000a4 = (double)((this->super_TSkill).Exp - iVar2) / (double)(iVar1 - iVar2); + } + (this->super_TSkill).FactorPercent = fp; + (this->super_TSkill).Delta = delta; + __x = (double)fp / 1000.0; + uVar4 = ((this->super_TSkill).Act - (this->super_TSkill).Min) + 1; + if ((int)uVar4 < 0) { + dVar5 = __cmath_power(__x,-uVar4); + dVar5 = 1.0 / dVar5; + } + else { + dVar5 = __cmath_power(__x,uVar4); + } + uVar4 = (this->super_TSkill).Act - (this->super_TSkill).Min; + (this->super_TSkill).NextLevel = + (int)ROUND(ROUND(((dVar5 - 1.0) / (__x - 1.0)) * (double)delta)); + if ((int)uVar4 < 0) { + dVar5 = __cmath_power(__x,-uVar4); + dVar5 = 1.0 / dVar5; + } + else { + dVar5 = __cmath_power(__x,uVar4); + } + iVar1 = (int)ROUND(ROUND(((dVar5 - 1.0) / (__x - 1.0)) * (double)delta)); + (this->super_TSkill).LastLevel = iVar1; + pTVar3 = (this->super_TSkill).Master; + (this->super_TSkill).Exp = + (int)ROUND(ROUND((double)((this->super_TSkill).NextLevel - iVar1) * stack0xffffffc4)) + + (this->super_TSkill).LastLevel; + if ((pTVar3 != (TCreature *)0x0) && (pTVar3->Type == PLAYER)) { + if ((this->super_TSkill).SkNr == 1) { + SendPlayerData(pTVar3->Connection); + } + else { + SendPlayerSkills(pTVar3->Connection); + } + } + return; +} + + + +// DWARF original prototype: void Advance(TSkillAdd * this, int Range) + +void __thiscall TSkillAdd::Advance(TSkillAdd *this,int Range) + +{ + int iVar1; + int iVar2; + + iVar2 = (this->super_TSkill).AddLevel * Range; + iVar1 = (this->super_TSkill).Max + iVar2; + iVar2 = iVar2 + (this->super_TSkill).Act; + (this->super_TSkill).Max = iVar1; + if (iVar2 <= iVar1) { + iVar1 = iVar2; + } + (this->super_TSkill).Act = iVar1; + return; +} + + + +// DWARF original prototype: void Reset(TSkillPoison * this) + +void __thiscall TSkillPoison::Reset(TSkillPoison *this) + +{ + (this->super_TSkill).Act = 0; + (this->super_TSkill).Max = 0x7fffffff; + (this->super_TSkill).Min = 0; + (this->super_TSkill).DAct = 0; + (this->super_TSkill).MDAct = 0; + (this->super_TSkill).LastLevel = 0; + (this->super_TSkill).NextLevel = 0x7fffffff; + (this->super_TSkill).Exp = 0; + (this->super_TSkill).Delta = 0x7fffffff; + (this->super_TSkill).Cycle = 0; + (this->super_TSkill).MaxCycle = 0; + (this->super_TSkill).Count = 0; + (this->super_TSkill).MaxCount = 0; + (this->super_TSkill).AddLevel = 0; + (this->super_TSkill).FactorPercent = 0x32; + return; +} + + + +// DWARF original prototype: bool SetTimer(TSkillPoison * this, int cyc, int cou, int maxcou, int +// additionalvalue) + +bool __thiscall TSkillPoison::SetTimer(TSkillPoison *this) + +{ + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + int in_stack_00000014; + + (this->super_TSkill).Cycle = in_stack_00000008; + (this->super_TSkill).Count = in_stack_0000000c; + (this->super_TSkill).MaxCount = in_stack_00000010; + this_00 = (TPlayer *)(this->super_TSkill).Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + if (in_stack_00000014 == -1) { + in_stack_00000014 = 0x32; + } + if (in_stack_00000014 < 10) { + in_stack_00000014 = 10; + } + if (1000 < in_stack_00000014) { + in_stack_00000014 = 1000; + } + (this->super_TSkill).FactorPercent = in_stack_00000014; + return true; +} + + + +// DWARF original prototype: bool Process(TSkillPoison * this) + +bool __thiscall TSkillPoison::Process(TSkillPoison *this) + +{ + int iVar1; + TPlayer *this_00; + bool bVar2; + int Range; + int iVar3; + + iVar1 = (this->super_TSkill).Cycle; + if (iVar1 == 0) { + this_00 = (TPlayer *)(this->super_TSkill).Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + bVar2 = true; + } + else { + iVar3 = (this->super_TSkill).Count; + if (iVar3 < 1) { + (this->super_TSkill).Count = (this->super_TSkill).MaxCount; + iVar3 = (iVar1 * (this->super_TSkill).FactorPercent) / 1000; + if (iVar3 == 0) { + iVar3 = (uint)(0 < iVar1) * 2 + -1; + } + (this->super_TSkill).Cycle = iVar1 - iVar3; + (*(this->super_TSkill)._vptr_TSkill[0xf])(this,iVar3); + } + else { + (this->super_TSkill).Count = iVar3 + -1; + } + bVar2 = false; + } + return bVar2; +} + + + +// DWARF original prototype: void Event(TSkillPoison * this, int Range) + +void __thiscall TSkillPoison::Event(TSkillPoison *this,int Range) + +{ + int *piVar1; + TCreature *this_00; + bool bVar2; + TCreature *atk; + ulong uVar3; + TCreature *cr; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + this_00 = (this->super_TSkill).Master; + if (this_00 == (TCreature *)0x0) { + error("TSkillPoison::Event: GetMaster liefert NULL zurueck!\n"); + } + else { + if (0x7fffffff < (uint)Range) { + Range = -Range; + } + atk = GetCreature(this_00->PoisonDamageOrigin); + TCreature::Damage(this_00,atk,Range,2); + GetFirstObject(); + if (local_2c != ::NONE.ObjectID) { + do { + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,AVOID); + if (bVar2) { + Object::getObjectType(local_4c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar3 == 2) { + piVar1 = &(this->super_TSkill).Cycle; + *piVar1 = *piVar1 + 1; + return; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != ::NONE.ObjectID); + } + } + return; +} + + + +// DWARF original prototype: void Event(TSkillBurning * this, int param_1) + +void __thiscall TSkillBurning::Event(TSkillBurning *this,int param_1) + +{ + int *piVar1; + TCreature *this_00; + bool bVar2; + TCreature *atk; + ulong uVar3; + TCreature *cr; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + this_00 = (this->super_TSkill).Master; + if (this_00 == (TCreature *)0x0) { + error("TSkillBurning::Event: GetMaster liefert NULL zurueck!\n"); + } + else { + atk = GetCreature(this_00->FireDamageOrigin); + TCreature::Damage(this_00,atk,10,4); + GetFirstObject(); + if (local_2c != ::NONE.ObjectID) { + do { + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,AVOID); + if (bVar2) { + Object::getObjectType(local_4c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar3 == 4) { + piVar1 = &(this->super_TSkill).Cycle; + *piVar1 = *piVar1 + 1; + return; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != ::NONE.ObjectID); + } + } + return; +} + + + +// DWARF original prototype: void Event(TSkillEnergy * this, int param_1) + +void __thiscall TSkillEnergy::Event(TSkillEnergy *this,int param_1) + +{ + int *piVar1; + TCreature *this_00; + bool bVar2; + TCreature *atk; + ulong uVar3; + TCreature *cr; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + this_00 = (this->super_TSkill).Master; + if (this_00 == (TCreature *)0x0) { + error("TSkillEnergy::Event: GetMaster liefert NULL zurueck!\n"); + } + else { + atk = GetCreature(this_00->EnergyDamageOrigin); + TCreature::Damage(this_00,atk,0x19,8); + GetFirstObject(); + if (local_2c != ::NONE.ObjectID) { + do { + local_4c[0].ObjectID = ::NONE.ObjectID; + local_3c[0].ObjectID = ::NONE.ObjectID; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,AVOID); + if (bVar2) { + Object::getObjectType(local_4c); + uVar3 = ObjectType::getAttribute((ObjectType *)local_4c,AVOIDDAMAGETYPES); + if (uVar3 == 8) { + piVar1 = &(this->super_TSkill).Cycle; + *piVar1 = *piVar1 + 1; + return; + } + } + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + } while (local_3c[0].ObjectID != ::NONE.ObjectID); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: SecsPerMana +// DWARF original prototype: void Event(TSkillFed * this, int param_1) + +void __thiscall TSkillFed::Event(TSkillFed *this,int param_1) + +{ + TPlayer *this_00; + TSkill *pTVar1; + bool bVar2; + byte bVar3; + int Profession; + uint uVar4; + int iVar5; + TCreature *cr; + int SecsPerHP; + int iVar6; + uint uVar7; + int local_14; + int SecsPerMana; + + this_00 = (TPlayer *)(this->super_TSkill).Master; + if (this_00 == (TPlayer *)0x0) { + error("TSkillFed::Event: GetMaster liefert NULL zurueck!\n"); + return; + } + if ((this_00->super_TCreature).IsDead != false) { + return; + } + iVar5 = (this_00->super_TCreature).posz; + uVar7 = (this_00->super_TCreature).posy; + bVar2 = IsProtectionZone(); + if (bVar2) { + return; + } + local_14 = 6; + uVar4 = 0; + iVar6 = 0xc; + if ((this_00->super_TCreature).Type == PLAYER) { + bVar3 = TPlayer::GetActiveProfession(this_00); + uVar4 = (uint)bVar3; + } + switch(uVar4) { + case 0: + case 1: + iVar6 = 6; + goto LAB_080c9d9a; + case 2: + local_14 = 4; + iVar6 = 8; + break; + case 3: + case 4: + iVar6 = 0xc; + goto LAB_080c9e20; + default: + error("TSkillFed::Event: Unbekannter Beruf %d.\n",uVar4,iVar5); + uVar7 = uVar4; + break; + case 0xb: + iVar6 = 4; +LAB_080c9d9a: + local_14 = 6; + break; + case 0xc: + iVar6 = 6; +LAB_080c9e20: + local_14 = 3; + break; + case 0xd: + case 0xe: + local_14 = 2; + iVar6 = 0xc; + } + iVar5 = (*(this->super_TSkill)._vptr_TSkill[0xd])(this,uVar7); + if (iVar5 % iVar6 == 0) { + pTVar1 = (this_00->super_TCreature).super_TSkillBase.Skills[2]; + (*pTVar1->_vptr_TSkill[2])(pTVar1,pTVar1->Act + 1); + if (pTVar1->Max < pTVar1->Act) { + pTVar1->Act = pTVar1->Max; + } + } + iVar5 = (*(this->super_TSkill)._vptr_TSkill[0xd])(this); + if (iVar5 % local_14 == 0) { + pTVar1 = (this_00->super_TCreature).super_TSkillBase.Skills[3]; + (*pTVar1->_vptr_TSkill[2])(pTVar1,pTVar1->Act + 2); + if (pTVar1->Max < pTVar1->Act) { + pTVar1->Act = pTVar1->Max; + } + } + return; +} + + + +// DWARF original prototype: void Event(TSkillIllusion * this, int param_1) + +void __thiscall TSkillIllusion::Event(TSkillIllusion *this,int param_1) + +{ + TCreature *pTVar1; + int iVar2; + anon_union_4_2_730cd3ca_for_TOutfit_2 aVar3; + int a; + int iVar4; + TCreature *cr; + Object local_2c [4]; + Object local_1c [5]; + + if ((this->super_TSkill).Cycle == 0) { + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 == (TCreature *)0x0) { + error("TSkillIllusion::Event: GetMaster liefert NULL zurueck!\n"); + } + else { + iVar2 = (this->super_TSkill).Min; + iVar4 = (this->super_TSkill).Act; + if (iVar4 < iVar2) { + iVar4 = iVar2; + } + if (iVar4 + (this->super_TSkill).MDAct + (this->super_TSkill).DAct < 1) { + aVar3 = (pTVar1->OrgOutfit).field_1; + (pTVar1->Outfit).OutfitID = (pTVar1->OrgOutfit).OutfitID; + (pTVar1->Outfit).field_1 = aVar3; + AnnounceChangedCreature(pTVar1->ID,3); + local_1c[0].ObjectID = ::NONE.ObjectID; + local_2c[0].ObjectID = (pTVar1->CrObject).ObjectID; + NotifyAllCreatures(local_2c,2,local_1c); + } + } + } + return; +} + + + +// DWARF original prototype: bool SetTimer(TSkillIllusion * this, int cyc, int cou, int maxcou, int +// param_4) + +bool __thiscall TSkillIllusion::SetTimer(TSkillIllusion *this) + +{ + TCreature *pTVar1; + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + this_00 = (TPlayer *)(this->super_TSkill).Master; + (this->super_TSkill).Cycle = in_stack_00000008; + (this->super_TSkill).Count = in_stack_0000000c; + (this->super_TSkill).MaxCount = in_stack_00000010; + if (this_00 != (TPlayer *)0x0) { + if ((this_00->super_TCreature).Type == PLAYER) { + TPlayer::CheckState(this_00); + this_00 = (TPlayer *)(this->super_TSkill).Master; + } + if (this_00 != (TPlayer *)0x0) { + pTVar1 = GetCreature((this_00->super_TCreature).ID); + if (pTVar1 == (TCreature *)0x0) { + return true; + } + AnnounceChangedCreature((this_00->super_TCreature).ID,3); + return true; + } + } + error("TSkillIllusion::SetTimer: GetMaster liefert NULL zurueck!\n"); + return false; +} + + + +// DWARF original prototype: void Event(TSkillLight * this, int param_1) + +void __thiscall TSkillLight::Event(TSkillLight *this,int param_1) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + if (pTVar1 != (TCreature *)0x0) { + AnnounceChangedCreature(pTVar1->ID,2); + return; + } + error("TSkillLight::Event: GetMaster liefert NULL zurueck!\n"); + return; +} + + + +// DWARF original prototype: bool SetTimer(TSkillLight * this, int cyc, int cou, int maxcou, int +// param_4) + +bool __thiscall TSkillLight::SetTimer(TSkillLight *this) + +{ + TCreature *pTVar1; + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + this_00 = (TPlayer *)(this->super_TSkill).Master; + (this->super_TSkill).Cycle = in_stack_00000008; + (this->super_TSkill).Count = in_stack_0000000c; + (this->super_TSkill).MaxCount = in_stack_00000010; + if (this_00 != (TPlayer *)0x0) { + if ((this_00->super_TCreature).Type == PLAYER) { + TPlayer::CheckState(this_00); + this_00 = (TPlayer *)(this->super_TSkill).Master; + } + if (this_00 != (TPlayer *)0x0) { + pTVar1 = GetCreature((this_00->super_TCreature).ID); + if (pTVar1 == (TCreature *)0x0) { + return true; + } + AnnounceChangedCreature((this_00->super_TCreature).ID,2); + return true; + } + } + error("TSkillLight::SetTimer: GetMaster liefert NULL zurueck!\n"); + return false; +} + + + +// DWARF original prototype: void Set(TSkillHitpoints * this, int a) + +void __thiscall TSkillHitpoints::Set(TSkillHitpoints *this,int a) + +{ + TCreature *pTVar1; + int iVar2; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + if (((pTVar1 != (TCreature *)0x0) && (pTVar1->IsDead != false)) && (0 < a)) { + error(&DAT_08108140); + return; + } + (this->super_TSkillAdd).super_TSkill.Act = a; + iVar2 = (this->super_TSkillAdd).super_TSkill.Max; + if (iVar2 < a) { + (this->super_TSkillAdd).super_TSkill.Act = iVar2; + } + if (pTVar1 != (TCreature *)0x0) { + if (pTVar1->Type == PLAYER) { + SendPlayerData(pTVar1->Connection); + } + AnnounceChangedCreature(pTVar1->ID,1); + return; + } + return; +} + + + +// DWARF original prototype: void Set(TSkillMana * this, int a) + +void __thiscall TSkillMana::Set(TSkillMana *this,int a) + +{ + int iVar1; + TCreature *pTVar2; + + iVar1 = (this->super_TSkillAdd).super_TSkill.Max; + (this->super_TSkillAdd).super_TSkill.Act = a; + if (iVar1 < a) { + (this->super_TSkillAdd).super_TSkill.Act = iVar1; + } + pTVar2 = (this->super_TSkillAdd).super_TSkill.Master; + if ((pTVar2 != (TCreature *)0x0) && (pTVar2->Type == PLAYER)) { + SendPlayerData(pTVar2->Connection); + return; + } + return; +} + + + +// DWARF original prototype: void Set(TSkillSoulpoints * this, int a) + +void __thiscall TSkillSoulpoints::Set(TSkillSoulpoints *this,int a) + +{ + int iVar1; + TCreature *pTVar2; + + iVar1 = (this->super_TSkillAdd).super_TSkill.Max; + (this->super_TSkillAdd).super_TSkill.Act = a; + if (iVar1 < a) { + (this->super_TSkillAdd).super_TSkill.Act = iVar1; + } + pTVar2 = (this->super_TSkillAdd).super_TSkill.Master; + if ((pTVar2 != (TCreature *)0x0) && (pTVar2->Type == PLAYER)) { + SendPlayerData(pTVar2->Connection); + return; + } + return; +} + + + +// DWARF original prototype: void Event(TSkillSoulpoints * this, int param_1) + +void __thiscall TSkillSoulpoints::Event(TSkillSoulpoints *this,int param_1) + +{ + TCreature *pTVar1; + TSkill *pTVar2; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + if (pTVar1 != (TCreature *)0x0) { + if (pTVar1->IsDead == false) { + pTVar2 = (pTVar1->super_TSkillBase).Skills[0x16]; + (*pTVar2->_vptr_TSkill[2])(pTVar2,pTVar2->Act + 1); + if (pTVar2->Max < pTVar2->Act) { + pTVar2->Act = pTVar2->Max; + } + } + return; + } + error("TSkillSoulpoints::Event: GetMaster liefert NULL zurueck!\n"); + return; +} + + + +// DWARF original prototype: bool SetTimer(TSkillGoStrength * this, int cyc, int cou, int maxcou, +// int param_4) + +bool __thiscall TSkillGoStrength::SetTimer(TSkillGoStrength *this) + +{ + ushort uVar1; + TPlayer *this_00; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + + (this->super_TSkillAdd).super_TSkill.Count = in_stack_0000000c; + (this->super_TSkillAdd).super_TSkill.Cycle = in_stack_00000008; + (this->super_TSkillAdd).super_TSkill.MaxCount = in_stack_00000010; + this_00 = (TPlayer *)(this->super_TSkillAdd).super_TSkill.Master; + if ((this_00 != (TPlayer *)0x0) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + this_00 = (TPlayer *)(this->super_TSkillAdd).super_TSkill.Master; + } + if ((in_stack_00000008 == 0) && + (uVar1 = (this->super_TSkillAdd).super_TSkill.SkNr, + (this->super_TSkillAdd).super_TSkill.MDAct = 0, uVar1 == 4)) { + if (this_00 == (TPlayer *)0x0) goto LAB_080ca268; + if ((this_00->super_TCreature).Type == PLAYER) { + TPlayer::CheckState(this_00); + this_00 = (TPlayer *)(this->super_TSkillAdd).super_TSkill.Master; + } + } + if (this_00 != (TPlayer *)0x0) { + AnnounceChangedCreature((this_00->super_TCreature).ID,4); + return true; + } +LAB_080ca268: + error("TSkillGoStrength::SetTimer: GetMaster liefert NULL zurueck!\n"); + return false; +} + + + +// DWARF original prototype: void Event(TSkillGoStrength * this, int param_1) + +void __thiscall TSkillGoStrength::Event(TSkillGoStrength *this,int param_1) + +{ + ushort uVar1; + TPlayer *this_00; + TCreature *cr; + + if ((this->super_TSkillAdd).super_TSkill.Cycle != 0) { + return; + } + this_00 = (TPlayer *)(this->super_TSkillAdd).super_TSkill.Master; + if (this_00 != (TPlayer *)0x0) { + uVar1 = (this->super_TSkillAdd).super_TSkill.SkNr; + (this->super_TSkillAdd).super_TSkill.MDAct = 0; + if ((uVar1 == 4) && ((this_00->super_TCreature).Type == PLAYER)) { + TPlayer::CheckState(this_00); + } + AnnounceChangedCreature((this_00->super_TCreature).ID,4); + return; + } + error("TSkillGoStrength::Event: GetMaster liefert NULL zurueck!\n"); + return; +} + + + +// DWARF original prototype: void Set(TSkillCarryStrength * this, int a) + +void __thiscall TSkillCarryStrength::Set(TSkillCarryStrength *this,int a) + +{ + int iVar1; + TCreature *pTVar2; + + iVar1 = (this->super_TSkillAdd).super_TSkill.Max; + (this->super_TSkillAdd).super_TSkill.Act = a; + if (iVar1 < a) { + (this->super_TSkillAdd).super_TSkill.Act = iVar1; + } + pTVar2 = (this->super_TSkillAdd).super_TSkill.Master; + if ((pTVar2 != (TCreature *)0x0) && (pTVar2->Type == PLAYER)) { + SendPlayerData(pTVar2->Connection); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitCrskill(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitCrskill(void) + +{ + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z14GetSkillByNamePc(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: void ~TSkillLevel(TSkillLevel * this, int __in_chrg) + +void __thiscall TSkillLevel::~TSkillLevel(TSkillLevel *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillLevel(TSkillLevel * this, int __in_chrg) + +void __thiscall TSkillLevel::~TSkillLevel(TSkillLevel *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillProbe(TSkillProbe * this, int __in_chrg) + +void __thiscall TSkillProbe::~TSkillProbe(TSkillProbe *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillProbe(TSkillProbe * this, int __in_chrg) + +void __thiscall TSkillProbe::~TSkillProbe(TSkillProbe *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillPoison(TSkillPoison * this, int __in_chrg) + +void __thiscall TSkillPoison::~TSkillPoison(TSkillPoison *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillPoison(TSkillPoison * this, int __in_chrg) + +void __thiscall TSkillPoison::~TSkillPoison(TSkillPoison *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillBurning(TSkillBurning * this, int __in_chrg) + +void __thiscall TSkillBurning::~TSkillBurning(TSkillBurning *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillBurning(TSkillBurning * this, int __in_chrg) + +void __thiscall TSkillBurning::~TSkillBurning(TSkillBurning *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillEnergy(TSkillEnergy * this, int __in_chrg) + +void __thiscall TSkillEnergy::~TSkillEnergy(TSkillEnergy *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillEnergy(TSkillEnergy * this, int __in_chrg) + +void __thiscall TSkillEnergy::~TSkillEnergy(TSkillEnergy *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillFed(TSkillFed * this, int __in_chrg) + +void __thiscall TSkillFed::~TSkillFed(TSkillFed *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillFed(TSkillFed * this, int __in_chrg) + +void __thiscall TSkillFed::~TSkillFed(TSkillFed *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillIllusion(TSkillIllusion * this, int __in_chrg) + +void __thiscall TSkillIllusion::~TSkillIllusion(TSkillIllusion *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillIllusion(TSkillIllusion * this, int __in_chrg) + +void __thiscall TSkillIllusion::~TSkillIllusion(TSkillIllusion *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillLight(TSkillLight * this, int __in_chrg) + +void __thiscall TSkillLight::~TSkillLight(TSkillLight *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillLight(TSkillLight * this, int __in_chrg) + +void __thiscall TSkillLight::~TSkillLight(TSkillLight *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillHitpoints(TSkillHitpoints * this, int __in_chrg) + +void __thiscall TSkillHitpoints::~TSkillHitpoints(TSkillHitpoints *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillHitpoints(TSkillHitpoints * this, int __in_chrg) + +void __thiscall TSkillHitpoints::~TSkillHitpoints(TSkillHitpoints *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillMana(TSkillMana * this, int __in_chrg) + +void __thiscall TSkillMana::~TSkillMana(TSkillMana *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillMana(TSkillMana * this, int __in_chrg) + +void __thiscall TSkillMana::~TSkillMana(TSkillMana *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillSoulpoints(TSkillSoulpoints * this, int __in_chrg) + +void __thiscall TSkillSoulpoints::~TSkillSoulpoints(TSkillSoulpoints *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillSoulpoints(TSkillSoulpoints * this, int __in_chrg) + +void __thiscall TSkillSoulpoints::~TSkillSoulpoints(TSkillSoulpoints *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillGoStrength(TSkillGoStrength * this, int __in_chrg) + +void __thiscall TSkillGoStrength::~TSkillGoStrength(TSkillGoStrength *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillGoStrength(TSkillGoStrength * this, int __in_chrg) + +void __thiscall TSkillGoStrength::~TSkillGoStrength(TSkillGoStrength *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillCarryStrength(TSkillCarryStrength * this, int __in_chrg) + +void __thiscall TSkillCarryStrength::~TSkillCarryStrength(TSkillCarryStrength *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + return; +} + + + +// DWARF original prototype: void ~TSkillCarryStrength(TSkillCarryStrength * this, int __in_chrg) + +void __thiscall TSkillCarryStrength::~TSkillCarryStrength(TSkillCarryStrength *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkillAdd).super_TSkill.Master; + (this->super_TSkillAdd).super_TSkill._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkillAdd).super_TSkill.SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void Increase(TSkill * this, int param_1) + +void __thiscall TSkill::Increase(TSkill *this,int param_1) + +{ + return; +} + + + +// DWARF original prototype: void Decrease(TSkill * this, int param_1) + +void __thiscall TSkill::Decrease(TSkill *this,int param_1) + +{ + return; +} + + + +// DWARF original prototype: int GetExpForLevel(TSkill * this, int param_1) + +int __thiscall TSkill::GetExpForLevel(TSkill *this,int param_1) + +{ + return 0; +} + + + +// DWARF original prototype: void Advance(TSkill * this, int param_1) + +void __thiscall TSkill::Advance(TSkill *this,int param_1) + +{ + return; +} + + + +// DWARF original prototype: void ChangeSkill(TSkill * this, int param_1, int param_2) + +void __thiscall TSkill::ChangeSkill(TSkill *this,int param_1,int param_2) + +{ + return; +} + + + +// DWARF original prototype: int ProbeValue(TSkill * this, int param_1, bool param_2) + +int __thiscall TSkill::ProbeValue(TSkill *this,int param_1,bool param_2) + +{ + return 0; +} + + + +// DWARF original prototype: bool Probe(TSkill * this, int param_1, int param_2, bool param_3) + +bool __thiscall TSkill::Probe(TSkill *this,int param_1,int param_2,bool param_3) + +{ + return false; +} + + + +// DWARF original prototype: int TimerValue(TSkill * this) + +int __thiscall TSkill::TimerValue(TSkill *this) + +{ + return this->Cycle; +} + + + +// DWARF original prototype: void ~TSkillAdd(TSkillAdd * this, int __in_chrg) + +void __thiscall TSkillAdd::~TSkillAdd(TSkillAdd *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void ~TSkillAdd(TSkillAdd * this, int __in_chrg) + +void __thiscall TSkillAdd::~TSkillAdd(TSkillAdd *this,int __in_chrg) + +{ + TCreature *pTVar1; + + pTVar1 = (this->super_TSkill).Master; + (this->super_TSkill)._vptr_TSkill = (_func_int_varargs **)&PTR__TSkill_081282c8; + if (pTVar1 != (TCreature *)0x0) { + TSkillBase::DelTimer(&pTVar1->super_TSkillBase,(this->super_TSkill).SkNr); + } + return; +} + + + +// DWARF original prototype: int TimerValue(TSkillSoulpoints * this) + +int __thiscall TSkillSoulpoints::TimerValue(TSkillSoulpoints *this) + +{ + return ((this->super_TSkillAdd).super_TSkill.Cycle + -1) * + (this->super_TSkillAdd).super_TSkill.MaxCount + + (this->super_TSkillAdd).super_TSkill.Count; +} + + + +double __cmath_power(double __x,uint __n) + +{ + double dVar1; + uint uVar2; + double __y; + + dVar1 = 1.0; + if ((__n & 1) != 0) { + dVar1 = __x; + } + for (uVar2 = __n >> 1; uVar2 != 0; uVar2 = uVar2 >> 1) { + __x = __x * __x; + if ((uVar2 & 1) != 0) { + dVar1 = dVar1 * __x; + } + } + return dVar1; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + TConnection *pTVar1; + int local_14; + + if (__priority == 0xffff) { + if (__initialize_p == 1) { + NONE.ObjectID = 0; + local_14 = 1099; + pTVar1 = Connections; + do { + // try { // try from 080cac40 to 080cac44 has its CatchHandler @ 080cac8c + TXTEASymmetricKey::TXTEASymmetricKey(&pTVar1->SymmetricKey); + pTVar1->State = CONNECTION_FREE; + pTVar1 = pTVar1 + 1; + local_14 = local_14 + -1; + } while (local_14 != -1); + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + if (__initialize_p == 1) { + Semaphore::Semaphore(&ConnectionMutex,1); + __cxa_atexit(__tcf_1,0,&__dso_handle); + } + } + return; +} + + + +// DWARF original prototype: void TConnection(TConnection * this) + +void __thiscall TConnection::TConnection(TConnection *this) + +{ + TXTEASymmetricKey::TXTEASymmetricKey(&this->SymmetricKey); + this->State = CONNECTION_FREE; + return; +} + + + +// DWARF original prototype: void TConnection(TConnection * this) + +void __thiscall TConnection::TConnection(TConnection *this) + +{ + TXTEASymmetricKey::TXTEASymmetricKey(&this->SymmetricKey); + this->State = CONNECTION_FREE; + return; +} + + + +// DWARF original prototype: void Process(TConnection * this) + +void __thiscall TConnection::Process(TConnection *this) + +{ + ulong uVar1; + bool bVar2; + CONNECTIONSTATE CVar3; + int Time; + int iVar4; + TPlayer *this_00; + TConnection *pTVar5; + int i; + + CVar3 = this->State; + if (CVar3 == CONNECTION_LOGIN) { + bVar2 = GameRunning(); + if ((!bVar2) || (this->ConnectionIsOk == false)) { + if (this->State < CONNECTION_CONNECTED) { + error(&DAT_08108420,this->State); + } + iVar4 = 0x95; + pTVar5 = this; + do { + if (pTVar5->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { + UnchainKnownCreature(this,pTVar5->KnownCreatureTable[0].CreatureID); + } + pTVar5->KnownCreatureTable[0].Connection = this; + pTVar5->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; + pTVar5->KnownCreatureTable[0].CreatureID = 0; + pTVar5 = (TConnection *)(pTVar5->InData + 0x10); + iVar4 = iVar4 + -1; + } while (-1 < iVar4); + this->ConnectionIsOk = false; + this->State = CONNECTION_DISCONNECTED; + kill(this->PID,1); + } + CVar3 = this->State; + } + if (1 < CVar3 - CONNECTION_GAME) goto LAB_080cae41; + iVar4 = RoundNr - this->TimeStamp; + if (iVar4 == 0x1e) { + SendPing(this); + } + if (iVar4 == 0x3c) { + SendPing(this); + } + if ((RoundNr - 900 == this->TimeStampAction) && + (bVar2 = CheckRight(this->CharacterID,NO_LOGOUT_BLOCK), !bVar2)) { + SendMessage(this,0x12, + "You have been idle for %d minutes. You will be disconnected in one minute if you are still idle then." + ,0xf); + } + bVar2 = GameRunning(); + if ((bVar2) && + ((RoundNr - this->TimeStampAction < 0x3c0 || + (bVar2 = CheckRight(this->CharacterID,NO_LOGOUT_BLOCK), bVar2)))) { + if ((this->ConnectionIsOk == false) || (0x59 < iVar4)) { + if (2 < this->State - CONNECTION_GAME) { + error(&DAT_08108460,this->State); + } + this->State = CONNECTION_LOGOUT; + this_00 = (TPlayer *)0x0; + if (this->CharacterID != 0) { + this_00 = ::GetPlayer(this->CharacterID); + } + if (this_00 != (TPlayer *)0x0) { + TPlayer::ClearConnection(this_00); + bVar2 = false; + goto LAB_080cae11; + } + goto LAB_080cae21; + } + } + else { + if (2 < this->State - CONNECTION_GAME) { + error(&DAT_08108460,this->State); + } + this_00 = (TPlayer *)0x0; + this->State = CONNECTION_LOGOUT; + if (this->CharacterID != 0) { + this_00 = ::GetPlayer(this->CharacterID); + } + if (this_00 != (TPlayer *)0x0) { + TPlayer::ClearConnection(this_00); + bVar2 = true; +LAB_080cae11: + TCreature::StartLogout(&this_00->super_TCreature,false,bVar2); + } +LAB_080cae21: + uVar1 = RoundNr; + this->CharacterID = 0; + this->TimeStamp = uVar1; + this->ClosingIsDelayed = false; + } + CVar3 = this->State; +LAB_080cae41: + if ((CVar3 == CONNECTION_LOGOUT) && + (((bVar2 = GameRunning(), !bVar2 || (this->ConnectionIsOk == false)) || + (this->TimeStamp <= RoundNr)))) { + if (this->State < CONNECTION_CONNECTED) { + error(&DAT_08108420,this->State); + } + iVar4 = 0x95; + pTVar5 = this; + do { + if (pTVar5->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { + UnchainKnownCreature(this,pTVar5->KnownCreatureTable[0].CreatureID); + } + pTVar5->KnownCreatureTable[0].Connection = this; + pTVar5->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; + pTVar5->KnownCreatureTable[0].CreatureID = 0; + pTVar5 = (TConnection *)(pTVar5->InData + 0x10); + iVar4 = iVar4 + -1; + } while (-1 < iVar4); + this->ConnectionIsOk = false; + this->State = CONNECTION_DISCONNECTED; + kill(this->PID,1); + } + return; +} + + + +// DWARF original prototype: void ResetTimer(TConnection * this, int Command) + +void __thiscall TConnection::ResetTimer(TConnection *this,int Command) + +{ + if ((((this->State - CONNECTION_GAME < 2) && (this->TimeStamp = RoundNr, Command != 0x69)) && + (Command != 0xbe)) && (((Command != 0xc9 && (Command != 0xca)) && (Command != 0x1e)))) { + this->TimeStampAction = RoundNr; + } + return; +} + + + +// DWARF original prototype: void EmergencyPing(TConnection * this) + +void __thiscall TConnection::EmergencyPing(TConnection *this) + +{ + if (this->State - CONNECTION_GAME < 2) { + if (RoundNr - this->TimeStamp < 0x50) { + this->TimeStamp = RoundNr - 100; + } + SendPing(this); + return; + } + return; +} + + + +// DWARF original prototype: pid_t GetPID(TConnection * this) + +pid_t __thiscall TConnection::GetPID(TConnection *this) + +{ + pid_t pVar1; + + if (this->State == CONNECTION_FREE) { + error("TConnection::GetPID: Verbindung ist nicht zugewiesen.\n"); + pVar1 = 0; + } + else { + pVar1 = this->PID; + } + return pVar1; +} + + + +// DWARF original prototype: int GetSocket(TConnection * this) + +int __thiscall TConnection::GetSocket(TConnection *this) + +{ + int iVar1; + + if (this->State < CONNECTION_CONNECTED) { + error("TConnection::GetSocket: Verbindung ist nicht angeschlossen.\n"); + iVar1 = -1; + } + else { + iVar1 = this->Socket; + } + return iVar1; +} + + + +// DWARF original prototype: char * GetIPAddress(TConnection * this) + +char * __thiscall TConnection::GetIPAddress(TConnection *this) + +{ + char *pcVar1; + + if (this->State < CONNECTION_CONNECTED) { + error("TConnection::GetIPAddress: Verbindung ist nicht angeschlossen.\n"); + pcVar1 = "Unknown"; + } + else { + pcVar1 = this->IPAddress; + } + return pcVar1; +} + + + +// DWARF original prototype: void Free(TConnection * this) + +void __thiscall TConnection::Free(TConnection *this) + +{ + this->State = CONNECTION_FREE; + return; +} + + + +// DWARF original prototype: void Assign(TConnection * this) + +void __thiscall TConnection::Assign(TConnection *this) + +{ + __pid_t _Var1; + + if (this->State != CONNECTION_FREE) { + error("TConnection::Assign: Verbindung ist nicht frei.\n"); + } + this->State = CONNECTION_ASSIGNED; + _Var1 = getpid(); + this->PID = _Var1; + return; +} + + + +// DWARF original prototype: void Connect(TConnection * this, int _Socket) + +void __thiscall TConnection::Connect(TConnection *this,int _Socket) + +{ + char *__src; + uint uVar1; + socklen_t local_30; + socklen_t addrlen; + sockaddr_in inaddr; + sockaddr peer; + + if (this->State != CONNECTION_ASSIGNED) { + error("TConnection::Connect: Verbindung ist keinem Thread zugewiesen .\n"); + } + this->State = CONNECTION_CONNECTED; + this->ConnectionIsOk = true; + this->ClosingIsDelayed = true; + this->Socket = _Socket; + local_30 = 0x10; + getpeername(this->Socket,(sockaddr *)(inaddr.sin_zero + 4),&local_30); + addrlen._0_1_ = inaddr.sin_zero[4]; + addrlen._1_1_ = inaddr.sin_zero[5]; + addrlen._2_1_ = inaddr.sin_zero[6]; + addrlen._3_1_ = inaddr.sin_zero[7]; + __src = inet_ntoa((in_addr)peer._0_4_); + strcpy(this->IPAddress,__src); + uVar1 = rand(); + this->RandomSeed = uVar1; + return; +} + + + +// DWARF original prototype: void Login(TConnection * this) + +void __thiscall TConnection::Login(TConnection *this) + +{ + if (this->State != CONNECTION_CONNECTED) { + error(&DAT_08108680,this->State); + } + this->State = CONNECTION_LOGIN; + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080cb3a6) +// WARNING: Removing unreachable block (ram,0x080cb640) +// DWARF original prototype: bool JoinGame(TConnection * this, TReadBuffer * Buffer) + +bool __thiscall TConnection::JoinGame(TConnection *this,TReadBuffer *Buffer) + +{ + uint uVar1; + ulong uVar2; + TPlayer *this_00; + TPlayer *pl; + TConnection *pTVar3; + int i; + int iVar4; + char *Text; + TPlayer *local_14; + + if (this->State != CONNECTION_LOGIN) { + error(&DAT_081086c0,this->State); + } + iVar4 = 0x95; + pTVar3 = this; + do { + pTVar3->KnownCreatureTable[0].Connection = this; + pTVar3->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; + pTVar3->KnownCreatureTable[0].CreatureID = 0; + pTVar3 = (TConnection *)(pTVar3->InData + 0x10); + iVar4 = iVar4 + -1; + } while (-1 < iVar4); + // try { // try from 080cb3d8 to 080cb3ee has its CatchHandler @ 080cb657 + uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + this->TerminalType = uVar1 & 0xffff; + uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + iVar4 = this->TerminalType; + this->TerminalVersion = uVar1 & 0xffff; + if ((iVar4 < 0) || ((1 < iVar4 && (iVar4 != 2)))) { + error("TConnection::JoinGame: Unbekannter Terminal-Typ %d.\n",iVar4); + } + else { + this->TerminalOffsetX = 8; + this->TerminalOffsetY = 6; + this->TerminalWidth = 0x12; + this->TerminalHeight = 0xe; + // try { // try from 080cb45a to 080cb45c has its CatchHandler @ 080cb687 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + this->CharacterID = uVar2; + this_00 = ::GetPlayer(uVar2); + if (this_00 == (TPlayer *)0x0) { + this_00 = (TPlayer *)operator_new(0xde8); + // try { // try from 080cb60d to 080cb611 has its CatchHandler @ 080cb6a6 + TPlayer::TPlayer(this_00,this,this->CharacterID); + if (this_00 == (TPlayer *)0x0) { + return false; + } + if (this_00->ConstructError == NOERROR) { +LAB_080cb54c: + strcpy(this->Name,(this_00->super_TCreature).Name); + this->TimeStamp = RoundNr; + this->TimeStampAction = RoundNr; + return true; + } + (*(this_00->super_TCreature)._vptr_TCreature[1])(this_00); + } + else { + if ((this_00->super_TCreature).IsDead == false) { + if (((this_00->super_TCreature).LoggingOut == false) || + (iVar4 = TCreature::LogoutPossible(&this_00->super_TCreature), iVar4 != 0)) { + pTVar3 = (this_00->super_TCreature).Connection; + TPlayer::ClearConnection(this_00); + if (pTVar3 != (TConnection *)0x0) { + pTVar3->CharacterID = 0; + if (2 < pTVar3->State - CONNECTION_GAME) { + error(&DAT_08108460,pTVar3->State); + } + pTVar3->State = CONNECTION_LOGOUT; + local_14 = (TPlayer *)0x0; + if (pTVar3->CharacterID != 0) { + local_14 = ::GetPlayer(pTVar3->CharacterID); + } + if (local_14 != (TPlayer *)0x0) { + TPlayer::ClearConnection(local_14); + TCreature::StartLogout(&local_14->super_TCreature,false,true); + } + uVar2 = RoundNr; + pTVar3->CharacterID = 0; + pTVar3->TimeStamp = uVar2; + pTVar3->ClosingIsDelayed = false; + } + DecrementIsOnlineOrder(this->CharacterID); + TPlayer::TakeOver(this_00,this); + goto LAB_080cb54c; + } + Text = "Spieler %s loggt gerade aus - Einloggen gescheitert.\n"; + } + else { + Text = "Spieler %s ist gerade am Sterben - Einloggen gescheitert.\n"; + } + Log("game",Text,(this_00->super_TCreature).Name); + DecreasePlayerPoolSlotSticky(this->CharacterID); + } + } + return false; +} + + + +// DWARF original prototype: void EnterGame(TConnection * this) + +void __thiscall TConnection::EnterGame(TConnection *this) + +{ + if (this->State != CONNECTION_LOGIN) { + error(&DAT_08108800,this->State); + } + this->State = CONNECTION_GAME; + return; +} + + + +// DWARF original prototype: void Die(TConnection * this) + +void __thiscall TConnection::Die(TConnection *this) + +{ + if (this->State == CONNECTION_GAME) { + this->State = CONNECTION_DEAD; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: StopFight_local +// DWARF original prototype: void Logout(TConnection * this, int Delay, bool StopFight) + +void __thiscall TConnection::Logout(TConnection *this,int Delay,bool StopFight) + +{ + ulong uVar1; + TPlayer *this_00; + bool StopFight_local; + + if (2 < this->State - CONNECTION_GAME) { + error(&DAT_08108460,this->State); + } + this_00 = (TPlayer *)0x0; + this->State = CONNECTION_LOGOUT; + if (this->CharacterID != 0) { + this_00 = ::GetPlayer(this->CharacterID); + } + if (this_00 != (TPlayer *)0x0) { + TPlayer::ClearConnection(this_00); + TCreature::StartLogout(&this_00->super_TCreature,false,StopFight); + } + uVar1 = RoundNr; + this->CharacterID = 0; + this->TimeStamp = Delay + uVar1; + this->ClosingIsDelayed = false; + return; +} + + + +// DWARF original prototype: void Close(TConnection * this, bool Delay) + +void __thiscall TConnection::Close(TConnection *this,bool Delay) + +{ + CONNECTIONSTATE CVar1; + + CVar1 = this->State; + if (CVar1 < CONNECTION_CONNECTED) { + error(&DAT_08108420,CVar1); + CVar1 = this->State; + } + this->ConnectionIsOk = false; + this->ClosingIsDelayed = Delay; + if (CVar1 == CONNECTION_CONNECTED) { + this->State = CONNECTION_DISCONNECTED; + } + return; +} + + + +// DWARF original prototype: void Disconnect(TConnection * this) + +void __thiscall TConnection::Disconnect(TConnection *this) + +{ + TConnection *pTVar1; + int i; + int iVar2; + + if (this->State < CONNECTION_CONNECTED) { + error(&DAT_08108420,this->State); + } + iVar2 = 0x95; + pTVar1 = this; + do { + if (pTVar1->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { + UnchainKnownCreature(this,pTVar1->KnownCreatureTable[0].CreatureID); + } + pTVar1->KnownCreatureTable[0].Connection = this; + pTVar1->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; + pTVar1->KnownCreatureTable[0].CreatureID = 0; + pTVar1 = (TConnection *)(pTVar1->InData + 0x10); + iVar2 = iVar2 + -1; + } while (-1 < iVar2); + this->ConnectionIsOk = false; + this->State = CONNECTION_DISCONNECTED; + kill(this->PID,1); + return; +} + + + +// DWARF original prototype: TPlayer * GetPlayer(TConnection * this) + +TPlayer * __thiscall TConnection::GetPlayer(TConnection *this) + +{ + TPlayer *pTVar1; + + if (this->State - CONNECTION_LOGIN < 4) { + if (this->CharacterID != 0) { + pTVar1 = ::GetPlayer(this->CharacterID); + return pTVar1; + } + } + else { + error(&DAT_08108840,this->State); + } + return (TPlayer *)0x0; +} + + + +// DWARF original prototype: char * GetName(TConnection * this) + +char * __thiscall TConnection::GetName(TConnection *this) + +{ + char *pcVar1; + + if (this->State - CONNECTION_LOGIN < 4) { + pcVar1 = this->Name; + } + else { + error(&DAT_08108880,this->State); + pcVar1 = ""; + } + return pcVar1; +} + + + +// DWARF original prototype: void GetPosition(TConnection * this, int * x, int * y, int * z) + +void __thiscall TConnection::GetPosition(TConnection *this,int *x,int *y,int *z) + +{ + TPlayer *pTVar1; + + if (this->State - CONNECTION_LOGIN < 4) { + pTVar1 = (TPlayer *)0x0; + if (this->CharacterID != 0) { + pTVar1 = ::GetPlayer(this->CharacterID); + } + } + else { + error(&DAT_08108840,this->State); + pTVar1 = (TPlayer *)0x0; + } + if (pTVar1 == (TPlayer *)0x0) { + *x = 0; + *y = 0; + *z = 0; + } + else { + *x = (pTVar1->super_TCreature).posx; + *y = (pTVar1->super_TCreature).posy; + *z = (pTVar1->super_TCreature).posz; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz +// DWARF original prototype: bool IsVisible(TConnection * this, int x, int y, int z) + +bool __thiscall TConnection::IsVisible(TConnection *this,int x,int y,int z) + +{ + bool bVar1; + int dz; + int iVar2; + int iVar3; + int local_1c; + int posx; + int posy; + int posz; + + GetPosition(this,&local_1c,&posx,&posy); + if (posy < 8) { + if (7 < z) { + return false; + } + if (posy < 8) goto LAB_080cba8a; + } + if (4 < (z - posy) + 2U) { + return false; + } +LAB_080cba8a: + iVar2 = ((y + this->TerminalOffsetY) - posx) - (posy - z); + iVar3 = ((x + this->TerminalOffsetX) - local_1c) - (posy - z); + if ((((iVar3 < 0) || (this->TerminalWidth <= iVar3)) || (iVar2 < 0)) || + (this->TerminalHeight <= iVar2)) { + bVar1 = false; + } + else { + bVar1 = true; + } + return bVar1; +} + + + +// DWARF original prototype: KNOWNCREATURESTATE KnownCreature(TConnection * this, ulong ID, bool +// UpdateFollows) + +KNOWNCREATURESTATE __thiscall +TConnection::KnownCreature(TConnection *this,ulong ID,bool UpdateFollows) + +{ + KNOWNCREATURESTATE KVar1; + int i; + int iVar2; + + iVar2 = 0; + while (this->KnownCreatureTable[0].CreatureID != ID) { + iVar2 = iVar2 + 1; + this = (TConnection *)(this->InData + 0x10); + if (0x95 < iVar2) { + return KNOWNCREATURE_FREE; + } + } + KVar1 = this->KnownCreatureTable[0].State; + if (KVar1 != KNOWNCREATURE_OUTDATED) { + return KVar1; + } + if (!UpdateFollows) { + return KNOWNCREATURE_OUTDATED; + } + this->KnownCreatureTable[0].State = KNOWNCREATURE_UPTODATE; + return KNOWNCREATURE_OUTDATED; +} + + + +// WARNING: Variable defined which should be unmapped: OldID +// WARNING: Variable defined which should be unmapped: FreeEntry +// DWARF original prototype: ulong NewKnownCreature(TConnection * this, ulong NewID) + +ulong __thiscall TConnection::NewKnownCreature(TConnection *this,ulong NewID) + +{ + int iVar1; + ulong uVar2; + bool bVar3; + ulong *puVar4; + TCreature *pTVar5; + TKnownCreature *pTVar6; + TCreature *cr; + int iVar7; + TConnection *pTVar8; + int i_1; + int local_1c; + int i_2; + int FreeEntry; + ulong OldID; + + iVar7 = 0; + i_2 = -1; + FreeEntry = 0; + puVar4 = &this->KnownCreatureTable[0].CreatureID; + do { + iVar1 = iVar7; + uVar2 = NewID; + if (*puVar4 == NewID) break; + iVar7 = iVar7 + 1; + puVar4 = puVar4 + 4; + iVar1 = i_2; + uVar2 = FreeEntry; + } while (iVar7 < 0x96); + FreeEntry = uVar2; + i_2 = iVar1; + if (i_2 == -1) { + iVar7 = 0; + pTVar6 = this->KnownCreatureTable; + pTVar8 = this; + do { + if (pTVar6->State == KNOWNCREATURE_FREE) { + FreeEntry = pTVar8->KnownCreatureTable[0].CreatureID; + i_2 = iVar7; + break; + } + iVar7 = iVar7 + 1; + pTVar6 = pTVar6 + 1; + pTVar8 = (TConnection *)(pTVar8->InData + 0x10); + } while (iVar7 < 0x96); + if (i_2 == -1) { + local_1c = 0; + puVar4 = &this->KnownCreatureTable[0].CreatureID; + do { + pTVar5 = GetCreature(*puVar4); + if (pTVar5 == (TCreature *)0x0) { + error("TUserCom::NewKnownCreature: Bekannte Kreatur existiert nicht.\n"); +LAB_080cbc81: + if ((pTVar5 == (TCreature *)0x0) || + (bVar3 = IsVisible(this,pTVar5->posx,pTVar5->posy,pTVar5->posz), !bVar3)) { + i_2 = local_1c; + FreeEntry = *puVar4; + UnchainKnownCreature(this,FreeEntry); + break; + } + } + else { + bVar3 = IsVisible(this,pTVar5->posx,pTVar5->posy,pTVar5->posz); + if (!bVar3) goto LAB_080cbc81; + } + local_1c = local_1c + 1; + puVar4 = puVar4 + 4; + } while (local_1c < 0x96); + if (i_2 == -1) { + print(); + return 0; + } + } + } + if (this->KnownCreatureTable[i_2].State != KNOWNCREATURE_FREE) { + error(&DAT_08108900); + } + this->KnownCreatureTable[i_2].CreatureID = NewID; + this->KnownCreatureTable[i_2].State = KNOWNCREATURE_UPTODATE; + pTVar5 = GetCreature(NewID); + if (pTVar5 == (TCreature *)0x0) { + error("TUserCom::NewKnownCreature: Kreatur %lu existiert nicht.\n",NewID); + } + else { + this->KnownCreatureTable[i_2].Next = pTVar5->FirstKnowingConnection; + pTVar5->FirstKnowingConnection = this->KnownCreatureTable + i_2; + } + return FreeEntry; +} + + + +// WARNING: Variable defined which should be unmapped: Unchain_local +// DWARF original prototype: void ClearKnownCreatureTable(TConnection * this, bool Unchain) + +void __thiscall TConnection::ClearKnownCreatureTable(TConnection *this,bool Unchain) + +{ + TConnection *pTVar1; + int i; + int iVar2; + bool Unchain_local; + + iVar2 = 0x95; + pTVar1 = this; + do { + if ((Unchain) && (pTVar1->KnownCreatureTable[0].State != KNOWNCREATURE_FREE)) { + UnchainKnownCreature(this,pTVar1->KnownCreatureTable[0].CreatureID); + } + pTVar1->KnownCreatureTable[0].Connection = this; + pTVar1->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; + pTVar1->KnownCreatureTable[0].CreatureID = 0; + pTVar1 = (TConnection *)(pTVar1->InData + 0x10); + iVar2 = iVar2 + -1; + } while (-1 < iVar2); + return; +} + + + +// DWARF original prototype: void UnchainKnownCreature(TConnection * this, ulong ID) + +void __thiscall TConnection::UnchainKnownCreature(TConnection *this,ulong ID) + +{ + TKnownCreature *pTVar1; + TCreature *pTVar2; + TCreature *cr; + TKnownCreature *KnownCreature; + TKnownCreature *pTVar3; + + pTVar2 = GetCreature(ID); + if (pTVar2 == (TCreature *)0x0) { + this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_08108a40; + } + else { + pTVar1 = pTVar2->FirstKnowingConnection; + if (pTVar1 != (TKnownCreature *)0x0) { + if (pTVar1->Connection == this) { + pTVar1->State = KNOWNCREATURE_FREE; + pTVar2->FirstKnowingConnection = pTVar1->Next; + } + else { + do { + pTVar3 = pTVar1; + pTVar1 = pTVar3->Next; + if (pTVar1 == (TKnownCreature *)0x0) { + this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_081089c0; + goto LAB_080cbe0d; + } + } while (pTVar1->Connection != this); + pTVar1->State = KNOWNCREATURE_FREE; + pTVar3->Next = pTVar1->Next; + } + return; + } + this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_08108a00; + } +LAB_080cbe0d: + error((char *)this); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TConnection * AssignFreeConnection(void) + +{ + int i; + int iVar1; + __pid_t _Var2; + TConnection *pTVar3; + + pTVar3 = Connections; + Semaphore::down(&ConnectionMutex); + iVar1 = 0; + do { + if (pTVar3->State == CONNECTION_FREE) { + pTVar3->State = CONNECTION_ASSIGNED; + _Var2 = getpid(); + pTVar3->PID = _Var2; + Semaphore::up(&ConnectionMutex); + return pTVar3; + } + iVar1 = iVar1 + 1; + pTVar3 = pTVar3 + 1; + } while (iVar1 < 0x44c); + Semaphore::up(&ConnectionMutex); + return (TConnection *)0x0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TConnection * GetFirstConnection(void) + +{ + TConnection *pTVar1; + + ConnectionIterator = -1; + pTVar1 = (TConnection *)(PlayerDataPool[0x7cd].QuestValues + 0x9a); + do { + ConnectionIterator = ConnectionIterator + 1; + if (pTVar1[1].State != CONNECTION_FREE) { + return pTVar1 + 1; + } + pTVar1 = pTVar1 + 1; + } while (ConnectionIterator < 1099); + return (TConnection *)0x0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +TConnection * GetNextConnection(void) + +{ + TConnection *pTVar1; + + if (ConnectionIterator < 1099) { + pTVar1 = Connections + ConnectionIterator; + do { + ConnectionIterator = ConnectionIterator + 1; + if (pTVar1[1].State != CONNECTION_FREE) { + return pTVar1 + 1; + } + pTVar1 = pTVar1 + 1; + } while (ConnectionIterator < 1099); + } + return (TConnection *)0x0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessConnections(void) + +{ + TConnection *Connection; + TConnection *this; + TConnection *pTVar1; + + this = GetFirstConnection(); +joined_r0x080cbf6d: + do { + if (this == (TConnection *)0x0) { + return; + } + TConnection::Process(this); + if (ConnectionIterator < 1099) { + pTVar1 = Connections + ConnectionIterator; + do { + this = pTVar1 + 1; + ConnectionIterator = ConnectionIterator + 1; + if (pTVar1[1].State != CONNECTION_FREE) goto joined_r0x080cbf6d; + pTVar1 = this; + } while (ConnectionIterator < 1099); + } + this = (TConnection *)0x0; + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitConnections(void) + +{ + CONNECTIONSTATE *pCVar1; + + pCVar1 = &Connections[0].State; + do { + *pCVar1 = CONNECTION_FREE; + pCVar1 = pCVar1 + 0x147e; + } while ((int)pCVar1 < 0xa67ef89); + FirstSendingConnection = (TConnection *)0x0; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitConnections(void) + +{ + return; +} + + + +void __tcf_0(void *param_1) + +{ + int unaff_EBX; + TConnection **ppTVar1; + + for (ppTVar1 = &FirstSendingConnection; (TConnection *)ppTVar1 != Connections; + ppTVar1 = (TConnection **)((int)ppTVar1 + -0x51f8)) { + TXTEASymmetricKey::~TXTEASymmetricKey + (&((TConnection *)((int)ppTVar1 + -0x51f8))->SymmetricKey,unaff_EBX); + } + return; +} + + + +void __tcf_1(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&ConnectionMutex,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_Connections(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +bool BeginSendData(TConnection *Connection) + +{ + bool bVar1; + + bVar1 = false; + if (Connection != (TConnection *)0x0) { + bVar1 = false; + if ((Connection->State - CONNECTION_LOGIN < 4) && + (bVar1 = false, Connection->State != CONNECTION_LOGIN)) { + if (Connection->NextToCommit == Connection->NextToSend + 0x4000) { + bVar1 = false; + TConnection::GetSocket(Connection); + print(); + } + else { + Connection->NextToWrite = Connection->NextToCommit; + bVar1 = true; + Connection->Overflow = false; + } + } + } + return bVar1; +} + + + +void FinishSendData(TConnection *Connection) + +{ + if (Connection == (TConnection *)0x0) { + Connection = (TConnection *)s_FinishSendData__Verbindung_ist_N_08108b60; + } + else { + if (Connection->State - CONNECTION_LOGIN < 4) { + if (Connection->Overflow == false) { + Connection->NextToCommit = Connection->NextToWrite; + if (Connection->WillingToSend == false) { + Connection->NextSendingConnection = FirstSendingConnection; + FirstSendingConnection = Connection; + Connection->WillingToSend = true; + } + } + else { + print(); + } + return; + } + Connection = (TConnection *)s_FinishSendData__Verbindung_ist_n_08108b20; + } + error((char *)Connection); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendAll(void) + +{ + TConnection **ppTVar1; + pid_t __pid; + TConnection *Connection; + TConnection *this; + + this = FirstSendingConnection; + if (FirstSendingConnection != (TConnection *)0x0) { + do { + if (this->WillingToSend == false) { + error("SendAll: Verbindung ist nicht sendewillig.\n"); + } + else { + this->WillingToSend = false; + if ((this->State - CONNECTION_LOGIN < 4) && (this->NextToSend != this->NextToCommit) + ) { + __pid = TConnection::GetPID(this); + kill(__pid,0xc); + } + } + ppTVar1 = &this->NextSendingConnection; + this = *ppTVar1; + } while (*ppTVar1 != (TConnection *)0x0); + } + FirstSendingConnection = (TConnection *)0x0; + return; +} + + + +void SkipFlush(TConnection *Connection) + +{ + int iVar1; + int iVar2; + + if (Skip != -1) { + do { + if (Skip < 0x100) { + iVar1 = Connection->NextToSend; + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar1 + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = (uchar)Skip; + iVar2 = iVar2 + 1; + Connection->NextToWrite = iVar2; + } + else { + Connection->Overflow = true; + } + if (iVar2 < iVar1 + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 0xff; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + Skip = -1; + } + else { + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 0xff; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 0xff; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + Skip = Skip + -0x100; + } + } while (-1 < Skip); + } + return; +} + + + +void SendMapObject(TConnection *Connection,Object *Obj) + +{ + undefined2 uVar1; + ushort uVar2; + bool bVar3; + uchar uVar4; + TPlayer *this; + KNOWNCREATURESTATE KVar5; + int iVar6; + uint uVar7; + TPlayer *pTVar8; + ulong uVar9; + size_t Length; + char *pcVar10; + int iVar11; + uint uVar12; + int iVar13; + char *s; + uint uVar14; + char *__s; + char *pcVar15; + uchar local_74; + uchar local_4c; + uchar local_44 [4]; + int HelpBrightness; + int HelpColor; + Object local_2c [7]; + + bVar3 = Object::exists(Obj); + if (!bVar3) { + pcVar15 = &DAT_08108be0; +LAB_080cc3ff: + error(pcVar15); + return; + } + Object::getObjectType(local_2c); + if (local_2c[0].ObjectID != 99) { + local_2c[0] = (Object)Obj->ObjectID; + Object::getObjectType((Object *)&HelpColor); + bVar3 = ObjectType::getFlag((ObjectType *)&HelpColor,DISGUISE); + if (bVar3) { + Object::getObjectType((Object *)&HelpColor); + uVar9 = ObjectType::getAttribute((ObjectType *)&HelpColor,DISGUISETARGET); + HelpColor._0_2_ = (undefined2)uVar9; + } + else { + Object::getObjectType((Object *)&HelpColor); + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)(undefined2)HelpColor; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)HelpColor >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType((Object *)&HelpColor); + bVar3 = ObjectType::getFlag((ObjectType *)&HelpColor,LIQUIDCONTAINER); + if (bVar3) { + uVar9 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + uVar4 = GetLiquidColor(uVar9); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType((Object *)&HelpColor); + bVar3 = ObjectType::getFlag((ObjectType *)&HelpColor,LIQUIDPOOL); + if (bVar3) { + uVar9 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + uVar4 = GetLiquidColor(uVar9); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType((Object *)&HelpColor); + bVar3 = ObjectType::getFlag((ObjectType *)&HelpColor,CUMULATIVE); + if (!bVar3) { + return; + } + uVar9 = Object::getAttribute(Obj,AMOUNT); + iVar6 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar6) { + Connection->Overflow = true; + return; + } + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar9; +LAB_080cce56: + Connection->NextToWrite = iVar6 + 1; + return; + } + local_2c[0] = (Object)Obj->ObjectID; + this = (TPlayer *)GetCreature(local_2c); + if (this == (TPlayer *)0x0) { + pcVar15 = "SendMapObject: Kreatur hat kein Kreatur-Objekt\n"; + goto LAB_080cc3ff; + } + KVar5 = TConnection::KnownCreature(Connection,(this->super_TCreature).ID,true); + if (KVar5 == KNOWNCREATURE_UPTODATE) { + iVar11 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 'c'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = '\0'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + uVar9 = (this->super_TCreature).ID; + if (iVar6 < iVar11 + 0x3ffd) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar9; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 8); + uVar12 = iVar6 + 2; + uVar7 = iVar6 + 0x4001; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 0x10); + uVar12 = iVar6 + 3; + uVar7 = iVar6 + 0x4002; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 0x18); + iVar6 = iVar6 + 4; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar11 + 0x4000 <= iVar6) { + Connection->Overflow = true; + return; + } + Connection->OutData[iVar6 % 0x4000] = (uchar)(this->super_TCreature).Direction; + goto LAB_080cce56; + } + if (1 < (int)KVar5) { + if (KVar5 != KNOWNCREATURE_OUTDATED) { + return; + } + iVar11 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + iVar13 = iVar6 % 0x4000; + iVar6 = iVar6 + 1; + Connection->OutData[iVar13] = 'b'; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = '\0'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + uVar9 = (this->super_TCreature).ID; + if (iVar6 < iVar11 + 0x3ffd) { + uVar12 = iVar6 + 1; + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar9; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 8); + uVar12 = iVar6 + 2; + uVar7 = iVar6 + 0x4001; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 0x10); + uVar12 = iVar6 + 3; + uVar7 = iVar6 + 0x4002; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar9 >> 0x18); + Connection->NextToWrite = iVar6 + 4; + } + else { + Connection->Overflow = true; + } + iVar6 = TCreature::GetHealth((TCreature *)this); + uVar4 = (uchar)iVar6; + iVar6 = Connection->NextToSend; + goto LAB_080cc4e9; + } + if (KVar5 != KNOWNCREATURE_FREE) { + return; + } + iVar11 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + iVar13 = iVar6 % 0x4000; + iVar6 = iVar6 + 1; + Connection->OutData[iVar13] = 'a'; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = '\0'; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + uVar9 = TConnection::NewKnownCreature(Connection,(this->super_TCreature).ID); + iVar11 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x3ffd) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar9; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 8); + uVar12 = iVar6 + 2; + uVar7 = iVar6 + 0x4001; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 0x10) + ; + uVar12 = iVar6 + 3; + uVar7 = iVar6 + 0x4002; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + iVar6 = iVar6 + 4; + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 0x18) + ; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + uVar9 = (this->super_TCreature).ID; + if (iVar6 < iVar11 + 0x3ffd) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar9; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 8); + uVar12 = iVar6 + 2; + uVar7 = iVar6 + 0x4001; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 0x10) + ; + uVar12 = iVar6 + 3; + uVar7 = iVar6 + 0x4002; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = (char)(uVar9 >> 0x18) + ; + Connection->NextToWrite = iVar6 + 4; + } + else { + Connection->Overflow = true; + } + if ((this->super_TCreature).Type == MONSTER) { + pcVar15 = (this->super_TCreature).Name; + pcVar10 = strchr(pcVar15,0x20); + __s = pcVar10 + 1; + if (pcVar10 == (char *)0x0) { + __s = pcVar15; + } + if (__s == (char *)0x0) goto LAB_080ccb5e; + Length = strlen(__s); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + local_4c = (uchar)(Length & 0xffff); + Connection->OutData[iVar6 % 0x4000] = local_4c; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + local_4c = (uchar)((Length & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = local_4c; + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } +joined_r0x080ccbc6: + if (0 < (int)Length) { + SendText(Connection,__s,Length); + } + } + else { + __s = (this->super_TCreature).Name; + if (__s != (char *)0x0) { + Length = strlen(__s); + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x3fff) { + local_74 = (uchar)(Length & 0xffff); + Connection->OutData[iVar6 % 0x4000] = local_74; + uVar12 = iVar6 + 1; + uVar7 = iVar6 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + local_74 = (uchar)((Length & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = local_74; + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + goto joined_r0x080ccbc6; + } +LAB_080ccb5e: + error("SendString: String ist NULL.\n"); + } + iVar6 = TCreature::GetHealth((TCreature *)this); + uVar4 = (uchar)iVar6; + iVar6 = Connection->NextToSend; +LAB_080cc4e9: + iVar11 = Connection->NextToWrite; + if (iVar11 < iVar6 + 0x4000) { + Connection->OutData[iVar11 % 0x4000] = uVar4; + iVar11 = iVar11 + 1; + Connection->NextToWrite = iVar11; + } + else { + Connection->Overflow = true; + } + if (iVar11 < iVar6 + 0x4000) { + Connection->OutData[iVar11 % 0x4000] = (uchar)(this->super_TCreature).Direction; + iVar11 = iVar11 + 1; + Connection->NextToWrite = iVar11; + } + else { + Connection->Overflow = true; + } + uVar1 = (undefined2)(this->super_TCreature).Outfit.OutfitID; + if (iVar11 < iVar6 + 0x3fff) { + Connection->OutData[iVar11 % 0x4000] = (uchar)uVar1; + uVar12 = iVar11 + 1; + uVar7 = iVar11 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + Connection->NextToWrite = iVar11 + 2; + } + else { + Connection->Overflow = true; + } + if ((this->super_TCreature).Outfit.OutfitID == 0) { + uVar2 = (this->super_TCreature).Outfit.field_1.ObjectType; + iVar11 = Connection->NextToWrite; + if (iVar11 < iVar6 + 0x3fff) { + uVar12 = iVar11 + 1; + Connection->OutData[iVar11 % 0x4000] = (uchar)uVar2; + uVar7 = iVar11 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + *(char *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806) = + (char)(uVar2 >> 8); + Connection->NextToWrite = iVar11 + 2; + } + else { + Connection->Overflow = true; + } + } + else { + SendText(Connection,(char *)(this->super_TCreature).Outfit.field_1.Colors,4); + } + GetCreatureLight((this->super_TCreature).ID,(int *)local_44,&HelpBrightness); + iVar11 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = local_44[0]; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)HelpBrightness; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + uVar7 = TCreature::GetSpeed((TCreature *)this); + iVar6 = Connection->NextToWrite; + iVar11 = Connection->NextToSend; + if (iVar6 < iVar11 + 0x3fff) { + local_74 = (uchar)(uVar7 & 0xffff); + Connection->OutData[iVar6 % 0x4000] = local_74; + uVar14 = iVar6 + 1; + uVar12 = iVar6 + 0x4000; + if (-1 < (int)uVar14) { + uVar12 = uVar14; + } + local_74 = (uchar)((uVar7 & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar14 - (uVar12 & 0xffffc000)) + 0x806) = local_74; + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + if ((this->super_TCreature).Type == PLAYER) { + pTVar8 = TConnection::GetPlayer(Connection); + iVar6 = TPlayer::GetPlayerkillingMark(this,pTVar8); + uVar4 = (uchar)iVar6; + iVar11 = Connection->NextToSend; + } + else { + uVar4 = '\0'; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + if ((this->super_TCreature).Type == PLAYER) { + pTVar8 = TConnection::GetPlayer(Connection); + iVar6 = TPlayer::GetPartyMark(this,pTVar8); + uVar4 = (uchar)iVar6; + iVar11 = Connection->NextToSend; + } + else { + uVar4 = '\0'; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar11 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendMapPoint(void) + +{ + int Count; + int iVar1; + TConnection *in_stack_00000004; + Object local_4c [4]; + Object local_3c [4]; + ulong local_2c; + Object Obj; + + GetFirstObject(); + local_3c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + iVar1 = 0; + SkipFlush(in_stack_00000004); + if (local_2c != NONE.ObjectID) { + do { + iVar1 = iVar1 + 1; + local_4c[0].ObjectID = local_2c; + local_3c[0].ObjectID = NONE.ObjectID; + SendMapObject(in_stack_00000004,local_4c); + Object::getNextObject(local_3c); + local_2c = local_3c[0].ObjectID; + if (iVar1 == 10) break; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + Skip = Skip + 1; + return; +} + + + +void SendResult(TConnection *Connection,RESULT r) + +{ + int iVar1; + bool bVar2; + TPlayer *pTVar3; + char *pcVar4; + + if (Connection == (TConnection *)0x0) { + return; + } + switch(r) { + case NOERROR: + Connection = (TConnection *)s_SendResult__NOERROR_08109aa1; + goto LAB_080cd2ea; + case NOTACCESSIBLE: + pcVar4 = "Sorry, not possible."; + break; + case NOTMOVABLE: + pcVar4 = "You cannot move this object."; + break; + case NOTTAKABLE: + pcVar4 = "You cannot take this object."; + break; + case NOROOM: + pcVar4 = "There is not enough room."; + break; + case OUTOFRANGE: + pcVar4 = "Destination is out of range."; + break; + case OUTOFHOME: + Connection = (TConnection *)s_SendResult__OUTOFHOME_08109b3c; + goto LAB_080cd2ea; + case CANNOTTHROW: + pcVar4 = "You cannot throw there."; + break; + case TOOHEAVY: + pcVar4 = "This object is too heavy."; + break; + case CROSSREFERENCE: + pcVar4 = "This is impossible."; + break; + case CONTAINERFULL: + pcVar4 = "You cannot put more objects in this container."; + break; + case WRONGPOSITION: + pcVar4 = "Put this object in your hand."; + break; + case WRONGPOSITION2: + pcVar4 = "Put this object in both hands."; + break; + case WRONGCLOTHES: + pcVar4 = "You cannot dress this object there."; + break; + case HANDSNOTFREE: + pcVar4 = "Both hands have to be free."; + break; + case HANDBLOCKED: + pcVar4 = "Drop the double-handed object first."; + break; + case ONEWEAPONONLY: + pcVar4 = "You may only use one weapon."; + break; + case NOMATCH: + Connection = (TConnection *)s_SendResult__NOMATCH_08109bf0; + goto LAB_080cd2ea; + case NOTCUMULABLE: + Connection = (TConnection *)s_SendResult__NOTCUMULABLE_08109c05; + goto LAB_080cd2ea; + case TOOMANYPARTS: + Connection = (TConnection *)s_SendResult__TOOMANYPARTS_08109c1f; + goto LAB_080cd2ea; + case EMPTYCONTAINER: + Connection = (TConnection *)s_SendResult__EMPTYCONTAINER_08109c39; + goto LAB_080cd2ea; + case SPLITOBJECT: + Connection = (TConnection *)s_SendResult__SPLITOBJECT_08109c55; + goto LAB_080cd2ea; + case NOKEYMATCH: + pcVar4 = "The key does not match."; + break; + case UPSTAIRS: + pcVar4 = "First go upstairs."; + break; + case DOWNSTAIRS: + pcVar4 = "First go downstairs."; + break; + case CREATURENOTEXISTING: + pcVar4 = "A creature with this name does not exist."; + break; + case PLAYERNOTEXISTING: + pcVar4 = "A player with this name does not exist."; + break; + case PLAYERNOTONLINE: + pcVar4 = "A player with this name is not online."; + break; + case NAMEAMBIGUOUS: + pcVar4 = "Playername is ambiguous."; + break; + case NOTUSABLE: + pcVar4 = "You cannot use this object."; + break; + case FEDUP: + pcVar4 = "You are full."; + break; + case SPELLUNKNOWN: + pcVar4 = "You must learn this spell first."; + break; + case LOWMAGICLEVEL: + pcVar4 = "Your magic level is too low."; + break; + case MAGICITEM: + pcVar4 = "A magic item is necessary to cast this spell."; + break; + case NOTENOUGHMANA: + pcVar4 = "You do not have enough mana."; + break; + case NOSKILL: + Connection = (TConnection *)s_SendResult__NOSKILL_08109d2b; + goto LAB_080cd2ea; + case TARGETLOST: + pcVar4 = "Target lost."; + break; + case NOCREATURE: + pcVar4 = "You can only use this rune on creatures."; + break; + case TOOLONG: + Connection = (TConnection *)s_SendResult__TOOLONG_08109d4d; +LAB_080cd2ea: + error((char *)Connection); + return; + case ATTACKNOTALLOWED: + pcVar4 = "You may not attack this person."; + break; + case NOWAY: + pcVar4 = "There is no way."; + break; + case LOGINERROR: + pcVar4 = "An error occured while logging in."; + break; + case PROTECTIONZONE: + pcVar4 = "This action is not permitted in a protection zone."; + break; + case ENTERPROTECTIONZONE: + pcVar4 = "Characters who attacked other players may not enter a protection zone."; + goto LAB_080cd511; + case EXHAUSTED: + pcVar4 = "You are exhausted."; + break; + case NOTINVITED: + pcVar4 = "You are not invited."; + goto LAB_080cd511; + case NOPREMIUMACCOUNT: + pcVar4 = "You need a premium account."; + break; + case MOVENOTPOSSIBLE: + pcVar4 = "Sorry, not possible."; +LAB_080cd511: + SendMessage(Connection,0x17,pcVar4); + bVar2 = BeginSendData(Connection); + if (!bVar2) { + return; + } + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = 0xb5; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 == (TPlayer *)0x0) { + return; + } + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)(pTVar3->super_TCreature).Direction; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + case ALREADYTRADING: + pcVar4 = "You are already trading. Finish this trade first."; + break; + case PARTNERTRADING: + pcVar4 = "This person is already trading."; + break; + case TOOMANYOBJECTS: + pcVar4 = "You can only trade up to 100 objects at one time."; + break; + case TOOMANYSLAVES: + pcVar4 = "You cannot control more creatures."; + break; + case NOTTURNABLE: + pcVar4 = "You cannot turn this object."; + break; + case SECUREMODE: + pcVar4 = "Turn secure mode off if you really want to attack unmarked players."; + break; + case NOTENOUGHSOULPOINTS: + pcVar4 = "You do not have enough soulpoints."; + break; + case LOWLEVEL: + pcVar4 = "Your level is too low."; + break; + default: + goto switchD_080cd2dc_caseD_ffffffff; + } + SendMessage(Connection,0x17,pcVar4); +switchD_080cd2dc_caseD_ffffffff: + return; +} + + + +// WARNING: Variable defined which should be unmapped: Color + +void SendRefresh(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + int iVar3; + uchar local_18 [4]; + int Brightness; + int Color; + + SendFullScreen(Connection); + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0x82; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + GetAmbiente((int *)local_18,&Brightness); + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = local_18[0]; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)Brightness; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + SendPlayerData(Connection); + SendPlayerSkills(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: id_local + +void __regparm2 SendInitGame(TConnection *Connection,ulong id) + +{ + int iVar1; + undefined2 uVar2; + bool bVar3; + int iVar4; + uint uVar5; + uint uVar6; + TConnection *in_stack_00000004; + ulong in_stack_00000008; + uchar local_14; + ulong id_local; + + bVar3 = BeginSendData(in_stack_00000004); + if (bVar3) { + iVar1 = in_stack_00000004->NextToSend; + iVar4 = in_stack_00000004->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + in_stack_00000004->OutData[iVar4 % 0x4000] = '\n'; + iVar4 = iVar4 + 1; + in_stack_00000004->NextToWrite = iVar4; + } + else { + in_stack_00000004->Overflow = true; + } + if (iVar4 < iVar1 + 0x3ffd) { + uVar6 = iVar4 + 1; + local_14 = (uchar)in_stack_00000008; + in_stack_00000004->OutData[iVar4 % 0x4000] = local_14; + uVar5 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar5 = uVar6; + } + *(char *)((int)in_stack_00000004 + (uVar6 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(in_stack_00000008 >> 8); + uVar6 = iVar4 + 2; + uVar5 = iVar4 + 0x4001; + if (-1 < (int)uVar6) { + uVar5 = uVar6; + } + *(char *)((int)in_stack_00000004 + (uVar6 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(in_stack_00000008 >> 0x10); + uVar6 = iVar4 + 3; + uVar5 = iVar4 + 0x4002; + if (-1 < (int)uVar6) { + uVar5 = uVar6; + } + *(char *)((int)in_stack_00000004 + (uVar6 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(in_stack_00000008 >> 0x18); + iVar4 = iVar4 + 4; + in_stack_00000004->NextToWrite = iVar4; + } + else { + in_stack_00000004->Overflow = true; + } + uVar2 = (undefined2)Beat; + if (iVar4 < iVar1 + 0x3fff) { + uVar6 = iVar4 + 1; + in_stack_00000004->OutData[iVar4 % 0x4000] = (uchar)(undefined2)Beat; + uVar5 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar5 = uVar6; + } + *(char *)((int)in_stack_00000004 + (uVar6 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar2 >> 8); + in_stack_00000004->NextToWrite = iVar4 + 2; + } + else { + in_stack_00000004->Overflow = true; + } + bVar3 = CheckRight(in_stack_00000008,SEND_BUGREPORTS); + iVar4 = in_stack_00000004->NextToWrite; + if (iVar4 < in_stack_00000004->NextToSend + 0x4000) { + in_stack_00000004->OutData[iVar4 % 0x4000] = bVar3; + in_stack_00000004->NextToWrite = iVar4 + 1; + } + else { + in_stack_00000004->Overflow = true; + } + FinishSendData(in_stack_00000004); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Connection_local + +void __regparm2 SendRights(TConnection *Connection) + +{ + bool bVar1; + bool bVar2; + TPlayer *pTVar3; + int Action; + int iVar4; + int Reason; + int Actions; + uint uVar5; + TConnection *in_stack_00000004; + RIGHT local_20; + int Right; + bool SendIt; + TPlayer *pl; + TConnection *Connection_local; + + bVar1 = BeginSendData(in_stack_00000004); + if (bVar1) { + iVar4 = in_stack_00000004->NextToWrite; + if (iVar4 < in_stack_00000004->NextToSend + 0x4000) { + in_stack_00000004->OutData[iVar4 % 0x4000] = '\v'; + in_stack_00000004->NextToWrite = iVar4 + 1; + } + else { + in_stack_00000004->Overflow = true; + } + pTVar3 = TConnection::GetPlayer(in_stack_00000004); + bVar1 = false; + local_20 = NAME_INSULTING; + do { + bVar2 = CheckRight((pTVar3->super_TCreature).ID,local_20); + uVar5 = 0; + if (bVar2) { + iVar4 = 0; + uVar5 = 0; + do { + bVar2 = CheckBanishmentRight + ((pTVar3->super_TCreature).ID,local_20 - NAME_INSULTING,iVar4) + ; + if (bVar2) { + uVar5 = uVar5 | 1 << ((byte)iVar4 & 0x1f); + } + iVar4 = iVar4 + 1; + } while (iVar4 < 7); + if (uVar5 != 0) { + bVar2 = CheckRight((pTVar3->super_TCreature).ID,IP_BANISHMENT); + if (bVar2) { + uVar5 = uVar5 | 0x80; + } + } + } + iVar4 = in_stack_00000004->NextToWrite; + if (iVar4 < in_stack_00000004->NextToSend + 0x4000) { + in_stack_00000004->OutData[iVar4 % 0x4000] = (uchar)uVar5; + in_stack_00000004->NextToWrite = iVar4 + 1; + } + else { + in_stack_00000004->Overflow = true; + } + if (uVar5 != 0) { + bVar1 = true; + } + local_20 = local_20 + NOTATION; + } while ((int)local_20 < 0x32); + if (bVar1) { + FinishSendData(in_stack_00000004); + return; + } + } + return; +} + + + +void SendPing(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = '\x1e'; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +void SendFullScreen(TConnection *Connection) + +{ + bool bVar1; + int iVar2; + uint uVar3; + uint uVar4; + int y; + int iVar5; + int iVar6; + int z_1; + int z; + int iVar7; + int local_30; + int local_2c; + int x_1; + int x; + int sy; + int sx; + int posx; + int posy; + int posz; + + bVar1 = BeginSendData(Connection); + if (bVar1) { + iVar7 = Connection->NextToWrite; + if (iVar7 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar7 % 0x4000] = 'd'; + Connection->NextToWrite = iVar7 + 1; + } + else { + Connection->Overflow = true; + } + TConnection::GetPosition(Connection,&sx,&posx,&posy); + iVar2 = Connection->NextToSend; + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar2 + 0x3fff) { + Connection->OutData[iVar7 % 0x4000] = (uchar)(undefined2)sx; + uVar4 = iVar7 + 1; + uVar3 = iVar7 + 0x4000; + if (-1 < (int)uVar4) { + uVar3 = uVar4; + } + *(char *)((int)Connection + (uVar4 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)sx >> 8); + iVar7 = iVar7 + 2; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar2 + 0x3fff) { + uVar4 = iVar7 + 1; + Connection->OutData[iVar7 % 0x4000] = (uchar)(undefined2)posx; + uVar3 = iVar7 + 0x4000; + if (-1 < (int)uVar4) { + uVar3 = uVar4; + } + *(char *)((int)Connection + (uVar4 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)posx >> 8); + iVar7 = iVar7 + 2; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar2 + 0x4000) { + Connection->OutData[iVar7 % 0x4000] = (uchar)posy; + Connection->NextToWrite = iVar7 + 1; + } + else { + Connection->Overflow = true; + } + Skip = -1; + if (posy < 8) { + iVar7 = 7; + local_30 = Connection->TerminalWidth; + do { + x_1 = 0; + if (0 < local_30) { + iVar2 = Connection->TerminalHeight; + do { + iVar5 = 0; + if (0 < iVar2) { + do { + iVar5 = iVar5 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalHeight; + } while (iVar5 < iVar2); + local_30 = Connection->TerminalWidth; + } + x_1 = x_1 + 1; + } while (x_1 < local_30); + } + iVar7 = iVar7 + -1; + } while (-1 < iVar7); + } + else { + iVar7 = posy + -2; + if ((iVar7 <= posy + 2) && (iVar7 < 0x10)) { + local_30 = Connection->TerminalWidth; + iVar2 = posy; + do { + local_2c = 0; + if (0 < local_30) { + iVar5 = Connection->TerminalHeight; + do { + iVar6 = 0; + if (0 < iVar5) { + do { + iVar6 = iVar6 + 1; + SendMapPoint(); + iVar5 = Connection->TerminalHeight; + } while (iVar6 < iVar5); + local_30 = Connection->TerminalWidth; + iVar2 = posy; + } + local_2c = local_2c + 1; + } while (local_2c < local_30); + } + iVar7 = iVar7 + 1; + } while ((iVar7 <= iVar2 + 2) && (iVar7 < 0x10)); + } + } + SkipFlush(Connection); + FinishSendData(Connection); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +void SendRow(TConnection *Connection,int Direction) + +{ + bool bVar1; + int iVar2; + int iVar3; + int z; + int iVar4; + int local_2c; + int end; + int dz; + int sy; + int sx; + int posx; + int posy; + int posz; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + if (Direction == 1) { + iVar4 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar4) goto LAB_080cdfdc; + Connection->OutData[iVar4 % 0x4000] = 'f'; + } + else if (Direction < 2) { + if (Direction != 0) { +LAB_080cdfab: + error(&DAT_08109140,Direction); + return; + } + iVar4 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar4) goto LAB_080cdfdc; + Connection->OutData[iVar4 % 0x4000] = 'e'; + } + else if (Direction == 2) { + iVar4 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar4) { +LAB_080cdfdc: + Connection->Overflow = true; + goto LAB_080cdfe3; + } + Connection->OutData[iVar4 % 0x4000] = 'g'; + } + else { + if (Direction != 3) goto LAB_080cdfab; + iVar4 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar4) goto LAB_080cdfdc; + Connection->OutData[iVar4 % 0x4000] = 'h'; + } + Connection->NextToWrite = iVar4 + 1; +LAB_080cdfe3: + TConnection::GetPosition(Connection,&sx,&posx,&posy); + Skip = -1; + if (posy < 8) { + end = -1; + iVar4 = 7; + local_2c = -1; + } + else { + end = 1; + iVar4 = posy + -2; + local_2c = 0x10; + if (posy + 3 < 0x11) { + local_2c = posy + 3; + } + } + if (Direction == 1) { + if (iVar4 != local_2c) { + iVar2 = Connection->TerminalHeight; + do { + iVar3 = 0; + if (0 < iVar2) { + do { + iVar3 = iVar3 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalHeight; + } while (iVar3 < iVar2); + } + iVar4 = iVar4 + end; + } while (iVar4 != local_2c); + } + } + else if (Direction < 2) { + if ((Direction == 0) && (iVar4 != local_2c)) { + iVar2 = Connection->TerminalWidth; + do { + iVar3 = 0; + if (0 < iVar2) { + do { + iVar3 = iVar3 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalWidth; + } while (iVar3 < iVar2); + } + iVar4 = iVar4 + end; + } while (iVar4 != local_2c); + } + } + else if (Direction == 2) { + if (iVar4 != local_2c) { + iVar2 = Connection->TerminalWidth; + do { + iVar3 = 0; + if (0 < iVar2) { + do { + iVar3 = iVar3 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalWidth; + } while (iVar3 < iVar2); + } + iVar4 = iVar4 + end; + } while (iVar4 != local_2c); + } + } + else if ((Direction == 3) && (iVar4 != local_2c)) { + iVar2 = Connection->TerminalHeight; + do { + iVar3 = 0; + if (0 < iVar2) { + do { + iVar3 = iVar3 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalHeight; + } while (iVar3 < iVar2); + } + iVar4 = iVar4 + end; + } while (iVar4 != local_2c); + } + SkipFlush(Connection); + FinishSendData(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +void SendFloors(TConnection *Connection,bool Up) + +{ + bool bVar1; + int iVar2; + int iVar3; + int iVar4; + int z; + int iVar5; + int local_30; + int x; + int sy; + int sx; + int dz; + int end; + int posx; + int posy; + int posz; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + iVar5 = Connection->NextToWrite; + if (iVar5 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar5 % 0x4000] = !Up + 0xbe; + Connection->NextToWrite = iVar5 + 1; + } + else { + Connection->Overflow = true; + } + TConnection::GetPosition(Connection,&end,&posx,&posy); + if (Up) { + if (7 < posy) { + sx = -1; + iVar5 = posy + -2; + dz = posy + -3; + goto LAB_080ce3a4; + } + if (posy != 7) goto LAB_080ce47c; + sx = -1; + iVar5 = 5; + } + else { + if (8 < posy) { + sx = 1; + iVar5 = posy + 2; + dz = posy + 3; + if (0x10 < iVar5) { + iVar5 = 0x10; + } + if (0x10 < dz) { + dz = 0x10; + } + goto LAB_080ce3a4; + } + if (posy == 8) { + sx = 1; + iVar5 = 8; + dz = 0xb; + goto LAB_080ce3a4; + } +LAB_080ce47c: + sx = 0; + iVar5 = -1; + } + dz = -1; +LAB_080ce3a4: + Skip = -1; + if (iVar5 != dz) { + iVar3 = Connection->TerminalWidth; + do { + local_30 = 0; + if (0 < iVar3) { + iVar2 = Connection->TerminalHeight; + do { + iVar4 = 0; + if (0 < iVar2) { + do { + iVar4 = iVar4 + 1; + SendMapPoint(); + iVar2 = Connection->TerminalHeight; + } while (iVar4 < iVar2); + iVar3 = Connection->TerminalWidth; + } + local_30 = local_30 + 1; + } while (local_30 < iVar3); + } + iVar5 = iVar5 + sx; + } while (iVar5 != dz); + } + SkipFlush(Connection); + FinishSendData(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: x_local + +void __regparm2 SendFieldData(TConnection *Connection,int x,int y,int z) + +{ + int iVar1; + bool bVar2; + uint uVar3; + int iVar4; + uint uVar5; + int iVar6; + undefined4 in_stack_0000000c; + undefined1 in_stack_00000010; + int z_local; + int y_local; + int x_local; + + bVar2 = BeginSendData((TConnection *)y); + if (bVar2) { + iVar1 = *(int *)(y + 0x4808); + iVar4 = *(int *)(y + 0x4810); + if (iVar4 < iVar1 + 0x4000) { + iVar6 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + *(undefined1 *)(y + 0x806 + iVar6) = 0x69; + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(y + 0x806 + iVar4 % 0x4000) = (char)z; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)(y + 0x806 + (uVar5 - (uVar3 & 0xffffc000))) = (char)((uint)z >> 8); + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(y + 0x806 + iVar4 % 0x4000) = (char)in_stack_0000000c; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)(y + 0x806 + (uVar5 - (uVar3 & 0xffffc000))) = + (char)((uint)in_stack_0000000c >> 8); + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(y + 0x806 + iVar4 % 0x4000) = in_stack_00000010; + *(int *)(y + 0x4810) = iVar4 + 1; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + Skip = -1; + SendMapPoint(); + SkipFlush((TConnection *)y); + FinishSendData((TConnection *)y); + return; + } + return; +} + + + +void SendCloseContainer(TConnection *Connection,int ContNr) + +{ + int iVar1; + bool bVar2; + int iVar3; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 'o'; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)ContNr; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +void SendContainer(TConnection *Connection,int ContNr) + +{ + int iVar1; + bool bVar2; + uchar uVar3; + TPlayer *pl; + TPlayer *Window; + ulong uVar4; + char *__s; + size_t Length; + uint uVar5; + int iVar6; + uint uVar7; + undefined2 uVar8; + int *piVar9; + undefined4 uVar10; + int local_6c; + int Count; + int local_60; + Object local_5c [4]; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c; + Object Obj; + + bVar2 = BeginSendData(Connection); + if (!bVar2) { + return; + } + iVar1 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 'n'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)ContNr; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + Window = TConnection::GetPlayer(Connection); + if (Window == (TPlayer *)0x0) { + error(&DAT_081091c0); + return; + } + iVar6 = ContNr; + TPlayer::GetOpenContainer((TPlayer *)&local_2c,(int)Window); + bVar2 = Object::exists(&local_2c); + if (!bVar2) { + error("SendContainer: Container %d existiert nicht.\n",ContNr,iVar6); + return; + } + local_3c[0].ObjectID = local_2c.ObjectID; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,DISGUISE); + if (bVar2) { + Object::getObjectType(local_4c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_4c,DISGUISETARGET); + uVar8 = (undefined2)uVar4; + } + else { + Object::getObjectType(local_4c); + uVar8 = (undefined2)local_4c[0].ObjectID; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar8; + uVar7 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar8 >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType(local_4c); + uVar10 = 0xffffffff; + __s = ObjectType::getName((ObjectType *)local_4c); + if (__s == (char *)0x0) { + error("SendString: String ist NULL.\n",uVar10); + } + else { + Length = strlen(__s); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Count._0_1_ = (uchar)(Length & 0xffff); + Connection->OutData[iVar6 % 0x4000] = (uchar)Count; + uVar7 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + Count._0_1_ = (uchar)((Length & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = (uchar)Count; + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,__s,Length); + } + } + Object::getObjectType(local_4c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_4c,CAPACITY); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + Object::getContainer(local_4c); + Object::getObjectType(local_3c); + if ((_func_int_varargs **)local_3c[0].ObjectID != (_func_int_varargs **)0x0) { + Object::getContainer(local_3c); + Object::getObjectType(local_5c); + bVar2 = false; + if ((0 < (int)local_5c[0].ObjectID) && ((int)local_5c[0].ObjectID < 0xb)) { + bVar2 = true; + } + uVar3 = '\x01'; + if (!bVar2) goto LAB_080ce9df; + } + uVar3 = '\0'; +LAB_080ce9df: + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + local_5c[0].ObjectID = local_2c.ObjectID; + local_60 = CountObjectsInContainer(local_5c); + iVar6 = Connection->NextToWrite; + piVar9 = &OBJECTS_PER_CONTAINER; + if (local_60 < 0x25) { + piVar9 = &local_60; + } + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)*piVar9; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + local_6c = 0; + local_3c[0].ObjectID = local_2c.ObjectID; + GetFirstContainerObject(local_4c); + local_2c.ObjectID = local_4c[0].ObjectID; + while( true ) { + bVar2 = false; + local_5c[0].ObjectID = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if ((local_2c.ObjectID != NONE.ObjectID) && (local_6c < 0x24)) { + bVar2 = true; + } + if (!bVar2) break; + local_5c[0].ObjectID = local_2c.ObjectID; + Object::getObjectType(local_4c); + bVar2 = ObjectType::getFlag((ObjectType *)local_4c,DISGUISE); + if (bVar2) { + Object::getObjectType(local_4c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_4c,DISGUISETARGET); + uVar8 = (undefined2)uVar4; + } + else { + Object::getObjectType(local_4c); + uVar8 = (undefined2)local_4c[0].ObjectID; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar8; + uVar7 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar8 >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDCONTAINER); + if (bVar2) { + uVar4 = Object::getAttribute(&local_2c,CONTAINERLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,LIQUIDPOOL); + if (bVar2) { + uVar4 = Object::getAttribute(&local_2c,POOLLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_5c); + bVar2 = ObjectType::getFlag((ObjectType *)local_5c,CUMULATIVE); + if (bVar2) { + uVar4 = Object::getAttribute(&local_2c,AMOUNT); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getNextObject(local_4c); + local_2c.ObjectID = local_4c[0].ObjectID; + local_6c = local_6c + 1; + } + FinishSendData(Connection); + return; +} + + + +void SendCreateInContainer(TConnection *Connection,int ContNr,Object *Obj) + +{ + int iVar1; + bool bVar2; + uchar uVar3; + ulong uVar4; + uint uVar5; + int iVar6; + uint uVar7; + Object local_3c [4]; + ulong local_2c; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + bVar2 = Object::exists(Obj); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 'p'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)ContNr; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + local_2c = Obj->ObjectID; + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,DISGUISE); + if (bVar2) { + Object::getObjectType(local_3c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_3c,DISGUISETARGET); + local_3c[0].ObjectID._0_2_ = (undefined2)uVar4; + } + else { + Object::getObjectType(local_3c); + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)(undefined2)local_3c[0].ObjectID; + uVar7 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)local_3c[0].ObjectID >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDCONTAINER); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDPOOL); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,AMOUNT); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + FinishSendData(Connection); + } + else { + error(&DAT_08109200); + } + } + return; +} + + + +void SendChangeInContainer(TConnection *Connection,int ContNr,Object *Obj) + +{ + int iVar1; + bool bVar2; + uchar uVar3; + int iVar4; + ulong uVar5; + uint uVar6; + int iVar7; + uint uVar8; + uchar local_40; + int RNum; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + iVar4 = GetObjectRNum(local_2c); + if (iVar4 < 0x24) { + iVar1 = Connection->NextToSend; + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar1 + 0x4000) { + Connection->OutData[iVar7 % 0x4000] = 'q'; + iVar7 = iVar7 + 1; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar1 + 0x4000) { + Connection->OutData[iVar7 % 0x4000] = (uchar)ContNr; + iVar7 = iVar7 + 1; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar1 + 0x4000) { + local_40 = (uchar)iVar4; + Connection->NextToWrite = iVar7 + 1; + Connection->OutData[iVar7 % 0x4000] = local_40; + } + else { + Connection->Overflow = true; + } + local_2c[0] = (Object)Obj->ObjectID; + Object::getObjectType((Object *)&RNum); + bVar2 = ObjectType::getFlag((ObjectType *)&RNum,DISGUISE); + if (bVar2) { + Object::getObjectType((Object *)&RNum); + uVar5 = ObjectType::getAttribute((ObjectType *)&RNum,DISGUISETARGET); + RNum._0_2_ = (undefined2)uVar5; + } + else { + Object::getObjectType((Object *)&RNum); + } + iVar4 = Connection->NextToWrite; + if (iVar4 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(undefined2)RNum; + uVar8 = iVar4 + 1; + uVar6 = iVar4 + 0x4000; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)RNum >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType((Object *)&RNum); + bVar2 = ObjectType::getFlag((ObjectType *)&RNum,LIQUIDCONTAINER); + if (bVar2) { + uVar5 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar5); + iVar4 = Connection->NextToWrite; + if (iVar4 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = uVar3; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType((Object *)&RNum); + bVar2 = ObjectType::getFlag((ObjectType *)&RNum,LIQUIDPOOL); + if (bVar2) { + uVar5 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar5); + iVar4 = Connection->NextToWrite; + if (iVar4 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = uVar3; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType((Object *)&RNum); + bVar2 = ObjectType::getFlag((ObjectType *)&RNum,CUMULATIVE); + if (bVar2) { + uVar5 = Object::getAttribute(Obj,AMOUNT); + iVar4 = Connection->NextToWrite; + if (iVar4 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)uVar5; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + } + FinishSendData(Connection); + } + } + else { + error(&DAT_08109240); + } + } + return; +} + + + +void SendDeleteInContainer(TConnection *Connection,int ContNr,Object *Obj) + +{ + int iVar1; + bool bVar2; + int iVar3; + int iVar4; + int RNum; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + iVar3 = GetObjectRNum(local_2c); + if (iVar3 < 0x24) { + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 'r'; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)ContNr; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)iVar3; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + } + else { + error(&DAT_08109280); + } + } + return; +} + + + +void SendBodyInventory(TConnection *Connection,ulong CreatureID) + +{ + int Position; + int Position_00; + Object local_4c [4]; + ulong local_3c; + ulong local_2c; + Object Obj; + + Position_00 = 1; + do { + GetBodyObject((ulong)&local_2c,CreatureID); + local_3c = NONE.ObjectID; + local_4c[0].ObjectID = NONE.ObjectID; + if (local_2c != NONE.ObjectID) { + local_4c[0].ObjectID = local_2c; + SendSetInventory(Connection,Position_00,local_4c); + } + Position_00 = Position_00 + 1; + } while (Position_00 < 0xb); + return; +} + + + +void SendSetInventory(TConnection *Connection,int Position,Object *Obj) + +{ + int iVar1; + bool bVar2; + uchar uVar3; + ulong uVar4; + uint uVar5; + int iVar6; + uint uVar7; + Object local_3c [4]; + ulong local_2c; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 'x'; + iVar6 = iVar6 + 1; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar1 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)Position; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c = Obj->ObjectID; + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,DISGUISE); + if (bVar2) { + Object::getObjectType(local_3c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_3c,DISGUISETARGET); + local_3c[0].ObjectID._0_2_ = (undefined2)uVar4; + } + else { + Object::getObjectType(local_3c); + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)(undefined2)local_3c[0].ObjectID; + uVar7 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)local_3c[0].ObjectID >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDCONTAINER); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDPOOL); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = uVar3; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,AMOUNT); + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar4; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + } + FinishSendData(Connection); + } + else { + error("SendSetInventory: Objekt existiert nicht.\n"); + } + } + return; +} + + + +void SendDeleteInventory(TConnection *Connection,int Position) + +{ + int iVar1; + bool bVar2; + int iVar3; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 'y'; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)Position; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +void SendTradeObjects(TConnection *Connection,Object *Obj) + +{ + int iVar1; + bool bVar2; + uchar uVar3; + ulong uVar4; + uint uVar5; + uint uVar6; + Object local_4c [4]; + Object local_3c [4]; + Object local_2c [7]; + + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,DISGUISE); + if (bVar2) { + Object::getObjectType(local_3c); + uVar4 = ObjectType::getAttribute((ObjectType *)local_3c,DISGUISETARGET); + local_3c[0].ObjectID._0_2_ = (undefined2)uVar4; + } + else { + Object::getObjectType(local_3c); + } + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar1 % 0x4000] = (uchar)(undefined2)local_3c[0].ObjectID; + uVar6 = iVar1 + 1; + uVar5 = iVar1 + 0x4000; + if (-1 < (int)uVar6) { + uVar5 = uVar6; + } + *(char *)((int)Connection + (uVar6 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)(undefined2)local_3c[0].ObjectID >> 8); + Connection->NextToWrite = iVar1 + 2; + } + else { + Connection->Overflow = true; + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDCONTAINER); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,CONTAINERLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = uVar3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,LIQUIDPOOL); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,POOLLIQUIDTYPE); + uVar3 = GetLiquidColor(uVar4); + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = uVar3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE); + if (bVar2) { + uVar4 = Object::getAttribute(Obj,AMOUNT); + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)uVar4; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + } + Object::getObjectType(local_3c); + bVar2 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER); + if (bVar2) { + local_4c[0] = (Object)Obj->ObjectID; + GetFirstContainerObject(local_2c); + Obj->ObjectID = (ulong)local_2c[0]; + if (local_2c[0].ObjectID != NONE.ObjectID) { + do { + local_4c[0] = (Object)Obj->ObjectID; + local_3c[0].ObjectID = NONE.ObjectID; + SendTradeObjects(Connection,local_4c); + Object::getNextObject(local_3c); + Obj->ObjectID = (ulong)local_3c[0]; + } while (local_3c[0].ObjectID != NONE.ObjectID); + } + } + } + return; +} + + + +void SendTradeOffer(TConnection *Connection,char *Name,bool OwnOffer,Object *Obj) + +{ + int iVar1; + bool bVar2; + size_t Length; + int iVar3; + uint uVar4; + uint uVar5; + char *Text; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = !OwnOffer + '}'; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + if (Name == (char *)0x0) { + Text = "SendTradeOffer: Name ist NULL.\n"; + } + else { + Length = strlen(Name); + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,Name,Length); + } + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + iVar3 = CountObjects(local_2c); + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)iVar3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + local_2c[0] = (Object)Obj->ObjectID; + SendTradeObjects(Connection,local_2c); + FinishSendData(Connection); + return; + } + Text = "SendTradeOffer: Objekt existiert nicht.\n"; + } + error(Text); + } + return; +} + + + +void SendCloseTrade(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = '\x7f'; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +void SendAddField(TConnection *Connection,int x,int y,int z,Object *Obj) + +{ + int iVar1; + bool bVar2; + uint uVar3; + int iVar4; + uint uVar5; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 'j'; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)x; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((uint)x >> 8); + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)y; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((uint)y >> 8); + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)z; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + SendMapObject(Connection,local_2c); + FinishSendData(Connection); + } + else { + error(&DAT_08109360); + } + } + return; +} + + + +void SendDeleteField(TConnection *Connection,int x,int y,int z,Object *Obj) + +{ + int iVar1; + bool bVar2; + int iVar3; + uint uVar4; + int RNum; + uint uVar5; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 'l'; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)x; + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((uint)x >> 8); + iVar3 = iVar3 + 2; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)y; + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((uint)y >> 8); + iVar3 = iVar3 + 2; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)z; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + iVar3 = GetObjectRNum(local_2c); + if (iVar3 < 10) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)iVar3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + } + else { + error(&DAT_08109360); + } + } + return; +} + + + +void SendChangeField(TConnection *Connection,int x,int y,int z,Object *Obj) + +{ + int iVar1; + bool bVar2; + int iVar3; + uint uVar4; + int RNum; + uint uVar5; + Object local_2c [7]; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 'k'; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)x; + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((uint)x >> 8); + iVar3 = iVar3 + 2; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)y; + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((uint)y >> 8); + iVar3 = iVar3 + 2; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)z; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + bVar2 = Object::exists(Obj); + if (bVar2) { + local_2c[0] = (Object)Obj->ObjectID; + iVar3 = GetObjectRNum(local_2c); + if (iVar3 < 10) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)iVar3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + local_2c[0] = (Object)Obj->ObjectID; + SendMapObject(Connection,local_2c); + FinishSendData(Connection); + } + } + else { + error(&DAT_081093a0); + } + } + return; +} + + + +void SendMoveCreature(TConnection *Connection,ulong CreatureID,int x,int y,int z) + +{ + undefined2 uVar1; + int iVar2; + bool bVar3; + bool bVar4; + bool bVar5; + TCreature *pTVar6; + int iVar7; + uint uVar8; + int iVar9; + uint uVar10; + TCreature *cr; + uchar uStack_30; + bool DestVisible; + bool StartVisible; + int RNum; + + if (Connection != (TConnection *)0x0) { + pTVar6 = GetCreature(CreatureID); + if (pTVar6 == (TCreature *)0x0) { + error("SendMoveCreature: Kreatur existiert nicht.\n"); + } + else { + RNum = (pTVar6->CrObject).ObjectID; + iVar7 = GetObjectRNum((Object *)&RNum); + bVar3 = false; + bVar4 = TConnection::IsVisible(Connection,pTVar6->posx,pTVar6->posy,pTVar6->posz); + if ((bVar4) && (iVar7 < 10)) { + bVar3 = true; + } + bVar4 = TConnection::IsVisible(Connection,x,y,z); + if (bVar3) { + if (bVar4) { + bVar5 = BeginSendData(Connection); + if (!bVar5) { + return; + } + iVar2 = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < iVar2 + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = 'm'; + iVar9 = iVar9 + 1; + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + uVar1 = (undefined2)pTVar6->posx; + if (iVar9 < iVar2 + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)uVar1; + uVar10 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar10) { + uVar8 = uVar10; + } + *(char *)((int)Connection + (uVar10 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + iVar9 = iVar9 + 2; + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + uVar1 = (undefined2)pTVar6->posy; + if (iVar9 < iVar2 + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)uVar1; + uVar10 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar10) { + uVar8 = uVar10; + } + iVar9 = iVar9 + 2; + *(char *)((int)Connection + (uVar10 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + if (iVar9 < iVar2 + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = (uchar)pTVar6->posz; + iVar9 = iVar9 + 1; + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + if (iVar9 < iVar2 + 0x4000) { + uStack_30 = (uchar)iVar7; + iVar7 = iVar9 % 0x4000; + iVar9 = iVar9 + 1; + Connection->OutData[iVar7] = uStack_30; + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + if (iVar9 < iVar2 + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)x; + uVar10 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar10) { + uVar8 = uVar10; + } + *(char *)((int)Connection + (uVar10 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((uint)x >> 8); + iVar9 = iVar9 + 2; + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + if (iVar9 < iVar2 + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)y; + uVar10 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar10) { + uVar8 = uVar10; + } + iVar9 = iVar9 + 2; + *(char *)((int)Connection + (uVar10 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((uint)y >> 8); + Connection->NextToWrite = iVar9; + } + else { + Connection->Overflow = true; + } + if (iVar9 < iVar2 + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = (uchar)z; + Connection->NextToWrite = iVar9 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + if (bVar3) { + if (bVar4) { + return; + } + RNum = (pTVar6->CrObject).ObjectID; + SendDeleteField(Connection,pTVar6->posx,pTVar6->posy,pTVar6->posz, + (Object *)&RNum); + return; + } + } + else if (!bVar4) { + return; + } + if (bVar4) { + RNum = (pTVar6->CrObject).ObjectID; + SendAddField(Connection,x,y,z,(Object *)&RNum); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: y_local + +void __regparm2 SendGraphicalEffect(TConnection *Connection,int x,int y,int z,int Type) + +{ + int iVar1; + bool bVar2; + uint uVar3; + int iVar4; + int iVar5; + uint uVar6; + undefined1 in_stack_00000010; + undefined1 in_stack_00000014; + int Type_local; + int z_local; + int y_local; + + bVar2 = BeginSendData((TConnection *)y); + if (bVar2) { + iVar1 = *(int *)(y + 0x4808); + iVar4 = *(int *)(y + 0x4810); + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(y + 0x806 + iVar4 % 0x4000) = 0x83; + iVar4 = iVar4 + 1; + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(y + 0x806 + iVar4 % 0x4000) = (char)(z & 0xffffU); + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(y + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((z & 0xffffU) >> 8); + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(y + 0x806 + iVar4 % 0x4000) = (char)Type; + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(y + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((uint)Type >> 8); + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + iVar5 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + *(undefined1 *)(y + 0x806 + iVar5) = in_stack_00000010; + *(int *)(y + 0x4810) = iVar4; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(y + 0x806 + iVar4 % 0x4000) = in_stack_00000014; + *(int *)(y + 0x4810) = iVar4 + 1; + } + else { + *(undefined1 *)(y + 0x4814) = 1; + } + FinishSendData((TConnection *)y); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: z_local +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendTextualEffect(TConnection *Connection,int x,int y,int z,int Color,char *Text) + +{ + int iVar1; + bool bVar2; + size_t Length; + uint uVar3; + int iVar4; + uint uVar5; + char *Text_local; + int Color_local; + int z_local; + + if (Text == (char *)0x0) { + Connection = (TConnection *)s_SendTextualEffect__Text_ist_NULL_08109460; + } + else { + if (*Text != '\0') { + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0x84; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(x & 0xffffU); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((x & 0xffffU) >> 8); + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3fff) { + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)(y & 0xffffU); + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((y & 0xffffU) >> 8); + iVar4 = iVar4 + 2; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Color_local._0_1_ = (uchar)z; + Connection->OutData[iVar4 % 0x4000] = (uchar)Color_local; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Text_local._0_1_ = (uchar)Color; + Connection->OutData[iVar4 % 0x4000] = (uchar)Text_local; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + if (Text == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + Length = strlen(Text); + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,Text,Length); + } + } + FinishSendData(Connection); + return; + } + return; + } + Connection = (TConnection *)s_SendTextualEffect__Text_ist_leer_08109420; + } + error((char *)Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: sy_local + +void __regparm2 +SendMissileEffect(TConnection *Connection,int sx,int sy,int sz,int zx,int zy,int zz,int Type) + +{ + int iVar1; + bool bVar2; + uint uVar3; + int iVar4; + int iVar5; + uint uVar6; + undefined1 in_stack_0000001c; + undefined1 in_stack_00000020; + int Type_local; + int zz_local; + int zy_local; + int zx_local; + int sz_local; + int sy_local; + + bVar2 = BeginSendData((TConnection *)sy); + if (bVar2) { + iVar1 = *(int *)(sy + 0x4808); + iVar4 = *(int *)(sy + 0x4810); + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(sy + 0x806 + iVar4 % 0x4000) = 0x85; + iVar4 = iVar4 + 1; + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(sy + 0x806 + iVar4 % 0x4000) = (char)(sz & 0xffffU); + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(sy + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((sz & 0xffffU) >> 8); + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(sy + 0x806 + iVar4 % 0x4000) = (char)zx; + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(sy + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((uint)zx >> 8); + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + zx_local._0_1_ = (undefined1)zy; + iVar5 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + *(undefined1 *)(sy + 0x806 + iVar5) = (undefined1)zx_local; + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(sy + 0x806 + iVar4 % 0x4000) = (char)zz; + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(sy + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((uint)zz >> 8); + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3fff) { + *(char *)(sy + 0x806 + iVar4 % 0x4000) = (char)Type; + uVar6 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + iVar4 = iVar4 + 2; + *(char *)(sy + 0x806 + (uVar6 - (uVar3 & 0xffffc000))) = (char)((uint)Type >> 8); + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + iVar5 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + *(undefined1 *)(sy + 0x806 + iVar5) = in_stack_0000001c; + *(int *)(sy + 0x4810) = iVar4; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(sy + 0x806 + iVar4 % 0x4000) = in_stack_00000020; + *(int *)(sy + 0x4810) = iVar4 + 1; + } + else { + *(undefined1 *)(sy + 0x4814) = 1; + } + FinishSendData((TConnection *)sy); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Color_local + +void __regparm2 SendMarkCreature(TConnection *Connection,ulong CreatureID,int Color) + +{ + int iVar1; + bool bVar2; + uint uVar3; + int iVar4; + uint uVar5; + undefined4 in_stack_00000008; + undefined1 in_stack_0000000c; + int Color_local; + + bVar2 = BeginSendData((TConnection *)Color); + if (bVar2) { + iVar1 = *(int *)(Color + 0x4808); + iVar4 = *(int *)(Color + 0x4810); + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(Color + 0x806 + iVar4 % 0x4000) = 0x86; + iVar4 = iVar4 + 1; + *(int *)(Color + 0x4810) = iVar4; + } + else { + *(undefined1 *)(Color + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x3ffd) { + *(char *)(Color + 0x806 + iVar4 % 0x4000) = (char)in_stack_00000008; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)(Color + 0x806 + (uVar5 - (uVar3 & 0xffffc000))) = + (char)((uint)in_stack_00000008 >> 8); + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)(Color + 0x806 + (uVar5 - (uVar3 & 0xffffc000))) = + (char)((uint)in_stack_00000008 >> 0x10); + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 4; + *(char *)(Color + 0x806 + (uVar5 - (uVar3 & 0xffffc000))) = + (char)((uint)in_stack_00000008 >> 0x18); + *(int *)(Color + 0x4810) = iVar4; + } + else { + *(undefined1 *)(Color + 0x4814) = 1; + } + if (iVar4 < iVar1 + 0x4000) { + *(undefined1 *)(Color + 0x806 + iVar4 % 0x4000) = in_stack_0000000c; + *(int *)(Color + 0x4810) = iVar4 + 1; + } + else { + *(undefined1 *)(Color + 0x4814) = 1; + } + FinishSendData((TConnection *)Color); + return; + } + return; +} + + + +void SendEditText(TConnection *Connection,Object *Obj) + +{ + Object *this; + bool bVar1; + TPlayer *pl; + ulong uVar2; + size_t sVar3; + uint uVar4; + TPlayer *pTVar5; + int iVar6; + int iVar7; + uint uVar8; + ushort *puVar9; + char *Text_00; + uchar local_1060; + char *local_1048; + char *Editor; + char *Text; + ushort MaxLen; + char Buffer [4096]; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 0x96; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + bVar1 = Object::exists(Obj); + if (!bVar1) { + Text_00 = &DAT_081094e0; +LAB_080d1c40: + error(Text_00); + return; + } + uVar2 = Obj->ObjectID; + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3ffd) { + uVar8 = iVar6 + 1; + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar2; + uVar4 = iVar6 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = (char)(uVar2 >> 8); + uVar8 = iVar6 + 2; + uVar4 = iVar6 + 0x4001; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = (char)(uVar2 >> 0x10); + uVar8 = iVar6 + 3; + uVar4 = iVar6 + 0x4002; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = (char)(uVar2 >> 0x18); + Connection->NextToWrite = iVar6 + 4; + } + else { + Connection->Overflow = true; + } + this = (Object *)(Buffer + 0xffc); + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,DISGUISE); + if (bVar1) { + Object::getObjectType(this); + uVar2 = ObjectType::getAttribute((ObjectType *)this,DISGUISETARGET); + Buffer._4092_2_ = (undefined2)uVar2; + } + else { + Object::getObjectType(this); + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x3fff) { + uVar8 = iVar6 + 1; + Connection->OutData[iVar6 % 0x4000] = (uchar)Buffer._4092_2_; + uVar4 = iVar6 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = + SUB21(Buffer._4092_2_,1); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + Editor = (char *)&MaxLen; + puVar9 = &MaxLen; + for (iVar6 = 0x400; iVar6 != 0; iVar6 = iVar6 + -1) { + puVar9[0] = 0; + puVar9[1] = 0; + puVar9 = puVar9 + 2; + } + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,WRITE); + if (bVar1) { +LAB_080d171d: + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,WRITE); + Object::getObjectType(this); + uVar2 = ObjectType::getAttribute((ObjectType *)this,!bVar1 + MAXLENGTH); + Text._0_2_ = (short)uVar2 + -1; + uVar2 = Object::getAttribute(Obj,TEXTSTRING); + Editor = GetDynamicString(uVar2); + uVar2 = Object::getAttribute(Obj,EDITOR); + local_1048 = GetDynamicString(uVar2); + } + else { + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,WRITEONCE); + if (bVar1) goto LAB_080d171d; + Object::getObjectType(this); + bVar1 = ObjectType::getFlag((ObjectType *)this,INFORMATION); + if (bVar1) { + Object::getObjectType(this); + uVar2 = ObjectType::getAttribute((ObjectType *)this,INFORMATIONTYPE); + if (uVar2 != 4) goto LAB_080d1b88; + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + Text_00 = &DAT_081094a0; + goto LAB_080d1c40; + } + GetSpellbook((pTVar5->super_TCreature).ID,Editor); + local_1048 = (char *)0x0; + sVar3 = strlen(Editor); + Text._0_2_ = (short)sVar3; + } + else { +LAB_080d1b88: + uVar2 = Object::getAttribute(Obj,TEXTSTRING); + Editor = GetDynamicString(uVar2); + uVar2 = Object::getAttribute(Obj,EDITOR); + local_1048 = GetDynamicString(uVar2); + Text._0_2_ = 0; + if (Editor != (char *)0x0) { + sVar3 = strlen(Editor); + Text._0_2_ = (short)sVar3; + } + } + } + iVar6 = Connection->NextToSend; + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar6 + 0x3fff) { + Connection->OutData[iVar7 % 0x4000] = (uchar)Text; + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((ushort)(short)Text >> 8); + Connection->NextToWrite = iVar7 + 2; + } + else { + Connection->Overflow = true; + } + if (Editor != (char *)0x0) { + if ((short)Text != 0) { + sVar3 = strlen(Editor); + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar6 + 0x3fff) { + local_1060 = (uchar)(sVar3 & 0xffff); + Connection->OutData[iVar7 % 0x4000] = local_1060; + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + local_1060 = (uchar)((sVar3 & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = local_1060; + Connection->NextToWrite = iVar7 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar3) { + SendText(Connection,Editor,sVar3); + iVar6 = Connection->NextToSend; + } + if (local_1048 == (char *)0x0) { + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar6 + 0x3fff) { + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + Connection->OutData[iVar7 % 0x4000] = '\0'; + *(undefined1 *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = 0; + Connection->NextToWrite = iVar7 + 2; + } + else { + Connection->Overflow = true; + } + } + else { + sVar3 = strlen(local_1048); + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar6 + 0x3fff) { + Connection->OutData[iVar7 % 0x4000] = (uchar)(sVar3 & 0xffff); + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((sVar3 & 0xffff) >> 8); + Connection->NextToWrite = iVar7 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar3) { + SendText(Connection,local_1048,sVar3); + } + } + } + if (Editor == (char *)0x0) { + iVar6 = Connection->NextToSend; + } + else { + if ((short)Text != 0) goto LAB_080d1904; + iVar6 = Connection->NextToSend; + } + } + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar6 + 0x3fff) { + Connection->OutData[iVar7 % 0x4000] = '\0'; + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = 0; + iVar7 = iVar7 + 2; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar6 + 0x3fff) { + Connection->OutData[iVar7 % 0x4000] = '\0'; + uVar8 = iVar7 + 1; + uVar4 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar4 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar4 & 0xffffc000)) + 0x806) = 0; + Connection->NextToWrite = iVar7 + 2; + } + else { + Connection->Overflow = true; + } +LAB_080d1904: + FinishSendData(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Type_local +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendEditList(TConnection *Connection,uchar Type,ulong ID,char *Text) + +{ + int iVar1; + bool bVar2; + size_t Length; + uint uVar3; + int iVar4; + uint uVar5; + char *Text_local; + uchar Type_local; + + bVar2 = BeginSendData(Connection); + if (!bVar2) { + return; + } + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0x97; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = Type; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3ffd) { + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)ID; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = (char)(ID >> 8); + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = (char)(ID >> 0x10); + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = (char)(ID >> 0x18); + Connection->NextToWrite = iVar4 + 4; + } + else { + Connection->Overflow = true; + } + Length = strlen(Text); + if (Length < 0xfa1) { + if (Text == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,Text,Length); + } + } + FinishSendData(Connection); + return; + } + error("SendEditList: Text ist zu lang.\n"); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Color + +void SendAmbiente(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + int iVar3; + uchar local_18 [4]; + int Brightness; + int Color; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0x82; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + GetAmbiente((int *)local_18,&Brightness); + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = local_18[0]; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)Brightness; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + return; +} + + + +void SendCreatureHealth(TConnection *Connection,ulong CreatureID) + +{ + bool bVar1; + TCreature *cr; + TCreature *this; + int iVar2; + int iVar3; + uint uVar4; + uint uVar5; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + iVar2 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar2 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0x8c; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar2 + 0x3ffd) { + uVar5 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = (uchar)CreatureID; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar5 = iVar3 + 2; + uVar4 = iVar3 + 0x4001; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar5 = iVar3 + 3; + uVar4 = iVar3 + 0x4002; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar3 + 4; + } + else { + Connection->Overflow = true; + } + this = GetCreature(CreatureID); + if (this != (TCreature *)0x0) { + iVar2 = TCreature::GetHealth(this); + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)iVar2; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + error("SendCreatureHealth: Kreatur %ld existiert nicht.\n"); + return; +} + + + +// WARNING: Variable defined which should be unmapped: HelpColor + +void SendCreatureLight(TConnection *Connection,ulong CreatureID) + +{ + int iVar1; + bool bVar2; + TCreature *pTVar3; + int iVar4; + TCreature *cr; + uint uVar5; + int iVar6; + uint uVar7; + uchar local_18 [4]; + int HelpBrightness; + int HelpColor; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0x8d; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3ffd) { + uVar7 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)CreatureID; + uVar5 = iVar4 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar7 = iVar4 + 2; + uVar5 = iVar4 + 0x4001; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar7 = iVar4 + 3; + uVar5 = iVar4 + 0x4002; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar4 + 4; + } + else { + Connection->Overflow = true; + } + pTVar3 = GetCreature(CreatureID); + if (pTVar3 == (TCreature *)0x0) { + error("SendCreatureLight: Kreatur %ld existiert nicht.\n",CreatureID); + } + else { + GetCreatureLight(pTVar3->ID,(int *)local_18,&HelpBrightness); + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + iVar6 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + Connection->OutData[iVar6] = local_18[0]; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)HelpBrightness; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + } + } + return; +} + + + +void SendCreatureOutfit(TConnection *Connection,ulong CreatureID) + +{ + undefined2 uVar1; + ushort uVar2; + int iVar3; + bool bVar4; + TCreature *pTVar5; + uint uVar6; + int iVar7; + TCreature *cr; + uint uVar8; + + bVar4 = BeginSendData(Connection); + if (!bVar4) { + return; + } + iVar3 = Connection->NextToSend; + iVar7 = Connection->NextToWrite; + if (iVar7 < iVar3 + 0x4000) { + Connection->OutData[iVar7 % 0x4000] = 0x8e; + iVar7 = iVar7 + 1; + Connection->NextToWrite = iVar7; + } + else { + Connection->Overflow = true; + } + if (iVar7 < iVar3 + 0x3ffd) { + uVar8 = iVar7 + 1; + Connection->OutData[iVar7 % 0x4000] = (uchar)CreatureID; + uVar6 = iVar7 + 0x4000; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar8 = iVar7 + 2; + uVar6 = iVar7 + 0x4001; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar8 = iVar7 + 3; + uVar6 = iVar7 + 0x4002; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar7 + 4; + } + else { + Connection->Overflow = true; + } + pTVar5 = GetCreature(CreatureID); + if (pTVar5 != (TCreature *)0x0) { + uVar1 = (undefined2)(pTVar5->Outfit).OutfitID; + iVar7 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar7 + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)uVar1; + uVar8 = iVar3 + 1; + uVar6 = iVar3 + 0x4000; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + if ((pTVar5->Outfit).OutfitID == 0) { + uVar2 = (pTVar5->Outfit).field_1.ObjectType; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar7 + 0x3fff) { + uVar8 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = (uchar)uVar2; + uVar6 = iVar3 + 0x4000; + if (-1 < (int)uVar8) { + uVar6 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar6 & 0xffffc000)) + 0x806) = + (char)(uVar2 >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + } + else { + SendText(Connection,(char *)(pTVar5->Outfit).field_1.Colors,4); + } + FinishSendData(Connection); + return; + } + error("SendCreatureOutfit: Kreatur %ld existiert nicht.\n"); + return; +} + + + +void SendCreatureSpeed(TConnection *Connection,ulong CreatureID) + +{ + int iVar1; + bool bVar2; + TCreature *cr; + TCreature *this; + uint uVar3; + int iVar4; + uint uVar5; + uint uVar6; + + bVar2 = BeginSendData(Connection); + if (!bVar2) { + return; + } + iVar1 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < iVar1 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0x8f; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < iVar1 + 0x3ffd) { + uVar6 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)CreatureID; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + *(char *)((int)Connection + (uVar6 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar6 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + *(char *)((int)Connection + (uVar6 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar6 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar6) { + uVar3 = uVar6; + } + *(char *)((int)Connection + (uVar6 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar4 + 4; + } + else { + Connection->Overflow = true; + } + this = GetCreature(CreatureID); + if (this != (TCreature *)0x0) { + uVar3 = TCreature::GetSpeed(this); + iVar4 = Connection->NextToWrite; + if (iVar4 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(uVar3 & 0xffff); + uVar5 = iVar4 + 1; + uVar6 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar6 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar6 & 0xffffc000)) + 0x806) = + (char)((uVar3 & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + error("SendCreatureSpeed: Kreatur %ld existiert nicht.\n"); + return; +} + + + +void SendCreatureSkull(TConnection *Connection,ulong CreatureID) + +{ + bool bVar1; + TPlayer *this; + TPlayer *Observer; + int iVar2; + int iVar3; + uint uVar4; + TPlayer *pl; + uint uVar5; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + iVar2 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar2 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0x90; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar2 + 0x3ffd) { + uVar5 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = (uchar)CreatureID; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar5 = iVar3 + 2; + uVar4 = iVar3 + 0x4001; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar5 = iVar3 + 3; + uVar4 = iVar3 + 0x4002; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar3 + 4; + } + else { + Connection->Overflow = true; + } + this = GetPlayer(CreatureID); + if (this != (TPlayer *)0x0) { + Observer = TConnection::GetPlayer(Connection); + iVar2 = TPlayer::GetPlayerkillingMark(this,Observer); + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)iVar2; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + error("SendCreatureSkull: Kreatur %ld existiert nicht.\n"); + return; +} + + + +void SendCreatureParty(TConnection *Connection,ulong CreatureID) + +{ + bool bVar1; + TPlayer *this; + TPlayer *Observer; + int iVar2; + int iVar3; + uint uVar4; + TPlayer *pl; + uint uVar5; + + bVar1 = BeginSendData(Connection); + if (!bVar1) { + return; + } + iVar2 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar2 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0x91; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar2 + 0x3ffd) { + uVar5 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = (uchar)CreatureID; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 8); + uVar5 = iVar3 + 2; + uVar4 = iVar3 + 0x4001; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x10); + uVar5 = iVar3 + 3; + uVar4 = iVar3 + 0x4002; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)(CreatureID >> 0x18); + Connection->NextToWrite = iVar3 + 4; + } + else { + Connection->Overflow = true; + } + this = GetPlayer(CreatureID); + if (this != (TPlayer *)0x0) { + Observer = TConnection::GetPlayer(Connection); + iVar2 = TPlayer::GetPartyMark(this,Observer); + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = (uchar)iVar2; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + error("SendCreatureParty: Kreatur %ld existiert nicht.\n"); + return; +} + + + +void SendClearTarget(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = 0xa3; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void SendPlayerData(TConnection *Connection) + +{ + undefined2 uVar1; + TSkill *pTVar2; + bool bVar3; + TPlayer *pTVar4; + uint uVar5; + int iVar6; + uint uVar7; + TSkill *sk; + int Capacity; + uint uVar8; + int iVar9; + int local_1c; + TPlayer *pl; + + bVar3 = BeginSendData(Connection); + if (!bVar3) { + return; + } + iVar9 = Connection->NextToWrite; + if (iVar9 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = 0xa0; + Connection->NextToWrite = iVar9 + 1; + } + else { + Connection->Overflow = true; + } + pTVar4 = TConnection::GetPlayer(Connection); + if (pTVar4 == (TPlayer *)0x0) { + error(&DAT_081096e0); + return; + } + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[2]; + if (pTVar2 == (TSkill *)0x0) { + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (local_1c + 0x3fff <= iVar9) goto LAB_080d3570; + Connection->OutData[iVar9 % 0x4000] = '\0'; + uVar8 = iVar9 + 1; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d2d93: + iVar9 = iVar9 + 2; + Connection->NextToWrite = iVar9; + } + else { + uVar5 = TSkill::Get(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)(uVar5 & 0xffff); + uVar7 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar7) { + uVar8 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((uVar5 & 0xffff) >> 8); + goto LAB_080d2d93; + } +LAB_080d3570: + Connection->Overflow = true; + } + if (pTVar2 == (TSkill *)0x0) { + if (local_1c + 0x3fff <= iVar9) goto LAB_080d3510; + Connection->OutData[iVar9 % 0x4000] = '\0'; + uVar8 = iVar9 + 1; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d2df5: + Connection->NextToWrite = iVar9 + 2; + } + else { + uVar1 = (undefined2)pTVar2->Max; + if (iVar9 < local_1c + 0x3fff) { + uVar8 = iVar9 + 1; + Connection->OutData[iVar9 % 0x4000] = (uchar)uVar1; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + goto LAB_080d2df5; + } +LAB_080d3510: + Connection->Overflow = true; + } + iVar9 = 0; + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[5]; + if (pTVar2 != (TSkill *)0x0) { + iVar6 = TSkill::Get(pTVar2); + iVar9 = GetInventoryWeight((pTVar4->super_TCreature).ID); + iVar9 = iVar6 * 100 - iVar9; + } + if (iVar9 < 0) { + iVar9 = 0; + } + bVar3 = CheckRight((pTVar4->super_TCreature).ID,ZERO_CAPACITY); + if (bVar3) { + iVar9 = 0; + } + local_1c = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + uVar5 = iVar9 / 100 & 0xffff; + if (iVar6 < local_1c + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)uVar5; + uVar7 = iVar6 + 1; + uVar8 = iVar6 + 0x4000; + if (-1 < (int)uVar7) { + uVar8 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar8 & 0xffffc000)) + 0x806) = (char)(uVar5 >> 8); + iVar6 = iVar6 + 2; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[0]; + if (pTVar2 == (TSkill *)0x0) { + if (local_1c + 0x3ffd <= iVar6) goto LAB_080d3425; + uVar8 = iVar6 + 1; + Connection->OutData[iVar6 % 0x4000] = '\0'; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; + uVar8 = iVar6 + 2; + uVar5 = iVar6 + 0x4001; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; + uVar8 = iVar6 + 3; + uVar5 = iVar6 + 0x4002; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d2f38: + Connection->NextToWrite = iVar6 + 4; + } + else { + iVar9 = pTVar2->Exp; + if (iVar6 < local_1c + 0x3ffd) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar9; + uVar8 = iVar6 + 1; + uVar5 = iVar6 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((uint)iVar9 >> 8); + uVar8 = iVar6 + 2; + uVar5 = iVar6 + 0x4001; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((uint)iVar9 >> 0x10); + uVar8 = iVar6 + 3; + uVar5 = iVar6 + 0x4002; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((uint)iVar9 >> 0x18); + goto LAB_080d2f38; + } +LAB_080d3425: + Connection->Overflow = true; + } + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x3fff <= iVar9) goto LAB_080d33c6; + uVar8 = iVar9 + 1; + Connection->OutData[iVar9 % 0x4000] = '\0'; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d2fb2: + Connection->NextToWrite = iVar9 + 2; + } + else { + uVar5 = TSkill::Get(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)(uVar5 & 0xffff); + uVar7 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar7) { + uVar8 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((uVar5 & 0xffff) >> 8); + goto LAB_080d2fb2; + } +LAB_080d33c6: + Connection->Overflow = true; + } + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x4000 <= iVar9) goto LAB_080d3383; + Connection->OutData[iVar9 % 0x4000] = '\0'; +LAB_080d3009: + Connection->NextToWrite = iVar9 + 1; + } + else { + iVar6 = TSkill::GetProgress(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = (uchar)iVar6; + goto LAB_080d3009; + } +LAB_080d3383: + Connection->Overflow = true; + } + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[3]; + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x3fff <= iVar9) goto LAB_080d3321; + uVar8 = iVar9 + 1; + Connection->OutData[iVar9 % 0x4000] = '\0'; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d3086: + iVar9 = iVar9 + 2; + Connection->NextToWrite = iVar9; + } + else { + uVar5 = TSkill::Get(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)(uVar5 & 0xffff); + uVar7 = iVar9 + 1; + uVar8 = iVar9 + 0x4000; + if (-1 < (int)uVar7) { + uVar8 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar8 & 0xffffc000)) + 0x806) = + (char)((uVar5 & 0xffff) >> 8); + goto LAB_080d3086; + } +LAB_080d3321: + Connection->Overflow = true; + } + if (pTVar2 == (TSkill *)0x0) { + if (local_1c + 0x3fff <= iVar9) goto LAB_080d32c8; + uVar8 = iVar9 + 1; + Connection->OutData[iVar9 % 0x4000] = '\0'; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(undefined1 *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = 0; +LAB_080d30e8: + Connection->NextToWrite = iVar9 + 2; + } + else { + uVar1 = (undefined2)pTVar2->Max; + if (iVar9 < local_1c + 0x3fff) { + Connection->OutData[iVar9 % 0x4000] = (uchar)uVar1; + uVar8 = iVar9 + 1; + uVar5 = iVar9 + 0x4000; + if (-1 < (int)uVar8) { + uVar5 = uVar8; + } + *(char *)((int)Connection + (uVar8 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + goto LAB_080d30e8; + } +LAB_080d32c8: + Connection->Overflow = true; + } + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[1]; + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x4000 <= iVar9) goto LAB_080d3286; + Connection->OutData[iVar9 % 0x4000] = '\0'; +LAB_080d3143: + Connection->NextToWrite = iVar9 + 1; + } + else { + iVar6 = TSkill::Get(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = (uchar)iVar6; + goto LAB_080d3143; + } +LAB_080d3286: + Connection->Overflow = true; + } + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x4000 <= iVar9) goto LAB_080d3243; + Connection->OutData[iVar9 % 0x4000] = '\0'; +LAB_080d319a: + Connection->NextToWrite = iVar9 + 1; + } + else { + iVar6 = TSkill::GetProgress(pTVar2); + local_1c = Connection->NextToSend; + iVar9 = Connection->NextToWrite; + if (iVar9 < local_1c + 0x4000) { + Connection->OutData[iVar9 % 0x4000] = (uchar)iVar6; + goto LAB_080d319a; + } +LAB_080d3243: + Connection->Overflow = true; + } + pTVar2 = (pTVar4->super_TCreature).super_TSkillBase.Skills[0x16]; + if (pTVar2 == (TSkill *)0x0) { + iVar9 = Connection->NextToWrite; + if (local_1c + 0x4000 <= iVar9) goto LAB_080d3201; + Connection->OutData[iVar9 % 0x4000] = '\0'; + } + else { + iVar6 = TSkill::Get(pTVar2); + iVar9 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar9) { +LAB_080d3201: + Connection->Overflow = true; + goto LAB_080d31f2; + } + Connection->OutData[iVar9 % 0x4000] = (uchar)iVar6; + } + Connection->NextToWrite = iVar9 + 1; +LAB_080d31f2: + FinishSendData(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void SendPlayerSkills(TConnection *Connection) + +{ + TSkill *pTVar1; + bool bVar2; + TPlayer *pTVar3; + int iVar4; + int iVar5; + int iVar6; + TSkill *sk; + uchar local_18; + TPlayer *pl; + + bVar2 = BeginSendData(Connection); + if (!bVar2) { + return; + } + iVar6 = Connection->NextToWrite; + if (iVar6 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = 0xa1; + Connection->NextToWrite = iVar6 + 1; + } + else { + Connection->Overflow = true; + } + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 == (TPlayer *)0x0) { + error(&DAT_08109720); + return; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[0xb]; + if (pTVar1 == (TSkill *)0x0) { + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3e93; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d36d2: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d36d2; + } +LAB_080d3e93: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3e52; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3725: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d3725; + } +LAB_080d3e52: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[9]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3e13; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3781: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d3781; + } +LAB_080d3e13: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3dd2; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d37d4: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d37d4; + } +LAB_080d3dd2: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[8]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3d93; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3830: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d3830; + } +LAB_080d3d93: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3d52; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3883: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d3883; + } +LAB_080d3d52: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[10]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3d13; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d38df: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d38df; + } +LAB_080d3d13: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3cd2; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3932: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d3932; + } +LAB_080d3cd2: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[7]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3c93; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d398e: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d398e; + } +LAB_080d3c93: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3c52; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d39e1: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d39e1; + } +LAB_080d3c52: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[6]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3c13; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3a3d: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d3a3d; + } +LAB_080d3c13: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3bd2; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3a90: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + iVar5 = Connection->NextToSend; + if (iVar6 < iVar5 + 0x4000) { + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar4; + goto LAB_080d3a90; + } +LAB_080d3bd2: + Connection->Overflow = true; + } + pTVar1 = (pTVar3->super_TCreature).super_TSkillBase.Skills[0xd]; + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3b91; + Connection->OutData[iVar6 % 0x4000] = '\0'; +LAB_080d3aec: + Connection->NextToWrite = iVar6 + 1; + } + else { + iVar4 = TSkill::Get(pTVar1); + iVar5 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar5 + 0x4000) { + local_18 = (uchar)iVar4; + Connection->OutData[iVar6 % 0x4000] = local_18; + goto LAB_080d3aec; + } +LAB_080d3b91: + Connection->Overflow = true; + } + if (pTVar1 == (TSkill *)0x0) { + iVar6 = Connection->NextToWrite; + if (iVar5 + 0x4000 <= iVar6) goto LAB_080d3b50; + Connection->OutData[iVar6 % 0x4000] = '\0'; + } + else { + iVar5 = TSkill::GetProgress(pTVar1); + iVar6 = Connection->NextToWrite; + if (Connection->NextToSend + 0x4000 <= iVar6) { +LAB_080d3b50: + Connection->Overflow = true; + goto LAB_080d3b3e; + } + Connection->OutData[iVar6 % 0x4000] = (uchar)iVar5; + } + Connection->NextToWrite = iVar6 + 1; +LAB_080d3b3e: + FinishSendData(Connection); + return; +} + + + +// WARNING: Variable defined which should be unmapped: State_local + +void SendPlayerState(TConnection *Connection,uchar State) + +{ + int iVar1; + bool bVar2; + int iVar3; + uchar State_local; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0xa2; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = State; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +void SendMessage(TConnection *Connection,int Mode,char *Text,...) + +{ + int iVar1; + bool bVar2; + size_t Length; + uint uVar3; + uint uVar4; + int iVar5; + int iVar6; + char local_101c [4]; + char Buffer [4096]; + + if (Mode - 0x12U < 6) { + bVar2 = BeginSendData(Connection); + if (bVar2) { + vsnprintf(local_101c,0x1000,Text,&stack0x00000010); + iVar1 = Connection->NextToSend; + iVar6 = Connection->NextToWrite; + if (iVar6 < iVar1 + 0x4000) { + iVar5 = iVar6 % 0x4000; + iVar6 = iVar6 + 1; + Connection->OutData[iVar5] = 0xb4; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + if (iVar6 < iVar1 + 0x4000) { + iVar5 = iVar6 % 0x4000; + iVar6 = iVar6 + 1; + Connection->OutData[iVar5] = (uchar)Mode; + Connection->NextToWrite = iVar6; + } + else { + Connection->Overflow = true; + } + Length = strlen(local_101c); + if (iVar6 < iVar1 + 0x3fff) { + Connection->OutData[iVar6 % 0x4000] = (uchar)(Length & 0xffff); + uVar4 = iVar6 + 1; + uVar3 = iVar6 + 0x4000; + if (-1 < (int)uVar4) { + uVar3 = uVar4; + } + *(char *)((int)Connection + (uVar4 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar6 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,local_101c,Length); + } + FinishSendData(Connection); + } + } + else { + error(&DAT_08109760,Mode); + } + return; +} + + + +void SendSnapback(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + TPlayer *pl; + TPlayer *pTVar3; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = 0xb5; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 != (TPlayer *)0x0) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = (uchar)(pTVar3->super_TCreature).Direction; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Sender_local + +void SendTalk(TConnection *Connection,ulong StatementID,char *Sender,int Mode,char *Text,int Data) + +{ + bool bVar1; + size_t sVar2; + uint uVar3; + int iVar4; + uint uVar5; + int local_28; + uchar local_24; + uchar local_1c; + int Data_local; + char *Text_local; + char *Sender_local; + + if ((((Mode != 4) && (Mode != 7)) && (Mode != 8)) && + (((Mode != 6 && (Mode != 0xb)) && (Mode != 9)))) { + error(&DAT_081097c0); + return; + } + if (Sender == (char *)0x0) { + Connection = (TConnection *)s_SendTalk______Sender_ist_NULL__081097a0; + } + else { + if (Text != (char *)0x0) { + bVar1 = BeginSendData(Connection); + if (bVar1) { + local_28 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < local_28 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0xaa; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < local_28 + 0x3ffd) { + Connection->OutData[iVar4 % 0x4000] = (uchar)StatementID; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 8); + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 0x10); + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 0x18); + Connection->NextToWrite = iVar4 + 4; + } + else { + Connection->Overflow = true; + } + if (Sender == (char *)0x0) { + error("SendString: String ist NULL.\n"); + local_28 = Connection->NextToSend; + } + else { + sVar2 = strlen(Sender); + iVar4 = Connection->NextToWrite; + if (iVar4 < local_28 + 0x3fff) { + local_24 = (uchar)(sVar2 & 0xffff); + Connection->OutData[iVar4 % 0x4000] = local_24; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_24 = (uchar)((sVar2 & 0xffff) >> 8); + *(uchar *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + local_24; + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar2) { + SendText(Connection,Sender,sVar2); + local_28 = Connection->NextToSend; + } + } + iVar4 = Connection->NextToWrite; + if (iVar4 < local_28 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = (uchar)Mode; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + if (Mode == 6) { + iVar4 = Connection->NextToWrite; + if (iVar4 < local_28 + 0x3ffd) { + local_1c = (uchar)Data; + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = local_1c; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_1c = (uchar)((uint)Data >> 8); + *(uchar *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + local_1c; + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_1c = (uchar)((uint)Data >> 0x10); + *(uchar *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + local_1c; + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_1c = (uchar)((uint)Data >> 0x18); + Connection->NextToWrite = iVar4 + 4; + *(uchar *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + local_1c; + } + else { + Connection->Overflow = true; + } + } + if (Text == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + sVar2 = strlen(Text); + iVar4 = Connection->NextToWrite; + if (iVar4 < local_28 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(sVar2 & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((sVar2 & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar2) { + SendText(Connection,Text,sVar2); + } + } + FinishSendData(Connection); + return; + } + return; + } + Connection = (TConnection *)s_SendTalk______Text_ist_NULL__08109deb; + } + error((char *)Connection); + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080d4a56) +// WARNING: Variable defined which should be unmapped: Sender_local + +void __regparm2 +SendTalk(TConnection *Connection,ulong StatementID,char *Sender,int Mode,int Channel,char *Text) + +{ + bool bVar1; + size_t sVar2; + uint uVar3; + int iVar4; + uint uVar5; + int iVar6; + undefined2 in_stack_00000014; + char *in_stack_00000018; + int local_2c; + char local_28; + char local_24; + char *Text_local; + int Channel_local; + char *Sender_local; + + if ((((Text != (char *)0x5) && (Text != (char *)0xa)) && (Text != (char *)0xc)) && + (Text != (char *)0xe)) { + error(&DAT_08109820); + return; + } + if (Channel == 0) { + Sender = "SendTalk (C): Sender ist NULL.\n"; + } + else { + if (in_stack_00000018 != (char *)0x0) { + bVar1 = BeginSendData((TConnection *)Sender); + if (!bVar1) { + return; + } + local_2c = *(int *)(Sender + 0x4808); + iVar4 = *(int *)(Sender + 0x4810); + if (iVar4 < local_2c + 0x4000) { + Sender[iVar4 % 0x4000 + 0x806] = -0x56; + iVar4 = iVar4 + 1; + *(int *)(Sender + 0x4810) = iVar4; + } + else { + Sender[0x4814] = '\x01'; + } + if (iVar4 < local_2c + 0x3ffd) { + Sender[iVar4 % 0x4000 + 0x806] = (char)Mode; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = (char)((uint)Mode >> 8); + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = (char)((uint)Mode >> 0x10); + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = (char)((uint)Mode >> 0x18); + *(int *)(Sender + 0x4810) = iVar4 + 4; + } + else { + Sender[0x4814] = '\x01'; + } + if (Text == (char *)0xe) { + sVar2 = strlen(""); + iVar4 = *(int *)(Sender + 0x4810); + if (iVar4 < local_2c + 0x3fff) { + local_24 = (char)(sVar2 & 0xffff); + Sender[iVar4 % 0x4000 + 0x806] = local_24; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_24 = (char)((sVar2 & 0xffff) >> 8); + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = local_24; + *(int *)(Sender + 0x4810) = iVar4 + 2; + } + else { + Sender[0x4814] = '\x01'; + } + if (0 < (int)sVar2) { + SendText((TConnection *)Sender,"",sVar2); + local_2c = *(int *)(Sender + 0x4808); + } + } + else { + if (Channel == 0) { + error("SendString: String ist NULL.\n"); + } + else { + sVar2 = strlen((char *)Channel); + iVar4 = *(int *)(Sender + 0x4810); + if (iVar4 < local_2c + 0x3fff) { + local_28 = (char)(sVar2 & 0xffff); + Sender[iVar4 % 0x4000 + 0x806] = local_28; + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + local_28 = (char)((sVar2 & 0xffff) >> 8); + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = local_28; + *(int *)(Sender + 0x4810) = iVar4 + 2; + } + else { + Sender[0x4814] = '\x01'; + } + if ((int)sVar2 < 1) goto LAB_080d47d5; + SendText((TConnection *)Sender,(char *)Channel,sVar2); + } + local_2c = *(int *)(Sender + 0x4808); + } +LAB_080d47d5: + iVar4 = *(int *)(Sender + 0x4810); + if (iVar4 < local_2c + 0x4000) { + iVar6 = iVar4 % 0x4000; + iVar4 = iVar4 + 1; + Sender[iVar6 + 0x806] = (char)Text; + *(int *)(Sender + 0x4810) = iVar4; + } + else { + Sender[0x4814] = '\x01'; + } + if (iVar4 < local_2c + 0x3fff) { + uVar5 = iVar4 + 1; + Sender[iVar4 % 0x4000 + 0x806] = (char)in_stack_00000014; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = + (char)((ushort)in_stack_00000014 >> 8); + *(int *)(Sender + 0x4810) = iVar4 + 2; + } + else { + Sender[0x4814] = '\x01'; + } + if (in_stack_00000018 == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + sVar2 = strlen(in_stack_00000018); + iVar4 = *(int *)(Sender + 0x4810); + if (iVar4 < local_2c + 0x3fff) { + Sender[iVar4 % 0x4000 + 0x806] = (char)(sVar2 & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + Sender[(uVar5 - (uVar3 & 0xffffc000)) + 0x806] = (char)((sVar2 & 0xffff) >> 8); + *(int *)(Sender + 0x4810) = iVar4 + 2; + } + else { + Sender[0x4814] = '\x01'; + } + if (0 < (int)sVar2) { + SendText((TConnection *)Sender,in_stack_00000018,sVar2); + } + } + FinishSendData((TConnection *)Sender); + return; + } + Sender = "SendTalk (C): Text ist NULL.\n"; + } + error(Sender); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Sender_local +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendTalk(TConnection *Connection,ulong StatementID,char *Sender,int Mode,int x,int y,int z, + char *Text) + +{ + bool bVar1; + size_t sVar2; + uint uVar3; + int iVar4; + uint uVar5; + int local_30; + char *Text_local; + int z_local; + int y_local; + int x_local; + int Mode_local; + char *Sender_local; + + if (((2 < Mode - 1U) && (Mode != 0x10)) && (Mode != 0x11)) { + error(&DAT_08109880); + return; + } + if (Sender == (char *)0x0) { + Connection = (TConnection *)s_SendTalk__K___Sender_ist_NULL__08109860; + } + else { + if (Text != (char *)0x0) { + bVar1 = BeginSendData(Connection); + if (bVar1) { + local_30 = Connection->NextToSend; + iVar4 = Connection->NextToWrite; + if (iVar4 < local_30 + 0x4000) { + Connection->OutData[iVar4 % 0x4000] = 0xaa; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < local_30 + 0x3ffd) { + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)StatementID; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 8); + uVar5 = iVar4 + 2; + uVar3 = iVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 0x10); + uVar5 = iVar4 + 3; + uVar3 = iVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(StatementID >> 0x18); + Connection->NextToWrite = iVar4 + 4; + } + else { + Connection->Overflow = true; + } + if (Sender == (char *)0x0) { + error("SendString: String ist NULL.\n"); + local_30 = Connection->NextToSend; + } + else { + sVar2 = strlen(Sender); + iVar4 = Connection->NextToWrite; + if (iVar4 < local_30 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(sVar2 & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((sVar2 & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar2) { + SendText(Connection,Sender,sVar2); + local_30 = Connection->NextToSend; + } + } + iVar4 = Connection->NextToWrite; + if (iVar4 < local_30 + 0x4000) { + x_local._0_1_ = (uchar)Mode; + Connection->OutData[iVar4 % 0x4000] = (uchar)x_local; + iVar4 = iVar4 + 1; + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < local_30 + 0x3fff) { + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)x; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((uint)x >> 8); + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < local_30 + 0x3fff) { + uVar5 = iVar4 + 1; + Connection->OutData[iVar4 % 0x4000] = (uchar)y; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + iVar4 = iVar4 + 2; + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((uint)y >> 8); + Connection->NextToWrite = iVar4; + } + else { + Connection->Overflow = true; + } + if (iVar4 < local_30 + 0x4000) { + Text_local._0_1_ = (uchar)z; + Connection->OutData[iVar4 % 0x4000] = (uchar)Text_local; + Connection->NextToWrite = iVar4 + 1; + } + else { + Connection->Overflow = true; + } + if (Text == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + sVar2 = strlen(Text); + iVar4 = Connection->NextToWrite; + if (iVar4 < local_30 + 0x3fff) { + Connection->OutData[iVar4 % 0x4000] = (uchar)(sVar2 & 0xffff); + uVar5 = iVar4 + 1; + uVar3 = iVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)((sVar2 & 0xffff) >> 8); + Connection->NextToWrite = iVar4 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar2) { + SendText(Connection,Text,sVar2); + } + } + FinishSendData(Connection); + return; + } + return; + } + Connection = (TConnection *)s_SendTalk__K___Text_ist_NULL__08109e27; + } + error((char *)Connection); + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080d5313) +// WARNING: Variable defined which should be unmapped: pl + +void SendChannels(TConnection *Connection) + +{ + int iVar1; + int iVar2; + ulong uVar3; + uint uVar4; + bool bVar5; + size_t sVar6; + uint uVar7; + int i; + int iVar8; + uchar uVar9; + uchar uVar10; + int Count; + uint uVar11; + uint uVar12; + int i_1; + uint uVar13; + ulong uStack_50; + size_t sStack_44; + undefined1 auStack_40 [12]; + uint local_34; + char *local_28; + undefined1 *local_24; + bool_0_ *Available; + int local_1c; + int Channels; + TPlayer *pTStack_14; + bool OwnChannel; + TPlayer *pl; + + Available = &stack0xffffffb4; + uStack_50 = 0x80d5017; + bVar5 = BeginSendData(Connection); + if (bVar5) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = 0xab; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + uStack_50 = 0x80d504d; + pTStack_14 = TConnection::GetPlayer(Connection); + if (pTStack_14 != (TPlayer *)0x0) { + uVar9 = '\0'; + iVar8 = 0; + uStack_50 = 0x80d506a; + Channels._3_1_ = MayOpenChannel((pTStack_14->super_TCreature).ID); + uStack_50 = 0x80d5072; + local_1c = GetNumberOfChannels(); + iVar1 = -(local_1c + 0xfU & 0xfffffff0); + local_24 = auStack_40 + iVar1; + uVar10 = '\0'; + if (0 < local_1c) { + do { + uVar3 = (pTStack_14->super_TCreature).ID; + *(int *)(&stack0xffffffb4 + iVar1) = iVar8; + *(ulong *)(&stack0xffffffb8 + iVar1) = uVar3; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d53bb; + bVar5 = ChannelAvailable(*(int *)(&stack0xffffffb4 + iVar1), + *(ulong *)(&stack0xffffffb8 + iVar1)); + uVar9 = uVar10; + if (bVar5) { + uVar9 = uVar10 + '\x01'; + } + local_24[iVar8] = bVar5; + iVar8 = iVar8 + 1; + uVar10 = uVar9; + } while (iVar8 < local_1c); + } + if (Channels._3_1_ != '\0') { + uVar9 = uVar9 + '\x01'; + } + iVar8 = Connection->NextToSend; + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar8 + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = uVar9; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + if (Channels._3_1_ != '\0') { + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar8 + 0x3fff) { + uVar11 = iVar2 + 1; + uVar13 = iVar2 + 0x4000; + if (-1 < (int)uVar11) { + uVar13 = uVar11; + } + Connection->OutData[iVar2 % 0x4000] = 0xff; + *(undefined1 *)((int)Connection + (uVar11 - (uVar13 & 0xffffc000)) + 0x806) = + 0xff; + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + *(char **)(&stack0xffffffb4 + iVar1) = "Private Chat Channel"; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d50f8; + sVar6 = strlen(*(char **)(&stack0xffffffb4 + iVar1)); + iVar8 = Connection->NextToWrite; + if (iVar8 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar8 % 0x4000] = (uchar)(sVar6 & 0xffff); + uVar11 = iVar8 + 1; + uVar13 = iVar8 + 0x4000; + if (-1 < (int)uVar11) { + uVar13 = uVar11; + } + *(char *)((int)Connection + (uVar11 - (uVar13 & 0xffffc000)) + 0x806) = + (char)((sVar6 & 0xffff) >> 8); + Connection->NextToWrite = iVar8 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar6) { + *(size_t *)((int)&sStack_44 + iVar1) = sVar6; + *(char **)(&stack0xffffffb8 + iVar1) = "Private Chat Channel"; + *(TConnection **)(&stack0xffffffb4 + iVar1) = Connection; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d513b; + SendText(*(TConnection **)(&stack0xffffffb4 + iVar1), + *(char **)(&stack0xffffffb8 + iVar1),*(int *)((int)&sStack_44 + iVar1)) + ; + } + } + if (0 < local_1c) { + uVar13 = 0; + do { + if (local_24[uVar13] != '\0') { + iVar8 = Connection->NextToWrite; + if (iVar8 < Connection->NextToSend + 0x3fff) { + uVar7 = iVar8 + 1; + Connection->OutData[iVar8 % 0x4000] = (uchar)(uVar13 & 0xffff); + uVar11 = iVar8 + 0x4000; + if (-1 < (int)uVar7) { + uVar11 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar11 & 0xffffc000)) + 0x806) = + (char)((uVar13 & 0xffff) >> 8); + Connection->NextToWrite = iVar8 + 2; + } + else { + Connection->Overflow = true; + } + uVar3 = (pTStack_14->super_TCreature).ID; + *(uint *)(&stack0xffffffb4 + iVar1) = uVar13; + *(ulong *)(&stack0xffffffb8 + iVar1) = uVar3; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d5198; + local_28 = GetChannelName(*(int *)(&stack0xffffffb4 + iVar1), + *(ulong *)(&stack0xffffffb8 + iVar1)); + if (local_28 == (char *)0x0) { + *(char **)(&stack0xffffffb4 + iVar1) = "SendString: String ist NULL.\n"; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d5270; + error(*(char **)(&stack0xffffffb4 + iVar1)); + } + else { + *(char **)(&stack0xffffffb4 + iVar1) = local_28; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d51ae; + sVar6 = strlen(*(char **)(&stack0xffffffb4 + iVar1)); + uVar11 = sVar6 & 0xffff; + local_34 = uVar11; + iVar8 = Connection->NextToWrite; + if (iVar8 < Connection->NextToSend + 0x3fff) { + local_34._0_1_ = (uchar)uVar11; + Connection->OutData[iVar8 % 0x4000] = (uchar)local_34; + uVar12 = iVar8 + 1; + uVar7 = iVar8 + 0x4000; + if (-1 < (int)uVar12) { + uVar7 = uVar12; + } + local_34 = uVar11 >> 8; + uVar4 = local_34; + local_34._0_1_ = (uchar)(uVar11 >> 8); + *(uchar *)((int)Connection + (uVar12 - (uVar7 & 0xffffc000)) + 0x806 + ) = (uchar)local_34; + Connection->NextToWrite = iVar8 + 2; + local_34 = uVar4; + } + else { + Connection->Overflow = true; + } + if (0 < (int)sVar6) { + *(size_t *)((int)&sStack_44 + iVar1) = sVar6; + *(char **)(&stack0xffffffb8 + iVar1) = local_28; + *(TConnection **)(&stack0xffffffb4 + iVar1) = Connection; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d51ef; + SendText(*(TConnection **)(&stack0xffffffb4 + iVar1), + *(char **)(&stack0xffffffb8 + iVar1), + *(int *)((int)&sStack_44 + iVar1)); + } + } + } + uVar13 = uVar13 + 1; + } while ((int)uVar13 < local_1c); + } + *(TConnection **)(&stack0xffffffb4 + iVar1) = Connection; + *(undefined4 *)((int)&uStack_50 + iVar1) = 0x80d5204; + FinishSendData(*(TConnection **)(&stack0xffffffb4 + iVar1)); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void SendOpenChannel(TConnection *Connection,int Channel) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + char *__s; + size_t Length; + uint uVar4; + uint uVar5; + TPlayer *pl; + + bVar1 = BeginSendData(Connection); + if (bVar1) { + if (Channel == 3) { + error("SendOpenChannel: Kanal ist GM-Request-Queue.\n"); + return; + } + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0xac; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + pTVar2 = TConnection::GetPlayer(Connection); + if (pTVar2 != (TPlayer *)0x0) { + if ((-1 < Channel) && (iVar3 = GetNumberOfChannels(), Channel < iVar3)) { + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)(Channel & 0xffffU); + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Channel & 0xffffU) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + __s = GetChannelName(Channel,(pTVar2->super_TCreature).ID); + if (__s == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + Length = strlen(__s); + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,__s,Length); + } + } + FinishSendData(Connection); + return; + } + error(&DAT_081098a0); + return; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Name_local +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendPrivateChannel(TConnection *Connection,char *Name) + +{ + int iVar1; + int iVar2; + bool bVar3; + size_t Length; + uint uVar4; + uint uVar5; + char *Name_local; + + bVar3 = BeginSendData(Connection); + if (!bVar3) { + return; + } + iVar1 = Connection->NextToSend; + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar1 + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 0xad; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + if (Name != (char *)0x0) { + Length = strlen(Name); + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar1 + 0x3fff) { + Connection->OutData[iVar2 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar2 + 1; + uVar4 = iVar2 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,Name,Length); + } + FinishSendData(Connection); + return; + } + error("SendPrivateChannel: Name ist NULL.\n"); + return; +} + + + +void SendOpenRequestQueue(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + int iVar3; + uint uVar4; + uint uVar5; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0xae; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + uVar5 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = '\x03'; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(undefined1 *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = 0; + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Name_local + +void __regparm2 SendDeleteRequest(TConnection *Connection,char *Name) + +{ + int iVar1; + int iVar2; + bool bVar3; + size_t Length; + uint uVar4; + uint uVar5; + TConnection *in_stack_00000004; + char *in_stack_00000008; + char *Name_local; + + bVar3 = BeginSendData(in_stack_00000004); + if (!bVar3) { + return; + } + iVar1 = in_stack_00000004->NextToSend; + iVar2 = in_stack_00000004->NextToWrite; + if (iVar2 < iVar1 + 0x4000) { + in_stack_00000004->OutData[iVar2 % 0x4000] = 0xaf; + in_stack_00000004->NextToWrite = iVar2 + 1; + } + else { + in_stack_00000004->Overflow = true; + } + if (in_stack_00000008 != (char *)0x0) { + Length = strlen(in_stack_00000008); + iVar2 = in_stack_00000004->NextToWrite; + if (iVar2 < iVar1 + 0x3fff) { + in_stack_00000004->OutData[iVar2 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar2 + 1; + uVar4 = iVar2 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)in_stack_00000004 + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + in_stack_00000004->NextToWrite = iVar2 + 2; + } + else { + in_stack_00000004->Overflow = true; + } + if (0 < (int)Length) { + SendText(in_stack_00000004,in_stack_00000008,Length); + } + FinishSendData(in_stack_00000004); + return; + } + error("SendDeleteRequest: Name ist NULL.\n"); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Name_local +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void SendFinishRequest(TConnection *Connection,char *Name) + +{ + int iVar1; + int iVar2; + bool bVar3; + size_t Length; + uint uVar4; + uint uVar5; + char *Name_local; + + bVar3 = BeginSendData(Connection); + if (!bVar3) { + return; + } + iVar1 = Connection->NextToSend; + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar1 + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 0xb0; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + if (Name != (char *)0x0) { + Length = strlen(Name); + iVar2 = Connection->NextToWrite; + if (iVar2 < iVar1 + 0x3fff) { + Connection->OutData[iVar2 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar2 + 1; + uVar4 = iVar2 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,Name,Length); + } + FinishSendData(Connection); + return; + } + error("SendFinishRequest: Name ist NULL.\n"); + return; +} + + + +void SendCloseRequest(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToWrite; + if (iVar1 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar1 % 0x4000] = 0xb1; + Connection->NextToWrite = iVar1 + 1; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void SendOpenOwnChannel(TConnection *Connection,int Channel) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + char *__s; + size_t Length; + uint uVar4; + uint uVar5; + TPlayer *pl; + + bVar1 = BeginSendData(Connection); + if (bVar1) { + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0xb2; + Connection->NextToWrite = iVar3 + 1; + } + else { + Connection->Overflow = true; + } + pTVar2 = TConnection::GetPlayer(Connection); + if (pTVar2 != (TPlayer *)0x0) { + if ((-1 < Channel) && (iVar3 = GetNumberOfChannels(), Channel < iVar3)) { + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)(Channel & 0xffffU); + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Channel & 0xffffU) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + __s = GetChannelName(Channel,(pTVar2->super_TCreature).ID); + if (__s == (char *)0x0) { + error("SendString: String ist NULL.\n"); + } + else { + Length = strlen(__s); + iVar3 = Connection->NextToWrite; + if (iVar3 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar3 % 0x4000] = (uchar)(Length & 0xffff); + uVar5 = iVar3 + 1; + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Length & 0xffff) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + if (0 < (int)Length) { + SendText(Connection,__s,Length); + } + } + FinishSendData(Connection); + return; + } + error(&DAT_081099e0); + return; + } + } + return; +} + + + +void SendCloseChannel(TConnection *Connection,int Channel) + +{ + int iVar1; + bool bVar2; + int iVar3; + uint uVar4; + uint uVar5; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + iVar3 = Connection->NextToWrite; + if (iVar3 < iVar1 + 0x4000) { + Connection->OutData[iVar3 % 0x4000] = 0xb3; + iVar3 = iVar3 + 1; + Connection->NextToWrite = iVar3; + } + else { + Connection->Overflow = true; + } + if (iVar3 < iVar1 + 0x3fff) { + uVar5 = iVar3 + 1; + Connection->OutData[iVar3 % 0x4000] = (uchar)(Channel & 0xffffU); + uVar4 = iVar3 + 0x4000; + if (-1 < (int)uVar5) { + uVar4 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar4 & 0xffffc000)) + 0x806) = + (char)((Channel & 0xffffU) >> 8); + Connection->NextToWrite = iVar3 + 2; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +void SendOutfit(TConnection *Connection) + +{ + undefined2 uVar1; + int iVar2; + bool bVar3; + TPlayer *pTVar4; + uint uVar5; + short sVar6; + TPlayer *pl; + uint uVar7; + + bVar3 = BeginSendData(Connection); + if (bVar3) { + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x4000) { + Connection->OutData[iVar2 % 0x4000] = 200; + Connection->NextToWrite = iVar2 + 1; + } + else { + Connection->Overflow = true; + } + pTVar4 = TConnection::GetPlayer(Connection); + if (pTVar4 != (TPlayer *)0x0) { + uVar1 = (undefined2)(pTVar4->super_TCreature).OrgOutfit.OutfitID; + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x3fff) { + Connection->OutData[iVar2 % 0x4000] = (uchar)uVar1; + uVar7 = iVar2 + 1; + uVar5 = iVar2 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)uVar1 >> 8); + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + SendText(Connection,(char *)(pTVar4->super_TCreature).OrgOutfit.field_1.Colors,4); + if ((pTVar4->super_TCreature).Sex == 1) { + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x3fff) { + uVar7 = iVar2 + 1; + Connection->OutData[iVar2 % 0x4000] = 0x80; + uVar5 = iVar2 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(undefined1 *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = 0; + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + bVar3 = CheckRight((pTVar4->super_TCreature).ID,PREMIUM_ACCOUNT); + sVar6 = (ushort)bVar3 * 3 + 0x83; + } + else { + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x3fff) { + uVar7 = iVar2 + 1; + Connection->OutData[iVar2 % 0x4000] = 0x88; + uVar5 = iVar2 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(undefined1 *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = 0; + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + bVar3 = CheckRight((pTVar4->super_TCreature).ID,PREMIUM_ACCOUNT); + sVar6 = (ushort)bVar3 * 3 + 0x8b; + } + iVar2 = Connection->NextToWrite; + if (iVar2 < Connection->NextToSend + 0x3fff) { + uVar7 = iVar2 + 1; + Connection->OutData[iVar2 % 0x4000] = (uchar)sVar6; + uVar5 = iVar2 + 0x4000; + if (-1 < (int)uVar7) { + uVar5 = uVar7; + } + *(char *)((int)Connection + (uVar7 - (uVar5 & 0xffffc000)) + 0x806) = + (char)((ushort)sVar6 >> 8); + Connection->NextToWrite = iVar2 + 2; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Name_local + +void __regparm2 SendBuddyData(TConnection *Connection,ulong CharacterID,char *Name,bool Online) + +{ + bool bVar1; + size_t Length; + uint uVar2; + int iVar3; + uint uVar4; + undefined3 in_stack_00000009; + char *in_stack_0000000c; + char in_stack_00000010; + int local_20; + bool Online_local; + char *Name_local; + + bVar1 = BeginSendData((TConnection *)Name); + if (bVar1) { + local_20 = *(int *)(Name + 0x4808); + iVar3 = *(int *)(Name + 0x4810); + if (iVar3 < local_20 + 0x4000) { + Name[iVar3 % 0x4000 + 0x806] = -0x2e; + iVar3 = iVar3 + 1; + *(int *)(Name + 0x4810) = iVar3; + } + else { + Name[0x4814] = '\x01'; + } + if (iVar3 < local_20 + 0x3ffd) { + uVar4 = iVar3 + 1; + Name[iVar3 % 0x4000 + 0x806] = Online; + uVar2 = iVar3 + 0x4000; + if (-1 < (int)uVar4) { + uVar2 = uVar4; + } + Name[(uVar4 - (uVar2 & 0xffffc000)) + 0x806] = (char)in_stack_00000009; + uVar4 = iVar3 + 2; + uVar2 = iVar3 + 0x4001; + if (-1 < (int)uVar4) { + uVar2 = uVar4; + } + Name[(uVar4 - (uVar2 & 0xffffc000)) + 0x806] = (char)((uint3)in_stack_00000009 >> 8); + uVar4 = iVar3 + 3; + uVar2 = iVar3 + 0x4002; + if (-1 < (int)uVar4) { + uVar2 = uVar4; + } + Name[(uVar4 - (uVar2 & 0xffffc000)) + 0x806] = (char)((uint3)in_stack_00000009 >> 0x10); + *(int *)(Name + 0x4810) = iVar3 + 4; + } + else { + Name[0x4814] = '\x01'; + } + if (in_stack_0000000c != (char *)0x0) { + Length = strlen(in_stack_0000000c); + iVar3 = *(int *)(Name + 0x4810); + if (iVar3 < local_20 + 0x3fff) { + Name[iVar3 % 0x4000 + 0x806] = (char)(Length & 0xffff); + uVar4 = iVar3 + 1; + uVar2 = iVar3 + 0x4000; + if (-1 < (int)uVar4) { + uVar2 = uVar4; + } + Name[(uVar4 - (uVar2 & 0xffffc000)) + 0x806] = (char)((Length & 0xffff) >> 8); + *(int *)(Name + 0x4810) = iVar3 + 2; + } + else { + Name[0x4814] = '\x01'; + } + if (0 < (int)Length) { + SendText((TConnection *)Name,in_stack_0000000c,Length); + local_20 = *(int *)(Name + 0x4808); + } + iVar3 = *(int *)(Name + 0x4810); + if (iVar3 < local_20 + 0x4000) { + Name[iVar3 % 0x4000 + 0x806] = in_stack_00000010 != '\0'; + *(int *)(Name + 0x4810) = iVar3 + 1; + } + else { + Name[0x4814] = '\x01'; + } + FinishSendData((TConnection *)Name); + return; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Online_local + +void SendBuddyStatus(TConnection *Connection,ulong CharacterID,bool Online) + +{ + int iVar1; + bool bVar2; + uint uVar3; + uint uVar4; + uint uVar5; + bool Online_local; + + bVar2 = BeginSendData(Connection); + if (bVar2) { + iVar1 = Connection->NextToSend; + uVar4 = Connection->NextToWrite; + if ((int)uVar4 < iVar1 + 0x4000) { + uVar3 = uVar4 + 0x3fff; + if (-1 < (int)uVar4) { + uVar3 = uVar4; + } + *(char *)((int)Connection + (uVar4 - (uVar3 & 0xffffc000)) + 0x806) = !Online + -0x2d; + uVar4 = uVar4 + 1; + Connection->NextToWrite = uVar4; + } + else { + Connection->Overflow = true; + } + if ((int)uVar4 < iVar1 + 0x3ffd) { + uVar5 = uVar4 + 1; + Connection->OutData[(int)uVar4 % 0x4000] = (uchar)CharacterID; + uVar3 = uVar4 + 0x4000; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CharacterID >> 8); + uVar5 = uVar4 + 2; + uVar3 = uVar4 + 0x4001; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CharacterID >> 0x10); + uVar5 = uVar4 + 3; + uVar3 = uVar4 + 0x4002; + if (-1 < (int)uVar5) { + uVar3 = uVar5; + } + *(char *)((int)Connection + (uVar5 - (uVar3 & 0xffffc000)) + 0x806) = + (char)(CharacterID >> 0x18); + Connection->NextToWrite = uVar4 + 4; + } + else { + Connection->Overflow = true; + } + FinishSendData(Connection); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Message + +void BroadcastMessage(int Mode,char *Text,...) + +{ + TConnection *Connection_00; + TConnection *Connection; + char local_40c [4]; + char Message [1024]; + + vsnprintf(local_40c,0x400,Text,&stack0x0000000c); + Connection_00 = GetFirstConnection(); + while (Connection_00 != (TConnection *)0x0) { + if (Connection_00->State - CONNECTION_LOGIN < 4) { + SendMessage(Connection_00,Mode,local_40c); + } + Connection_00 = GetNextConnection(); + } + return; +} + + + +void DeleteGamemasterRequest(char *Name) + +{ + bool bVar1; + TPlayer *pl; + TConnection *this; + TPlayer *pTVar2; + undefined3 extraout_var; + char *Name_00; + TConnection *Connection; + + if (Name != (char *)0x0) { + this = GetFirstConnection(); + while (this != (TConnection *)0x0) { + if ((this->State - CONNECTION_LOGIN < 4) && + (pTVar2 = TConnection::GetPlayer(this), pTVar2 != (TPlayer *)0x0)) { + bVar1 = ChannelSubscribed(3,(pTVar2->super_TCreature).ID); + if (bVar1) { + SendDeleteRequest((TConnection *)CONCAT31(extraout_var,bVar1),Name_00); + } + } + this = GetNextConnection(); + } + return; + } + error("DeleteGamemasterRequest: Name ist NULL.\n"); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z13BeginSendDataP11TConnection(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Text_local + +void SendText(TConnection *Connection,char *Text,int Length) + +{ + int Offset; + int iVar1; + uchar *__dest; + size_t __n; + char *Text_local; + + if (Text == (char *)0x0) { + error("SendText: Text ist NULL.\n"); + return; + } + if (0 < Length) { + if ((Connection->NextToSend - Length) + 0x4000 < Connection->NextToWrite) { + Connection->Overflow = true; + } + else { + iVar1 = Connection->NextToWrite % 0x4000; + if (Length + iVar1 < 0x4001) { + __dest = Connection->OutData + iVar1; + __n = Length; + } + else { + memcpy(Connection->OutData + iVar1,Text,0x4000 - iVar1); + __dest = Connection->OutData; + Text = Text + (0x4000 - iVar1); + __n = (Length + iVar1) - 0x4000; + } + memcpy(__dest,Text,__n); + Connection->NextToWrite = Connection->NextToWrite + Length; + } + return; + } + error(&DAT_08109a60); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +bool CommandAllowed(TConnection *Connection,ushort Command) + +{ + CONNECTIONSTATE CVar1; + + if (Connection == (TConnection *)0x0) { + error("CommandAllowed: Connection ist NULL.\n"); + } + else { + CVar1 = Connection->State; + if (CVar1 == CONNECTION_GAME) { + return 1 < (ushort)(Command - 10); + } + if ((3 < (int)CVar1) && ((int)CVar1 < 7)) { + if ((Command != 0xe6) && (((Command != 0xe8 && (Command != 0x1e)) && (Command != 0x14))) + ) { + return false; + } + return true; + } + error(&DAT_08109f80,CVar1,(uint)Command); + } + return false; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool CheckSpecialCoordinates(void) + +{ + bool bVar1; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + char in_stack_00000014; + + if (in_stack_00000008 == 0xffff) { + bVar1 = in_stack_00000014 != '\0'; + if (in_stack_0000000c != 0) { + if ((in_stack_0000000c - 0xbU < 0x35) || (0x4f < in_stack_0000000c)) { + print(); + bVar1 = false; + } + else { + bVar1 = true; + } + } + } + else { + bVar1 = IsOnMap(in_stack_00000008,in_stack_0000000c,in_stack_00000010); + } + return bVar1; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +bool CheckVisibility(int Command,TConnection *Connection,int x,int y,int z) + +{ + bool bVar1; + int local_1c; + int posx; + int posy; + int posz; + + if (Connection == (TConnection *)0x0) { + error("CheckVisibility: Connection ist NULL.\n"); + } + else { + bVar1 = TConnection::IsVisible(Connection,x,y,z); + if (bVar1) { + return true; + } + TConnection::GetPosition(Connection,&local_1c,&posx,&posy); + print(); + } + return false; +} + + + +bool CheckObjectType(int Command,int TypeID) + +{ + bool bVar1; + + bVar1 = ObjectTypeExists(TypeID); + if (!bVar1) { + print(); + } + return bVar1; +} + + + +ObjectType GetObjectType(ushort TypeID) + +{ + bool bVar1; + uint TypeID_00; + undefined2 in_stack_00000006; + ushort in_stack_00000008; + + TypeID_00 = (uint)in_stack_00000008; + bVar1 = ObjectTypeExists(TypeID_00); + if (!bVar1) { + print(); + TypeID_00 = 0; + } + ObjectType::setTypeID(_TypeID,TypeID_00); + return (ObjectType)(int)_TypeID; +} + + + +void CGoDirection(TConnection *Connection,int dx,int dy) + +{ + bool bVar1; + RESULT r; + TPlayer *this; + TPlayer *pl; + int local_48; + int x; + int y; + int z; + TToDoEntry TD; + + if (Connection == (TConnection *)0x0) { + error("CGoDirection: Connection ist NULL.\n"); + } + else { + TConnection::GetPosition(Connection,&local_48,&x,&y); + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + // try { // try from 080d6a74 to 080d6abb has its CatchHandler @ 080d6ae0 + bVar1 = TCreature::ToDoClear(&this->super_TCreature); + if (bVar1) { + SendSnapback(Connection); + } + z = 1; + TD.field_1.Go.x = dy + x; + TD.Code = dx + local_48; + TD.field_1.Go.y = y; + TCreature::ToDoAdd(&this->super_TCreature,(TToDoEntry *)&z); + TCreature::ToDoStart(&this->super_TCreature); + } + } + return; +} + + + +void CGoPath(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + uint uVar2; + TPlayer *this; + uint uVar3; + int Steps; + int local_50; + int i; + TPlayer *pl; + int x; + int y; + int z; + TToDoEntry TD; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080d6c37 to 080d6c3b has its CatchHandler @ 080d6c86 + error("CGoPath: Connection ist NULL.\n"); + } + else { + // try { // try from 080d6b42 to 080d6b6c has its CatchHandler @ 080d6c86 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + TConnection::GetPosition(Connection,(int *)&pl,&x,&y); + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + // try { // try from 080d6b77 to 080d6c27 has its CatchHandler @ 080d6c3e + bVar1 = TCreature::ToDoClear(&this->super_TCreature); + if (bVar1) { + SendSnapback(Connection); + } + local_50 = 0; + if ((uVar2 & 0xff) != 0) { + do { + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + switch(uVar3 & 0xff) { + default: + goto switchD_080d6ba0_caseD_0; + case 1: + pl = (TPlayer *)((int)&(pl->super_TCreature)._vptr_TCreature + 1); + goto LAB_080d6baa; + case 2: + pl = (TPlayer *)((int)&(pl->super_TCreature)._vptr_TCreature + 1); + break; + case 3: + break; + case 4: + pl = (TPlayer *)((int)pl[-1].AddresseesTimes + 0x4f); + break; + case 5: + pl = (TPlayer *)((int)pl[-1].AddresseesTimes + 0x4f); + goto LAB_080d6baa; + case 6: + pl = (TPlayer *)((int)pl[-1].AddresseesTimes + 0x4f); + case 7: + goto switchD_080d6ba0_caseD_7; + case 8: + pl = (TPlayer *)((int)&(pl->super_TCreature)._vptr_TCreature + 1); + goto switchD_080d6ba0_caseD_7; + } + x = x + -1; +LAB_080d6baa: + z = 1; + TD.Code = (ToDoType)pl; + TD.field_1.Go.x = x; + TD.field_1.Go.y = y; + TCreature::ToDoAdd(&this->super_TCreature,(TToDoEntry *)&z); +switchD_080d6ba0_caseD_0: + local_50 = local_50 + 1; + } while (local_50 < (int)(uVar2 & 0xff)); + } + TCreature::ToDoStart(&this->super_TCreature); + } + } + return; +switchD_080d6ba0_caseD_7: + x = x + 1; + goto LAB_080d6baa; +} + + + +void CStop(TConnection *Connection) + +{ + TPlayer *this; + + if (Connection == (TConnection *)0x0) { + error("CGoStop: Connection ist NULL.\n"); + return; + } + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + TCreature::ToDoStop(&this->super_TCreature); + return; + } + return; +} + + + +void CLookAtPoint(TConnection *Connection,TReadBuffer *Buffer) + +{ + ulong CreatureID_00; + bool bVar1; + TPlayer *pl; + uint uVar2; + uint uVar3; + uint uVar4; + TPlayer *pTVar5; + ObjectType *Type; + ObjectType *z; + int x; + ulong CreatureID; + int y; + int posx; + int posy; + int posz; + Object local_2c; + Object Obj; + + if (Connection == (TConnection *)0x0) { + error("CLookAtPoint: Connection ist NULL.\n"); + } + else { + // try { // try from 080d6d05 to 080d6df2 has its CatchHandler @ 080d6ee6 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + z = (ObjectType *)(uVar4 & 0xff); + bVar1 = CheckSpecialCoordinates(); + if (bVar1) { + if ((uVar2 == 0xffff) || + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,(int)z), bVar1)) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 != (TPlayer *)0x0) { + CreatureID_00 = (pTVar5->super_TCreature).ID; + ObjectType::setTypeID((ObjectType *)&posz,0); + Type = (ObjectType *)0xffffffff; + if (uVar2 == 0xffff) { + Type = z; + } + GetObject((ulong)&local_2c,CreatureID_00,uVar2,uVar3 & 0xffff,(int)z,Type); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + posz = local_2c.ObjectID; + // try { // try from 080d6e20 to 080d6e24 has its CatchHandler @ 080d6ea1 + Look(CreatureID_00,(Object *)&posz); + } + } + } + else { + // try { // try from 080d6e3f to 080d6e9b has its CatchHandler @ 080d6ee6 + TConnection::GetPosition(Connection,&y,&posx,&posy); + print(); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +void CRefreshField(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + TConnection *Connection_00; + int x_00; + int x; + int y; + int posx; + int posy; + int posz; + + if (Connection == (TConnection *)0x0) { + error("CRefreshField: Connection ist NULL.\n"); + } + else { + // try { // try from 080d6f22 to 080d700e has its CatchHandler @ 080d7014 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + Connection_00 = (TConnection *)(uVar3 & 0xffff); + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + bVar1 = IsOnMap(uVar2,(int)Connection_00,uVar3 & 0xff); + if (bVar1) { + bVar1 = TConnection::IsVisible(Connection,uVar2,(int)Connection_00,uVar3 & 0xff); + if (bVar1) { + SendFieldData(Connection_00,x_00,(int)Connection,uVar2); + } + else { + TConnection::GetPosition(Connection,&y,&posx,&posy); + print(); + } + } + } + return; +} + + + +void CTalk(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + int GamemasterID; + uint uVar2; + TPlayer *this; + char *pcVar3; + ulong uVar4; + TConnection *this_00; + TPlayer *pTVar5; + TCreature *pTVar6; + int iVar7; + uint uVar8; + int Mode; + TPlayer *pl; + int Channel; + char Text [256]; + char Addressee [30]; + + if (Connection == (TConnection *)0x0) { + error("CTalk: Connection ist NULL.\n"); + return; + } + // try { // try from 080d7055 to 080d713e has its CatchHandler @ 080d76f6 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar2 = uVar2 & 0xff; + if ((((((7 < uVar2 - 1) && (uVar2 != 0xb)) && (uVar2 != 0xf)) && + ((uVar2 != 10 && (uVar2 != 0xe)))) && (uVar2 != 9)) && (uVar2 != 0xd)) { +LAB_080d708d: + print(); + return; + } + Text[0xfc] = '\0'; + pl = (TPlayer *)0x0; + if ((((uVar2 == 4) || (uVar2 == 7)) || ((uVar2 == 0xb || (uVar2 == 0xf)))) && + ((*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,Text + 0xfc,0x1e), + Text[0xfc] == '\0')) goto LAB_080d7126; + if (((uVar2 == 5) || (uVar2 == 10)) || (uVar2 == 0xe)) { + uVar8 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + pl = (TPlayer *)(uVar8 & 0xffff); + iVar7 = GetNumberOfChannels(); + if (iVar7 <= (int)pl) goto LAB_080d708d; + sprintf(Text + 0xfc,"%d",pl); + } + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&Channel,0x100); + if (((char)Channel == '\0') || + (this = TConnection::GetPlayer(Connection), this == (TPlayer *)0x0)) goto LAB_080d7126; + pcVar3 = strchr((char *)&Channel,10); + if (pcVar3 != (char *)0x0) { + error("CTalk: %s verwendet Newlines (%d,%s)\n",(this->super_TCreature).Name,uVar2,&Channel); + return; + } + if ((uVar2 == 7) && + (bVar1 = CheckRight((this->super_TCreature).ID,READ_GAMEMASTER_CHANNEL), !bVar1)) { + uVar2 = 4; + } + if ((uVar2 == 9) && + (bVar1 = CheckRight((this->super_TCreature).ID,GAMEMASTER_BROADCAST), !bVar1)) { + uVar2 = 1; + } + if ((uVar2 == 10) && + (bVar1 = CheckRight((this->super_TCreature).ID,GAMEMASTER_BROADCAST), !bVar1)) { + uVar2 = 5; + } + if ((uVar2 == 0xb) && + (bVar1 = CheckRight((this->super_TCreature).ID,GAMEMASTER_BROADCAST), !bVar1)) { + uVar2 = 4; + } + if ((uVar2 == 0xd) && + (bVar1 = CheckRight((this->super_TCreature).ID,ANONYMOUS_BROADCAST), !bVar1)) { + uVar2 = 1; + } + if ((uVar2 == 0xe) && + (bVar1 = CheckRight((this->super_TCreature).ID,ANONYMOUS_BROADCAST), !bVar1)) { + uVar2 = 5; + } + if ((uVar2 == 0xf) && + (bVar1 = CheckRight((this->super_TCreature).ID,ANONYMOUS_BROADCAST), !bVar1)) { + uVar2 = 4; + } + if ((uVar2 == 3) && + (iVar7 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0]), iVar7 < 2)) { + pcVar3 = "You may not yell as long as you are on level 1."; + goto LAB_080d731f; + } + if (uVar2 == 5) { + iVar7 = TSkill::Get((this->super_TCreature).super_TSkillBase.Skills[0]); + if (iVar7 < 2) { + pcVar3 = "You may not speak into channels as long as you are on level 1."; + goto LAB_080d731f; + } +LAB_080d7444: + if (pl == (TPlayer *)0x3) { +LAB_080d7126: + print(); + return; + } + } + else if ((uVar2 == 10) || (uVar2 == 0xe)) goto LAB_080d7444; + if ((((uVar2 == 5) || (uVar2 == 10)) || (uVar2 == 0xe)) && + (bVar1 = ChannelSubscribed((int)pl,(this->super_TCreature).ID), !bVar1)) { + Text[0xfc] = '\0'; + uVar2 = 1; + } + if (((uVar2 == 5) && (pl == (TPlayer *)0x7)) && + (bVar1 = CheckRight((this->super_TCreature).ID,HIGHLIGHT_HELP_CHANNEL), bVar1)) { + this->TutorActivities = this->TutorActivities + 1; + print(); + uVar2 = 0xc; + } + if (uVar2 == 8) { + if (this->Request == 0) { + return; + } + if (this->RequestProcessingGamemaster == 0) { + pcVar3 = "Please wait until your request is answered."; + goto LAB_080d731f; + } + pTVar6 = GetCreature(this->RequestProcessingGamemaster); + if (pTVar6 == (TCreature *)0x0) { + SendCloseRequest(Connection); + this->Request = 0; + return; + } + strcpy(Text + 0xfc,pTVar6->Name); + } + if (uVar2 != 6) { + // try { // try from 080d7226 to 080d7238 has its CatchHandler @ 080d76a6 + TCreature::ToDoTalk(&this->super_TCreature); + TCreature::ToDoStart(&this->super_TCreature); + return; + } + if (this->Request == 0) { + if ((char)Channel == '\0') { + return; + } + // try { // try from 080d7268 to 080d76a0 has its CatchHandler @ 080d76f6 + uVar4 = AddDynamicString((char *)&Channel); + this->Request = uVar4; + this->RequestTimestamp = RoundNr; + this->RequestProcessingGamemaster = 0; + this_00 = GetFirstConnection(); + if (this_00 == (TConnection *)0x0) { + return; + } + do { + if (((this_00->State - CONNECTION_LOGIN < 4) && + (pTVar5 = TConnection::GetPlayer(this_00), pTVar5 != (TPlayer *)0x0)) && + (bVar1 = ChannelSubscribed(3,(pTVar5->super_TCreature).ID), bVar1)) { + SendTalk(this_00,0,(this->super_TCreature).Name,6,(char *)&Channel,0); + } + this_00 = GetNextConnection(); + } while (this_00 != (TConnection *)0x0); + return; + } + pcVar3 = "You have already submitted a request. Please wait until it is answered."; +LAB_080d731f: + SendMessage(Connection,0x17,pcVar3); + return; +} + + + +void CGetChannels(TConnection *Connection) + +{ + if (Connection != (TConnection *)0x0) { + SendChannels(Connection); + return; + } + error("CGetChannels: Connection ist NULL.\n"); + return; +} + + + +void CJoinChannel(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + TPlayer *pl; + uint uVar2; + int iVar3; + TPlayer *pTVar4; + int Channel; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080d77c7 to 080d77cb has its CatchHandler @ 080d7816 + error("CJoinChannel: ist NULL.\n"); + } + else { + // try { // try from 080d774b to 080d776b has its CatchHandler @ 080d7816 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + iVar3 = GetNumberOfChannels(); + if ((int)uVar2 < iVar3) { + pTVar4 = TConnection::GetPlayer(Connection); + if (pTVar4 != (TPlayer *)0x0) { + // try { // try from 080d777d to 080d77b6 has its CatchHandler @ 080d77ce + bVar1 = JoinChannel(uVar2,(pTVar4->super_TCreature).ID); + if (uVar2 == 3) { + SendOpenRequestQueue(Connection); + SendExistingRequests(Connection); + } + else if (bVar1) { + SendOpenOwnChannel(Connection,uVar2); + } + else { + SendOpenChannel(Connection,uVar2); + } + } + } + } + return; +} + + + +void CLeaveChannel(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *pl; + uint uVar1; + int iVar2; + TPlayer *pTVar3; + int Channel; + + if (Connection == (TConnection *)0x0) { + error("CLeaveChannel: Connection ist NULL.\n"); + } + else { + // try { // try from 080d784b to 080d789b has its CatchHandler @ 080d78a0 + uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + iVar2 = GetNumberOfChannels(); + if ((int)(uVar1 & 0xffff) < iVar2) { + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 != (TPlayer *)0x0) { + LeaveChannel(uVar1 & 0xffff,(pTVar3->super_TCreature).ID,true); + } + } + } + return; +} + + + +void CPrivateChannel(TConnection *Connection,TReadBuffer *Buffer) + +{ + ulong uVar1; + TPlayer *pTVar2; + char *Name_00; + ulong OppID; + char local_3c [4]; + char Name [30]; + + if (Connection == (TConnection *)0x0) { + error("CPrivateChannel: Connection ist NULL.\n"); + } + else { + // try { // try from 080d78f1 to 080d7972 has its CatchHandler @ 080d7975 + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_3c,0x1e); + if (local_3c[0] != '\0') { + uVar1 = GetCharacterID(local_3c); + if (uVar1 == 0) { + SendResult(Connection,PLAYERNOTEXISTING); + } + else { + pTVar2 = TConnection::GetPlayer(Connection); + if (uVar1 == (pTVar2->super_TCreature).ID) { + SendMessage(Connection,0x17, + "You cannot set up a private message channel with yourself."); + } + else { + Name_00 = GetCharacterName(local_3c); + SendPrivateChannel(Connection,Name_00); + } + } + } + } + return; +} + + + +void CProcessRequest(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + TPlayer *pl; + char *Text; + TPlayer *local_40; + TPlayer *Opp; + char Name [30]; + + if (Connection == (TConnection *)0x0) { + error("CProcessRequest: Connection ist NULL.\n"); + } + else { + // try { // try from 080d79b0 to 080d7a9d has its CatchHandler @ 080d7aa3 + pTVar2 = TConnection::GetPlayer(Connection); + if (((pTVar2 != (TPlayer *)0x0) && + (bVar1 = ChannelAvailable(3,(pTVar2->super_TCreature).ID), bVar1)) && + ((*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&Opp,0x1e), (char)Opp != '\0' + )) { + iVar3 = IdentifyPlayer((char *)&Opp,true,true,&local_40); + if (iVar3 == 0) { + if ((local_40->Request != 0) && (local_40->RequestProcessingGamemaster == 0)) { + local_40->RequestProcessingGamemaster = (pTVar2->super_TCreature).ID; + DeleteGamemasterRequest((local_40->super_TCreature).Name); + return; + } + Text = "Request has already been processed."; + } + else { + Text = "Player is not online any more."; + } + SendMessage(Connection,0x17,Text); + SendFinishRequest(Connection,"Name"); + } + } + return; +} + + + +void CRemoveRequest(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + TPlayer *pTVar2; + int iVar3; + TPlayer *pl; + TPlayer *local_40; + TPlayer *Opp; + char Name [30]; + + if (Connection == (TConnection *)0x0) { + error("CRemoveRequest: Connection ist NULL.\n"); + } + else { + // try { // try from 080d7ae0 to 080d7bdc has its CatchHandler @ 080d7be2 + pTVar2 = TConnection::GetPlayer(Connection); + if (((pTVar2 != (TPlayer *)0x0) && + (bVar1 = ChannelAvailable(3,(pTVar2->super_TCreature).ID), bVar1)) && + ((*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&Opp,0x1e), (char)Opp != '\0' + )) { + iVar3 = IdentifyPlayer((char *)&Opp,true,true,&local_40); + if (iVar3 == 0) { + if (local_40->Request != 0) { + if (local_40->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest((local_40->super_TCreature).Name); + } + else if (local_40->RequestProcessingGamemaster != (pTVar2->super_TCreature).ID) + { + return; + } + SendCloseRequest((local_40->super_TCreature).Connection); + local_40->Request = 0; + } + } + else { + SendMessage(Connection,0x17,"Player is not online any more."); + SendFinishRequest(Connection,"Name"); + } + } + } + return; +} + + + +void CCancelRequest(TConnection *Connection) + +{ + bool bVar1; + TPlayer *pTVar2; + TPlayer *pTVar3; + TPlayer *pl; + + if (Connection != (TConnection *)0x0) { + pTVar2 = TConnection::GetPlayer(Connection); + if (pTVar2 != (TPlayer *)0x0) { + bVar1 = ChannelAvailable(3,(pTVar2->super_TCreature).ID); + if ((bVar1) && (pTVar2->Request != 0)) { + if (pTVar2->RequestProcessingGamemaster == 0) { + DeleteGamemasterRequest((pTVar2->super_TCreature).Name); + } + else { + pTVar3 = GetPlayer(pTVar2->RequestProcessingGamemaster); + if (pTVar3 != (TPlayer *)0x0) { + SendFinishRequest((pTVar3->super_TCreature).Connection, + (pTVar2->super_TCreature).Name); + } + } + pTVar2->Request = 0; + } + } + return; + } + error("CCancelRequest: Connection ist NULL.\n"); + return; +} + + + +void CRotate(TConnection *Connection,int Direction) + +{ + RESULT r; + TPlayer *this; + TPlayer *pl; + + if (Connection != (TConnection *)0x0) { + if ((uint)Direction < 4) { + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + // try { // try from 080d7cf5 to 080d7d01 has its CatchHandler @ 080d7d20 + TCreature::ToDoRotate(&this->super_TCreature,Direction); + TCreature::ToDoStart(&this->super_TCreature); + } + } + return; + } + error("CRotate: Connection ist NULL.\n"); + return; +} + + + +void CBugReport(TConnection *Connection,TReadBuffer *Buffer) + +{ + uint *puVar1; + char cVar2; + int iVar3; + char *pcVar4; + time_t *ptVar5; + size_t sVar6; + uint *puVar7; + uint *puVar8; + uint uVar9; + uint uVar10; + int LineStart; + bool bVar11; + int iVar12; + int iVar13; + int iVar14; + int iVar15; + int iVar16; + size_t local_48c; + int LastSpace; + int i; + int local_47c; + int posx; + int posy; + int posz; + time_t Time; + char Line [80]; + char Text [1024]; + + if (Connection == (TConnection *)0x0) { + error("CBugReport: Connection ist NULL.\n"); + return; + } + puVar1 = (uint *)(Line + 0x4c); + // try { // try from 080d7d91 to 080d811b has its CatchHandler @ 080d8121 + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,puVar1,0x400); + while( true ) { + puVar8 = puVar1; + if (Line[0x4c] == '\0') { + return; + } + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + iVar3 = isprint((int)*(char *)((int)puVar8 + + (int)(Line + (-(int)puVar1 - + (uint)CARRY1((byte)uVar10,(byte)uVar10)) + 0x48)) + ); + puVar8 = puVar1; + if (iVar3 != 0) break; + do { + puVar7 = puVar8; + uVar9 = *puVar7 + 0xfefefeff & ~*puVar7; + uVar10 = uVar9 & 0x80808080; + puVar8 = puVar7 + 1; + } while (uVar10 == 0); + bVar11 = (uVar9 & 0x8080) == 0; + if (bVar11) { + uVar10 = uVar10 >> 0x10; + } + if (bVar11) { + puVar8 = (uint *)((int)puVar7 + 6); + } + *(char *)((int)puVar8 + + (int)(Line + (-(int)puVar1 - (uint)CARRY1((byte)uVar10,(byte)uVar10)) + 0x48)) = + '\0'; + } + if (Line[0x4c] == '\0') { + return; + } + time(&posz); + TConnection::GetPosition(Connection,&local_47c,&posx,&posy); + pcVar4 = ctime(&posz); + iVar13 = Connection->TerminalVersion; + iVar12 = Connection->TerminalType; + ptVar5 = (time_t *)TConnection::GetName(Connection); + Log("bugreport","%s - %d/%d - [%d,%d,%d] - %s",ptVar5,iVar12,iVar13,local_47c,posx,posy,pcVar4); + iVar3 = 0; + iVar14 = local_47c; + iVar15 = posx; + iVar16 = posy; +LAB_080d7f12: + do { + if (Line[iVar3 + 0x4c] == '\0') { + Log("bugreport", + "---------------------------------------------------------------------------\n", + ptVar5,iVar12,iVar13,iVar14,iVar15,iVar16,pcVar4); + SendMessage(Connection,0x15,"Comment sent."); + return; + } + local_48c = 0xffffffff; + LastSpace = 0; + while (cVar2 = Line[LastSpace + iVar3 + -0x1c + 0x68], cVar2 != '\0') { + if (0x4a < LastSpace) { + if (local_48c == 0xffffffff) { + strncpy((char *)&Time,(char *)(iVar3 + (int)puVar1),0x4a); + ptVar5 = &Time; + Line[0x46] = '-'; + Line[0x47] = '\0'; + Log("bugreport","%s\n",ptVar5,iVar12,iVar13,iVar14,iVar15,iVar16,pcVar4); + iVar3 = iVar3 + 0x4a; + } + else { + strncpy((char *)&Time,(char *)(iVar3 + (int)puVar1),local_48c); + Line[local_48c - 4] = '\0'; + ptVar5 = &Time; + Log("bugreport","%s\n",ptVar5); + if (Line[local_48c + iVar3 + -0x1c + 0x68] == ' ') { + iVar3 = iVar3 + 1; + } + iVar3 = iVar3 + local_48c; + } + goto LAB_080d7f12; + } + if (cVar2 == '\n') { + strncpy((char *)&Time,(char *)(iVar3 + (int)puVar1),LastSpace); + ptVar5 = &Time; + Line[LastSpace + -4] = '\0'; + Log("bugreport","%s\n",ptVar5); + iVar3 = LastSpace + 1 + iVar3; + goto LAB_080d7f12; + } + bVar11 = isSpace((int)cVar2); + sVar6 = LastSpace; + if (!bVar11) { + sVar6 = local_48c; + } + LastSpace = LastSpace + 1; + local_48c = sVar6; + } + ptVar5 = (time_t *)(iVar3 + (int)puVar1); + Log("bugreport","%s\n",ptVar5,iVar12,iVar13,iVar14,iVar15,iVar16,pcVar4); + iVar3 = iVar3 + LastSpace; + } while( true ); +} + + + +void CErrorFileEntry(TConnection *Connection,TReadBuffer *Buffer) + +{ + char cVar1; + int iVar2; + bool bVar3; + char *pcVar4; + char *pcVar5; + int iVar6; + time_t *__s; + size_t __n; + int LastSpace; + size_t __n_00; + time_t *ptVar7; + int local_b0c; + int posx; + int posy; + int posz; + time_t Time; + char Line [80]; + char Comment [513]; + time_t local_89c; + char Stack [2049]; + time_t local_8c; + char Date [27]; + undefined1 local_6c [4]; + char Title [65]; + + if (Connection == (TConnection *)0x0) { + error("CErrorFileEntry: Connection ist NULL.\n"); + } + else { + // try { // try from 080d8174 to 080d851e has its CatchHandler @ 080d8521 + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_6c,0x41); + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&local_8c,0x1b); + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&local_89c,0x801); + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,Line + 0x4c,0x201); + if (((char)local_89c != '\0') || (Line[0x4c] != '\0')) { + time(&posz); + TConnection::GetPosition(Connection,&local_b0c,&posx,&posy); + pcVar4 = ctime(&posz); + iVar6 = Connection->TerminalVersion; + iVar2 = Connection->TerminalType; + pcVar5 = TConnection::GetName(Connection); + Log("client-error","%s - %d/%d - [%d,%d,%d] - %s",pcVar5,iVar2,iVar6,local_b0c,posx,posy + ,pcVar4); + Log("client-error","%s\n",local_6c); + ptVar7 = &local_8c; + Log("client-error","%s\n",ptVar7); + Log("client-error","\n"); + __s = &local_89c; + while( true ) { + pcVar4 = strchr((char *)__s,10); + if (pcVar4 == (char *)0x0) break; + *pcVar4 = '\0'; + if ((char)*__s != '\0') { + Log("client-error","%s\n",__s); + ptVar7 = __s; + } + __s = (time_t *)(pcVar4 + 1); + } + if ((char)*__s != '\0') { + Log("client-error","%s\n",__s); + ptVar7 = __s; + } + if (((char)local_89c != '\0') && (Line[0x4c] != '\0')) { + Log("client-error","\n",ptVar7); + } + iVar6 = 0; +LAB_080d8335: + if (Line[iVar6 + 0x4c] != '\0') { + __n = 0; + __n_00 = 0xffffffff; + while (cVar1 = Line[__n + iVar6 + -0x1c + 0x68], cVar1 != '\0') { + if (0x4a < (int)__n) { + if (__n_00 == 0xffffffff) { + ptVar7 = &Time; + strncpy((char *)&Time,Line + iVar6 + 0x4c,0x4a); + Line[0x46] = '-'; + Line[0x47] = '\0'; + Log("client-error","%s\n",ptVar7); + iVar6 = iVar6 + 0x4a; + } + else { + ptVar7 = &Time; + strncpy((char *)&Time,Line + iVar6 + 0x4c,__n_00); + Line[__n_00 - 4] = '\0'; + Log("client-error","%s\n",ptVar7); + if (Line[__n_00 + iVar6 + -0x1c + 0x68] == ' ') { + iVar6 = iVar6 + 1; + } + iVar6 = iVar6 + __n_00; + } + goto LAB_080d8335; + } + if (cVar1 == '\n') { + strncpy((char *)&Time,Line + iVar6 + 0x4c,__n); + ptVar7 = &Time; + Line[__n - 4] = '\0'; + Log("client-error","%s\n",ptVar7); + iVar6 = __n + 1 + iVar6; + goto LAB_080d8335; + } + bVar3 = isSpace((int)cVar1); + if (bVar3) { + __n_00 = __n; + } + __n = __n + 1; + } + ptVar7 = (time_t *)(Line + iVar6 + 0x4c); + Log("client-error","%s\n",ptVar7); + iVar6 = iVar6 + __n; + goto LAB_080d8335; + } + Log("client-error", + "---------------------------------------------------------------------------\n", + ptVar7); + } + } + return; +} + + + +void CMoveObject(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + int iVar6; + uint uVar7; + uint uVar8; + TPlayer *this; + int sx; + uint uVar9; + uint uVar10; + uint uVar11; + undefined4 uVar12; + TPlayer *pl; + uchar Count; + int zz; + int zy; + int zx; + uchar RNum; + int sz; + int sy; + int posx; + int posy; + int posz; + int posx_1; + int posy_1; + int posz_1; + ObjectType local_2c; + ObjectType Type; + + if (Connection == (TConnection *)0x0) { + error("CMoveObject: Connection ist NULL.\n"); + return; + } + // try { // try from 080d8565 to 080d870d has its CatchHandler @ 080d88c6 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + zx._3_1_ = (uchar)iVar6; + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + uVar7 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar7 = uVar7 & 0xffff; + uVar8 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar8 = uVar8 & 0xff; + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + if (uVar2 != 0xffff) { + zx._3_1_ = '\x01'; + } + bVar1 = CheckSpecialCoordinates(); + if (!bVar1) { + return; + } + if ((uVar2 != 0xffff) && + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,uVar4 & 0xff), !bVar1)) { + TConnection::GetPosition(Connection,&posz,&posx_1,&posy_1); + print(); + return; + } + uVar12 = 1; + uVar9 = uVar5; + uVar10 = uVar7; + uVar11 = uVar8; + bVar1 = CheckSpecialCoordinates(); + if (!bVar1) { + return; + } + if (uVar5 == 0xffff) goto LAB_080d86c1; + if (Connection == (TConnection *)0x0) { + error("CheckVisibility: Connection ist NULL.\n",uVar9,uVar10,uVar11,uVar12); +LAB_080d87dd: + bVar1 = false; + } + else { + bVar1 = TConnection::IsVisible(Connection,uVar5,uVar7,uVar8); + if (!bVar1) { + // try { // try from 080d8792 to 080d886b has its CatchHandler @ 080d88c6 + TConnection::GetPosition(Connection,&sy,&posx,&posy); + print(); + goto LAB_080d87dd; + } + bVar1 = true; + } + if (!bVar1) { + return; + } +LAB_080d86c1: + ObjectType::setTypeID((ObjectType *)&posz_1,0); + if ((local_2c.TypeID != posz_1) && + (((bVar1 = ObjectType::getFlag(&local_2c,CUMULATIVE), !bVar1 || ((uchar)iVar6 != '\0')) && + (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)))) { + // try { // try from 080d871f to 080d8774 has its CatchHandler @ 080d8871 + ObjectType::setTypeID((ObjectType *)&posz_1,local_2c.TypeID); + TCreature::ToDoMove(&this->super_TCreature,uVar2,uVar3 & 0xffff,uVar4 & 0xff, + (ObjectType *)&posz_1,zx._3_1_,uVar5,uVar7,uVar8,(uchar)iVar6); + TCreature::ToDoStart(&this->super_TCreature); + } + return; +} + + + +void CTradeObject(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + int iVar6; + ulong TradePartner_00; + TPlayer *this; + ulong TradePartner; + TPlayer *pl; + uchar RNum; + int z; + int y; + int x; + int posx; + int posy; + int posz; + int local_2c; + ObjectType Type; + + if (Connection == (TConnection *)0x0) { + error("CTradeObject: Connection ist NULL.\n"); + } + else { + // try { // try from 080d8905 to 080d89fc has its CatchHandler @ 080d8b26 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + pl._3_1_ = (uchar)iVar6; + TradePartner_00 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + if (uVar2 != 0xffff) { + pl._3_1_ = '\x01'; + } + bVar1 = CheckSpecialCoordinates(); + if (bVar1) { + if ((uVar2 == 0xffff) || + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,uVar4 & 0xff), bVar1) + ) { + ObjectType::setTypeID((ObjectType *)&posz,0); + if ((local_2c != posz) && + (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)) { + // try { // try from 080d8a0e to 080d8a4d has its CatchHandler @ 080d8ad1 + ObjectType::setTypeID((ObjectType *)&posz,local_2c); + TCreature::ToDoTrade + (&this->super_TCreature,uVar2,uVar3 & 0xffff,uVar4 & 0xff, + (ObjectType *)&posz,pl._3_1_,TradePartner_00); + TCreature::ToDoStart(&this->super_TCreature); + } + } + else { + // try { // try from 080d8a68 to 080d8acb has its CatchHandler @ 080d8b26 + TConnection::GetPosition(Connection,&x,&posx,&posy); + print(); + } + } + } + return; +} + + + +void CInspectTrade(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + uint uVar2; + TPlayer *pTVar3; + int Side; + TPlayer *pl; + Object local_2c; + Object Obj; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080d8bf7 to 080d8bfb has its CatchHandler @ 080d8c40 + error("CInspectTrade: Connection ist NULL.\n"); + } + else { + // try { // try from 080d8b62 to 080d8bb0 has its CatchHandler @ 080d8c40 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 != (TPlayer *)0x0) { + TPlayer::InspectTrade((TPlayer *)&local_2c,SUB41(pTVar3,0),(uint)((uVar2 & 0xff) == 0)); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + pl = (TPlayer *)local_2c.ObjectID; + // try { // try from 080d8be6 to 080d8bea has its CatchHandler @ 080d8bfe + Look((pTVar3->super_TCreature).ID,(Object *)&pl); + } + } + } + return; +} + + + +void CAcceptTrade(TConnection *Connection) + +{ + TPlayer *this; + + if (Connection == (TConnection *)0x0) { + error("CAcceptTrade: Connection ist NULL.\n"); + return; + } + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + TPlayer::AcceptTrade(this); + return; + } + return; +} + + + +void CRejectTrade(TConnection *Connection) + +{ + TPlayer *this; + + if (Connection == (TConnection *)0x0) { + error("CRejectTrade: Connection ist NULL.\n"); + return; + } + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + TPlayer::RejectTrade(this); + return; + } + return; +} + + + +void CUseObject(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + int iVar6; + int iVar7; + TPlayer *this; + int x; + TPlayer *pl; + uchar Dummy; + uchar RNum; + int z; + int y; + int posx; + int posy; + int posz; + ObjectType local_3c [4]; + ObjectType local_2c; + ObjectType Type; + + if (Connection == (TConnection *)0x0) { + error("CUseObject: Connection ist NULL.\n"); + } + else { + // try { // try from 080d8cf5 to 080d8e0a has its CatchHandler @ 080d8f86 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + iVar7 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + bVar1 = CheckSpecialCoordinates(); + if (bVar1) { + if ((uVar2 == 0xffff) || + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,uVar4 & 0xff), bVar1) + ) { + ObjectType::setTypeID(local_3c,0); + if ((((local_2c.TypeID != local_3c[0].TypeID) && + (bVar1 = ObjectType::getFlag(&local_2c,MULTIUSE), !bVar1)) && + ((bVar1 = ObjectType::getFlag(&local_2c,CONTAINER), !bVar1 || + ((byte)iVar7 < 0x10)))) && + (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)) { + // try { // try from 080d8e1d to 080d8eae has its CatchHandler @ 080d8f31 + TCreature::ToDoWait(&this->super_TCreature,100); + ObjectType::setTypeID(local_3c,0); + ObjectType::setTypeID((ObjectType *)&posz,local_2c.TypeID); + TCreature::ToDoUse(&this->super_TCreature,'\x01',uVar2,uVar3 & 0xffff, + uVar4 & 0xff,(ObjectType *)&posz,(uchar)iVar6,(byte)iVar7,0,0 + ,0,local_3c,'\0'); + TCreature::ToDoStart(&this->super_TCreature); + } + } + else { + // try { // try from 080d8ecc to 080d8f2b has its CatchHandler @ 080d8f86 + TConnection::GetPosition(Connection,&y,&posx,&posy); + print(); + } + } + } + return; +} + + + +void CUseTwoObjects(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + int iVar6; + uint uVar7; + uint uVar8; + uint uVar9; + int iVar10; + TPlayer *this; + int x1; + uint uVar11; + uint uVar12; + undefined4 uVar13; + TPlayer *pl; + uchar RNum2; + int z2; + int y2; + int x2; + uchar RNum1; + int z1; + int y1; + int posx; + int posy; + int posz; + int posx_1; + int posy_1; + int posz_1; + ObjectType local_4c [4]; + int local_3c; + ObjectType Type2; + ObjectType local_2c; + ObjectType Type1; + + if (Connection == (TConnection *)0x0) { + error("CUseTwoObjects: Connection ist NULL.\n"); + return; + } + // try { // try from 080d8fc5 to 080d91a8 has its CatchHandler @ 080d93c0 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + uVar7 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar7 = uVar7 & 0xffff; + uVar8 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar8 = uVar8 & 0xff; + uVar9 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar9 = uVar9 & 0xffff; + GetObjectType((ushort)&local_3c); + iVar10 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar9); + bVar1 = CheckSpecialCoordinates(); + if (!bVar1) { + return; + } + if ((uVar2 != 0xffff) && + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,uVar4 & 0xff), !bVar1)) { + TConnection::GetPosition(Connection,&posz,&posx_1,&posy_1); + print(); + return; + } + ObjectType::setTypeID(local_4c,0); + if (local_2c.TypeID == local_4c[0].TypeID) { + return; + } + bVar1 = ObjectType::getFlag(&local_2c,MULTIUSE); + if (!bVar1) { + return; + } + uVar13 = 0; + uVar9 = uVar5; + uVar11 = uVar7; + uVar12 = uVar8; + bVar1 = CheckSpecialCoordinates(); + if (!bVar1) { + return; + } + if (uVar5 == 0xffff) goto LAB_080d9182; + if (Connection == (TConnection *)0x0) { + error("CheckVisibility: Connection ist NULL.\n",uVar9,uVar11,uVar12,uVar13); +LAB_080d92d0: + bVar1 = false; + } + else { + bVar1 = TConnection::IsVisible(Connection,uVar5,uVar7,uVar8); + if (!bVar1) { + // try { // try from 080d927f to 080d935b has its CatchHandler @ 080d93c0 + TConnection::GetPosition(Connection,&y1,&posx,&posy); + print(); + goto LAB_080d92d0; + } + bVar1 = true; + } + if (!bVar1) { + return; + } +LAB_080d9182: + ObjectType::setTypeID(local_4c,0); + if ((local_3c != local_4c[0].TypeID) && + (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)) { + // try { // try from 080d91c2 to 080d9261 has its CatchHandler @ 080d9361 + TCreature::ToDoWait(&this->super_TCreature,100); + ObjectType::setTypeID(local_4c,local_3c); + ObjectType::setTypeID((ObjectType *)&posz_1,local_2c.TypeID); + TCreature::ToDoUse(&this->super_TCreature,'\x02',uVar2,uVar3 & 0xffff,uVar4 & 0xff, + (ObjectType *)&posz_1,(uchar)iVar6,'\0',uVar5,uVar7,uVar8,local_4c, + (uchar)iVar10); + TCreature::ToDoStart(&this->super_TCreature); + } + return; +} + + + +void CUseOnCreature(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + uint uVar6; + ulong id; + TCreature *pTVar7; + TPlayer *this; + undefined4 uVar8; + RESULT r; + uint uVar9; + undefined4 uVar10; + TPlayer *pl; + uchar RNum; + int z; + int y; + int x; + int posx; + int posy; + int posz; + int posx_1; + int posy_1; + int posz_1; + Object local_5c [4]; + Object local_4c; + Object Obj2; + Object local_3c; + Object Obj1; + ulong local_2c; + ObjectType Type; + + if (Connection == (TConnection *)0x0) { + error("CUseOnCreature: Connection ist NULL.\n"); + return; + } + // try { // try from 080d93f5 to 080d9655 has its CatchHandler @ 080d9826 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar3 = uVar3 & 0xffff; + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar4 = uVar4 & 0xff; + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + uVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + id = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + uVar10 = 0; + uVar5 = uVar3; + uVar9 = uVar4; + bVar1 = CheckSpecialCoordinates(); + if (!bVar1) { + return; + } + if ((uVar2 != 0xffff) && + (uVar5 = uVar3, uVar9 = uVar4, bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3,uVar4), + !bVar1)) { + TConnection::GetPosition(Connection,&posz,&posx_1,&posy_1); + print(); + return; + } + uVar8 = 0; + ObjectType::setTypeID((ObjectType *)&local_3c,0); + if (local_2c == local_3c.ObjectID) { + return; + } + pTVar7 = GetCreature(id); + if (pTVar7 == (TCreature *)0x0) { + return; + } + if (Connection == (TConnection *)0x0) { + error("CheckVisibility: Connection ist NULL.\n",uVar8,uVar5,uVar9,uVar10); +LAB_080d9726: + bVar1 = false; + } + else { + bVar1 = TConnection::IsVisible(Connection,pTVar7->posx,pTVar7->posy,pTVar7->posz); + if (!bVar1) { + // try { // try from 080d96d8 to 080d97be has its CatchHandler @ 080d9826 + TConnection::GetPosition(Connection,&x,&posx,&posy); + print(); + goto LAB_080d9726; + } + bVar1 = true; + } + if (!bVar1) { + return; + } + if (pTVar7->Type == PLAYER) { + return; + } + this = TConnection::GetPlayer(Connection); + if (this == (TPlayer *)0x0) { + return; + } + uVar5 = (this->super_TCreature).posx - pTVar7->posx; + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + if ((int)uVar5 < Connection->TerminalOffsetX) { + uVar5 = (this->super_TCreature).posy - pTVar7->posy; + if (0x7fffffff < uVar5) { + uVar5 = -uVar5; + } + if ((int)uVar5 < Connection->TerminalOffsetY) { + ObjectType::setTypeID((ObjectType *)&local_4c,local_2c); + GetObject((ulong)&local_3c,(this->super_TCreature).ID,uVar2,uVar3,uVar4, + (ObjectType *)(uVar6 & 0xff)); + local_4c.ObjectID = (pTVar7->CrObject).ObjectID; + bVar1 = Object::exists(&local_3c); + if ((bVar1) && (bVar1 = Object::exists(&local_4c), bVar1)) { + // try { // try from 080d9678 to 080d96ba has its CatchHandler @ 080d97c4 + TCreature::ToDoWait(&this->super_TCreature,100); + local_5c[0].ObjectID = local_4c.ObjectID; + posz_1 = local_3c.ObjectID; + TCreature::ToDoUse(&this->super_TCreature,'\x02',(Object *)&posz_1,local_5c); + TCreature::ToDoStart(&this->super_TCreature); + return; + } + r = NOTACCESSIBLE; + goto LAB_080d95cc; + } + } + r = OUTOFRANGE; +LAB_080d95cc: + SendResult(Connection,r); + return; +} + + + +void CTurnObject(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint uVar5; + int iVar6; + TPlayer *this; + TPlayer *pl; + int z; + int y; + int x; + int posx; + int posy; + int posz; + int local_2c; + ObjectType Type; + + if (Connection == (TConnection *)0x0) { + error("CTurnObject: Connection ist NULL.\n"); + } + else { + // try { // try from 080d9865 to 080d9944 has its CatchHandler @ 080d9a76 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar5 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar5 = uVar5 & 0xffff; + GetObjectType((ushort)&local_2c); + iVar6 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer,uVar5); + bVar1 = CheckSpecialCoordinates(); + if (bVar1) { + if ((uVar2 == 0xffff) || + (bVar1 = TConnection::IsVisible(Connection,uVar2,uVar3 & 0xffff,uVar4 & 0xff), bVar1) + ) { + ObjectType::setTypeID((ObjectType *)&posz,0); + if ((local_2c != posz) && + (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)) { + // try { // try from 080d9957 to 080d99a0 has its CatchHandler @ 080d9a21 + TCreature::ToDoWait(&this->super_TCreature,100); + ObjectType::setTypeID((ObjectType *)&posz,local_2c); + TCreature::ToDoTurn(&this->super_TCreature,uVar2,uVar3 & 0xffff,uVar4 & 0xff, + (ObjectType *)&posz,(uchar)iVar6); + TCreature::ToDoStart(&this->super_TCreature); + } + } + else { + // try { // try from 080d99bb to 080d9a1b has its CatchHandler @ 080d9a76 + TConnection::GetPosition(Connection,&x,&posx,&posy); + print(); + } + } + } + return; +} + + + +void CCloseContainer(TConnection *Connection,TReadBuffer *Buffer) + +{ + uint uVar1; + TPlayer *this; + TPlayer *pl; + int Window; + Object local_1c [4]; + + if (Connection == (TConnection *)0x0) { + error("CCloseContainer: Connection ist NULL.\n"); + } + else { + // try { // try from 080d9aab to 080d9b02 has its CatchHandler @ 080d9b05 + uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar1 = uVar1 & 0xff; + if (uVar1 < 0x10) { + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + local_1c[0].ObjectID = NONE.ObjectID; + TPlayer::SetOpenContainer(this,uVar1,local_1c); + SendCloseContainer(Connection,uVar1); + } + } + } + return; +} + + + +void CUpContainer(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + uint uVar2; + TPlayer *this; + int Window; + TPlayer *pl; + Object local_4c [4]; + _func_int_varargs **local_3c; + _func_int_varargs **local_2c; + Object Con; + + if (Connection == (TConnection *)0x0) { + error("CUpContainer: Connection ist NULL.\n"); + } + else { + // try { // try from 080d9b42 to 080d9c5b has its CatchHandler @ 080d9c61 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar2 = uVar2 & 0xff; + if ((uVar2 < 0x10) && (this = TConnection::GetPlayer(Connection), this != (TPlayer *)0x0)) { + TPlayer::GetOpenContainer((TPlayer *)&local_2c,(int)this); + local_3c = (_func_int_varargs **)NONE.ObjectID; + if (local_2c != (_func_int_varargs **)NONE.ObjectID) { + Object::getContainer(local_4c); + local_2c = (_func_int_varargs **)local_4c[0].ObjectID; + local_3c = (_func_int_varargs **)local_4c[0].ObjectID; + Object::getObjectType(local_4c); + if ((_func_int_varargs **)local_4c[0].ObjectID != (_func_int_varargs **)0x0) { + Object::getObjectType(local_4c); + bVar1 = false; + if ((0 < (int)local_4c[0].ObjectID) && ((int)local_4c[0].ObjectID < 0xb)) { + bVar1 = true; + } + if (!bVar1) { + local_4c[0].ObjectID = (ulong)local_2c; + TPlayer::SetOpenContainer(this,uVar2,local_4c); + SendContainer(Connection,uVar2); + return; + } + } + local_4c[0].ObjectID = NONE.ObjectID; + TPlayer::SetOpenContainer(this,uVar2,local_4c); + SendCloseContainer(Connection,uVar2); + } + } + } + return; +} + + + +void CRefreshContainer(TConnection *Connection,TReadBuffer *Buffer) + +{ + uint uVar1; + TPlayer *Window_00; + int Window; + _func_int_varargs **local_1c; + Object Con; + + if (Connection == (TConnection *)0x0) { + error("CRefreshContainer: Connection ist NULL.\n"); + } + else { + // try { // try from 080d9c9b to 080d9cfb has its CatchHandler @ 080d9d00 + uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + if ((uVar1 & 0xff) < 0x10) { + Window_00 = TConnection::GetPlayer(Connection); + if (Window_00 != (TPlayer *)0x0) { + TPlayer::GetOpenContainer((TPlayer *)&local_1c,(int)Window_00); + if (local_1c != (_func_int_varargs **)NONE.ObjectID) { + SendContainer(Connection,uVar1 & 0xff); + } + } + } + } + return; +} + + + +void CGetOutfit(TConnection *Connection) + +{ + bool bVar1; + TPlayer *pl; + TPlayer *pTVar2; + + if (Connection == (TConnection *)0x0) { + error("CGetOutfit: Connection ist NULL.\n"); + return; + } + pTVar2 = TConnection::GetPlayer(Connection); + if (pTVar2 != (TPlayer *)0x0) { + bVar1 = CheckRight((pTVar2->super_TCreature).ID,GAMEMASTER_OUTFIT); + if (!bVar1) { + SendOutfit(Connection); + return; + } + SendMessage(Connection,0x17,"You may not change your outfit."); + } + return; +} + + + +void CSetOutfit(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *pTVar1; + uint uVar2; + int iVar3; + TOutfit *pTVar4; + int OutfitID; + TOutfit *pTVar5; + bool bVar6; + TPlayer *pl; + TOutfit NewOutfit; + undefined4 local_18; + uchar Colors [4]; + + if (Connection == (TConnection *)0x0) { + error("CSetOutfit: Connection ist NULL.\n"); + return; + } + // try { // try from 080d9dc0 to 080d9f8e has its CatchHandler @ 080d9f94 + pTVar1 = TConnection::GetPlayer(Connection); + if (pTVar1 == (TPlayer *)0x0) { + return; + } + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); + uVar2 = uVar2 & 0xffff; + (*(Buffer->super_TReadStream)._vptr_TReadStream[5])(Buffer,&local_18,4); + iVar3 = (pTVar1->super_TCreature).Sex; + if (iVar3 == 1) { + bVar6 = false; + if ((0x7f < uVar2) && (uVar2 < 0x87)) { + bVar6 = true; + } + if (bVar6) { + bVar6 = CheckRight((pTVar1->super_TCreature).ID,PREMIUM_ACCOUNT); + if (bVar6) { + iVar3 = (pTVar1->super_TCreature).Sex; + } + else { + if (0x83 < uVar2) goto LAB_080d9f0c; + iVar3 = (pTVar1->super_TCreature).Sex; + } + goto LAB_080d9e00; + } +LAB_080d9f0c: + print(); + } + else { +LAB_080d9e00: + if (iVar3 == 2) { + bVar6 = false; + if ((0x87 < uVar2) && (uVar2 < 0x8f)) { + bVar6 = true; + } + if ((!bVar6) || + ((bVar6 = CheckRight((pTVar1->super_TCreature).ID,PREMIUM_ACCOUNT), !bVar6 && + (0x8b < uVar2)))) goto LAB_080d9f0c; + } + if (((((byte)local_18 < 0x85) && (local_18._1_1_ < 0x85)) && (local_18._2_1_ < 0x85)) && + (local_18._3_1_ < 0x85)) { + iVar3 = 8; + pTVar4 = &(pTVar1->super_TCreature).OrgOutfit; + bVar6 = pTVar4 == (TOutfit *)0x0; + pTVar5 = &(pTVar1->super_TCreature).Outfit; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar6 = (char)pTVar4->OutfitID == (char)pTVar5->OutfitID; + pTVar4 = (TOutfit *)((int)&pTVar4->OutfitID + 1); + pTVar5 = (TOutfit *)((int)&pTVar5->OutfitID + 1); + } while (bVar6); + if (bVar6) { + (pTVar1->super_TCreature).Outfit.OutfitID = uVar2; + *(undefined4 *)&(pTVar1->super_TCreature).Outfit.field_1.ObjectType = local_18; + AnnounceChangedCreature((pTVar1->super_TCreature).ID,3); + } + (pTVar1->super_TCreature).OrgOutfit.OutfitID = uVar2; + *(undefined4 *)&(pTVar1->super_TCreature).OrgOutfit.field_1.ObjectType = local_18; + } + else { + print(); + } + } + return; +} + + + +void CEditText(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + ulong uVar2; + TPlayer *pTVar3; + TPlayer *pl; + uint uVar4; + uint uVar5; + uint *puVar6; + uint *puVar7; + RESULT r_00; + uint local_103c; + char Text [4096]; + Object local_2c; + Object Obj; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080da177 to 080da17b has its CatchHandler @ 080da1c6 + error("CEditText: Connection ist NULL.\n"); + return; + } + // try { // try from 080d9fd8 to 080da136 has its CatchHandler @ 080da1c6 + local_2c.ObjectID = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + bVar1 = Object::exists(&local_2c); + if (bVar1) { + Object::getObjectType((Object *)(Text + 0xffc)); + bVar1 = ObjectType::getFlag((ObjectType *)(Text + 0xffc),WRITE); + if (!bVar1) { + Object::getObjectType((Object *)(Text + 0xffc)); + bVar1 = ObjectType::getFlag((ObjectType *)(Text + 0xffc),WRITEONCE); + if ((!bVar1) || (uVar2 = Object::getAttribute(&local_2c,TEXTSTRING), uVar2 != 0)) + goto LAB_080da050; + } + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&local_103c,0x1000); + puVar7 = &local_103c; + do { + puVar6 = puVar7; + uVar4 = *puVar6 + 0xfefefeff & ~*puVar6; + uVar5 = uVar4 & 0x80808080; + puVar7 = puVar6 + 1; + } while (uVar5 == 0); + bVar1 = (uVar4 & 0x8080) == 0; + if (bVar1) { + uVar5 = uVar5 >> 0x10; + } + if (bVar1) { + puVar7 = (uint *)((int)puVar6 + 6); + } + Object::getObjectType((Object *)(Text + 0xffc)); + bVar1 = ObjectType::getFlag((ObjectType *)(Text + 0xffc),WRITE); + Object::getObjectType((Object *)(Text + 0xffc)); + uVar2 = ObjectType::getAttribute((ObjectType *)(Text + 0xffc),!bVar1 + MAXLENGTH); + if ((int)puVar7 + ((-3 - (uint)CARRY1((byte)uVar5,(byte)uVar5)) - (int)&local_103c) < uVar2) + { + pTVar3 = TConnection::GetPlayer(Connection); + if (pTVar3 == (TPlayer *)0x0) { + return; + } + Text[0xffc] = (undefined1)local_2c.ObjectID; + Text[0xffd] = local_2c.ObjectID._1_1_; + Text[0xffe] = local_2c.ObjectID._2_1_; + Text[0xfff] = local_2c.ObjectID._3_1_; + // try { // try from 080da161 to 080da165 has its CatchHandler @ 080da181 + EditText((pTVar3->super_TCreature).ID,(Object *)(Text + 0xffc),(char *)&local_103c); + return; + } + r_00 = NOROOM; + } + else { +LAB_080da050: + r_00 = NOTACCESSIBLE; + } + SendResult(Connection,r_00); + return; +} + + + +void CEditList(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + RESULT r; + uint uVar2; + ulong uVar3; + TPlayer *pl; + uint uVar4; + ulong ID; + Object OStack_104c; + uchar Type; + ulong local_103c; + Object local_102c; + Object Door; + char local_101c [4]; + char Text [4096]; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080da3a7 to 080da3ab has its CatchHandler @ 080da3f6 + error("CEditList: Connection ist NULL.\n"); + } + else { + // try { // try from 080da205 to 080da241 has its CatchHandler @ 080da3f6 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_101c,0x1000); + local_102c.ObjectID = 0; + pl = TConnection::GetPlayer(Connection); + if (pl != (TPlayer *)0x0) { + uVar4 = uVar2 & 0xff; + if (uVar4 == 2) { + ChangeSubowners((ushort)uVar3,pl,local_101c); + } + else { + if (uVar4 < 3) { + if (uVar4 == 1) { + ChangeGuests((ushort)uVar3,pl,local_101c); + return; + } + } + else if (uVar4 == 3) { + OStack_104c.ObjectID = uVar3; + local_103c = uVar3; + local_102c.ObjectID = uVar3; + bVar1 = Object::exists(&local_102c); + if (bVar1) { + Object::getObjectType(&stack0xffffefb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffefb4,NAMEDOOR); + if (bVar1) { + Object::getObjectType(&stack0xffffefb4); + bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffefb4,TEXT); + if (bVar1) { + OStack_104c.ObjectID = local_102c.ObjectID; + ChangeNameDoor(&stack0xffffefb4,pl,local_101c); + return; + } + } + } + SendResult(Connection,NOTACCESSIBLE); + return; + } + // try { // try from 080da272 to 080da398 has its CatchHandler @ 080da3b1 + error("CEditList: Unbekannter Typ %d.\n",uVar2 & 0xff); + } + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: ChaseMode + +void CSetTactics(TConnection *Connection,TReadBuffer *Buffer) + +{ + TCombat *this; + bool bVar1; + uint uVar2; + uint uVar3; + uint uVar4; + TPlayer *pTVar5; + TPlayer *pl; + int AttackMode; + int ChaseMode; + + if (Connection == (TConnection *)0x0) { + error("CSetTactics: Connection ist NULL.\n"); + } + else { + // try { // try from 080da432 to 080da51b has its CatchHandler @ 080da521 + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + bVar1 = false; + if (((uVar2 & 0xff) != 0) && ((uVar2 & 0xff) < 4)) { + bVar1 = true; + } + if (((bVar1) && ((uVar3 & 0xff) < 2)) && ((uVar4 & 0xff) < 2)) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 != (TPlayer *)0x0) { + this = &(pTVar5->super_TCreature).Combat; + TCombat::SetAttackMode(this,(uchar)uVar2); + TCombat::SetChaseMode(this,(uchar)uVar3); + TCombat::SetSecureMode(this,(uchar)uVar4); + } + } + else { + print(); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: pl + +void CAttack(TConnection *Connection,TReadBuffer *Buffer,bool Follow) + +{ + ulong CreatureID; + TPlayer *this; + ulong dfd; + TPlayer *pl; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080da5c7 to 080da5cb has its CatchHandler @ 080da620 + error("CAttack: Connection ist NULL.\n"); + } + else { + // try { // try from 080da560 to 080da573 has its CatchHandler @ 080da620 + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + dfd = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + // try { // try from 080da58a to 080da5a4 has its CatchHandler @ 080da5d0 + TCombat::SetAttackDest(&(this->super_TCreature).Combat,dfd,Follow); + TCreature::ToDoAttack(&this->super_TCreature); + TCreature::ToDoStart(&this->super_TCreature); + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: posz + +void CInviteToParty(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + TCreature *guest; + TPlayer *pTVar2; + ulong id; + TCreature *pTVar3; + TPlayer *pl; + int local_1c; + int posx; + int posy; + int posz; + + if (Connection == (TConnection *)0x0) { + error("CInviteToParty: Connection ist NULL.\n"); + } + else { + // try { // try from 080da650 to 080da74b has its CatchHandler @ 080da751 + pTVar2 = TConnection::GetPlayer(Connection); + if (pTVar2 != (TPlayer *)0x0) { + id = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + pTVar3 = GetCreature(id); + if (pTVar3 != (TCreature *)0x0) { + bVar1 = TConnection::IsVisible(Connection,pTVar3->posx,pTVar3->posy,pTVar3->posz); + if (bVar1) { + InviteToParty((pTVar2->super_TCreature).ID,id); + } + else { + TConnection::GetPosition(Connection,&local_1c,&posx,&posy); + print(); + } + } + } + } + return; +} + + + +void CJoinParty(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *pTVar1; + ulong Host; + TPlayer *pl; + + if (Connection == (TConnection *)0x0) { + error("CJoinParty: Connection ist NULL.\n"); + } + else { + // try { // try from 080da789 to 080da7c3 has its CatchHandler @ 080da7c6 + pTVar1 = TConnection::GetPlayer(Connection); + if (pTVar1 != (TPlayer *)0x0) { + Host = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + JoinParty((pTVar1->super_TCreature).ID,Host); + } + } + return; +} + + + +void CRevokeInvitation(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *this; + ulong Guest; + ulong uVar1; + TPlayer *pl; + + if (Connection == (TConnection *)0x0) { + error("CRevokeInvitation: Connection ist NULL.\n"); + } + else { + // try { // try from 080da7f9 to 080da86b has its CatchHandler @ 080da870 + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + Guest = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + uVar1 = TPlayer::GetPartyLeader(this,false); + if (uVar1 == 0) { + print(); + } + else { + RevokeInvitation((this->super_TCreature).ID,Guest); + } + } + } + return; +} + + + +void CPassLeadership(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *this; + ulong NewLeader; + ulong uVar1; + TPlayer *pl; + + if (Connection == (TConnection *)0x0) { + error("CPassLeadership: Connection ist NULL.\n"); + } + else { + // try { // try from 080da8a9 to 080da91b has its CatchHandler @ 080da920 + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + NewLeader = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + uVar1 = TPlayer::GetPartyLeader(this,false); + if (uVar1 == 0) { + print(); + } + else { + PassLeadership((this->super_TCreature).ID,NewLeader); + } + } + } + return; +} + + + +void CLeaveParty(TConnection *Connection) + +{ + TPlayer *this; + ulong uVar1; + TPlayer *pl; + + if (Connection != (TConnection *)0x0) { + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + uVar1 = TPlayer::GetPartyLeader(this,false); + if (uVar1 == 0) { + print(); + } + else { + LeaveParty((this->super_TCreature).ID,false); + } + } + return; + } + error("CLeaveParty: Connection ist NULL.\n"); + return; +} + + + +void COpenChannel(TConnection *Connection) + +{ + TPlayer *pl; + TPlayer *pTVar1; + + if (Connection != (TConnection *)0x0) { + pTVar1 = TConnection::GetPlayer(Connection); + if (pTVar1 != (TPlayer *)0x0) { + // try { // try from 080da9e8 to 080da9ec has its CatchHandler @ 080daa10 + OpenChannel((pTVar1->super_TCreature).ID); + } + return; + } + error("COpenChannel: Connection ist NULL.\n"); + return; +} + + + +void CInviteToChannel(TConnection *Connection,TReadBuffer *Buffer) + +{ + RESULT r; + TPlayer *pTVar1; + TPlayer *pl; + char local_3c [4]; + char PlayerName [30]; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080daadb to 080daadf has its CatchHandler @ 080dab20 + error("CInviteToChannel: Connection ist NULL.\n"); + } + else { + // try { // try from 080daa6c to 080daaa7 has its CatchHandler @ 080dab20 + pTVar1 = TConnection::GetPlayer(Connection); + if (pTVar1 != (TPlayer *)0x0) { + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_3c,0x1e); + if (local_3c[0] == '\0') { + print(); + } + else { + // try { // try from 080daacd to 080daad1 has its CatchHandler @ 080daae2 + InviteToChannel((pTVar1->super_TCreature).ID,local_3c); + } + } + } + return; +} + + + +void CExcludeFromChannel(TConnection *Connection,TReadBuffer *Buffer) + +{ + RESULT r; + TPlayer *pTVar1; + TPlayer *pl; + char local_3c [4]; + char PlayerName [30]; + + if (Connection == (TConnection *)0x0) { + // try { // try from 080dab97 to 080dab9b has its CatchHandler @ 080dabe0 + error("CExcludeFromChannel: Connection ist NULL.\n"); + } + else { + // try { // try from 080dab49 to 080dab6d has its CatchHandler @ 080dabe0 + pTVar1 = TConnection::GetPlayer(Connection); + if (pTVar1 != (TPlayer *)0x0) { + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_3c,0x1e); + // try { // try from 080dab7b to 080dab7f has its CatchHandler @ 080dab9e + ExcludeFromChannel((pTVar1->super_TCreature).ID,local_3c); + } + } + return; +} + + + +void CCancel(TConnection *Connection) + +{ + bool bVar1; + TPlayer *this; + TPlayer *pl; + + if (Connection == (TConnection *)0x0) { + error("CCancel: Connection ist NULL.\n"); + return; + } + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + // try { // try from 080dac22 to 080dac2e has its CatchHandler @ 080dac75 + TCombat::StopAttack(&(this->super_TCreature).Combat,0); + bVar1 = TCreature::ToDoClear(&this->super_TCreature); + if (bVar1) { + // try { // try from 080dac47 to 080dac4b has its CatchHandler @ 080dac75 + SendSnapback(Connection); + } + TCreature::ToDoYield(&this->super_TCreature); + return; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Name + +void CAddBuddy(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *pl; + TPlayer *this; + char local_2c [4]; + char Name [30]; + + if (Connection == (TConnection *)0x0) { + error("CAddBuddy: Connection ist NULL.\n"); + } + else { + // try { // try from 080dacba to 080dacfb has its CatchHandler @ 080dad00 + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_2c,0x1e); + if (local_2c[0] != '\0') { + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + TPlayer::AddBuddy(this,local_2c); + } + } + } + return; +} + + + +void CRemoveBuddy(TConnection *Connection,TReadBuffer *Buffer) + +{ + TPlayer *pl; + ulong CharacterID_00; + TPlayer *this; + ulong CharacterID; + + if (Connection == (TConnection *)0x0) { + error("CRemoveBuddy: Connection ist NULL.\n"); + } + else { + // try { // try from 080dad3b to 080dad6d has its CatchHandler @ 080dad70 + CharacterID_00 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + this = TConnection::GetPlayer(Connection); + if (this != (TPlayer *)0x0) { + TPlayer::RemoveBuddy(this,CharacterID_00); + } + } + return; +} + + + +void CRuleViolation(TConnection *Connection,TReadBuffer *Buffer) + +{ + bool bVar1; + ulong CriminalID; + TPlayer *cr; + uint uVar2; + uint uVar3; + ulong StatementID_00; + int iVar4; + ulong uVar5; + TPlayer *Gamemaster; + bool IPBanishment; + char *pcVar6; + char *local_128; + char *IPAddress; + ulong StatementID; + int Action; + int Reason; + int NumberOfStatements; + vector<> *ReportedStatements; + TPlayer *Criminal; + char Comment [200]; + char local_3c [4]; + char Name [30]; + + if (Connection == (TConnection *)0x0) { + error("CRuleViolation: Connection ist NULL.\n"); + return; + } + // try { // try from 080dadb3 to 080db14e has its CatchHandler @ 080db154 + cr = TConnection::GetPlayer(Connection); + if (cr == (TPlayer *)0x0) { + return; + } + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,local_3c,0x1e); + Trim(local_3c); + uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar2 = uVar2 & 0xff; + uVar3 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + uVar3 = uVar3 & 0xff; + (*(Buffer->super_TReadStream)._vptr_TReadStream[4])(Buffer,&Criminal,200); + StatementID_00 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); + iVar4 = (*(Buffer->super_TReadStream)._vptr_TReadStream[1])(Buffer); + IPBanishment = (char)iVar4 != '\0'; + bVar1 = CheckBanishmentRight((cr->super_TCreature).ID,uVar2,uVar3); + if ((!bVar1) || + ((IPBanishment && (bVar1 = CheckRight((cr->super_TCreature).ID,IP_BANISHMENT), !bVar1)))) { + pcVar6 = "You have no authorization for this action."; + goto LAB_080daf27; + } + if ((char)Criminal == '\0') { + pcVar6 = "Please provide a comment for this report."; + goto LAB_080daf27; + } + if ((uVar3 == 6) && (StatementID_00 == 0)) { + pcVar6 = "Please provide a statement for this rule violation."; + goto LAB_080daf27; + } + local_128 = (char *)0x0; + ReportedStatements = (vector<> *)0x0; + bVar1 = CheckRight((cr->super_TCreature).ID,READ_GAMEMASTER_CHANNEL); + iVar4 = IdentifyPlayer(local_3c,false,!bVar1,(TPlayer **)&ReportedStatements); + if (iVar4 == 0) { + bVar1 = CheckRight(*(ulong *)(ReportedStatements[1].init.Text + 0xac),NO_BANISHMENT); + if (!bVar1) { + strcpy(local_3c,ReportedStatements[1].init.Text + 0xb8); + local_128 = ReportedStatements[2].init.Text + 0xf1; + goto LAB_080daf8c; + } + if (((uVar3 == 1) || (uVar3 == 3)) || (uVar3 == 5)) { + pcVar6 = "This name has already been approved."; + goto LAB_080daf27; + } + if (uVar3 != 6) { + pcVar6 = "You may not report a god or gamemaster."; + goto LAB_080daf27; + } + } + else { + uVar5 = GetCharacterID(local_3c); + if (uVar5 == 0) { + SendResult(Connection,PLAYERNOTEXISTING); + return; + } + pcVar6 = GetCharacterName(local_3c); + strcpy(local_3c,pcVar6); + if (IPBanishment) { + SendMessage(Connection,0x17,"Player is not online. No IP address was banished."); + IPBanishment = false; + } +LAB_080daf8c: + Reason = 0; + bVar1 = false; + NumberOfStatements = 0; + if ((0x1a < uVar2 + 0x12) && (uVar2 + 0x12 < 0x2e)) { + bVar1 = true; + } + if (((!bVar1) && (uVar2 != 0x1d)) || (StatementID_00 == 0)) { +LAB_080dafc4: + PunishmentOrder(&cr->super_TCreature,local_3c,local_128,uVar2,uVar3,(char *)&Criminal, + Reason,(vector<> *)NumberOfStatements,StatementID_00,IPBanishment); + return; + } + uVar5 = 0; + if (uVar3 != 6) { + uVar5 = (cr->super_TCreature).ID; + } + iVar4 = GetCommunicationContext + (uVar5,StatementID_00,&Reason,(vector<> **)&NumberOfStatements); + if (iVar4 == 1) { + pcVar6 = "Statement is unknown. Perhaps it is too old?"; + goto LAB_080daf27; + } + if (iVar4 != 2) goto LAB_080dafc4; + } + pcVar6 = "Statement has already been reported."; +LAB_080daf27: + SendMessage(Connection,0x17,pcVar6); + return; +} + + + +void CQuitGame(TConnection *Connection) + +{ + TPlayer *this; + int iVar1; + TPlayer *pl; + char *Text; + + this = TConnection::GetPlayer(Connection); + if (this == (TPlayer *)0x0) goto LAB_080db1b8; + iVar1 = TCreature::LogoutPossible(&this->super_TCreature); + if (iVar1 == 1) { + Text = "You may not logout during or immediately after a fight!"; +LAB_080db1e2: + SendMessage(Connection,0x17,Text); + return; + } + if (iVar1 < 2) { + if (iVar1 != 0) goto LAB_080db1a4; + } + else { + if (iVar1 == 2) { + Text = "You may not logout here!"; + goto LAB_080db1e2; + } +LAB_080db1a4: + error(&DAT_0810b2e0); + } + TCreature::ToDoClear(&this->super_TCreature); +LAB_080db1b8: + TConnection::Logout(Connection,0,true); + return; +} + + + +void ReceiveData(TConnection *Connection) + +{ + byte bVar1; + bool bVar2; + int Length; + int iVar3; + ulong uVar4; + TPlayer *pTVar5; + TPlayer *pl; + int Command; + uint uVar6; + char *pcVar7; + int dx; + undefined1 local_2c [4]; + TReadBuffer Buffer; + + if (Connection == (TConnection *)0x0) { + pcVar7 = "ReceiveData: Connection ist NULL.\n"; +LAB_080db8fa: + error(pcVar7); + return; + } + uVar6 = Connection->InDataSize; + if ((int)uVar6 < 1) { + pcVar7 = "ReceiveData: Keine Daten vorhanden.\n"; + goto LAB_080db8fa; + } + if (0x7fe < (int)uVar6) { + pcVar7 = &DAT_0810b360; +LAB_080db24a: + error(pcVar7,uVar6); + return; + } + TReadBuffer::TReadBuffer((TReadBuffer *)local_2c,Connection->InData + 2,uVar6); + // try { // try from 080db279 to 080db27d has its CatchHandler @ 080db910 + bVar1 = TReadBuffer::readByte((TReadBuffer *)local_2c); + uVar6 = (uint)bVar1; + if (Connection->State == CONNECTION_LOGIN) { + if (uVar6 == 0xb) { + bVar2 = TConnection::JoinGame(Connection,(TReadBuffer *)local_2c); + if (bVar2) { + return; + } + Log("game","Einloggen gescheitert.\n"); + SendResult(Connection,LOGINERROR); + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + error("ReceiveData: Einloggen gescheitert und keine Kreatur bekannt.\n"); + } + else { + DecrementIsOnlineOrder((pTVar5->super_TCreature).ID); + } + TConnection::Disconnect(Connection); + return; + } + pcVar7 = "ReceiveData: Falsches Login-Kommando %d.\n"; + goto LAB_080db24a; + } + bVar2 = CommandAllowed(Connection,(ushort)bVar1); + if (!bVar2) { + return; + } + TConnection::ResetTimer(Connection,uVar6); + switch(uVar6) { + case 0x14: + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 != (TPlayer *)0x0) { + iVar3 = TCreature::LogoutPossible(&pTVar5->super_TCreature); + if (iVar3 == 1) { + pcVar7 = "You may not logout during or immediately after a fight!"; +LAB_080db32b: + SendMessage(Connection,0x17,pcVar7); + return; + } + if (iVar3 < 2) { + if (iVar3 != 0) goto LAB_080db2f2; + } + else { + if (iVar3 == 2) { + pcVar7 = "You may not logout here!"; + goto LAB_080db32b; + } +LAB_080db2f2: + error(&DAT_0810b2e0); + } + TCreature::ToDoClear(&pTVar5->super_TCreature); + } + TConnection::Logout(Connection,0,true); + break; + default: + // try { // try from 080db834 to 080db86b has its CatchHandler @ 080db982 + print(); + break; + case 0x1e: + break; + case 100: + // try { // try from 080db2c6 to 080db587 has its CatchHandler @ 080db982 + CGoPath(Connection,(TReadBuffer *)local_2c); + break; + case 0x65: + iVar3 = -1; + goto LAB_080db358; + case 0x66: + iVar3 = 0; + goto LAB_080db375; + case 0x67: + iVar3 = 1; +LAB_080db358: + dx = 0; + goto LAB_080db360; + case 0x68: + iVar3 = 0; + goto LAB_080db391; + case 0x69: + if (Connection != (TConnection *)0x0) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + return; + } + TCreature::ToDoStop(&pTVar5->super_TCreature); + return; + } + pcVar7 = "CGoStop: Connection ist NULL.\n"; + goto LAB_080db3c3; + case 0x6a: + iVar3 = -1; + goto LAB_080db375; + case 0x6b: + iVar3 = 1; +LAB_080db375: + dx = 1; +LAB_080db360: + CGoDirection(Connection,dx,iVar3); + break; + case 0x6c: + iVar3 = 1; + goto LAB_080db391; + case 0x6d: + iVar3 = -1; +LAB_080db391: + dx = -1; + goto LAB_080db360; + case 0x6f: + iVar3 = 0; + goto LAB_080db3fd; + case 0x70: + iVar3 = 1; + goto LAB_080db3fd; + case 0x71: + iVar3 = 2; + goto LAB_080db3fd; + case 0x72: + iVar3 = 3; +LAB_080db3fd: + CRotate(Connection,iVar3); + break; + case 0x78: + CMoveObject(Connection,(TReadBuffer *)local_2c); + break; + case 0x7d: + CTradeObject(Connection,(TReadBuffer *)local_2c); + break; + case 0x7e: + CInspectTrade(Connection,(TReadBuffer *)local_2c); + break; + case 0x7f: + if (Connection != (TConnection *)0x0) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + return; + } + TPlayer::AcceptTrade(pTVar5); + return; + } + pcVar7 = "CAcceptTrade: Connection ist NULL.\n"; + goto LAB_080db3c3; + case 0x80: + if (Connection != (TConnection *)0x0) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + return; + } + TPlayer::RejectTrade(pTVar5); + return; + } + pcVar7 = "CRejectTrade: Connection ist NULL.\n"; + goto LAB_080db3c3; + case 0x82: + CUseObject(Connection,(TReadBuffer *)local_2c); + break; + case 0x83: + CUseTwoObjects(Connection,(TReadBuffer *)local_2c); + break; + case 0x84: + CUseOnCreature(Connection,(TReadBuffer *)local_2c); + break; + case 0x85: + CTurnObject(Connection,(TReadBuffer *)local_2c); + break; + case 0x87: + CCloseContainer(Connection,(TReadBuffer *)local_2c); + break; + case 0x88: + CUpContainer(Connection,(TReadBuffer *)local_2c); + break; + case 0x89: + CEditText(Connection,(TReadBuffer *)local_2c); + break; + case 0x8a: + CEditList(Connection,(TReadBuffer *)local_2c); + break; + case 0x8c: + CLookAtPoint(Connection,(TReadBuffer *)local_2c); + break; + case 0x96: + CTalk(Connection,(TReadBuffer *)local_2c); + break; + case 0x97: + if (Connection != (TConnection *)0x0) { + SendChannels(Connection); + return; + } + pcVar7 = "CGetChannels: Connection ist NULL.\n"; + goto LAB_080db3c3; + case 0x98: + CJoinChannel(Connection,(TReadBuffer *)local_2c); + break; + case 0x99: + if (Connection == (TConnection *)0x0) { + error("CLeaveChannel: Connection ist NULL.\n"); + } + else { + // try { // try from 080db597 to 080db5eb has its CatchHandler @ 080db946 + uVar6 = (**(_func_int_varargs **)((int)local_2c + 8))((TReadBuffer *)local_2c); + iVar3 = GetNumberOfChannels(); + if (((int)(uVar6 & 0xffff) < iVar3) && + (pTVar5 = TConnection::GetPlayer(Connection), pTVar5 != (TPlayer *)0x0)) { + LeaveChannel(uVar6 & 0xffff,(pTVar5->super_TCreature).ID,true); + } + } + break; + case 0x9a: + // try { // try from 080db5f8 to 080db670 has its CatchHandler @ 080db982 + CPrivateChannel(Connection,(TReadBuffer *)local_2c); + break; + case 0x9b: + CProcessRequest(Connection,(TReadBuffer *)local_2c); + break; + case 0x9c: + CRemoveRequest(Connection,(TReadBuffer *)local_2c); + break; + case 0x9d: + CCancelRequest(Connection); + break; + case 0xa0: + CSetTactics(Connection,(TReadBuffer *)local_2c); + break; + case 0xa1: + bVar2 = false; + goto LAB_080db64a; + case 0xa2: + bVar2 = true; +LAB_080db64a: + CAttack(Connection,(TReadBuffer *)local_2c,bVar2); + break; + case 0xa3: + CInviteToParty(Connection,(TReadBuffer *)local_2c); + break; + case 0xa4: + if (Connection == (TConnection *)0x0) { + error("CJoinParty: Connection ist NULL.\n"); + } + else { + // try { // try from 080db67d to 080db6bb has its CatchHandler @ 080db980 + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 != (TPlayer *)0x0) { + uVar4 = (**(_func_int_varargs **)((int)local_2c + 0xc))((TReadBuffer *)local_2c); + JoinParty((pTVar5->super_TCreature).ID,uVar4); + } + } + break; + case 0xa5: + // try { // try from 080db6c8 to 080db7d4 has its CatchHandler @ 080db982 + CRevokeInvitation(Connection,(TReadBuffer *)local_2c); + break; + case 0xa6: + CPassLeadership(Connection,(TReadBuffer *)local_2c); + break; + case 0xa7: + if (Connection != (TConnection *)0x0) { + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 == (TPlayer *)0x0) { + return; + } + uVar4 = TPlayer::GetPartyLeader(pTVar5,false); + if (uVar4 == 0) { + print(); + return; + } + LeaveParty((pTVar5->super_TCreature).ID,false); + return; + } + pcVar7 = "CLeaveParty: Connection ist NULL.\n"; +LAB_080db3c3: + error(pcVar7); + break; + case 0xaa: + COpenChannel(Connection); + break; + case 0xab: + CInviteToChannel(Connection,(TReadBuffer *)local_2c); + break; + case 0xac: + CExcludeFromChannel(Connection,(TReadBuffer *)local_2c); + break; + case 0xbe: + CCancel(Connection); + break; + case 0xc9: + CRefreshField(Connection,(TReadBuffer *)local_2c); + break; + case 0xca: + CRefreshContainer(Connection,(TReadBuffer *)local_2c); + break; + case 0xd2: + CGetOutfit(Connection); + break; + case 0xd3: + CSetOutfit(Connection,(TReadBuffer *)local_2c); + break; + case 0xdc: + CAddBuddy(Connection,(TReadBuffer *)local_2c); + break; + case 0xdd: + if (Connection == (TConnection *)0x0) { + error("CRemoveBuddy: Connection ist NULL.\n"); + } + else { + // try { // try from 080db7e4 to 080db81b has its CatchHandler @ 080db946 + uVar4 = (**(_func_int_varargs **)((int)local_2c + 0xc))((TReadBuffer *)local_2c); + pTVar5 = TConnection::GetPlayer(Connection); + if (pTVar5 != (TPlayer *)0x0) { + TPlayer::RemoveBuddy(pTVar5,uVar4); + } + } + break; + case 0xe6: + CBugReport(Connection,(TReadBuffer *)local_2c); + break; + case 0xe7: + CRuleViolation(Connection,(TReadBuffer *)local_2c); + break; + case 0xe8: + CErrorFileEntry(Connection,(TReadBuffer *)local_2c); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ReceiveData(void) + +{ + TConnection *Connection_00; + pid_t __pid; + TConnection *Connection; + + Connection_00 = GetFirstConnection(); + while (Connection_00 != (TConnection *)0x0) { + if ((Connection_00->State - CONNECTION_LOGIN < 4) && (Connection_00->WaitingForACK != false) + ) { + ReceiveData(Connection_00); + Connection_00->WaitingForACK = false; + if (Connection_00->State - CONNECTION_LOGIN < 4) { + __pid = TConnection::GetPID(Connection_00); + kill(__pid,10); + } + } + Connection_00 = GetNextConnection(); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z14CommandAllowedP11TConnectiont(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + vlong::vlong(&RSA_EXPONENT,0x10001); + __cxa_atexit(__tcf_0,0,&__dso_handle); + Semaphore::Semaphore(&CommunicationThreadMutex,1); + __cxa_atexit(__tcf_1,0,&__dso_handle); + TRSAPrivateKey::TRSAPrivateKey(&PrivateKey); + __cxa_atexit(__tcf_2,0,&__dso_handle); + Semaphore::Semaphore(&RSAMutex,1); + __cxa_atexit(__tcf_3,0,&__dso_handle); + TQueryManagerConnectionPool::TQueryManagerConnectionPool(&QueryManagerConnectionPool,10); + __cxa_atexit(__tcf_4,0,&__dso_handle); + Waitinglist.Units = (list<> *)operator_new(8); + (Waitinglist.Units)->firstNode = (listnode<> *)0x0; + (Waitinglist.Units)->lastNode = (listnode<> *)0x0; + Waitinglist.firstFreeItem = (storeitem<> *)0x0; + __cxa_atexit(__tcf_5,0,&__dso_handle); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitCommunicationThreadStacks(void) + +{ + int i; + int iVar1; + + if (UseOwnStacks) { + memset(CommunicationThreadStacks,0xaa,0x44c0000); + iVar1 = 0; + do { + LastUsingCommunicationThread[iVar1] = 0; + FreeCommunicationThreadStacks[iVar1] = iVar1; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x44c); + NumberOfFreeCommunicationThreadStacks = 0x44c; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Stack_local + +void GetCommunicationThreadStack(int *StackNumber,void **Stack) + +{ + int iVar1; + int iVar2; + int Number; + int i; + int iVar3; + bool bVar4; + void **Stack_local; + + if (!UseOwnStacks) { + error(&DAT_0810b9a0); + *StackNumber = -1; + *Stack = (void *)0x0; + return; + } + iVar3 = 0; + Semaphore::down(&CommunicationThreadMutex); + *StackNumber = -1; + bVar4 = 0 < NumberOfFreeCommunicationThreadStacks; + *Stack = (void *)0x0; + if (bVar4) { + do { + iVar1 = FreeCommunicationThreadStacks[iVar3]; + if (LastUsingCommunicationThread[iVar1] == 0) { +LAB_080dbcd6: + *StackNumber = iVar1; + NumberOfFreeCommunicationThreadStacks = NumberOfFreeCommunicationThreadStacks + -1; + *Stack = CommunicationThreadStacks + iVar1 * 0x10000; + FreeCommunicationThreadStacks[iVar3] = + FreeCommunicationThreadStacks[NumberOfFreeCommunicationThreadStacks]; + break; + } + iVar2 = kill(LastUsingCommunicationThread[iVar1],0); + if (iVar2 == -1) goto LAB_080dbcd6; + iVar3 = iVar3 + 1; + } while (iVar3 < NumberOfFreeCommunicationThreadStacks); + } + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +void AttachCommunicationThreadStack(int StackNumber) + +{ + __pid_t _Var1; + + _Var1 = getpid(); + LastUsingCommunicationThread[StackNumber] = _Var1; + return; +} + + + +void ReleaseCommunicationThreadStack(int StackNumber) + +{ + Semaphore::down(&CommunicationThreadMutex); + FreeCommunicationThreadStacks[NumberOfFreeCommunicationThreadStacks] = StackNumber; + NumberOfFreeCommunicationThreadStacks = NumberOfFreeCommunicationThreadStacks + 1; + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitCommunicationThreadStacks(void) + +{ + int i; + int iVar1; + int HighestStackAddress; + int iVar2; + int LowestStackAddress; + int iVar3; + int Stack; + int iVar4; + + if (UseOwnStacks) { + if (NumberOfFreeCommunicationThreadStacks != 0x44c) { + error("FreeCommunicationThreadStacks: Nicht alle Stacks freigegeben.\n"); + } + iVar2 = -1; + iVar3 = 0x10000; + iVar4 = 0; + do { + iVar1 = 0; + do { + if (CommunicationThreadStacks[iVar4 * 0x10000 + iVar1] != 0xaa) { + if (iVar2 < iVar1) { + iVar2 = iVar1; + } + if (iVar1 < iVar3) { + iVar3 = iVar1; + } + } + iVar1 = iVar1 + 1; + } while (iVar1 < 0x10000); + iVar4 = iVar4 + 1; + } while (iVar4 < 0x44c); + if (0x10000 - (iVar2 - iVar3) < 0x8000) { + error("Maximale Stack-Ausdehnung: %d..%d\n",iVar3,iVar2); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitLoadHistory(void) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + LoadHistory[iVar1] = 0; + iVar1 = iVar1 + 1; + } while (iVar1 < 0x168); + LoadHistoryPointer = 0; + TotalSend = 0; + TotalLoad = 0; + LagEnd = 0; + TotalRecv = 0; + EarliestFreeAccountAdmissionRound = 0; + InitLog("netload"); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool LagDetected(void) + +{ + return RoundNr <= LagEnd; +} + + + +void NetLoad(int Amount,bool Send) + +{ + Semaphore::down(&CommunicationThreadMutex); + if (Send) { + TotalSend = TotalSend + Amount; + } + else { + TotalRecv = TotalRecv + Amount; + } + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void NetLoadSummary(void) + +{ + Semaphore::down(&CommunicationThreadMutex); + Log("netload","gesendet: %d Bytes.\n",TotalSend); + Log("netload","empfangen: %d Bytes.\n",TotalRecv); + TotalSend = 0; + TotalRecv = 0; + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void NetLoadCheck(void) + +{ + int Delay; + int iVar1; + TConnection *this; + ulong *puVar2; + TConnection *Connection; + int iVar3; + int DeltaRecv; + int iVar4; + uint local_c; + + iVar4 = NetLoadCheck::LastRecv; + NetLoadCheck::LastRecv = TotalRecv; + iVar4 = TotalRecv - iVar4; + if (-1 < iVar4) { + iVar1 = GetPlayersOnline(); + if (iVar1 == 0) { + iVar4 = 0; + } + else { + iVar1 = GetPlayersOnline(); + iVar4 = iVar4 / iVar1; + } + iVar1 = LoadHistory[LoadHistoryPointer]; + LoadHistory[LoadHistoryPointer] = iVar4; + iVar3 = LoadHistoryPointer + 1; + TotalLoad = (TotalLoad - iVar1) + iVar4; + LoadHistoryPointer = 0; + if (iVar3 != 0x168) { + LoadHistoryPointer = iVar3; + } + if (((0xe0f < RoundNr) && (iVar1 = GetPlayersOnline(), 0x31 < iVar1)) && + (iVar4 < TotalLoad / 0x2d0)) { + Log("game","Lag erkannt!\n"); + LagEnd = RoundNr + 0x1e; + if (PremiumPlayerBuffer == 0) { + iVar4 = 0x3c; + } + else { + iVar4 = GetPlayersOnline(); + iVar4 = ((iVar4 - (MaxPlayers + PremiumPlayerBuffer * -2)) * 0x1e) / + PremiumPlayerBuffer; + } + local_c = iVar4 + RoundNr; + puVar2 = &EarliestFreeAccountAdmissionRound; + if (EarliestFreeAccountAdmissionRound < iVar4 + RoundNr) { + puVar2 = &local_c; + } + EarliestFreeAccountAdmissionRound = *puVar2; + this = GetFirstConnection(); + while (this != (TConnection *)0x0) { + if (this->State - CONNECTION_LOGIN < 4) { + TConnection::EmergencyPing(this); + } + this = GetNextConnection(); + } + } + } + return; +} + + + +bool WriteToSocket(TConnection *Connection,uchar *Buffer,int Size) + +{ + uchar *__block; + int iVar1; + ssize_t sVar2; + int *piVar3; + int Offset; + size_t __n; + int in_stack_ffffffbc; + int local_30; + int Chances; + TWriteBuffer WriteBuffer; + + if ((Size & 7U) != 0) { + do { + iVar1 = rand_r(&Connection->RandomSeed); + Buffer[Size + 2] = (uchar)iVar1; + Size = Size + 1; + } while ((Size & 7U) != 0); + } + __n = Size + 2; + iVar1 = 2; + if (2 < (int)__n) { + do { + __block = Buffer + iVar1; + iVar1 = iVar1 + 8; + TXTEASymmetricKey::encrypt(&Connection->SymmetricKey,(char *)__block,in_stack_ffffffbc); + } while (iVar1 < (int)__n); + } + TWriteBuffer::TWriteBuffer((TWriteBuffer *)&Chances,Buffer,__n); + TWriteBuffer::writeWord((TWriteBuffer *)&Chances,(ushort)Size); + local_30 = 0x32; +joined_r0x080dc15b: + if ((int)__n < 1) { + Semaphore::down(&CommunicationThreadMutex); + TotalSend = TotalSend + Size + 0x32U; + Semaphore::up(&CommunicationThreadMutex); + return true; + } + iVar1 = TConnection::GetSocket(Connection); + sVar2 = write(iVar1,Buffer,__n); + if (sVar2 == -1) goto LAB_080dc1f0; + goto LAB_080dc182; +LAB_080dc1f0: + piVar3 = __errno_location(); + if (*piVar3 != 4) { + if ((*piVar3 != 0xb) || (local_30 < 1)) { + piVar3 = __errno_location(); + iVar1 = *piVar3; + if (((iVar1 == 0x68) || (iVar1 == 0x20)) || (iVar1 == 0xb)) { + iVar1 = TConnection::GetSocket(Connection); + Log("game","Verbindung an Socket %d zusammengebrochen.\n",iVar1); + } + else { +LAB_080dc182: + if (0 < sVar2) { + __n = __n - sVar2; + Buffer = Buffer + sVar2; + goto joined_r0x080dc15b; + } + iVar1 = TConnection::GetSocket(Connection); + piVar3 = __errno_location(); + error("WriteToSocket: Fehler %d beim Senden an Socket %d.\n",*piVar3,iVar1); + } + return false; + } + DelayThread(0,100000); + local_30 = local_30 + -1; + } + goto joined_r0x080dc15b; +} + + + +bool SendLoginMessage(TConnection *Connection,int Type,char *Message,int WaitingTime) + +{ + int Size; + bool bVar1; + size_t sVar2; + char *Text; + undefined1 local_15c [4]; + TWriteBuffer Buffer; + uchar Data [302]; + + if (Type - 0x14U < 3) { + if (Message == (char *)0x0) { + error("SendLoginMessage: Message ist NULL.\n"); + return true; + } + if (Type == 0x16) { + bVar1 = false; + if ((0 < WaitingTime) && (WaitingTime < 0x100)) { + bVar1 = true; + } + if (!bVar1) { + Text = &DAT_0810bb40; + goto LAB_080dc3c0; + } + } + // try { // try from 080dc2d0 to 080dc390 has its CatchHandler @ 080dc3f0 + TWriteBuffer::TWriteBuffer + ((TWriteBuffer *)local_15c,(uchar *)((int)&Buffer.Position + 2),300); + TWriteBuffer::writeWord((TWriteBuffer *)local_15c,0); + TWriteBuffer::writeByte((TWriteBuffer *)local_15c,(uchar)Type); + sVar2 = strlen(Message); + if (sVar2 < 0x123) { + TWriteStream::writeString((TWriteStream *)local_15c,Message); + if (Type == 0x16) { + TWriteBuffer::writeByte((TWriteBuffer *)local_15c,(uchar)WaitingTime); + } + Size = Buffer.Size; + Buffer.Size = 0; + TWriteBuffer::writeWord((TWriteBuffer *)local_15c,(short)Size - 2); + bVar1 = WriteToSocket(Connection,(uchar *)&Buffer.Position,Size); + return bVar1; + } + error("SendLoginMessage: Botschaft zu lang (%s).\n",Message); + } + else { + Text = &DAT_0810bbc0; + WaitingTime = Type; +LAB_080dc3c0: + error(Text,WaitingTime); + } + return true; +} + + + +bool SendData(TConnection *Connection) + +{ + int iVar1; + undefined1 *puVar2; + bool bVar3; + uint uVar4; + int Offset; + int iVar5; + int DataSize; + uint uVar6; + undefined4 uStackY_50; + uint auStack_48 [2]; + undefined1 auStack_40 [8]; + undefined1 *local_38; + uchar_0_ *Buffer; + int local_30; + int PacketSize; + TWriteBuffer WriteBuffer; + + Buffer = &stack0xffffffb4; + if (Connection == (TConnection *)0x0) { + uStackY_50 = 0x80dc573; + error("SendData: Verbindung ist NULL.\n"); + } + else { + uVar6 = Connection->NextToCommit - Connection->NextToSend; + uVar4 = uVar6 + 0xe; + if (-1 < (int)(uVar6 + 7)) { + uVar4 = uVar6 + 7; + } + uVar4 = uVar4 & 0xfffffff8; + local_30 = uVar4 + 2; + iVar1 = -(uVar4 + 0x13 & 0xfffffff0); + local_38 = auStack_40 + iVar1; + *(uint *)((int)auStack_48 + iVar1 + 4) = uVar4 + 4; + *(undefined1 **)((int)auStack_48 + iVar1) = auStack_40 + iVar1; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc48e; + TWriteBuffer::TWriteBuffer + (*(TWriteBuffer **)(&stack0xffffffb4 + iVar1),*(uchar **)((int)auStack_48 + iVar1) + ,*(int *)((int)auStack_48 + iVar1 + 4)); + *(undefined4 *)((int)auStack_48 + iVar1) = 0; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc4a1; + TWriteBuffer::writeWord + (*(TWriteBuffer **)(&stack0xffffffb4 + iVar1),*(ushort *)((int)auStack_48 + iVar1) + ); + *(uint *)((int)auStack_48 + iVar1) = uVar6 & 0xffff; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc4b3; + TWriteBuffer::writeWord + (*(TWriteBuffer **)(&stack0xffffffb4 + iVar1),*(ushort *)((int)auStack_48 + iVar1) + ); + iVar5 = Connection->NextToSend % 0x4000; + if ((int)(uVar6 + iVar5) < 0x4001) { + *(uint *)((int)auStack_48 + iVar1 + 4) = uVar6; + *(uchar **)((int)auStack_48 + iVar1) = Connection->OutData + iVar5; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + } + else { + *(uchar **)((int)auStack_48 + iVar1) = Connection->OutData + iVar5; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + *(int *)((int)auStack_48 + iVar1 + 4) = 0x4000 - iVar5; + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc4f9; + TWriteBuffer::writeBytes + (*(TWriteBuffer **)(&stack0xffffffb4 + iVar1), + *(uchar **)((int)auStack_48 + iVar1),*(int *)((int)auStack_48 + iVar1 + 4)); + *(uint *)((int)auStack_48 + iVar1 + 4) = uVar6 + iVar5 + -0x4000; + *(uchar **)((int)auStack_48 + iVar1) = Connection->OutData; + *(int **)(&stack0xffffffb4 + iVar1) = &PacketSize; + } + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc518; + TWriteBuffer::writeBytes + (*(TWriteBuffer **)(&stack0xffffffb4 + iVar1),*(uchar **)((int)auStack_48 + iVar1) + ,*(int *)((int)auStack_48 + iVar1 + 4)); + *(int *)((int)auStack_48 + iVar1 + 4) = local_30; + puVar2 = local_38; + *(TConnection **)(&stack0xffffffb4 + iVar1) = Connection; + *(undefined1 **)((int)auStack_48 + iVar1) = puVar2; + *(undefined4 *)((int)&uStackY_50 + iVar1) = 0x80dc52e; + bVar3 = WriteToSocket(*(TConnection **)(&stack0xffffffb4 + iVar1), + *(uchar **)((int)auStack_48 + iVar1), + *(int *)((int)auStack_48 + iVar1 + 4)); + if (bVar3) { + Connection->NextToSend = Connection->NextToSend + uVar6; + return true; + } + } + return false; +} + + + +bool SendData(TConnection *Connection,char *Data,int Size) + +{ + bool bVar1; + + if (Connection == (TConnection *)0x0) { + error("SendData: Connection ist NULL.\n"); + bVar1 = false; + } + else if (Data == (char *)0x0) { + error("SendData: Data ist NULL.\n"); + bVar1 = true; + } + else { + memcpy(Connection->OutData + 2,Data,Size); + Connection->NextToSend = 0; + Connection->NextToCommit = Size + 2; + bVar1 = SendData(Connection); + } + return bVar1; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GetWaitinglistEntry(void) + +{ + TWaitinglistEntry *pTVar1; + int iVar2; + TWaitinglistEntry *Search; + char *in_stack_00000004; + ulong *in_stack_00000008; + undefined1 *in_stack_0000000c; + undefined1 *in_stack_00000010; + + Semaphore::down(&CommunicationThreadMutex); + pTVar1 = WaitinglistHead; + while( true ) { + if (pTVar1 == (TWaitinglistEntry *)0x0) { + Semaphore::up(&CommunicationThreadMutex); + return false; + } + iVar2 = stricmp(in_stack_00000004,pTVar1->Name,-1); + if (iVar2 == 0) break; + pTVar1 = pTVar1->Next; + } + *in_stack_00000008 = pTVar1->NextTry; + *in_stack_0000000c = pTVar1->FreeAccount; + *in_stack_00000010 = pTVar1->Newbie; + Semaphore::up(&CommunicationThreadMutex); + return true; +} + + + +// WARNING: Variable defined which should be unmapped: NextTry_local + +void InsertWaitinglistEntry(char *Name,ulong NextTry,bool FreeAccount,bool Newbie) + +{ + TWaitinglistEntry *pTVar1; + int iVar2; + TWaitinglistEntry *pTVar3; + TWaitinglistEntry *Entry; + TWaitinglistEntry *Last; + bool Newbie_local; + bool FreeAccount_local; + ulong NextTry_local; + + Semaphore::down(&CommunicationThreadMutex); + pTVar1 = (TWaitinglistEntry *)0x0; + pTVar3 = WaitinglistHead; + while( true ) { + if (pTVar3 == (TWaitinglistEntry *)0x0) { + pTVar3 = store<>::getFreeItem(&Waitinglist); + strcpy(pTVar3->Name,Name); + pTVar3->NextTry = NextTry; + pTVar3->FreeAccount = FreeAccount; + pTVar3->Next = (TWaitinglistEntry *)0x0; + pTVar3->Sleeping = false; + pTVar3->Newbie = Newbie; + if (pTVar1 != (TWaitinglistEntry *)0x0) { + pTVar1->Next = pTVar3; + pTVar3 = WaitinglistHead; + } + WaitinglistHead = pTVar3; + Semaphore::up(&CommunicationThreadMutex); + Log("queue",&DAT_0810bc80); + return; + } + iVar2 = stricmp(Name,pTVar3->Name,-1); + if (iVar2 == 0) break; + pTVar1 = pTVar3; + pTVar3 = pTVar3->Next; + } + pTVar3->NextTry = NextTry; + pTVar3->FreeAccount = FreeAccount; + pTVar3->Newbie = Newbie; + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +void DeleteWaitinglistEntry(char *Name) + +{ + TWaitinglistEntry *pTVar1; + TWaitinglistEntry *pTVar2; + int iVar3; + TWaitinglistEntry *Search; + TWaitinglistEntry *Entry; + storeitem<> *psVar4; + + psVar4 = (storeitem<> *)0x0; + Semaphore::down(&CommunicationThreadMutex); + if (WaitinglistHead != (TWaitinglistEntry *)0x0) { + iVar3 = stricmp(Name,WaitinglistHead->Name,-1); + if (iVar3 == 0) { + psVar4 = (storeitem<> *)WaitinglistHead; + WaitinglistHead = WaitinglistHead->Next; + } + else if (WaitinglistHead != (TWaitinglistEntry *)0x0) { + pTVar1 = WaitinglistHead->Next; + pTVar2 = WaitinglistHead; + while (pTVar1 != (TWaitinglistEntry *)0x0) { + iVar3 = stricmp(Name,pTVar2->Next->Name,-1); + if (iVar3 == 0) { + psVar4 = (storeitem<> *)pTVar2->Next; + pTVar2->Next = (TWaitinglistEntry *)psVar4->next; + break; + } + pTVar2 = pTVar2->Next; + pTVar1 = pTVar2->Next; + } + } + } + if (psVar4 != (storeitem<> *)0x0) { + psVar4->next = Waitinglist.firstFreeItem; + Waitinglist.firstFreeItem = psVar4; + } + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Newbie_local + +int GetWaitinglistPosition(char *Name,bool FreeAccount,bool Newbie) + +{ + int iVar1; + int iVar2; + storeitem<> *psVar3; + TWaitinglistEntry *Search; + storeitem<> *psVar4; + int PremiumVeterans; + int iVar5; + int PremiumNewbies; + int iVar6; + int local_1c; + int FreeVeterans; + int FreeNewbies; + bool Newbie_local; + bool FreeAccount_local; + + iVar6 = 0; + iVar5 = 0; + local_1c = 0; + FreeVeterans = 0; + Semaphore::down(&CommunicationThreadMutex); + psVar3 = (storeitem<> *)WaitinglistHead; + if ((WaitinglistHead != (TWaitinglistEntry *)0x0) && (WaitinglistHead->NextTry + 0x3c < RoundNr) + ) { + do { + psVar4 = psVar3; + Log("queue",&DAT_0810bcc0,(psVar4->data).Name); + psVar3 = (storeitem<> *)WaitinglistHead->Next; + WaitinglistHead = (TWaitinglistEntry *)psVar3; + psVar4->next = Waitinglist.firstFreeItem; + Waitinglist.firstFreeItem = psVar4; + if (psVar3 == (storeitem<> *)0x0) break; + } while ((psVar3->data).NextTry + 0x3c < RoundNr); + } + if (psVar3 != (storeitem<> *)0x0) { + iVar5 = 0; + do { + iVar1 = stricmp(Name,(psVar3->data).Name,-1); + if (iVar1 == 0) break; + iVar1 = local_1c; + if ((psVar3->data).Sleeping == false) { + if ((psVar3->data).NextTry + 5 < RoundNr) { + (psVar3->data).Sleeping = true; + } + else if ((psVar3->data).FreeAccount == false) { + if ((psVar3->data).Newbie != false) { + iVar6 = iVar6 + 1; + } + if ((psVar3->data).Newbie == false) { + iVar5 = iVar5 + 1; + } + } + else { + iVar2 = FreeVeterans + 1; + if ((psVar3->data).Newbie == false) { + iVar2 = FreeVeterans; + } + iVar1 = local_1c + 1; + FreeVeterans = iVar2; + if ((psVar3->data).Newbie != false) { + iVar1 = local_1c; + } + } + } + local_1c = iVar1; + psVar3 = psVar3->next; + } while (psVar3 != (storeitem<> *)0x0); + } + Semaphore::up(&CommunicationThreadMutex); + if (FreeAccount) { + if (Newbie) { + local_1c = iVar5 + 1 + FreeVeterans + local_1c + iVar6; + } + else { + local_1c = iVar5 + 1 + local_1c; + iVar5 = GetNewbiesOnline(); + if (iVar5 < MaxNewbies - PremiumNewbieBuffer) { + local_1c = FreeVeterans + local_1c; + } + } + } + else { + local_1c = iVar5 + 1 + iVar6; + if (!Newbie) { + iVar1 = GetNewbiesOnline(); + local_1c = iVar5 + 1; + if (iVar1 < MaxNewbies) { + local_1c = iVar6 + iVar5 + 1; + } + } + } + return local_1c; +} + + + +int CheckWaitingTime(char *Name,TConnection *Connection,bool FreeAccount,bool Newbie) + +{ + int iVar1; + int iVar2; + int iVar3; + int iVar4; + int PlayersOnline; + int Position; + int WaitingTime; + int WaitingTime_00; + int NewbiesOnline; + char *Reason; + char local_11c [2]; + bool Newbie_local; + bool FreeAccount_local; + char Message [250]; + + WaitingTime_00 = 0; + NewbiesOnline = 0; + iVar1 = GetWaitinglistPosition(Name,FreeAccount,Newbie); + iVar2 = GetPlayersOnline(); + iVar3 = GetNewbiesOnline(); + iVar4 = GetOrderBufferSpace(); + if (iVar4 - iVar1 < iVar2) { + print(); + NewbiesOnline = (int)s_The_server_is_overloaded__0810d5ea; + WaitingTime_00 = iVar1 / 2 + 10; + goto LAB_080dcb50; + } + if (FreeAccount) { + if (RoundNr < EarliestFreeAccountAdmissionRound) { + print(); + NewbiesOnline = (int)s_The_server_is_overloaded__Only_p_0810bf60; + WaitingTime_00 = iVar1 / 2 + (EarliestFreeAccountAdmissionRound - RoundNr); + goto LAB_080dcb50; + } + if (iVar2 <= (MaxPlayers - PremiumPlayerBuffer) - iVar1) goto LAB_080dcaff; + print(); + NewbiesOnline = (int)s_Too_many_players_online__Only_pl_0810bec0; +LAB_080dcbd5: + WaitingTime_00 = iVar1 / 2 + 5; + } + else { + if (MaxPlayers - iVar1 < iVar2) { + print(); + NewbiesOnline = (int)s_There_are_too_many_players_onlin_0810bfc0; + } + else { +LAB_080dcaff: + if (!Newbie) goto LAB_080dcb50; + if ((FreeAccount) || (iVar3 <= MaxNewbies - iVar1)) { + if ((!Newbie) || + ((!FreeAccount || (iVar3 <= (MaxNewbies - PremiumNewbieBuffer) - iVar1)))) + goto LAB_080dcb50; + print(); + NewbiesOnline = (int)s_There_are_too_many_players_onlin_0810bd80; + goto LAB_080dcbd5; + } + print(); + NewbiesOnline = (int)s_There_are_too_many_players_onlin_0810be20; + } + WaitingTime_00 = iVar1 / 2 + 3; + } +LAB_080dcb50: + if (0xf0 < WaitingTime_00) { + WaitingTime_00 = 0xf0; + } + if (0 < WaitingTime_00) { + snprintf(local_11c,0xfa,"%s\n\nYou are at place %d on the waiting list.",NewbiesOnline,iVar1 + ); + SendLoginMessage(Connection,0x16,local_11c,WaitingTime_00); + } + return WaitingTime_00; +} + + + +// WARNING: Variable defined which should be unmapped: Chances + +int ReadFromSocket(TConnection *Connection,uchar *Buffer,int Size) + +{ + int __fd; + ssize_t sVar1; + int *piVar2; + int nread; + int nleft; + size_t __nbytes; + int local_14; + int Chances; + + local_14 = 0x32; + __nbytes = Size; + if (0 < Size) { + do { + __fd = TConnection::GetSocket(Connection); + sVar1 = read(__fd,Buffer,__nbytes); + if (sVar1 == 0) break; + if (sVar1 < 0) { + piVar2 = __errno_location(); + if (*piVar2 != 4) { + if (*piVar2 != 0xb) { + return sVar1; + } + if (__nbytes == Size) { + return sVar1; + } + if (local_14 == 0) { + return sVar1; + } + local_14 = local_14 + -1; + usleep(100000); + } + } + else { + __nbytes = __nbytes - sVar1; + Buffer = Buffer + sVar1; + } + } while (0 < (int)__nbytes); + } + return Size - __nbytes; +} + + + +bool CallGameThread(TConnection *Connection) + +{ + bool bVar1; + pid_t pVar2; + int iVar3; + + bVar1 = GameRunning(); + if (bVar1) { + Connection->WaitingForACK = true; + pVar2 = GetGameThreadPID(); + iVar3 = kill(pVar2,10); + if (iVar3 != 0) { + pVar2 = GetGameThreadPID(); + error("CallGameThread: Can\'t send SIGUSR1 to pid %d\n",pVar2); + SendLoginMessage(Connection,0x14,"The server is not online.\nPlease try again later.",-1 + ); + return false; + } + } + return true; +} + + + +bool CheckConnection(TConnection *Connection) + +{ + int iVar1; + bool bVar2; + undefined1 local_14 [4]; + pollfd Status; + + bVar2 = false; + local_14 = (undefined1 [4])TConnection::GetSocket(Connection); + Status.fd._0_2_ = 1; + iVar1 = poll((pollfd *)local_14,1,0); + if ((-1 < iVar1) && ((Status.fd._2_2_ & 1) == 0)) { + bVar2 = true; + } + return bVar2; +} + + + +TPlayerData * +PerformRegistration(TConnection *Connection,char *PlayerName,ulong AccountID,char *PlayerPassword, + bool GamemasterClient) + +{ + int iVar1; + char *pcVar2; + TPlayerData *pTVar3; + __pid_t _Var4; + TPlayerData *PlayerData; + char (*__dest) [30]; + bool bVar5; + int iVar6; + int local_e18; + int local_e14; + int i; + undefined1 auStack_e0c [2]; + bool ReadOnly; + bool GamemasterClient_local; + pollfd Status_1; + ulong CharacterID; + int Sex; + int NumberOfBuddies; + undefined1 auStack_df4 [3]; + bool PremiumAccountActivated; + pollfd Status; + char BuddyNames [100] [30]; + char local_22c [4]; + char Title [31]; + char Rank [31]; + char Guild [31]; + ulong BuddyIDs [100]; + uchar Rights [12]; + undefined1 local_2c [4]; + TQueryManagerPoolConnection QueryManagerConnection; + + TQueryManagerPoolConnection::TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)local_2c,&QueryManagerConnectionPool); + if (QueryManagerConnection.QueryManagerConnectionPool == (TQueryManagerConnectionPool *)0x0) { + pcVar2 = "PerformRegistration: Kann Verbindung zum Query-Manager nicht herstellen.\n"; +LAB_080dd3a0: + error(pcVar2); +switchD_080dcfed_caseD_0: + pcVar2 = "Internal error, closing connection."; + goto LAB_080dd020; + } + // try { // try from 080dceb0 to 080dd02f has its CatchHandler @ 080dd590 + _auStack_df4 = TConnection::GetSocket(Connection); + bVar5 = false; + Status.fd._0_2_ = 1; + iVar6 = 1; + iVar1 = poll((pollfd *)auStack_df4,1,0); + if ((-1 < iVar1) && ((Status.fd._2_2_ & 1) == 0)) { + bVar5 = true; + } + if (!bVar5) goto LAB_080dd030; + print(); + BuddyIDs[99] = 0; + pcVar2 = TConnection::GetIPAddress(Connection); + iVar6 = TQueryManagerConnection::loginGame + ((TQueryManagerConnection *)QueryManagerConnection.QueryManagerConnectionPool, + AccountID,PlayerName,PlayerPassword,pcVar2,PrivateWorld,false, + GamemasterClient,(ulong *)&Status_1.events,(int *)&CharacterID,Rank + 0x1c, + Title + 0x1c,local_22c,&Sex,(ulong *)(Guild + 0x1c), + (char (*) [30])&Status.events,(uchar *)(BuddyIDs + 99), + (bool *)((int)&NumberOfBuddies + 3)); + switch(iVar6) { + case 0: + // try { // try from 080dd05c to 080dd11d has its CatchHandler @ 080dd590 + _auStack_e0c = TConnection::GetSocket(Connection); + bVar5 = false; + Status_1.fd._0_2_ = 1; + iVar6 = poll((pollfd *)auStack_e0c,1,0); + if ((-1 < iVar6) && ((Status_1.fd._2_2_ & 1) == 0)) { + bVar5 = true; + } + if (!bVar5) { + TQueryManagerConnection::decrementIsOnline + ((TQueryManagerConnection *)QueryManagerConnection.QueryManagerConnectionPool, + Status_1._4_4_); + iVar6 = Status_1._4_4_; + goto LAB_080dd030; + } + if (AccountID == 0) { + error("PerformRegistration: Spieler %s wurde noch keinem Account zugewiesen.\n", + PlayerName); + pcVar2 = + "Character is not assigned to an account.\nPerform this on the Tibia website\nat \"www.tibia.com\"." + ; + } + else { + PlayerName[0x1d] = '\0'; + if (NumberOfBuddies._3_1_ != '\0') { + SendLoginMessage(Connection,0x15, + "Your Premium Account is now activated.\nHave a lot of fun in Tibia." + ,-1); + } + pcVar2 = TConnection::GetIPAddress(Connection); + iVar6 = TConnection::GetSocket(Connection); + Log("game","Spieler %s loggt ein an Socket %d von %s.\n",PlayerName,iVar6,pcVar2); + pcVar2 = (char *)0x1; + pTVar3 = AssignPlayerPoolSlot(Status_1._4_4_,true); + if (pTVar3 != (TPlayerData *)0x0) { + _Var4 = getpid(); + bVar5 = pTVar3->Locked == _Var4; + if ((bVar5) || (pTVar3->AccountID == 0)) { + pTVar3->Sex = CharacterID; + pTVar3->AccountID = AccountID; + strcpy(pTVar3->Name,PlayerName); + *(ulong *)pTVar3->Rights = BuddyIDs[99]; + pTVar3->Rights[4] = '\0'; + pTVar3->Rights[5] = '\0'; + pTVar3->Rights[6] = '\0'; + pTVar3->Rights[7] = '\0'; + pTVar3->Rights[8] = '\0'; + pTVar3->Rights[9] = '\0'; + pTVar3->Rights[10] = '\0'; + pTVar3->Rights[0xb] = '\0'; + strcpy(pTVar3->Guild,Rank + 0x1c); + strcpy(pTVar3->Rank,Title + 0x1c); + pcVar2 = local_22c; + strcpy(pTVar3->Title,pcVar2); + } + if ((bVar5) && (pTVar3->Buddies == 0)) { + pTVar3->Buddies = Sex; + local_e14 = 0; + if (0 < Sex) { + local_e18 = 0; + __dest = pTVar3->BuddyName; + do { + pTVar3->Buddy[local_e14] = *(ulong *)(Guild + local_e14 * 4 + 0x1c); + pcVar2 = BuddyNames[-1] + local_e18 + 0x1a; + strcpy(*__dest,pcVar2); + local_e14 = local_e14 + 1; + local_e18 = local_e18 + 0x1e; + __dest = __dest + 1; + } while (local_e14 < Sex); + } + } + TQueryManagerPoolConnection::~TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)local_2c,(int)pcVar2); + return pTVar3; + } + // try { // try from 080dd27e to 080dd569 has its CatchHandler @ 080dd590 + error(&DAT_0810c160); + TQueryManagerConnection::decrementIsOnline + ((TQueryManagerConnection *)QueryManagerConnection.QueryManagerConnectionPool, + Status_1._4_4_); + pcVar2 = "There are too many players online.\nPlease try again later."; + } + break; + case 1: + print(); + pcVar2 = + "Character doesn\'t exist.\nCreate a new character on the Tibia website\nat \"www.tibia.com\"." + ; + break; + case 2: + print(); + pcVar2 = "Character doesn\'t exist.\nCreate a new character on the Tibia website."; + break; + case 3: + print(); + pcVar2 = "Character doesn\'t live on this world.\nPlease login on the right world."; + break; + case 4: + print(); + pcVar2 = "This world is private and you have not been invited to play on it."; + break; + default: + pcVar2 = &DAT_0810c4a0; + goto LAB_080dd3a0; + case 6: + pcVar2 = TConnection::GetIPAddress(Connection); + Log("game",&DAT_0810c500,PlayerName,pcVar2); + goto LAB_080dd3d1; + case 7: + pcVar2 = TConnection::GetIPAddress(Connection); + Log("game","Spieler %s blockiert; Login von %s.\n",PlayerName,pcVar2); + pcVar2 = "Account disabled for five minutes. Please wait."; + break; + case 8: + Log("game",&DAT_0810c600,PlayerName); +LAB_080dd3d1: + pcVar2 = "Accountnumber or password is not correct."; + break; + case 9: + pcVar2 = TConnection::GetIPAddress(Connection); + Log("game",&DAT_0810c640,pcVar2,PlayerName); + pcVar2 = "IP address blocked for 30 minutes. Please wait."; + break; + case 10: + print(); + pcVar2 = "Your account is banished."; + break; + case 0xb: + print(); + pcVar2 = "Your character is banished because of his/her name."; + break; + case 0xc: + print(); + pcVar2 = "Your IP address is banished."; + break; + case 0xd: + print(); + pcVar2 = "You may only login with one character\nof your account at the same time."; + break; + case 0xe: + print(); + pcVar2 = "You may only login with a Gamemaster account."; + break; + case 0xf: + Log("game",&DAT_0810c860,AccountID,PlayerName); + pcVar2 = "Login failed due to corrupt data."; + break; + case -1: + goto switchD_080dcfed_caseD_0; + } +LAB_080dd020: + iVar6 = 0x14; + SendLoginMessage(Connection,0x14,pcVar2,-1); +LAB_080dd030: + TQueryManagerPoolConnection::~TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)local_2c,iVar6); + return (TPlayerData *)0x0; +} + + + +bool HandleLogin(TConnection *Connection) + +{ + TReadBuffer *this; + int *ctx; + TWaitinglistEntry *pTVar1; + uchar Command; + uchar uVar2; + bool bVar3; + bool bVar4; + ushort w; + ushort w_00; + ulong AccountID_00; + int iVar5; + TPlayerData *Slot; + __pid_t _Var6; + pid_t pVar7; + bool FreeAccount_00; + bool Newbie_00; + int WaitingTime; + TPlayerData *PlayerData; + int Type; + TQueryManagerConnectionPool *CharacterID; + uchar *out; + char *pcVar8; + size_t *in_stack_fffffed0; + uchar *in_stack_fffffed4; + size_t in_stack_fffffed8; + bool ReadOnly; + ulong AccountID; + bool GamemasterClient; + ushort TerminalVersion; + ushort TerminalType; + bool local_102; + bool local_101; + bool Newbie; + ulong uStack_100; + bool FreeAccount; + ulong NextTry; + TWriteBuffer WriteBuffer; + uchar AssymmetricData [128]; + char PlayerPassword [31]; + char PlayerName [31]; + TReadBuffer Buffer; + + this = (TReadBuffer *)(PlayerName + 0x1c); + TReadBuffer::TReadBuffer(this,Connection->InData + 2,0x7fe); + // try { // try from 080dd5e8 to 080dd5ec has its CatchHandler @ 080ddd00 + uVar2 = TReadBuffer::readByte(this); + if (uVar2 == '\n') { + out = (uchar *)0x80; + ctx = &WriteBuffer.Position; + // try { // try from 080dd635 to 080dd645 has its CatchHandler @ 080ddde8 + TReadBuffer::readBytes(this,(uchar *)ctx,0x80); + Semaphore::down(&RSAMutex); + // try { // try from 080dd651 to 080dd655 has its CatchHandler @ 080ddd3f + TRSAPrivateKey::decrypt + (&PrivateKey,(EVP_PKEY_CTX *)ctx,out,in_stack_fffffed0,in_stack_fffffed4, + in_stack_fffffed8); + // try { // try from 080dd65d to 080dd74c has its CatchHandler @ 080ddde8 + Semaphore::up(&RSAMutex); + TReadBuffer::TReadBuffer((TReadBuffer *)&NextTry,(uchar *)ctx,0x80); + TReadBuffer::readByte((TReadBuffer *)&NextTry); + TXTEASymmetricKey::init + (&Connection->SymmetricKey,(EVP_PKEY_CTX *)((int)ctx + WriteBuffer.Size)); + TReadBuffer::skip((TReadBuffer *)&NextTry,0x10); + w = TReadBuffer::readWord((TReadBuffer *)&NextTry); + w_00 = TReadBuffer::readWord((TReadBuffer *)&NextTry); + uVar2 = TReadBuffer::readByte((TReadBuffer *)&NextTry); + AccountID_00 = TReadBuffer::readQuad((TReadBuffer *)&NextTry); + pcVar8 = PlayerPassword + 0x1c; + TReadStream::readString((TReadStream *)&NextTry,pcVar8,0x1e); + TReadStream::readString((TReadStream *)&NextTry,(char *)(AssymmetricData + 0x7c),0x1e); + if (PlayerPassword[0x1c] == '\0') { + pcVar8 = "You must enter a character name."; + } + else if ((w < 3) && (TERMINALVERSION[w] <= (int)(uint)w_00)) { + bVar3 = GameRunning(); + if (bVar3) { + bVar3 = GameStarting(); + if (bVar3) { + pcVar8 = "The game is just starting.\nPlease try again later."; + } + else { + bVar3 = GameEnding(); + if (!bVar3) { + do { + Semaphore::down(&CommunicationThreadMutex); + for (pTVar1 = WaitinglistHead; pTVar1 != (TWaitinglistEntry *)0x0; + pTVar1 = pTVar1->Next) { + iVar5 = stricmp(pcVar8,pTVar1->Name,-1); + if (iVar5 == 0) { + uStack_100 = pTVar1->NextTry; + local_101 = pTVar1->FreeAccount; + local_102 = pTVar1->Newbie; + Semaphore::up(&CommunicationThreadMutex); + bVar3 = true; + goto LAB_080dd827; + } + } + Semaphore::up(&CommunicationThreadMutex); + bVar3 = false; +LAB_080dd827: + if (!bVar3) { + print(); + Slot = PerformRegistration(Connection,pcVar8,AccountID_00, + (char *)(AssymmetricData + 0x7c), + uVar2 != '\0'); + if (Slot == (TPlayerData *)0x0) { + return false; + } + _Var6 = getpid(); + bVar3 = Slot->Locked != _Var6; + FreeAccount_00 = (bool)((Slot->Rights[0] ^ 1) & 1); + Newbie_00 = false; + if ((Slot->Profession == 0) && ((Slot->Rights[8] & 0x40) == 0)) { + Newbie_00 = true; + } + if ((FreeAccount_00 == false) || + ((MaxPlayers != PremiumPlayerBuffer && + ((Newbie_00 == false || (MaxNewbies != PremiumNewbieBuffer)))))) + { + bVar4 = IsPlayerOnline(pcVar8); + if ((bVar4) || + (iVar5 = CheckWaitingTime(pcVar8,Connection,FreeAccount_00, + Newbie_00), iVar5 < 1)) + goto LAB_080dd929; + InsertWaitinglistEntry + (pcVar8,iVar5 + RoundNr,FreeAccount_00,Newbie_00); + CharacterID = &QueryManagerConnectionPool; + TQueryManagerPoolConnection::TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)&NextTry, + &QueryManagerConnectionPool); + if (WriteBuffer.super_TWriteStream._vptr_TWriteStream == + (_func_int_varargs **)0x0) { + error( + "HandleLogin: Kann Verbindung zum Query-Manager nicht herstellen.\n" + ); + } + else { + CharacterID = (TQueryManagerConnectionPool *) + Slot->CharacterID; + // try { // try from 080ddbdb to 080ddbf0 has its CatchHandler @ 080dde0a + TQueryManagerConnection::decrementIsOnline + ((TQueryManagerConnection *) + WriteBuffer.super_TWriteStream._vptr_TWriteStream + ,(ulong)CharacterID); + } + if (bVar3) { + DecreasePlayerPoolSlotSticky(Slot); + } + else { + // try { // try from 080ddc07 to 080ddc19 has its CatchHandler @ 080dde0a + ReleasePlayerPoolSlot(Slot); + } + } + else { + SendLoginMessage(Connection,0x14, + + "Only players with premium accounts\nare allowed to enter this world." + ,-1); + CharacterID = &QueryManagerConnectionPool; + TQueryManagerPoolConnection::TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)&NextTry, + &QueryManagerConnectionPool); + if (WriteBuffer.super_TWriteStream._vptr_TWriteStream == + (_func_int_varargs **)0x0) { + error( + "HandleLogin: Kann Verbindung zum Query-Manager nicht herstellen.\n" + ); + } + else { + CharacterID = (TQueryManagerConnectionPool *) + Slot->CharacterID; + // try { // try from 080ddc65 to 080ddc9e has its CatchHandler @ 080dddf5 + TQueryManagerConnection::decrementIsOnline + ((TQueryManagerConnection *) + WriteBuffer.super_TWriteStream._vptr_TWriteStream + ,(ulong)CharacterID); + } + if (bVar3) { + DecreasePlayerPoolSlotSticky(Slot); + } + else { + ReleasePlayerPoolSlot(Slot); + } + } + TQueryManagerPoolConnection::~TQueryManagerPoolConnection + ((TQueryManagerPoolConnection *)&NextTry,(int)CharacterID) + ; + return false; + } + print(); + iVar5 = uStack_100 - RoundNr; + if (0 < iVar5) { + Log("queue",&DAT_0810ca20,pcVar8,iVar5); + pcVar8 = "It\'s not your turn yet."; + Type = 0x16; + goto LAB_080dd78e; + } + if (-0x3d < iVar5) { + iVar5 = CheckWaitingTime(pcVar8,Connection,local_101,local_102); + if (0 < iVar5) { + InsertWaitinglistEntry + (pcVar8,iVar5 + RoundNr,local_101,local_102); + return false; + } + DeleteWaitinglistEntry(pcVar8); + Slot = PerformRegistration(Connection,pcVar8,AccountID_00, + (char *)(AssymmetricData + 0x7c), + uVar2 != '\0'); + if (Slot == (TPlayerData *)0x0) { + return false; + } + _Var6 = getpid(); + bVar3 = Slot->Locked != _Var6; +LAB_080dd929: + if (!bVar3) { + IncreasePlayerPoolSlotSticky(Slot); + ReleasePlayerPoolSlot(Slot); + } + TWriteBuffer::TWriteBuffer + ((TWriteBuffer *)&NextTry,Connection->InData + 2,0x7fe); + // try { // try from 080dd967 to 080dd9af has its CatchHandler @ 080dde17 + TWriteBuffer::writeByte((TWriteBuffer *)&NextTry,'\v'); + TWriteBuffer::writeWord((TWriteBuffer *)&NextTry,w); + TWriteBuffer::writeWord((TWriteBuffer *)&NextTry,w_00); + TWriteBuffer::writeQuad((TWriteBuffer *)&NextTry,Slot->CharacterID); + Connection->NextToSend = 0; + Connection->NextToCommit = 0; + Connection->InDataSize = WriteBuffer.Size; + Connection->NextToWrite = 0; + TConnection::Login(Connection); + bVar3 = GameRunning(); + if (bVar3) { + Connection->WaitingForACK = true; + pVar7 = GetGameThreadPID(); + iVar5 = kill(pVar7,10); + if (iVar5 != 0) { + pVar7 = GetGameThreadPID(); + error("CallGameThread: Can\'t send SIGUSR1 to pid %d\n", + pVar7); + SendLoginMessage(Connection,0x14, + + "The server is not online.\nPlease try again later." + ,-1); + return false; + } + } + return true; + } + Log("queue",&DAT_0810c9e0,pcVar8,-iVar5); + DeleteWaitinglistEntry(pcVar8); + } while( true ); + } + pcVar8 = "The game is just going down.\nPlease try again later."; + } + } + else { + pcVar8 = "The server is not online.\nPlease try again later."; + } + } + else { + pcVar8 = + "Your terminal version is too old.\nPlease get a new version at\nhttp://www.tibia.com."; + } + iVar5 = -1; + Type = 0x14; +LAB_080dd78e: + SendLoginMessage(Connection,Type,pcVar8,iVar5); + } + else { + print(); + } + return false; +} + + + +// WARNING: Variable defined which should be unmapped: Help + +bool ReceiveCommand(TConnection *Connection) + +{ + uint uVar1; + bool bVar2; + int n; + int iVar3; + uchar *puVar4; + EVP_PKEY_CTX *ctx; + pid_t pVar5; + ssize_t sVar6; + int Offset; + int Count; + uchar *Size; + uchar *out; + size_t *in_stack_ffffffe0; + uchar *in_stack_ffffffe4; + size_t in_stack_ffffffe8; + byte local_12; + byte local_11; + uchar Help [2]; + + if (Connection == (TConnection *)0x0) { + error("ReceiveCommand: Connection ist NULL.\n"); +LAB_080de0d3: + bVar2 = false; + } + else { + do { + do { + while( true ) { + iVar3 = ReadFromSocket(Connection,&local_12,2); + if (iVar3 == 0) { + return false; + } + if (iVar3 < 0) { + return true; + } + if (iVar3 < 2) { + Semaphore::down(&CommunicationThreadMutex); + TotalRecv = TotalRecv + 0x31; + Semaphore::up(&CommunicationThreadMutex); + TConnection::GetSocket(Connection); + print(); + goto LAB_080de003; + } + Size = (uchar *)((uint)local_11 * 0x100 + (uint)local_12); + Connection->InDataSize = (int)Size; + if (((uchar *)0x7fd < Size) || (Size == (uchar *)0x0)) { + TConnection::GetSocket(Connection); + print(); + if (Size != (uchar *)0x0) { + do { + Size = Size + -0x800; + iVar3 = TConnection::GetSocket(Connection); + sVar6 = read(iVar3,Connection,0x800); + Semaphore::down(&CommunicationThreadMutex); + TotalRecv = TotalRecv + sVar6 + 0x30; + Semaphore::up(&CommunicationThreadMutex); + } while (0 < (int)Size); + } + goto LAB_080de003; + } + if (Connection->State == CONNECTION_CONNECTED) break; + out = Size; + puVar4 = (uchar *)ReadFromSocket(Connection,Connection->InData,(int)Size); + if ((int)puVar4 < 0) { +LAB_080de0b0: + SendLoginMessage(Connection,0x14,"Internal error, closing connection.",-1); + goto LAB_080de0d3; + } + Semaphore::down(&CommunicationThreadMutex); + TotalRecv = (int)puVar4 + TotalRecv + 0x30; + Semaphore::up(&CommunicationThreadMutex); + if (puVar4 == Size) { + if (((uint)Size & 7) == 0) { + iVar3 = 0; + if (Size != (uchar *)0x0) { + do { + ctx = (EVP_PKEY_CTX *)(Connection->InData + iVar3); + iVar3 = iVar3 + 8; + TXTEASymmetricKey::decrypt + (&Connection->SymmetricKey,ctx,out,in_stack_ffffffe0, + in_stack_ffffffe4,in_stack_ffffffe8); + } while (iVar3 < (int)Size); + } + uVar1 = (uint)Connection->InData[1] * 0x100 + + (uint)Connection->InData[0]; + Connection->InDataSize = uVar1; + if ((uVar1 < 0x7fe) && (uVar1 != 0)) goto LAB_080ddfc8; + in_stack_ffffffe0 = (size_t *)TConnection::GetSocket(Connection); + } + else { + in_stack_ffffffe0 = (size_t *)TConnection::GetName(Connection); + } + print(); + } + } + iVar3 = ReadFromSocket(Connection,Connection->InData + 2,(int)Size); + if (iVar3 < 0) goto LAB_080de0b0; + Semaphore::down(&CommunicationThreadMutex); + TotalRecv = TotalRecv + iVar3 + 0x30; + Semaphore::up(&CommunicationThreadMutex); + } while (iVar3 != Connection->InDataSize); +LAB_080ddfc8: + if (Connection->State == CONNECTION_CONNECTED) { + alarm(0); + bVar2 = HandleLogin(Connection); + } + else { + bVar2 = GameRunning(); + if (bVar2) { + Connection->WaitingForACK = true; + pVar5 = GetGameThreadPID(); + iVar3 = kill(pVar5,10); + if (iVar3 != 0) { + pVar5 = GetGameThreadPID(); + error("CallGameThread: Can\'t send SIGUSR1 to pid %d\n",pVar5); + in_stack_ffffffe0 = (size_t *)0xffffffff; + SendLoginMessage(Connection,0x14, + "The server is not online.\nPlease try again later.",-1); + bVar2 = false; + goto LAB_080ddfe6; + } + } + bVar2 = true; + } +LAB_080ddfe6: + if (bVar2 == false) { + return false; + } + } while (Connection->WaitingForACK == false); + Connection->SigIOPending = true; +LAB_080de003: + bVar2 = true; + } + return bVar2; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void IncrementActiveConnections(void) + +{ + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + 1; + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void DecrementActiveConnections(void) + +{ + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + -1; + Semaphore::up(&CommunicationThreadMutex); + return; +} + + + +void CommunicationThread(int Socket) + +{ + CONNECTIONSTATE CVar1; + bool bVar2; + TConnection *this; + __pid_t _Var3; + int iVar4; + int *piVar5; + TConnection *Connection; + char *Text; + int local_a0; + int Signal; + sigset_t SignalSet; + + this = AssignFreeConnection(); + if (this == (TConnection *)0x0) { + print(); + iVar4 = close(Socket); + if (-1 < iVar4) { + return; + } + piVar5 = __errno_location(); + error(&DAT_0810cf20,*piVar5); + return; + } + TConnection::Connect(this,Socket); + this->WaitingForACK = false; + _Var3 = getpid(); + iVar4 = fcntl(Socket,8,_Var3); + if (iVar4 < 0) { + error(&DAT_0810cea0,Socket); + iVar4 = close(Socket); + if (-1 < iVar4) goto LAB_080de426; + piVar5 = __errno_location(); + iVar4 = *piVar5; + Text = &DAT_0810cee0; + } + else { + iVar4 = fcntl(Socket,4,0x2800); + if (-1 < iVar4) { + sigfillset((sigset_t *)&Signal); + sigprocmask(2,(sigset_t *)&Signal,(sigset_t *)0x0); + alarm(5); + bVar2 = ReceiveCommand(this); + if (!bVar2) { + TConnection::Close(this,true); + } + this->SigIOPending = false; +switchD_080de377_caseD_0: + bVar2 = GameRunning(); + if ((!bVar2) || (this->ConnectionIsOk == false)) goto LAB_080de403; + sigwait((sigset_t *)&Signal,&local_a0); + switch(local_a0) { + default: + goto switchD_080de377_caseD_0; + case 1: + case 0xd: + break; + case 10: + if (this->SigIOPending != false) goto switchD_080de377_caseD_1d; + goto switchD_080de377_caseD_0; + case 0xc: + bVar2 = SendData(this); + if (bVar2) goto switchD_080de377_caseD_0; + break; + case 0xe: + if (this->State != CONNECTION_CONNECTED) goto switchD_080de377_caseD_0; + print(); + break; + case 0x1d: +switchD_080de377_caseD_1d: + if (this->WaitingForACK == false) { + this->SigIOPending = false; + bVar2 = ReceiveCommand(this); + if (!bVar2) { + bVar2 = true; + goto LAB_080de3ab; + } + } + else { + this->SigIOPending = true; + } + goto switchD_080de377_caseD_0; + } + bVar2 = false; +LAB_080de3ab: + TConnection::Close(this,bVar2); + goto switchD_080de377_caseD_0; + } + error(&DAT_0810ce20,Socket); + iVar4 = close(Socket); + if (-1 < iVar4) goto LAB_080de426; + piVar5 = __errno_location(); + iVar4 = *piVar5; + Text = &DAT_0810ce60; + } +LAB_080de44b: + error(Text,iVar4); +LAB_080de426: + TConnection::Free(this); + return; +LAB_080de403: + CVar1 = this->State; + while (CVar1 - CONNECTION_LOGIN < 4) { + DelayThread(1,0); + CVar1 = this->State; + } + if (this->ClosingIsDelayed != false) { + DelayThread(2,0); + } + iVar4 = close(Socket); + if (-1 < iVar4) goto LAB_080de426; + piVar5 = __errno_location(); + iVar4 = *piVar5; + Text = &DAT_0810cde0; + goto LAB_080de44b; +} + + + +int HandleConnection(void *Data) + +{ + __pid_t _Var1; + int Socket; + int iVar2; + void *pvVar3; + + pvVar3 = Data; + if ((void *)0x7fffffff < Data) { + pvVar3 = (void *)((int)Data + 0xffff); + } + iVar2 = (int)pvVar3 >> 0x10; + if (UseOwnStacks) { + _Var1 = getpid(); + LastUsingCommunicationThread[iVar2] = _Var1; + } + // try { // try from 080de581 to 080de585 has its CatchHandler @ 080de5f0 + CommunicationThread((int)((int)Data + iVar2 * -0x10000)); + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + -1; + Semaphore::up(&CommunicationThreadMutex); + if (UseOwnStacks != false) { + Semaphore::down(&CommunicationThreadMutex); + FreeCommunicationThreadStacks[NumberOfFreeCommunicationThreadStacks] = iVar2; + NumberOfFreeCommunicationThreadStacks = NumberOfFreeCommunicationThreadStacks + 1; + Semaphore::up(&CommunicationThreadMutex); + } + return 0; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool OpenSocket(void) + +{ + ushort __x; + int iVar1; + int *piVar2; + char *pcVar3; + undefined4 uVar4; + undefined4 uVar5; + undefined4 *__optval; + undefined4 local_2c; + linger l; + undefined1 local_1c [4]; + sockaddr_in ServerAddress; + + print(); + getpid(); + __optval = (undefined4 *)GamePort; + print(); + uVar5 = 0; + uVar4 = 1; + TCPSocket = socket(2,1,0); + if (TCPSocket < 0) { + pcVar3 = &DAT_0810d1c0; + } + else { + local_2c = 0; + __optval = &local_2c; + l.l_onoff = 0; + uVar5 = 0xd; + uVar4 = 1; + iVar1 = setsockopt(TCPSocket,1,0xd,__optval,8); + if (-1 < iVar1) { + local_1c._0_2_ = 0; + local_1c[2] = '\0'; + local_1c[3] = '\0'; + ServerAddress.sin_family = 0; + ServerAddress.sin_port = 0; + ServerAddress.sin_addr.s_addr = 0; + ServerAddress.sin_zero[0] = '\0'; + ServerAddress.sin_zero[1] = '\0'; + ServerAddress.sin_zero[2] = '\0'; + ServerAddress.sin_zero[3] = '\0'; + ServerAddress._0_4_ = inet_addr(GameAddress); + local_1c._2_2_ = (ushort)GamePort >> 8 | (ushort)GamePort << 8; + local_1c._0_2_ = 2; + iVar1 = setsockopt(TCPSocket,1,2,(sockaddr *)local_1c,0x10); + if (iVar1 == 0) { + iVar1 = bind(TCPSocket,(sockaddr *)local_1c,0x10); + if (iVar1 < 0) { + piVar2 = __errno_location(); + error("LaunchServer: Fehler %d bei bind.\n",*piVar2); + print(); + while (iVar1 = bind(TCPSocket,(sockaddr *)local_1c,0x10), iVar1 < 0) { + sleep(1); + } + } + piVar2 = __errno_location(); + *piVar2 = 0; + iVar1 = listen(TCPSocket,0x200); + if (-1 < iVar1) { + return true; + } + iVar1 = *piVar2; + pcVar3 = "LaunchServer: Fehler %d bei listen.\n"; + } + else { + piVar2 = __errno_location(); + iVar1 = *piVar2; + pcVar3 = "LaunchServer: Fehler %d bei setsockopt.\n"; + } + error(pcVar3,iVar1); + return false; + } + pcVar3 = "LaunchServer: Socket wurde nicht auf LINGER=0 gesetzt.\n"; + } + error(pcVar3,uVar4,uVar5,__optval); + return false; +} + + + +// WARNING: Variable defined which should be unmapped: cli_addr + +int AcceptorThreadLoop(void *param_1) + +{ + bool bVar1; + RESULT r; + int *piVar2; + void *Argument; + Thread TVar3; + int iVar4; + int NewSocket; + char *Text; + int local_28; + int StackNumber; + void *Stack; + socklen_t clilen; + sockaddr_in cli_addr; + + AcceptorThreadPID = getpid(); + print(); +LAB_080de8d6: + do { + while( true ) { + bVar1 = GameRunning(); + if (!bVar1) { + AcceptorThreadPID = 0; + if (0 < ActiveConnections) { + print(); + while (0 < ActiveConnections) { + sleep(1); + } + } + return 0; + } + Stack = (void *)0x10; + piVar2 = __errno_location(); + *piVar2 = 0; + Argument = (void *)accept(TCPSocket,(sockaddr *)&clilen,(socklen_t *)&Stack); + if ((int)Argument < 0) goto LAB_080deb36; + if (UseOwnStacks != false) break; + if (ActiveConnections < 0x44c) { + // try { // try from 080de940 to 080deb3a has its CatchHandler @ 080deba5 + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + 1; + Semaphore::up(&CommunicationThreadMutex); + TVar3 = StartThread(HandleConnection,Argument,0x10000,true); + if (TVar3 == 0) { + print(); + iVar4 = close((int)Argument); + if (iVar4 < 0) { + error(&DAT_0810d240,*piVar2); + } + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + -1; +LAB_080de9b1: + Semaphore::up(&CommunicationThreadMutex); + } + } + else { + print(); + iVar4 = close((int)Argument); + if (iVar4 < 0) { + iVar4 = *piVar2; + Text = &DAT_0810d280; + goto LAB_080dea07; + } + } + } + GetCommunicationThreadStack(&local_28,(void **)&StackNumber); + if (StackNumber != 0) { + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + 1; + Semaphore::up(&CommunicationThreadMutex); + TVar3 = StartThread(HandleConnection,(void *)(local_28 * 0x10000 + (int)Argument), + (void *)StackNumber,0x10000,true); + if (TVar3 == 0) { + print(); + iVar4 = close((int)Argument); + if (iVar4 < 0) { + error(&DAT_0810d2c0,*piVar2); + } + Semaphore::down(&CommunicationThreadMutex); + ActiveConnections = ActiveConnections + -1; + Semaphore::up(&CommunicationThreadMutex); + iVar4 = local_28; + Semaphore::down(&CommunicationThreadMutex); + FreeCommunicationThreadStacks[NumberOfFreeCommunicationThreadStacks] = iVar4; + NumberOfFreeCommunicationThreadStacks = NumberOfFreeCommunicationThreadStacks + 1; + goto LAB_080de9b1; + } + goto LAB_080de8d6; + } + print(); + iVar4 = close((int)Argument); + if (iVar4 < 0) { + iVar4 = *piVar2; + Text = &DAT_0810d320; + goto LAB_080dea07; + } + } while( true ); +LAB_080deb36: + bVar1 = GameRunning(); + if (bVar1) { + iVar4 = *piVar2; + Text = "AcceptorThreadLoop: Fehler %d beim Accept.\n"; +LAB_080dea07: + error(Text,iVar4); + } + goto LAB_080de8d6; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void CheckThreadlibVersion(void) + +{ + bool bVar1; + + bVar1 = FileExists("/etc/image-release"); + UseOwnStacks = !bVar1; + print(); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitCommunication(void) + +{ + bool bVar1; + int i; + int iVar2; + undefined4 *puVar3; + char *ctx; + + // try { // try from 080dec6d to 080ded9e has its CatchHandler @ 080dee0e + bVar1 = FileExists("/etc/image-release"); + UseOwnStacks = !bVar1; + if (UseOwnStacks) { + ctx = "Verwende eigene Stacks.\n"; + } + else { + ctx = "Verwende verkleinerte Bibliotheks-Stacks.\n"; + } + print(); + if (UseOwnStacks != false) { + ctx = (char *)0xaa; + memset(CommunicationThreadStacks,0xaa,0x44c0000); + iVar2 = 0; + do { + LastUsingCommunicationThread[iVar2] = 0; + FreeCommunicationThreadStacks[iVar2] = iVar2; + iVar2 = iVar2 + 1; + } while (iVar2 < 0x44c); + NumberOfFreeCommunicationThreadStacks = 0x44c; + } + TQueryManagerConnectionPool::init(&QueryManagerConnectionPool,(EVP_PKEY_CTX *)ctx); + ActiveConnections = 0; + TCPSocket = -1; + OpenSocket(); + if (TCPSocket == -1) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "cannot open socket"; + } + else { + iVar2 = 0; + do { + LoadHistory[iVar2] = 0; + iVar2 = iVar2 + 1; + } while (iVar2 < 0x168); + LoadHistoryPointer = 0; + TotalSend = 0; + TotalRecv = 0; + TotalLoad = 0; + LagEnd = 0; + EarliestFreeAccountAdmissionRound = 0; + InitLog("netload"); + WaitinglistHead = (TWaitinglistEntry *)0x0; + TRSAPrivateKey::init + (&PrivateKey, + (EVP_PKEY_CTX *) + "12017580013707233233987537782574702577133548287527131234152948150506251412291888866940292054989907714155267326586216043845592229084368540020196135619327879" + ); + AcceptorThread = StartThread(AcceptorThreadLoop,(void *)0x0,false); + if (AcceptorThread != 0) { + return; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "cannot start acceptor thread"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitCommunication(void) + +{ + TConnection *Connection; + TConnection *this; + pid_t __pid; + int iVar1; + int *piVar2; + char *__status; + + print(); + this = GetFirstConnection(); + while (this != (TConnection *)0x0) { + __pid = TConnection::GetPID(this); + kill(__pid,1); + this = GetNextConnection(); + } + ProcessConnections(); + __status = "Alle Verbindungen beendet.\n"; + print(); + if ((TCPSocket != -1) && (iVar1 = close(TCPSocket), iVar1 < 0)) { + piVar2 = __errno_location(); + __status = (char *)*piVar2; + error(&DAT_0810d500); + } + if (AcceptorThread != 0) { + if (AcceptorThreadPID != 0) { + __status = (char *)0x1; + kill(AcceptorThreadPID,1); + } + JoinThread(AcceptorThread); + AcceptorThread = 0; + } + TQueryManagerConnectionPool::exit(&QueryManagerConnectionPool,(int)__status); + ExitCommunicationThreadStacks(); + return; +} + + + +void __tcf_0(void *param_1) + +{ + int in_stack_00000008; + + vlong::~vlong(&RSA_EXPONENT,in_stack_00000008); + return; +} + + + +void __tcf_1(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&CommunicationThreadMutex,in_stack_00000008); + return; +} + + + +void __tcf_2(void *param_1) + +{ + int in_stack_00000008; + + TRSAPrivateKey::~TRSAPrivateKey(&PrivateKey,in_stack_00000008); + return; +} + + + +void __tcf_3(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&RSAMutex,in_stack_00000008); + return; +} + + + +void __tcf_4(void *param_1) + +{ + int in_stack_00000008; + int in_stack_fffffff8; + + Semaphore::~Semaphore(&QueryManagerConnectionPool.QueryManagerConnectionMutex,in_stack_fffffff8) + ; + Semaphore::~Semaphore(&QueryManagerConnectionPool.FreeQueryManagerConnections,in_stack_00000008) + ; + return; +} + + + +void __tcf_5(void *param_1) + +{ + listnode<> *plVar1; + list<> *plVar2; + listnode<> *plVar3; + + plVar2 = Waitinglist.Units; + if (Waitinglist.Units != (list<> *)0x0) { + plVar1 = (Waitinglist.Units)->firstNode; + while (plVar1 != (listnode<> *)0x0) { + plVar3 = plVar1->prev; + if (plVar3 == (listnode<> *)0x0) { + plVar2->firstNode = plVar1->next; + plVar3 = plVar1->prev; + } + else { + plVar3->next = plVar1->next; + } + if (plVar1->next == (listnode<> *)0x0) { + plVar2->lastNode = plVar3; + } + else { + plVar1->next->prev = plVar3; + } + operator_delete(plVar1); + plVar1 = plVar2->firstNode; + } + operator_delete(plVar2); + return; + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_TCPSocket(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original prototype: TWaitinglistEntry * getFreeItem(store * this) + +TWaitinglistEntry * __thiscall store<>::getFreeItem(store<> *this) + +{ + int iVar1; + listnode<> *plVar2; + storeitem<> *psVar3; + storeunit<> *psVar4; + int i; + int iVar5; + int local_1c; + int local_18; + storeunit<> *local_14; + + psVar3 = this->firstFreeItem; + if (psVar3 == (storeitem<> *)0x0) { + plVar2 = list<>::append(this->Units); + local_18 = 0; + local_1c = 0; + iVar5 = 0x62; + do { + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + local_14 = (storeunit<> *)0x0; + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + local_14 = &plVar2->data; + psVar4 = &plVar2->data; + } + iVar1 = local_18 + 0x2c; + local_18 = local_18 + 0x2c; + *(int *)((int)local_14->item + local_1c) = (int)psVar4->item + iVar1; + local_1c = local_1c + 0x2c; + iVar5 = iVar5 + -1; + } while (-1 < iVar5); + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar4 = (storeunit<> *)0x0; + } + else { + psVar4 = &plVar2->data; + } + psVar4->item[99].next = (storeitem<> *)0x0; + if (plVar2 == (listnode<> *)0x0) { + error("listIterator::operator*: Iterator ist NULL.\n"); + psVar3 = (storeitem<> *)0x0; + } + else { + psVar3 = (plVar2->data).item; + } + this->firstFreeItem = psVar3; + } + this->firstFreeItem = psVar3->next; + return (TWaitinglistEntry *)psVar3; +} + + + +// DWARF original prototype: listnode_> * +// append(list_> * this) + +listnode<> * __thiscall list<>::append(list<> *this) + +{ + listnode<> *plVar1; + uint uVar2; + listnode<> *plVar3; + + plVar1 = (listnode<> *)operator_new(0x1138); + uVar2 = 0x1138; + plVar3 = plVar1; + if (((uint)plVar1 & 4) != 0) { + plVar1->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar1->prev; + uVar2 = 0x1134; + } + for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { + plVar3->next = (listnode<> *)0x0; + plVar3 = (listnode<> *)&plVar3->prev; + } + plVar1->prev = (listnode<> *)0x0; + plVar1->next = (listnode<> *)0x0; + if (this->firstNode == (listnode<> *)0x0) { + this->firstNode = plVar1; + } + else { + this->lastNode->next = plVar1; + plVar1->prev = this->lastNode; + } + this->lastNode = plVar1; + return this->lastNode; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + Semaphore::Semaphore(&OrderBufferEmpty,200); + __cxa_atexit(__tcf_0,0,&__dso_handle); + Semaphore::Semaphore(&OrderBufferFull,0); + __cxa_atexit(__tcf_1,0,&__dso_handle); + TDynamicWriteBuffer::TDynamicWriteBuffer(&HelpBuffer,0x10000); + __cxa_atexit(__tcf_2,0,&__dso_handle); + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitReaderBuffers(void) + +{ + ReplyPointerWrite = 0; + OrderPointerWrite = 0; + OrderPointerRead = 0; + ReplyPointerRead = 0; + return; +} + + + +void InsertOrder(TReaderThreadOrderType OrderType,int SectorX,int SectorY,int SectorZ, + ulong CharacterID) + +{ + int iVar1; + ulong CharacterID_local; + int SectorZ_local; + + if (199 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_0810da40); + } + Semaphore::down(&OrderBufferEmpty); + iVar1 = OrderPointerWrite % 200; + OrderBuffer[iVar1].SectorY = SectorY; + OrderPointerWrite = OrderPointerWrite + 1; + OrderBuffer[iVar1].OrderType = OrderType; + OrderBuffer[iVar1].SectorX = SectorX; + OrderBuffer[iVar1].SectorZ = SectorZ; + OrderBuffer[iVar1].CharacterID = CharacterID; + Semaphore::up(&OrderBufferFull); + return; +} + + + +void GetOrder(TReaderThreadOrderType *OrderType,int *SectorX,int *SectorY,int *SectorZ, + ulong *CharacterID) + +{ + int iVar1; + ulong *CharacterID_local; + int *SectorZ_local; + int *SectorY_local; + + Semaphore::down(&OrderBufferFull); + iVar1 = OrderPointerRead % 200; + *OrderType = OrderBuffer[iVar1].OrderType; + *SectorX = OrderBuffer[iVar1].SectorX; + *SectorY = OrderBuffer[OrderPointerRead % 200].SectorY; + *SectorZ = OrderBuffer[OrderPointerRead % 200].SectorZ; + iVar1 = OrderPointerRead % 200; + OrderPointerRead = OrderPointerRead + 1; + *CharacterID = OrderBuffer[iVar1].CharacterID; + Semaphore::up(&OrderBufferEmpty); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InsertReply(void) + +{ + int iVar1; + TReaderThreadReplyType in_stack_00000004; + int in_stack_00000008; + int in_stack_0000000c; + int in_stack_00000010; + uchar *in_stack_00000014; + int in_stack_00000018; + + iVar1 = ReplyPointerWrite - ReplyPointerRead; + while (199 < iVar1) { + error("InsertReply (Reader): Puffer ist voll; warte...\n"); + DelayThread(5,0); + iVar1 = ReplyPointerWrite - ReplyPointerRead; + } + iVar1 = ReplyPointerWrite % 200; + ReplyPointerWrite = ReplyPointerWrite + 1; + ReplyBuffer[iVar1].ReplyType = in_stack_00000004; + ReplyBuffer[iVar1].SectorX = in_stack_00000008; + ReplyBuffer[iVar1].SectorY = in_stack_0000000c; + ReplyBuffer[iVar1].SectorZ = in_stack_00000010; + ReplyBuffer[iVar1].Data = in_stack_00000014; + ReplyBuffer[iVar1].Size = in_stack_00000018; + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +bool GetReply(void) + +{ + int iVar1; + bool bVar2; + TReaderThreadReplyType *in_stack_00000004; + int *in_stack_00000008; + int *in_stack_0000000c; + int *in_stack_00000010; + undefined4 *in_stack_00000014; + int *in_stack_00000018; + + bVar2 = ReplyPointerRead != ReplyPointerWrite; + if (bVar2) { + iVar1 = ReplyPointerRead % 200; + *in_stack_00000004 = ReplyBuffer[iVar1].ReplyType; + *in_stack_00000008 = ReplyBuffer[iVar1].SectorX; + *in_stack_0000000c = ReplyBuffer[ReplyPointerRead % 200].SectorY; + *in_stack_00000010 = ReplyBuffer[ReplyPointerRead % 200].SectorZ; + iVar1 = ReplyPointerRead % 200; + *in_stack_00000014 = ReplyBuffer[iVar1].Data; + *in_stack_00000018 = ReplyBuffer[iVar1].Size; + ReplyPointerRead = ReplyPointerRead + 1; + } + return bVar2; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void TerminateReaderOrder(void) + +{ + int iVar1; + + if (199 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_0810da40); + } + Semaphore::down(&OrderBufferEmpty); + iVar1 = OrderPointerWrite % 200; + OrderBuffer[iVar1].SectorX = 0; + OrderPointerWrite = OrderPointerWrite + 1; + OrderBuffer[iVar1].OrderType = ORDER_TERMINATE; + OrderBuffer[iVar1].SectorY = 0; + OrderBuffer[iVar1].SectorZ = 0; + OrderBuffer[iVar1].CharacterID = 0; + Semaphore::up(&OrderBufferFull); + return; +} + + + +void LoadSectorOrder(int SectorX,int SectorY,int SectorZ) + +{ + int iVar1; + + if (199 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_0810da40); + } + Semaphore::down(&OrderBufferEmpty); + iVar1 = OrderPointerWrite % 200; + OrderBuffer[iVar1].SectorX = SectorX; + OrderPointerWrite = OrderPointerWrite + 1; + OrderBuffer[iVar1].OrderType = ORDER_LOADSECTOR; + OrderBuffer[iVar1].SectorY = SectorY; + OrderBuffer[iVar1].SectorZ = SectorZ; + OrderBuffer[iVar1].CharacterID = 0; + Semaphore::up(&OrderBufferFull); + return; +} + + + +void LoadCharacterOrder(ulong CharacterID) + +{ + int iVar1; + + if (199 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_0810da40); + } + Semaphore::down(&OrderBufferEmpty); + iVar1 = OrderPointerWrite % 200; + OrderPointerWrite = OrderPointerWrite + 1; + OrderBuffer[iVar1].OrderType = ORDER_LOADCHARACTER; + OrderBuffer[iVar1].SectorX = 0; + OrderBuffer[iVar1].SectorY = 0; + OrderBuffer[iVar1].CharacterID = CharacterID; + OrderBuffer[iVar1].SectorZ = 0; + Semaphore::up(&OrderBufferFull); + return; +} + + + +void ProcessLoadSectorOrder(int SectorX,int SectorY,int SectorZ) + +{ + byte b; + bool bVar1; + char cVar2; + uchar *Help; + byte *pbVar3; + uchar *__dest; + int iVar4; + int iVar5; + int DataSize; + char *pcVar6; + undefined1 uVar7; + TDynamicWriteBuffer *__s; + char *pcVar8; + uchar *Data; + bool Refreshable; + int yy; + int xx; + TReadScriptFile Script; + undefined1 local_101c [4]; + char FileName [4096]; + + __s = (TDynamicWriteBuffer *)local_101c; + pcVar8 = ORIGMAPPATH; + sprintf((char *)__s,"%s/%04u-%04u-%02u.sec",ORIGMAPPATH,SectorX,SectorY,SectorZ); + bVar1 = FileExists((char *)__s); + if (bVar1) { + // try { // try from 080df909 to 080df90d has its CatchHandler @ 080dfbf7 + TReadScriptFile::TReadScriptFile((TReadScriptFile *)&xx); + // try { // try from 080df915 to 080dfb32 has its CatchHandler @ 080dfbc0 + TReadScriptFile::open((TReadScriptFile *)&xx,(char *)__s,(int)pcVar8); + Data._3_1_ = 0; + yy = -1; + b = 0xff; + HelpBuffer.super_TWriteBuffer.Position = 0; + while (TReadScriptFile::nextToken((TReadScriptFile *)&xx), xx != 0) { + if ((xx != 6) || + (cVar2 = TReadScriptFile::getSpecial((TReadScriptFile *)&xx), cVar2 != ',')) { + if (xx == 4) { + pbVar3 = TReadScriptFile::getBytesequence((TReadScriptFile *)&xx); + yy = (int)*pbVar3; + b = pbVar3[1]; + __s = (TDynamicWriteBuffer *)0x3a; + TReadScriptFile::readSymbol((TReadScriptFile *)&xx,':'); + Data._3_1_ = 0; + } + else if (xx == 1) { + uVar7 = yy == -1; + if ((bool)uVar7) { + pcVar8 = "coordinate expected"; + TReadScriptFile::error((TReadScriptFile *)&xx,"coordinate expected"); + __s = (TDynamicWriteBuffer *)pcVar8; + } + pcVar8 = TReadScriptFile::getIdentifier((TReadScriptFile *)&xx); + iVar4 = 8; + pcVar6 = "refresh"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + Data._3_1_ = 1; + } + pcVar8 = TReadScriptFile::getIdentifier((TReadScriptFile *)&xx); + iVar4 = 8; + pcVar6 = "content"; + do { + if (iVar4 == 0) break; + iVar4 = iVar4 + -1; + uVar7 = *pcVar8 == *pcVar6; + pcVar8 = pcVar8 + 1; + pcVar6 = pcVar6 + 1; + } while ((bool)uVar7); + if ((bool)uVar7) { + TReadScriptFile::readSymbol((TReadScriptFile *)&xx,'='); + if (Data._3_1_ != 0) { + TDynamicWriteBuffer::writeByte(&HelpBuffer,(uchar)yy); + TDynamicWriteBuffer::writeByte(&HelpBuffer,b); + } + __s = &HelpBuffer; + LoadObjects((TReadScriptFile *)&xx,(TWriteStream *)&HelpBuffer, + (bool)(Data._3_1_ ^ 1)); + } + } + } + } + TReadScriptFile::close((TReadScriptFile *)&xx,(int)__s); + iVar4 = HelpBuffer.super_TWriteBuffer.Position; + if (HelpBuffer.super_TWriteBuffer.Position != 0) { + __dest = (uchar *)operator_new__(HelpBuffer.super_TWriteBuffer.Position); + __s = (TDynamicWriteBuffer *)HelpBuffer.super_TWriteBuffer.Data; + memcpy(__dest,HelpBuffer.super_TWriteBuffer.Data,iVar4); + iVar5 = ReplyPointerWrite - ReplyPointerRead; + while (199 < iVar5) { + error("InsertReply (Reader): Puffer ist voll; warte...\n"); + __s = (TDynamicWriteBuffer *)0x0; + DelayThread(5,0); + iVar5 = ReplyPointerWrite - ReplyPointerRead; + } + iVar5 = ReplyPointerWrite % 200; + ReplyBuffer[iVar5].ReplyType = REPLY_SECTORDATA; + ReplyPointerWrite = ReplyPointerWrite + 1; + ReplyBuffer[iVar5].SectorX = SectorX; + ReplyBuffer[iVar5].SectorY = SectorY; + ReplyBuffer[iVar5].SectorZ = SectorZ; + ReplyBuffer[iVar5].Data = __dest; + ReplyBuffer[iVar5].Size = iVar4; + } + // try { // try from 080dfbb6 to 080dfbba has its CatchHandler @ 080dfbf7 + TReadScriptFile::~TReadScriptFile((TReadScriptFile *)&xx,(int)__s); + } + return; +} + + + +void ProcessLoadCharacterOrder(ulong CharacterID) + +{ + TPlayerData *Slot; + __pid_t _Var1; + pid_t pVar2; + TPlayerData *PlayerData; + int iVar3; + + while( true ) { + Slot = AssignPlayerPoolSlot(CharacterID,true); + if (Slot == (TPlayerData *)0x0) { + error(&DAT_0810db00); + return; + } + _Var1 = getpid(); + if (Slot->Locked == _Var1) break; + pVar2 = GetGameThreadPID(); + if (Slot->Locked == pVar2) { + return; + } + DecreasePlayerPoolSlotSticky(Slot); + DelayThread(1,0); + } + IncreasePlayerPoolSlotSticky(Slot); + ReleasePlayerPoolSlot(Slot); + iVar3 = ReplyPointerWrite - ReplyPointerRead; + while (199 < iVar3) { + error("InsertReply (Reader): Puffer ist voll; warte...\n"); + DelayThread(5,0); + iVar3 = ReplyPointerWrite - ReplyPointerRead; + } + iVar3 = ReplyPointerWrite % 200; + ReplyBuffer[iVar3].ReplyType = REPLY_CHARACTERDATA; + ReplyBuffer[iVar3].SectorX = 0; + ReplyBuffer[iVar3].SectorY = 0; + ReplyBuffer[iVar3].SectorZ = 0; + ReplyBuffer[iVar3].Data = (uchar *)0x0; + ReplyBuffer[iVar3].Size = CharacterID; + ReplyPointerWrite = ReplyPointerWrite + 1; + return; +} + + + +int ReaderThreadLoop(void *param_1) + +{ + int SectorX; + TReaderThreadOrderType TVar1; + int SectorY; + int SectorZ; + ulong CharacterID; + int iVar2; + +LAB_080dfd60: + do { + while( true ) { + Semaphore::down(&OrderBufferFull); + iVar2 = OrderPointerRead % 200; + SectorX = OrderBuffer[iVar2].SectorX; + TVar1 = OrderBuffer[iVar2].OrderType; + OrderPointerRead = OrderPointerRead + 1; + SectorY = OrderBuffer[iVar2].SectorY; + SectorZ = OrderBuffer[iVar2].SectorZ; + CharacterID = OrderBuffer[iVar2].CharacterID; + Semaphore::up(&OrderBufferEmpty); + if (TVar1 != ORDER_LOADSECTOR) break; + ProcessLoadSectorOrder(SectorX,SectorY,SectorZ); + } + if ((int)TVar1 < 2) { + if (TVar1 == ORDER_TERMINATE) { + return 0; + } + } + else if (TVar1 == ORDER_LOADCHARACTER) { + ProcessLoadCharacterOrder(CharacterID); + goto LAB_080dfd60; + } + error("ReaderThreadLoop: Unbekanntes Kommando %d.\n",TVar1); + } while( true ); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ProcessSectorReply(void) + +{ + code *in_stack_00000004; + void *in_stack_00000014; + + (*in_stack_00000004)(); + if (in_stack_00000014 != (void *)0x0) { + operator_delete__(in_stack_00000014); + return; + } + return; +} + + + +void ProcessCharacterReply(TSendMailsFunction *SendMails,ulong CharacterID) + +{ + TPlayerData *Slot; + TPlayerData *PlayerData; + + Slot = AttachPlayerPoolSlot(CharacterID,true); + if (Slot != (TPlayerData *)0x0) { + (*SendMails)(Slot); + DecreasePlayerPoolSlotSticky(Slot); + ReleasePlayerPoolSlot(Slot); + return; + } + DecreasePlayerPoolSlotSticky(CharacterID); + return; +} + + + +// WARNING: Variable defined which should be unmapped: SectorX + +void ProcessReaderThreadReplies(TRefreshSectorFunction *RefreshSector,TSendMailsFunction *SendMails) + +{ + TReaderThreadReplyType TVar1; + ulong CharacterID; + uchar *puVar2; + TPlayerData *Slot; + uchar *Data; + int Size; + int iVar3; + TReaderThreadReplyType ReplyType; + TPlayerData *PlayerData; + int SectorZ; + int SectorY; + int SectorX; + + while (ReplyPointerRead != ReplyPointerWrite) { + iVar3 = ReplyPointerRead % 200; + ReplyPointerRead = ReplyPointerRead + 1; + TVar1 = ReplyBuffer[iVar3].ReplyType; + CharacterID = ReplyBuffer[iVar3].Size; + puVar2 = ReplyBuffer[iVar3].Data; + if (TVar1 == REPLY_SECTORDATA) { + (*RefreshSector)(ReplyBuffer[iVar3].SectorX,ReplyBuffer[iVar3].SectorY, + ReplyBuffer[iVar3].SectorZ,puVar2,CharacterID); + if (puVar2 != (uchar *)0x0) { + operator_delete__(puVar2); + } + } + else if (TVar1 == REPLY_CHARACTERDATA) { + Slot = AttachPlayerPoolSlot(CharacterID,true); + if (Slot == (TPlayerData *)0x0) { + DecreasePlayerPoolSlotSticky(CharacterID); + } + else { + (*SendMails)(Slot); + DecreasePlayerPoolSlotSticky(Slot); + ReleasePlayerPoolSlot(Slot); + } + } + else { + error(&DAT_0810dba0,TVar1); + } + } + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void InitReader(void) + +{ + undefined4 *puVar1; + + ReplyPointerRead = 0; + OrderPointerWrite = 0; + OrderPointerRead = 0; + ReplyPointerWrite = 0; + // try { // try from 080e006c to 080e00a7 has its CatchHandler @ 080e00a8 + ReaderThread = StartThread(ReaderThreadLoop,(void *)0x0,false); + if (ReaderThread != 0) { + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "cannot start reader thread"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void ExitReader(void) + +{ + int iVar1; + + if (ReaderThread != 0) { + if (199 < OrderPointerWrite - OrderPointerRead) { + error(&DAT_0810da40); + } + Semaphore::down(&OrderBufferEmpty); + iVar1 = OrderPointerWrite % 200; + OrderBuffer[iVar1].OrderType = ORDER_TERMINATE; + OrderBuffer[iVar1].SectorX = 0; + OrderPointerWrite = OrderPointerWrite + 1; + OrderBuffer[iVar1].SectorY = 0; + OrderBuffer[iVar1].SectorZ = 0; + OrderBuffer[iVar1].CharacterID = 0; + Semaphore::up(&OrderBufferFull); + JoinThread(ReaderThread); + ReaderThread = 0; + } + return; +} + + + +void __tcf_0(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&OrderBufferEmpty,in_stack_00000008); + return; +} + + + +void __tcf_1(void *param_1) + +{ + int in_stack_00000008; + + Semaphore::~Semaphore(&OrderBufferFull,in_stack_00000008); + return; +} + + + +void __tcf_2(void *param_1) + +{ + int in_stack_00000008; + + TDynamicWriteBuffer::~TDynamicWriteBuffer(&HelpBuffer,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__Z17InitReaderBuffersv(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + NONE.ObjectID = 0; + } + return; +} + + + +void SetQueryManagerLoginData(int Type,char *Data) + +{ + ApplicationType = Type; + if (Data == (char *)0x0) { + LoginData[0] = '\0'; + } + else { + strncpy(LoginData,Data,0x1e); + } + return; +} + + + +// DWARF original prototype: void TQueryManagerConnection(TQueryManagerConnection * this, int +// QueryBufferSize) + +void __thiscall +TQueryManagerConnection::TQueryManagerConnection(TQueryManagerConnection *this,int QueryBufferSize) + +{ + uint uVar1; + uchar *puVar2; + uint *puVar3; + sockaddr *__addr; + socklen_t in_stack_ffffffe0; + uint local_1c [4]; + + local_1c[3] = 0x4000; + puVar3 = local_1c + 3; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + puVar2 = (uchar *)operator_new__(*puVar3); + this->Buffer = puVar2; + local_1c[2] = 0x4000; + puVar3 = local_1c + 2; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + TReadBuffer::TReadBuffer(&this->ReadBuffer,this->Buffer,*puVar3); + local_1c[1] = 0x4000; + puVar3 = local_1c + 1; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + __addr = (sockaddr *)*puVar3; + puVar2 = this->Buffer; + TWriteBuffer::TWriteBuffer(&this->WriteBuffer,puVar2,(int)__addr); + local_1c[0] = 0x4000; + puVar3 = local_1c; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + uVar1 = *puVar3; + this->Socket = -1; + this->QueryOk = false; + this->BufferSize = uVar1; + connect(this,(int)puVar2,__addr,in_stack_ffffffe0); + return; +} + + + +// DWARF original prototype: void TQueryManagerConnection(TQueryManagerConnection * this, int +// QueryBufferSize) + +void __thiscall +TQueryManagerConnection::TQueryManagerConnection(TQueryManagerConnection *this,int QueryBufferSize) + +{ + uint uVar1; + uchar *puVar2; + uint *puVar3; + sockaddr *__addr; + socklen_t in_stack_ffffffe0; + uint local_1c [4]; + + local_1c[3] = 0x4000; + puVar3 = local_1c + 3; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + puVar2 = (uchar *)operator_new__(*puVar3); + this->Buffer = puVar2; + local_1c[2] = 0x4000; + puVar3 = local_1c + 2; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + TReadBuffer::TReadBuffer(&this->ReadBuffer,this->Buffer,*puVar3); + local_1c[1] = 0x4000; + puVar3 = local_1c + 1; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + __addr = (sockaddr *)*puVar3; + puVar2 = this->Buffer; + TWriteBuffer::TWriteBuffer(&this->WriteBuffer,puVar2,(int)__addr); + local_1c[0] = 0x4000; + puVar3 = local_1c; + if (0x3fff < QueryBufferSize) { + puVar3 = (uint *)&QueryBufferSize; + } + uVar1 = *puVar3; + this->Socket = -1; + this->QueryOk = false; + this->BufferSize = uVar1; + connect(this,(int)puVar2,__addr,in_stack_ffffffe0); + return; +} + + + +// DWARF original prototype: void ~TQueryManagerConnection(TQueryManagerConnection * this, int +// __in_chrg) + +void __thiscall +TQueryManagerConnection::~TQueryManagerConnection(TQueryManagerConnection *this,int __in_chrg) + +{ + int iVar1; + int *piVar2; + + if (-1 < this->Socket) { + iVar1 = close(this->Socket); + if (iVar1 < 0) { + piVar2 = __errno_location(); + error(&DAT_0810dc00,*piVar2); + } + this->Socket = -1; + } + if (this->Buffer == (uchar *)0x0) { + return; + } + operator_delete__(this->Buffer); + return; +} + + + +// DWARF original prototype: void ~TQueryManagerConnection(TQueryManagerConnection * this, int +// __in_chrg) + +void __thiscall +TQueryManagerConnection::~TQueryManagerConnection(TQueryManagerConnection *this,int __in_chrg) + +{ + int iVar1; + int *piVar2; + + if (-1 < this->Socket) { + iVar1 = close(this->Socket); + if (iVar1 < 0) { + piVar2 = __errno_location(); + error(&DAT_0810dc00,*piVar2); + } + this->Socket = -1; + } + if (this->Buffer == (uchar *)0x0) { + return; + } + operator_delete__(this->Buffer); + return; +} + + + +// DWARF original prototype: void connect(TQueryManagerConnection * this) + +int __thiscall +TQueryManagerConnection::connect + (TQueryManagerConnection *this,int __fd,sockaddr *__addr,socklen_t __len) + +{ + ushort uVar1; + int Result; + int iVar2; + int *piVar3; + char *__cp; + TWriteBuffer *this_00; + int Try; + int iVar4; + int iVar5; + hostent *local_858; + hostent *HostEntAddr; + int ErrorCode; + char local_84c [4]; + char Buffer [2048]; + hostent HostEnt; + undefined1 local_2c [4]; + sockaddr_in QueryManagerAddress; + + iVar4 = 0; + if (0 < NumberOfQueryManagers) { + do { + local_2c._0_2_ = 0; + local_2c[2] = '\0'; + local_2c[3] = '\0'; + QueryManagerAddress.sin_family = 0; + QueryManagerAddress.sin_port = 0; + QueryManagerAddress.sin_addr.s_addr = 0; + QueryManagerAddress.sin_zero[0] = '\0'; + QueryManagerAddress.sin_zero[1] = '\0'; + QueryManagerAddress.sin_zero[2] = '\0'; + QueryManagerAddress.sin_zero[3] = '\0'; + QueryManagerAddress._0_4_ = inet_addr(QUERY_MANAGER[iVar4].Host); + if (QueryManagerAddress._0_4_ == 0xffffffff) { + HostEntAddr = (hostent *)0x0; + iVar2 = gethostbyname_r(QUERY_MANAGER[iVar4].Host,(hostent *)(Buffer + 0x7fc), + local_84c,0x800,&local_858,(int *)&HostEntAddr); + if ((iVar2 == 0) && (local_858 != (hostent *)0x0)) { + __cp = inet_ntoa((in_addr)*(in_addr_t *)*local_858->h_addr_list); + QueryManagerAddress._0_4_ = inet_addr(__cp); + goto LAB_080e0505; + } +LAB_080e06c8: + print(); + } + else { +LAB_080e0505: + iVar2 = socket(2,1,0); + this->Socket = iVar2; + if (iVar2 < 0) goto LAB_080e06c8; + uVar1 = (ushort)QUERY_MANAGER[iVar4].Port; + iVar5 = 0x10; + ErrorCode._2_2_ = uVar1 >> 8 | uVar1 << 8; + local_2c._2_2_ = ErrorCode._2_2_; + local_2c._0_2_ = 2; + iVar2 = ::connect(this->Socket,(sockaddr *)local_2c,0x10); + if (iVar2 < 0) { + print(); + } + else { + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e0595 to 080e05a9 has its CatchHandler @ 080e0754 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\0'); + // try { // try from 080e05b8 to 080e05bc has its CatchHandler @ 080e0791 + TWriteBuffer::writeByte(this_00,(uchar)ApplicationType); + // try { // try from 080e05d1 to 080e05d5 has its CatchHandler @ 080e07c1 + TWriteStream::writeString + (&this_00->super_TWriteStream,QUERY_MANAGER[iVar4].Password); + if (ApplicationType == 1) { + // try { // try from 080e069d to 080e06a1 has its CatchHandler @ 080e07f1 + TWriteStream::writeString(&this_00->super_TWriteStream,LoginData); + } + iVar5 = executeQuery(this,0x1e,false); + if (iVar5 == 0) { + return 0; + } + print(); + } + if (-1 < this->Socket) { + iVar2 = close(this->Socket); + if (iVar2 < 0) { + piVar3 = __errno_location(); + error(&DAT_0810dc00,*piVar3,iVar5); + } + this->Socket = -1; + } + } + iVar4 = iVar4 + 1; + } while (iVar4 < NumberOfQueryManagers); + } + print(); + this->Socket = -1; + return (int)this; +} + + + +// DWARF original prototype: void disconnect(TQueryManagerConnection * this) + +void __thiscall TQueryManagerConnection::disconnect(TQueryManagerConnection *this) + +{ + int iVar1; + int *piVar2; + + if (-1 < this->Socket) { + iVar1 = close(this->Socket); + if (iVar1 < 0) { + piVar2 = __errno_location(); + error(&DAT_0810dc00,*piVar2); + } + this->Socket = -1; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: Chances +// DWARF original prototype: int write(TQueryManagerConnection * this, uchar * Buffer, int Size) + +ssize_t __thiscall +TQueryManagerConnection::write(TQueryManagerConnection *this,int __fd,void *__buf,size_t __n) + +{ + ssize_t sVar1; + int *piVar2; + int nwritten; + int nleft; + void *__n_00; + int local_14; + int Chances; + + local_14 = 0x32; + __n_00 = __buf; + if (0 < (int)__buf) { + do { + sVar1 = ::write(this->Socket,(void *)__fd,(size_t)__n_00); + if (((sVar1 == -1) && (piVar2 = __errno_location(), *piVar2 == 0xb)) && (0 < local_14)) + { + DelayThread(0,100000); + local_14 = local_14 + -1; + } + else { + if (sVar1 < 1) { + return sVar1; + } + __n_00 = (void *)((int)__n_00 - sVar1); + __fd = __fd + sVar1; + } + } while (0 < (int)__n_00); + } + return (int)__buf - (int)__n_00; +} + + + +// DWARF original prototype: int read(TQueryManagerConnection * this, uchar * Buffer, int Size, int +// Timeout) + +ssize_t __thiscall +TQueryManagerConnection::read(TQueryManagerConnection *this,int __fd,void *__buf,size_t __nbytes) + +{ + int iVar1; + ssize_t sVar2; + int *piVar3; + int nread; + int nleft; + void *__nbytes_00; + int local_20; + int Chances; + pollfd ufds; + + local_20 = 0x32; + __nbytes_00 = __buf; + if (0 < (int)__buf) { + do { + Chances = this->Socket; + ufds.fd._0_2_ = 1; + ufds.fd._2_2_ = 0; + iVar1 = poll((pollfd *)&Chances,1,__nbytes * 1000); + if (iVar1 < 1) { + return -2; + } + sVar2 = ::read(this->Socket,(void *)__fd,(size_t)__nbytes_00); + if (sVar2 == 0) break; + if (sVar2 < 0) { + piVar3 = __errno_location(); + if (*piVar3 != 4) { + if (*piVar3 != 0xb) { + return sVar2; + } + if (__nbytes_00 == __buf) { + return sVar2; + } + if (local_20 == 0) { + return sVar2; + } + local_20 = local_20 + -1; + DelayThread(0,100000); + } + } + else { + __nbytes_00 = (void *)((int)__nbytes_00 - sVar2); + __fd = __fd + sVar2; + } + } while (0 < (int)__nbytes_00); + } + return (int)__buf - (int)__nbytes_00; +} + + + +// DWARF original prototype: void prepareQuery(TQueryManagerConnection * this, int QueryType) + +void __thiscall TQueryManagerConnection::prepareQuery(TQueryManagerConnection *this,int QueryType) + +{ + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e0a08 to 080e0a1c has its CatchHandler @ 080e0a27 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,(uchar)QueryType); + return; +} + + + +// DWARF original prototype: void sendFlag(TQueryManagerConnection * this, bool f) + +void __thiscall TQueryManagerConnection::sendFlag(TQueryManagerConnection *this,bool f) + +{ + TWriteBuffer::writeByte(&this->WriteBuffer,f); + return; +} + + + +// DWARF original prototype: void sendByte(TQueryManagerConnection * this, uchar b) + +void __thiscall TQueryManagerConnection::sendByte(TQueryManagerConnection *this,uchar b) + +{ + // try { // try from 080e0a9d to 080e0aa1 has its CatchHandler @ 080e0ab0 + TWriteBuffer::writeByte(&this->WriteBuffer,b); + return; +} + + + +// DWARF original prototype: void sendWord(TQueryManagerConnection * this, ushort w) + +void __thiscall TQueryManagerConnection::sendWord(TQueryManagerConnection *this,ushort w) + +{ + // try { // try from 080e0b0d to 080e0b11 has its CatchHandler @ 080e0b20 + TWriteBuffer::writeWord(&this->WriteBuffer,w); + return; +} + + + +// DWARF original prototype: void sendQuad(TQueryManagerConnection * this, ulong q) + +void __thiscall TQueryManagerConnection::sendQuad(TQueryManagerConnection *this,ulong q) + +{ + // try { // try from 080e0b7c to 080e0b80 has its CatchHandler @ 080e0b90 + TWriteBuffer::writeQuad(&this->WriteBuffer,q); + return; +} + + + +// DWARF original prototype: void sendString(TQueryManagerConnection * this, char * s) + +void __thiscall TQueryManagerConnection::sendString(TQueryManagerConnection *this,char *s) + +{ + // try { // try from 080e0bec to 080e0bf0 has its CatchHandler @ 080e0c00 + TWriteStream::writeString(&(this->WriteBuffer).super_TWriteStream,s); + return; +} + + + +// DWARF original prototype: void sendBytes(TQueryManagerConnection * this, uchar * Buffer, int +// Count) + +void __thiscall TQueryManagerConnection::sendBytes(TQueryManagerConnection *this) + +{ + uchar *in_stack_00000008; + int in_stack_0000000c; + + // try { // try from 080e0c63 to 080e0c67 has its CatchHandler @ 080e0c72 + TWriteBuffer::writeBytes(&this->WriteBuffer,in_stack_00000008,in_stack_0000000c); + return; +} + + + +// DWARF original prototype: bool getFlag(TQueryManagerConnection * this) + +bool __thiscall TQueryManagerConnection::getFlag(TQueryManagerConnection *this) + +{ + uchar uVar1; + + // try { // try from 080e0cc2 to 080e0cc6 has its CatchHandler @ 080e0cd8 + uVar1 = TReadBuffer::readByte(&this->ReadBuffer); + return uVar1 != '\0'; +} + + + +// DWARF original prototype: uchar getByte(TQueryManagerConnection * this) + +uchar __thiscall TQueryManagerConnection::getByte(TQueryManagerConnection *this) + +{ + uchar uVar1; + + // try { // try from 080e0d22 to 080e0d26 has its CatchHandler @ 080e0d31 + uVar1 = TReadBuffer::readByte(&this->ReadBuffer); + return uVar1; +} + + + +// DWARF original prototype: ushort getWord(TQueryManagerConnection * this) + +ushort __thiscall TQueryManagerConnection::getWord(TQueryManagerConnection *this) + +{ + ushort uVar1; + + // try { // try from 080e0d82 to 080e0d86 has its CatchHandler @ 080e0d91 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + return uVar1; +} + + + +// DWARF original prototype: ulong getQuad(TQueryManagerConnection * this) + +ulong __thiscall TQueryManagerConnection::getQuad(TQueryManagerConnection *this) + +{ + ulong uVar1; + + // try { // try from 080e0de2 to 080e0de6 has its CatchHandler @ 080e0df0 + uVar1 = TReadBuffer::readQuad(&this->ReadBuffer); + return uVar1; +} + + + +// DWARF original prototype: void getString(TQueryManagerConnection * this, char * Buffer, int +// MaxLength) + +void __thiscall +TQueryManagerConnection::getString(TQueryManagerConnection *this,char *Buffer,int MaxLength) + +{ + // try { // try from 080e0e53 to 080e0e57 has its CatchHandler @ 080e0e62 + TReadStream::readString(&(this->ReadBuffer).super_TReadStream,Buffer,MaxLength); + return; +} + + + +// DWARF original prototype: void getBytes(TQueryManagerConnection * this, uchar * Buffer, int +// Count) + +void __thiscall TQueryManagerConnection::getBytes(TQueryManagerConnection *this) + +{ + uchar *in_stack_00000008; + int in_stack_0000000c; + + // try { // try from 080e0ec0 to 080e0ec4 has its CatchHandler @ 080e0ed0 + TReadBuffer::readBytes(&this->ReadBuffer,in_stack_00000008,in_stack_0000000c); + return; +} + + + +// WARNING: Variable defined which should be unmapped: Help +// DWARF original prototype: int executeQuery(TQueryManagerConnection * this, int Timeout, bool +// AutoReconnect) + +int __thiscall +TQueryManagerConnection::executeQuery(TQueryManagerConnection *this,int Timeout,bool AutoReconnect) + +{ + byte bVar1; + void *pvVar2; + sockaddr *psVar3; + ssize_t sVar4; + int iVar5; + void *pvVar6; + int Result; + TWriteBuffer *this_00; + int Size; + int DataSize; + sockaddr *__buf; + undefined4 uStackY_40; + char *Text; + uchar *puVar7; + socklen_t in_stack_ffffffd0; + undefined1 auStack_2c [11]; + char local_21; + char *pcStack_20; + bool SecondChance; + char local_19; + byte local_18; + undefined1 local_17 [2]; + bool AutoReconnect_local; + uchar Help2 [4]; + uchar Help [2]; + + this_00 = &this->WriteBuffer; + local_19 = AutoReconnect; + __buf = (sockaddr *)(this->WriteBuffer).Position; + (this->WriteBuffer).Position = 0; + if ((int)__buf < 0xffff) { + // try { // try from 080e1376 to 080e137a has its CatchHandler @ 080e13ed + uStackY_40 = 0x80e137b; + TWriteBuffer::writeWord(this_00,(short)__buf - 2); + } + else { + if (this->BufferSize < (int)(__buf->sa_data + 2)) { + Text = "TQueryManagerConnection::executeQuery: Puffer zu klein.\n"; + goto LAB_080e0f4d; + } + pcStack_20 = __buf[-1].sa_data + 0xc; + uStackY_40 = 0x80e0f86; + memmove(this->Buffer + 6,this->Buffer + 2,(size_t)pcStack_20); + // try { // try from 080e0f91 to 080e0f95 has its CatchHandler @ 080e1380 + uStackY_40 = 0x80e0f96; + TWriteBuffer::writeWord(this_00,0xffff); + // try { // try from 080e0fa0 to 080e0fa4 has its CatchHandler @ 080e13bd + uStackY_40 = 0x80e0fa5; + TWriteBuffer::writeQuad(this_00,(ulong)pcStack_20); + __buf = (sockaddr *)(__buf->sa_data + 2); + } + local_21 = '\x01'; + if (this->QueryOk != false) { + do { + if (this->Socket < 0) { + if (local_19 == '\0') { + return 3; + } + if ((int)__buf < 0x4000) { + iVar5 = -((uint)(__buf->sa_data + 0xd) & 0xfffffff0); + puVar7 = this->Buffer; + *(sockaddr **)(Help2 + iVar5 + -0x20) = __buf; + *(uchar **)(&stack0xffffffc8 + iVar5) = puVar7; + *(undefined1 **)(&stack0xffffffc4 + iVar5) = auStack_2c + iVar5; + *(undefined4 *)((int)&uStackY_40 + iVar5) = 0x80e1335; + memcpy(*(void **)(&stack0xffffffc4 + iVar5),*(void **)(&stack0xffffffc8 + iVar5) + ,*(size_t *)(Help2 + iVar5 + -0x20)); + *(TQueryManagerConnection **)(&stack0xffffffc4 + iVar5) = this; + *(undefined4 *)((int)&uStackY_40 + iVar5) = 0x80e1340; + connect(*(TQueryManagerConnection **)(&stack0xffffffc4 + iVar5), + *(int *)(&stack0xffffffc8 + iVar5),*(sockaddr **)(Help2 + iVar5 + -0x20) + ,*(socklen_t *)(&stack0xffffffd0 + iVar5)); + puVar7 = this->Buffer; + *(undefined1 **)(&stack0xffffffc8 + iVar5) = auStack_2c + iVar5; + *(sockaddr **)(Help2 + iVar5 + -0x20) = __buf; + *(uchar **)(&stack0xffffffc4 + iVar5) = puVar7; + *(undefined4 *)((int)&uStackY_40 + iVar5) = 0x80e1356; + memcpy(*(void **)(&stack0xffffffc4 + iVar5),*(void **)(&stack0xffffffc8 + iVar5) + ,*(size_t *)(Help2 + iVar5 + -0x20)); + } + else { + uStackY_40 = 0x80e0ff6; + pvVar2 = operator_new__((uint)__buf); + puVar7 = this->Buffer; + uStackY_40 = 0x80e100e; + psVar3 = __buf; + memcpy(pvVar2,puVar7,(size_t)__buf); + uStackY_40 = 0x80e1019; + connect(this,(int)puVar7,psVar3,in_stack_ffffffd0); + uStackY_40 = 0x80e102f; + memcpy(this->Buffer,pvVar2,(size_t)__buf); + if (pvVar2 != (void *)0x0) { + uStackY_40 = 0x80e103b; + operator_delete__(pvVar2); + } + } + if (this->Socket < 0) { + return 3; + } + } + uStackY_40 = 0x80e1069; + psVar3 = (sockaddr *)write(this,(int)this->Buffer,__buf,in_stack_ffffffd0); + if (psVar3 == __buf) { + uStackY_40 = 0x80e1092; + in_stack_ffffffd0 = Timeout; + sVar4 = read(this,(int)(Help2 + 2),(void *)0x2,Timeout); + if (sVar4 == 2) { + pvVar2 = (void *)((uint)Help2[3] * 0x100 + (uint)Help2[2]); + if (pvVar2 == (void *)0xffff) { + uStackY_40 = 0x80e1241; + sVar4 = read(this,(int)&local_18,(void *)0x4,Timeout); + if (sVar4 != 4) { + if (this->Socket < 0) { + return 3; + } + uStackY_40 = 0x80e1263; + iVar5 = close(this->Socket); + if (iVar5 < 0) { + uStackY_40 = 0x80e127b; + __errno_location(); + uStackY_40 = 0x80e128d; + error(&DAT_0810dc00); + } + this->Socket = -1; + return 3; + } + pvVar2 = (void *)((uint)local_18 + (uint)_local_17 * 0x100); + } + if ((pvVar2 == (void *)0x0) || (this->BufferSize < (int)pvVar2)) { + if (-1 < this->Socket) { + uStackY_40 = 0x80e114a; + iVar5 = close(this->Socket); + if (iVar5 < 0) { + uStackY_40 = 0x80e115f; + __errno_location(); + uStackY_40 = 0x80e1171; + error(&DAT_0810dc00); + } + this->Socket = -1; + } + uStackY_40 = 0x80e113d; + error(&DAT_0810e120); + return 3; + } + uStackY_40 = 0x80e1190; + pvVar6 = (void *)read(this,(int)this->Buffer,pvVar2,Timeout); + if (pvVar6 == pvVar2) { + (this->ReadBuffer).Size = (int)pvVar6; + (this->ReadBuffer).Position = 0; + // try { // try from 080e11f7 to 080e11fb has its CatchHandler @ 080e1415 + uStackY_40 = 0x80e11fc; + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + if (bVar1 == 3) { + uStackY_40 = 0x80e121a; + error("TQueryManagerConnection::executeQuery: Anfrage fehlgeschlagen.\n" + ); + return 3; + } + return (uint)bVar1; + } + if (-1 < this->Socket) { + uStackY_40 = 0x80e11bb; + iVar5 = close(this->Socket); + if (iVar5 < 0) { + uStackY_40 = 0x80e11d0; + __errno_location(); + uStackY_40 = 0x80e11e2; + error(&DAT_0810dc00); + } + this->Socket = -1; + } + Text = + "TQueryManagerConnection::executeQuery: Fehler beim Auslesen der Daten.\n"; + goto LAB_080e0f4d; + } + if (-1 < this->Socket) { + uStackY_40 = 0x80e10ce; + iVar5 = close(this->Socket); + if (iVar5 < 0) { + uStackY_40 = 0x80e10e3; + __errno_location(); + uStackY_40 = 0x80e10f5; + error(&DAT_0810dc00); + } + this->Socket = -1; + } + if (sVar4 == -2) { + return 3; + } + if (local_21 == '\0') { + return 3; + } + } + else { + if (-1 < this->Socket) { + uStackY_40 = 0x80e12e8; + iVar5 = close(this->Socket); + if (iVar5 < 0) { + uStackY_40 = 0x80e12fd; + __errno_location(); + uStackY_40 = 0x80e130f; + error(&DAT_0810dc00); + } + this->Socket = -1; + } + if (local_21 == '\0') { + Text = + "TQueryManagerConnection::executeQuery: Fehler beim Abschicken der Anfrage.\n"; + goto LAB_080e0f4d; + } + } + local_21 = '\0'; + } while( true ); + } + Text = "TQueryManagerConnection::executeQuery: Fehler beim Zusammenbauen der Anfrage.\n"; +LAB_080e0f4d: + uStackY_40 = 0x80e0f52; + error(Text); + return 3; +} + + + +// DWARF original prototype: int checkAccountPassword(TQueryManagerConnection * this, ulong +// AccountID, char * Password, char * IPAddress) + +int __thiscall TQueryManagerConnection::checkAccountPassword(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + int FailureCode; + int iVar4; + uint uVar5; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e1465 to 080e1479 has its CatchHandler @ 080e1510 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\n'); + // try { // try from 080e1484 to 080e1488 has its CatchHandler @ 080e1550 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e1493 to 080e1497 has its CatchHandler @ 080e1582 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e14a2 to 080e14a6 has its CatchHandler @ 080e15b2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + iVar3 = executeQuery(this,0x1e,true); + iVar4 = 0; + if (iVar3 != 0) { + if (iVar3 == 1) { + // try { // try from 080e14dd to 080e14e1 has its CatchHandler @ 080e15e2 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar5 = (uint)bVar2; + bVar1 = false; + if ((uVar5 != 0) && (uVar5 < 5)) { + bVar1 = true; + } + if (bVar1) { + return uVar5; + } + error(&DAT_0810e2e0,uVar5); + } + iVar4 = -1; + } + return iVar4; +} + + + +// WARNING: Variable defined which should be unmapped: PrivateWorld_local +// DWARF original prototype: int loginAdmin(TQueryManagerConnection * this, ulong AccountID, bool +// PrivateWorld, int * NumberOfCharacters, char[30] * Characters, char[30] * Worlds, uchar[4] * +// IPAddresses, ushort * Ports, ushort * PremiumDaysLeft) + +int __thiscall +TQueryManagerConnection::loginAdmin + (TQueryManagerConnection *this,ulong AccountID,bool PrivateWorld,int *NumberOfCharacters, + char (*Characters) [30],char (*Worlds) [30],uchar (*IPAddresses) [4],ushort *Ports, + ushort *PremiumDaysLeft) + +{ + TWriteBuffer *this_00; + TReadBuffer *this_01; + byte bVar1; + ushort uVar2; + int iVar3; + bool PrivateWorld_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e163c to 080e1650 has its CatchHandler @ 080e1782 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\f'); + // try { // try from 080e165b to 080e165f has its CatchHandler @ 080e17c0 + TWriteBuffer::writeQuad(this_00,AccountID); + TWriteBuffer::writeByte(this_00,PrivateWorld); + iVar3 = executeQuery(this,0x1e,true); + if (iVar3 == 0) { + this_01 = &this->ReadBuffer; + // try { // try from 080e16d6 to 080e16da has its CatchHandler @ 080e17f2 + bVar1 = TReadBuffer::readByte(this_01); + iVar3 = 0; + *NumberOfCharacters = (uint)bVar1; + if (bVar1 != 0) { + do { + // try { // try from 080e1720 to 080e1724 has its CatchHandler @ 080e181d + TReadStream::readString(&this_01->super_TReadStream,Characters[iVar3],0x1e); + // try { // try from 080e1744 to 080e1748 has its CatchHandler @ 080e184f + TReadStream::readString(&this_01->super_TReadStream,Worlds[iVar3],0x1e); + // try { // try from 080e175e to 080e1762 has its CatchHandler @ 080e1885 + TReadBuffer::readBytes(this_01,IPAddresses[iVar3],4); + // try { // try from 080e1766 to 080e176a has its CatchHandler @ 080e18b5 + uVar2 = TReadBuffer::readWord(this_01); + Ports[iVar3] = uVar2; + iVar3 = iVar3 + 1; + } while (iVar3 < *NumberOfCharacters); + } + // try { // try from 080e16ef to 080e16f3 has its CatchHandler @ 080e18e7 + uVar2 = TReadBuffer::readWord(this_01); + *PremiumDaysLeft = uVar2; + iVar3 = 0; + } + else { + if (iVar3 == 1) { + // try { // try from 080e16a7 to 080e16ab has its CatchHandler @ 080e1919 + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + if (bVar1 == 1) { + return 1; + } + error(&DAT_0810e340,(uint)bVar1); + } + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int loadWorldConfig(TQueryManagerConnection * this, int * WorldType, +// int * RebootTime, int * IPAddress, int * Port, int * MaxPlayers, int * PremiumPlayerBuffer, int * +// MaxNewbies, int * PremiumNewbieBuffer) + +int __thiscall TQueryManagerConnection::loadWorldConfig(TQueryManagerConnection *this) + +{ + TReadBuffer *this_00; + byte bVar1; + ushort uVar2; + int iVar3; + uint *in_stack_00000008; + int *in_stack_0000000c; + int in_stack_00000010; + uint *in_stack_00000014; + uint *in_stack_00000018; + uint *in_stack_0000001c; + uint *in_stack_00000020; + uint *in_stack_00000024; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e1975 to 080e1989 has its CatchHandler @ 080e1a56 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'5'); + iVar3 = executeQuery(this,0x1e,true); + if (iVar3 == 0) { + this_00 = &this->ReadBuffer; + // try { // try from 080e19b9 to 080e19bd has its CatchHandler @ 080e1a90 + bVar1 = TReadBuffer::readByte(this_00); + *in_stack_00000008 = (uint)bVar1; + // try { // try from 080e19cc to 080e19d0 has its CatchHandler @ 080e1abb + bVar1 = TReadBuffer::readByte(this_00); + iVar3 = 0; + *in_stack_0000000c = (uint)bVar1 * 0x3c; + do { + // try { // try from 080e19e8 to 080e19ec has its CatchHandler @ 080e1ae6 + bVar1 = TReadBuffer::readByte(this_00); + *(uint *)(in_stack_00000010 + iVar3 * 4) = (uint)bVar1; + iVar3 = iVar3 + 1; + } while (iVar3 < 4); + // try { // try from 080e1a02 to 080e1a06 has its CatchHandler @ 080e1b14 + uVar2 = TReadBuffer::readWord(this_00); + *in_stack_00000014 = (uint)uVar2; + // try { // try from 080e1a12 to 080e1a16 has its CatchHandler @ 080e1b46 + uVar2 = TReadBuffer::readWord(this_00); + *in_stack_00000018 = (uint)uVar2; + // try { // try from 080e1a22 to 080e1a26 has its CatchHandler @ 080e1b78 + uVar2 = TReadBuffer::readWord(this_00); + *in_stack_0000001c = (uint)uVar2; + // try { // try from 080e1a32 to 080e1a36 has its CatchHandler @ 080e1baa + uVar2 = TReadBuffer::readWord(this_00); + *in_stack_00000020 = (uint)uVar2; + // try { // try from 080e1a42 to 080e1a46 has its CatchHandler @ 080e1bdc + uVar2 = TReadBuffer::readWord(this_00); + *in_stack_00000024 = (uint)uVar2; + iVar3 = 0; + } + else { + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int loginGame(TQueryManagerConnection * this, ulong AccountID, char * +// PlayerName, char * Password, char * IPAddress, bool PrivateWorld, bool PremiumAccountRequired, +// bool GamemasterRequired, ulong * CharacterID, int * Sex, char * Guild, char * Rank, char * Title, +// int * NumberOfBuddies, ulong * BuddyIDs, char[30] * BuddyNames, uchar * Rights, bool * +// PremiumAccountActivated) + +int __thiscall +TQueryManagerConnection::loginGame + (TQueryManagerConnection *this,ulong AccountID,char *PlayerName,char *Password, + char *IPAddress,bool PrivateWorld,bool PremiumAccountRequired,bool GamemasterRequired, + ulong *CharacterID,int *Sex,char *Guild,char *Rank,char *Title,int *NumberOfBuddies, + ulong *BuddyIDs,char (*BuddyNames) [30],uchar *Rights,bool *PremiumAccountActivated) + +{ + TWriteBuffer *this_00; + byte bVar1; + uchar uVar2; + int iVar3; + ulong uVar4; + int iVar5; + int iVar6; + int FailureCode; + uint uVar7; + int *piVar8; + int i_1; + byte *pbVar9; + TReadBuffer *this_01; + byte *pbVar10; + undefined1 uVar11; + bool bVar12; + undefined1 uVar13; + bool bVar14; + byte local_60; + int Right; + uint local_50; + int i_2; + int NumberOfRights; + bool GamemasterRequired_local; + bool PremiumAccountRequired_local; + int iStack_40; + bool PrivateWorld_local; + byte local_3c [4]; + char RightName [30]; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e1c4a to 080e1c5e has its CatchHandler @ 080e2c00 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x14'); + // try { // try from 080e1c69 to 080e1c6d has its CatchHandler @ 080e2c40 + TWriteBuffer::writeQuad(this_00,AccountID); + // try { // try from 080e1c78 to 080e1c7c has its CatchHandler @ 080e2c72 + TWriteStream::writeString(&this_00->super_TWriteStream,PlayerName); + // try { // try from 080e1c87 to 080e1c8b has its CatchHandler @ 080e2ca2 + TWriteStream::writeString(&this_00->super_TWriteStream,Password); + // try { // try from 080e1c96 to 080e1c9a has its CatchHandler @ 080e2cd2 + TWriteStream::writeString(&this_00->super_TWriteStream,IPAddress); + TWriteBuffer::writeByte(this_00,PrivateWorld); + TWriteBuffer::writeByte(this_00,PremiumAccountRequired); + TWriteBuffer::writeByte(this_00,GamemasterRequired); + iVar3 = executeQuery(this,0x78,true); + if (iVar3 == 0) { + this_01 = &this->ReadBuffer; + // try { // try from 080e1d4c to 080e1d50 has its CatchHandler @ 080e2d06 + uVar4 = TReadBuffer::readQuad(this_01); + *CharacterID = uVar4; + // try { // try from 080e1d6d to 080e1d71 has its CatchHandler @ 080e2d38 + TReadStream::readString(&this_01->super_TReadStream,PlayerName,0x1e); + // try { // try from 080e1d78 to 080e1d7c has its CatchHandler @ 080e2d6e + bVar1 = TReadBuffer::readByte(this_01); + *Sex = (uint)bVar1; + // try { // try from 080e1d9d to 080e1da1 has its CatchHandler @ 080e2da0 + TReadStream::readString(&this_01->super_TReadStream,Guild,0x1e); + // try { // try from 080e1db7 to 080e1dbb has its CatchHandler @ 080e2dd6 + TReadStream::readString(&this_01->super_TReadStream,Rank,0x1e); + // try { // try from 080e1dd1 to 080e1dd5 has its CatchHandler @ 080e2e0c + TReadStream::readString(&this_01->super_TReadStream,Title,0x1e); + // try { // try from 080e1ddc to 080e1de0 has its CatchHandler @ 080e2e42 + bVar1 = TReadBuffer::readByte(this_01); + *NumberOfBuddies = (uint)bVar1; + if (100 < bVar1) { + error(&DAT_0810e400,*NumberOfBuddies,PlayerName); + } + iVar3 = 0; + while( true ) { + iStack_40 = 100; + piVar8 = &stack0xffffffc0; + if (*NumberOfBuddies < 0x65) { + piVar8 = NumberOfBuddies; + } + if (*piVar8 <= iVar3) break; + // try { // try from 080e1e16 to 080e1e1a has its CatchHandler @ 080e2e74 + uVar4 = TReadBuffer::readQuad(this_01); + BuddyIDs[iVar3] = uVar4; + // try { // try from 080e1e42 to 080e1e46 has its CatchHandler @ 080e2ea6 + TReadStream::readString(&this_01->super_TReadStream,BuddyNames[iVar3],0x1e); + iVar3 = iVar3 + 1; + } + iVar3 = 100; + if (100 < *NumberOfBuddies) { + do { + // try { // try from 080e2bad to 080e2bb1 has its CatchHandler @ 080e2ed9 + TReadBuffer::readQuad(this_01); + // try { // try from 080e2bc7 to 080e2bcb has its CatchHandler @ 080e2f09 + TReadStream::readString(&this_01->super_TReadStream,(char *)local_3c,0x1e); + iVar3 = iVar3 + 1; + } while (iVar3 < *NumberOfBuddies); + } + // try { // try from 080e1e5d to 080e1e61 has its CatchHandler @ 080e2f3c + bVar1 = TReadBuffer::readByte(this_01); + uVar7 = (uint)bVar1; + local_50 = 0; + uVar11 = uVar7 != 0; + uVar13 = uVar7 == 0; + if (uVar7 != 0) { + do { + // try { // try from 080e1e97 to 080e1e9b has its CatchHandler @ 080e2f6e + TReadStream::readString(&this_01->super_TReadStream,(char *)local_3c,0x1e); + iVar3 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"PREMIUM_ACCOUNT"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar3 = 0; + if (!(bool)uVar13) { + iVar3 = -1; + } + iVar5 = 9; + pbVar9 = local_3c; + pbVar10 = (byte *)"NOTATION"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 9; + iVar5 = 1; + if (!(bool)uVar13) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAMELOCK"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0x11; + iVar3 = 2; + if (!(bool)uVar13) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_REPORT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0xb; + iVar5 = 3; + if (!(bool)uVar13) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)0x810fcf3; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0xe; + iVar3 = 4; + if (!(bool)uVar13) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"FINAL_WARNING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0xe; + iVar5 = 5; + if (!(bool)uVar13) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"IP_BANISHMENT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 5; + iVar3 = 6; + if (!(bool)uVar13) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = &DAT_0810fb59; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0xe; + iVar5 = 7; + if (!(bool)uVar13) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"HOME_TELEPORT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + iVar6 = 0x15; + iVar3 = 8; + if (!(bool)uVar13) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CLEAR_CHARACTER_INFO"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + uVar11 = *pbVar9 < *pbVar10; + uVar13 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while ((bool)uVar13); + bVar12 = (!(bool)uVar11 && !(bool)uVar13) < (byte)uVar11; + bVar14 = (!(bool)uVar11 && !(bool)uVar13) == (bool)uVar11; + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xd; + pbVar9 = local_3c; + pbVar10 = (byte *)"CLEAR_GUILDS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xe; + pbVar9 = local_3c; + pbVar10 = (byte *)"DELETE_GUILDS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xd; + pbVar9 = local_3c; + pbVar10 = (byte *)"BOARD_REPORT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x11; + pbVar9 = local_3c; + pbVar10 = (byte *)"BOARD_MODERATION"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x15; + pbVar9 = local_3c; + pbVar10 = (byte *)"BOARD_ANONYMOUS_EDIT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x13; + pbVar9 = local_3c; + pbVar10 = (byte *)"BOARD_PRECONFIRMED"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xd; + pbVar9 = local_3c; + pbVar10 = (byte *)"KEEP_ACCOUNT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x15; + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_BROADCAST"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 9; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x14; + pbVar9 = local_3c; + pbVar10 = (byte *)"ANONYMOUS_BROADCAST"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 10; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 8; + pbVar9 = local_3c; + pbVar10 = (byte *)"INVITED"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xe; + pbVar9 = local_3c; + pbVar10 = (byte *)"NO_BANISHMENT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0xb; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x12; + pbVar9 = local_3c; + pbVar10 = (byte *)"ALLOW_MULTICLIENT"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0xf; + pbVar9 = local_3c; + pbVar10 = (byte *)"CIPWATCH_ADMIN"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0xe; + pbVar9 = local_3c; + pbVar10 = (byte *)"CIPWATCH_USER"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0x16; + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATECHAR_GAMEMASTER"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0xf; + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATECHAR_GOD"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATECHAR_TEST"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0xd; + pbVar9 = local_3c; + pbVar10 = (byte *)"VIEW_ACCOUNT"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0x17; + pbVar9 = local_3c; + pbVar10 = (byte *)"VIEW_GAMEMASTER_RECORD"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0x15; + pbVar9 = local_3c; + pbVar10 = (byte *)"VIEW_CRIMINAL_RECORD"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0xf; + pbVar9 = local_3c; + pbVar10 = (byte *)"VIEW_LOG_FILES"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar5 = -2; + } + iVar3 = 0x12; + pbVar9 = local_3c; + pbVar10 = (byte *)"LOG_COMMUNICATION"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0xd; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0x12; + pbVar9 = local_3c; + pbVar10 = (byte *)"MODIFY_BANISHMENT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x18; + pbVar9 = local_3c; + pbVar10 = (byte *)"READ_GAMEMASTER_CHANNEL"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0xe; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x13; + pbVar9 = local_3c; + pbVar10 = (byte *)"READ_TUTOR_CHANNEL"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0xf; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0x17; + pbVar9 = local_3c; + pbVar10 = (byte *)"HIGHLIGHT_HELP_CHANNEL"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0x10; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"SEND_BUGREPORTS"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0x11; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0xc; + pbVar9 = local_3c; + pbVar10 = (byte *)"APPOINT_CIP"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xc; + pbVar9 = local_3c; + pbVar10 = (byte *)"APPOINT_SGM"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0xc; + pbVar9 = local_3c; + pbVar10 = (byte *)"APPOINT_JGM"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"APPOINT_SENATOR"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x13; + pbVar9 = local_3c; + pbVar10 = (byte *)"SET_ACCOUNT_RIGHTS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x15; + pbVar9 = local_3c; + pbVar10 = (byte *)"SET_CHARACTER_RIGHTS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x18; + pbVar9 = local_3c; + pbVar10 = (byte *)"SET_ACCOUNTGROUP_RIGHTS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + if (bVar14) { + iVar3 = -2; + } + iVar5 = 0x1a; + pbVar9 = local_3c; + pbVar10 = (byte *)"SET_CHARACTERGROUP_RIGHTS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = -2; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_INSULTING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xe; + iVar3 = 0x12; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_SENTENCE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x19; + iVar5 = 0x13; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_NONSENSICAL_LETTERS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x15; + iVar3 = 0x14; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_BADLY_FORMATTED"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = 0x15; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_NO_PERSON"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar3 = 0x16; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_CELEBRITY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xd; + iVar5 = 0x17; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_COUNTRY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x13; + iVar3 = 0x18; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_FAKE_IDENTITY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x13; + iVar5 = 0x19; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NAME_FAKE_POSITION"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x14; + iVar3 = 0x1a; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_INSULTING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0x1b; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x13; + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_SPAMMING"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x1a; + iVar3 = 0x1c; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_ADVERT_OFFTOPIC"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x17; + iVar5 = 0x1d; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_ADVERT_MONEY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x16; + iVar3 = 0x1e; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_NON_ENGLISH"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x1b; + iVar5 = 0x1f; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_CHANNEL_OFFTOPIC"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x1d; + iVar3 = 0x20; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"STATEMENT_VIOLATION_INCITING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x13; + iVar5 = 0x21; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_BUG_ABUSE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x17; + iVar3 = 0x22; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_GAME_WEAKNESS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x13; + iVar5 = 0x23; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_MACRO_USE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0x24; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0x19; + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_MODIFIED_CLIENT"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x11; + iVar5 = 0x25; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_HACKING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x16; + iVar3 = 0x26; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_MULTI_CLIENT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x19; + iVar5 = 0x27; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_ACCOUNT_TRADING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x19; + iVar3 = 0x28; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHEATING_ACCOUNT_SHARING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x17; + iVar5 = 0x29; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_THREATENING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x16; + iVar3 = 0x2a; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_PRETENDING"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x15; + iVar5 = 0x2b; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_INFLUENCE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x19; + iVar3 = 0x2c; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_FALSE_REPORTS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0x2d; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0x1e; + pbVar9 = local_3c; + pbVar10 = (byte *)"KILLING_EXCESSIVE_UNJUSTIFIED"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x16; + iVar3 = 0x2e; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"DESTRUCTIVE_BEHAVIOUR"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x11; + iVar5 = 0x2f; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"SPOILING_AUCTION"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x10; + iVar3 = 0x30; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"INVALID_PAYMENT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x16; + iVar5 = 0x31; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"TELEPORT_TO_CHARACTER"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x11; + iVar3 = 0x32; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"TELEPORT_TO_MARK"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x12; + iVar5 = 0x33; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"TELEPORT_VERTICAL"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x17; + iVar3 = 0x34; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"TELEPORT_TO_COORDINATE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 9; + iVar5 = 0x35; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"LEVITATE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0x36; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"SPECIAL_MOVEUSE"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x12; + iVar5 = 0x37; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"MODIFY_GOSTRENGTH"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x10; + iVar3 = 0x38; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"SHOW_COORDINATE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 9; + iVar5 = 0x39; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"RETRIEVE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xd; + iVar3 = 0x3a; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"INVULNERABLE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = 0x3d; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"UNLIMITED_MANA"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar3 = 0x3e; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"KEEP_INVENTORY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xb; + iVar5 = 0x3f; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"ALL_SPELLS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x13; + iVar3 = 0x40; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"UNLIMITED_CAPACITY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar5 = 0x41; + if (!bVar14) { + iVar5 = iVar3; + } + iVar3 = 0xe; + pbVar9 = local_3c; + pbVar10 = (byte *)"ZERO_CAPACITY"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x12; + iVar3 = 0x42; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"ATTACK_EVERYWHERE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 10; + iVar5 = 0x43; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NO_ATTACK"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 9; + iVar3 = 0x44; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NO_RUNES"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x10; + iVar5 = 0x45; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NO_LOGOUT_BLOCK"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x12; + iVar3 = 0x46; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"GAMEMASTER_OUTFIT"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xb; + iVar5 = 0x47; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"ILLUMINATE"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x12; + iVar3 = 0x48; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHANGE_PROFESSION"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x14; + iVar5 = 0x49; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"IGNORED_BY_MONSTERS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar3 = 0x4a; + if (!bVar14) { + iVar3 = iVar5; + } + iVar5 = 0x15; + pbVar9 = local_3c; + pbVar10 = (byte *)"SHOW_KEYHOLE_NUMBERS"; + do { + if (iVar5 == 0) break; + iVar5 = iVar5 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = 0x4b; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATE_OBJECTS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xd; + iVar3 = 0x4c; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATE_MONEY"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0x10; + iVar5 = 0x4d; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CREATE_MONSTERS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xe; + iVar3 = 0x4e; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CHANGE_SKILLS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = 0x4f; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"CLEANUP_FIELDS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xe; + iVar3 = 0x50; + if (!bVar14) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"NO_STATISTICS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + iVar6 = 0xf; + iVar5 = 0x51; + if (!bVar14) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"KEEP_CHARACTER"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 < *pbVar10; + bVar14 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar14); + bVar12 = (!bVar12 && !bVar14) == bVar12; + if (bVar12) { + iVar5 = -2; + } + iVar3 = 0x10; + pbVar9 = local_3c; + pbVar10 = (byte *)"EXTRA_CHARACTER"; + do { + if (iVar3 == 0) break; + iVar3 = iVar3 + -1; + bVar12 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar12); + iVar6 = 0xd; + iVar3 = -2; + if (!bVar12) { + iVar3 = iVar5; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"ENTER_HOUSES"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar12); + iVar6 = 0x10; + iVar5 = 0x3b; + if (!bVar12) { + iVar5 = iVar3; + } + pbVar9 = local_3c; + pbVar10 = (byte *)"OPEN_NAMEDDOORS"; + do { + if (iVar6 == 0) break; + iVar6 = iVar6 + -1; + bVar12 = *pbVar9 == *pbVar10; + pbVar9 = pbVar9 + 1; + pbVar10 = pbVar10 + 1; + } while (bVar12); + iVar3 = 0x3c; + if (!bVar12) { + iVar3 = iVar5; + } + if (iVar3 != -2) { + if (iVar3 == -1) { + error("TQueryManagerConnection::loginGame: Unbekanntes Recht %s.\n",local_3c + ); + } + else { + iVar5 = iVar3 + 7; + if (-1 < iVar3) { + iVar5 = iVar3; + } + local_60 = (char)iVar3 + (char)(iVar5 >> 3) * -8; + Rights[iVar5 >> 3] = Rights[iVar5 >> 3] | (byte)(1 << (local_60 & 0x1f)); + } + } + local_50 = local_50 + 1; + uVar11 = local_50 < uVar7; + uVar13 = local_50 == uVar7; + } while ((int)local_50 < (int)uVar7); + } + // try { // try from 080e2b7b to 080e2b7f has its CatchHandler @ 080e2fa2 + uVar2 = TReadBuffer::readByte(this_01); + *PremiumAccountActivated = uVar2 != '\0'; + iVar3 = 0; + } + else { + if (iVar3 == 1) { + // try { // try from 080e1d0c to 080e1d10 has its CatchHandler @ 080e2fd4 + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + uVar7 = (uint)bVar1; + bVar12 = false; + if ((uVar7 != 0) && (uVar7 < 0x10)) { + bVar12 = true; + } + if (bVar12) { + return uVar7; + } + error(&DAT_0810e380,uVar7); + } + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int logoutGame(TQueryManagerConnection * this, ulong CharacterID, int +// Level, char * Profession, char * Residence, time_t LastLoginTime, int TutorActivities) + +int __thiscall TQueryManagerConnection::logoutGame(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong in_stack_00000008; + ushort in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + ulong in_stack_00000018; + ushort in_stack_0000001c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3035 to 080e3049 has its CatchHandler @ 080e30d0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x15'); + // try { // try from 080e3054 to 080e3058 has its CatchHandler @ 080e3110 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e3064 to 080e3068 has its CatchHandler @ 080e3142 + TWriteBuffer::writeWord(this_00,in_stack_0000000c); + // try { // try from 080e3073 to 080e3077 has its CatchHandler @ 080e3172 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e3082 to 080e3086 has its CatchHandler @ 080e31a2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e3091 to 080e3095 has its CatchHandler @ 080e31d6 + TWriteBuffer::writeQuad(this_00,in_stack_00000018); + // try { // try from 080e30a1 to 080e30a5 has its CatchHandler @ 080e320a + TWriteBuffer::writeWord(this_00,in_stack_0000001c); + iVar1 = executeQuery(this,0x78,true); + return (iVar1 == 0) - 1; +} + + + +// DWARF original prototype: int setNotation(TQueryManagerConnection * this, ulong GamemasterID, +// char * PlayerName, char * IPAddress, char * Reason, char * Comment, ulong * BanishmentID) + +int __thiscall TQueryManagerConnection::setNotation(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + ulong uVar4; + int FailureCode; + uint uVar5; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + ulong *in_stack_0000001c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3265 to 080e3279 has its CatchHandler @ 080e3350 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1a'); + // try { // try from 080e3284 to 080e3288 has its CatchHandler @ 080e3390 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e3293 to 080e3297 has its CatchHandler @ 080e33c2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e32a2 to 080e32a6 has its CatchHandler @ 080e33f2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e32b1 to 080e32b5 has its CatchHandler @ 080e3422 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e32c0 to 080e32c4 has its CatchHandler @ 080e3456 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + iVar3 = executeQuery(this,0x1e,true); + if (iVar3 == 0) { + // try { // try from 080e3340 to 080e3344 has its CatchHandler @ 080e348a + uVar4 = TReadBuffer::readQuad(&this->ReadBuffer); + *in_stack_0000001c = uVar4; + iVar3 = 0; + } + else { + if (iVar3 == 1) { + // try { // try from 080e3303 to 080e3307 has its CatchHandler @ 080e34bc + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar5 = (uint)bVar2; + bVar1 = false; + if ((uVar5 != 0) && (uVar5 < 3)) { + bVar1 = true; + } + if (bVar1) { + return uVar5; + } + error(&DAT_0810e4a0,uVar5); + } + else { + error("TQueryManagerConnection::setNotation: Anfrage fehlgeschlagen.\n"); + } + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int setNamelock(TQueryManagerConnection * this, ulong GamemasterID, +// char * PlayerName, char * IPAddress, char * Reason, char * Comment) + +int __thiscall TQueryManagerConnection::setNamelock(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + int FailureCode; + int iVar4; + uint uVar5; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3515 to 080e3529 has its CatchHandler @ 080e35f0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x17'); + // try { // try from 080e3534 to 080e3538 has its CatchHandler @ 080e3630 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e3543 to 080e3547 has its CatchHandler @ 080e3662 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e3552 to 080e3556 has its CatchHandler @ 080e3692 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e3561 to 080e3565 has its CatchHandler @ 080e36c2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e3570 to 080e3574 has its CatchHandler @ 080e36f6 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + iVar3 = executeQuery(this,0x1e,true); + iVar4 = 0; + if (iVar3 != 0) { + if (iVar3 == 1) { + // try { // try from 080e35b7 to 080e35bb has its CatchHandler @ 080e372a + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar5 = (uint)bVar2; + bVar1 = false; + if ((uVar5 != 0) && (uVar5 < 5)) { + bVar1 = true; + } + if (bVar1) { + return uVar5; + } + error(&DAT_0810e540,uVar5); + } + else { + error("TQueryManagerConnection::setNamelock: Anfrage fehlgeschlagen.\n"); + } + iVar4 = -1; + } + return iVar4; +} + + + +// DWARF original prototype: int banishAccount(TQueryManagerConnection * this, ulong GamemasterID, +// char * PlayerName, char * IPAddress, char * Reason, char * Comment, bool * FinalWarning, int * +// Days, ulong * BanishmentID) + +int __thiscall TQueryManagerConnection::banishAccount(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + TReadBuffer *this_01; + bool bVar1; + byte bVar2; + uchar uVar3; + int iVar4; + ulong uVar5; + int FailureCode; + uint uVar6; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + char *in_stack_0000001c; + uint *in_stack_00000020; + ulong *in_stack_00000024; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3785 to 080e3799 has its CatchHandler @ 080e38c0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x19'); + // try { // try from 080e37a4 to 080e37a8 has its CatchHandler @ 080e3900 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e37b3 to 080e37b7 has its CatchHandler @ 080e3932 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e37c2 to 080e37c6 has its CatchHandler @ 080e3962 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e37d1 to 080e37d5 has its CatchHandler @ 080e3992 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e37e0 to 080e37e4 has its CatchHandler @ 080e39c6 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + // try { // try from 080e37f8 to 080e37fc has its CatchHandler @ 080e39fa + TWriteBuffer::writeByte(this_00,*in_stack_0000001c != '\0'); + iVar4 = executeQuery(this,0x1e,true); + if (iVar4 == 0) { + this_01 = &this->ReadBuffer; + // try { // try from 080e3878 to 080e387c has its CatchHandler @ 080e3a2e + uVar5 = TReadBuffer::readQuad(this_01); + *in_stack_00000024 = uVar5; + // try { // try from 080e3887 to 080e388b has its CatchHandler @ 080e3a60 + bVar2 = TReadBuffer::readByte(this_01); + uVar6 = 0xffffffff; + if (bVar2 != 0xff) { + uVar6 = (uint)bVar2; + } + *in_stack_00000020 = uVar6; + // try { // try from 080e38a8 to 080e38ac has its CatchHandler @ 080e3a92 + uVar3 = TReadBuffer::readByte(this_01); + *in_stack_0000001c = uVar3 != '\0'; + iVar4 = 0; + } + else { + if (iVar4 == 1) { + // try { // try from 080e383b to 080e383f has its CatchHandler @ 080e3ac4 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar6 = (uint)bVar2; + bVar1 = false; + if ((uVar6 != 0) && (uVar6 < 4)) { + bVar1 = true; + } + if (bVar1) { + return uVar6; + } + error(&DAT_0810e600,uVar6); + } + else { + error("TQueryManagerConnection::banishAccount: Anfrage fehlgeschlagen.\n"); + } + iVar4 = -1; + } + return iVar4; +} + + + +// WARNING: Variable defined which should be unmapped: i_1 +// DWARF original prototype: int reportStatement(TQueryManagerConnection * this, ulong ReporterID, +// char * PlayerName, char * Reason, char * Comment, ulong BanishmentID, ulong StatementID, int +// NumberOfStatements, ulong * StatementIDs, ulong * TimeStamps, ulong * CharacterIDs, char[30] * +// Channels, char[256] * Texts) + +int __thiscall TQueryManagerConnection::reportStatement(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + int iVar1; + bool bVar2; + byte bVar3; + int iVar4; + int i; + int iVar5; + uint uVar6; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + ulong in_stack_00000018; + ulong in_stack_0000001c; + int in_stack_00000020; + int *in_stack_00000024; + int in_stack_00000028; + int in_stack_0000002c; + int in_stack_00000030; + int in_stack_00000034; + int local_14; + int i_1; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3b25 to 080e3b39 has its CatchHandler @ 080e3ce0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1b'); + // try { // try from 080e3b44 to 080e3b48 has its CatchHandler @ 080e3d20 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e3b53 to 080e3b57 has its CatchHandler @ 080e3d52 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e3b62 to 080e3b66 has its CatchHandler @ 080e3d82 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e3b71 to 080e3b75 has its CatchHandler @ 080e3db2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e3b80 to 080e3b84 has its CatchHandler @ 080e3de6 + TWriteBuffer::writeQuad(this_00,in_stack_00000018); + // try { // try from 080e3b8f to 080e3b93 has its CatchHandler @ 080e3e1a + TWriteBuffer::writeQuad(this_00,in_stack_0000001c); + iVar5 = 0; + iVar4 = in_stack_00000020; + if (0 < in_stack_00000020) { + iVar1 = *in_stack_00000024; + while (iVar1 == 0) { + iVar5 = iVar5 + 1; + iVar4 = iVar4 + -1; + if (in_stack_00000020 <= iVar5) break; + iVar1 = in_stack_00000024[iVar5]; + } + } + // try { // try from 080e3bcb to 080e3bcf has its CatchHandler @ 080e3e4e + TWriteBuffer::writeWord(this_00,(ushort)iVar4); + local_14 = 0; + if (0 < in_stack_00000020) { + do { + if (in_stack_00000024[local_14] != 0) { + // try { // try from 080e3c77 to 080e3c7b has its CatchHandler @ 080e3e82 + TWriteBuffer::writeQuad(this_00,in_stack_00000024[local_14]); + // try { // try from 080e3c8c to 080e3c90 has its CatchHandler @ 080e3eb6 + TWriteBuffer::writeQuad(this_00,*(ulong *)(in_stack_00000028 + local_14 * 4)); + // try { // try from 080e3ca1 to 080e3ca5 has its CatchHandler @ 080e3eea + TWriteBuffer::writeQuad(this_00,*(ulong *)(in_stack_0000002c + local_14 * 4)); + // try { // try from 080e3cbe to 080e3cc2 has its CatchHandler @ 080e3f1e + TWriteStream::writeString + (&this_00->super_TWriteStream, + (char *)(in_stack_00000030 + local_14 * 0x1e)); + // try { // try from 080e3cd5 to 080e3cd9 has its CatchHandler @ 080e3f52 + TWriteStream::writeString + (&this_00->super_TWriteStream, + (char *)(local_14 * 0x100 + in_stack_00000034)); + } + local_14 = local_14 + 1; + } while (local_14 < in_stack_00000020); + } + iVar5 = executeQuery(this,0xb4,true); + iVar4 = 0; + if (iVar5 != 0) { + if (iVar5 == 1) { + // try { // try from 080e3c3d to 080e3c41 has its CatchHandler @ 080e3f86 + bVar3 = TReadBuffer::readByte(&this->ReadBuffer); + uVar6 = (uint)bVar3; + bVar2 = false; + if ((uVar6 != 0) && (uVar6 < 3)) { + bVar2 = true; + } + if (bVar2) { + return uVar6; + } + error(&DAT_0810e6c0,uVar6); + } + else { + error("TQueryManagerConnection::reportStatement: Anfrage fehlgeschlagen.\n"); + } + iVar4 = -1; + } + return iVar4; +} + + + +// DWARF original prototype: int banishIPAddress(TQueryManagerConnection * this, ulong GamemasterID, +// char * PlayerName, char * IPAddress, char * Reason, char * Comment) + +int __thiscall TQueryManagerConnection::banishIPAddress(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + int FailureCode; + int iVar4; + uint uVar5; + ulong in_stack_00000008; + char *in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e3fe5 to 080e3ff9 has its CatchHandler @ 080e40c0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1c'); + // try { // try from 080e4004 to 080e4008 has its CatchHandler @ 080e4100 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e4013 to 080e4017 has its CatchHandler @ 080e4132 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e4022 to 080e4026 has its CatchHandler @ 080e4162 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e4031 to 080e4035 has its CatchHandler @ 080e4192 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e4040 to 080e4044 has its CatchHandler @ 080e41c6 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + iVar3 = executeQuery(this,0x1e,true); + iVar4 = 0; + if (iVar3 != 0) { + if (iVar3 == 1) { + // try { // try from 080e4087 to 080e408b has its CatchHandler @ 080e41fa + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar5 = (uint)bVar2; + bVar1 = false; + if ((uVar5 != 0) && (uVar5 < 3)) { + bVar1 = true; + } + if (bVar1) { + return uVar5; + } + error(&DAT_0810e780,uVar5); + } + else { + error("TQueryManagerConnection::banishIPAddress: Anfrage fehlgeschlagen.\n"); + } + iVar4 = -1; + } + return iVar4; +} + + + +// WARNING: Variable defined which should be unmapped: Unjustified_local +// DWARF original prototype: int logCharacterDeath(TQueryManagerConnection * this, ulong +// CharacterID, int Level, ulong Offender, char * Remark, bool Unjustified, time_t Time) + +int __thiscall +TQueryManagerConnection::logCharacterDeath + (TQueryManagerConnection *this,ulong CharacterID,int Level,ulong Offender,char *Remark, + bool Unjustified,time_t Time) + +{ + TWriteBuffer *this_00; + int iVar1; + bool Unjustified_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e425c to 080e4270 has its CatchHandler @ 080e4310 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1d'); + // try { // try from 080e427b to 080e427f has its CatchHandler @ 080e4350 + TWriteBuffer::writeQuad(this_00,CharacterID); + // try { // try from 080e428b to 080e428f has its CatchHandler @ 080e4382 + TWriteBuffer::writeWord(this_00,(ushort)Level); + // try { // try from 080e429a to 080e429e has its CatchHandler @ 080e43b2 + TWriteBuffer::writeQuad(this_00,Offender); + // try { // try from 080e42a9 to 080e42ad has its CatchHandler @ 080e43e2 + TWriteStream::writeString(&this_00->super_TWriteStream,Remark); + // try { // try from 080e42be to 080e42c2 has its CatchHandler @ 080e4416 + TWriteBuffer::writeByte(this_00,Unjustified); + // try { // try from 080e42cd to 080e42d1 has its CatchHandler @ 080e444a + TWriteBuffer::writeQuad(this_00,Time); + iVar1 = executeQuery(this,0x5a,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::logCharacterDeath: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int addBuddy(TQueryManagerConnection * this, ulong AccountID, ulong +// Buddy) + +int __thiscall TQueryManagerConnection::addBuddy(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong in_stack_00000008; + ulong in_stack_0000000c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e44a5 to 080e44b9 has its CatchHandler @ 080e4513 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1e'); + // try { // try from 080e44c4 to 080e44c8 has its CatchHandler @ 080e4550 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e44d3 to 080e44d7 has its CatchHandler @ 080e4582 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + iVar1 = executeQuery(this,0x5a,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::addBuddy: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int removeBuddy(TQueryManagerConnection * this, ulong AccountID, ulong +// Buddy) + +int __thiscall TQueryManagerConnection::removeBuddy(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong in_stack_00000008; + ulong in_stack_0000000c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e45d5 to 080e45e9 has its CatchHandler @ 080e4643 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\x1f'); + // try { // try from 080e45f4 to 080e45f8 has its CatchHandler @ 080e4680 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e4603 to 080e4607 has its CatchHandler @ 080e46b2 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + iVar1 = executeQuery(this,0x5a,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::removeBuddy: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int decrementIsOnline(TQueryManagerConnection * this, ulong +// CharacterID) + +int __thiscall +TQueryManagerConnection::decrementIsOnline(TQueryManagerConnection *this,ulong CharacterID) + +{ + TWriteBuffer *this_00; + int iVar1; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e470b to 080e471f has its CatchHandler @ 080e4773 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,' '); + // try { // try from 080e472a to 080e472e has its CatchHandler @ 080e47b0 + TWriteBuffer::writeQuad(this_00,CharacterID); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::decrementIsOnline: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int finishAuctions(TQueryManagerConnection * this, int * +// NumberOfAuctions, ushort * HouseIDs, ulong * CharacterIDs, char[30] * CharacterNames, int * Bids) + +int __thiscall +TQueryManagerConnection::finishAuctions + (TQueryManagerConnection *this,int *NumberOfAuctions,ushort *HouseIDs,ulong *CharacterIDs, + char (*CharacterNames) [30],int *Bids) + +{ + ushort uVar1; + int iVar2; + ulong uVar3; + uint uVar4; + TReadBuffer *this_00; + int MaxNumberOfAuctions; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e4805 to 080e4819 has its CatchHandler @ 080e4900 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'!'); + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + this_00 = &this->ReadBuffer; + iVar2 = *NumberOfAuctions; + // try { // try from 080e485b to 080e485f has its CatchHandler @ 080e4940 + uVar1 = TReadBuffer::readWord(this_00); + uVar4 = (uint)uVar1; + *NumberOfAuctions = uVar4; + if ((int)uVar4 <= iVar2) { + iVar2 = 0; + if (uVar4 != 0) { + do { + // try { // try from 080e487c to 080e4880 has its CatchHandler @ 080e496b + uVar1 = TReadBuffer::readWord(this_00); + HouseIDs[iVar2] = uVar1; + // try { // try from 080e488e to 080e4892 has its CatchHandler @ 080e4996 + uVar3 = TReadBuffer::readQuad(this_00); + CharacterIDs[iVar2] = uVar3; + // try { // try from 080e48ba to 080e48be has its CatchHandler @ 080e49c4 + TReadStream::readString(&this_00->super_TReadStream,CharacterNames[iVar2],0x1e); + // try { // try from 080e48c2 to 080e48c6 has its CatchHandler @ 080e49fa + uVar3 = TReadBuffer::readQuad(this_00); + Bids[iVar2] = uVar3; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfAuctions); + } + return 0; + } + error("TQueryManagerConnection::finishAuctions: zu viele Auktionen (%d>%d).\n", + *NumberOfAuctions,iVar2); + } + else { + error("TQueryManagerConnection::finishAuctions: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// WARNING: Variable defined which should be unmapped: Banish_local +// DWARF original prototype: int excludeFromAuctions(TQueryManagerConnection * this, ulong +// CharacterID, bool Banish) + +int __thiscall +TQueryManagerConnection::excludeFromAuctions + (TQueryManagerConnection *this,ulong CharacterID,bool Banish) + +{ + TWriteBuffer *this_00; + int iVar1; + bool Banish_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e4a5c to 080e4a70 has its CatchHandler @ 080e4ad3 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'3'); + // try { // try from 080e4a7b to 080e4a7f has its CatchHandler @ 080e4b10 + TWriteBuffer::writeQuad(this_00,CharacterID); + TWriteBuffer::writeByte(this_00,Banish); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::excludeFromAuctions: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int transferHouses(TQueryManagerConnection * this, int * +// NumberOfTransfers, ushort * HouseIDs, ulong * NewOwnerIDs, char[30] * NewOwnerNames, int * +// Prices) + +int __thiscall +TQueryManagerConnection::transferHouses + (TQueryManagerConnection *this,int *NumberOfTransfers,ushort *HouseIDs,ulong *NewOwnerIDs, + char (*NewOwnerNames) [30],int *Prices) + +{ + ushort uVar1; + int iVar2; + ulong uVar3; + uint uVar4; + TReadBuffer *this_00; + int MaxNumberOfTransfers; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e4b65 to 080e4b79 has its CatchHandler @ 080e4c60 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'#'); + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + this_00 = &this->ReadBuffer; + iVar2 = *NumberOfTransfers; + // try { // try from 080e4bbb to 080e4bbf has its CatchHandler @ 080e4ca0 + uVar1 = TReadBuffer::readWord(this_00); + uVar4 = (uint)uVar1; + *NumberOfTransfers = uVar4; + if ((int)uVar4 <= iVar2) { + iVar2 = 0; + if (uVar4 != 0) { + do { + // try { // try from 080e4bdc to 080e4be0 has its CatchHandler @ 080e4ccb + uVar1 = TReadBuffer::readWord(this_00); + HouseIDs[iVar2] = uVar1; + // try { // try from 080e4bee to 080e4bf2 has its CatchHandler @ 080e4cf6 + uVar3 = TReadBuffer::readQuad(this_00); + NewOwnerIDs[iVar2] = uVar3; + // try { // try from 080e4c1a to 080e4c1e has its CatchHandler @ 080e4d24 + TReadStream::readString(&this_00->super_TReadStream,NewOwnerNames[iVar2],0x1e); + // try { // try from 080e4c22 to 080e4c26 has its CatchHandler @ 080e4d5a + uVar3 = TReadBuffer::readQuad(this_00); + Prices[iVar2] = uVar3; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfTransfers); + } + return 0; + } + error("TQueryManagerConnection::transferHouses: zu viele Transfers (%d>%d).\n", + *NumberOfTransfers,iVar2); + } + else { + error("TQueryManagerConnection::transferHouses: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local +// DWARF original prototype: int cancelHouseTransfer(TQueryManagerConnection * this, ushort HouseID) + +int __thiscall +TQueryManagerConnection::cancelHouseTransfer(TQueryManagerConnection *this,ushort HouseID) + +{ + TWriteBuffer *this_00; + int iVar1; + ushort HouseID_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e4dc2 to 080e4dd6 has its CatchHandler @ 080e4e24 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'4'); + // try { // try from 080e4de1 to 080e4de5 has its CatchHandler @ 080e4e60 + TWriteBuffer::writeWord(this_00,HouseID); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::cancelHouseTransfer: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int evictFreeAccounts(TQueryManagerConnection * this, int * +// NumberOfEvictions, ushort * HouseIDs, ulong * OwnerIDs) + +int __thiscall +TQueryManagerConnection::evictFreeAccounts + (TQueryManagerConnection *this,int *NumberOfEvictions,ushort *HouseIDs,ulong *OwnerIDs) + +{ + ushort uVar1; + int iVar2; + ulong uVar3; + uint uVar4; + TReadBuffer *this_00; + int MaxNumberOfEvictions; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e4eb5 to 080e4ec9 has its CatchHandler @ 080e4f77 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'$'); + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + this_00 = &this->ReadBuffer; + iVar2 = *NumberOfEvictions; + // try { // try from 080e4f0b to 080e4f0f has its CatchHandler @ 080e4fb1 + uVar1 = TReadBuffer::readWord(this_00); + uVar4 = (uint)uVar1; + *NumberOfEvictions = uVar4; + if ((int)uVar4 <= iVar2) { + iVar2 = 0; + if (uVar4 != 0) { + do { + // try { // try from 080e4f33 to 080e4f37 has its CatchHandler @ 080e4fdc + uVar1 = TReadBuffer::readWord(this_00); + HouseIDs[iVar2] = uVar1; + // try { // try from 080e4f45 to 080e4f49 has its CatchHandler @ 080e5007 + uVar3 = TReadBuffer::readQuad(this_00); + OwnerIDs[iVar2] = uVar3; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfEvictions); + } + return 0; + } + error(&DAT_0810ebc0,*NumberOfEvictions,iVar2); + } + else { + error("TQueryManagerConnection::evictFreeAccounts: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// DWARF original prototype: int evictDeletedCharacters(TQueryManagerConnection * this, int * +// NumberOfEvictions, ushort * HouseIDs) + +int __thiscall +TQueryManagerConnection::evictDeletedCharacters + (TQueryManagerConnection *this,int *NumberOfEvictions,ushort *HouseIDs) + +{ + ushort uVar1; + int iVar2; + uint uVar3; + int MaxNumberOfEvictions; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e5055 to 080e5069 has its CatchHandler @ 080e5107 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'%'); + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + iVar2 = *NumberOfEvictions; + // try { // try from 080e50ae to 080e50b2 has its CatchHandler @ 080e5141 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + uVar3 = (uint)uVar1; + *NumberOfEvictions = uVar3; + if ((int)uVar3 <= iVar2) { + iVar2 = 0; + if (uVar3 != 0) { + do { + // try { // try from 080e50d6 to 080e50da has its CatchHandler @ 080e5170 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + HouseIDs[iVar2] = uVar1; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfEvictions); + } + return 0; + } + error(&DAT_0810ec80,*NumberOfEvictions,iVar2); + } + else { + error("TQueryManagerConnection::evictDeletedCharacters: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: int evictExGuildleaders(TQueryManagerConnection * this, int +// NumberOfGuildhouses, int * NumberOfEvictions, ushort * HouseIDs, ulong * Guildleaders) + +int __thiscall +TQueryManagerConnection::evictExGuildleaders + (TQueryManagerConnection *this,int NumberOfGuildhouses,int *NumberOfEvictions, + ushort *HouseIDs,ulong *Guildleaders) + +{ + TWriteBuffer *this_00; + ushort uVar1; + int iVar2; + int i_1; + int local_14; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e51c5 to 080e51d9 has its CatchHandler @ 080e52b0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'&'); + // try { // try from 080e51e5 to 080e51e9 has its CatchHandler @ 080e52f0 + TWriteBuffer::writeWord(this_00,(ushort)NumberOfGuildhouses); + local_14 = 0; + if (0 < NumberOfGuildhouses) { + do { + // try { // try from 080e5281 to 080e5285 has its CatchHandler @ 080e5322 + TWriteBuffer::writeWord(this_00,HouseIDs[local_14]); + // try { // try from 080e5296 to 080e529a has its CatchHandler @ 080e5350 + TWriteBuffer::writeQuad(this_00,Guildleaders[local_14]); + local_14 = local_14 + 1; + } while (local_14 < NumberOfGuildhouses); + } + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + // try { // try from 080e5236 to 080e523a has its CatchHandler @ 080e5380 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + *NumberOfEvictions = (uint)uVar1; + iVar2 = 0; + if (uVar1 != 0) { + do { + // try { // try from 080e5253 to 080e5257 has its CatchHandler @ 080e53b2 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + HouseIDs[iVar2] = uVar1; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfEvictions); + } + iVar2 = 0; + } + else { + error("TQueryManagerConnection::evictExGuildleaders: Anfrage fehlgeschlagen.\n"); + iVar2 = -1; + } + return iVar2; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local +// DWARF original prototype: int insertHouseOwner(TQueryManagerConnection * this, ushort HouseID, +// ulong OwnerID, int PaidUntil) + +int __thiscall +TQueryManagerConnection::insertHouseOwner + (TQueryManagerConnection *this,ushort HouseID,ulong OwnerID,int PaidUntil) + +{ + TWriteBuffer *this_00; + int iVar1; + ushort HouseID_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e540c to 080e5420 has its CatchHandler @ 080e5487 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'\''); + // try { // try from 080e542b to 080e542f has its CatchHandler @ 080e54c1 + TWriteBuffer::writeWord(this_00,HouseID); + // try { // try from 080e543a to 080e543e has its CatchHandler @ 080e54f2 + TWriteBuffer::writeQuad(this_00,OwnerID); + // try { // try from 080e5449 to 080e544d has its CatchHandler @ 080e5522 + TWriteBuffer::writeQuad(this_00,PaidUntil); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::insertHouseOwner: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local +// DWARF original prototype: int updateHouseOwner(TQueryManagerConnection * this, ushort HouseID, +// ulong OwnerID, int PaidUntil) + +int __thiscall +TQueryManagerConnection::updateHouseOwner + (TQueryManagerConnection *this,ushort HouseID,ulong OwnerID,int PaidUntil) + +{ + TWriteBuffer *this_00; + int iVar1; + ushort HouseID_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e557c to 080e5590 has its CatchHandler @ 080e55f7 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'('); + // try { // try from 080e559b to 080e559f has its CatchHandler @ 080e5631 + TWriteBuffer::writeWord(this_00,HouseID); + // try { // try from 080e55aa to 080e55ae has its CatchHandler @ 080e5662 + TWriteBuffer::writeQuad(this_00,OwnerID); + // try { // try from 080e55b9 to 080e55bd has its CatchHandler @ 080e5692 + TWriteBuffer::writeQuad(this_00,PaidUntil); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::updateHouseOwner: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local +// DWARF original prototype: int deleteHouseOwner(TQueryManagerConnection * this, ushort HouseID) + +int __thiscall +TQueryManagerConnection::deleteHouseOwner(TQueryManagerConnection *this,ushort HouseID) + +{ + TWriteBuffer *this_00; + int iVar1; + ushort HouseID_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e56f2 to 080e5706 has its CatchHandler @ 080e5754 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,')'); + // try { // try from 080e5711 to 080e5715 has its CatchHandler @ 080e5790 + TWriteBuffer::writeWord(this_00,HouseID); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::deleteHouseOwner: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int getHouseOwners(TQueryManagerConnection * this, int * +// NumberOfHouses, ushort * HouseIDs, ulong * OwnerIDs, char[30] * OwnerNames, int * PaidUntils) + +int __thiscall +TQueryManagerConnection::getHouseOwners + (TQueryManagerConnection *this,int *NumberOfHouses,ushort *HouseIDs,ulong *OwnerIDs, + char (*OwnerNames) [30],int *PaidUntils) + +{ + ushort uVar1; + int iVar2; + ulong uVar3; + uint uVar4; + TReadBuffer *this_00; + int MaxNumberOfHouses; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e57e5 to 080e57f9 has its CatchHandler @ 080e58e0 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'*'); + iVar2 = executeQuery(this,0x3c,true); + if (iVar2 == 0) { + this_00 = &this->ReadBuffer; + iVar2 = *NumberOfHouses; + // try { // try from 080e583b to 080e583f has its CatchHandler @ 080e5920 + uVar1 = TReadBuffer::readWord(this_00); + uVar4 = (uint)uVar1; + *NumberOfHouses = uVar4; + if ((int)uVar4 <= iVar2) { + iVar2 = 0; + if (uVar4 != 0) { + do { + // try { // try from 080e585c to 080e5860 has its CatchHandler @ 080e594b + uVar1 = TReadBuffer::readWord(this_00); + HouseIDs[iVar2] = uVar1; + // try { // try from 080e586e to 080e5872 has its CatchHandler @ 080e5976 + uVar3 = TReadBuffer::readQuad(this_00); + OwnerIDs[iVar2] = uVar3; + // try { // try from 080e589a to 080e589e has its CatchHandler @ 080e59a4 + TReadStream::readString(&this_00->super_TReadStream,OwnerNames[iVar2],0x1e); + // try { // try from 080e58a2 to 080e58a6 has its CatchHandler @ 080e59da + uVar3 = TReadBuffer::readQuad(this_00); + PaidUntils[iVar2] = uVar3; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfHouses); + } + return 0; + } + error(&DAT_0810eec0,*NumberOfHouses,iVar2); + } + else { + error("TQueryManagerConnection::getHouseOwners: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// DWARF original prototype: int getAuctions(TQueryManagerConnection * this, int * NumberOfAuctions, +// ushort * HouseIDs) + +int __thiscall +TQueryManagerConnection::getAuctions + (TQueryManagerConnection *this,int *NumberOfAuctions,ushort *HouseIDs) + +{ + ushort uVar1; + int iVar2; + uint uVar3; + int MaxNumberOfAuctions; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e5a35 to 080e5a49 has its CatchHandler @ 080e5ae7 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'+'); + iVar2 = executeQuery(this,0x78,true); + if (iVar2 == 0) { + iVar2 = *NumberOfAuctions; + // try { // try from 080e5a8e to 080e5a92 has its CatchHandler @ 080e5b21 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + uVar3 = (uint)uVar1; + *NumberOfAuctions = uVar3; + if ((int)uVar3 <= iVar2) { + iVar2 = 0; + if (uVar3 != 0) { + do { + // try { // try from 080e5ab6 to 080e5aba has its CatchHandler @ 080e5b50 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + HouseIDs[iVar2] = uVar1; + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfAuctions); + } + return 0; + } + error("TQueryManagerConnection::getAuctions: zu viele Auktionen (%d>%d).\n", + *NumberOfAuctions,iVar2); + } + else { + error("TQueryManagerConnection::getAuctions: Anfrage fehlgeschlagen.\n"); + } + return -1; +} + + + +// WARNING: Variable defined which should be unmapped: HouseID_local +// DWARF original prototype: int startAuction(TQueryManagerConnection * this, ushort HouseID) + +int __thiscall TQueryManagerConnection::startAuction(TQueryManagerConnection *this,ushort HouseID) + +{ + TWriteBuffer *this_00; + int iVar1; + ushort HouseID_local; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e5bb2 to 080e5bc6 has its CatchHandler @ 080e5c14 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,','); + // try { // try from 080e5bd1 to 080e5bd5 has its CatchHandler @ 080e5c50 + TWriteBuffer::writeWord(this_00,HouseID); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::startAuction: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: int insertHouses(TQueryManagerConnection * this, int NumberOfHouses, +// ushort * HouseIDs, char * * Names, int * Rents, char * * Descriptions, int * Sizes, int * +// PositionsX, int * PositionsY, int * PositionsZ, char[30] * Towns, bool * Guildhouses) + +int __thiscall +TQueryManagerConnection::insertHouses + (TQueryManagerConnection *this,int NumberOfHouses,ushort *HouseIDs,char **Names,int *Rents + ,char **Descriptions,int *Sizes,int *PositionsX,int *PositionsY,int *PositionsZ, + char (*Towns) [30],bool *Guildhouses) + +{ + TWriteBuffer *this_00; + int iVar1; + int local_14; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e5ca5 to 080e5cb9 has its CatchHandler @ 080e5e10 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'-'); + // try { // try from 080e5cc5 to 080e5cc9 has its CatchHandler @ 080e5e50 + TWriteBuffer::writeWord(this_00,(ushort)NumberOfHouses); + local_14 = 0; + if (0 < NumberOfHouses) { + do { + // try { // try from 080e5d23 to 080e5d27 has its CatchHandler @ 080e5e82 + TWriteBuffer::writeWord(this_00,HouseIDs[local_14]); + // try { // try from 080e5d38 to 080e5d3c has its CatchHandler @ 080e5eaf + TWriteStream::writeString(&this_00->super_TWriteStream,Names[local_14]); + // try { // try from 080e5d4d to 080e5d51 has its CatchHandler @ 080e5edf + TWriteBuffer::writeQuad(this_00,Rents[local_14]); + // try { // try from 080e5d62 to 080e5d66 has its CatchHandler @ 080e5f13 + TWriteStream::writeString(&this_00->super_TWriteStream,Descriptions[local_14]); + // try { // try from 080e5d78 to 080e5d7c has its CatchHandler @ 080e5f47 + TWriteBuffer::writeWord(this_00,*(ushort *)(Sizes + local_14)); + // try { // try from 080e5d8e to 080e5d92 has its CatchHandler @ 080e5f7b + TWriteBuffer::writeWord(this_00,*(ushort *)(PositionsX + local_14)); + // try { // try from 080e5da4 to 080e5da8 has its CatchHandler @ 080e5faf + TWriteBuffer::writeWord(this_00,*(ushort *)(PositionsY + local_14)); + // try { // try from 080e5dba to 080e5dbe has its CatchHandler @ 080e5fe3 + TWriteBuffer::writeByte(this_00,(uchar)PositionsZ[local_14]); + // try { // try from 080e5dd7 to 080e5ddb has its CatchHandler @ 080e6017 + TWriteStream::writeString(&this_00->super_TWriteStream,Towns[local_14]); + // try { // try from 080e5df3 to 080e5df7 has its CatchHandler @ 080e604b + TWriteBuffer::writeByte(this_00,Guildhouses[local_14] != false); + local_14 = local_14 + 1; + } while (local_14 < NumberOfHouses); + } + iVar1 = executeQuery(this,0x3c,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::insertHouses: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int clearIsOnline(TQueryManagerConnection * this, int * +// NumberOfAffectedPlayers) + +int __thiscall +TQueryManagerConnection::clearIsOnline(TQueryManagerConnection *this,int *NumberOfAffectedPlayers) + +{ + ushort uVar1; + int iVar2; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e60a8 to 080e60bc has its CatchHandler @ 080e6110 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,'.'); + iVar2 = executeQuery(this,0x78,true); + if (iVar2 == 0) { + // try { // try from 080e60fa to 080e60fe has its CatchHandler @ 080e6147 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + *NumberOfAffectedPlayers = (uint)uVar1; + iVar2 = 0; + } + else { + error("TQueryManagerConnection::clearIsOnline: Anfrage fehlgeschlagen.\n"); + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: int createPlayerlist(TQueryManagerConnection * this, int +// NumberOfPlayers, char * * Names, int * Levels, char[30] * Professions, bool * NewRecord) + +int __thiscall +TQueryManagerConnection::createPlayerlist + (TQueryManagerConnection *this,int NumberOfPlayers,char **Names,int *Levels, + char (*Professions) [30],bool *NewRecord) + +{ + uchar uVar1; + ushort w; + TWriteBuffer *this_00; + int i; + int iVar2; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6197 to 080e61ab has its CatchHandler @ 080e6270 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'/'); + w = 0xffff; + if (-1 < NumberOfPlayers) { + w = (ushort)NumberOfPlayers; + } + // try { // try from 080e61c4 to 080e61c8 has its CatchHandler @ 080e62b0 + TWriteBuffer::writeWord(this_00,w); + iVar2 = 0; + if (0 < NumberOfPlayers) { + do { + // try { // try from 080e6232 to 080e6236 has its CatchHandler @ 080e62e2 + TWriteStream::writeString(&this_00->super_TWriteStream,Names[iVar2]); + // try { // try from 080e6245 to 080e6249 has its CatchHandler @ 080e6312 + TWriteBuffer::writeWord(this_00,*(ushort *)(Levels + iVar2)); + // try { // try from 080e625e to 080e6262 has its CatchHandler @ 080e6345 + TWriteStream::writeString(&this_00->super_TWriteStream,Professions[iVar2]); + iVar2 = iVar2 + 1; + } while (iVar2 < NumberOfPlayers); + } + iVar2 = executeQuery(this,0xf0,true); + if (iVar2 == 0) { + // try { // try from 080e6211 to 080e6215 has its CatchHandler @ 080e637c + uVar1 = TReadBuffer::readByte(&this->ReadBuffer); + *NewRecord = uVar1 != '\0'; + iVar2 = 0; + } + else { + error("TQueryManagerConnection::createPlayerlist: Anfrage fehlgeschlagen.\n"); + iVar2 = -1; + } + return iVar2; +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: int logKilledCreatures(TQueryManagerConnection * this, int +// NumberOfRaces, char * * Names, int * KilledPlayers, int * KilledCreatures) + +int __thiscall +TQueryManagerConnection::logKilledCreatures + (TQueryManagerConnection *this,int NumberOfRaces,char **Names,int *KilledPlayers, + int *KilledCreatures) + +{ + TWriteBuffer *this_00; + int iVar1; + int local_14; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e63d5 to 080e63e9 has its CatchHandler @ 080e6491 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'0'); + // try { // try from 080e63f5 to 080e63f9 has its CatchHandler @ 080e64d0 + TWriteBuffer::writeWord(this_00,(ushort)NumberOfRaces); + local_14 = 0; + if (0 < NumberOfRaces) { + do { + // try { // try from 080e6452 to 080e6456 has its CatchHandler @ 080e6502 + TWriteStream::writeString(&this_00->super_TWriteStream,Names[local_14]); + // try { // try from 080e6467 to 080e646b has its CatchHandler @ 080e6530 + TWriteBuffer::writeQuad(this_00,KilledPlayers[local_14]); + // try { // try from 080e647c to 080e6480 has its CatchHandler @ 080e6560 + TWriteBuffer::writeQuad(this_00,KilledCreatures[local_14]); + local_14 = local_14 + 1; + } while (local_14 < NumberOfRaces); + } + iVar1 = executeQuery(this,0xf0,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::logKilledCreatures: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int loadPlayers(TQueryManagerConnection * this, ulong +// MinimumCharacterID, int * NumberOfPlayers, char[30] * Names, ulong * CharacterIDs) + +int __thiscall +TQueryManagerConnection::loadPlayers + (TQueryManagerConnection *this,ulong MinimumCharacterID,int *NumberOfPlayers, + char (*Names) [30],ulong *CharacterIDs) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong uVar2; + int i; + TReadBuffer *this_01; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e65b5 to 080e65c9 has its CatchHandler @ 080e6670 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,'2'); + // try { // try from 080e65d4 to 080e65d8 has its CatchHandler @ 080e66b0 + TWriteBuffer::writeQuad(this_00,MinimumCharacterID); + iVar1 = executeQuery(this,900,true); + if (iVar1 == 0) { + this_01 = &this->ReadBuffer; + // try { // try from 080e6616 to 080e661a has its CatchHandler @ 080e66e2 + uVar2 = TReadBuffer::readQuad(this_01); + iVar1 = 0; + *NumberOfPlayers = uVar2; + if (0 < (int)uVar2) { + do { + // try { // try from 080e664f to 080e6653 has its CatchHandler @ 080e670d + TReadStream::readString(&this_01->super_TReadStream,Names[iVar1],0x1e); + // try { // try from 080e6657 to 080e665b has its CatchHandler @ 080e673f + uVar2 = TReadBuffer::readQuad(this_01); + CharacterIDs[iVar1] = uVar2; + iVar1 = iVar1 + 1; + } while (iVar1 < *NumberOfPlayers); + } + iVar1 = 0; + } + else { + error("TQueryManagerConnection::loadPlayers: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int getKeptCharacters(TQueryManagerConnection * this, ulong +// MinimumCharacterID, int * NumberOfPlayers, ulong * CharacterIDs) + +int __thiscall +TQueryManagerConnection::getKeptCharacters + (TQueryManagerConnection *this,ulong MinimumCharacterID,int *NumberOfPlayers, + ulong *CharacterIDs) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong uVar2; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6795 to 080e67a9 has its CatchHandler @ 080e6830 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,200); + // try { // try from 080e67b4 to 080e67b8 has its CatchHandler @ 080e6870 + TWriteBuffer::writeQuad(this_00,MinimumCharacterID); + iVar1 = executeQuery(this,0x708,true); + if (iVar1 == 0) { + // try { // try from 080e67f6 to 080e67fa has its CatchHandler @ 080e68a2 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + iVar1 = 0; + *NumberOfPlayers = uVar2; + if (0 < (int)uVar2) { + do { + // try { // try from 080e6813 to 080e6817 has its CatchHandler @ 080e68d0 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + CharacterIDs[iVar1] = uVar2; + iVar1 = iVar1 + 1; + } while (iVar1 < *NumberOfPlayers); + } + iVar1 = 0; + } + else { + error("TQueryManagerConnection::getKeptCharacters: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int getDeletedCharacters(TQueryManagerConnection * this, ulong +// MinimumCharacterID, int * NumberOfPlayers, ulong * CharacterIDs) + +int __thiscall +TQueryManagerConnection::getDeletedCharacters + (TQueryManagerConnection *this,ulong MinimumCharacterID,int *NumberOfPlayers, + ulong *CharacterIDs) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong uVar2; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6925 to 080e6939 has its CatchHandler @ 080e69c0 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xc9); + // try { // try from 080e6944 to 080e6948 has its CatchHandler @ 080e6a00 + TWriteBuffer::writeQuad(this_00,MinimumCharacterID); + iVar1 = executeQuery(this,900,true); + if (iVar1 == 0) { + // try { // try from 080e6986 to 080e698a has its CatchHandler @ 080e6a32 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + iVar1 = 0; + *NumberOfPlayers = uVar2; + if (0 < (int)uVar2) { + do { + // try { // try from 080e69a3 to 080e69a7 has its CatchHandler @ 080e6a60 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + CharacterIDs[iVar1] = uVar2; + iVar1 = iVar1 + 1; + } while (iVar1 < *NumberOfPlayers); + } + iVar1 = 0; + } + else { + error("TQueryManagerConnection::getKeptCharacters: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int deleteOldCharacter(TQueryManagerConnection * this, ulong +// CharacterID) + +int __thiscall +TQueryManagerConnection::deleteOldCharacter(TQueryManagerConnection *this,ulong CharacterID) + +{ + TWriteBuffer *this_00; + int iVar1; + + this_00 = &this->WriteBuffer; + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6abb to 080e6acf has its CatchHandler @ 080e6b23 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xca); + // try { // try from 080e6ada to 080e6ade has its CatchHandler @ 080e6b60 + TWriteBuffer::writeQuad(this_00,CharacterID); + iVar1 = executeQuery(this,0x1e,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::deleteOldCharacter: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int getHiddenCharacters(TQueryManagerConnection * this, ulong +// MinimumCharacterID, int * NumberOfPlayers, ulong * CharacterIDs) + +int __thiscall +TQueryManagerConnection::getHiddenCharacters + (TQueryManagerConnection *this,ulong MinimumCharacterID,int *NumberOfPlayers, + ulong *CharacterIDs) + +{ + TWriteBuffer *this_00; + int iVar1; + ulong uVar2; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6bb5 to 080e6bc9 has its CatchHandler @ 080e6c50 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xcb); + // try { // try from 080e6bd4 to 080e6bd8 has its CatchHandler @ 080e6c90 + TWriteBuffer::writeQuad(this_00,MinimumCharacterID); + iVar1 = executeQuery(this,0x78,true); + if (iVar1 == 0) { + // try { // try from 080e6c16 to 080e6c1a has its CatchHandler @ 080e6cc2 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + iVar1 = 0; + *NumberOfPlayers = uVar2; + if (0 < (int)uVar2) { + do { + // try { // try from 080e6c33 to 080e6c37 has its CatchHandler @ 080e6cf0 + uVar2 = TReadBuffer::readQuad(&this->ReadBuffer); + CharacterIDs[iVar1] = uVar2; + iVar1 = iVar1 + 1; + } while (iVar1 < *NumberOfPlayers); + } + iVar1 = 0; + } + else { + error("TQueryManagerConnection::getHiddenCharacters: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: int createHighscores(TQueryManagerConnection * this, int +// NumberOfPlayers, ulong * CharacterIDs, int * ExpPoints, int * ExpLevel, int * Fist, int * Club, +// int * Axe, int * Sword, int * Distance, int * Shielding, int * Magic, int * Fishing) + +int __thiscall +TQueryManagerConnection::createHighscores + (TQueryManagerConnection *this,int NumberOfPlayers,ulong *CharacterIDs,int *ExpPoints, + int *ExpLevel,int *Fist,int *Club,int *Axe,int *Sword,int *Distance,int *Shielding, + int *Magic,int *Fishing) + +{ + TWriteBuffer *this_00; + int iVar1; + int local_14; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e6d45 to 080e6d59 has its CatchHandler @ 080e6eb5 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xcc); + // try { // try from 080e6d64 to 080e6d68 has its CatchHandler @ 080e6ef0 + TWriteBuffer::writeQuad(this_00,NumberOfPlayers); + local_14 = 0; + if (0 < NumberOfPlayers) { + do { + // try { // try from 080e6dc1 to 080e6dc5 has its CatchHandler @ 080e6f22 + TWriteBuffer::writeQuad(this_00,CharacterIDs[local_14]); + // try { // try from 080e6dd6 to 080e6dda has its CatchHandler @ 080e6f4f + TWriteBuffer::writeQuad(this_00,ExpPoints[local_14]); + // try { // try from 080e6dec to 080e6df0 has its CatchHandler @ 080e6f7f + TWriteBuffer::writeWord(this_00,*(ushort *)(ExpLevel + local_14)); + // try { // try from 080e6e02 to 080e6e06 has its CatchHandler @ 080e6fb3 + TWriteBuffer::writeWord(this_00,*(ushort *)(Fist + local_14)); + // try { // try from 080e6e18 to 080e6e1c has its CatchHandler @ 080e6fe7 + TWriteBuffer::writeWord(this_00,*(ushort *)(Club + local_14)); + // try { // try from 080e6e2e to 080e6e32 has its CatchHandler @ 080e701b + TWriteBuffer::writeWord(this_00,*(ushort *)(Axe + local_14)); + // try { // try from 080e6e44 to 080e6e48 has its CatchHandler @ 080e704f + TWriteBuffer::writeWord(this_00,*(ushort *)(Sword + local_14)); + // try { // try from 080e6e5a to 080e6e5e has its CatchHandler @ 080e7083 + TWriteBuffer::writeWord(this_00,*(ushort *)(Distance + local_14)); + // try { // try from 080e6e70 to 080e6e74 has its CatchHandler @ 080e70b7 + TWriteBuffer::writeWord(this_00,*(ushort *)(Shielding + local_14)); + // try { // try from 080e6e86 to 080e6e8a has its CatchHandler @ 080e70eb + TWriteBuffer::writeWord(this_00,*(ushort *)(Magic + local_14)); + // try { // try from 080e6e9c to 080e6ea0 has its CatchHandler @ 080e711f + TWriteBuffer::writeWord(this_00,*(ushort *)(Fishing + local_14)); + local_14 = local_14 + 1; + } while (local_14 < NumberOfPlayers); + } + iVar1 = executeQuery(this,0x78,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::createHighscores: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int createCensus(TQueryManagerConnection * this) + +int __thiscall TQueryManagerConnection::createCensus(TQueryManagerConnection *this) + +{ + int iVar1; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7178 to 080e718c has its CatchHandler @ 080e71c8 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,0xcd); + iVar1 = executeQuery(this,600,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::createCensus: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int createKillStatistics(TQueryManagerConnection * this) + +int __thiscall TQueryManagerConnection::createKillStatistics(TQueryManagerConnection *this) + +{ + int iVar1; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7228 to 080e723c has its CatchHandler @ 080e7278 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,0xce); + iVar1 = executeQuery(this,300,true); + if (iVar1 == 0) { + iVar1 = 0; + } + else { + error("TQueryManagerConnection::createKillStatistics: Anfrage fehlgeschlagen.\n"); + iVar1 = -1; + } + return iVar1; +} + + + +// DWARF original prototype: int getPlayersOnline(TQueryManagerConnection * this, int * +// NumberOfWorlds, char[30] * Names, ushort * Players) + +int __thiscall +TQueryManagerConnection::getPlayersOnline + (TQueryManagerConnection *this,int *NumberOfWorlds,char (*Names) [30],ushort *Players) + +{ + TReadBuffer *this_00; + byte bVar1; + ushort uVar2; + int iVar3; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e72d5 to 080e72e9 has its CatchHandler @ 080e7380 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,0xcf); + iVar3 = executeQuery(this,0x78,true); + if (iVar3 == 0) { + this_00 = &this->ReadBuffer; + // try { // try from 080e7326 to 080e732a has its CatchHandler @ 080e73c0 + bVar1 = TReadBuffer::readByte(this_00); + iVar3 = 0; + *NumberOfWorlds = (uint)bVar1; + if (bVar1 != 0) { + do { + // try { // try from 080e735f to 080e7363 has its CatchHandler @ 080e73eb + TReadStream::readString(&this_00->super_TReadStream,Names[iVar3],0x1e); + // try { // try from 080e7367 to 080e736b has its CatchHandler @ 080e741a + uVar2 = TReadBuffer::readWord(this_00); + Players[iVar3] = uVar2; + iVar3 = iVar3 + 1; + } while (iVar3 < *NumberOfWorlds); + } + iVar3 = 0; + } + else { + error("TQueryManagerConnection::getPlayersOnline: Anfrage fehlgeschlagen.\n"); + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int getWorlds(TQueryManagerConnection * this, int * NumberOfWorlds, +// char[30] * Names) + +int __thiscall +TQueryManagerConnection::getWorlds + (TQueryManagerConnection *this,int *NumberOfWorlds,char (*Names) [30]) + +{ + byte bVar1; + int iVar2; + + this->QueryOk = true; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7475 to 080e7489 has its CatchHandler @ 080e7511 + TWriteBuffer::writeWord(&this->WriteBuffer,0); + TWriteBuffer::writeByte(&this->WriteBuffer,0xd0); + iVar2 = executeQuery(this,0x78,true); + if (iVar2 == 0) { + // try { // try from 080e74c9 to 080e74cd has its CatchHandler @ 080e7550 + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + iVar2 = 0; + *NumberOfWorlds = (uint)bVar1; + if (bVar1 != 0) { + do { + // try { // try from 080e7502 to 080e7506 has its CatchHandler @ 080e7580 + TReadStream::readString(&(this->ReadBuffer).super_TReadStream,Names[iVar2],0x1e); + iVar2 = iVar2 + 1; + } while (iVar2 < *NumberOfWorlds); + } + iVar2 = 0; + } + else { + error("TQueryManagerConnection::getWorlds: Anfrage fehlgeschlagen.\n"); + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: int getServerLoad(TQueryManagerConnection * this, char * World, int +// Period, int * Data) + +int __thiscall +TQueryManagerConnection::getServerLoad + (TQueryManagerConnection *this,char *World,int Period,int *Data) + +{ + TWriteBuffer *this_00; + ushort uVar1; + int iVar2; + uint uVar3; + ushort Value; + int i; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e75d5 to 080e75e9 has its CatchHandler @ 080e7673 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd1); + // try { // try from 080e75f4 to 080e75f8 has its CatchHandler @ 080e76b0 + TWriteStream::writeString(&this_00->super_TWriteStream,World); + // try { // try from 080e7607 to 080e760b has its CatchHandler @ 080e76e2 + TWriteBuffer::writeByte(this_00,(uchar)Period); + iVar2 = executeQuery(this,0x168,true); + if (iVar2 == 0) { + iVar2 = 0; + do { + // try { // try from 080e7630 to 080e7634 has its CatchHandler @ 080e7712 + uVar1 = TReadBuffer::readWord(&this->ReadBuffer); + uVar3 = 0xffffffff; + if (uVar1 != 0xffff) { + uVar3 = (uint)uVar1; + } + Data[iVar2] = uVar3; + iVar2 = iVar2 + 1; + } while (iVar2 < 600); + iVar2 = 0; + } + else { + error("TQueryManagerConnection::getServerLoad: Anfrage fehlgeschlagen.\n"); + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: int insertPaymentDataOld(TQueryManagerConnection * this, ulong +// PurchaseNr, ulong ReferenceNr, char * FirstName, char * LastName, char * Company, char * Street, +// char * Zip, char * City, char * Country, char * State, char * Phone, char * Fax, char * EMail, +// char * PaymentMethod, ulong ProductID, char * Registrant, ulong AccountID, ulong * PaymentID) + +int __thiscall TQueryManagerConnection::insertPaymentDataOld(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + byte bVar1; + int iVar2; + ulong uVar3; + ulong in_stack_00000008; + ulong in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + char *in_stack_0000001c; + char *in_stack_00000020; + char *in_stack_00000024; + char *in_stack_00000028; + char *in_stack_0000002c; + char *in_stack_00000030; + char *in_stack_00000034; + char *in_stack_00000038; + char *in_stack_0000003c; + ulong in_stack_00000040; + char *in_stack_00000044; + ulong in_stack_00000048; + ulong *in_stack_0000004c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7765 to 080e7779 has its CatchHandler @ 080e78f6 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd2); + // try { // try from 080e7784 to 080e7788 has its CatchHandler @ 080e7930 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e7793 to 080e7797 has its CatchHandler @ 080e7962 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + // try { // try from 080e77a2 to 080e77a6 has its CatchHandler @ 080e7992 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e77b1 to 080e77b5 has its CatchHandler @ 080e79c2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e77c0 to 080e77c4 has its CatchHandler @ 080e79f6 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + // try { // try from 080e77cf to 080e77d3 has its CatchHandler @ 080e7a2a + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000001c); + // try { // try from 080e77de to 080e77e2 has its CatchHandler @ 080e7a5e + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000020); + // try { // try from 080e77ed to 080e77f1 has its CatchHandler @ 080e7a92 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000024); + // try { // try from 080e77fc to 080e7800 has its CatchHandler @ 080e7ac6 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000028); + // try { // try from 080e780b to 080e780f has its CatchHandler @ 080e7afa + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000002c); + // try { // try from 080e781a to 080e781e has its CatchHandler @ 080e7b2e + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000030); + // try { // try from 080e7829 to 080e782d has its CatchHandler @ 080e7b62 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000034); + // try { // try from 080e7838 to 080e783c has its CatchHandler @ 080e7b96 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000038); + // try { // try from 080e7847 to 080e784b has its CatchHandler @ 080e7bca + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000003c); + // try { // try from 080e7856 to 080e785a has its CatchHandler @ 080e7bfe + TWriteBuffer::writeQuad(this_00,in_stack_00000040); + // try { // try from 080e7865 to 080e7869 has its CatchHandler @ 080e7c32 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000044); + // try { // try from 080e7874 to 080e7878 has its CatchHandler @ 080e7c66 + TWriteBuffer::writeQuad(this_00,in_stack_00000048); + iVar2 = executeQuery(this,0x168,true); + if (iVar2 == 0) { + // try { // try from 080e78e6 to 080e78ea has its CatchHandler @ 080e7c9a + uVar3 = TReadBuffer::readQuad(&this->ReadBuffer); + *in_stack_0000004c = uVar3; + iVar2 = 0; + } + else { + if (iVar2 == 1) { + // try { // try from 080e78b7 to 080e78bb has its CatchHandler @ 080e7ccc + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + if (bVar1 == 1) { + return 1; + } + error(&DAT_0810f520,(uint)bVar1); + } + else { + error("TQueryManagerConnection::insertPaymentDataOld: Anfrage fehlgeschlagen.\n"); + } + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: int addPaymentOld(TQueryManagerConnection * this, ulong AccountID, char +// * Description, ulong PaymentID, int Days, int * ActionTaken) + +int __thiscall TQueryManagerConnection::addPaymentOld(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + int FailureCode; + uint uVar4; + ulong in_stack_00000008; + char *in_stack_0000000c; + ulong in_stack_00000010; + ushort in_stack_00000014; + uint *in_stack_00000018; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7d25 to 080e7d39 has its CatchHandler @ 080e7e06 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd3); + // try { // try from 080e7d44 to 080e7d48 has its CatchHandler @ 080e7e40 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e7d53 to 080e7d57 has its CatchHandler @ 080e7e72 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000000c); + // try { // try from 080e7d62 to 080e7d66 has its CatchHandler @ 080e7ea2 + TWriteBuffer::writeQuad(this_00,in_stack_00000010); + // try { // try from 080e7d72 to 080e7d76 has its CatchHandler @ 080e7ed2 + TWriteBuffer::writeWord(this_00,in_stack_00000014); + iVar3 = executeQuery(this,0x168,true); + if (iVar3 == 0) { + // try { // try from 080e7df2 to 080e7df6 has its CatchHandler @ 080e7f06 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + *in_stack_00000018 = (uint)bVar2; + iVar3 = 0; + } + else { + if (iVar3 == 1) { + // try { // try from 080e7db5 to 080e7db9 has its CatchHandler @ 080e7f38 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar4 = (uint)bVar2; + bVar1 = false; + if ((uVar4 != 0) && (uVar4 < 3)) { + bVar1 = true; + } + if (bVar1) { + return uVar4; + } + error(&DAT_0810f5e0,uVar4); + } + else { + error("TQueryManagerConnection::addPaymentOld: Anfrage fehlgeschlagen.\n"); + } + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int cancelPaymentOld(TQueryManagerConnection * this, ulong PurchaseNr, +// ulong ReferenceNr, ulong AccountID, bool * IllegalUse, char * EMailAddress) + +int __thiscall TQueryManagerConnection::cancelPaymentOld(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + uchar uVar3; + int iVar4; + int FailureCode; + uint uVar5; + ulong in_stack_00000008; + ulong in_stack_0000000c; + ulong in_stack_00000010; + undefined4 in_stack_00000014; + char *in_stack_00000018; + char *Text; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e7f95 to 080e7fa9 has its CatchHandler @ 080e8072 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd4); + // try { // try from 080e7fb4 to 080e7fb8 has its CatchHandler @ 080e80b0 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e7fc3 to 080e7fc7 has its CatchHandler @ 080e80e2 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + // try { // try from 080e7fd2 to 080e7fd6 has its CatchHandler @ 080e8112 + TWriteBuffer::writeQuad(this_00,in_stack_00000010); + iVar4 = executeQuery(this,0x168,true); + if (iVar4 == 0) { + // try { // try from 080e8047 to 080e804b has its CatchHandler @ 080e8142 + uVar3 = TReadBuffer::readByte(&this->ReadBuffer); + *(bool *)in_stack_00000014 = uVar3 != '\0'; + // try { // try from 080e8069 to 080e806d has its CatchHandler @ 080e8174 + TReadStream::readString(&(this->ReadBuffer).super_TReadStream,in_stack_00000018,0x32); + iVar4 = 0; + } + else { + if (iVar4 == 1) { + // try { // try from 080e8015 to 080e8019 has its CatchHandler @ 080e81aa + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar5 = (uint)bVar2; + bVar1 = false; + if ((uVar5 != 0) && (uVar5 < 3)) { + bVar1 = true; + } + if (bVar1) { + return uVar5; + } + Text = &DAT_0810f6a0; + } + else { + Text = "TQueryManagerConnection::cancelPaymentOld: Anfrage fehlgeschlagen.\n"; + } + error(Text); + iVar4 = -1; + } + return iVar4; +} + + + +// DWARF original prototype: int insertPaymentDataNew(TQueryManagerConnection * this, ulong +// PurchaseNr, ulong ReferenceNr, char * FirstName, char * LastName, char * Company, char * Street, +// char * Zip, char * City, char * Country, char * State, char * Phone, char * Fax, char * EMail, +// char * PaymentMethod, ulong ProductID, char * Registrant, char * PaymentKey, ulong * PaymentID) + +int __thiscall TQueryManagerConnection::insertPaymentDataNew(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + byte bVar1; + int iVar2; + ulong uVar3; + ulong in_stack_00000008; + ulong in_stack_0000000c; + char *in_stack_00000010; + char *in_stack_00000014; + char *in_stack_00000018; + char *in_stack_0000001c; + char *in_stack_00000020; + char *in_stack_00000024; + char *in_stack_00000028; + char *in_stack_0000002c; + char *in_stack_00000030; + char *in_stack_00000034; + char *in_stack_00000038; + char *in_stack_0000003c; + ulong in_stack_00000040; + char *in_stack_00000044; + char *in_stack_00000048; + ulong *in_stack_0000004c; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e8205 to 080e8219 has its CatchHandler @ 080e8396 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd5); + // try { // try from 080e8224 to 080e8228 has its CatchHandler @ 080e83d0 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e8233 to 080e8237 has its CatchHandler @ 080e8402 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + // try { // try from 080e8242 to 080e8246 has its CatchHandler @ 080e8432 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + // try { // try from 080e8251 to 080e8255 has its CatchHandler @ 080e8462 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000014); + // try { // try from 080e8260 to 080e8264 has its CatchHandler @ 080e8496 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000018); + // try { // try from 080e826f to 080e8273 has its CatchHandler @ 080e84ca + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000001c); + // try { // try from 080e827e to 080e8282 has its CatchHandler @ 080e84fe + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000020); + // try { // try from 080e828d to 080e8291 has its CatchHandler @ 080e8532 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000024); + // try { // try from 080e829c to 080e82a0 has its CatchHandler @ 080e8566 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000028); + // try { // try from 080e82ab to 080e82af has its CatchHandler @ 080e859a + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000002c); + // try { // try from 080e82ba to 080e82be has its CatchHandler @ 080e85ce + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000030); + // try { // try from 080e82c9 to 080e82cd has its CatchHandler @ 080e8602 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000034); + // try { // try from 080e82d8 to 080e82dc has its CatchHandler @ 080e8636 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000038); + // try { // try from 080e82e7 to 080e82eb has its CatchHandler @ 080e866a + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_0000003c); + // try { // try from 080e82f6 to 080e82fa has its CatchHandler @ 080e869e + TWriteBuffer::writeQuad(this_00,in_stack_00000040); + // try { // try from 080e8305 to 080e8309 has its CatchHandler @ 080e86d2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000044); + // try { // try from 080e8314 to 080e8318 has its CatchHandler @ 080e8706 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000048); + iVar2 = executeQuery(this,0x168,true); + if (iVar2 == 0) { + // try { // try from 080e8386 to 080e838a has its CatchHandler @ 080e873a + uVar3 = TReadBuffer::readQuad(&this->ReadBuffer); + *in_stack_0000004c = uVar3; + iVar2 = 0; + } + else { + if (iVar2 == 1) { + // try { // try from 080e8357 to 080e835b has its CatchHandler @ 080e876c + bVar1 = TReadBuffer::readByte(&this->ReadBuffer); + if (bVar1 == 1) { + return 1; + } + error(&DAT_0810f760,(uint)bVar1); + } + else { + error("TQueryManagerConnection::insertPaymentDataNew: Anfrage fehlgeschlagen.\n"); + } + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: int addPaymentNew(TQueryManagerConnection * this, char * PaymentKey, +// ulong PaymentID, int * ActionTaken, char * EMailReceiver) + +int __thiscall TQueryManagerConnection::addPaymentNew(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + bool bVar1; + byte bVar2; + int iVar3; + int FailureCode; + uint uVar4; + char *in_stack_00000008; + ulong in_stack_0000000c; + uint *in_stack_00000010; + char *in_stack_00000014; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e87c5 to 080e87d9 has its CatchHandler @ 080e88a8 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd6); + // try { // try from 080e87e4 to 080e87e8 has its CatchHandler @ 080e88e2 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000008); + // try { // try from 080e87f3 to 080e87f7 has its CatchHandler @ 080e8912 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + iVar3 = executeQuery(this,0x168,true); + if (iVar3 == 0) { + // try { // try from 080e8876 to 080e887a has its CatchHandler @ 080e8942 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + *in_stack_00000010 = (uint)bVar2; + if (bVar2 == 5) { + // try { // try from 080e88a1 to 080e88a5 has its CatchHandler @ 080e8970 + TReadStream::readString(&(this->ReadBuffer).super_TReadStream,in_stack_00000014,100); + } + iVar3 = 0; + } + else { + if (iVar3 == 1) { + // try { // try from 080e8836 to 080e883a has its CatchHandler @ 080e89a6 + bVar2 = TReadBuffer::readByte(&this->ReadBuffer); + uVar4 = (uint)bVar2; + bVar1 = false; + if ((uVar4 != 0) && (uVar4 < 4)) { + bVar1 = true; + } + if (bVar1) { + return uVar4; + } + error(&DAT_0810f820,uVar4); + } + else { + error("TQueryManagerConnection::addPaymentNew: Anfrage fehlgeschlagen.\n"); + } + iVar3 = -1; + } + return iVar3; +} + + + +// DWARF original prototype: int cancelPaymentNew(TQueryManagerConnection * this, ulong PurchaseNr, +// ulong ReferenceNr, char * PaymentKey, bool * IllegalUse, bool * Present, char * EMailAddress) + +int __thiscall TQueryManagerConnection::cancelPaymentNew(TQueryManagerConnection *this) + +{ + TWriteBuffer *this_00; + TReadBuffer *this_01; + uchar uVar1; + int iVar2; + ulong in_stack_00000008; + ulong in_stack_0000000c; + char *in_stack_00000010; + undefined4 in_stack_00000014; + undefined4 in_stack_00000018; + char *in_stack_0000001c; + char *Text; + + this->QueryOk = true; + this_00 = &this->WriteBuffer; + (this->WriteBuffer).Position = 0; + // try { // try from 080e8a05 to 080e8a19 has its CatchHandler @ 080e8ae4 + TWriteBuffer::writeWord(this_00,0); + TWriteBuffer::writeByte(this_00,0xd7); + // try { // try from 080e8a24 to 080e8a28 has its CatchHandler @ 080e8b20 + TWriteBuffer::writeQuad(this_00,in_stack_00000008); + // try { // try from 080e8a33 to 080e8a37 has its CatchHandler @ 080e8b52 + TWriteBuffer::writeQuad(this_00,in_stack_0000000c); + // try { // try from 080e8a42 to 080e8a46 has its CatchHandler @ 080e8b82 + TWriteStream::writeString(&this_00->super_TWriteStream,in_stack_00000010); + iVar2 = executeQuery(this,0x168,true); + if (iVar2 == 0) { + this_01 = &this->ReadBuffer; + // try { // try from 080e8aa6 to 080e8aaa has its CatchHandler @ 080e8bb2 + uVar1 = TReadBuffer::readByte(this_01); + *(bool *)in_stack_00000014 = uVar1 != '\0'; + // try { // try from 080e8ab9 to 080e8abd has its CatchHandler @ 080e8be4 + uVar1 = TReadBuffer::readByte(this_01); + *(bool *)in_stack_00000018 = uVar1 != '\0'; + // try { // try from 080e8adb to 080e8adf has its CatchHandler @ 080e8c16 + TReadStream::readString(&this_01->super_TReadStream,in_stack_0000001c,0x32); + iVar2 = 0; + } + else { + if (iVar2 == 1) { + // try { // try from 080e8a85 to 080e8a89 has its CatchHandler @ 080e8c4c + uVar1 = TReadBuffer::readByte(&this->ReadBuffer); + if (uVar1 == '\x01') { + return 1; + } + Text = &DAT_0810f8e0; + } + else { + Text = "TQueryManagerConnection::cancelPaymentNew: Anfrage fehlgeschlagen.\n"; + } + error(Text); + iVar2 = -1; + } + return iVar2; +} + + + +// DWARF original prototype: void TQueryManagerConnectionPool(TQueryManagerConnectionPool * this, +// int Connections) + +void __thiscall +TQueryManagerConnectionPool::TQueryManagerConnectionPool + (TQueryManagerConnectionPool *this,int Connections) + +{ + Semaphore::Semaphore(&this->FreeQueryManagerConnections,Connections); + // try { // try from 080e8cb5 to 080e8cb9 has its CatchHandler @ 080e8d00 + Semaphore::Semaphore(&this->QueryManagerConnectionMutex,1); + if (Connections < 1) { + // try { // try from 080e8ce6 to 080e8cea has its CatchHandler @ 080e8cf2 + error(&DAT_0810f940,Connections); + Connections = 1; + } + this->NumberOfConnections = Connections; + this->QueryManagerConnection = (TQueryManagerConnection *)0x0; + this->QueryManagerConnectionFree = (bool *)0x0; + return; +} + + + +// DWARF original prototype: void TQueryManagerConnectionPool(TQueryManagerConnectionPool * this, +// int Connections) + +void __thiscall +TQueryManagerConnectionPool::TQueryManagerConnectionPool + (TQueryManagerConnectionPool *this,int Connections) + +{ + Semaphore::Semaphore(&this->FreeQueryManagerConnections,Connections); + // try { // try from 080e8d55 to 080e8d59 has its CatchHandler @ 080e8da0 + Semaphore::Semaphore(&this->QueryManagerConnectionMutex,1); + if (Connections < 1) { + // try { // try from 080e8d86 to 080e8d8a has its CatchHandler @ 080e8d92 + error(&DAT_0810f940,Connections); + Connections = 1; + } + this->NumberOfConnections = Connections; + this->QueryManagerConnection = (TQueryManagerConnection *)0x0; + this->QueryManagerConnectionFree = (bool *)0x0; + return; +} + + + +// DWARF original prototype: void init(TQueryManagerConnectionPool * this) + +int __thiscall +TQueryManagerConnectionPool::init(TQueryManagerConnectionPool *this,EVP_PKEY_CTX *ctx) + +{ + int *piVar1; + bool *pbVar2; + undefined4 *puVar3; + int iVar4; + int i; + int iVar5; + TQueryManagerConnection *this_00; + + iVar5 = this->NumberOfConnections; + // try { // try from 080e8dda to 080e8dde has its CatchHandler @ 080e8f00 + piVar1 = (int *)operator_new__(iVar5 * 0x30 + 4); + *piVar1 = iVar5; + this_00 = (TQueryManagerConnection *)(piVar1 + 1); + while (iVar5 = iVar5 + -1, iVar5 != -1) { + // try { // try from 080e8dfc to 080e8e00 has its CatchHandler @ 080e8ea4 + TQueryManagerConnection::TQueryManagerConnection(this_00,0x4000); + this_00 = this_00 + 1; + } + this->QueryManagerConnection = (TQueryManagerConnection *)(piVar1 + 1); + // try { // try from 080e8e1e to 080e8ea3 has its CatchHandler @ 080e8f00 + pbVar2 = (bool *)operator_new__(this->NumberOfConnections); + iVar5 = 0; + this->QueryManagerConnectionFree = pbVar2; + if (0 < this->NumberOfConnections) { + iVar4 = 0; + do { + if (*(int *)((int)&this->QueryManagerConnection->Socket + iVar4) < 0) { + error("TQueryManagerConnectionPool::init: Kann nicht zum Query-Manager verbinden.\n" + ); + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "cannot connect to query manager"; + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); + } + iVar4 = iVar4 + 0x30; + pbVar2 = this->QueryManagerConnectionFree; + pbVar2[iVar5] = true; + iVar5 = iVar5 + 1; + } while (iVar5 < this->NumberOfConnections); + } + return (int)pbVar2; +} + + + +// DWARF original prototype: void exit(TQueryManagerConnectionPool * this) + +void __thiscall TQueryManagerConnectionPool::exit(TQueryManagerConnectionPool *this,int __status) + +{ + TQueryManagerConnection *pTVar1; + int i; + int iVar2; + TQueryManagerConnection *this_00; + int in_stack_ffffffe8; + + iVar2 = 0; + if (0 < this->NumberOfConnections) { + do { + iVar2 = iVar2 + 1; + Semaphore::down(&this->FreeQueryManagerConnections); + } while (iVar2 < this->NumberOfConnections); + } + pTVar1 = this->QueryManagerConnection; + if (pTVar1 != (TQueryManagerConnection *)0x0) { + this_00 = pTVar1 + *(int *)&pTVar1[-1].QueryOk; + while (pTVar1 != this_00) { + this_00 = this_00 + -1; + TQueryManagerConnection::~TQueryManagerConnection(this_00,in_stack_ffffffe8); + pTVar1 = this->QueryManagerConnection; + } + operator_delete__(&pTVar1[-1].QueryOk); + } + if (this->QueryManagerConnectionFree == (bool *)0x0) { + return; + } + operator_delete__(this->QueryManagerConnectionFree); + return; +} + + + +// DWARF original prototype: TQueryManagerConnection * getConnection(TQueryManagerConnectionPool * +// this) + +TQueryManagerConnection * __thiscall +TQueryManagerConnectionPool::getConnection(TQueryManagerConnectionPool *this) + +{ + Semaphore *this_00; + int i; + int iVar1; + int iVar2; + + this_00 = &this->QueryManagerConnectionMutex; + Semaphore::down(&this->FreeQueryManagerConnections); + Semaphore::down(this_00); + iVar1 = 0; + if (0 < this->NumberOfConnections) { + iVar2 = 0; + do { + if (this->QueryManagerConnectionFree[iVar1] != false) { + this->QueryManagerConnectionFree[iVar1] = false; + Semaphore::up(this_00); + return (TQueryManagerConnection *) + ((int)&this->QueryManagerConnection->BufferSize + iVar2); + } + iVar1 = iVar1 + 1; + iVar2 = iVar2 + 0x30; + } while (iVar1 < this->NumberOfConnections); + } + error("TQueryManagerConnectionPool::getConnection: Keine freie Verbindung gefunden.\n"); + Semaphore::up(this_00); + return (TQueryManagerConnection *)0x0; +} + + + +// DWARF original prototype: void releaseConnection(TQueryManagerConnectionPool * this, +// TQueryManagerConnection * Connection) + +void __thiscall +TQueryManagerConnectionPool::releaseConnection + (TQueryManagerConnectionPool *this,TQueryManagerConnection *Connection) + +{ + TQueryManagerConnection *pTVar1; + int i; + int iVar2; + + iVar2 = 0; + if (0 < this->NumberOfConnections) { + pTVar1 = this->QueryManagerConnection; + do { + if (pTVar1 == Connection) { + this->QueryManagerConnectionFree[iVar2] = true; + Semaphore::up(&this->FreeQueryManagerConnections); + return; + } + iVar2 = iVar2 + 1; + pTVar1 = pTVar1 + 1; + } while (iVar2 < this->NumberOfConnections); + } + error("TQueryManagerConnectionPool::releaseConnection: Verbindung nicht gefunden.\n"); + return; +} + + + +// DWARF original prototype: void TQueryManagerPoolConnection(TQueryManagerPoolConnection * this, +// TQueryManagerConnectionPool * Pool) + +void __thiscall +TQueryManagerPoolConnection::TQueryManagerPoolConnection + (TQueryManagerPoolConnection *this,TQueryManagerConnectionPool *Pool) + +{ + TQueryManagerConnection *pTVar1; + int i; + int iVar2; + + if (Pool == (TQueryManagerConnectionPool *)0x0) { + error("TQueryManagerPoolConnection::TQueryManagerPoolConnection: Pool ist NULL.\n"); + this->QueryManagerConnection = (TQueryManagerConnection *)0x0; + } + else { + this->QueryManagerConnectionPool = Pool; + iVar2 = 0; + Semaphore::down(&Pool->FreeQueryManagerConnections); + Semaphore::down(&Pool->QueryManagerConnectionMutex); + if (0 < Pool->NumberOfConnections) { + do { + if (Pool->QueryManagerConnectionFree[iVar2] != false) { + Pool->QueryManagerConnectionFree[iVar2] = false; + Semaphore::up(&Pool->QueryManagerConnectionMutex); + pTVar1 = Pool->QueryManagerConnection + iVar2; + goto LAB_080e90b4; + } + iVar2 = iVar2 + 1; + } while (iVar2 < Pool->NumberOfConnections); + } + error("TQueryManagerConnectionPool::getConnection: Keine freie Verbindung gefunden.\n"); + Semaphore::up(&Pool->QueryManagerConnectionMutex); + pTVar1 = (TQueryManagerConnection *)0x0; +LAB_080e90b4: + this->QueryManagerConnection = pTVar1; + } + return; +} + + + +// DWARF original prototype: void TQueryManagerPoolConnection(TQueryManagerPoolConnection * this, +// TQueryManagerConnectionPool * Pool) + +void __thiscall +TQueryManagerPoolConnection::TQueryManagerPoolConnection + (TQueryManagerPoolConnection *this,TQueryManagerConnectionPool *Pool) + +{ + TQueryManagerConnection *pTVar1; + int i; + int iVar2; + + if (Pool == (TQueryManagerConnectionPool *)0x0) { + error("TQueryManagerPoolConnection::TQueryManagerPoolConnection: Pool ist NULL.\n"); + this->QueryManagerConnection = (TQueryManagerConnection *)0x0; + } + else { + this->QueryManagerConnectionPool = Pool; + iVar2 = 0; + Semaphore::down(&Pool->FreeQueryManagerConnections); + Semaphore::down(&Pool->QueryManagerConnectionMutex); + if (0 < Pool->NumberOfConnections) { + do { + if (Pool->QueryManagerConnectionFree[iVar2] != false) { + Pool->QueryManagerConnectionFree[iVar2] = false; + Semaphore::up(&Pool->QueryManagerConnectionMutex); + pTVar1 = Pool->QueryManagerConnection + iVar2; + goto LAB_080e9154; + } + iVar2 = iVar2 + 1; + } while (iVar2 < Pool->NumberOfConnections); + } + error("TQueryManagerConnectionPool::getConnection: Keine freie Verbindung gefunden.\n"); + Semaphore::up(&Pool->QueryManagerConnectionMutex); + pTVar1 = (TQueryManagerConnection *)0x0; +LAB_080e9154: + this->QueryManagerConnection = pTVar1; + } + return; +} + + + +// DWARF original prototype: void ~TQueryManagerPoolConnection(TQueryManagerPoolConnection * this, +// int __in_chrg) + +void __thiscall +TQueryManagerPoolConnection::~TQueryManagerPoolConnection + (TQueryManagerPoolConnection *this,int __in_chrg) + +{ + TQueryManagerConnectionPool *pTVar1; + TQueryManagerConnection *pTVar2; + int i; + int iVar3; + + if (this->QueryManagerConnection == (TQueryManagerConnection *)0x0) { + return; + } + pTVar1 = this->QueryManagerConnectionPool; + iVar3 = 0; + if (0 < pTVar1->NumberOfConnections) { + pTVar2 = pTVar1->QueryManagerConnection; + do { + if (pTVar2 == this->QueryManagerConnection) { + pTVar1->QueryManagerConnectionFree[iVar3] = true; + Semaphore::up(&pTVar1->FreeQueryManagerConnections); + return; + } + iVar3 = iVar3 + 1; + pTVar2 = pTVar2 + 1; + } while (iVar3 < pTVar1->NumberOfConnections); + } + error("TQueryManagerConnectionPool::releaseConnection: Verbindung nicht gefunden.\n"); + return; +} + + + +// DWARF original prototype: void ~TQueryManagerPoolConnection(TQueryManagerPoolConnection * this, +// int __in_chrg) + +void __thiscall +TQueryManagerPoolConnection::~TQueryManagerPoolConnection + (TQueryManagerPoolConnection *this,int __in_chrg) + +{ + TQueryManagerConnectionPool *pTVar1; + TQueryManagerConnection *pTVar2; + int i; + int iVar3; + + if (this->QueryManagerConnection == (TQueryManagerConnection *)0x0) { + return; + } + pTVar1 = this->QueryManagerConnectionPool; + iVar3 = 0; + if (0 < pTVar1->NumberOfConnections) { + pTVar2 = pTVar1->QueryManagerConnection; + do { + if (pTVar2 == this->QueryManagerConnection) { + pTVar1->QueryManagerConnectionFree[iVar3] = true; + Semaphore::up(&pTVar1->FreeQueryManagerConnections); + return; + } + iVar3 = iVar3 + 1; + pTVar2 = pTVar2 + 1; + } while (iVar3 < pTVar1->NumberOfConnections); + } + error("TQueryManagerConnectionPool::releaseConnection: Verbindung nicht gefunden.\n"); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I_ApplicationType(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +void __static_initialization_and_destruction_0(int __initialize_p,int __priority) + +{ + if ((__priority == 0xffff) && (__initialize_p == 1)) { + vlong::vlong(&RSA_EXPONENT,0x10001); + __cxa_atexit(__tcf_0,0,&__dso_handle); + } + return; +} + + + +// DWARF original prototype: void TRSAPrivateKey(TRSAPrivateKey * this) + +void __thiscall TRSAPrivateKey::TRSAPrivateKey(TRSAPrivateKey *this) + +{ + this->_vptr_TRSAPrivateKey = (_func_int_varargs **)&PTR__TRSAPrivateKey_081283e0; + vlong::vlong(&this->m_PrimeP,0); + // try { // try from 080e9359 to 080e935d has its CatchHandler @ 080e93d8 + vlong::vlong(&this->m_PrimeQ,0); + // try { // try from 080e936f to 080e9373 has its CatchHandler @ 080e93d4 + vlong::vlong(&this->m_U,0); + // try { // try from 080e9385 to 080e9389 has its CatchHandler @ 080e93d0 + vlong::vlong(&this->m_DP,0); + // try { // try from 080e9398 to 080e939c has its CatchHandler @ 080e93aa + vlong::vlong(&this->m_DQ,0); + return; +} + + + +// DWARF original prototype: void TRSAPrivateKey(TRSAPrivateKey * this) + +void __thiscall TRSAPrivateKey::TRSAPrivateKey(TRSAPrivateKey *this) + +{ + this->_vptr_TRSAPrivateKey = (_func_int_varargs **)&PTR__TRSAPrivateKey_081283e0; + vlong::vlong(&this->m_PrimeP,0); + // try { // try from 080e9429 to 080e942d has its CatchHandler @ 080e94a8 + vlong::vlong(&this->m_PrimeQ,0); + // try { // try from 080e943f to 080e9443 has its CatchHandler @ 080e94a4 + vlong::vlong(&this->m_U,0); + // try { // try from 080e9455 to 080e9459 has its CatchHandler @ 080e94a0 + vlong::vlong(&this->m_DP,0); + // try { // try from 080e9468 to 080e946c has its CatchHandler @ 080e947a + vlong::vlong(&this->m_DQ,0); + return; +} + + + +// DWARF original prototype: void ~TRSAPrivateKey(TRSAPrivateKey * this, int __in_chrg) + +void __thiscall TRSAPrivateKey::~TRSAPrivateKey(TRSAPrivateKey *this,int __in_chrg) + +{ + int unaff_EBX; + + this->_vptr_TRSAPrivateKey = (_func_int_varargs **)&PTR__TRSAPrivateKey_081283e0; + vlong::~vlong(&this->m_DQ,unaff_EBX); + vlong::~vlong(&this->m_DP,unaff_EBX); + vlong::~vlong(&this->m_U,unaff_EBX); + vlong::~vlong(&this->m_PrimeQ,unaff_EBX); + vlong::~vlong(&this->m_PrimeP,unaff_EBX); + return; +} + + + +// DWARF original prototype: void ~TRSAPrivateKey(TRSAPrivateKey * this, int __in_chrg) + +void __thiscall TRSAPrivateKey::~TRSAPrivateKey(TRSAPrivateKey *this,int __in_chrg) + +{ + int unaff_EBX; + + this->_vptr_TRSAPrivateKey = (_func_int_varargs **)&PTR__TRSAPrivateKey_081283e0; + vlong::~vlong(&this->m_DQ,unaff_EBX); + vlong::~vlong(&this->m_DP,unaff_EBX); + vlong::~vlong(&this->m_U,unaff_EBX); + vlong::~vlong(&this->m_PrimeQ,unaff_EBX); + vlong::~vlong(&this->m_PrimeP,unaff_EBX); + return; +} + + + +// DWARF original prototype: void ~TRSAPrivateKey(TRSAPrivateKey * this, int __in_chrg) + +void __thiscall TRSAPrivateKey::~TRSAPrivateKey(TRSAPrivateKey *this,int __in_chrg) + +{ + int unaff_EBX; + + this->_vptr_TRSAPrivateKey = (_func_int_varargs **)&PTR__TRSAPrivateKey_081283e0; + vlong::~vlong(&this->m_DQ,unaff_EBX); + vlong::~vlong(&this->m_DP,unaff_EBX); + vlong::~vlong(&this->m_U,unaff_EBX); + vlong::~vlong(&this->m_PrimeQ,unaff_EBX); + vlong::~vlong(&this->m_PrimeP,unaff_EBX); + operator_delete(this); + return; +} + + + +// DWARF original prototype: void init(TRSAPrivateKey * this, char * PrimeP, char * PrimeQ) + +int __thiscall TRSAPrivateKey::init(TRSAPrivateKey *this,EVP_PKEY_CTX *ctx) + +{ + vlong *pvVar1; + undefined4 *puVar2; + size_t __len; + char *in_stack_0000000c; + vlong *pvVar3; + vlong *Number; + vlong local_6c; + vlong local_5c; + undefined1 local_4c [4]; + vlong d; + vlong local_3c; + string Error; + + if (ctx == (EVP_PKEY_CTX *)0x0) { + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "PrimeP pointer is NULL"; + } + else { + if (in_stack_0000000c != (char *)0x0) { + pvVar1 = &this->m_PrimeP; + // try { // try from 080e95ec to 080e95f0 has its CatchHandler @ 080e9850 + vlong::convert((char *)ctx,pvVar1); + Number = &this->m_PrimeQ; + // try { // try from 080e95fe to 080e9602 has its CatchHandler @ 080e9980 + vlong::convert(in_stack_0000000c,Number); + vlong::vlong(&local_5c,1); + pvVar3 = Number; + // try { // try from 080e9627 to 080e962b has its CatchHandler @ 080e9aa1 + operator-((vlong *)&stack0xffffffd4,Number); + vlong::~vlong(&local_5c,(int)pvVar3); + // try { // try from 080e9648 to 080e964c has its CatchHandler @ 080e9adb + vlong::vlong(&local_6c,1); + pvVar3 = pvVar1; + // try { // try from 080e965e to 080e9662 has its CatchHandler @ 080e9ab3 + operator-(&local_5c,pvVar1); + // try { // try from 080e966c to 080e9670 has its CatchHandler @ 080e9adb + vlong::~vlong(&local_6c,(int)pvVar3); + // try { // try from 080e9685 to 080e9689 has its CatchHandler @ 080e9ad7 + operator*(&local_3c,&local_5c); + pvVar3 = &RSA_EXPONENT; + // try { // try from 080e96a2 to 080e96a6 has its CatchHandler @ 080e9ac5 + vlong::modinv((vlong *)local_4c,&RSA_EXPONENT,&local_3c); + // try { // try from 080e96b0 to 080e96b4 has its CatchHandler @ 080e9ad7 + vlong::~vlong(&local_3c,(int)pvVar3); + // try { // try from 080e96bb to 080e96bf has its CatchHandler @ 080e9adb + vlong::~vlong(&local_5c,(int)pvVar3); + vlong::~vlong((vlong *)&stack0xffffffd4,(int)pvVar3); + // try { // try from 080e96d9 to 080e96dd has its CatchHandler @ 080e9b10 + vlong::modinv(&local_6c,pvVar1,Number); + pvVar3 = &local_6c; + // try { // try from 080e96f1 to 080e96f5 has its CatchHandler @ 080e9adf + vlong::operator=(&this->m_U,pvVar3); + // try { // try from 080e96fc to 080e9713 has its CatchHandler @ 080e9b10 + vlong::~vlong(&local_6c,(int)pvVar3); + vlong::vlong(&local_3c,1); + // try { // try from 080e9725 to 080e9729 has its CatchHandler @ 080e9af1 + operator-(&local_5c,pvVar1); + // try { // try from 080e9733 to 080e9737 has its CatchHandler @ 080e9b10 + vlong::~vlong(&local_3c,(int)pvVar1); + // try { // try from 080e974c to 080e9750 has its CatchHandler @ 080e9b0a + operator%(&local_6c,(vlong *)local_4c); + pvVar3 = &local_6c; + // try { // try from 080e9764 to 080e9768 has its CatchHandler @ 080e9af8 + vlong::operator=(&this->m_DP,pvVar3); + // try { // try from 080e976f to 080e9773 has its CatchHandler @ 080e9b0a + vlong::~vlong(&local_6c,(int)pvVar3); + // try { // try from 080e977a to 080e9791 has its CatchHandler @ 080e9b10 + vlong::~vlong(&local_5c,(int)pvVar3); + vlong::vlong(&local_3c,1); + // try { // try from 080e97a3 to 080e97a7 has its CatchHandler @ 080e9af1 + operator-(&local_5c,Number); + // try { // try from 080e97b1 to 080e97b5 has its CatchHandler @ 080e9b10 + vlong::~vlong(&local_3c,(int)Number); + // try { // try from 080e97ca to 080e97ce has its CatchHandler @ 080e9b0a + operator%(&local_6c,(vlong *)local_4c); + pvVar3 = &local_6c; + // try { // try from 080e97e2 to 080e97e6 has its CatchHandler @ 080e9af8 + pvVar1 = vlong::operator=(&this->m_DQ,pvVar3); + // try { // try from 080e97ed to 080e97f1 has its CatchHandler @ 080e9b0a + vlong::~vlong(&local_6c,(int)pvVar3); + // try { // try from 080e97f8 to 080e97fc has its CatchHandler @ 080e9b10 + vlong::~vlong(&local_5c,(int)pvVar3); + vlong::~vlong((vlong *)local_4c,(int)pvVar3); + return (int)pvVar1; + } + puVar2 = (undefined4 *)__cxa_allocate_exception(4); + *puVar2 = "PrimeQ pointer is NULL"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar2,char_const*::typeinfo,0); +} + + + +// DWARF original prototype: void decrypt(TRSAPrivateKey * this, uchar * Data) + +int __thiscall +TRSAPrivateKey::decrypt + (TRSAPrivateKey *this,EVP_PKEY_CTX *ctx,uchar *out,size_t *outlen,uchar *in,size_t inlen) + +{ + size_t __size; + int iVar1; + vlong *pvVar2; + undefined4 *puVar3; + size_t __len; + char *pE; + char *pE_1; + undefined1 *puVar4; + string Error_1; + vlong local_8c; + vlong local_7c; + vlong local_6c; + undefined1 local_5c [4]; + vlong a; + undefined1 local_4c [4]; + vlong b; + undefined1 local_3c [4]; + vlong Plain; + undefined1 local_2c [4]; + vlong Cipher; + + if (ctx == (EVP_PKEY_CTX *)0x0) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "Data pointer is NULL"; + } + else { + vlong::vlong((vlong *)local_2c,0); + pvVar2 = (vlong *)local_2c; + // try { // try from 080e9b57 to 080e9b5b has its CatchHandler @ 080e9e62 + iVar1 = vlong::cf(&this->m_PrimeP,(vlong *)local_2c); + vlong::~vlong((vlong *)local_2c,(int)pvVar2); + if (iVar1 == 0) { + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "m_PrimeP is null"; + } + else { + vlong::vlong((vlong *)local_2c,0); + pvVar2 = (vlong *)local_2c; + // try { // try from 080e9b9c to 080e9ba0 has its CatchHandler @ 080e9e74 + iVar1 = vlong::cf(&this->m_PrimeQ,(vlong *)local_2c); + vlong::~vlong((vlong *)local_2c,(int)pvVar2); + if (iVar1 != 0) { + vlong::vlong((vlong *)local_2c,0); + // try { // try from 080e9bda to 080e9bde has its CatchHandler @ 080e9e76 + vlong::convert((uchar *)ctx,0x80,(vlong *)local_2c); + // try { // try from 080e9bed to 080e9bf1 has its CatchHandler @ 080e9e62 + operator%((vlong *)local_4c,(vlong *)local_2c); + puVar4 = local_4c; + // try { // try from 080e9c10 to 080e9c14 has its CatchHandler @ 080e9fa0 + vlong::modexp((vlong *)local_5c); + // try { // try from 080e9c1e to 080e9c22 has its CatchHandler @ 080e9e62 + vlong::~vlong((vlong *)local_4c,(int)puVar4); + // try { // try from 080e9c37 to 080e9c3b has its CatchHandler @ 080ea17e + operator%((vlong *)local_3c,(vlong *)local_2c); + puVar4 = local_3c; + // try { // try from 080e9c60 to 080e9c64 has its CatchHandler @ 080e9fb2 + vlong::modexp((vlong *)local_4c); + // try { // try from 080e9c6e to 080e9c72 has its CatchHandler @ 080ea17e + vlong::~vlong((vlong *)local_3c,(int)puVar4); + // try { // try from 080e9c80 to 080e9c84 has its CatchHandler @ 080ea177 + vlong::vlong((vlong *)local_3c,(vlong *)local_5c); + pvVar2 = (vlong *)local_3c; + // try { // try from 080e9c92 to 080e9c96 has its CatchHandler @ 080e9fc4 + iVar1 = vlong::cf((vlong *)local_4c,pvVar2); + // try { // try from 080e9ca2 to 080e9cca has its CatchHandler @ 080ea177 + vlong::~vlong((vlong *)local_3c,(int)pvVar2); + if (iVar1 < 0) { + // try { // try from 080e9e00 to 080e9e04 has its CatchHandler @ 080ea177 + vlong::operator+=((vlong *)local_4c,&this->m_PrimeQ); + } + operator-((vlong *)&stack0xffffff64,(vlong *)local_4c); + // try { // try from 080e9ceb to 080e9cef has its CatchHandler @ 080ea012 + operator*(&local_8c,(vlong *)&stack0xffffff64); + // try { // try from 080e9d0d to 080e9d11 has its CatchHandler @ 080ea00e + operator%(&local_7c,&local_8c); + // try { // try from 080e9d26 to 080e9d2a has its CatchHandler @ 080ea00a + operator*(&local_6c,&this->m_PrimeP); + pvVar2 = (vlong *)local_5c; + // try { // try from 080e9d42 to 080e9d46 has its CatchHandler @ 080e9fd9 + operator+((vlong *)local_3c,pvVar2); + // try { // try from 080e9d50 to 080e9d54 has its CatchHandler @ 080ea00a + vlong::~vlong(&local_6c,(int)pvVar2); + // try { // try from 080e9d5b to 080e9d5f has its CatchHandler @ 080ea00e + vlong::~vlong(&local_7c,(int)pvVar2); + // try { // try from 080e9d69 to 080e9d6d has its CatchHandler @ 080ea012 + vlong::~vlong(&local_8c,(int)pvVar2); + // try { // try from 080e9d77 to 080e9d7b has its CatchHandler @ 080ea177 + vlong::~vlong((vlong *)&stack0xffffff64,(int)pvVar2); + // try { // try from 080e9d8c to 080e9d90 has its CatchHandler @ 080ea11f + vlong::vlong((vlong *)&stack0xffffff64,(vlong *)local_3c); + // try { // try from 080e9da9 to 080e9dad has its CatchHandler @ 080ea016 + vlong::convert((vlong *)&stack0xffffff64,(uchar *)ctx,0x80); + // try { // try from 080e9db7 to 080e9dbb has its CatchHandler @ 080ea11f + vlong::~vlong((vlong *)&stack0xffffff64,(int)ctx); + pvVar2 = (vlong *)local_3c; + // try { // try from 080e9dc2 to 080e9dc6 has its CatchHandler @ 080ea177 + vlong::~vlong(pvVar2,(int)ctx); + // try { // try from 080e9dcd to 080e9dd1 has its CatchHandler @ 080ea17e + vlong::~vlong((vlong *)local_4c,(int)ctx); + // try { // try from 080e9dd8 to 080e9ddc has its CatchHandler @ 080e9e62 + vlong::~vlong((vlong *)local_5c,(int)ctx); + vlong::~vlong((vlong *)local_2c,(int)ctx); + return (int)pvVar2; + } + puVar3 = (undefined4 *)__cxa_allocate_exception(4); + *puVar3 = "m_PrimeQ is null"; + } + } + // WARNING: Subroutine does not return + __cxa_throw(puVar3,char_const*::typeinfo,0); +} + + + +void __tcf_0(void *param_1) + +{ + int in_stack_00000008; + + vlong::~vlong(&RSA_EXPONENT,in_stack_00000008); + return; +} + + + +// WARNING: Unknown calling convention -- yet parameter storage is locked + +void _GLOBAL__I__ZN14TRSAPrivateKeyC2Ev(void) + +{ + __static_initialization_and_destruction_0(1,0xffff); + return; +} + + + +// DWARF original name: _M_replace_safe +// DWARF original prototype: basic_string,std::allocator_> * +// _M_replace_safe(basic_string,std::allocator_> * +// this, +// __normal_iterator,_std::allocator_>_> +// __i1, +// __normal_iterator,_std::allocator_>_> +// __i2, char * __k1, char * __k2) + +basic_string<> * __thiscall +basic_string<>::_M_replace_safe<> + (basic_string<> *this,__normal_iterator<> __i1,__normal_iterator<> __i2,char *__k1, + char *__k2) + +{ + uint __n; + uint uVar1; + + __n = (int)__k2 - (int)__k1; + if (std::string::_Rep::_S_max_size <= __n) { + std::__throw_length_error("basic_string::_M_replace"); + } + uVar1 = (int)__i1._M_current - (int)(this->_M_dataplus)._M_p; + std::string::_M_mutate((uint)this,uVar1,(int)__i2._M_current - (int)__i1._M_current); + if (__n != 0) { + memcpy((this->_M_dataplus)._M_p + uVar1,__k1,__n); + } + return this; +} + + + +// DWARF original prototype: void TXTEASymmetricKey(TXTEASymmetricKey * this) + +void __thiscall TXTEASymmetricKey::TXTEASymmetricKey(TXTEASymmetricKey *this) + +{ + this->_vptr_TXTEASymmetricKey = (_func_int_varargs **)&PTR__TXTEASymmetricKey_081283f8; + this->m_SymmetricKey[0] = '\0'; + this->m_SymmetricKey[1] = '\0'; + this->m_SymmetricKey[2] = '\0'; + this->m_SymmetricKey[3] = '\0'; + this->m_SymmetricKey[4] = '\0'; + this->m_SymmetricKey[5] = '\0'; + this->m_SymmetricKey[6] = '\0'; + this->m_SymmetricKey[7] = '\0'; + this->m_SymmetricKey[8] = '\0'; + this->m_SymmetricKey[9] = '\0'; + this->m_SymmetricKey[10] = '\0'; + this->m_SymmetricKey[0xb] = '\0'; + this->m_SymmetricKey[0xc] = '\0'; + this->m_SymmetricKey[0xd] = '\0'; + this->m_SymmetricKey[0xe] = '\0'; + this->m_SymmetricKey[0xf] = '\0'; + return; +} + + + +// DWARF original prototype: void TXTEASymmetricKey(TXTEASymmetricKey * this) + +void __thiscall TXTEASymmetricKey::TXTEASymmetricKey(TXTEASymmetricKey *this) + +{ + this->_vptr_TXTEASymmetricKey = (_func_int_varargs **)&PTR__TXTEASymmetricKey_081283f8; + this->m_SymmetricKey[0] = '\0'; + this->m_SymmetricKey[1] = '\0'; + this->m_SymmetricKey[2] = '\0'; + this->m_SymmetricKey[3] = '\0'; + this->m_SymmetricKey[4] = '\0'; + this->m_SymmetricKey[5] = '\0'; + this->m_SymmetricKey[6] = '\0'; + this->m_SymmetricKey[7] = '\0'; + this->m_SymmetricKey[8] = '\0'; + this->m_SymmetricKey[9] = '\0'; + this->m_SymmetricKey[10] = '\0'; + this->m_SymmetricKey[0xb] = '\0'; + this->m_SymmetricKey[0xc] = '\0'; + this->m_SymmetricKey[0xd] = '\0'; + this->m_SymmetricKey[0xe] = '\0'; + this->m_SymmetricKey[0xf] = '\0'; + return; +} + + + +// DWARF original prototype: void ~TXTEASymmetricKey(TXTEASymmetricKey * this, int __in_chrg) + +void __thiscall TXTEASymmetricKey::~TXTEASymmetricKey(TXTEASymmetricKey *this,int __in_chrg) + +{ + this->_vptr_TXTEASymmetricKey = (_func_int_varargs **)&PTR__TXTEASymmetricKey_081283f8; + return; +} + + + +// DWARF original prototype: void ~TXTEASymmetricKey(TXTEASymmetricKey * this, int __in_chrg) + +void __thiscall TXTEASymmetricKey::~TXTEASymmetricKey(TXTEASymmetricKey *this,int __in_chrg) + +{ + this->_vptr_TXTEASymmetricKey = (_func_int_varargs **)&PTR__TXTEASymmetricKey_081283f8; + return; +} + + + +// DWARF original prototype: void ~TXTEASymmetricKey(TXTEASymmetricKey * this, int __in_chrg) + +void __thiscall TXTEASymmetricKey::~TXTEASymmetricKey(TXTEASymmetricKey *this,int __in_chrg) + +{ + this->_vptr_TXTEASymmetricKey = (_func_int_varargs **)&PTR__TXTEASymmetricKey_081283f8; + operator_delete(this); + return; +} + + + +// DWARF original prototype: void init(TXTEASymmetricKey * this, uchar * SymmetricKey) + +int __thiscall TXTEASymmetricKey::init(TXTEASymmetricKey *this,EVP_PKEY_CTX *ctx) + +{ + int in_EAX; + + if (ctx != (EVP_PKEY_CTX *)0x0) { + *(undefined4 *)this->m_SymmetricKey = *(undefined4 *)ctx; + *(undefined4 *)(this->m_SymmetricKey + 4) = *(undefined4 *)(ctx + 4); + *(undefined4 *)(this->m_SymmetricKey + 8) = *(undefined4 *)(ctx + 8); + in_EAX = *(int *)(ctx + 0xc); + *(int *)(this->m_SymmetricKey + 0xc) = in_EAX; + } + return in_EAX; +} + + + +// DWARF original prototype: bool isInitialized(TXTEASymmetricKey * this) + +bool __thiscall TXTEASymmetricKey::isInitialized(TXTEASymmetricKey *this) + +{ + int i; + int iVar1; + + iVar1 = 0; + do { + if (this->m_SymmetricKey[iVar1] != '\0') { + return true; + } + iVar1 = iVar1 + 1; + } while (iVar1 < 0x10); + return false; +} + + + +// DWARF original prototype: void encrypt(TXTEASymmetricKey * this, uchar * Data) + +void __thiscall TXTEASymmetricKey::encrypt(TXTEASymmetricKey *this,char *__block,int __edflag) + +{ + uint uVar1; + ulong v0; + uint uVar2; + ulong v1; + uint uVar3; + ulong sum; + uint uVar4; + ulong i; + uint uVar5; + + if (__block != (char *)0x0) { + uVar5 = 0; + uVar2 = *(uint *)__block; + uVar3 = *(uint *)(__block + 4); + uVar4 = 0; + do { + uVar5 = uVar5 + 1; + uVar1 = *(int *)(this->m_SymmetricKey + (uVar4 & 3) * 4) + uVar4; + uVar4 = uVar4 + 0x9e3779b9; + uVar2 = uVar2 + ((uVar3 << 4 ^ uVar3 >> 5) + uVar3 ^ uVar1); + uVar3 = uVar3 + ((uVar2 * 0x10 ^ uVar2 >> 5) + uVar2 ^ + *(int *)(this->m_SymmetricKey + (uVar4 >> 0xb & 3) * 4) + uVar4); + } while (uVar5 < 0x20); + *(uint *)__block = uVar2; + *(uint *)(__block + 4) = uVar3; + } + return; +} + + + +// DWARF original prototype: void decrypt(TXTEASymmetricKey * this, uchar * Data) + +int __thiscall +TXTEASymmetricKey::decrypt + (TXTEASymmetricKey *this,EVP_PKEY_CTX *ctx,uchar *out,size_t *outlen,uchar *in, + size_t inlen) + +{ + uint uVar1; + ulong v0; + uint uVar2; + ulong v1; + uint uVar3; + ulong sum; + uint uVar4; + ulong i; + uint uVar5; + + if (ctx != (EVP_PKEY_CTX *)0x0) { + uVar5 = 0; + uVar2 = *(uint *)ctx; + uVar3 = *(uint *)(ctx + 4); + uVar4 = 0xc6ef3720; + do { + uVar5 = uVar5 + 1; + uVar1 = *(int *)(this->m_SymmetricKey + (uVar4 >> 0xb & 3) * 4) + uVar4; + uVar4 = uVar4 + 0x61c88647; + uVar3 = uVar3 - ((uVar2 << 4 ^ uVar2 >> 5) + uVar2 ^ uVar1); + uVar2 = uVar2 - ((uVar3 * 0x10 ^ uVar3 >> 5) + uVar3 ^ + *(int *)(this->m_SymmetricKey + (uVar4 & 3) * 4) + uVar4); + } while (uVar5 < 0x20); + *(uint *)ctx = uVar2; + *(uint *)(ctx + 4) = uVar3; + } + return (int)ctx; +} + + + +void TXTEASymmetricKey::encrypt(char *__block,int __edflag) + +{ + uint uVar1; + ulong v0; + uint uVar2; + ulong v1; + uint uVar3; + ulong sum; + uint uVar4; + ulong i; + uint uVar5; + + uVar2 = *(uint *)__block; + uVar3 = *(uint *)(__block + 4); + uVar4 = 0; + uVar5 = 0; + do { + uVar5 = uVar5 + 1; + uVar1 = *(int *)(__edflag + (uVar4 & 3) * 4) + uVar4; + uVar4 = uVar4 + 0x9e3779b9; + uVar2 = uVar2 + ((uVar3 << 4 ^ uVar3 >> 5) + uVar3 ^ uVar1); + uVar3 = uVar3 + ((uVar2 * 0x10 ^ uVar2 >> 5) + uVar2 ^ + *(int *)(__edflag + (uVar4 >> 0xb & 3) * 4) + uVar4); + } while (uVar5 < 0x20); + *(uint *)__block = uVar2; + *(uint *)(__block + 4) = uVar3; + return; +} + + + +int TXTEASymmetricKey::decrypt(EVP_PKEY_CTX *ctx,uchar *out,size_t *outlen,uchar *in,size_t inlen) + +{ + uint uVar1; + ulong v0; + uint uVar2; + ulong v1; + uint uVar3; + ulong sum; + uint uVar4; + ulong i; + uint uVar5; + + uVar5 = 0; + uVar2 = *(uint *)ctx; + uVar3 = *(uint *)(ctx + 4); + uVar4 = 0xc6ef3720; + do { + uVar5 = uVar5 + 1; + uVar1 = *(int *)(out + (uVar4 >> 0xb & 3) * 4) + uVar4; + uVar4 = uVar4 + 0x61c88647; + uVar3 = uVar3 - ((uVar2 << 4 ^ uVar2 >> 5) + uVar2 ^ uVar1); + uVar2 = uVar2 - ((uVar3 * 0x10 ^ uVar3 >> 5) + uVar3 ^ + *(int *)(out + (uVar4 & 3) * 4) + uVar4); + } while (uVar5 < 0x20); + *(uint *)ctx = uVar2; + *(uint *)(ctx + 4) = uVar3; + return (int)ctx; +} + + + +// DWARF original prototype: void vlong_montgomery(vlong_montgomery * this, vlong * M) + +void __thiscall vlong_montgomery::vlong_montgomery(vlong_montgomery *this,vlong *M) + +{ + _func_int_varargs **pp_Var1; + uint *puVar2; + vlong_value *pvVar3; + int iVar4; + uint i; + int iVar5; + uint uVar6; + vlong_montgomery *__in_chrg; + vlong *a; + vlong *pvVar7; + vlong_montgomery *x; + undefined1 local_3c [4]; + vlong result; + vlong local_2c [2]; + + (this->R)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->R).value = pvVar3; + (this->R).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->R1)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea612 to 080ea656 has its CatchHandler @ 080ead98 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->R1).value = pvVar3; + (this->R1).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + pvVar7 = &this->m; + (this->m)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea66b to 080ea6af has its CatchHandler @ 080ead91 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->m).value = pvVar3; + (this->m).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->n1)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea6c4 to 080ea708 has its CatchHandler @ 080ead8a + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->n1).value = pvVar3; + (this->n1).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->T)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea71d to 080ea761 has its CatchHandler @ 080ead83 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->T).value = pvVar3; + (this->T).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->k)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea776 to 080ea7ba has its CatchHandler @ 080ead7c + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->k).value = pvVar3; + (this->k).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + pvVar3 = (this->m).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = M->value; + (this->m).value = pvVar3; + puVar2 = &pvVar3->share; + *puVar2 = *puVar2 + 1; + (this->m).negative = M->negative; + this->N = 0; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ea7f7 to 080ea8f5 has its CatchHandler @ 080ead75 + local_2c[0].value = (vlong_value *)operator_new(0x10); + ((local_2c[0].value)->super_vlong_flex_unit).z = 0; + ((local_2c[0].value)->super_vlong_flex_unit).a = (uint *)0x0; + (local_2c[0].value)->share = 0; + local_2c[0].negative = 0; + ((local_2c[0].value)->super_vlong_flex_unit).n = 0; + __in_chrg = (vlong_montgomery *)0x0; + vlong_flex_unit::set((vlong_flex_unit *)local_2c[0].value,0,1); + pvVar3 = (this->R).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = local_2c[0].value; + (this->R).value = local_2c[0].value; + (local_2c[0].value)->share = (local_2c[0].value)->share + 1; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + (this->R).negative = local_2c[0].negative; + if ((local_2c[0].value)->share == 0) { + if (local_2c[0].value != (vlong_value *)0x0) { + // try { // try from 080eab2d to 080eab31 has its CatchHandler @ 080ead75 + vlong_flex_unit::~vlong_flex_unit + (&(local_2c[0].value)->super_vlong_flex_unit,(int)__in_chrg); + operator_delete(pvVar3); + } + } + else { + (local_2c[0].value)->share = (local_2c[0].value)->share - 1; + } + while( true ) { + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + local_2c[0].negative = M->negative; + iVar4 = 0; + x = (vlong_montgomery *)M->value; + (x->R1)._vptr_vlong = (_func_int_varargs **)((int)(x->R1)._vptr_vlong + 1); + if (((this->R).negative != 0) && ((((this->R).value)->super_vlong_flex_unit).n != 0)) { + iVar4 = 1; + } + iVar5 = 0; + if ((local_2c[0].negative != 0) && ((x->R)._vptr_vlong != (_func_int_varargs **)0x0)) { + iVar5 = 1; + } + local_2c[0].value = (vlong_value *)x; + if (iVar4 == iVar5) { + // try { // try from 080eab18 to 080eab1c has its CatchHandler @ 080eabbc + iVar4 = vlong_value::cf((this->R).value,(vlong_value *)x); + __in_chrg = x; + } + else { + iVar4 = (uint)(iVar4 == 0) * 2 + -1; + } + vlong::~vlong(local_2c,(int)__in_chrg); + if (-1 < iVar4) break; + __in_chrg = this; + vlong::operator+=(&this->R,&this->R); + this->N = this->N + 1; + } + local_3c = (undefined1 [4])&PTR__vlong_08128410; + result.value = (vlong_value *)(this->R).negative; + result._vptr_vlong = (_func_int_varargs **)(this->R).value; + ((vlong_value *)result._vptr_vlong)->share = ((vlong_value *)result._vptr_vlong)->share + 1; + // try { // try from 080ea921 to 080ea925 has its CatchHandler @ 080ead15 + vlong::operator-=((vlong *)local_3c,pvVar7); + a = (vlong *)local_3c; + // try { // try from 080ea93a to 080ea93e has its CatchHandler @ 080ead1f + vlong::modinv(local_2c,a,pvVar7); + pvVar3 = (this->R1).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = local_2c[0].value; + (this->R1).value = local_2c[0].value; + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)((vlong *)&(local_2c[0].value)->share)->_vptr_vlong + 1); + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + (this->R1).negative = local_2c[0].negative; + pp_Var1 = ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong; + if (pp_Var1 == (_func_int_varargs **)0x0) { + if ((vlong_montgomery *)local_2c[0].value != (vlong_montgomery *)0x0) { + // try { // try from 080eaabd to 080eaac1 has its CatchHandler @ 080ead1f + vlong_flex_unit::~vlong_flex_unit(&(local_2c[0].value)->super_vlong_flex_unit,(int)a); + operator_delete(pvVar3); + } + } + else { + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)pp_Var1 - 1); + } + pp_Var1 = result._vptr_vlong; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + if (result._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (result._vptr_vlong != (_func_int_varargs **)0x0) { + // try { // try from 080eaaa0 to 080eaaa4 has its CatchHandler @ 080ead75 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)result._vptr_vlong,(int)a); + operator_delete(pp_Var1); + } + } + else { + result._vptr_vlong[3] = result._vptr_vlong[3] + -1; + } + // try { // try from 080ea9ac to 080ea9b0 has its CatchHandler @ 080ead75 + vlong::modinv(local_2c,pvVar7,&this->R); + local_3c = (undefined1 [4])&PTR__vlong_08128410; + result.value = (vlong_value *)(this->R).negative; + pvVar7 = local_2c; + result._vptr_vlong = (_func_int_varargs **)(this->R).value; + ((vlong_value *)result._vptr_vlong)->share = ((vlong_value *)result._vptr_vlong)->share + 1; + // try { // try from 080ea9d7 to 080ea9db has its CatchHandler @ 080ead58 + vlong::operator-=((vlong *)local_3c,pvVar7); + pvVar3 = (this->n1).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pp_Var1 = result._vptr_vlong; + (this->n1).value = (vlong_value *)result._vptr_vlong; + result._vptr_vlong[3] = result._vptr_vlong[3] + 1; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + (this->n1).negative = (int)result.value; + if (result._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (result._vptr_vlong != (_func_int_varargs **)0x0) { + // try { // try from 080eaa4e to 080eaa52 has its CatchHandler @ 080ead71 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)result._vptr_vlong,(int)pvVar7); + operator_delete(pp_Var1); + } + } + else { + result._vptr_vlong[3] = result._vptr_vlong[3] + -1; + } + pvVar3 = local_2c[0].value; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pp_Var1 = ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong; + if (pp_Var1 == (_func_int_varargs **)0x0) { + if ((vlong_montgomery *)local_2c[0].value != (vlong_montgomery *)0x0) { + // try { // try from 080eaa38 to 080eaa3c has its CatchHandler @ 080ead75 + vlong_flex_unit::~vlong_flex_unit + (&(local_2c[0].value)->super_vlong_flex_unit,(int)pvVar7); + operator_delete(pvVar3); + } + } + else { + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)pp_Var1 - 1); + } + return; +} + + + +// DWARF original prototype: void vlong_montgomery(vlong_montgomery * this, vlong * M) + +void __thiscall vlong_montgomery::vlong_montgomery(vlong_montgomery *this,vlong *M) + +{ + _func_int_varargs **pp_Var1; + uint *puVar2; + vlong_value *pvVar3; + int iVar4; + uint i; + int iVar5; + uint uVar6; + vlong_montgomery *__in_chrg; + vlong *a; + vlong *pvVar7; + vlong_montgomery *x; + undefined1 local_3c [4]; + vlong result; + vlong local_2c [2]; + + (this->R)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->R).value = pvVar3; + (this->R).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->R1)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eae12 to 080eae56 has its CatchHandler @ 080eb598 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->R1).value = pvVar3; + (this->R1).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + pvVar7 = &this->m; + (this->m)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eae6b to 080eaeaf has its CatchHandler @ 080eb591 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->m).value = pvVar3; + (this->m).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->n1)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eaec4 to 080eaf08 has its CatchHandler @ 080eb58a + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->n1).value = pvVar3; + (this->n1).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->T)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eaf1d to 080eaf61 has its CatchHandler @ 080eb583 + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->T).value = pvVar3; + (this->T).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + (this->k)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eaf76 to 080eafba has its CatchHandler @ 080eb57c + pvVar3 = (vlong_value *)operator_new(0x10); + (pvVar3->super_vlong_flex_unit).z = 0; + (pvVar3->super_vlong_flex_unit).a = (uint *)0x0; + pvVar3->share = 0; + (this->k).value = pvVar3; + (this->k).negative = 0; + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + pvVar3 = (this->m).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = M->value; + (this->m).value = pvVar3; + puVar2 = &pvVar3->share; + *puVar2 = *puVar2 + 1; + (this->m).negative = M->negative; + this->N = 0; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080eaff7 to 080eb0f5 has its CatchHandler @ 080eb575 + local_2c[0].value = (vlong_value *)operator_new(0x10); + ((local_2c[0].value)->super_vlong_flex_unit).z = 0; + ((local_2c[0].value)->super_vlong_flex_unit).a = (uint *)0x0; + (local_2c[0].value)->share = 0; + local_2c[0].negative = 0; + ((local_2c[0].value)->super_vlong_flex_unit).n = 0; + __in_chrg = (vlong_montgomery *)0x0; + vlong_flex_unit::set((vlong_flex_unit *)local_2c[0].value,0,1); + pvVar3 = (this->R).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = local_2c[0].value; + (this->R).value = local_2c[0].value; + (local_2c[0].value)->share = (local_2c[0].value)->share + 1; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + (this->R).negative = local_2c[0].negative; + if ((local_2c[0].value)->share == 0) { + if (local_2c[0].value != (vlong_value *)0x0) { + // try { // try from 080eb32d to 080eb331 has its CatchHandler @ 080eb575 + vlong_flex_unit::~vlong_flex_unit + (&(local_2c[0].value)->super_vlong_flex_unit,(int)__in_chrg); + operator_delete(pvVar3); + } + } + else { + (local_2c[0].value)->share = (local_2c[0].value)->share - 1; + } + while( true ) { + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + local_2c[0].negative = M->negative; + iVar4 = 0; + x = (vlong_montgomery *)M->value; + (x->R1)._vptr_vlong = (_func_int_varargs **)((int)(x->R1)._vptr_vlong + 1); + if (((this->R).negative != 0) && ((((this->R).value)->super_vlong_flex_unit).n != 0)) { + iVar4 = 1; + } + iVar5 = 0; + if ((local_2c[0].negative != 0) && ((x->R)._vptr_vlong != (_func_int_varargs **)0x0)) { + iVar5 = 1; + } + local_2c[0].value = (vlong_value *)x; + if (iVar4 == iVar5) { + // try { // try from 080eb318 to 080eb31c has its CatchHandler @ 080eb3bc + iVar4 = vlong_value::cf((this->R).value,(vlong_value *)x); + __in_chrg = x; + } + else { + iVar4 = (uint)(iVar4 == 0) * 2 + -1; + } + vlong::~vlong(local_2c,(int)__in_chrg); + if (-1 < iVar4) break; + __in_chrg = this; + vlong::operator+=(&this->R,&this->R); + this->N = this->N + 1; + } + local_3c = (undefined1 [4])&PTR__vlong_08128410; + result.value = (vlong_value *)(this->R).negative; + result._vptr_vlong = (_func_int_varargs **)(this->R).value; + ((vlong_value *)result._vptr_vlong)->share = ((vlong_value *)result._vptr_vlong)->share + 1; + // try { // try from 080eb121 to 080eb125 has its CatchHandler @ 080eb515 + vlong::operator-=((vlong *)local_3c,pvVar7); + a = (vlong *)local_3c; + // try { // try from 080eb13a to 080eb13e has its CatchHandler @ 080eb51f + vlong::modinv(local_2c,a,pvVar7); + pvVar3 = (this->R1).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pvVar3 = local_2c[0].value; + (this->R1).value = local_2c[0].value; + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)((vlong *)&(local_2c[0].value)->share)->_vptr_vlong + 1); + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + (this->R1).negative = local_2c[0].negative; + pp_Var1 = ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong; + if (pp_Var1 == (_func_int_varargs **)0x0) { + if ((vlong_montgomery *)local_2c[0].value != (vlong_montgomery *)0x0) { + // try { // try from 080eb2bd to 080eb2c1 has its CatchHandler @ 080eb51f + vlong_flex_unit::~vlong_flex_unit(&(local_2c[0].value)->super_vlong_flex_unit,(int)a); + operator_delete(pvVar3); + } + } + else { + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)pp_Var1 - 1); + } + pp_Var1 = result._vptr_vlong; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + if (result._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (result._vptr_vlong != (_func_int_varargs **)0x0) { + // try { // try from 080eb2a0 to 080eb2a4 has its CatchHandler @ 080eb575 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)result._vptr_vlong,(int)a); + operator_delete(pp_Var1); + } + } + else { + result._vptr_vlong[3] = result._vptr_vlong[3] + -1; + } + // try { // try from 080eb1ac to 080eb1b0 has its CatchHandler @ 080eb575 + vlong::modinv(local_2c,pvVar7,&this->R); + local_3c = (undefined1 [4])&PTR__vlong_08128410; + result.value = (vlong_value *)(this->R).negative; + pvVar7 = local_2c; + result._vptr_vlong = (_func_int_varargs **)(this->R).value; + ((vlong_value *)result._vptr_vlong)->share = ((vlong_value *)result._vptr_vlong)->share + 1; + // try { // try from 080eb1d7 to 080eb1db has its CatchHandler @ 080eb558 + vlong::operator-=((vlong *)local_3c,pvVar7); + pvVar3 = (this->n1).value; + if (pvVar3->share == 0) { + if (pvVar3 != (vlong_value *)0x0) { + uVar6 = (pvVar3->super_vlong_flex_unit).z; + while (uVar6 != 0) { + uVar6 = uVar6 - 1; + (pvVar3->super_vlong_flex_unit).a[uVar6] = 0; + } + puVar2 = (pvVar3->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar3); + } + } + else { + pvVar3->share = pvVar3->share - 1; + } + pp_Var1 = result._vptr_vlong; + (this->n1).value = (vlong_value *)result._vptr_vlong; + result._vptr_vlong[3] = result._vptr_vlong[3] + 1; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + (this->n1).negative = (int)result.value; + if (result._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (result._vptr_vlong != (_func_int_varargs **)0x0) { + // try { // try from 080eb24e to 080eb252 has its CatchHandler @ 080eb571 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)result._vptr_vlong,(int)pvVar7); + operator_delete(pp_Var1); + } + } + else { + result._vptr_vlong[3] = result._vptr_vlong[3] + -1; + } + pvVar3 = local_2c[0].value; + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pp_Var1 = ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong; + if (pp_Var1 == (_func_int_varargs **)0x0) { + if ((vlong_montgomery *)local_2c[0].value != (vlong_montgomery *)0x0) { + // try { // try from 080eb238 to 080eb23c has its CatchHandler @ 080eb575 + vlong_flex_unit::~vlong_flex_unit + (&(local_2c[0].value)->super_vlong_flex_unit,(int)pvVar7); + operator_delete(pvVar3); + } + } + else { + ((vlong *)&(local_2c[0].value)->share)->_vptr_vlong = + (_func_int_varargs **)((int)pp_Var1 - 1); + } + return; +} + + + +// DWARF original prototype: void mul(vlong_montgomery * this, vlong * x, vlong * y) + +void __thiscall vlong_montgomery::mul(vlong_montgomery *this,vlong *x,vlong *y) + +{ + uint uVar1; + sbyte sVar2; + vlong_value *pvVar3; + uint uVar4; + int iVar5; + uint u; + uint x_00; + int iVar6; + uint i; + vlong_value *i_00; + vlong_value *pvVar7; + uint uVar8; + vlong_value *pvVar9; + vlong_value *pvVar10; + byte local_34; + uint delta; + vlong_value *local_28; + int local_24; + + vlong_flex_unit::fast_mul + (&((this->T).value)->super_vlong_flex_unit,&x->value->super_vlong_flex_unit, + &y->value->super_vlong_flex_unit,this->N * 2); + vlong_flex_unit::fast_mul + (&((this->k).value)->super_vlong_flex_unit,&((this->T).value)->super_vlong_flex_unit, + &((this->n1).value)->super_vlong_flex_unit,this->N); + vlong_flex_unit::fast_mul + (&x->value->super_vlong_flex_unit,&((this->k).value)->super_vlong_flex_unit, + &((this->m).value)->super_vlong_flex_unit,this->N * 2); + pvVar9 = (vlong_value *)&this->T; + vlong::operator+=(x,(vlong *)pvVar9); + pvVar10 = x->value; + uVar1 = this->N; + pvVar3 = (vlong_value *)(pvVar10->super_vlong_flex_unit).n; + uVar8 = uVar1 & 0x1f; + if (pvVar3 != (vlong_value *)0x0) { + sVar2 = (sbyte)uVar8; + local_34 = 0x20 - sVar2; + i_00 = (vlong_value *)0x0; + do { + x_00 = 0; + pvVar9 = (vlong_value *)((int)&(i_00->super_vlong_flex_unit).n + (uVar1 >> 5)); + if (pvVar9 < pvVar3) { + x_00 = (pvVar10->super_vlong_flex_unit).a[(int)pvVar9]; + } + if (uVar8 != 0) { + uVar4 = 0; + pvVar9 = (vlong_value *)((int)&(pvVar9->super_vlong_flex_unit).n + 1); + if (pvVar9 < pvVar3) { + uVar4 = (pvVar10->super_vlong_flex_unit).a[(int)pvVar9]; + } + x_00 = (x_00 >> sVar2) + (uVar4 << (local_34 & 0x1f)); + } + pvVar7 = (vlong_value *)((int)&(i_00->super_vlong_flex_unit).n + 1); + pvVar9 = i_00; + vlong_flex_unit::set(&pvVar10->super_vlong_flex_unit,(uint)i_00,x_00); + pvVar3 = (vlong_value *)(pvVar10->super_vlong_flex_unit).n; + i_00 = pvVar7; + } while (pvVar7 < pvVar3); + } + delta = (uint)&PTR__vlong_08128410; + iVar5 = 0; + local_24 = (this->m).negative; + pvVar10 = (this->m).value; + pvVar10->share = pvVar10->share + 1; + if ((x->negative != 0) && ((x->value->super_vlong_flex_unit).n != 0)) { + iVar5 = 1; + } + iVar6 = 0; + if ((local_24 != 0) && ((pvVar10->super_vlong_flex_unit).n != 0)) { + iVar6 = 1; + } + local_28 = pvVar10; + if (iVar5 == iVar6) { + // try { // try from 080eb76a to 080eb76e has its CatchHandler @ 080eb771 + iVar5 = vlong_value::cf(x->value,pvVar10); + pvVar9 = pvVar10; + } + else { + iVar5 = (uint)(iVar5 == 0) * 2 + -1; + } + vlong::~vlong((vlong *)&delta,(int)pvVar9); + if (-1 < iVar5) { + vlong::operator-=(x,&this->m); + } + return; +} + + + +// DWARF original prototype: vlong exp(vlong_montgomery * this, vlong * x, vlong * e) + +double __thiscall vlong_montgomery::exp(vlong_montgomery *this,double __x) + +{ + vlong_flex_unit *x; + _func_int_varargs **pp_Var1; + vlong_value *x_00; + uint uVar2; + uint uVar3; + vlong_value *pvVar4; + uint x_2; + uint i; + uint uVar5; + longdouble extraout_ST0; + longdouble lVar6; + longdouble extraout_ST0_00; + longdouble extraout_ST0_01; + longdouble extraout_ST0_02; + vlong *result_5; + int in_stack_00000010; + uint uVar7; + uint local_84; + uint *local_80; + undefined1 local_5c [4]; + vlong_value divide; + vlong result_2; + undefined1 local_3c [4]; + vlong t; + undefined1 local_2c [4]; + vlong result; + + local_2c = (undefined1 [4])&PTR__vlong_08128410; + result.value = (vlong_value *)result_5->negative; + result._vptr_vlong = (_func_int_varargs **)result_5->value; + ((vlong_value *)result._vptr_vlong)->share = ((vlong_value *)result._vptr_vlong)->share + 1; + // try { // try from 080eb7cb to 080eb7cf has its CatchHandler @ 080ebce1 + vlong::operator-=((vlong *)local_2c,result_5 + 2); + divide.share = (uint)&PTR__vlong_08128410; + // try { // try from 080eb7de to 080eb81f has its CatchHandler @ 080ebdf0 + x_00 = (vlong_value *)operator_new(0x10); + (x_00->super_vlong_flex_unit).z = 0; + (x_00->super_vlong_flex_unit).a = (uint *)0x0; + x_00->share = 0; + (x_00->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)x_00,0,0); + x = *(vlong_flex_unit **)(__x._4_4_ + 4); + pvVar4 = result_5->value; + uVar5 = x->n << 5; + do { + uVar7 = uVar5; + if (uVar7 == 0) break; + uVar5 = uVar7 - 1; + if (uVar5 >> 5 < x->n) { + uVar2 = x->a[uVar5 >> 5]; + } + else { + uVar2 = 0; + } + } while ((1 << ((byte)uVar5 & 0x1f) & uVar2) == 0); + uVar5 = (pvVar4->super_vlong_flex_unit).n << 5; + do { + uVar2 = uVar5; + if (uVar2 == 0) break; + uVar5 = uVar2 - 1; + if (uVar5 >> 5 < (pvVar4->super_vlong_flex_unit).n) { + uVar3 = (pvVar4->super_vlong_flex_unit).a[uVar5 >> 5]; + } + else { + uVar3 = 0; + } + } while ((1 << ((byte)uVar5 & 0x1f) & uVar3) == 0); + // try { // try from 080eb8c8 to 080eb8cc has its CatchHandler @ 080ebcf0 + vlong_flex_unit::fast_mul + ((vlong_flex_unit *)x_00,x,&pvVar4->super_vlong_flex_unit,uVar2 + uVar7); + local_3c = (undefined1 [4])&PTR__vlong_08128410; + uVar5 = result_5->negative; + uVar7 = *(uint *)(__x._4_4_ + 8); + // try { // try from 080eb8ec to 080eb92d has its CatchHandler @ 080ebd80 + t._vptr_vlong = (_func_int_varargs **)operator_new(0x10); + ((vlong_flex_unit *)t._vptr_vlong)->z = 0; + ((vlong_flex_unit *)t._vptr_vlong)->a = (uint *)0x0; + ((vlong_flex_unit *)((int)t._vptr_vlong + 0xc))->n = 0; + t.value = (vlong_value *)0x0; + ((vlong_flex_unit *)t._vptr_vlong)->n = 0; + vlong_flex_unit::set((vlong_flex_unit *)t._vptr_vlong,0,0); + divide.super_vlong_flex_unit.a = (uint *)0x0; + divide.super_vlong_flex_unit.n = 0; + local_5c = (undefined1 [4])0x0; + divide.super_vlong_flex_unit.z = 0; + pvVar4 = x_00; + // try { // try from 080eb968 to 080eb96c has its CatchHandler @ 080ebd33 + vlong_value::divide((vlong_value *)local_5c,x_00,result_5[2].value,(vlong_value *)t._vptr_vlong) + ; + t.value = (vlong_value *)(uVar5 ^ uVar7); + // try { // try from 080eb979 to 080eb97d has its CatchHandler @ 080ebd78 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)local_5c,(int)pvVar4); + divide.share = (uint)&PTR__vlong_08128410; + if (x_00->share == 0) { + if (x_00 != (vlong_value *)0x0) { + // try { // try from 080ebcb3 to 080ebcb7 has its CatchHandler @ 080ebdf0 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)x_00,(int)pvVar4); + operator_delete(x_00); + } + } + else { + x_00->share = x_00->share - 1; + } + local_80 = *(uint **)(in_stack_00000010 + 4); + uVar5 = *local_80 << 5; + do { + uVar7 = uVar5; + if (uVar7 == 0) break; + uVar5 = uVar7 - 1; + if (uVar5 >> 5 < *local_80) { + uVar2 = *(uint *)(local_80[1] + (uVar5 >> 5) * 4); + } + else { + uVar2 = 0; + } + } while ((1 << ((byte)uVar5 & 0x1f) & uVar2) == 0); + uVar5 = 0; + while( true ) { + if (uVar5 >> 5 < *local_80) { + uVar2 = *(uint *)(local_80[1] + (uVar5 >> 5) * 4); + } + else { + uVar2 = 0; + } + if ((1 << ((byte)uVar5 & 0x1f) & uVar2) != 0) { + mul((vlong_montgomery *)result_5,(vlong *)local_2c,(vlong *)local_3c); + } + uVar5 = uVar5 + 1; + if (uVar5 == uVar7) break; + // try { // try from 080eba0f to 080eba77 has its CatchHandler @ 080ebde7 + mul((vlong_montgomery *)result_5,(vlong *)local_3c,(vlong *)local_3c); + local_80 = *(uint **)(in_stack_00000010 + 4); + } + local_5c = (undefined1 [4])&PTR__vlong_08128410; + divide.super_vlong_flex_unit.n = (uint)operator_new(0x10); + ((vlong_flex_unit *)divide.super_vlong_flex_unit.n)->z = 0; + ((vlong_flex_unit *)divide.super_vlong_flex_unit.n)->a = (uint *)0x0; + ((vlong_flex_unit *)(divide.super_vlong_flex_unit.n + 0xc))->n = 0; + divide.super_vlong_flex_unit.a = (uint *)0x0; + ((vlong_flex_unit *)divide.super_vlong_flex_unit.n)->n = 0; + vlong_flex_unit::set((vlong_flex_unit *)divide.super_vlong_flex_unit.n,0,0); + pvVar4 = result_5[1].value; + uVar5 = (int)*result._vptr_vlong << 5; + do { + uVar7 = uVar5; + if (uVar7 == 0) break; + uVar5 = uVar7 - 1; + if ((_func_int_varargs *)(uVar5 >> 5) < *result._vptr_vlong) { + uVar2 = *(uint *)(result._vptr_vlong[1] + (int)(uVar5 >> 5) * 4); + } + else { + uVar2 = 0; + } + } while ((1 << ((byte)uVar5 & 0x1f) & uVar2) == 0); + uVar5 = (pvVar4->super_vlong_flex_unit).n << 5; + do { + uVar2 = uVar5; + if (uVar2 == 0) break; + uVar5 = uVar2 - 1; + if (uVar5 >> 5 < (pvVar4->super_vlong_flex_unit).n) { + local_84 = (pvVar4->super_vlong_flex_unit).a[uVar5 >> 5]; + } + else { + local_84 = 0; + } + } while ((local_84 & 1 << ((byte)uVar5 & 0x1f)) == 0); + // try { // try from 080ebb09 to 080ebb0d has its CatchHandler @ 080ebd84 + vlong_flex_unit::fast_mul + ((vlong_flex_unit *)divide.super_vlong_flex_unit.n, + (vlong_flex_unit *)result._vptr_vlong,&pvVar4->super_vlong_flex_unit,uVar2 + uVar7); + divide.super_vlong_flex_unit.a = (uint *)(result_5[1].negative ^ (uint)result.value); + (this->R)._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ebb2c to 080ebb70 has its CatchHandler @ 080ebde3 + pvVar4 = (vlong_value *)operator_new(0x10); + (pvVar4->super_vlong_flex_unit).z = 0; + (pvVar4->super_vlong_flex_unit).a = (uint *)0x0; + pvVar4->share = 0; + (this->R).value = pvVar4; + (this->R).negative = 0; + (pvVar4->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar4,0,0); + divide.share = 0; + uVar7 = divide.super_vlong_flex_unit.n; + // try { // try from 080ebbae to 080ebbb2 has its CatchHandler @ 080ebd9d + vlong_value::divide((vlong_value *)÷.share,(vlong_value *)divide.super_vlong_flex_unit.n, + result_5[2].value,(this->R).value); + (this->R).negative = (int)divide.super_vlong_flex_unit.a; + // try { // try from 080ebbbf to 080ebbc3 has its CatchHandler @ 080ebddf + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)÷.share,uVar7); + uVar5 = divide.super_vlong_flex_unit.n; + local_5c = (undefined1 [4])&PTR__vlong_08128410; + lVar6 = extraout_ST0; + if (*(int *)(divide.super_vlong_flex_unit.n + 0xc) == 0) { + if (divide.super_vlong_flex_unit.n != 0) { + // try { // try from 080ebc46 to 080ebc89 has its CatchHandler @ 080ebde7 + vlong_flex_unit::~vlong_flex_unit + ((vlong_flex_unit *)divide.super_vlong_flex_unit.n,uVar7); + operator_delete((void *)uVar5); + lVar6 = extraout_ST0_02; + } + } + else { + *(int *)(divide.super_vlong_flex_unit.n + 0xc) = + *(int *)(divide.super_vlong_flex_unit.n + 0xc) + -1; + } + pp_Var1 = t._vptr_vlong; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + if (t._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (t._vptr_vlong != (_func_int_varargs **)0x0) { + // try { // try from 080ebc30 to 080ebc34 has its CatchHandler @ 080ebdf0 + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)t._vptr_vlong,uVar7); + operator_delete(pp_Var1); + lVar6 = extraout_ST0_01; + } + } + else { + t._vptr_vlong[3] = t._vptr_vlong[3] + -1; + } + pp_Var1 = result._vptr_vlong; + local_2c = (undefined1 [4])&PTR__vlong_08128410; + if (result._vptr_vlong[3] == (_func_int_varargs *)0x0) { + if (result._vptr_vlong != (_func_int_varargs **)0x0) { + vlong_flex_unit::~vlong_flex_unit((vlong_flex_unit *)result._vptr_vlong,uVar7); + operator_delete(pp_Var1); + lVar6 = extraout_ST0_00; + } + } + else { + result._vptr_vlong[3] = result._vptr_vlong[3] + -1; + } + return (double)lVar6; +} + + + +// DWARF original prototype: void vlong_flex_unit(vlong_flex_unit * this) + +void __thiscall vlong_flex_unit::vlong_flex_unit(vlong_flex_unit *this) + +{ + this->z = 0; + this->a = (uint *)0x0; + this->n = 0; + return; +} + + + +// DWARF original prototype: void vlong_flex_unit(vlong_flex_unit * this) + +void __thiscall vlong_flex_unit::vlong_flex_unit(vlong_flex_unit *this) + +{ + this->z = 0; + this->a = (uint *)0x0; + this->n = 0; + return; +} + + + +// DWARF original prototype: void ~vlong_flex_unit(vlong_flex_unit * this, int __in_chrg) + +void __thiscall vlong_flex_unit::~vlong_flex_unit(vlong_flex_unit *this,int __in_chrg) + +{ + uint i; + uint uVar1; + + uVar1 = this->z; + while (uVar1 != 0) { + uVar1 = uVar1 - 1; + this->a[uVar1] = 0; + } + if (this->a == (uint *)0x0) { + return; + } + operator_delete__(this->a); + return; +} + + + +// DWARF original prototype: void ~vlong_flex_unit(vlong_flex_unit * this, int __in_chrg) + +void __thiscall vlong_flex_unit::~vlong_flex_unit(vlong_flex_unit *this,int __in_chrg) + +{ + uint i; + uint uVar1; + + uVar1 = this->z; + while (uVar1 != 0) { + uVar1 = uVar1 - 1; + this->a[uVar1] = 0; + } + if (this->a == (uint *)0x0) { + return; + } + operator_delete__(this->a); + return; +} + + + +// DWARF original prototype: uint get(vlong_flex_unit * this, uint i) + +uint __thiscall vlong_flex_unit::get(vlong_flex_unit *this,uint i) + +{ + uint uVar1; + + if (i < this->n) { + uVar1 = this->a[i]; + } + else { + uVar1 = 0; + } + return uVar1; +} + + + +// DWARF original prototype: void clear(vlong_flex_unit * this) + +void __thiscall vlong_flex_unit::clear(vlong_flex_unit *this) + +{ + this->n = 0; + return; +} + + + +// DWARF original prototype: void reserve(vlong_flex_unit * this, uint x) + +void __thiscall vlong_flex_unit::reserve(vlong_flex_unit *this,uint x) + +{ + uint *puVar1; + uint i; + uint uVar2; + uint *na; + + if (this->z < x) { + puVar1 = (uint *)operator_new__(x * 4); + uVar2 = 0; + if (this->n != 0) { + do { + puVar1[uVar2] = this->a[uVar2]; + uVar2 = uVar2 + 1; + } while (uVar2 < this->n); + } + if (this->a != (uint *)0x0) { + operator_delete__(this->a); + } + this->a = puVar1; + this->z = x; + } + return; +} + + + +// DWARF original prototype: void set(vlong_flex_unit * this, uint i, uint x) + +void __thiscall vlong_flex_unit::set(vlong_flex_unit *this,uint i,uint x) + +{ + uint uVar1; + uint uVar2; + uint *puVar3; + uint j; + uint uVar4; + uint *na; + + uVar4 = this->n; + if (i < uVar4) { + this->a[i] = x; + if ((x == 0) && (uVar4 = this->n, uVar4 != 0)) { + uVar1 = this->a[uVar4 - 1]; + while (uVar1 == 0) { + uVar2 = uVar4 - 1; + this->n = uVar2; + if (uVar2 == 0) { + return; + } + uVar1 = this->a[uVar4 - 2]; + uVar4 = uVar2; + } + } + } + else if (x != 0) { + uVar1 = i + 1; + if (this->z < uVar1) { + puVar3 = (uint *)operator_new__(uVar1 * 4); + uVar2 = 0; + uVar4 = this->n; + if (uVar4 != 0) { + do { + puVar3[uVar2] = this->a[uVar2]; + uVar2 = uVar2 + 1; + uVar4 = this->n; + } while (uVar2 < uVar4); + } + if (this->a != (uint *)0x0) { + operator_delete__(this->a); + uVar4 = this->n; + } + this->a = puVar3; + this->z = uVar1; + } + for (; uVar4 < i; uVar4 = uVar4 + 1) { + this->a[uVar4] = 0; + } + this->a[i] = x; + this->n = uVar1; + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: i +// DWARF original prototype: void fast_mul(vlong_flex_unit * this, vlong_flex_unit * x, +// vlong_flex_unit * y, uint keep) + +void __thiscall +vlong_flex_unit::fast_mul(vlong_flex_unit *this,vlong_flex_unit *x,vlong_flex_unit *y,uint keep) + +{ + uint *puVar1; + uint m; + uint *puVar2; + uint p; + uint v; + uint uVar3; + uint uVar4; + uint uVar5; + uint *na; + uint uVar6; + uint c; + uint uVar7; + int iVar8; + uint w; + uint uVar9; + uint uVar10; + uint uVar11; + uint local_24; + uint j; + uint min_1; + uint min; + uint limit; + uint i; + + min = keep + 0x1f >> 5; + if (this->z < min) { + puVar2 = (uint *)operator_new__(min << 2); + uVar5 = 0; + if (this->n != 0) { + do { + puVar2[uVar5] = this->a[uVar5]; + uVar5 = uVar5 + 1; + } while (uVar5 < this->n); + } + if (this->a != (uint *)0x0) { + operator_delete__(this->a); + } + this->a = puVar2; + this->z = min; + } + limit = 0; + if (min != 0) { + do { + this->a[limit] = 0; + limit = limit + 1; + } while (limit < min); + } + limit = 0; + uVar5 = min; + if (x->n <= min) { + uVar5 = x->n; + } + if (uVar5 != 0) { + do { + uVar7 = 0; + uVar9 = limit + y->n; + uVar3 = min; + if (uVar9 <= min) { + uVar3 = uVar9; + } + local_24 = limit; + if (limit < uVar3) { + uVar10 = x->a[limit] & 0xffff; + uVar9 = x->a[limit] >> 0x10; + uVar7 = 0; + do { + uVar4 = this->a[local_24] + uVar7; + uVar7 = (uint)(uVar4 < uVar7); + uVar6 = y->a[local_24 - limit] & 0xffff; + uVar11 = uVar10 * uVar6; + uVar4 = uVar4 + uVar11; + if (uVar4 < uVar11) { + uVar7 = uVar7 + 1; + } + uVar6 = uVar9 * uVar6; + uVar11 = uVar6 * 0x10000; + uVar4 = uVar4 + uVar11; + iVar8 = uVar7 + (uVar6 >> 0x10); + if (uVar4 < uVar11) { + iVar8 = iVar8 + 1; + } + uVar7 = y->a[local_24 - limit] >> 0x10; + uVar6 = uVar10 * uVar7; + uVar11 = uVar6 * 0x10000; + iVar8 = iVar8 + (uVar6 >> 0x10); + uVar4 = uVar4 + uVar11; + if (uVar4 < uVar11) { + iVar8 = iVar8 + 1; + } + uVar7 = iVar8 + uVar7 * uVar9; + this->a[local_24] = uVar4; + local_24 = local_24 + 1; + } while (local_24 < uVar3); + } + if ((uVar7 != 0) && (local_24 < min)) { + puVar2 = this->a; + do { + puVar2[local_24] = puVar2[local_24] + uVar7; + puVar2 = this->a; + puVar1 = puVar2 + local_24; + local_24 = local_24 + 1; + uVar7 = (uint)(*puVar1 < uVar7); + if (uVar7 == 0) break; + } while (local_24 < min); + } + limit = limit + 1; + } while (limit < uVar5); + } + if ((keep & 0x1f) != 0) { + this->a[min - 1] = this->a[min - 1] & (1 << (sbyte)(keep & 0x1f)) - 1U; + } + if ((min != 0) && (this->a[min - 1] == 0)) { + puVar2 = this->a + (min - 1); + do { + puVar2 = puVar2 + -1; + min = min - 1; + if (min == 0) break; + } while (*puVar2 == 0); + } + this->n = min; + return; +} + + + +// DWARF original name: operator unsigned int +// DWARF original prototype: uint operator_unsigned_int(vlong_value * this) + +uint __thiscall vlong_value::operator_unsigned_int(vlong_value *this) + +{ + uint uVar1; + + if ((this->super_vlong_flex_unit).n == 0) { + uVar1 = 0; + } + else { + uVar1 = *(this->super_vlong_flex_unit).a; + } + return uVar1; +} + + + +// DWARF original prototype: int is_zero(vlong_value * this) + +int __thiscall vlong_value::is_zero(vlong_value *this) + +{ + return (uint)((this->super_vlong_flex_unit).n == 0); +} + + + +// DWARF original prototype: int test(vlong_value * this, uint i) + +int __thiscall vlong_value::test(vlong_value *this,uint i) + +{ + uint uVar1; + + if (i >> 5 < (this->super_vlong_flex_unit).n) { + uVar1 = (this->super_vlong_flex_unit).a[i >> 5]; + } + else { + uVar1 = 0; + } + return (uint)((1 << ((byte)i & 0x1f) & uVar1) != 0); +} + + + +// DWARF original prototype: uint bits(vlong_value * this) + +uint __thiscall vlong_value::bits(vlong_value *this) + +{ + uint uVar1; + uint uVar2; + uint x; + uint uVar3; + + uVar1 = (this->super_vlong_flex_unit).n << 5; + do { + uVar3 = uVar1; + if (uVar3 == 0) { + return 0; + } + uVar1 = uVar3 - 1; + if (uVar1 >> 5 < (this->super_vlong_flex_unit).n) { + uVar2 = (this->super_vlong_flex_unit).a[uVar1 >> 5]; + } + else { + uVar2 = 0; + } + } while ((1 << ((byte)uVar1 & 0x1f) & uVar2) == 0); + return uVar3; +} + + + +// DWARF original prototype: int cf(vlong_value * this, vlong_value * x) + +int __thiscall vlong_value::cf(vlong_value *this,vlong_value *x) + +{ + uint uVar1; + uint uVar2; + int iVar3; + uint uVar4; + uint i; + uint uVar5; + uint uVar6; + + uVar1 = (this->super_vlong_flex_unit).n; + uVar2 = (x->super_vlong_flex_unit).n; + iVar3 = 1; + if ((uVar1 <= uVar2) && (iVar3 = -1, uVar5 = uVar1, uVar2 <= uVar1)) { + do { + if (uVar5 == 0) { + return 0; + } + uVar5 = uVar5 - 1; + uVar6 = 0; + if (uVar5 < uVar1) { + uVar6 = (this->super_vlong_flex_unit).a[uVar5]; + } + uVar4 = 0; + if (uVar5 < uVar2) { + uVar4 = (x->super_vlong_flex_unit).a[uVar5]; + } + if (uVar4 < uVar6) { + return 1; + } + if (uVar5 < (this->super_vlong_flex_unit).n) { + uVar6 = (this->super_vlong_flex_unit).a[uVar5]; + } + else { + uVar6 = 0; + } + if (uVar5 < (x->super_vlong_flex_unit).n) { + uVar4 = (x->super_vlong_flex_unit).a[uVar5]; + } + else { + uVar4 = 0; + } + iVar3 = -1; + } while (uVar4 <= uVar6); + } + return iVar3; +} + + + +// WARNING: Variable defined which should be unmapped: N +// DWARF original prototype: void shl(vlong_value * this) + +void __thiscall vlong_value::shl(vlong_value *this) + +{ + uint uVar1; + uint uVar2; + uint carry; + uint uVar3; + uint uVar4; + uint i; + uint i_00; + uint N; + + uVar3 = 0; + uVar1 = (this->super_vlong_flex_unit).n; + uVar2 = uVar1; + i_00 = 0; + while( true ) { + uVar4 = 0; + if (i_00 < uVar2) { + uVar4 = (this->super_vlong_flex_unit).a[i_00]; + } + vlong_flex_unit::set(&this->super_vlong_flex_unit,i_00,uVar3 + uVar4 * 2); + uVar3 = uVar4 >> 0x1f; + if (uVar1 < i_00 + 1) break; + uVar2 = (this->super_vlong_flex_unit).n; + i_00 = i_00 + 1; + } + return; +} + + + +// DWARF original prototype: void shr(vlong_value * this) + +void __thiscall vlong_value::shr(vlong_value *this) + +{ + uint uVar1; + uint carry; + int iVar2; + uint i; + uint i_00; + uint uVar3; + + iVar2 = 0; + uVar1 = (this->super_vlong_flex_unit).n; + i_00 = uVar1; + if (uVar1 != 0) { + while( true ) { + i_00 = i_00 - 1; + uVar3 = 0; + if (i_00 < uVar1) { + uVar3 = (this->super_vlong_flex_unit).a[i_00]; + } + vlong_flex_unit::set(&this->super_vlong_flex_unit,i_00,(uVar3 >> 1) + iVar2); + iVar2 = uVar3 << 0x1f; + if (i_00 == 0) break; + uVar1 = (this->super_vlong_flex_unit).n; + } + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: delta +// DWARF original prototype: void shr(vlong_value * this, uint x) + +void __thiscall vlong_value::shr(vlong_value *this,uint x) + +{ + sbyte sVar1; + uint uVar2; + uint uVar3; + uint uVar4; + uint u; + uint x_00; + uint i; + uint i_00; + byte local_18; + uint delta; + + uVar2 = (this->super_vlong_flex_unit).n; + if (uVar2 != 0) { + sVar1 = (sbyte)(x & 0x1f); + local_18 = 0x20 - sVar1; + i_00 = 0; + do { + x_00 = 0; + uVar4 = (x >> 5) + i_00; + if (uVar4 < uVar2) { + x_00 = (this->super_vlong_flex_unit).a[uVar4]; + } + if ((x & 0x1f) != 0) { + uVar3 = 0; + if (uVar4 + 1 < uVar2) { + uVar3 = (this->super_vlong_flex_unit).a[uVar4 + 1]; + } + x_00 = (x_00 >> sVar1) + (uVar3 << (local_18 & 0x1f)); + } + uVar4 = i_00 + 1; + vlong_flex_unit::set(&this->super_vlong_flex_unit,i_00,x_00); + uVar2 = (this->super_vlong_flex_unit).n; + i_00 = uVar4; + } while (uVar4 < uVar2); + } + return; +} + + + +// DWARF original prototype: void add(vlong_value * this, vlong_value * x) + +void __thiscall vlong_value::add(vlong_value *this,vlong_value *x) + +{ + uint *puVar1; + uint uVar2; + uint *puVar3; + uint uVar4; + uint u; + uint i; + uint uVar5; + uint uVar6; + uint carry; + uint uVar7; + uint max; + uint uVar8; + + uVar8 = (this->super_vlong_flex_unit).n; + uVar5 = (x->super_vlong_flex_unit).n; + if (uVar8 < uVar5) { + uVar8 = uVar5; + } + if ((this->super_vlong_flex_unit).z < uVar8) { + puVar3 = (uint *)operator_new__(uVar8 * 4); + uVar5 = 0; + if ((this->super_vlong_flex_unit).n != 0) { + do { + puVar3[uVar5] = (this->super_vlong_flex_unit).a[uVar5]; + uVar5 = uVar5 + 1; + } while (uVar5 < (this->super_vlong_flex_unit).n); + } + puVar1 = (this->super_vlong_flex_unit).a; + if (puVar1 != (uint *)0x0) { + operator_delete__(puVar1); + } + (this->super_vlong_flex_unit).a = puVar3; + (this->super_vlong_flex_unit).z = uVar8; + } + uVar7 = 0; + uVar5 = 0; + if (uVar8 != 0xffffffff) { + do { + if (uVar5 < (this->super_vlong_flex_unit).n) { + uVar2 = (this->super_vlong_flex_unit).a[uVar5]; + } + else { + uVar2 = 0; + } + uVar6 = (uint)(uVar7 + uVar2 < uVar7); + if (uVar5 < (x->super_vlong_flex_unit).n) { + uVar4 = (x->super_vlong_flex_unit).a[uVar5]; + } + else { + uVar4 = 0; + } + uVar2 = uVar7 + uVar2 + uVar4; + uVar7 = uVar6; + if (uVar2 < uVar4) { + uVar7 = uVar6 + 1; + } + uVar6 = uVar5 + 1; + vlong_flex_unit::set(&this->super_vlong_flex_unit,uVar5,uVar2); + uVar5 = uVar6; + } while (uVar6 < uVar8 + 1); + } + return; +} + + + +// WARNING: Variable defined which should be unmapped: N +// DWARF original prototype: void subtract(vlong_value * this, vlong_value * x) + +void __thiscall vlong_value::subtract(vlong_value *this,vlong_value *x) + +{ + uint uVar1; + uint uVar2; + uint uVar3; + uint ux; + uint nu; + uint i; + uint i_00; + uint carry; + uint uVar4; + uint N; + + i_00 = 0; + uVar1 = (this->super_vlong_flex_unit).n; + if (uVar1 != 0) { + uVar4 = 0; + do { + if (i_00 < (x->super_vlong_flex_unit).n) { + uVar2 = (x->super_vlong_flex_unit).a[i_00]; + } + else { + uVar2 = 0; + } + if (uVar4 <= uVar4 + uVar2) { + if (i_00 < (this->super_vlong_flex_unit).n) { + uVar3 = (this->super_vlong_flex_unit).a[i_00]; + } + else { + uVar3 = 0; + } + uVar2 = uVar3 - (uVar4 + uVar2); + uVar4 = (uint)(uVar3 < uVar2); + vlong_flex_unit::set(&this->super_vlong_flex_unit,i_00,uVar2); + } + i_00 = i_00 + 1; + } while (i_00 < uVar1); + } + return; +} + + + +// DWARF original prototype: void init(vlong_value * this, uint x) + +int __thiscall vlong_value::init(vlong_value *this,EVP_PKEY_CTX *ctx) + +{ + (this->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set(&this->super_vlong_flex_unit,0,(uint)ctx); + return (int)ctx; +} + + + +// DWARF original prototype: void copy(vlong_value * this, vlong_value * x) + +int __thiscall vlong_value::copy(vlong_value *this,EVP_PKEY_CTX *dst,EVP_PKEY_CTX *src) + +{ + uint in_EAX; + uint i; + uint i_00; + + (this->super_vlong_flex_unit).n = 0; + i_00 = *(uint *)dst; + while (i_00 != 0) { + i_00 = i_00 - 1; + if (i_00 < *(uint *)dst) { + in_EAX = *(uint *)(*(int *)(dst + 4) + i_00 * 4); + } + else { + in_EAX = 0; + } + vlong_flex_unit::set(&this->super_vlong_flex_unit,i_00,in_EAX); + } + return in_EAX; +} + + + +// DWARF original prototype: void vlong_value(vlong_value * this) + +void __thiscall vlong_value::vlong_value(vlong_value *this) + +{ + (this->super_vlong_flex_unit).z = 0; + (this->super_vlong_flex_unit).a = (uint *)0x0; + (this->super_vlong_flex_unit).n = 0; + this->share = 0; + return; +} + + + +// DWARF original prototype: void vlong_value(vlong_value * this) + +void __thiscall vlong_value::vlong_value(vlong_value *this) + +{ + (this->super_vlong_flex_unit).z = 0; + (this->super_vlong_flex_unit).a = (uint *)0x0; + (this->super_vlong_flex_unit).n = 0; + this->share = 0; + return; +} + + + +// DWARF original prototype: void mul(vlong_value * this, vlong_value * x, vlong_value * y) + +void __thiscall vlong_value::mul(vlong_value *this,vlong_value *x,vlong_value *y) + +{ + uint uVar1; + uint uVar2; + + uVar1 = bits(x); + uVar2 = bits(y); + vlong_flex_unit::fast_mul + (&this->super_vlong_flex_unit,&x->super_vlong_flex_unit,&y->super_vlong_flex_unit, + uVar2 + uVar1); + return; +} + + + +// DWARF original prototype: void divide(vlong_value * this, vlong_value * x, vlong_value * y, +// vlong_value * rem) + +void __thiscall +vlong_value::divide(vlong_value *this,vlong_value *x,vlong_value *y,vlong_value *rem) + +{ + uint *this_00; + uint i_00; + uint i_01; + int iVar1; + uint carry; + EVP_PKEY_CTX *src; + uint local_4c; + uint i_1; + uint i; + vlong_value s; + vlong_value m; + + this_00 = &s.share; + (this->super_vlong_flex_unit).n = 0; + src = (EVP_PKEY_CTX *)0x0; + vlong_flex_unit::set(&this->super_vlong_flex_unit,0,0); + copy(rem,(EVP_PKEY_CTX *)x,src); + vlong_value((vlong_value *)this_00); + vlong_value((vlong_value *)&i); + // try { // try from 080ec83c to 080ec97b has its CatchHandler @ 080ec9d7 + copy((vlong_value *)this_00,(EVP_PKEY_CTX *)y,src); + i = 0; + vlong_flex_unit::set((vlong_flex_unit *)&i,0,1); + while (iVar1 = cf(rem,(vlong_value *)this_00), 0 < iVar1) { + shl((vlong_value *)this_00); + shl((vlong_value *)&i); + } + while (iVar1 = cf(rem,y), -1 < iVar1) { + while (iVar1 = cf(rem,(vlong_value *)this_00), iVar1 < 0) { + iVar1 = 0; + i_01 = i; + i_00 = s.share; + while (i = i_01, i_00 != 0) { + i_00 = i_00 - 1; + if (i_00 < s.share) { + i_1 = *(uint *)(m.super_vlong_flex_unit.n + i_00 * 4); + } + else { + i_1 = 0; + } + vlong_flex_unit::set((vlong_flex_unit *)this_00,i_00,(i_1 >> 1) + iVar1); + iVar1 = i_1 << 0x1f; + i_01 = i; + } + iVar1 = 0; + while (i_01 != 0) { + i_01 = i_01 - 1; + if (i_01 < i) { + local_4c = *(uint *)(s.super_vlong_flex_unit.n + i_01 * 4); + } + else { + local_4c = 0; + } + vlong_flex_unit::set((vlong_flex_unit *)&i,i_01,(local_4c >> 1) + iVar1); + iVar1 = local_4c << 0x1f; + } + } + subtract(rem,(vlong_value *)this_00); + add(this,(vlong_value *)&i); + } + while (s.super_vlong_flex_unit.a != (uint *)0x0) { + s.super_vlong_flex_unit.a = (uint *)((int)s.super_vlong_flex_unit.a + -1); + *(undefined4 *)(s.super_vlong_flex_unit.n + (int)s.super_vlong_flex_unit.a * 4) = 0; + } + if (s.super_vlong_flex_unit.n != 0) { + operator_delete__((void *)s.super_vlong_flex_unit.n); + } + if (m.super_vlong_flex_unit.a != (uint *)0x0) { + do { + m.super_vlong_flex_unit.a = (uint *)((int)m.super_vlong_flex_unit.a + -1); + *(undefined4 *)(m.super_vlong_flex_unit.n + (int)m.super_vlong_flex_unit.a * 4) = 0; + } while (m.super_vlong_flex_unit.a != (uint *)0x0); + } + if (m.super_vlong_flex_unit.n != 0) { + operator_delete__((void *)m.super_vlong_flex_unit.n); + } + return; +} + + + +// DWARF original prototype: void vlong(vlong * this, uint x) + +void __thiscall vlong::vlong(vlong *this,uint x) + +{ + vlong_value *this_00; + + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this_00 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(this_00); + this->negative = 0; + this->value = this_00; + (this_00->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)this_00,0,x); + return; +} + + + +// DWARF original prototype: void vlong(vlong * this, uint x) + +void __thiscall vlong::vlong(vlong *this,uint x) + +{ + vlong_value *this_00; + + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this_00 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(this_00); + this->negative = 0; + this->value = this_00; + (this_00->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)this_00,0,x); + return; +} + + + +// DWARF original prototype: void vlong(vlong * this, vlong * x) + +void __thiscall vlong::vlong(vlong *this,vlong *x) + +{ + uint *puVar1; + int iVar2; + vlong_value *pvVar3; + + iVar2 = x->negative; + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this->negative = iVar2; + pvVar3 = x->value; + this->value = pvVar3; + puVar1 = &pvVar3->share; + *puVar1 = *puVar1 + 1; + return; +} + + + +// DWARF original prototype: void vlong(vlong * this, vlong * x) + +void __thiscall vlong::vlong(vlong *this,vlong *x) + +{ + uint *puVar1; + int iVar2; + vlong_value *pvVar3; + + iVar2 = x->negative; + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this->negative = iVar2; + pvVar3 = x->value; + this->value = pvVar3; + puVar1 = &pvVar3->share; + *puVar1 = *puVar1 + 1; + return; +} + + + +// DWARF original prototype: void ~vlong(vlong * this, int __in_chrg) + +void __thiscall vlong::~vlong(vlong *this,int __in_chrg) + +{ + vlong_value *pvVar1; + uint *puVar2; + uint i; + uint uVar3; + + pvVar1 = this->value; + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + if (pvVar1->share == 0) { + if (pvVar1 != (vlong_value *)0x0) { + uVar3 = (pvVar1->super_vlong_flex_unit).z; + while (uVar3 != 0) { + uVar3 = uVar3 - 1; + (pvVar1->super_vlong_flex_unit).a[uVar3] = 0; + } + puVar2 = (pvVar1->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar1); + } + } + else { + pvVar1->share = pvVar1->share - 1; + } + return; +} + + + +// DWARF original prototype: void ~vlong(vlong * this, int __in_chrg) + +void __thiscall vlong::~vlong(vlong *this,int __in_chrg) + +{ + vlong_value *pvVar1; + uint *puVar2; + uint i; + uint uVar3; + + pvVar1 = this->value; + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + if (pvVar1->share == 0) { + if (pvVar1 != (vlong_value *)0x0) { + uVar3 = (pvVar1->super_vlong_flex_unit).z; + while (uVar3 != 0) { + uVar3 = uVar3 - 1; + (pvVar1->super_vlong_flex_unit).a[uVar3] = 0; + } + puVar2 = (pvVar1->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar1); + } + } + else { + pvVar1->share = pvVar1->share - 1; + } + return; +} + + + +// DWARF original prototype: void ~vlong(vlong * this, int __in_chrg) + +void __thiscall vlong::~vlong(vlong *this,int __in_chrg) + +{ + vlong_value *pvVar1; + uint *puVar2; + uint i; + uint uVar3; + + pvVar1 = this->value; + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + if (pvVar1->share == 0) { + if (pvVar1 != (vlong_value *)0x0) { + uVar3 = (pvVar1->super_vlong_flex_unit).z; + while (uVar3 != 0) { + uVar3 = uVar3 - 1; + (pvVar1->super_vlong_flex_unit).a[uVar3] = 0; + } + puVar2 = (pvVar1->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar1); + } + } + else { + pvVar1->share = pvVar1->share - 1; + } + operator_delete(this); + return; +} + + + +// DWARF original prototype: void docopy(vlong * this) + +void __thiscall vlong::docopy(vlong *this) + +{ + uint uVar1; + vlong_value *this_00; + EVP_PKEY_CTX *in_stack_ffffffec; + + uVar1 = this->value->share; + if (uVar1 != 0) { + this->value->share = uVar1 - 1; + this_00 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(this_00); + vlong_value::copy(this_00,(EVP_PKEY_CTX *)this->value,in_stack_ffffffec); + this->value = this_00; + } + return; +} + + + +// DWARF original prototype: int cf(vlong * this, vlong * x) + +int __thiscall vlong::cf(vlong *this,vlong *x) + +{ + int iVar1; + int iVar2; + + iVar2 = 0; + if ((this->negative != 0) && ((this->value->super_vlong_flex_unit).n != 0)) { + iVar2 = 1; + } + iVar1 = 0; + if ((x->negative != 0) && ((x->value->super_vlong_flex_unit).n != 0)) { + iVar1 = 1; + } + if (iVar2 != iVar1) { + return (uint)(iVar2 == 0) * 2 + -1; + } + iVar2 = vlong_value::cf(this->value,x->value); + return iVar2; +} + + + +// DWARF original prototype: vlong * operator=(vlong * this, vlong * x) + +vlong * __thiscall vlong::operator=(vlong *this,vlong *x) + +{ + vlong_value *pvVar1; + uint *puVar2; + uint i; + uint uVar3; + + pvVar1 = this->value; + if (pvVar1->share == 0) { + if (pvVar1 != (vlong_value *)0x0) { + uVar3 = (pvVar1->super_vlong_flex_unit).z; + while (uVar3 != 0) { + uVar3 = uVar3 - 1; + (pvVar1->super_vlong_flex_unit).a[uVar3] = 0; + } + puVar2 = (pvVar1->super_vlong_flex_unit).a; + if (puVar2 != (uint *)0x0) { + operator_delete__(puVar2); + } + operator_delete(pvVar1); + } + } + else { + pvVar1->share = pvVar1->share - 1; + } + pvVar1 = x->value; + this->value = pvVar1; + puVar2 = &pvVar1->share; + *puVar2 = *puVar2 + 1; + this->negative = x->negative; + return this; +} + + + +// DWARF original name: operator unsigned int +// DWARF original prototype: uint operator_unsigned_int(vlong * this) + +uint __thiscall vlong::operator_unsigned_int(vlong *this) + +{ + uint uVar1; + + if ((this->value->super_vlong_flex_unit).n == 0) { + uVar1 = 0; + } + else { + uVar1 = *(this->value->super_vlong_flex_unit).a; + } + return uVar1; +} + + + +// DWARF original prototype: vlong * operator+=(vlong * this, vlong * x) + +vlong * __thiscall vlong::operator+=(vlong *this,vlong *x) + +{ + int iVar1; + vlong_value *pvVar2; + vlong *x_00; + EVP_PKEY_CTX *in_stack_ffffffcc; + undefined1 local_2c [4]; + vlong tmp; + + if (this->negative == x->negative) { + pvVar2 = this->value; + if (pvVar2->share != 0) { + pvVar2->share = pvVar2->share - 1; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + vlong_value::copy(pvVar2,(EVP_PKEY_CTX *)this->value,in_stack_ffffffcc); + this->value = pvVar2; + } + vlong_value::add(pvVar2,x->value); + } + else { + iVar1 = vlong_value::cf(this->value,x->value); + if (iVar1 < 0) { + local_2c = (undefined1 [4])&PTR__vlong_08128410; + tmp.value = (vlong_value *)this->negative; + tmp._vptr_vlong = (_func_int_varargs **)this->value; + ((vlong_value *)tmp._vptr_vlong)->share = ((vlong_value *)tmp._vptr_vlong)->share + 1; + operator=(this,x); + x_00 = (vlong *)local_2c; + // try { // try from 080ecedc to 080ecee0 has its CatchHandler @ 080ecf40 + operator+=(this,x_00); + ~vlong((vlong *)local_2c,(int)x_00); + } + else { + pvVar2 = this->value; + if (pvVar2->share != 0) { + pvVar2->share = pvVar2->share - 1; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + vlong_value::copy(pvVar2,(EVP_PKEY_CTX *)this->value,in_stack_ffffffcc); + this->value = pvVar2; + } + vlong_value::subtract(pvVar2,x->value); + } + } + return this; +} + + + +// DWARF original prototype: vlong * operator-=(vlong * this, vlong * x) + +vlong * __thiscall vlong::operator-=(vlong *this,vlong *x) + +{ + vlong_value *pvVar1; + int iVar2; + vlong *x_00; + EVP_PKEY_CTX *in_stack_ffffffcc; + undefined1 local_2c [4]; + vlong tmp; + + if (this->negative == x->negative) { + iVar2 = vlong_value::cf(this->value,x->value); + if (iVar2 < 0) { + local_2c = (undefined1 [4])&PTR__vlong_08128410; + tmp.value = (vlong_value *)this->negative; + tmp._vptr_vlong = (_func_int_varargs **)this->value; + ((vlong_value *)tmp._vptr_vlong)->share = ((vlong_value *)tmp._vptr_vlong)->share + 1; + operator=(this,x); + x_00 = (vlong *)local_2c; + // try { // try from 080ed062 to 080ed066 has its CatchHandler @ 080ed084 + operator-=(this,x_00); + this->negative = 1 - this->negative; + ~vlong((vlong *)local_2c,(int)x_00); + } + else { + pvVar1 = this->value; + if (pvVar1->share != 0) { + pvVar1->share = pvVar1->share - 1; + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + vlong_value::copy(pvVar1,(EVP_PKEY_CTX *)this->value,in_stack_ffffffcc); + this->value = pvVar1; + } + vlong_value::subtract(pvVar1,x->value); + } + } + else { + pvVar1 = this->value; + if (pvVar1->share != 0) { + pvVar1->share = pvVar1->share - 1; + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + vlong_value::copy(pvVar1,(EVP_PKEY_CTX *)this->value,in_stack_ffffffcc); + this->value = pvVar1; + } + vlong_value::add(pvVar1,x->value); + } + return this; +} + + + +vlong * operator+(vlong *x,vlong *y) + +{ + uint *puVar1; + int iVar2; + vlong_value *pvVar3; + vlong *result; + vlong *in_stack_0000000c; + + iVar2 = y->negative; + x->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + x->negative = iVar2; + pvVar3 = y->value; + x->value = pvVar3; + puVar1 = &pvVar3->share; + *puVar1 = *puVar1 + 1; + // try { // try from 080ed0d1 to 080ed0d5 has its CatchHandler @ 080ed0e4 + vlong::operator+=(x,in_stack_0000000c); + return x; +} + + + +vlong * operator-(vlong *x,vlong *y) + +{ + uint *puVar1; + int iVar2; + vlong_value *pvVar3; + vlong *result; + vlong *in_stack_0000000c; + + iVar2 = y->negative; + x->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + x->negative = iVar2; + pvVar3 = y->value; + x->value = pvVar3; + puVar1 = &pvVar3->share; + *puVar1 = *puVar1 + 1; + // try { // try from 080ed131 to 080ed135 has its CatchHandler @ 080ed144 + vlong::operator-=(x,in_stack_0000000c); + return x; +} + + + +vlong * operator*(vlong *x,vlong *y) + +{ + vlong_value *this; + vlong_value *this_00; + vlong_value *pvVar1; + uint uVar2; + uint uVar3; + vlong *result; + int in_stack_0000000c; + + x->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + x->negative = 0; + x->value = pvVar1; + (pvVar1->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + pvVar1 = x->value; + this = y->value; + this_00 = *(vlong_value **)(in_stack_0000000c + 4); + uVar2 = vlong_value::bits(this); + uVar3 = vlong_value::bits(this_00); + // try { // try from 080ed1ef to 080ed1f3 has its CatchHandler @ 080ed211 + vlong_flex_unit::fast_mul + (&pvVar1->super_vlong_flex_unit,&this->super_vlong_flex_unit, + &this_00->super_vlong_flex_unit,uVar3 + uVar2); + x->negative = *(uint *)(in_stack_0000000c + 8) ^ y->negative; + return x; +} + + + +vlong * operator/(vlong *x,vlong *y) + +{ + vlong_value *this; + uint i; + vlong *result; + int in_stack_0000000c; + undefined1 local_2c [4]; + vlong_value rem; + + x->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(this); + x->negative = 0; + x->value = this; + (this->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)this,0,0); + vlong_value::vlong_value((vlong_value *)local_2c); + // try { // try from 080ed2a9 to 080ed2ad has its CatchHandler @ 080ed300 + vlong_value::divide(x->value,y->value,*(vlong_value **)(in_stack_0000000c + 4), + (vlong_value *)local_2c); + x->negative = *(uint *)(in_stack_0000000c + 8) ^ y->negative; + while (rem.super_vlong_flex_unit.a != (uint *)0x0) { + rem.super_vlong_flex_unit.a = (uint *)((int)rem.super_vlong_flex_unit.a + -1); + *(undefined4 *)(rem.super_vlong_flex_unit.n + (int)rem.super_vlong_flex_unit.a * 4) = 0; + } + if (rem.super_vlong_flex_unit.n != 0) { + operator_delete__((void *)rem.super_vlong_flex_unit.n); + } + return x; +} + + + +vlong * operator%(vlong *x,vlong *y) + +{ + vlong_value *this; + uint i; + vlong *result; + int in_stack_0000000c; + undefined1 local_2c [4]; + vlong_value divide; + + x->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(this); + x->negative = 0; + x->value = this; + (this->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)this,0,0); + vlong_value::vlong_value((vlong_value *)local_2c); + // try { // try from 080ed3b9 to 080ed3bd has its CatchHandler @ 080ed400 + vlong_value::divide((vlong_value *)local_2c,y->value,*(vlong_value **)(in_stack_0000000c + 4), + x->value); + x->negative = y->negative; + while (divide.super_vlong_flex_unit.a != (uint *)0x0) { + divide.super_vlong_flex_unit.a = (uint *)((int)divide.super_vlong_flex_unit.a + -1); + *(undefined4 *)(divide.super_vlong_flex_unit.n + (int)divide.super_vlong_flex_unit.a * 4) = + 0; + } + if (divide.super_vlong_flex_unit.n != 0) { + operator_delete__((void *)divide.super_vlong_flex_unit.n); + } + return x; +} + + + +vlong * vlong::modexp(vlong *__return_storage_ptr__) + +{ + undefined4 in_stack_00000008; + vlong *in_stack_00000010; + vlong_montgomery *__in_chrg; + undefined1 local_5c [4]; + vlong_montgomery me; + + vlong_montgomery::vlong_montgomery((vlong_montgomery *)local_5c,in_stack_00000010); + __in_chrg = (vlong_montgomery *)local_5c; + // try { // try from 080ed472 to 080ed476 has its CatchHandler @ 080ed4c4 + vlong_montgomery::exp + ((vlong_montgomery *)__return_storage_ptr__, + (double)CONCAT44(in_stack_00000008,(vlong_montgomery *)local_5c)); + ~vlong((vlong *)&me.T.negative,(int)__in_chrg); + ~vlong((vlong *)&me.n1.negative,(int)__in_chrg); + ~vlong((vlong *)&me.m.negative,(int)__in_chrg); + ~vlong((vlong *)&me.R1.negative,(int)__in_chrg); + ~vlong((vlong *)&me.R.negative,(int)__in_chrg); + ~vlong((vlong *)local_5c,(int)__in_chrg); + return __return_storage_ptr__; +} + + + +vlong * __thiscall vlong::gcd(vlong *this,vlong *X,vlong *Y) + +{ + vlong_value *pvVar1; + int iVar2; + vlong *pvVar3; + vlong local_4c; + undefined1 local_3c [4]; + vlong y; + undefined1 local_2c [4]; + vlong x; + + local_2c = (undefined1 [4])&PTR__vlong_08128410; + x.value = (vlong_value *)X->negative; + x._vptr_vlong = (_func_int_varargs **)X->value; + ((vlong_value *)x._vptr_vlong)->share = ((vlong_value *)x._vptr_vlong)->share + 1; + local_3c = (undefined1 [4])&PTR__vlong_08128410; + y.value = (vlong_value *)Y->negative; + y._vptr_vlong = (_func_int_varargs **)Y->value; + ((vlong_value *)y._vptr_vlong)->share = ((vlong_value *)y._vptr_vlong)->share + 1; + do { + local_4c._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ed55f to 080ed65f has its CatchHandler @ 080ed6c8 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + local_4c.negative = 0; + (pvVar1->super_vlong_flex_unit).n = 0; + local_4c.value = pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + pvVar3 = &local_4c; + iVar2 = cf((vlong *)local_3c,&local_4c); + ~vlong(&local_4c,(int)pvVar3); + if (iVar2 == 0) { + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this->negative = (int)x.value; + pvVar1 = (vlong_value *)x._vptr_vlong; +LAB_080ed68e: + this->value = pvVar1; + pvVar1->share = pvVar1->share + 1; + ~vlong((vlong *)local_3c,(int)pvVar3); + ~vlong((vlong *)local_2c,(int)pvVar3); + return this; + } + operator%(&local_4c,(vlong *)local_2c); + pvVar3 = &local_4c; + operator=((vlong *)local_2c,&local_4c); + ~vlong(&local_4c,(int)pvVar3); + local_4c._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + local_4c.negative = 0; + (pvVar1->super_vlong_flex_unit).n = 0; + local_4c.value = pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + pvVar3 = &local_4c; + iVar2 = cf((vlong *)local_2c,&local_4c); + ~vlong(&local_4c,(int)pvVar3); + if (iVar2 == 0) { + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + this->negative = (int)y.value; + pvVar1 = (vlong_value *)y._vptr_vlong; + goto LAB_080ed68e; + } + operator%(&local_4c,(vlong *)local_3c); + pvVar3 = &local_4c; + operator=((vlong *)local_3c,&local_4c); + ~vlong(&local_4c,(int)pvVar3); + } while( true ); +} + + + +vlong * __thiscall vlong::modinv(vlong *this,vlong *a,vlong *m) + +{ + vlong_value *pvVar1; + int iVar2; + vlong *i; + vlong *pvVar3; + undefined1 local_8c [4]; + vlong result_1; + undefined1 local_7c [4]; + vlong result; + undefined1 local_6c [4]; + vlong y; + undefined1 local_5c [4]; + vlong x; + undefined1 local_4c [4]; + vlong c; + undefined1 local_3c [4]; + vlong b; + undefined1 local_2c [4]; + vlong j; + + local_2c = (undefined1 [4])&PTR__vlong_08128410; + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + j.value = (vlong_value *)0x0; + (pvVar1->super_vlong_flex_unit).n = 0; + j._vptr_vlong = (_func_int_varargs **)pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,1); + this->_vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + // try { // try from 080ed754 to 080ed78a has its CatchHandler @ 080edb77 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + this->negative = 0; + this->value = pvVar1; + (pvVar1->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + local_3c = (undefined1 [4])&PTR__vlong_08128410; + b.value = (vlong_value *)m->negative; + b._vptr_vlong = (_func_int_varargs **)m->value; + ((vlong_value *)b._vptr_vlong)->share = ((vlong_value *)b._vptr_vlong)->share + 1; + local_4c = (undefined1 [4])&PTR__vlong_08128410; + c.value = (vlong_value *)a->negative; + c._vptr_vlong = (_func_int_varargs **)a->value; + ((vlong_value *)c._vptr_vlong)->share = ((vlong_value *)c._vptr_vlong)->share + 1; + local_5c = (undefined1 [4])&PTR__vlong_08128410; + // try { // try from 080ed7c8 to 080ed7fe has its CatchHandler @ 080edb70 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + x.value = (vlong_value *)0x0; + (pvVar1->super_vlong_flex_unit).n = 0; + x._vptr_vlong = (_func_int_varargs **)pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + local_6c = (undefined1 [4])&PTR__vlong_08128410; + // try { // try from 080ed80d to 080ed843 has its CatchHandler @ 080edb64 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + y.value = (vlong_value *)0x0; + (pvVar1->super_vlong_flex_unit).n = 0; + y._vptr_vlong = (_func_int_varargs **)pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + while( true ) { + local_7c = (undefined1 [4])&PTR__vlong_08128410; + // try { // try from 080ed855 to 080ed90c has its CatchHandler @ 080edb60 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + result.value = (vlong_value *)0x0; + (pvVar1->super_vlong_flex_unit).n = 0; + result._vptr_vlong = (_func_int_varargs **)pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + pvVar3 = (vlong *)local_7c; + iVar2 = cf((vlong *)local_4c,pvVar3); + ~vlong((vlong *)local_7c,(int)pvVar3); + if (iVar2 == 0) break; + operator/((vlong *)local_7c,(vlong *)local_3c); + pvVar3 = (vlong *)local_7c; + operator=((vlong *)local_5c,pvVar3); + ~vlong((vlong *)local_7c,(int)pvVar3); + operator*((vlong *)local_8c,(vlong *)local_5c); + local_7c = (undefined1 [4])&PTR__vlong_08128410; + result.value = b.value; + result._vptr_vlong = b._vptr_vlong; + b._vptr_vlong[3] = b._vptr_vlong[3] + 1; + // try { // try from 080ed936 to 080ed93a has its CatchHandler @ 080edaf0 + operator-=((vlong *)local_7c,(vlong *)local_8c); + pvVar3 = (vlong *)local_7c; + operator=((vlong *)local_6c,pvVar3); + ~vlong((vlong *)local_7c,(int)pvVar3); + ~vlong((vlong *)local_8c,(int)pvVar3); + operator=((vlong *)local_3c,(vlong *)local_4c); + operator=((vlong *)local_4c,(vlong *)local_6c); + operator=((vlong *)local_6c,(vlong *)local_2c); + // try { // try from 080ed9aa to 080ed9ae has its CatchHandler @ 080edb60 + operator*((vlong *)local_7c,(vlong *)local_2c); + local_8c = (undefined1 [4])&PTR__vlong_08128410; + result_1.value = (vlong_value *)this->negative; + result_1._vptr_vlong = (_func_int_varargs **)this->value; + ((vlong_value *)result_1._vptr_vlong)->share = + ((vlong_value *)result_1._vptr_vlong)->share + 1; + // try { // try from 080ed9df to 080ed9e3 has its CatchHandler @ 080edb41 + operator-=((vlong *)local_8c,(vlong *)local_7c); + pvVar3 = (vlong *)local_8c; + operator=((vlong *)local_2c,pvVar3); + ~vlong((vlong *)local_8c,(int)pvVar3); + ~vlong((vlong *)local_7c,(int)pvVar3); + operator=(this,(vlong *)local_6c); + } + local_8c = (undefined1 [4])&PTR__vlong_08128410; + // try { // try from 080eda35 to 080edae6 has its CatchHandler @ 080edb60 + pvVar1 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar1); + result_1.value = (vlong_value *)0x0; + (pvVar1->super_vlong_flex_unit).n = 0; + result_1._vptr_vlong = (_func_int_varargs **)pvVar1; + vlong_flex_unit::set((vlong_flex_unit *)pvVar1,0,0); + pvVar3 = (vlong *)local_8c; + iVar2 = cf(this,pvVar3); + ~vlong((vlong *)local_8c,(int)pvVar3); + if (iVar2 < 0) { + operator+=(this,m); + pvVar3 = m; + } + ~vlong((vlong *)local_6c,(int)pvVar3); + ~vlong((vlong *)local_5c,(int)pvVar3); + ~vlong((vlong *)local_4c,(int)pvVar3); + ~vlong((vlong *)local_3c,(int)pvVar3); + ~vlong((vlong *)local_2c,(int)pvVar3); + return this; +} + + + +void vlong::convert(char *pDecimal,vlong *Number) + +{ + char cVar1; + ushort uVar2; + vlong_value *pvVar3; + uint x; + undefined4 *puVar4; + vlong *pvVar5; + undefined2 local_4e; + undefined1 auStack_4c [2]; + char Buffer [2]; + vlong local_3c; + undefined1 local_2c [4]; + vlong result; + + if (pDecimal == (char *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "pDecimal pointer is NULL"; + } + else { + local_2c = (undefined1 [4])&PTR__vlong_08128410; + local_4e = 0x100; + pvVar3 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar3); + result.value = (vlong_value *)0x0; + (pvVar3->super_vlong_flex_unit).n = 0; + result._vptr_vlong = (_func_int_varargs **)pvVar3; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,0); + pvVar5 = (vlong *)local_2c; + operator=(Number,(vlong *)local_2c); + ~vlong((vlong *)local_2c,(int)pvVar5); + cVar1 = *pDecimal; + while( true ) { + if (cVar1 == '\0') { + return; + } + uVar2 = (ushort)local_4e >> 8; + local_4e = CONCAT11((char)uVar2,cVar1); + x = __strtol_internal(&local_4e,0,10,0); + if (9 < x) break; + _auStack_4c = &PTR__vlong_08128410; + pvVar3 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar3); + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,10); + pvVar5 = Number; + // try { // try from 080edcae to 080edcb2 has its CatchHandler @ 080edda6 + operator*(&local_3c,Number); + ~vlong((vlong *)auStack_4c,(int)pvVar5); + _auStack_4c = &PTR__vlong_08128410; + // try { // try from 080edccf to 080edd04 has its CatchHandler @ 080edde3 + pvVar3 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar3); + (pvVar3->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar3,0,x); + local_2c = (undefined1 [4])&PTR__vlong_08128410; + pvVar5 = (vlong *)auStack_4c; + result.value = (vlong_value *)local_3c.negative; + result._vptr_vlong = (_func_int_varargs **)local_3c.value; + (local_3c.value)->share = (local_3c.value)->share + 1; + // try { // try from 080edd25 to 080edd29 has its CatchHandler @ 080eddad + operator+=((vlong *)local_2c,pvVar5); + pDecimal = pDecimal + 1; + ~vlong((vlong *)auStack_4c,(int)pvVar5); + pvVar5 = (vlong *)local_2c; + operator=(Number,(vlong *)local_2c); + ~vlong((vlong *)local_2c,(int)pvVar5); + ~vlong(&local_3c,(int)pvVar5); + cVar1 = *pDecimal; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "digit out of range"; + } + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char_const*::typeinfo,0); +} + + + +void vlong::convert(vlong *Number,char *pDecimal,ushort DecimalLength) + +{ + char cVar1; + vlong_value *pvVar2; + int iVar3; + undefined4 *puVar4; + vlong *pvVar5; + uint local_48; + int local_44; + int i; + undefined1 auStack_3c [2]; + char Buffer [2]; + vlong local_2c [2]; + + if (pDecimal == (char *)0x0) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "pDecimal pointer is NULL"; + } + else { + if (DecimalLength != 0) { + memset(pDecimal,0,(uint)DecimalLength); + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + local_2c[0].negative = 0; + (pvVar2->super_vlong_flex_unit).n = 0; + local_2c[0].value = pvVar2; + vlong_flex_unit::set((vlong_flex_unit *)pvVar2,0,0); + pvVar5 = local_2c; + iVar3 = cf(Number,local_2c); + ~vlong(local_2c,(int)pvVar5); + if (iVar3 == 0) { + *pDecimal = '0'; + } + else { + local_44 = 0; + i._2_2_ = 0x100; + while( true ) { + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + local_2c[0].negative = 0; + (pvVar2->super_vlong_flex_unit).n = 0; + local_2c[0].value = pvVar2; + vlong_flex_unit::set((vlong_flex_unit *)pvVar2,0,0); + pvVar5 = local_2c; + iVar3 = cf(Number,local_2c); + ~vlong(local_2c,(int)pvVar5); + if (iVar3 < 1) break; + if ((int)(uint)DecimalLength <= local_44) { + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = + "large number does not fit in char array (DecimalLength too small)"; + goto LAB_080ee083; + } + _auStack_3c = &PTR__vlong_08128410; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + (pvVar2->super_vlong_flex_unit).n = 0; + vlong_flex_unit::set((vlong_flex_unit *)pvVar2,0,10); + pvVar5 = Number; + // try { // try from 080edf82 to 080edf86 has its CatchHandler @ 080ee0f0 + operator%(local_2c,Number); + ~vlong((vlong *)auStack_3c,(int)pvVar5); + if (((local_2c[0].value)->super_vlong_flex_unit).n == 0) { + local_48 = 0; + } + else { + local_48 = *((local_2c[0].value)->super_vlong_flex_unit).a; + } + ~vlong(local_2c,(int)pvVar5); + local_2c[0]._vptr_vlong = (_func_int_varargs **)&PTR__vlong_08128410; + pvVar2 = (vlong_value *)operator_new(0x10); + vlong_value::vlong_value(pvVar2); + local_2c[0].negative = 0; + (pvVar2->super_vlong_flex_unit).n = 0; + local_2c[0].value = pvVar2; + vlong_flex_unit::set((vlong_flex_unit *)pvVar2,0,10); + pvVar5 = Number; + // try { // try from 080ee007 to 080ee00b has its CatchHandler @ 080ee100 + operator/((vlong *)auStack_3c,Number); + ~vlong(local_2c,(int)pvVar5); + pvVar5 = (vlong *)auStack_3c; + operator=(Number,pvVar5); + ~vlong((vlong *)auStack_3c,(int)pvVar5); + sprintf((char *)((int)&i + 2),"%d",local_48); + pDecimal[local_44] = i._2_1_; + local_44 = local_44 + 1; + } + local_44 = local_44 + -1; + while (0 < local_44) { + cVar1 = *pDecimal; + *pDecimal = pDecimal[local_44]; + pDecimal[local_44] = cVar1; + } + } + return; + } + puVar4 = (undefined4 *)__cxa_allocate_exception(4); + *puVar4 = "DecimalLength = 0"; + } +LAB_080ee083: + // WARNING: Subroutine does not return + __cxa_throw(puVar4,char_const*::typeinfo,0); +} + + + +void vlong::convert(uchar *pData,ushort DataLength,vlong *Number) + +{ + undefined4 *puVar1; + byte bVar2; + int j; + uint uVar3; + int iVar4; + int i; + int iVar5; + uint x; + uint x_00; + ushort DataLength_local; + + uVar3 = (uint)DataLength; + if (pData == (uchar *)0x0) { + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "pData pointer is NULL"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); + } + iVar5 = 0; + (Number->value->super_vlong_flex_unit).n = 0; + if (uVar3 != 0) { + do { + x_00 = 0; + iVar4 = 0; + bVar2 = 0x18; + do { + if (iVar4 + iVar5 < (int)uVar3) { + x_00 = x_00 + ((uint)pData[iVar4 + iVar5] << (bVar2 & 0x1f)); + } + iVar4 = iVar4 + 1; + bVar2 = bVar2 - 8; + } while (iVar4 < 4); + iVar4 = iVar5 + 4; + vlong_flex_unit::set + (&Number->value->super_vlong_flex_unit,((uVar3 + 3) / 4 - iVar5 / 4) - 1,x_00) + ; + iVar5 = iVar4; + } while (iVar4 < (int)uVar3); + } + return; +} + + + +void vlong::convert(vlong *Number,uchar *pData,ushort DataLength) + +{ + undefined4 *puVar1; + byte bVar2; + uint __n; + uint uVar3; + int j; + int iVar4; + int i; + int iVar5; + ushort DataLength_local; + uint local_1c; + + __n = (uint)DataLength; + if (pData != (uchar *)0x0) { + memset(pData,0,__n); + if (__n != 0) { + iVar5 = 0; + do { + uVar3 = ((__n + 3) / 4 - iVar5 / 4) - 1; + if (uVar3 < (Number->value->super_vlong_flex_unit).n) { + local_1c = (Number->value->super_vlong_flex_unit).a[uVar3]; + } + else { + local_1c = 0; + } + iVar4 = 0; + bVar2 = 0x18; + do { + if (iVar4 + iVar5 < (int)__n) { + pData[iVar4 + iVar5] = (uchar)(local_1c >> (bVar2 & 0x1f)); + } + iVar4 = iVar4 + 1; + bVar2 = bVar2 - 8; + } while (iVar4 < 4); + iVar5 = iVar5 + 4; + } while (iVar5 < (int)__n); + } + return; + } + puVar1 = (undefined4 *)__cxa_allocate_exception(4); + *puVar1 = "pData pointer is NULL"; + // WARNING: Subroutine does not return + __cxa_throw(puVar1,char_const*::typeinfo,0); +} + + + +// WARNING: Removing unreachable block (ram,0x080ee309) +// WARNING: Removing unreachable block (ram,0x080ee30c) + +void __libc_csu_init(void) + +{ + _init(); + return; +} + + + +// WARNING: Removing unreachable block (ram,0x080ee340) +// WARNING: Removing unreachable block (ram,0x080ee34e) + +void __libc_csu_fini(void) + +{ + _fini(); + return; +} + + + +int atexit(__func *__func) + +{ + int iVar1; + + iVar1 = __cxa_atexit(__func,0,__dso_handle); + return iVar1; +} + + + +undefined4 __do_global_ctors_aux(void) + +{ + code *pcVar1; + undefined4 in_EDX; + undefined **ppuVar2; + + ppuVar2 = &PTR__GLOBAL__I__ZN14TRSAPrivateKeyC2Ev_0812856c; + pcVar1 = (code *)PTR__GLOBAL__I__ZN14TRSAPrivateKeyC2Ev_0812856c; + if (PTR__GLOBAL__I__ZN14TRSAPrivateKeyC2Ev_0812856c != (undefined *)0xffffffff) { + do { + ppuVar2 = ppuVar2 + -1; + (*pcVar1)(); + pcVar1 = (code *)*ppuVar2; + } while (pcVar1 != (code *)0xffffffff); + } + return in_EDX; +} + + + +void _fini(void) + +{ + __do_global_dtors_aux(); + return; +} + + diff --git a/reference/types.hh b/reference/types.hh new file mode 100644 index 0000000..5b493d2 --- /dev/null +++ b/reference/types.hh @@ -0,0 +1,1712 @@ +struct Object { + uint32 ObjectID; +}; + +struct TSkill { + int (**_vptr.TSkill)(...); // VTABLE? + int DAct; + int MDAct; + uint16 SkNr; + TCreature *Master; + int Act; + int Max; + int Min; + int FactorPercent; + int LastLevel; + int NextLevel; + int Delta; + int Exp; + int Cycle; + int MaxCycle; + int Count; + int MaxCount; + int AddLevel; +}; + +struct TSkillAdd { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillHitpoints { + TSkillAdd super_TSkillAdd; // INHERITANCE? +}; + +struct TSkillSoulpoints { + TSkillAdd super_TSkillAdd; // INHERITANCE? +}; + +struct TSkillProbe { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillMana { + TSkillAdd super_TSkillAdd; // INHERITANCE? +}; + +struct TSkillGoStrength { + TSkillAdd super_TSkillAdd; // INHERITANCE? +}; + +struct TSkillLight { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillEnergy { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillCarryStrength { + TSkillAdd super_TSkillAdd; // INHERITANCE? +}; + +struct TSkillPoison { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillBurning { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillFed { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillIllusion { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillLevel { + TSkill super_TSkill; // INHERITANCE? +}; + +struct TSkillBase { + TSkill *Skills[25]; + TSkill *TimerList[25]; + uint16 FirstFreeTimer; +}; + +struct TImpact { + int (**_vptr.TImpact)(...); // VTABLE? +}; + +struct TSummonImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int Race; + int Maximum; +}; + +struct TSpeedImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int Percent; + int Duration; +}; + +struct THealingImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int Power; +}; + +struct TOutfitImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + TOutfit Outfit; + int Duration; +}; + +struct TFieldImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int FieldType; +}; + +struct TDrunkenImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int Power; + int Duration; +}; + +struct TStrengthImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int Skills; + int Percent; + int Duration; +}; + +struct TDamageImpact { + TImpact super_TImpact; // INHERITANCE? + TCreature *Actor; + int DamageType; + int Power; + bool AllowDefense; +}; + +struct TCombatEntry { + uint32 ID; + uint32 Damage; + int TimeStamp; +}; + +struct TCombat { + TCreature *Master; + uint32 EarliestAttackTime; + uint32 EarliestDefendTime; + uint32 LastDefendTime; + uint32 LatestAttackTime; + uint32 AttackMode; + uint32 ChaseMode; + uint32 SecureMode; + uint32 AttackDest; + bool Following; + Object Shield; + Object Close; + Object Missile; + Object Throw; + Object Wand; + Object Ammo; + bool Fist; + uint32 CombatDamage; + int ActCombatEntry; + TCombatEntry CombatList[20]; + int LearningPoints; +}; + +struct TOutfit { + int OutfitID; + union{ + uint16 ObjectType; + uint8 Colors[4]; + }; +}; + +struct TCreature { + int (**_vptr.TCreature)(...); // CREATURE VTABLE? + TSkillBase super_TSkillBase; // INHERITANCE? + TCombat Combat; + uint32 ID; + TCreature *NextHashEntry; + uint32 NextChainCreature; + char Name[31]; + char Murderer[31]; + TOutfit OrgOutfit; + TOutfit Outfit; + int startx; + int starty; + int startz; + int posx; + int posy; + int posz; + int Sex; + int Race; + int Direction; + int Radius; + CreatureType Type; + bool IsDead; + int LoseInventory; + bool LoggingOut; + bool LogoutAllowed; + uint32 EarliestLogoutRound; + uint32 EarliestProtectionZoneRound; + uint32 EarliestYellRound; + uint32 EarliestTradeChannelRound; + uint32 EarliestSpellTime; + uint32 EarliestMultiuseTime; + uint32 EarliestWalkTime; + uint32 LifeEndRound; + TKnownCreature *FirstKnowingConnection; + int SummonedCreatures; + uint32 FireDamageOrigin; + uint32 PoisonDamageOrigin; + uint32 EnergyDamageOrigin; + Object CrObject; + vector ToDoList; + int ActToDo; + int NrToDo; + uint32 NextWakeup; + bool Stop; + bool LockToDo; + uint8 Profession; + TConnection *Connection; +}; + + +struct TKnownCreature { + KNOWNCREATURESTATE State; + uint32 CreatureID; + TKnownCreature *Next; + TConnection *Connection; +}; + +struct TConnection { + uint8 InData[2048]; + int InDataSize; + bool SigIOPending; + bool WaitingForACK; + uint8 OutData[16384]; + uint8 field5_0x4806; + uint8 field6_0x4807; + int NextToSend; + int NextToCommit; + int NextToWrite; + bool Overflow; + bool WillingToSend; + uint8 field12_0x4816; + uint8 field13_0x4817; + TConnection *NextSendingConnection; + uint32 RandomSeed; + CONNECTIONSTATE State; + pid_t PID; + int Socket; + char IPAddress[16]; + TXTEASymmetricKey SymmetricKey; + bool ConnectionIsOk; + bool ClosingIsDelayed; + uint8 field23_0x4852; + uint8 field24_0x4853; + uint32 TimeStamp; + uint32 TimeStampAction; + int TerminalType; + int TerminalVersion; + int TerminalOffsetX; + int TerminalOffsetY; + int TerminalWidth; + int TerminalHeight; + uint32 CharacterID; + char Name[31]; + uint8 field35_0x4897; + TKnownCreature KnownCreatureTable[150]; +}; + +struct TCircle { + int x[32]; + int y[32]; + int Count; +}; + +struct TSpellList { + uint8 Syllable[10]; + uint8 RuneGr; + uint8 RuneNr; + char *Comment; + uint16 Level; + uint16 RuneLevel; + uint16 Flags; + int Mana; + int SoulPoints; + int Amount; +}; + +struct TToDoEntry { + ToDoType Code; + union{ + struct{ + uint32 Time; + } Wait; + + struct{ + int x; + int y; + int z; + } Go; + + struct{ + int Direction; + } Rotate; + + struct{ + uint32 Obj; + int x; + int y; + int z; + int Count; + } Move; + + struct{ + uint32 Obj; + uint32 Partner; + } Trade; + + struct{ + uint32 Obj1; + uint32 Obj2; + int Dummy; + } Use; + + struct{ + uint32 Obj; + } Turn; + + struct{ + uint32 Text; // POINTER? + int Mode; + uint32 Addressee; + bool CheckSpamming; + } Talk; + + struct{ + int NewState; + } ChangeState; + }; +}; + +// TODO(fusion): The storage per creature of TToDoEntry's? +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + TToDoEntry init; + TToDoEntry *entry; +}; + +struct TXTEASymmetricKey { + int (**_vptr.TXTEASymmetricKey)(...); // VTABLE? + uint8 m_SymmetricKey[16]; +}; + + +// NOTE(fusion): Some minimal processing up until here. Then I realized the file would be huge. +//================================================================================================== +//================================================================================================== +//================================================================================================== + +struct TDatabasePoolConnection { + TDatabaseConnectionPool *DatabaseConnectionPool; + TDatabaseConnection *DatabaseConnection; + bool TransactionRunning; +}; + +struct TDatabaseSettings { + char Product[30]; + char Database[30]; + char Login[30]; + char Password[30]; + char Host[30]; + char Port[6]; +}; + +struct Semaphore { + int value; + struct pthread_mutex_t mutex; + struct pthread_cond_t condition; +}; + +struct TDatabaseConnectionPool { + int NumberOfConnections; + struct TDatabaseSettings DatabaseSettings; + struct TDatabaseConnection **DatabaseConnection; + bool *DatabaseConnectionFree; + struct Semaphore FreeDatabaseConnections; + struct Semaphore DatabaseConnectionMutex; +}; + +// TODO(fusion): Opaque struct? +struct TDatabaseConnection {}; + +struct TPreparedQuery { + int Number; + char *Query; + char *DBTypes; + char *CTypes; + char *Name; +}; + +struct TSharedMemory { + int Command; + char CommandBuffer[256]; + ulong RoundNr; + ulong ObjectCounter; + ulong Errors; + int PlayersOnline; + int NewbiesOnline; + int PrintBufferPosition; + char PrintBuffer[200][128]; + enum GAMESTATE GameState; + pid_t GameThreadPID; +}; + +struct TPlayerIndexNode { + bool InternalNode; +}; + +struct TPlayerIndexInternalNode { + struct TPlayerIndexNode super_TPlayerIndexNode; + struct TPlayerIndexNode *Child[27]; +}; + +union storeitem { + union storeitem *next; + struct TPlayerIndexInternalNode data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +struct TPlayerIndexEntry { + char Name[30]; + ulong CharacterID; +}; + +struct TPlayerIndexLeafNode { + struct TPlayerIndexNode super_TPlayerIndexNode; + int Count; + struct TPlayerIndexEntry Entry[10]; +}; + +union storeitem { + union storeitem *next; + struct TPlayerIndexLeafNode data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +struct TNode { + int Type; + int Data; + struct TNode *Left; + struct TNode *Right; +}; + +union storeitem { + union storeitem *next; + struct TNode data; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +struct priority_queue_entry { // Original name: priority_queue_entry + ulong Key; + ulong Data; +}; + +struct THouseGuest { + char Name[60]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouseGuest init; + struct THouseGuest *entry; +}; + +struct THouse { + ushort ID; + char Name[50]; + char Description[500]; + int Size; + ulong Rent; + int DepotNr; + bool NoAuction; + bool GuildHouse; + int ExitX; + int ExitY; + int ExitZ; + int CenterX; + int CenterY; + int CenterZ; + ulong OwnerID; + char OwnerName[30]; + int LastTransition; + int PaidUntil; + struct vector Subowner; + int Subowners; + struct vector Guest; + int Guests; + int Help; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouse init; + struct THouse *entry; +}; + +struct matrix { // Original name: matrix + int xmin; + int ymin; + int dx; + int dy; + ulong *entry; +}; + +struct TWaitinglistEntry { + struct TWaitinglistEntry *Next; + char Name[30]; + ulong NextTry; + bool FreeAccount; + bool Newbie; + bool Sleeping; +}; + +union storeitem { + union storeitem *next; + struct TWaitinglistEntry data; +}; + +struct storeunit { + union storeitem item[100]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCreature *init; + struct TCreature **entry; +}; + +struct ObjectType { + int TypeID; +}; + +struct priority_queue_entry { // Original name: priority_queue_entry + ulong Key; + struct TAttackWave *Data; +}; + +struct TItemData { + struct ObjectType Type; + int Maximum; + int Probability; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TItemData init; + struct TItemData *entry; +}; + +struct TAttackWave { + int x; + int y; + int z; + int Spread; + int Race; + int MinCount; + int MaxCount; + int Radius; + int Lifetime; + ulong Message; + int ExtraItems; + struct vector ExtraItem; +}; + +struct TSkillData { + int Nr; + int Actual; + int Minimum; + int Maximum; + int NextLevel; + int FactorPercent; + int AddLevel; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TSkillData init; + struct TSkillData *entry; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +struct TDynamicStringTableBlock { + int FreeEntries; + int TotalTextLength; + bool Dirty; + uchar EntryType[256]; + ushort StringOffset[256]; + char Text[32768]; +}; + +struct listnode { + struct listnode *next; + struct listnode *prev; + struct TDynamicStringTableBlock data; +}; + +struct listIterator { + struct listnode *actNode; +}; + + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TNonplayer *init; + struct TNonplayer **entry; +}; + +struct TNonplayer { + struct TCreature super_TCreature; // INHERITANCE? + enum STATE State; +}; + +struct TReportedStatement { + ulong StatementID; + ulong TimeStamp; + ulong CharacterID; + int Mode; + int Channel; + char Text[256]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TReportedStatement init; + struct TReportedStatement *entry; +}; + + +struct TListener { + ulong StatementID; + ulong CharacterID; +}; + +struct fifo { + struct TListener *Entry; + int Size; + int Head; + int Tail; +}; + +struct TDelayedMail { + ulong CharacterID; + int DepotNumber; + uchar *Packet; + int PacketSize; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TDelayedMail init; + struct TDelayedMail *entry; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +struct vector_> { // Original name: vector > + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct priority_queue_entry init; + struct priority_queue_entry *entry; +}; + +struct TSpellData { + enum SpellShapeType Shape; + int ShapeParam1; + int ShapeParam2; + int ShapeParam3; + int ShapeParam4; + enum SpellImpactType Impact; + int ImpactParam1; + int ImpactParam2; + int ImpactParam3; + int ImpactParam4; + int Delay; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TSpellData init; + struct TSpellData *entry; +}; + +struct storeunit { + union storeitem item[256]; +}; + +struct listnode_> { // Original name: listnode > + struct listnode_> *next; + struct listnode_> *prev; + struct storeunit data; +}; + +struct TShortwayPoint { + int x; + int y; + int Waypoints; + int Waylength; + int Heuristic; + struct TShortwayPoint *Predecessor; + struct TShortwayPoint *NextToExpand; +}; + +struct matrix { + int xmin; + int ymin; + int dx; + int dy; + struct TShortwayPoint *entry; +}; + +struct TCronEntry { + struct Object Obj; + ulong RoundNr; + int Previous; + int Next; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCronEntry init; + struct TCronEntry *entry; +}; + +struct TMonsterhome { + int Race; + int x; + int y; + int z; + int Radius; + int MaxMonsters; + int ActMonsters; + int RegenerationTime; + int Timer; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMonsterhome init; + struct TMonsterhome *entry; +}; + +struct TStaticStringTableBlock { + int TotalTextLength; + char Text[65536]; +}; + +struct listnode { + struct listnode *next; + struct listnode *prev; + struct TStaticStringTableBlock data; +}; + +struct list { + struct listnode *firstNode; + struct listnode *lastNode; +}; + +struct vector_> { // Original name: vector > + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct priority_queue_entry init; + struct priority_queue_entry *entry; +}; + +struct listIterator { + struct listnode *actNode; +}; + +struct list_> { // Original name: list > + struct listnode_> *firstNode; + struct listnode_> *lastNode; +}; + +struct TObjectType { + char *Name; + char *Description; + uchar Flags[9]; + ulong Attributes[62]; + int AttributeOffsets[18]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TObjectType init; + struct TObjectType *entry; +}; + +struct TCondition { + int Type; + ulong Text; + struct TNode *Expression; + int Property; + int Number; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TCondition init; + struct TCondition *entry; +}; + +struct priority_queue { // Original name: priority_queue + struct vector_> *Entry; + int Entries; +}; + +struct matrix3d { + int xmin; + int ymin; + int zmin; + int dx; + int dy; + int dz; + struct TSector **entry; +}; + +struct TSector { + struct Object MapCon[32][32]; + ulong TimeStamp; + uchar Status; + uchar MapFlags; +}; + +struct vector { // Original name: vector + int min; + int max; + int start; + int space; + int block; + bool initialized; + ulong init; + ulong *entry; +}; + +struct TChannel { + ulong Moderator; + char ModeratorName[30]; + struct vector Subscriber; + int Subscribers; + struct vector InvitedPlayer; + int InvitedPlayers; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TChannel init; + struct TChannel *entry; +}; + +struct THelpDepot { + ulong CharacterID; + struct Object Box; + int DepotNr; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THelpDepot init; + struct THelpDepot *entry; +}; + +struct matrix { + int xmin; + int ymin; + int dx; + int dy; + int *entry; +}; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +struct TPlayerData { + ulong CharacterID; + pid_t Locked; + int Sticky; + bool Dirty; + int Race; + struct TOutfit OriginalOutfit; + struct TOutfit CurrentOutfit; + time_t LastLoginTime; + time_t LastLogoutTime; + int startx; + int starty; + int startz; + int posx; + int posy; + int posz; + int Profession; + int PlayerkillerEnd; + int Actual[25]; + int Maximum[25]; + int Minimum[25]; + int DeltaAct[25]; + int MagicDeltaAct[25]; + int Cycle[25]; + int MaxCycle[25]; + int Count[25]; + int MaxCount[25]; + int AddLevel[25]; + int Experience[25]; + int FactorPercent[25]; + int NextLevel[25]; + int Delta[25]; + uchar SpellList[256]; + int QuestValues[500]; + int MurderTimestamps[20]; + uchar *Inventory; + int InventorySize; + uchar *Depot[9]; + int DepotSize[9]; + ulong AccountID; + int Sex; + char Name[30]; + uchar Rights[12]; + char Guild[31]; + char Rank[31]; + char Title[31]; + int Buddies; + ulong Buddy[100]; + char BuddyName[100][30]; + ulong EarliestYellRound; + ulong EarliestTradeChannelRound; + ulong EarliestSpellTime; + ulong EarliestMultiuseTime; + ulong TalkBufferFullTime; + ulong MutingEndRound; + ulong Addressees[20]; + ulong AddresseesTimes[20]; + int NumberOfMutings; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TPlayer *init; + struct TPlayer **entry; +}; + +struct TPlayer { + struct TCreature super_TCreature; + ulong AccountID; + char Guild[31]; + char Rank[31]; + char Title[31]; + char IPAddress[16]; + uchar Rights[12]; + struct Object Depot; + int DepotNr; + int DepotSpace; + enum RESULT ConstructError; + struct TPlayerData *PlayerData; + struct Object TradeObject; + ulong TradePartner; + bool TradeAccepted; + int OldState; + ulong Request; + int RequestTimestamp; + ulong RequestProcessingGamemaster; + int TutorActivities; + uchar SpellList[256]; + int QuestValues[500]; + struct Object OpenContainer[16]; + struct vector AttackedPlayers; + int NumberOfAttackedPlayers; + bool Aggressor; + struct vector FormerAttackedPlayers; + int NumberOfFormerAttackedPlayers; + bool FormerAggressor; + ulong FormerLogoutRound; + ulong PartyLeader; + ulong PartyLeavingRound; + ulong TalkBufferFullTime; + ulong MutingEndRound; + int NumberOfMutings; + ulong Addressees[20]; + ulong AddresseesTimes[20]; +}; + +struct TParty { + ulong Leader; + struct vector Member; + int Members; + struct vector InvitedPlayer; + int InvitedPlayers; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TParty init; + struct TParty *entry; +}; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + +struct TMark { + char Name[20]; + int x; + int y; + int z; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMark init; + struct TMark *entry; +}; + +struct store { + struct list_> *Units; + union storeitem *firstFreeItem; +}; + +struct TMoveUseAction { + enum ActionType Action; + int Parameters[5]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseAction init; + struct TMoveUseAction *entry; +}; + +struct list { + struct listnode *firstNode; + struct listnode *lastNode; +}; + +struct TMoveUseRule { + int FirstCondition; + int LastCondition; + int FirstAction; + int LastAction; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseRule init; + struct TMoveUseRule *entry; +}; + +struct TMoveUseCondition { + enum ModifierType Modifier; + enum ConditionType Condition; + int Parameters[5]; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TMoveUseCondition init; + struct TMoveUseCondition *entry; +}; + +struct TAction { + int Type; + ulong Text; + int Number; + struct TNode *Expression; + struct TNode *Expression2; + struct TNode *Expression3; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TAction init; + struct TAction *entry; +}; + +struct TBehaviour { + struct vector Condition; + struct vector Action; + int Conditions; + int Actions; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TBehaviour init; + struct TBehaviour *entry; +}; + +struct THouseArea { + ushort ID; + int SQMPrice; + int DepotNr; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct THouseArea init; + struct THouseArea *entry; +}; + +struct priority_queue { // Original name: priority_queue + struct vector_> *Entry; + int Entries; +}; + +struct listIterator_> { // Original name: listIterator > + struct listnode_> *actNode; +}; + + +struct TDepotInfo { + char Town[20]; + int Size; +}; + +struct vector { + int min; + int max; + int start; + int space; + int block; + bool initialized; + struct TDepotInfo init; + struct TDepotInfo *entry; +}; + +struct fifoIterator { + struct fifo *Fifo; + int Position; +}; + +struct fifo { + struct TStatement *Entry; + int Size; + int Head; + int Tail; +}; + +struct TStatement { + ulong StatementID; + ulong TimeStamp; + ulong CharacterID; + int Mode; + int Channel; + ulong Text; + bool Reported; +}; + +struct fifoIterator { + struct fifo *Fifo; + int Position; +}; + +struct TWriteStream { + int (**_vptr.TWriteStream)(...); +}; + +struct TReadStream { + int (**_vptr.TReadStream)(...); +}; + +struct TReadBuffer { + struct TReadStream super_TReadStream; + uchar *Data; + int Size; + int Position; +}; + +struct TWriteBuffer { + struct TWriteStream super_TWriteStream; + uchar *Data; + int Size; + int Position; +}; + +struct TDynamicWriteBuffer { + struct TWriteBuffer super_TWriteBuffer; +}; + +struct TDirectReplyData { + ulong CharacterID; + char Message[100]; +}; + +struct TWriterThreadReply { + enum TWriterThreadReplyType ReplyType; + void *Data; +}; + +struct TWriterThreadOrder { + enum TWriterThreadOrderType OrderType; + void *Data; +}; + +struct TPunishmentOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CriminalName[30]; + char CriminalIPAddress[16]; + int Reason; + int Action; + char Comment[200]; + int NumberOfStatements; + struct vector *ReportedStatements; + ulong StatementID; + bool IPBanishment; +}; + +struct TLogoutOrderData { + ulong CharacterID; + int Level; + int Profession; + time_t LastLoginTime; + int TutorActivities; + char Residence[30]; +}; + +struct TCharacterDeathOrderData { + ulong CharacterID; + int Level; + ulong Offender; + char Remark[30]; + bool Unjustified; + time_t Time; +}; + +struct TNameLockOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CharacterName[30]; + bool OldNameVisible; +}; + +struct TNotationOrderData { + ulong GamemasterID; + char GamemasterName[30]; + char CharacterName[30]; + char Comment[200]; +}; + +struct TProtocolThreadOrder { + char ProtocolName[20]; + char Text[256]; +}; + +struct TPlayerlistOrderData { + int NumberOfPlayers; + char *PlayerNames; + int *PlayerLevels; + int *PlayerProfessions; +}; + +struct TBuddyOrderData { + ulong AccountID; + ulong Buddy; +}; + +struct TKillStatisticsOrderData { + int NumberOfRaces; + char *RaceNames; + int *KilledPlayers; + int *KilledCreatures; +}; + +struct TMoveUseDatabase { + struct vector Rules; + int NumberOfRules; +}; + +struct TObject { + ulong ObjectID; + struct Object NextObject; + struct Object Container; + struct ObjectType Type; + ulong Attributes[4]; +}; + +struct TObjectBlock { + struct TObject Object[32768]; +}; + +struct TFindCreatures { + int startx; + int starty; + int endx; + int endy; + int blockx; + int blocky; + ulong ActID; + ulong SkipID; + int Mask; + bool finished; +}; + +typedef int (ThreadFunction)(void *); +struct TThreadStarter { + ThreadFunction *Function; + void *Argument; + bool Detach; +}; + +struct TReaderThreadOrder { + enum TReaderThreadOrderType OrderType; + int SectorX; + int SectorY; + int SectorZ; + ulong CharacterID; +}; + +struct TReaderThreadReply { + enum TReaderThreadReplyType ReplyType; + int SectorX; + int SectorY; + int SectorZ; + uchar *Data; + int Size; +}; + +struct TWriteBinaryFile { + struct TWriteStream super_TWriteStream; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + FILE *File; + char Filename[4096]; +}; + +struct TWriteScriptFile { + FILE *File; + char Filename[4096]; + int Line; +}; + +struct TReadBinaryFile { + struct TReadStream super_TReadStream; + undefined field1_0x1; + undefined field2_0x2; + undefined field3_0x3; + FILE *File; + char Filename[4096]; + int FileSize; +}; + +struct TReadScriptFile { + enum TOKEN Token; + FILE *File[3]; + char Filename[3][4096]; + int Line[3]; + char String[4000]; + int RecursionDepth; + uchar *Bytes; + int Number; + int CoordX; + int CoordY; + int CoordZ; + char Special; +}; + +struct TNPC { + struct TNonplayer super_TNonplayer; + ulong Interlocutor; + int Topic; + int Price; + int Amount; + int TypeID; + ulong Data; + ulong LastTalk; + struct vector QueuedPlayers; + struct vector QueuedAddresses; + int QueueLength; + struct TBehaviourDatabase *Behaviour; +}; + +struct TBehaviourDatabase { + struct vector Behaviour; + int Behaviours; +}; + +struct TMonster { + struct TNonplayer super_TNonplayer; + int Home; + ulong Master; + ulong Target; +}; + +struct TRaceData { + char Name[30]; + char Article[3]; + struct TOutfit Outfit; + struct ObjectType MaleCorpse; + struct ObjectType FemaleCorpse; + enum BloodType Blood; + int ExperiencePoints; + int FleeThreshold; + int Attack; + int Defend; + int Armor; + int Poison; + int SummonCost; + int LoseTarget; + int Strategy[4]; + bool KickBoxes; + bool KickCreatures; + bool SeeInvisible; + bool Unpushable; + bool DistanceFighting; + bool NoSummon; + bool NoIllusion; + bool NoConvince; + bool NoBurning; + bool NoPoison; + bool NoEnergy; + bool NoHit; + bool NoLifeDrain; + bool NoParalyze; + int Skills; + struct vector Skill; + int Talks; + struct vector Talk; + int Items; + struct vector Item; + int Spells; + struct vector Spell; +}; + +struct TQueryManagerConnection { + int BufferSize; + uchar *Buffer; + struct TReadBuffer ReadBuffer; + struct TWriteBuffer WriteBuffer; + int Socket; + bool QueryOk; + undefined field6_0x2d; + undefined field7_0x2e; + undefined field8_0x2f; +}; + +struct TQueryManagerSettings { + char Host[50]; + int Port; + char Password[30]; +}; + +struct TQueryManagerPoolConnection { + struct TQueryManagerConnectionPool *QueryManagerConnectionPool; + struct TQueryManagerConnection *QueryManagerConnection; +}; + +struct TQueryManagerConnectionPool { + int NumberOfConnections; + struct TQueryManagerConnection *QueryManagerConnection; + bool *QueryManagerConnectionFree; + struct Semaphore FreeQueryManagerConnections; + struct Semaphore QueryManagerConnectionMutex; +}; + +// NOTE(fusion): Probably bigint structures for RSA decoding. +struct vlong_flex_unit { + uint n; + uint *a; + uint z; +}; + +struct vlong { + int (**_vptr.vlong)(...); + struct vlong_value *value; + int negative; +}; + +struct vlong_value { + struct vlong_flex_unit super_vlong_flex_unit; + uint share; +}; + +struct vlong_montgomery { + struct vlong R; + struct vlong R1; + struct vlong m; + struct vlong n1; + struct vlong T; + struct vlong k; + uint N; +}; + +// NOTE(fusion): Oh yes. +struct TRSAPrivateKey { + int (**_vptr.TRSAPrivateKey)(...); + struct vlong m_PrimeP; + struct vlong m_PrimeQ; + struct vlong m_U; + struct vlong m_DP; + struct vlong m_DQ; +}; + +struct TShortway { + struct matrix *Map; + struct TShortwayPoint *FirstToExpand; + struct TCreature *cr; + int VisibleX; + int VisibleY; + int StartX; + int StartY; + int StartZ; + int MinWaypoints; +}; diff --git a/src/creature.cc b/src/creature.cc new file mode 100644 index 0000000..b6b046b --- /dev/null +++ b/src/creature.cc @@ -0,0 +1,429 @@ +#include "creature.hh" +#include "enums.hh" + +// TSkill REGULAR FUNCTIONS +//============================================================================== +TSkill::TSkill(int SkNr, TCreature *Master){ + this->Reset(); + this->SkNr = (uint16)SkNr; + this->Master = Master; +} + +int TSkill::Get(void){ + int Value = this->Act; + if(Value < this->Min) + Value = this->Min; + Value += this->MDAct + this->DAct; + return Value; +} + +int TSkill::GetProgress(void){ + int Result = 0; + if(this->NextLevel > this->LastLevel){ + Result = (this->NextLevel - this->Exp) * 100 / (this->NextLevel - this->LastLevel); + + // TODO(fusion): This feels too much for reporting a mostly *impossible* error. + if(Result < 0 || Result > 100){ + error("TSkill::GetProgress: Berechnungsfehler Exp %d, Last %d, Next %d, Prozent %d.\n", + this->Exp, this->LastLevel, this->NextLevel, Result); + + const char *MasterName = "(Unknown"; + if(this->Master != NULL){ + MasterName = this->Master->Name; + } + error("# Spieler %s - Skill %d\n", MasterName, this->SkNr); + Result = 0; + } + } + return Result; +} + +void TSkill::Check(void){ + if(this->Act > this->Max){ + this->Act = this->Max; + } +} + +void TSkill::Change(int Amount){ + this->Set(this->Act + Amount); + + // TODO(fusion): Probably `TSkill::Check` inlined? It doesn't make a whole + // lot of sense because `TSkill::Set` also checks the value. Maybe a custom + // version of it does something differently? + if(this->Act > this->Max){ + this->Act = this->Max; + } +} + +void TSkill::SetMDAct(int MDAct){ + this->MDAct = MDAct; + if(this->SkNr == 4 && this->Master && this->Master->Type == PLAYER){ + // TODO(fusion): Same as `TSkill::Process`. + ((TPlayer*)this->Master)->CheckState(); + } +} + +void TSkill::Load(int Act, int Max, int Min, int DAct, int MDAct, + int Cycle, int MaxCycle, int Count, int MaxCount, int AddLevel, + int Exp, int FactorPercent, int NextLevel, int Delta){ + this->Act = Act; + this->Max = Max; + this->Min = Min; + this->DAct = DAct; + this->MDAct = MDAct; + this->Cycle = Cycle; + this->MaxCycle = MaxCycle; + this->Count = Count; + this->MaxCount = MaxCount; + this->AddLevel = AddLevel; + this->Exp = Exp; + this->FactorPercent = FactorPercent; + this->NextLevel = NextLevel; + this->Delta = Delta; + + // TODO(fusion): Shouldn't we also do the same for `NextLevel`? + this->LastLevel = this->GetExpForLevel(Act); + + TCreature *Master = this->Master; + if(Master && Cycle != 0){ + int SkNr = this->SkNr; + if(SkNr >= NARRAY(Master->Skills)){ + error("TSkillBase::SetTimer: Ungueltige SkNr: %d\n", SkNr); + return; + } + + // TODO(fusion): I'm not entirely sure wtf is going on here. + TSkill *Other = Master->Skills[SkNr]; + Master->DelTimer(SkNr); + if(Other->SetTimer(Cycle, Count, MaxCount, FactorPercent)){ + Master->TimerList[Master->FirstFreeTimer] = Other; + Master->FirstFreeTimer += 1; + } + } +} + + +void TSkill::Save(int *Act, int *Max, int *Min, int *DAct, int *MDAct, + int *Cycle, int *MaxCycle, int *Count, int *MaxCount, int *AddLevel, + int *Exp, int *FactorPercent, int *NextLevel, int *Delta){ + *Act = this->Act; + *Max = this->Max; + *Min = this->Min; + *DAct = this->DAct; + *MDAct = this->MDAct; + *Cycle = this->Cycle; + *MaxCycle = this->MaxCycle; + *Count = this->Count; + *MaxCount = this->MaxCount; + *AddLevel = this->AddLevel; + *Exp = this->Exp; + *FactorPercent = this->FactorPercent; + *NextLevel = this->NextLevel; + *Delta = this->Delta; +} + +// TSkill VIRTUAL FUNCTIONS +//============================================================================== +TSkill::~TSkill(void){ + if(this->Master != NULL){ + this->Master->DelTimer(this->SkNr); + } +} + +void TSkill::Set(int Value){ + if(Value > this->Max) + Value = this->Max; + this->Act = Value; +} + +void TSkill::Increase(int Amount){ + // no-op +} + +void TSkill::Decrease(int Amount){ + // no-op +} + +int TSkill::GetExpForLevel(int Level){ + return 0; +} + +void TSkill::Advance(int Range){ + // no-op +} + +void TSkill::ChangeSkill(int FactorPercent, int Delta){ + // no-op +} + +int TSkill::ProbeValue(int Max, bool Increase){ + return 0; +} + +bool TSkill::Probe(int Diff, int Prob, bool Increase){ + return false; +} + +bool TSkill::Process(void){ + bool Result = this->Cycle == 0; + if(Result){ + if(this->Master && this->Master->Type == PLAYER){ + // TODO(fusion): Verify if a simple pointer cast works. Maybe `dynamic_cast`? + ((TPlayer*)this->Master)->CheckState(); + } + }else if(this->Count <= 0){ + this->Count = this->MaxCount; + // NOTE(fusion): `Range` should move `Cycle` towards ZERO. + int Range = (this->Cycle < 1) ? +1 : -1; + this->Cycle += Range; + this->Event(Range); + }else{ + this->Count -= 1; + } + + return Result; +} + +bool TSkill::SetTimer(int Cycle, int Count, int MaxCount, int AdditionalValue){ + this->Cycle = Cycle; + this->Count = Count; + this->MaxCount = MaxCount; + if(this->Master && this->Master->Type == PLAYER){ + // TODO(fusion): Same as `TSkill::Process`. + ((TPlayer*)this->Master)->CheckState(); + } + return true; +} + +bool TSkill::DelTimer(void){ + this->Cycle = 0; + this->Count = 0; + this->MaxCount = 0; + if(this->Master && this->Master->Type == PLAYER){ + // TODO(fusion): Same as `TSkill::Process`. + ((TPlayer*)this->Master)->CheckState(); + } + return true; +} + +int TSkill::TimerValue(void){ + return this->Cycle; +} + +bool TSkill::Jump(int Range){ + return true; +} + +void TSkill::Event(int Range){ + // no-op +} + +void TSkill::Reset(void){ + this->Act = 0; + this->Max = INT_MAX; + this->Min = 0; + this->DAct = 0; + this->MDAct = 0; + this->FactorPercent = 1000; + this->LastLevel = 0; + this->NextLevel = INT_MAX; + this->Exp = 0; + this->Delta = INT_MAX; + this->Cycle = 0; + this->MaxCycle = 0; + this->Count = 0; + this->MaxCount = 0; + this->AddLevel = 0; +} + +// TSkillLevel +//============================================================================== +TSkillLevel::~TSkillLevel(void){ + if(this->Master != NULL){ + this->Master->DelTimer(this->SkNr); + } +} + +void TSkillLevel::Increase(int Amount){ + if (Amount < 0) { + error("TSkillLevel::Increase: Amount negativ (%d).\n", Amount); + return; + } + + // BUG(fusion): No bounds check as in `TSkillLevel::Decrease`? + + int Range = 0; + this->Exp += Amount; + while(this->Exp >= this->NextLevel){ + this->Act += 1; + this->LastLevel = this->GetExpForLevel(this->Act); + this->NextLevel = this->GetExpForLevel(this->Act + 1); + if(this->NextLevel < 0){ + // BUG(fusion): We don't check if `Master` is valid here? + error("TSkillLevel::Increase: Skill vor Überlauf (%s, Skill %d).\n", this->Master->Name, this->SkNr); + this->NextLevel = this->Exp; + this->Exp -= 1000000; + break; + } + Range += 1; + } + + if(Range != 0){ + this->Jump(Range); + } + + if(this->Master == NULL){ + error("TSkillLevel::Increase: GetMaster liefert NULL zurueck.\n"); + return; + } + + if(this->Master->Type == PLAYER){ + SendPlayerData(this->Master->Connection); + } +} + +void TSkillLevel::Decrease(int Amount){ + if(Amount < 0){ + error("TSkillLevel::Decrease: Amount negativ (%d).\n", Amount); + return; + } + + // TODO(fusion): This is some weird ass comparison. + if(Amount > this->Exp && this->Exp > 100000){ + error("TSkillLevel::Decrease: Amount zu gross(%d).\n", Amount); + return; + } + + int Range = 0; + if(Amount < this->Exp){ + this->Exp -= Amount; + }else{ + this->Exp = 0; + } + + // TODO(fusion): This could probably be an oversight but the decompiled + // function was calling `GetExpForLevel` instead of using `LastLevel` + // which makes me wonder whether `LastLevel` is properly initialized. + while(this->Exp < this->LastLevel){ + this->Act -= 1; + this->NextLevel = this->LastLevel; + this->LastLevel = this->GetExpForLevel(this->Act); + } + + if(Range != 0){ + this->Jump(Range); + } + + if(this->Master == NULL){ + error("TSkillLevel::Decrease: GetMaster liefert NULL zurueck.\n"); + return; + } + + if(this->Master->Type == PLAYER){ + SendPlayerData(this->Master->Connection); + } +} + +int TSkillLevel::GetExpForLevel(int Level){ + if(Level < 1){ + error("TSkillLevel::GetExpForLevel: Ungültiger Level %d.\n", Level); + return 0; + } + + if(Level > 500){ + error("TSkillLevel::GetExpForLevel: Level=%d; Formel gegen Überlauf sichern.\n", Level); + return -1; + } + + if(this->Delta <= 0){ + error("TSkillLevel::GetExpForLevel: Ungültiger Delta-Wert %d.\n", this->Delta); + return 0; + } + + return ((((Level - 6) * Level + 17) * Level - 12) / 6) * this->Delta; +} + +bool TSkillLevel::Jump(int Range){ + if(this->Master == NULL){ + error("TSkillLevel::Jump: GetMaster liefert NULL zurueck!\n"); + return false; + } + + this->Master->Skills[SKILL_HITPOINTS ]->Advance(Range); + this->Master->Skills[SKILL_MANA ]->Advance(Range); + this->Master->Skills[SKILL_GO_STRENGTH ]->Advance(Range); + this->Master->Skills[SKILL_CARRY_WEIGHT]->Advance(Range); + + AnnounceChangedCreature(this->Master->ID, 4); + this->Master->Combat.CheckCombatValues(); + + if(this->Master->Type == PLAYER){ + // TODO(fusion): Probably `TSkill::Get` inlined? + int Level = this->Act; + if(Level < this->Min) + Level = this->Min; + Level += this->MDAct + this->DAct; + // == + + int FromLevel = Level - Range; + int ToLevel = Level; + if(Range > 0){ + SendMessage(this->Master->Connection, TALK_ANONYMOUS_BROADCAST, + "You advanced from Level %d to Level %d.", FromLevel, ToLevel); + }else if(Range < 0){ + SendMessage(this->Master->Connection, TALK_ANONYMOUS_BROADCAST, + "You were downgraded from Level %d to Level %d.", FromLevel, ToLevel); + } + } + + return true; +} + +// Creature Functions +//============================================================================== +// TODO(fusion): This was the first function I attempted to cleanup but soon +// realized we should start with the building blocks of the codebase, namely +// TSkill, TSkillBase, etc... +// We should probably come back to this once we start doing creature functions +// again. +void CheckMana(TCreature *Creature, int ManaPoints, int SoulPoints, int Delay){ + if(Creature == NULL){ + error("CheckMana: Übergebene Kreatur existiert nicht.\n"); + throw ERROR; + } + + if(Creature->Type != PLAYER || ManaPoints < 0) + return; + + TSkill *Mana = Creature->Skills[SKILL_MANA]; + if(Mana == NULL){ + error("CheckMana: Kein Skill MANA!\n"); + throw ERROR; + } + + TSkill *Soul = Creature->Skills[SKILL_SOUL]; + if(Soul == NULL){ + error("CheckMana: Kein Skill SOULPOINTS!\n"); + throw ERROR; + } + + if(!CheckRight(Creature->ID, UNLIMITED_MANA)){ + if(Mana->Get() < ManaPoints) + throw NOTENOUGHMANA; + + if(Soul->Get() < SoulPoints) + throw NOTENOUGHSOULPOINTS; + + Mana->Change(-ManaPoints); + Soul->Change(-SoulPoints); + } + + if(ManaPoints > 0){ + Creature->Skills[SKILL_MAGIC_LEVEL]->Increase(ManaPoints); + } + + // NOTE(fusion): Maintain largest exhaust? + int EarliestSpellTime = Delay + ServerMilliseconds; + if(Creature->EarliestSpellTime < EarliestSpellTime) + Creature->EarliestSpellTime = EarliestSpellTime; +} diff --git a/src/creature.hh b/src/creature.hh new file mode 100644 index 0000000..b471662 --- /dev/null +++ b/src/creature.hh @@ -0,0 +1,76 @@ +#ifndef TIBIA_CREATURE_HH_ +#define TIBIA_CREATURE_HH_ 1 + +#include "main.hh" + +struct TSkillBase; +struct TCreature; +struct TPlayer; + +struct TSkill{ + // REGULAR FUNCTIONS + // ========================================================================= + TSkill(int SkNr, TCreature *Master); + int Get(void); + int GetProgress(void); + void Check(void); + void Change(int Amount); + void SetMDAct(int MDAct); + void Load(int Act, int Max, int Min, int DAct, int MDAct, + int Cycle, int MaxCycle, int Count, int MaxCount, int AddLevel, + int Exp, int FactorPercent, int NextLevel, int Delta); + void Save(int *Act, int *Max, int *Min, int *DAct, int *MDAct, + int *Cycle, int *MaxCycle, int *Count, int *MaxCount, int *AddLevel, + int *Exp, int *FactorPercent, int *NextLevel, int *Delta); + + // VIRTUAL FUNCTIONS + // ========================================================================= + virtual ~TSkill(void); // VTABLE[ 0] + //virtual ~TSkill(void); // Duplicate destructor that also calls operator delete. // VTABLE[ 1] + virtual void Set(int Value); // VTABLE[ 2] + virtual void Increase(int Amount); // VTABLE[ 3] + virtual void Decrease(int Amount); // VTABLE[ 4] + virtual int GetExpForLevel(int Level); // VTABLE[ 5] + virtual void Advance(int Range); // VTABLE[ 6] + virtual void ChangeSkill(int FactorPercent, int Delta); // VTABLE[ 7] + virtual int ProbeValue(int Max, bool Increase); // VTABLE[ 8] + virtual bool Probe(int Diff, int Prob, bool Increase); // VTABLE[ 9] + virtual bool Process(void); // VTABLE[10] + virtual bool SetTimer(int Cycle, int Count, int MaxCount, int AdditionalValue); // VTABLE[11] + virtual bool DelTimer(void); // VTABLE[12] + virtual int TimerValue(void); // VTABLE[13] + virtual bool Jump(int Range); // VTABLE[14] + virtual void Event(int Range); // VTABLE[15] + virtual void Reset(void); // VTABLE[16] + + // DATA + // ========================================================================= + //void *VTABLE; // IMPLICIT + int DAct; // Delta Value - Probably from equipment. + int MDAct; // Delta Magic Value - Probably from spells. + uint16 SkNr; + TCreature *Master; + int Act; // Actual Value (?) + int Max; + int Min; + int FactorPercent; + int LastLevel; + int NextLevel; + int Delta; + int Exp; + int Cycle; + int MaxCycle; + int Count; + int MaxCount; + int AddLevel; +}; + +struct TSkillLevel: TSkill { + ~TSkillLevel(void) override; + void Increase(int Amount) override; + void Decrease(int Amount) override; + int GetExpForLevel(int Level) override; + bool Jump(int Range) override; +}; + +#endif //TIBIA_CREATURE_HH_ diff --git a/src/enums.hh b/src/enums.hh new file mode 100644 index 0000000..8212db1 --- /dev/null +++ b/src/enums.hh @@ -0,0 +1,219 @@ +#ifndef TIBIA_ENUMS_HH_ +#define TIBIA_ENUMS_HH_ 1 + +#include "main.hh" + +// TODO(fusion): Probably cleanup these names? Prefix values? Its crazy that +// there are no collision problems (possibly yet). + +enum CreatureType: int { + PLAYER = 0, + MONSTER = 1, + NPC = 2, +}; + +enum RESULT: int { + ERROR = -1, + NOERROR = 0, + NOTACCESSIBLE = 1, + NOTMOVABLE = 2, + NOTTAKABLE = 3, + NOROOM = 4, + OUTOFRANGE = 5, + OUTOFHOME = 6, + CANNOTTHROW = 7, + TOOHEAVY = 8, + CROSSREFERENCE = 9, + CONTAINERFULL = 10, + WRONGPOSITION = 11, + WRONGPOSITION2 = 12, + WRONGCLOTHES = 13, + HANDSNOTFREE = 14, + HANDBLOCKED = 15, + ONEWEAPONONLY = 16, + NOMATCH = 17, + NOTCUMULABLE = 18, + TOOMANYPARTS = 19, + EMPTYCONTAINER = 20, + SPLITOBJECT = 21, + NOKEYMATCH = 22, + UPSTAIRS = 23, + DOWNSTAIRS = 24, + CREATURENOTEXISTING = 25, + PLAYERNOTEXISTING = 26, + PLAYERNOTONLINE = 27, + NAMEAMBIGUOUS = 28, + NOTUSABLE = 29, + FEDUP = 30, + DESTROYED = 31, + SPELLUNKNOWN = 32, + LOWMAGICLEVEL = 33, + MAGICITEM = 34, + NOTENOUGHMANA = 35, + NOSKILL = 36, + TARGETLOST = 37, + OUTOFAMMO = 38, + NOCREATURE = 39, + TOOLONG = 40, + TARGETOUTOFRANGE = 41, + TARGETHIDDEN = 42, + ATTACKNOTALLOWED = 43, + NOWAY = 44, + LOGINERROR = 45, + LOGINABORT = 46, + PROTECTIONZONE = 47, + ENTERPROTECTIONZONE = 48, + EXHAUSTED = 49, + NOTINVITED = 50, + NOPREMIUMACCOUNT = 51, + MOVENOTPOSSIBLE = 52, + ALREADYTRADING = 53, + PARTNERTRADING = 54, + TOOMANYOBJECTS = 55, + TOOMANYSLAVES = 56, + NOTTURNABLE = 57, + SECUREMODE = 58, + NOTENOUGHSOULPOINTS = 59, + LOWLEVEL = 60, +}; + +enum RIGHT: int { + PREMIUM_ACCOUNT = 0, + NOTATION = 1, + NAMELOCK = 2, + STATEMENT_REPORT = 3, + BANISHMENT = 4, + FINAL_WARNING = 5, + IP_BANISHMENT = 6, + KICK = 7, + HOME_TELEPORT = 8, + GAMEMASTER_BROADCAST = 9, + ANONYMOUS_BROADCAST = 10, + NO_BANISHMENT = 11, + ALLOW_MULTICLIENT = 12, + LOG_COMMUNICATION = 13, + READ_GAMEMASTER_CHANNEL = 14, + READ_TUTOR_CHANNEL = 15, + HIGHLIGHT_HELP_CHANNEL = 16, + SEND_BUGREPORTS = 17, + NAME_INSULTING = 18, + NAME_SENTENCE = 19, + NAME_NONSENSICAL_LETTERS = 20, + NAME_BADLY_FORMATTED = 21, + NAME_NO_PERSON = 22, + NAME_CELEBRITY = 23, + NAME_COUNTRY = 24, + NAME_FAKE_IDENTITY = 25, + NAME_FAKE_POSITION = 26, + STATEMENT_INSULTING = 27, + STATEMENT_SPAMMING = 28, + STATEMENT_ADVERT_OFFTOPIC = 29, + STATEMENT_ADVERT_MONEY = 30, + STATEMENT_NON_ENGLISH = 31, + STATEMENT_CHANNEL_OFFTOPIC = 32, + STATEMENT_VIOLATION_INCITING = 33, + CHEATING_BUG_ABUSE = 34, + CHEATING_GAME_WEAKNESS = 35, + CHEATING_MACRO_USE = 36, + CHEATING_MODIFIED_CLIENT = 37, + CHEATING_HACKING = 38, + CHEATING_MULTI_CLIENT = 39, + CHEATING_ACCOUNT_TRADING = 40, + CHEATING_ACCOUNT_SHARING = 41, + GAMEMASTER_THREATENING = 42, + GAMEMASTER_PRETENDING = 43, + GAMEMASTER_INFLUENCE = 44, + GAMEMASTER_FALSE_REPORTS = 45, + KILLING_EXCESSIVE_UNJUSTIFIED = 46, + DESTRUCTIVE_BEHAVIOUR = 47, + SPOILING_AUCTION = 48, + INVALID_PAYMENT = 49, + TELEPORT_TO_CHARACTER = 50, + TELEPORT_TO_MARK = 51, + TELEPORT_VERTICAL = 52, + TELEPORT_TO_COORDINATE = 53, + LEVITATE = 54, + SPECIAL_MOVEUSE = 55, + MODIFY_GOSTRENGTH = 56, + SHOW_COORDINATE = 57, + RETRIEVE = 58, + ENTER_HOUSES = 59, + OPEN_NAMEDOORS = 60, + INVULNERABLE = 61, + UNLIMITED_MANA = 62, + KEEP_INVENTORY = 63, + ALL_SPELLS = 64, + UNLIMITED_CAPACITY = 65, + ZERO_CAPACITY = 66, + ATTACK_EVERYWHERE = 67, + NO_ATTACK = 68, + NO_RUNES = 69, + NO_LOGOUT_BLOCK = 70, + GAMEMASTER_OUTFIT = 71, + ILLUMINATE = 72, + CHANGE_PROFESSION = 73, + IGNORED_BY_MONSTERS = 74, + SHOW_KEYHOLE_NUMBERS = 75, + CREATE_OBJECTS = 76, + CREATE_MONEY = 77, + CREATE_MONSTERS = 78, + CHANGE_SKILLS = 79, + CLEANUP_FIELDS = 80, + NO_STATISTICS = 81, +}; + +// NOTE(fusion): This didn't exist int the decompiled version but is handy when +// accessing a creature's `Skills` table. +enum Skill: int { + SKILL_LEVEL = 0, + SKILL_MAGIC_LEVEL = 1, + SKILL_HITPOINTS = 2, + SKILL_MANA = 3, + SKILL_GO_STRENGTH = 4, // speed? + SKILL_CARRY_WEIGHT = 5, // capacity? + SKILL_FIST = 6, + SKILL_CLUB = 7, + SKILL_SWORD = 8, + SKILL_AXE = 9, + SKILL_DISTANCE = 10, + SKILL_SHIELDING = 11, + // 12? + SKILL_FISHING = 13, + SKILL_FED = 14, + SKILL_LIGHT = 15, + SKILL_ILLUSION = 16, + SKILL_POISON = 17, + SKILL_BURNING = 18, + SKILL_ENERGY = 19, + // 20? + // 21? + SKILL_SOUL = 22, +}; + +enum TalkMode: int { + TALK_SAY = 1, + TALK_WHISPER = 2, + TALK_YELL = 3, + TALK_PRIVATE_MESSAGE = 4, + TALK_CHANNEL_CALL = 5, + TALK_GAMEMASTER_REQUEST = 6, + TALK_GAMEMASTER_ANSWER = 7, + TALK_PLAYER_ANSWER = 8, + TALK_GAMEMASTER_BROADCAST = 9, + TALK_GAMEMASTER_CHANNELCALL = 10, + TALK_GAMEMASTER_MESSAGE = 11, + TALK_HIGHLIGHT_CHANNELCALL = 12, + TALK_ANONYMOUS_BROADCAST = 13, + TALK_ANONYMOUS_CHANNELCALL = 14, + TALK_ANONYMOUS_MESSAGE = 15, + TALK_ANIMAL_LOW = 16, + TALK_ANIMAL_LOUD = 17, + TALK_ADMIN_MESSAGE = 18, + TALK_EVENT_MESSAGE = 19, + TALK_LOGIN_MESSAGE = 20, + TALK_STATUS_MESSAGE = 21, + TALK_INFO_MESSAGE = 22, + TALK_FAILURE_MESSAGE = 23, +}; + +#endif //TIBIA_ENUMS_HH_ diff --git a/src/main.cc b/src/main.cc new file mode 100644 index 0000000..e616ce3 --- /dev/null +++ b/src/main.cc @@ -0,0 +1,38 @@ +#include "main.hh" + +#if 0 +// TODO(fusion): All globals should probably be packed into a `GlobalState` +// structure to minimize collisions and bugs. +struct GlobalState{ + // world state + // creatures + // items + // etc... +}; + +GlobalState G = {}; +#endif + +// TODO(fusion): Probably current server time. Used for delays, timers, etc. +int ServerMilliseconds = 0; + +void (*ErrorFunction)(const char*) = NULL; + +void error(char *Text, ...){ + char s[1024]; + + va_list ap; + va_start(ap, Text); + vsnprintf(s, sizeof(s) - 1, Text, ap); + va_end(ap); + + if(ErrorFunction){ + ErrorFunction(s); + }else{ + printf("%s", s); + } +} + +int main(int argc, char **argv){ + return 0; +} diff --git a/src/main.hh b/src/main.hh new file mode 100644 index 0000000..ad4f3ca --- /dev/null +++ b/src/main.hh @@ -0,0 +1,78 @@ +#ifndef TIBIA_MAIN_HH_ +#define TIBIA_MAIN_HH_ 1 + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uintptr_t uintptr; +typedef size_t usize; + +#define STATIC_ASSERT(expr) static_assert((expr), "static assertion failed: " #expr) +#define NARRAY(arr) (sizeof(arr) / sizeof(arr[0])) +#define ISPOW2(x) ((x) != 0 && ((x) & ((x) - 1)) == 0) +#define KB(x) ((usize)(x) << 10) +#define MB(x) ((usize)(x) << 20) +#define GB(x) ((usize)(x) << 30) + +// TODO(fusion): We might not actually compile the output for the decompilation +// step but if we did, we'd need to make sure we're compiling in 32 bits mode. +STATIC_ASSERT(sizeof(bool) == 1); +STATIC_ASSERT(sizeof(int) == 4); +//STATIC_ASSERT(sizeof(void*) == 4); + +#if !OS_WINDOWS && !OS_LINUX +# if defined(_WIN32) +# define OS_WINDOWS 1 +# elif defined(__linux__) || defined(__gnu_linux__) +# define OS_LINUX 1 +# else +# error "Operating system not supported." +# endif +#endif + +#if !COMPILER_MSVC && !COMPILER_GCC && !COMPILER_CLANG +# if defined(_MSC_VER) +# define COMPILER_MSVC 1 +# elif defined(__GNUC__) +# define COMPILER_GCC 1 +# elif defined(__clang__) +# define COMPILER_CLANG 1 +# endif +#endif + +// NOTE(fusion): Compiler attributes. +#if COMPILER_GCC || COMPILER_CLANG +# define ATTR_FALLTHROUGH __attribute__((fallthrough)) +# define ATTR_PRINTF(x, y) __attribute__((format(printf, x, y))) +#else +# define ATTR_FALLTHROUGH +# define ATTR_PRINTF(x, y) +#endif + +#if COMPILER_MSVC +# define TRAP() __debugbreak(); +#elif COMPILER_GCC || COMPILER_CLANG +# define TRAP() __builtin_trap() +#else +# define TRAP() abort() +#endif + +#define ASSERT_ALWAYS(expr) if(!(expr)) { TRAP(); } +#if BUILD_DEBUG +# define ASSERT(expr) ASSERT_ALWAYS(expr) +#else +# define ASSERT(expr) ((void)(expr)) +#endif + +void error(char *Text, ...) ATTR_PRINTF(1, 2); + +#endif //TIBIA_MAIN_HH_