Ir para conteúdo

Featured Replies

Postado

queria tirar uma duvida e fazer um pedido.

meu servidor TFS 04 alguém me ajuda com codigo para slot para cada equipamento?  ex : ammo apenas para arrow?

 achei alguns tutorias mais nada para 0.4 

 

classicEquipmentSlots = true

tentei add clasic mais tive muitos erros.

Editado por DoidoPox (veja o histórico de edições)

  • Respostas 5
  • Visualizações 724
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

tenho esse script mais meu TFS e 0.4.

nao sei se funciona mas no meu server e outra versão ,alguem pode me ajuda convertendo ? 

  Citar
ReturnValue Player::__queryAdd(int32_t index, const Thing* thing, uint32_t count, uint32_t flags, Creature* actor/* = NULL*/) const
{
    const Item* item = thing->getItem();
    if(item == NULL)
        return RET_NOTPOSSIBLE;

    bool childIsOwner = hasBitSet(FLAG_CHILDISOWNER, flags);
    bool skipLimit = hasBitSet(FLAG_NOLIMIT, flags);
    if(childIsOwner)
    {
        //a child container is querying the player, just check if enough capacity
        if(skipLimit || hasCapacity(item, count))
            return RET_NOERROR;

        return RET_NOTENOUGHCAPACITY;
    }

    if(!item->isPickupable())
        return RET_CANNOTPICKUP;

    ReturnValue ret = RET_NOERROR;
    const int32_t& slotPosition = item->getSlotPosition();
    if((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) ||
        (slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) ||
        (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) ||
        (slotPosition & SLOTP_RING)) {
        ret = RET_CANNOTBEDRESSED;
    } else if(slotPosition & SLOTP_TWO_HAND) {
        ret = RET_PUTTHISOBJECTINBOTHHANDS;
    } else if((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) {
        if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
            ret = RET_CANNOTBEDRESSED;
        } else {
            ret = RET_PUTTHISOBJECTINYOURHAND;
        }
    }

    switch(index)
    {
        case SLOT_HEAD:
        {
            if(slotPosition & SLOTP_HEAD)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_NECKLACE:
        {
            if(slotPosition & SLOTP_NECKLACE)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_BACKPACK:
        {
            if(slotPosition & SLOTP_BACKPACK)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_ARMOR:
        {
            if(slotPosition & SLOTP_ARMOR)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_RIGHT:
        {
            if(slotPosition & SLOTP_RIGHT)
            {
                if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
                    //check if we already carry an item in the other hand
                    if(slotPosition & SLOTP_TWO_HAND) {
                        if(inventory[SLOT_LEFT] && inventory[SLOT_LEFT] != item)
                            ret = RET_BOTHHANDSNEEDTOBEFREE;
                        else
                            ret = RET_NOERROR;
                    }
                } else if (slotPosition & SLOTP_TWO_HAND) {
                    if (inventory[SLOT_LEFT] && inventory[SLOT_LEFT] != item) {
                        ret = RET_BOTHHANDSNEEDTOBEFREE;
                    } else {
                        ret = RET_NOERROR;
                    }
                } else if(inventory[SLOT_LEFT]) {
                    const Item* leftItem = inventory[SLOT_LEFT];
                    WeaponType_t type = item->getWeaponType(), leftType = leftItem->getWeaponType();
                    if(leftItem->getSlotPosition() & SLOTP_TWO_HAND)
                        ret = RET_DROPTWOHANDEDITEM;
                    else if(item == leftItem && count == item->getItemCount())
                        ret = RET_NOERROR;
                    else if(leftType == WEAPON_SHIELD && type == WEAPON_SHIELD)
                        ret = RET_CANONLYUSEONESHIELD;
                    else if(leftType == WEAPON_NONE || type == WEAPON_NONE ||
                        leftType == WEAPON_SHIELD || leftType == WEAPON_AMMO
                        || type == WEAPON_SHIELD || type == WEAPON_AMMO)
                        ret = RET_NOERROR;
                    else
                        ret = RET_CANONLYUSEONEWEAPON;
                } else {
                    ret = RET_NOERROR;
                }
            }
            break;
        }

        case SLOT_LEFT:
        {
            if(slotPosition & SLOTP_LEFT)
            {
                if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
                    //check if we already carry an item in the other hand
                    if(slotPosition & SLOTP_TWO_HAND) {
                        if(inventory[SLOT_RIGHT] && inventory[SLOT_RIGHT] != item)
                            ret = RET_BOTHHANDSNEEDTOBEFREE;
                        else
                            ret = RET_NOERROR;
                    }
                } else if (slotPosition & SLOTP_TWO_HAND) {
                    if (inventory[SLOT_RIGHT] && inventory[SLOT_RIGHT] != item) {
                        ret = RET_BOTHHANDSNEEDTOBEFREE;
                    } else {
                        ret = RET_NOERROR;
                    }
                } else if(inventory[SLOT_RIGHT]) {
                    const Item* leftItem = inventory[SLOT_RIGHT];
                    WeaponType_t type = item->getWeaponType(), leftType = leftItem->getWeaponType();
                    if(leftItem->getSlotPosition() & SLOTP_TWO_HAND)
                        ret = RET_DROPTWOHANDEDITEM;
                    else if(item == leftItem && count == item->getItemCount())
                        ret = RET_NOERROR;
                    else if(leftType == WEAPON_SHIELD && type == WEAPON_SHIELD)
                        ret = RET_CANONLYUSEONESHIELD;
                    else if(leftType == WEAPON_NONE || type == WEAPON_NONE ||
                        leftType == WEAPON_SHIELD || leftType == WEAPON_AMMO
                        || type == WEAPON_SHIELD || type == WEAPON_AMMO)
                        ret = RET_NOERROR;
                    else
                        ret = RET_CANONLYUSEONEWEAPON;
                } else {
                    ret = RET_NOERROR;
                }
            }
            break;
        }

        case SLOT_LEGS:
        {
            if(slotPosition & SLOTP_LEGS)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_FEET:
        {
            if(slotPosition & SLOTP_FEET)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_RING:
        {
            if(slotPosition & SLOTP_RING)
                ret = RET_NOERROR;

            break;
        }

        case SLOT_AMMO:
        {
            if(slotPosition & SLOTP_AMMO || !g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS))
                ret = RET_NOERROR;

            break;
        }

        case SLOT_WHEREEVER:
        case -1:
            ret = RET_NOTENOUGHROOM;
            break;

        default:
            ret = RET_NOTPOSSIBLE;
            break;
    }

    if(ret == RET_NOERROR || ret == RET_NOTENOUGHROOM)
    {
        //need an exchange with source?
        if(getInventoryItem((slots_t)index) != NULL && (!getInventoryItem((slots_t)index)->isStackable()
            || getInventoryItem((slots_t)index)->getID() != item->getID()))
            return RET_NEEDEXCHANGE;

        if(!g_moveEvents->onPlayerEquip(const_cast<Player*>(this), const_cast<Item*>(item), (slots_t)index, true))
            return RET_CANNOTBEDRESSED;

        //check if enough capacity
        if(!hasCapacity(item, count))
            return RET_NOTENOUGHCAPACITY;
    }

    return ret;
}

 

Editado por DoidoPox (veja o histórico de edições)

Postado

Não basta apenas adicionar isso no config.lua. Se nas sources não estiver incluso não vai funcionar mesmo. A parte que teria que alterar seria nessa mesmo que tu mando.

Baixe a rev3996 que disponibilizei. Bastante bugs das revs anteriores foram corrigidos, e muita coisa foi adicionada. Inclusive isto que você quer utilizar.

Caso utilize ela, só alterar no config.lua para:

classicEquipmentSlots = false

 

Postado
  • Autor

blz eu nao sou scripter mais me considero tester

eu sei como funciona tentei add mais sempre tenho errors 

Mostrar conteúdo oculto

 baixei seu tfs mais mesmo asim tive erros em ad algumas coisas uso a versao 3777 quero add o max de coisas e depois disponibilizar  

agradeço desde ja!

 

Postado
  Em 21/06/2020 em 08:52, DoidoPox disse:

blz eu nao sou scripter mais me considero tester

eu sei como funciona tentei add mais sempre tenho errors 

Mostrar conteúdo oculto

 baixei seu tfs mais mesmo asim tive erros em ad algumas coisas uso a versao 3777 quero add o max de coisas e depois disponibilizar  

agradeço desde ja!

 

Poderia me informar os erros?

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo