Feature Quiver [TFS 1.X + 0.X]

kor

PHP ziom
Premium User
Joined
Jul 12, 2008
Messages
88
Best answers
9
Reaction score
66
Location
Bialystok, Poland
Hello. Inspired @xydius solution I've created possibility to make use for quivers for both TFS (1.X based on otland/forgottenserver (https://github.com/otland/forgottenserver) and 0.X on Fir3element/3777 (https://github.com/Fir3element/3777)).

I won't post what to change in what line, instead here you have GitHub branches:
My solution will require creating an item which have name set to Quiver:
- TFS 1.X
Lua:
local item = Game.createItem(11241, 1) -- example ID, in my case Expedition Backpack
item:setAttribute(ITEM_ATTRIBUTE_NAME, 'Quiver')
item:setAttribute(ITEM_ATTRIBUTE_ARTICLE, 'a') -- in my case Expedition Backpack have prefix "an", so I'm changing it here
player:addItemEx(item)
- TFS 0.X
Lua:
local item = doCreateItemEx(11241, 1)
doItemSetAttribute(item, 'name', 'Quiver')
doItemSetAttribute(item, 'article', 'a')
doPlayerAddItemEx(cid, item)
Created Quiver will:
  • not allow to put inside otems other than ammo (container.cpp part)
  • have max items amount set to 4 both in "look at" and "put into" (container.h, item.cpp and protocolgame.cpp part); if you don't want to set max amout, just skip that changes
  • get first matching ammo item from Quiver in arrow slot
  • allow in newer versions to put Quiver in arrow slot without enabling CLASSIC_EQUIPMENT_SLOTS option

Hope you enjoy :)
 

70011983

Ners
Joined
Nov 21, 2011
Messages
344
Best answers
1
Reaction score
49
Location
Croatia
Works just fine so far, nice one!
Though on OTX3 the last change is in protocolgamebase.cpp instead of protocolgame.cpp, the rest is on spot.
 
OP
kor

kor

PHP ziom
Premium User
Joined
Jul 12, 2008
Messages
88
Best answers
9
Reaction score
66
Location
Bialystok, Poland
Thanks :) My servers are on 0.4 and 1.3 so I didn't have possibility to test it on OTX.
 
Top