Last active
June 27, 2017 11:15
-
-
Save ValentinFunk/f5da9031ab298dcacee4bb0d56b8a84e to your computer and use it in GitHub Desktop.
Example for Pointshop2.com Drops and Crates custom lua crate and function to print all item class names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local str = LibK._(Pointshop2.GetRegisteredItems()):chain() | |
:map(function(item) | |
return { className = item.className, name = item:GetPrintName() } | |
end) | |
:sort(function(a, b) | |
if tonumber(a.className) and tonumber(b.className) then | |
return tonumber(a.className) < tonumber(b.className) | |
elseif tonumber(a) and not tonumber(b) then | |
return false | |
else | |
return a.className < b.className | |
end | |
end) | |
:map(function(entry) | |
return entry.className .. ": " .. entry.name | |
end) | |
:join("\n") | |
:value() | |
print(str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this file is in kinv/items/pointshop/crates | |
ITEM.PrintName = "My Special Crate" | |
ITEM.baseClass = "base_crate" | |
ITEM.material = "pointshop2/box39.png" | |
-- See print.lua to get the item class numbers | |
ITEM.itemMap = { | |
{ | |
["factorySettings"] = { | |
["BasicSettings.ItemClass"] = "57", | |
}, | |
["factoryClassName"] = "Pointshop2.SingleItemFactory", | |
["chance"] = 47, | |
}, | |
{ | |
["factorySettings"] = { | |
["BasicSettings.Amount"] = 100, | |
["BasicSettings.CurrencyType"] = "points", | |
}, | |
["factoryClassName"] = "Pointshop2.PointsFactory", | |
["chance"] = 47, | |
}, | |
{ | |
["factorySettings"] = { | |
["ManualSettings.CategoryName"] = "Hats", | |
["BasicSettings.WeightedRandom"] = true | |
}, | |
["factoryClassName"] = "Pointshop2.ItemFromCategoryFactory", | |
["chance"] = 47, | |
}, | |
} | |
function ITEM.static:GetRequiredKeyClass( ) | |
return Pointshop2.GetItemClassByPrintName( "Name of your Key" ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment