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

feat: add ItemTemplate methods #84

Merged
merged 2 commits into from
Dec 30, 2022
Merged

feat: add ItemTemplate methods #84

merged 2 commits into from
Dec 30, 2022

Conversation

r-o-b-o-t-o
Copy link
Member

  • Adds GetItemTemplate(itemEntry)
  • Adds Item:GetItemTemplate()
  • Adds ItemTemplate methods:
    • ItemTemplate:GetItemId()
    • ItemTemplate:GetClass()
    • ItemTemplate:GetSubClass()
    • ItemTemplate:GetName()
    • ItemTemplate:GetDisplayId()
    • ItemTemplate:GetQuality()
    • ItemTemplate:GetFlags()
    • ItemTemplate:GetExtraFlags()
    • ItemTemplate:GetBuyCount()
    • ItemTemplate:GetBuyPrice()
    • ItemTemplate:GetSellPrice()
    • ItemTemplate:GetInventoryType()
    • ItemTemplate:GetAllowableClass()
    • ItemTemplate:GetAllowableRace()
    • ItemTemplate:GetItemLevel()
    • ItemTemplate:GetRequiredLevel()
      Most of these methods are still accessible through the Item class to keep compatibility with existing scripts.

@55Honey
Copy link
Member

55Honey commented Dec 30, 2022

Tested with

local function command( event, player, command, chathandler )
   
    if player then
        print('Slot: '..command)
        local template = GetItemTemplate( player:GetItemByPos(255,command):GetEntry() )
        print( 'GetItemId: '.. template:GetItemId() )
        print( 'GetClass: '.. template:GetClass() )
        print( 'GetSubClass: '.. template:GetSubClass() )
        print( 'GetName: '.. template:GetName() )
        print( 'GetDisplayId: '.. template:GetDisplayId() )
        print( 'GetQuality: '.. template:GetQuality() )
        print( 'GetFlags: '.. template:GetFlags() )
        print( 'GetExtraFlags: '.. template:GetExtraFlags() )
        print( 'GetBuyCount: '.. template:GetBuyCount() )
        print( 'GetBuyPrice: '.. template:GetBuyPrice() )
        print( 'GetSellPrice: '.. template:GetSellPrice() )
        print( 'GetInventoryType: '.. template:GetInventoryType() )
        print( 'GetAllowableClass: '.. template:GetAllowableClass() )
        print( 'GetAllowableRace: '.. template:GetAllowableRace() )
        print( 'GetItemLevel: '.. template:GetItemLevel() )
        print( 'GetRequiredLevel: '.. template:GetRequiredLevel() )
    end
end

RegisterPlayerEvent(42, command)

image
image

@r-o-b-o-t-o r-o-b-o-t-o merged commit a206745 into master Dec 30, 2022
@r-o-b-o-t-o r-o-b-o-t-o deleted the feat/item-template branch December 30, 2022 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants