Пример #1
0
TooltipData MenuItemStorage::checkTooltip(Point mouse, StatBlock *stats, bool vendor_view) {
	TooltipData tip;
	int slot = slotOver( mouse);

	if (slot > -1 && storage[slot].item > 0) {
		return items->getTooltip( storage[slot].item, stats, vendor_view);
	}
	return tip;
}
Пример #2
0
TooltipData MenuItemStorage::checkTooltip(Point position, StatBlock *stats, int context) {
    TooltipData tip;
    int slot = slotOver(position);

    if (slot > -1 && storage[slot].item > 0) {
        return items->getTooltip(storage[slot], stats, context);
    }
    return tip;
}
Пример #3
0
ItemStack MenuItemStorage::click(Point position) {
    ItemStack item;

    drag_prev_slot = slotOver(position);

    // try to click on the highlighted (aka in focus) slot
    // since mouse clicks defocus slots before this point,
    // we don't have to worry about the mouse being over another slot
    if (drag_prev_slot == -1) {
        for (unsigned int i=0; i<slots.size(); i++) {
            if (slots[i]->in_focus) {
                drag_prev_slot = i;
                break;
            }
        }
    }

    if (drag_prev_slot > -1) {
        item = storage[drag_prev_slot];
        if (TOUCHSCREEN) {
            if (!slots[drag_prev_slot]->in_focus && !item.empty()) {
                slots[drag_prev_slot]->in_focus = true;
                current_slot = slots[drag_prev_slot];
                item.clear();
                drag_prev_slot = -1;
                return item;
            }
            else {
                slots[drag_prev_slot]->in_focus = false;
                current_slot = NULL;
            }
        }
        if (!item.empty()) {
            if (item.quantity > 1 && !inpt->pressing[CTRL] && (inpt->pressing[SHIFT] || NO_MOUSE || inpt->touch_locked)) {
                // we use an external menu to let the player pick the desired quantity
                // we will subtract from this stack after they've made their decision
                return item;
            }
            subtract( drag_prev_slot, item.quantity);
        }
        // item will be cleared if item.empty() == true
        return item;
    }
    else {
        item.clear();
        return item;
    }
}
Пример #4
0
ItemStack MenuItemStorage::click(InputState * input) {
	ItemStack item;
	drag_prev_slot = slotOver(input->mouse);
	if( drag_prev_slot > -1) { 
		item = storage[drag_prev_slot];
		if( input->pressing[SHIFT]) {
			item.quantity = 1;
		}
		substract( drag_prev_slot, item.quantity);
		return item;
	}
	else {
		item.item = 0;
		item.quantity = 0;
		return item;
	}
}