• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Programmer [Avesta Sources] Paying for help!

Veterana

Oldschool Player
Joined
May 4, 2010
Messages
194
Reaction score
7
I need help with removing stairjump exhaust from Avesta.
Also need help with making objects such as parcels not walkable if they are stacked, just like in the old days of Tibia.
What sources do i need to edit?


I am more then happy to pay the person who helped me!
 
Keep your money ;]

How to fix UH Trap and Parcel Trap:

game.cpp
Code:
Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index,
	uint32_t spriteId /*= 0*/, stackPosType_t type /*= STACKPOS_NORMAL*/)
{
	if(pos.x != 0xFFFF){
		Tile* tile = getTile(pos.x, pos.y, pos.z);
 
		if(tile){
			/*look at*/
			if(type == STACKPOS_LOOK){
				return tile->getTopThing();
			}
 
			Thing* thing = NULL;
 
			/*for move operations*/
			if(type == STACKPOS_MOVE){
				Item* item = tile->getTopDownItem();
				if(item && !item->isNotMoveable())
					thing = item;
				else
					thing = tile->getTopCreature();
			}
			/*use item*/
			else if(type == STACKPOS_USE){
				thing = tile->getTopDownItem();
			}
			else if(type == STACKPOS_USEITEM){
				 //First check items with topOrder 2 (ladders, signs, splashes)
				Item* item =  tile->getItemByTopOrder(0);
				if(item && g_actions->hasAction(item)){
					thing = item;
				}
				else{
					//then down items
					thing = tile->getTopDownItem();
					if(thing == NULL){
						//then last we check items with topOrder 3 (doors etc)
						thing = tile->getTopTopItem();
					}
				}
			}
			else{
				thing = tile->__getThing(index);
			}
 
			if(player){
				//do extra checks here if the thing is accessable
				if(thing && thing->getItem()){
					if(tile->hasProperty(ISVERTICAL)){
						if(player->getPosition().x + 1 == tile->getPosition().x){
							thing = NULL;
						}
					}
					else if(tile->hasProperty(ISHORIZONTAL)){
						if(player->getPosition().y + 1 == tile->getPosition().y){
							thing = NULL;
						}
					}
				}
			}
 
			return thing;
		}
	}
	else{
		//container
		if(pos.y & 0x40){
			uint8_t fromCid = pos.y & 0x0F;
			uint8_t slot = pos.z;
 
			Container* parentcontainer = player->getContainer(fromCid);
			if(!parentcontainer)
				return NULL;
 
			return parentcontainer->getItem(slot);
		}
		else if(pos.y == 0 && pos.z == 0){
			const ItemType& it = Item::items.getItemIdByClientId(spriteId);
			if(it.id == 0){
				return NULL;
			}
 
			int32_t subType = -1;
			if(it.isFluidContainer()){
				int32_t maxFluidType = sizeof(reverseFluidMap) / sizeof(uint32_t);
				if(index < maxFluidType){
					subType = reverseFluidMap[index];
				}
			}
 
			return findItemOfType(player, it.id, true, subType);
		}
		//inventory
		else{
			slots_t slot = (slots_t)static_cast<unsigned char>(pos.y);
			return player->getInventoryItem(slot);
		}
	}
 
	return NULL;
}

game.cpp
Code:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
	Cylinder* fromTile = creature->getTile();
	Cylinder* toTile = NULL;

	const Position& currentPos = creature->getPosition();
	Position destPos = currentPos;

	bool canChangeFloor = true;
	switch(direction){
		case NORTH:
			destPos.y -= 1;
			break;

		case SOUTH:
			destPos.y += 1;
			break;

		case WEST:
			destPos.x -= 1;
			break;

		case EAST:
			destPos.x += 1;
			break;

		case SOUTHWEST:
			destPos.x -= 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;

		case NORTHWEST:
			destPos.x -= 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case NORTHEAST:
			destPos.x += 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case SOUTHEAST:
			destPos.x += 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;
	}

	if(creature->getPlayer() && canChangeFloor){
		//try go up
		if(currentPos.z != 8 && creature->getTile()->hasHeight(3)){
			Tile* tmpTile = map->getTile(currentPos.x, currentPos.y, currentPos.z - 1);
			if(tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z - 1);
				if(tmpTile && tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z -= 1;
				}
			}
		}
		else{
			//try go down
			Tile* tmpTile = map->getTile(destPos);
			if(currentPos.z != 7 && (tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID)))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z + 1);

				if(tmpTile && tmpTile->hasHeight(3)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z += 1;
				}
			}
		}
	}

	toTile = map->getTile(destPos);
	
	Tile* toPos = getTile(destPos.x, destPos.y, destPos.z);
	Tile* fromPos = getTile(currentPos.x, currentPos.y, currentPos.z);
	
	ReturnValue ret = RET_NOTPOSSIBLE;

	if(toTile != NULL){
		if (currentPos.z > destPos.z && toPos->getHeight() > 1);
			// not possible
		else if ((((toPos->getHeight() - fromPos->getHeight()) < 2)) || 
			(fromPos->hasHeight(3) && (currentPos.z == destPos.z)) ||
			((currentPos.z < destPos.z) && (toPos->hasHeight(3) && (fromPos->getHeight() < 2))))
			ret = internalMoveCreature(creature, fromTile, toTile, flags);
	}

	if(ret != RET_NOERROR){
		if(Player* player = creature->getPlayer()){
			player->sendCancelMessage(ret);
			player->sendCancelWalk();
		}
	}

	return ret;
}

Tile.cpp:

Change
Code:
uint32_t Tile::getHeight() const

To this:
Code:
int32_t Tile::getHeight() const

Tile.h:

Change this:
Code:
uint32_t getHeight() const;

To this:
Code:
int32_t getHeight() const;
 
Keep your money ;]

How to fix UH Trap and Parcel Trap:

game.cpp
Code:
Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index,
	uint32_t spriteId /*= 0*/, stackPosType_t type /*= STACKPOS_NORMAL*/)
{
	if(pos.x != 0xFFFF){
		Tile* tile = getTile(pos.x, pos.y, pos.z);
 
		if(tile){
			/*look at*/
			if(type == STACKPOS_LOOK){
				return tile->getTopThing();
			}
 
			Thing* thing = NULL;
 
			/*for move operations*/
			if(type == STACKPOS_MOVE){
				Item* item = tile->getTopDownItem();
				if(item && !item->isNotMoveable())
					thing = item;
				else
					thing = tile->getTopCreature();
			}
			/*use item*/
			else if(type == STACKPOS_USE){
				thing = tile->getTopDownItem();
			}
			else if(type == STACKPOS_USEITEM){
				 //First check items with topOrder 2 (ladders, signs, splashes)
				Item* item =  tile->getItemByTopOrder(0);
				if(item && g_actions->hasAction(item)){
					thing = item;
				}
				else{
					//then down items
					thing = tile->getTopDownItem();
					if(thing == NULL){
						//then last we check items with topOrder 3 (doors etc)
						thing = tile->getTopTopItem();
					}
				}
			}
			else{
				thing = tile->__getThing(index);
			}
 
			if(player){
				//do extra checks here if the thing is accessable
				if(thing && thing->getItem()){
					if(tile->hasProperty(ISVERTICAL)){
						if(player->getPosition().x + 1 == tile->getPosition().x){
							thing = NULL;
						}
					}
					else if(tile->hasProperty(ISHORIZONTAL)){
						if(player->getPosition().y + 1 == tile->getPosition().y){
							thing = NULL;
						}
					}
				}
			}
 
			return thing;
		}
	}
	else{
		//container
		if(pos.y & 0x40){
			uint8_t fromCid = pos.y & 0x0F;
			uint8_t slot = pos.z;
 
			Container* parentcontainer = player->getContainer(fromCid);
			if(!parentcontainer)
				return NULL;
 
			return parentcontainer->getItem(slot);
		}
		else if(pos.y == 0 && pos.z == 0){
			const ItemType& it = Item::items.getItemIdByClientId(spriteId);
			if(it.id == 0){
				return NULL;
			}
 
			int32_t subType = -1;
			if(it.isFluidContainer()){
				int32_t maxFluidType = sizeof(reverseFluidMap) / sizeof(uint32_t);
				if(index < maxFluidType){
					subType = reverseFluidMap[index];
				}
			}
 
			return findItemOfType(player, it.id, true, subType);
		}
		//inventory
		else{
			slots_t slot = (slots_t)static_cast<unsigned char>(pos.y);
			return player->getInventoryItem(slot);
		}
	}
 
	return NULL;
}

