• 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!

Compiling Look for item in container

Stellow

C++/C#/PHP/LUA
Joined
Oct 23, 2008
Messages
1,112
Reaction score
221
Location
Germany
GitHub
eubrunomiguel
I am trying to implement a system which players can conjure runes with the blank rune on their backpack.
The part of the code i am trying to edit is here:

Code:
    ReturnValue result = RET_NOERROR;
    if (spell->getReagentId() != 0){
        //Test if we can cast the conjure spell on left hand
        ReturnValue result1 = internalConjureItem(player, spell->getConjureId(), spell->getConjureCount(),
            spell->getReagentId(), SLOT_LEFT, true);

        if (result1 == RET_NOERROR){
            //Check level/mana etc.
            if (!spell->playerSpellCheck(player)){
                return false;
            }

            result1 = internalConjureItem(player, spell->getConjureId(), spell->getConjureCount(),
                spell->getReagentId(), SLOT_LEFT);

            if (result1 == RET_NOERROR){
                spell->postCastSpell(player, false);
            }
        }

and

Code:
    if (reagentId != 0){
        Item* item = player->getInventoryItem(slot);
        if (item && item->getID() == reagentId){
            if (item->isStackable() && item->getItemCount() != 1){ //TODO? reagentCount
                return RET_YOUNEEDTOSPLITYOURSPEARS;
            }

            if (test){
                return RET_NOERROR;
            }

            Item* newItem = g_game.transformItem(item, conjureId, conjureCount);
            if (newItem){
                g_game.startDecay(newItem);
            }

            player->updateInventoryWeight();
            return RET_NOERROR;
        }
    }

    player->updateInventoryWeight();
    return RET_YOUNEEDAMAGICITEMTOCASTSPELL;
On this specific one, he can conjure on left hand....

ideas?
 
Code:
Item* bp = player->getInventoryItem(CONST_SLOT_BACKPACK);
if(bp){
for(Item* item : bp->getItemList()){

}

Wrote this on my phone so don't kill me if it doesn't work ;p but i guess that is some of the functions you could use.
 
Back
Top