• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature Conjure Runes Backpkac

adric21

Well-Known Member
Joined
Apr 26, 2016
Messages
296
Solutions
1
Reaction score
85
Code:
Item* Player::getEquippedItem(slots_t slot) const
{
Item* item = getInventoryItem(slot);
if(!item)
return NULL;

switch(slot)
{
case SLOT_LEFT:
case SLOT_RIGHT:
return item->getWieldPosition() == SLOT_HAND ? item : NULL;

default:
break;
}

return item->getWieldPosition() == slot ? item : NULL;
}

-----------------------------ADD----------------------

Item* Player::getFirstItemById(uint32_t id) const
{
Item* tmpItem = NULL;
Container* tmpContainer = NULL;
std::list<Container*> listContainer;
for(int32_t slot = SLOT_FIRST; slot <= SLOT_LAST; slot++){
if((tmpItem = getInventoryItem((slots_t)slot))){
if(tmpItem->getID() == id){
return tmpItem;
}
else if((tmpContainer = tmpItem->getContainer())){
listContainer.push_back(tmpContainer);
}
}
}

ItemList::const_iterator it;
while(!listContainer.empty()){
Container* container = listContainer.front();
listContainer.pop_front();
for(it = container->getItems(); it != container->getEnd(); ++it){
if((tmpItem = *it)){
if(tmpItem->getID() == id){
return tmpItem;
}
else if((tmpContainer = tmpItem->getContainer())){
listContainer.push_back(tmpContainer);
}
}
}
}

return NULL;
}

_________________________________________________________________________

IN SPELLS.CPP CHAGE

if(!(item = player->getInventoryItem((slots_t)i)))

--------------TO-------------

if(!(item = player->getFirstItemById((uint32_t)i)))
_________________________________________________________________________

IN PLAYER.H

under

Item* getInventoryItem(slots_t slot) const;

----------------add--------------

Item* Player::getFirstItemById(uint32_t id) const;
 
Back
Top