As title says, I would like to know how to add pagination to a container item.
I'm using tfs 1.2 btw
void setPagination(bool state) {
pagination = state;
}
Container(ITEM_BROWSEFIELD, 30, false, true)
container:addItemEx(virtualItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
if (pid >= 1 && pid <= 11) {
if (pid == 11) {
Container* container = item->getContainer()...
As title says, I would like to know how to add pagination to a container item.
I'm using tfs 1.2 btw
void setPagination(bool state) {
pagination = state;
}
Container(ITEM_BROWSEFIELD, 30, false, true)
container:addItemEx(virtualItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
if (pid >= 1 && pid <= 11) {
if (pid == 11) {
Container* container = item->getContainer();
if (container) {
container->setPagination(true);
}
}
player->internalAddThing(pid, item);
I guess I'm fucked then, time to have some experiments with the store inbox, thanks!Code:void setPagination(bool state) { pagination = state; }
Or construct it with pagination already like browse field:
Code:Container(ITEM_BROWSEFIELD, 30, false, true)
To add items to this container in lua you use:
Code:container:addItemEx(virtualItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
If you want this for store inbox you will have to edit more shit to get it done as pagination state is not serialized.
You can do it in iologindata.cpp where it loads the inventory items:
Code:if (pid >= 1 && pid <= 11) { if (pid == 11) { Container* container = item->getContainer(); if (container) { container->setPagination(true); } } player->internalAddThing(pid, item);
Why? I just said how to do for store inbox :xI guess I'm fucked then, time to have some experiments with the store inbox, thanks!
Oh, nice I'll check it thenWhy? I just said how to do for store inbox :x
Code:void setPagination(bool state) { pagination = state; }
Or construct it with pagination already like browse field:
Code:Container(ITEM_BROWSEFIELD, 30, false, true)
To add items to this container in lua you use:
Code:container:addItemEx(virtualItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
If you want this for store inbox you will have to edit more shit to get it done as pagination state is not serialized.
You can do it in iologindata.cpp where it loads the inventory items:
Code:if (pid >= 1 && pid <= 11) { if (pid == 11) { Container* container = item->getContainer(); if (container) { container->setPagination(true); } } player->internalAddThing(pid, item);
i do the part of the iologindata.cpp to add pagination to PURSE item. but get error "setPagination its not a member of container
how i can solve this?
im trying to make the purse slot "item" with pagination "true"
You did not add the method setPagination to Container class.
local purse = player:getSlotItem(CONST_SLOT_PURSE)
if purse then
purse:addItem(2160, 100, INDEX_WHEREEVER, FLAG_NOLIMIT)
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if toPosition.x == CONTAINER_POSITION and toCylinder and toCylinder:getId() == 17432 then
local Chest = (toCylinder)
local newitem = item:getId()
local itemname = item:getName()
doRemoveItem(item.uid, count)
Chest:addItem(newitem, count, INDEX_WHEREEVER, FLAG_NOLIMIT)
end
return true
end
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if toPosition.x == CONTAINER_POSITION and toCylinder and toCylinder:getId() == 17432 then
local depotChest = (toCylinder)
item:moveTo(depotChest)
end
return true
end
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if toPosition.x == CONTAINER_POSITION and toCylinder and toCylinder:getId() == 17432 then // <<< HERE THE ID of your depot, inbox, store inbox etc.
local depotChest = (toCylinder)
item:moveTo(depotChest)
else
return true
end
return false
end
//load inventory items
ItemMap itemMap;
query.str(std::string());
query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_items` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC";
if ((result = db->storeQuery(query.str()))) {
loadItems(itemMap, result);
for (ItemMap::const_reverse_iterator it = itemMap.rbegin(), end = itemMap.rend(); it != end; ++it) {
const std::pair<Item*, int32_t>& pair = it->second;
Item* item = pair.first;
int32_t pid = pair.second;
if (pid >= 1 && pid <= 11) {
if (pid == 11) {
Container* container = item->getContainer();
if (container) {
container->setPagination(true);
}
}
player->internalAddThing(pid, item);
} else {
ItemMap::const_iterator it2 = itemMap.find(pid);
if (it2 == itemMap.end()) {
continue;
}
Container* container = it2->second.first->getContainer();
if (container) {
container->internalAddThing(item);
}
}
}
}
if (!player->inventory[CONST_SLOT_PURSE]) {
player->internalAddThing(CONST_SLOT_PURSE, Item::CreateItem(ITEM_PURSE));
}
Can you not quadruple post? You can use the EDIT function.Someone can help me here on pagination!
iologindata.cpp
Code://load inventory items ItemMap itemMap; query.str(std::string()); query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_items` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC"; if ((result = db->storeQuery(query.str()))) { loadItems(itemMap, result); for (ItemMap::const_reverse_iterator it = itemMap.rbegin(), end = itemMap.rend(); it != end; ++it) { const std::pair<Item*, int32_t>& pair = it->second; Item* item = pair.first; int32_t pid = pair.second; if (pid >= 1 && pid <= 11) { if (pid == 11) { Container* container = item->getContainer(); if (container) { container->setPagination(true); } } player->internalAddThing(pid, item); } else { ItemMap::const_iterator it2 = itemMap.find(pid); if (it2 == itemMap.end()) { continue; } Container* container = it2->second.first->getContainer(); if (container) { container->internalAddThing(item); } } } } if (!player->inventory[CONST_SLOT_PURSE]) { player->internalAddThing(CONST_SLOT_PURSE, Item::CreateItem(ITEM_PURSE)); }
here its added the pagination to the ITEM on the slot 11 "purse" <
now i want to add pagination to all the CONTAINER items.
something like
item get container
if container then Set pagination true
player internal add thing
someone?
Hello again Mkalo, im trying to add the FLAG_NOLIMIT only when the toCylinder get pagination true.Can you not quadruple post? You can use the EDIT function.
There reason why you cant move it to the container with pagination: You need the flag FLAG_NOLIMIT to move items to paginated containers. (item:moveTo uses this flag).
If you wanna add pagination to all containers you have to edit the source to always use the FLAG_NOLIMIT when a player moves an item and you can just construct with pagination set with true as default here:
forgottenserver/container.h at master · otland/forgottenserver · GitHub