Jump to content

[Mod] Sell Useless Weapons


Quellcrest

Recommended Posts

I had probably hundreds of shitty white weapons or other types of weapons I had no use for and always selling them off was a tad annoying. So I made this little mod. It's a little ugly visually, whatever, but it seems to work just fine.

 

What it actually does? Finds all turrets in your inventory, loops through them all and finds undesirable ones, and sells them. What counts as undesirable? The table named "JunkWeapons" contains names of weapons that I didn't want.

 

Feel free to use, edit, modify, improve upon, etc.

 

Note: You do need to follow standard procedure for selling items(proper rep, docked, etc).

 

Screenshot:

http://i.imgur.com/hNH8LLW.jpg

 

In the file scripts\lib\shop.lua, inside the buildGui function, right at the bottom add:

local station = Entity()

if guiType == 1 and (string.match(station.title, "Turret") or string.match(station.title, "Equipment")) then
	yText = y + 6
	window:createButton(Rect(340, yText - 6, 160 + 360, 30 + yText - 6), "Sell Junk", "onSellJunkButtonPressed")
end

 

Now add 2 brand new functions:

function onSellJunkButtonPressed(button) -- client
local craftIndex = Player().craftIndex
local ship = Entity(craftIndex)
    local station = Entity()
local player = Player(ship.factionIndex)

local JunkWeapons = {}
table.insert(JunkWeapons, "Plasma")
table.insert(JunkWeapons, "Rocket")
table.insert(JunkWeapons, "Rail")
table.insert(JunkWeapons, "Bolter")
table.insert(JunkWeapons, "Repair")
table.insert(JunkWeapons, "Chaingun")
table.insert(JunkWeapons, "Mining")
table.insert(JunkWeapons, "Force")

local stuffs = player:getInventory():getItemsByType(InventoryItemType.Turret)
for i,item in pairs(stuffs) do
	for _,junkweapon in pairs(JunkWeapons) do
		if string.match(item.item.weaponName, junkweapon) then
			invokeServerFunction("buyFromPlayer", craftIndex, i)
		end
	end
end

invokeServerFunction("onSellJunkButtonPressed2", Player().craftIndex)
end

 

and

function onSellJunkButtonPressed2(shipIndex) -- server
    local ship = Entity(shipIndex)
    local station = Entity()
local player = Player(ship.factionIndex)

player:sendChatMessage("Server", 1, "All Junk items have been sold!")
end

Link to comment
Share on other sites

  • 1 year later...

Hallo,

 

so etwas suche ich schon die ganze zeit!!

Leider bekomme ich es nicht zum laufen.

 

zusätzlich wäre es schön wenn man die Upgrads auch verkaufen könnte

Vielleicht das man sich Gruppen Typen und Qualität aussuchen kann.

Kann sich dem ein Programmierer annehmen?

würde mich extrem freuen darüber!

 

lg

Sarok

 

 

 

 

Link to comment
Share on other sites

English - Google:

 

A big hello to the many scripters!

 

I have found a mod on the web that will allow you to sell your weapons faster (automatically). Unfortunately, I can not do it this works. Here I would need your help how this could be brought to life. I would be very thankful!!

 

If I would like to add something more, it would be better to add some additional features.

 

1- upgrades should also be able to be sold

2- favorites should not be sold automatically

3- quality and group types should be able to choose

 

I believe that the wish list really much work, would help immediately if desired

(but I'm not a scripter)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...