void Game::thingMoveInternal(Creature *creature, unsigned short from_x, unsigned short from_y, unsigned char from_z, unsigned char stackPos, unsigned short itemid, unsigned short to_x, unsigned short to_y, unsigned char to_z, unsigned char count) { Tile *fromTile = getTile(from_x, from_y, from_z); if(!fromTile) return; Tile *toTile = getTile(to_x, to_y, to_z); /* if(!toTile){ if(dynamic_cast(player)) dynamic_cast(player)->sendCancelWalk("Sorry, not possible..."); return; } */ Thing *thing = fromTile->getThingByStackPos(stackPos); #ifdef __DEBUG__ // std::cout << "moving" /* << ": from_x: "<< (int)from_x << ", from_y: "<< (int)from_y << ", from_z: "<< (int)from_z << ", stackpos: "<< (int)stackPos << ", to_x: "<< (int)to_x << ", to_y: "<< (int)to_y << ", to_z: "<< (int)to_z */ //<< std::endl; #endif if (!thing) return; Item* item = dynamic_cast(thing); Creature* creatureMoving = dynamic_cast(thing); Player* playerMoving = dynamic_cast(creatureMoving); Player* player = dynamic_cast(creature); Position oldPos; oldPos.x = from_x; oldPos.y = from_y; oldPos.z = from_z; #ifdef RULY_NOPUSHPARCEL if (toTile){ ItemVector::iterator brn; for (brn = toTile->downItems.begin(); brn != toTile->downItems.end(); brn++) { if (playerMoving && (*brn)->getID() == 2595 && player != thing || playerMoving && (*brn)->getID() == 2596 && player != thing) { player->sendCancel("Sorry not possible."); return; } } } #endif //RULY_NOPUSHPARCEL #ifdef RULY_ZITEM if(fromTile && playerMoving && player)//TODO: abs check { const Tile* down = getTile(to_x, to_y, to_z+1); if(down && down->zItem >= 3 && playerMoving->canMovedTo(down)) { if(getTile(to_x, to_y, to_z) == NULL){ teleport(playerMoving, Position(to_x, to_y, to_z+1)); return; } } else if(toTile && toTile->zItem >= 3 && fromTile->zItem <= 1) { playerMoving->sendCancelWalk(); player->sendCancel("Sorry, not possible."); return; } else if(toTile && toTile->zItem >= 2 && fromTile->zItem <= 0) { playerMoving->sendCancelWalk(); player->sendCancel("Sorry, not possible."); return; } else if(fromTile->zItem >= 3 && player == playerMoving) { if(getTile(from_x, from_y, from_z-1) == NULL) //going up { Tile* newTile = getTile(to_x, to_y, to_z-1); if(newTile && newTile->ground && playerMoving->canMovedTo(newTile)) { if(newTile->ground->getID() != 460 && newTile->ground->getID() != 459) { teleport(playerMoving, Position(to_x, to_y, to_z-1)); return; } } } } } #endif //RULY_ZITEM if(toTile) { Thing *tothing = toTile->getThingByStackPos( stackPos ); Item *toItem = dynamic_cast( tothing ); if( toItem && !playerMoving && !creatureMoving && toItem->getID() == 2494 ) { switch( item->getID() ) { //Undeleteable items case 1774: //Barrel case 1770: //Barrel player->sendTextMessage(MSG_SMALLINFO, "Sorry, not possible."); player->sendCancelWalk(); return; break; default: removeThing( playerMoving, oldPos, item, true ); return; break; } } } #ifdef TP_TRASH_BINS if(toTile) { Thing *tothing = toTile->getThingByStackPos(stackPos); Item *toItem = dynamic_cast(tothing); if(item && toItem && !playerMoving && !creature && toItem->isDeleter()) { fromTile->removeThing(item); this->FreeThing(item); //creatureBroadcastTileUpdated(oldPos); sendRemoveThing(player, item->pos, item, stackPos); return; } } #endif //TP_TRASH_BINS // *** Creature moving itself to a non-tile if(!toTile && creatureMoving && creatureMoving == creature){ //change level begin Tile* downTile = getTile(to_x, to_y, to_z+1); //diagonal begin if(!downTile) { #ifdef RULY_NOPUSHFIELDS if (toTile){ ItemVector::iterator brn; for (brn = toTile->downItems.begin(); brn != toTile->downItems.end(); brn++) { if (playerMoving && (*brn)->getID() == 1492 && player != thing || playerMoving && (*brn)->getID() == 1493 && player != thing || playerMoving && (*brn)->getID() == 1494 && player != thing || playerMoving && (*brn)->getID() == 1491 && player != thing || playerMoving && (*brn)->getID() == 1490 && player != thing || playerMoving && (*brn)->getID() == FIRE_FIELD && player != thing || playerMoving && (*brn)->getID() == FIRE_FIELD2 && player != thing || playerMoving && (*brn)->getID() == FIRE_FIELD3 && player != thing) { player->sendCancel("You cannot push players to the fields."); return; } } } #endif //RULY_NOPUSHFIELDS if(player) { player->sendTextMessage(MSG_SMALLINFO, "Sorry, not possible."); player->sendCancelWalk(); } return; }