From 15b40c7915fca14e537534ae9ba03f3add965943 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Fri, 13 Jun 2025 03:35:56 -0300 Subject: more work on `operate.cc` --- reference/game.c | 1806 ------------------------------------------------------ 1 file changed, 1806 deletions(-) (limited to 'reference/game.c') diff --git a/reference/game.c b/reference/game.c index b68c771..9a9762d 100644 --- a/reference/game.c +++ b/reference/game.c @@ -18375,1812 +18375,6 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority return; } -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 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 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 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) { -- cgit v1.2.3