Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal for house items to be delivered by the configured quantity #1932

Closed
2 of 5 tasks
LeoTKBR opened this issue Nov 28, 2023 · 1 comment · Fixed by #1940
Closed
2 of 5 tasks

proposal for house items to be delivered by the configured quantity #1932

LeoTKBR opened this issue Nov 28, 2023 · 1 comment · Fixed by #1940
Labels
Stale No activity Status: Pending Test This PR or Issue requires more testing Type: Enhancement New feature or request

Comments

@LeoTKBR
Copy link
Contributor

LeoTKBR commented Nov 28, 2023

Priority

Enhancement

Area

  • Datapack
  • Source
  • Map
  • Other

What is missing?

This is a proposal to be able to receive house-type items in quantities configured by count on gamestore.lua

Of course, it's just an idea, if necessary, just apply improvements and corrections.

function GameStore.processHouseRelatedPurchase(player, offer)
	local function isCaskItem(itemId)
		return (itemId >= ITEM_HEALTH_CASK_START and itemId <= ITEM_HEALTH_CASK_END) or (itemId >= ITEM_MANA_CASK_START and itemId <= ITEM_MANA_CASK_END) or (itemId >= ITEM_SPIRIT_CASK_START and itemId <= ITEM_SPIRIT_CASK_END)
	end

	local inbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)
	local itemIds = offer.itemtype
	if type(itemIds) ~= "table" then
		itemIds = { itemIds }
	end
	if inbox then
		for _, itemId in ipairs(itemIds) do
			for i = 1, offer.count do
				local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
				if decoKit then
					decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a <" .. ItemType(itemId):getName() .. ">.")
					decoKit:setCustomAttribute("unWrapId", itemId)
					if isCaskItem(itemId) then
						decoKit:setAttribute(ITEM_ATTRIBUTE_DATE, offer.count)
					end

					if offer.moveable ~= true then
						decoKit:setAttribute(ITEM_ATTRIBUTE_STORE, systemTime())
					end
				end
			end
		end
		player:sendUpdateContainer(inbox)
	else
		return error({ code = 0, message = "Please make sure you have free slots in your store inbox." })
	end
end

Code of Conduct

  • I agree to follow this project's Code of Conduct
@github-actions github-actions bot added Status: Pending Test This PR or Issue requires more testing Type: Enhancement New feature or request labels Nov 28, 2023
@elsongabriel elsongabriel linked a pull request Feb 23, 2024 that will close this issue
Copy link
Contributor

This issue is stale because it has been open 120 days with no activity.

@github-actions github-actions bot added the Stale No activity label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale No activity Status: Pending Test This PR or Issue requires more testing Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant