Ilusion Edit Ots!

illusionedit.no-ip.biz


#1 2011-11-12 09:49:44

duszek

Spamer

Zarejestrowany: 2011-11-10
Posty: 12
Punktów :   

Blokada usuwania ścian.

W game.cpp nalezy usunac:

Spoiler:

bool Game::canDelete(Player *player, unsigned short itemid, Position toPos, Position fromPos, int from_stack, unsigned char count)
{
     OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::canDelete()");

     if(itemid == 99 || (itemid >= 4329 && itemid <= 4555))
         return false;
     else if(fromPos.x != 0xFFFF && ((abs(player->pos.x - fromPos.x) > 1) || (abs(player->pos.y - fromPos.y) > 1) || (player->pos.z != fromPos.z)))
        return false;
     else if(map->canThrowObjectTo(player->pos, toPos, BLOCK_PROJECTILE) != RET_NOERROR)
        return false;
     else if(toPos.x == 0xFFFF)
         return false;

     Item* trash = dynamic_cast<Item*>(getThing(fromPos, from_stack, player));
     if(trash){
         trash->pos = fromPos;
         if((abs(player->pos.x - toPos.x) > trash->throwRange) || (abs(player->pos.y - toPos.y) > trash->throwRange)) {       
            return false;
         }

         Tile *toTile = map->getTile(toPos);
         if(toTile){
             if((toTile->ground->getID() >= GROUND_WATER1 && toTile->ground->getID() <= GROUND_WATER3) || (toTile->ground->getID() >= GROUND_LAVA1 && toTile->ground->getID() <= GROUND_SWAMP4)){
                 if(!trash->isNotMoveable() && trash->isBlocking())
                     return false;
                 else if(trashObjects(player, toTile, trash, toPos, fromPos, from_stack, count))
                     return true;
             }
Item *toItem = dynamic_cast<Item*>(toTile->getTopTopItem());
             if(toItem && toItem->getID() == ITEM_DUSTBIN){
                 if(!trash->isNotMoveable() && trash->isBlocking())
                     return false;
                 else if(trashObjects(player, toTile, trash, toPos, fromPos, from_stack, count))
                     return true;
             }
         }
     }

     return false;
}   

bool Game::trashObjects(Player *player, Tile *toTile, Item *trash, Position toPos, Position fromPos, int from_stack, unsigned char count)
{
     //OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::trashObjects()");

     if(toTile){
         switch(toTile->ground->getID()){
             case GROUND_WATER1:
             spectatorEffect(toPos, NM_ME_LOOSE_ENERGY);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;   
             break;
             case GROUND_WATER2:
             spectatorEffect(toPos, NM_ME_LOOSE_ENERGY);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_WATER3:
             spectatorEffect(toPos, NM_ME_LOOSE_ENERGY);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_LAVA1:
             spectatorEffect(toPos, NM_ME_HITBY_FIRE);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_LAVA2:
             spectatorEffect(toPos, NM_ME_HITBY_FIRE);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_LAVA3:
             spectatorEffect(toPos, NM_ME_HITBY_FIRE);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_LAVA4:
             spectatorEffect(toPos, NM_ME_HITBY_FIRE);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_SWAMP1:
             spectatorEffect(toPos, NM_ME_POISEN_RINGS);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_SWAMP2:
             spectatorEffect(toPos, NM_ME_POISEN_RINGS);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_SWAMP3:
             spectatorEffect(toPos, NM_ME_POISEN_RINGS);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
             case GROUND_SWAMP4:
             spectatorEffect(toPos, NM_ME_POISEN_RINGS);
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
             break;
         }   

         Item *toItem = toTile->getTopItem();
         if(toItem && toItem->getID() == ITEM_DUSTBIN){
             if(trashItems(player, trash, fromPos, from_stack, count))
                 return true;
         }
     }

     return false;
}

bool Game::trashItems(Player *player, Item *trash, Position fromPos, int from_stack, unsigned char count)
{
    //OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::trashItems()");

    if(trash && player){
        if(trash->isStackable()){
            if(trash->getItemCountOrSubtype() > count){
                trash->setItemCountOrSubtype(trash->getItemCountOrSubtype() - count);
                sendUpdateThing(player,fromPos,trash,from_stack);
                player->updateInventoryWeigth();
                return true;
            }
            else{
                if(removeThing(player, fromPos, trash)){
                    player->updateInventoryWeigth();
                    return true;
                }
            }
        }
        else{
            if(removeThing(player, fromPos, trash)){
                player->updateInventoryWeigth();
                return true;
             }
        }
    }
    return false;
}

bool Game::canTeleportItem(Player *player, unsigned short itemid, Position toPos, Position fromPos, int from_stack, unsigned char count)
{
     OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::canTeleportItem()");

     if(itemid == 99 || (itemid >= 4329 && itemid <= 4555))
         return false;
     else if(fromPos.x != 0xFFFF && ((abs(player->pos.x - fromPos.x) > 1) || (abs(player->pos.y - fromPos.y) > 1) || (player->pos.z != fromPos.z)))
        return false;
     else if(map->canThrowObjectTo(player->pos, toPos, BLOCK_PROJECTILE) != RET_NOERROR)
        return false;
     else if(toPos.x == 0xFFFF)
         return false;
     else if(!checkChangeFloor(map->getTile(toPos), getTile(toPos.x,toPos.y,toPos.z+1)))
        return false;

     Item* tpItem = dynamic_cast<Item*>(getThing(fromPos, from_stack, player));
     if(tpItem){
         tpItem->pos = fromPos;
         if((abs(player->pos.x - toPos.x) > tpItem->throwRange) || (abs(player->pos.y - toPos.y) > tpItem->throwRange)) {       
            return false;
         }

         if(tpItem->isStackable()){
             if(tpItem->getItemCountOrSubtype() > count){
                 tpItem->setItemCountOrSubtype(tpItem->getItemCountOrSubtype() - count);
                 Item *newitem = Item::CreateItem(tpItem->getID(), count);
                 addThing(player,getTeleportPos(toPos),newitem);
                 sendUpdateThing(player,fromPos,tpItem,from_stack);
                 player->updateInventoryWeigth();
                 return true;
             }
             else{
                 if(removeThing(player, fromPos, tpItem)){
                     addThing(player,getTeleportPos(toPos),tpItem);
                     player->updateInventoryWeigth();
                     return true;
                 }
             }
         }
         else{
             if(removeThing(player, fromPos, tpItem)){
                 addThing(player,getTeleportPos(toPos),tpItem);
                 player->updateInventoryWeigth();
                 return true;
             }
         }
     }
     return false;
}

Position Game::getTeleportPos(Position to)
{
Tile *toTile = map->getTile(to);
if(toTile->ground && toTile->ground->floorChangeDown())
{
Tile* downTile = getTile(to.x, to.y, to.z+1);
if(downTile){
//diagonal begin
if(downTile->floorChange(NORTH) && downTile->floorChange(EAST)){
return Position(to.x-1, to.y+1, to.z+1);
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(WEST)){
return Position(to.x+1, to.y+1, to.z+1);
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(EAST)){
return Position(to.x-1, to.y-1, to.z+1);
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(WEST)){
return Position(to.x+1, to.y-1, to.z+1);
}
//diagonal end
else if(downTile->floorChange(NORTH)){
return Position(to.x, to.y+1, to.z+1);
}
else if(downTile->floorChange(SOUTH)){
return Position(to.x, to.y-1, to.z+1);
}
else if(downTile->floorChange(EAST)){
return Position(to.x-1, to.y, to.z+1);
}
else if(downTile->floorChange(WEST)){
return Position(to.x+1, to.y, to.z+1);
}
//floor change down
else if(Item::items[toTile->ground->getID()].floorChangeDown){
return Position(to.x, to.y, to.z+1);
}
else {
return Position(to.x, to.y, to.z+1);
}
}
}
//diagonal begin
else if(toTile->floorChange(NORTH) && toTile->floorChange(EAST)){
return Position(to.x+1, to.y-1, to.z-1);
}
else if(toTile->floorChange(NORTH) && toTile->floorChange(WEST)){
return Position(to.x-1, to.y-1, to.z-1);
}
else if(toTile->floorChange(SOUTH) && toTile->floorChange(EAST)){
return Position(to.x+1, to.y+1, to.z-1);
}
else if(toTile->floorChange(SOUTH) && toTile->floorChange(WEST)){
return Position(to.x-1, to.y+1, to.z-1);
}                 
else if(toTile->floorChange(NORTH)){
return Position(to.x, to.y-1, to.z-1);
}
else if(toTile->floorChange(SOUTH)){
return Position(to.x, to.y+1, to.z-1);
}
else if(toTile->floorChange(EAST)){
return Position(to.x+1, to.y, to.z-1);
}
else if(toTile->floorChange(WEST)){
return Position(to.x-1, to.y, to.z-1);
}                                     
if(!toTile){
Tile* downTile = getTile(to.x, to.y, to.z+1);
if(!downTile)
{
return Position(0,0,0);
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(EAST)){
return Position(to.x-2, to.y+2, to.z+1);
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(WEST)){
return Position(to.x+2, to.y+2, to.z+1);
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(EAST)){
return Position(to.x-2, to.y-2, to.z+1);
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(WEST)){
return Position(to.x+2, to.y-2, to.z+1);
}                                                   
else if(downTile->floorChange(NORTH)){
return Position(to.x, to.y + 1, to.z+1);
}
else if(downTile->floorChange(SOUTH)){
return Position(to.x, to.y - 1, to.z+1);
}
else if(downTile->floorChange(EAST)){
return Position(to.x - 1, to.y, to.z+1);
}
else if(downTile->floorChange(WEST)){
return Position(to.x + 1, to.y, to.z+1);
}
}
}

bool Game::checkChangeFloor(Tile *toTile, Tile* downTile)
{
if(toTile->ground && toTile->ground->floorChangeDown())
{
if(downTile){
if(downTile->floorChange(NORTH) && downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(WEST)){
return true;
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(WEST)){
return true;
}
else if(downTile->floorChange(NORTH)){
return true;
}
else if(downTile->floorChange(SOUTH)){
return true;
}
else if(downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(WEST)){
return true;
}
else if(Item::items[toTile->ground->getID()].floorChangeDown){
return true;
}
else {
return true;
}
}
}
else if(toTile->floorChange(NORTH) && toTile->floorChange(EAST)){
return true;
}
else if(toTile->floorChange(NORTH) && toTile->floorChange(WEST)){
return true;
}
else if(toTile->floorChange(SOUTH) && toTile->floorChange(EAST)){
return true;
}
else if(toTile->floorChange(SOUTH) && toTile->floorChange(WEST)){
return true;
}                   
else if(toTile->floorChange(NORTH)){
return true;
}
else if(toTile->floorChange(SOUTH)){
return true;
}
else if(toTile->floorChange(EAST)){
return true;
}
else if(toTile->floorChange(WEST)){
return true;
}
if(!toTile){
if(!downTile)
{
return false;
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(NORTH) && downTile->floorChange(WEST)){
return true;
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(SOUTH) && downTile->floorChange(WEST)){
return true;
}                                                     
else if(downTile->floorChange(NORTH)){
return true;
}
else if(downTile->floorChange(SOUTH)){
return true;
}
else if(downTile->floorChange(EAST)){
return true;
}
else if(downTile->floorChange(WEST)){
return true;
}
}
return false;
}

void Game::spectatorEffect(Position pos, unsigned char type)
{
    SpectatorVec list;
    SpectatorVec::iterator it;
    getSpectators(Range(pos, true), list);
         
    for(it = list.begin(); it != list.end(); ++it) {
        if(Player* p = dynamic_cast<Player*>(*it)) {
            p->sendMagicEffect(pos, type);
        }
    }
}

Teraz w game.h nalezy usunac:

Spoiler:

Position getTeleportPos(Position to);
bool canTeleportItem(Player *player, unsigned short itemid, Position toPos, Position fromPos, int from_stack, unsigned char count);
bool canDelete(Player *player, unsigned short itemid, Position toPos, Position fromPos, int from_stack, unsigned char count);
bool trashItems(Player *player, Item *trash, Position fromPos, int from_stack, unsigned char count);
bool trashObjects(Player *player, Tile *toTile, Item *trash, Position toPos, Position fromPos, int from_stack, unsigned char count);
bool checkChangeFloor(Tile *toTile, Tile* downTile);
void spectatorEffect(Position pos, unsigned char type);

W protocol76.cpp

Zamienic ten kod:

Spoiler:

Position from_pos = Position(from_x,from_y,from_z);
Position to_pos = Position(to_x,to_y,to_z);
if(game->canDelete(player, itemid, to_pos, from_pos, from_stack, count) || game->canTeleportItem(player, itemid, to_pos, from_pos, from_stack, count))
return;
if(from_x == to_x && from_y == to_y && from_z == to_z)
return;

Na ten:

Spoiler:

if(from_x == to_x && from_y == to_y && from_z == to_z)
return;

Jesli uzywasz BD trash systemu, jak np w devlandach, mozliwe ze w illusions to w protocol76.cpp znajdz:

Spoiler:

                             #ifdef BD_DOWN
Position from_pos = Position(from_x,from_y,from_z);
Position to_pos = Position(to_x,to_y,to_z);
Tile* t = game->getTile(to_x, to_y, to_z);
Item* itan = dynamic_cast<Item*>(game->getThing(Position(from_x, from_y, from_z), from_stack, player));

if(t && !t->hasItem(ITEM_DUSTBIN) && game->canDelete(player, itemid, to_pos, from_pos, from_stack, count) || game->canTeleportItem(player, itemid, to_pos, from_pos, from_stack, count))
return;
if(from_x == to_x && from_y == to_y && from_z == to_z)
return;

if(to_x != 0xFFFF && t && t->hasItem(ITEM_DUSTBIN)) {
if(from_x != 0xFFFF && (abs(player->pos.x - from_x) > 1 || abs(player->pos.y - from_y) > 1 || player->pos.z != from_z))
return;

if(to_x != 0xFFFF && t && t->hasItem(ITEM_DUSTBIN))
game->trashItems(player, itan, from_pos, from_stack, count);
}
#endif //BD_DOWN

i zamien na to co wczesniej czyli:

Spoiler:


                             #ifdef BD_DOWN
   if(from_x == to_x && from_y == to_y && from_z == to_z)
return;

#endif //BD_DOWN

Skrypt nie mój.

Offline

 

#2 2011-11-12 12:24:20

Chada

Administrator

35939696
Call me!
Zarejestrowany: 2011-11-10
Posty: 47
Punktów :   

Re: Blokada usuwania ścian.

Dobra Jest Okej Ale To jest skopiowane ! Ale dostajesz + tylko stym problem ze nie mam SOurce!


Uważaj Ban Leci z Każdej Strony!! Nie wiadomo od kogo i skąd xddd 
Pozdrawia Was,  http://cdn.graphicsfactory.com/clip-art/image_files/image/6/1156196-Chada.gif
http://signatures.otservlist.org/1282082_4.png
Chcesz kupic outfit na OTS pisz do Chada

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.stijo.pun.pl www.pokemonmistrzgry.pun.pl www.najbud4.pun.pl www.polacypisces.pun.pl www.roxoria.pun.pl