예제 #1
0
void Pony::unwearItemAt(quint8 index)
{
    bool found=false;
    for (int i=0; i<worn.size();i++)
    {
        if (worn[i].index == index+1)
        {
            found=true;
            int itemSlots = wearablePositionsMap[worn[i].id];
            wornSlots = (wornSlots | itemSlots) ^ itemSlots;
            addInventoryItem(worn[i].id, 1);
            worn.removeAt(i);
            break;
        }
    }
    if (!found)
    {
        logMessage(QObject::tr("Couldn't unwear item, index %1 not found").arg(index));
        return;
    }
    sendUnwearItemRPC(owner, index);

    Scene* scene = findScene(sceneName);
    if (scene->name.isEmpty())
        logMessage(QObject::tr("UDP: Can't find the scene for unwearItem RPC, aborting"));
    else
    {
        for (Player* dest : scene->players)
            if (dest->pony.netviewId != netviewId)
                sendUnwearItemRPC(this, dest, index);
    }
}
예제 #2
0
bool Parallaction::pickupItem(ZonePtr z) {
	if (z->_flags & kFlagsFixed) {
		return false;
	}

	int slot = addInventoryItem(z->u._getIcon);
	if (slot != -1) {
		showZone(z, false);
	}

	return (slot != -1);
}