game.cpp
Code:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
	Cylinder* fromTile = creature->getTile();
	Cylinder* toTile = NULL;

	const Position& currentPos = creature->getPosition();
	Position destPos = currentPos;

	bool canChangeFloor = true;
	switch(direction){
		case NORTH:
			destPos.y -= 1;
			break;

		case SOUTH:
			destPos.y += 1;
			break;

		case WEST:
			destPos.x -= 1;
			break;

		case EAST:
			destPos.x += 1;
			break;

		case SOUTHWEST:
			destPos.x -= 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;

		case NORTHWEST:
			destPos.x -= 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case NORTHEAST:
			destPos.x += 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case SOUTHEAST:
			destPos.x += 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;
	}

	if(creature->getPlayer() && canChangeFloor){
		//try go up
		if(currentPos.z != 8 && creature->getTile()->hasHeight(3)){
			Tile* tmpTile = map->getTile(currentPos.x, currentPos.y, currentPos.z - 1);
			if(tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z - 1);
				if(tmpTile && tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z -= 1;
				}
			}
		}
		else{
			//try go down
			Tile* tmpTile = map->getTile(destPos);
			if(currentPos.z != 7 && (tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID)))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z + 1);

				if(tmpTile && tmpTile->hasHeight(3)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z += 1;
				}
			}
		}
	}

	toTile = map->getTile(destPos);
	
	Tile* toPos = getTile(destPos.x, destPos.y, destPos.z);
	Tile* fromPos = getTile(currentPos.x, currentPos.y, currentPos.z);
	
	ReturnValue ret = RET_NOTPOSSIBLE;

	if(toTile != NULL){
		if (currentPos.z > destPos.z && toPos->getHeight() > 1);
			// not possible
		else if ((((toPos->getHeight() - fromPos->getHeight()) < 2)) || 
			(fromPos->hasHeight(3) && (currentPos.z == destPos.z)) ||
			((currentPos.z < destPos.z) && (toPos->hasHeight(3) && (fromPos->getHeight() < 2))))
			ret = internalMoveCreature(creature, fromTile, toTile, flags);
	}

	if(ret != RET_NOERROR){
		if(Player* player = creature->getPlayer()){
			player->sendCancelMessage(ret);
			player->sendCancelWalk();
		}
	}

	return ret;
}

Tile.cpp:

Change
Code:
uint32_t Tile::getHeight() const

To this:
Code:
int32_t Tile::getHeight() const

Tile.h:

Change this:
Code:
uint32_t getHeight() const;

To this:
Code:
int32_t getHeight() const;


I can tell that these fixes doesnt work because u can drag with ur mouse urself on the 2 stacked parcels so bad fix..


fix for stair delay exhaust =
find:
Code:
void Creature::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos, const Tile* oldTile, const Position& oldPos, uint32_t oldStackPos, bool teleport)

in your sources then after find this

Code:
if(oldPos.z != newPos.z){
//floor change extra cost
lastStepCost = 2;
}

change lastStepCost to 1 and congratz exhaust has been removed;)

kind regards
 
Keep your money ;]

How to fix UH Trap and Parcel Trap:

game.cpp
Code:
Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index,
	uint32_t spriteId /*= 0*/, stackPosType_t type /*= STACKPOS_NORMAL*/)
{
	if(pos.x != 0xFFFF){
		Tile* tile = getTile(pos.x, pos.y, pos.z);
 
		if(tile){
			/*look at*/
			if(type == STACKPOS_LOOK){
				return tile->getTopThing();
			}
 
			Thing* thing = NULL;
 
			/*for move operations*/
			if(type == STACKPOS_MOVE){
				Item* item = tile->getTopDownItem();
				if(item && !item->isNotMoveable())
					thing = item;
				else
					thing = tile->getTopCreature();
			}
			/*use item*/
			else if(type == STACKPOS_USE){
				thing = tile->getTopDownItem();
			}
			else if(type == STACKPOS_USEITEM){
				 //First check items with topOrder 2 (ladders, signs, splashes)
				Item* item =  tile->getItemByTopOrder(0);
				if(item && g_actions->hasAction(item)){
					thing = item;
				}
				else{
					//then down items
					thing = tile->getTopDownItem();
					if(thing == NULL){
						//then last we check items with topOrder 3 (doors etc)
						thing = tile->getTopTopItem();
					}
				}
			}
			else{
				thing = tile->__getThing(index);
			}
 
			if(player){
				//do extra checks here if the thing is accessable
				if(thing && thing->getItem()){
					if(tile->hasProperty(ISVERTICAL)){
						if(player->getPosition().x + 1 == tile->getPosition().x){
							thing = NULL;
						}
					}
					else if(tile->hasProperty(ISHORIZONTAL)){
						if(player->getPosition().y + 1 == tile->getPosition().y){
							thing = NULL;
						}
					}
				}
			}
 
			return thing;
		}
	}
	else{
		//container
		if(pos.y & 0x40){
			uint8_t fromCid = pos.y & 0x0F;
			uint8_t slot = pos.z;
 
			Container* parentcontainer = player->getContainer(fromCid);
			if(!parentcontainer)
				return NULL;
 
			return parentcontainer->getItem(slot);
		}
		else if(pos.y == 0 && pos.z == 0){
			const ItemType& it = Item::items.getItemIdByClientId(spriteId);
			if(it.id == 0){
				return NULL;
			}
 
			int32_t subType = -1;
			if(it.isFluidContainer()){
				int32_t maxFluidType = sizeof(reverseFluidMap) / sizeof(uint32_t);
				if(index < maxFluidType){
					subType = reverseFluidMap[index];
				}
			}
 
			return findItemOfType(player, it.id, true, subType);
		}
		//inventory
		else{
			slots_t slot = (slots_t)static_cast<unsigned char>(pos.y);
			return player->getInventoryItem(slot);
		}
	}
 
	return NULL;
}

game.cpp
Code:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
	Cylinder* fromTile = creature->getTile();
	Cylinder* toTile = NULL;

	const Position& currentPos = creature->getPosition();
	Position destPos = currentPos;

	bool canChangeFloor = true;
	switch(direction){
		case NORTH:
			destPos.y -= 1;
			break;

		case SOUTH:
			destPos.y += 1;
			break;

		case WEST:
			destPos.x -= 1;
			break;

		case EAST:
			destPos.x += 1;
			break;

		case SOUTHWEST:
			destPos.x -= 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;

		case NORTHWEST:
			destPos.x -= 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case NORTHEAST:
			destPos.x += 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case SOUTHEAST:
			destPos.x += 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;
	}

	if(creature->getPlayer() && canChangeFloor){
		//try go up
		if(currentPos.z != 8 && creature->getTile()->hasHeight(3)){
			Tile* tmpTile = map->getTile(currentPos.x, currentPos.y, currentPos.z - 1);
			if(tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z - 1);
				if(tmpTile && tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z -= 1;
				}
			}
		}
		else{
			//try go down
			Tile* tmpTile = map->getTile(destPos);
			if(currentPos.z != 7 && (tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID)))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z + 1);

				if(tmpTile && tmpTile->hasHeight(3)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z += 1;
				}
			}
		}
	}

	toTile = map->getTile(destPos);
	
	Tile* toPos = getTile(destPos.x, destPos.y, destPos.z);
	Tile* fromPos = getTile(currentPos.x, currentPos.y, currentPos.z);
	
	ReturnValue ret = RET_NOTPOSSIBLE;

	if(toTile != NULL){
		if (currentPos.z > destPos.z && toPos->getHeight() > 1);
			// not possible
		else if ((((toPos->getHeight() - fromPos->getHeight()) < 2)) || 
			(fromPos->hasHeight(3) && (currentPos.z == destPos.z)) ||
			((currentPos.z < destPos.z) && (toPos->hasHeight(3) && (fromPos->getHeight() < 2))))
			ret = internalMoveCreature(creature, fromTile, toTile, flags);
	}

	if(ret != RET_NOERROR){
		if(Player* player = creature->getPlayer()){
			player->sendCancelMessage(ret);
			player->sendCancelWalk();
		}
	}

	return ret;
}

Tile.cpp:

Change
Code:
uint32_t Tile::getHeight() const

To this:
Code:
int32_t Tile::getHeight() const

Tile.h:

Change this:
Code:
uint32_t getHeight() const;

To this:
Code:
int32_t getHeight() const;


Cant get it to work man.
Am i supposed to change the game.cpp code too or not?
 
Back
Top