REPAIR BY!!!!

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
InadequateCoder
Posts: 33
Joined: Fri Jan 22, 2010 1:23 am

REPAIR BY!!!!

#1 Post by InadequateCoder » Sun Jan 24, 2010 5:12 pm

EDIT:
The functions had errors in them I had to debug so I'm reposting this from the start:

RepairByItem(<Item Type>, <Item Count>);
RepairByDura(<Equip Slot>, <Equip Dura>);
RepairByFullBag();

Add the following to the end of player.lua:

Code: Select all

-- load repair path based on item counts (healing, mana, arrow, thrown, poison)
function CPlayer:RepairByItem(_ItemType, _ItemCount)
	inventory:update();
	if (_ItemType == "poison") then
		if ( _ItemCount > (inventory:itemTotalCount( "Poison" ))) then
			local _RepairPath = string.gsub( __WPL:getFileName(),".xml", "_repair.xml" );
			loadPaths(_RepairPath);
		end
	else
		if( _ItemCount > ( inventory:itemTotalCount( inventory:bestAvailableConsumable(_ItemType) ) ) ) then
			local _RepairPath = string.gsub( __WPL:getFileName(),".xml", "_repair.xml" );
			loadPaths(_RepairPath);
		end
	end
	
end

-- load repair path based on Durability of an item (Helmet, Gloves, Feet, Chest, Legs, Back, Waist, Shoulder, Necklace, Ammo, Ranged, Ring1, Ring2, Earring1, Earring2, MainHand, OffHand, Shield)
function CPlayer:RepairByDura(_EquipSlot, _ItemDura)
	slotID = {}; 
	slotID["Helmet"] = 0;
	slotID["Gloves"] = 1;
	slotID["Feet"] = 2;
	slotID["Chest"] = 3;
	slotID["Legs"] = 4;
	slotID["Back"] = 5;
	slotID["Waist"] = 6;
	slotID["Shoulder"] = 7;
	slotID["Necklace"] = 8;
	slotID["Ammo"] = 9;
	slotID["Ranged"] = 10;
	slotID["Ring1"] = 11;
	slotID["Ring2"] = 12;
	slotID["Earring1"] = 13;
	slotID["Earring2"] = 14;
	slotID["MainHand"] = 15;
	slotID["OffHand"] = 16;
	slotID["Shield"] = 16;
	local equipslot = slotID[_EquipSlot]
	local equipdura = inventory:getDurability(equipslot);
	if( _ItemDura > equipdura ) then
		local _RepairPath = string.gsub( __WPL:getFileName(),".xml", "_repair.xml" );
		loadPaths(_RepairPath);
	end

end

-- load repair path based on bags being full
function CPlayer:RepairByFullBag()
	occupiedSlots, totalSlots = sendMacro("GetBagCount();");
	availableSlots = (totalSlots - occupiedSlots)
	if availableSlots == 0 then
		local _RepairPath = string.gsub( __WPL:getFileName(),".xml", "_repair.xml" );
		loadPaths(_RepairPath);
	end
	
end

My Examples:
player:RepairByFullBag();
player:RepairByItem("healing", 99);
player:RepairByDura("MainHand", 80);

Please let me know if you find any more bugs in this or if you have improvements to add. Thank you and please...
Enjoy!

InadequateCoder
Posts: 33
Joined: Fri Jan 22, 2010 1:23 am

Re: REPAIR BY!!!!

#2 Post by InadequateCoder » Sun Jan 24, 2010 11:23 pm

More errors. This time it's adding an extra _repair to the filename and I'm not sure where. I'll look into it later though just don't use them for now. :(

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests