08-15-2010, 11:52 AM
Ok so hear is the first bit of code I am still working on it but I think I have all the effecting factors in there. I have put things in the way I think they should go, but I might be totally wrong. Have not got all the parts to work together quite yet. So please post if you have some impute.
K I am not getting any more errors but the code is still not working.
K I am not getting any more errors but the code is still not working.
Code:
-- Author : Adminirtsator
-- Create Date : 10/29/2009 1:31:07 PM
function ATK_ChatCommand(command)
local a=strfind(command, "");
local msg = strsub(command,a);
local rand = math.random(1,100);
if GHI_CountItem("Duskwolf_66914333") == 0
then
str = 0
elseif GHI_CountItem("Duskwolf_66914333") == 1
then
str = 5
elseif GHI_CountItem("Duskwolf_66914333") == 2
then
str = 10
elseif GHI_CountItem("Duskwolf_66914333") == 3
then
str = 15
elseif GHI_CountItem("Duskwolf_66914333") == 4
then
str = 20
elseif GHI_CountItem("Duskwolf_66914333") >= 5
then
str = 25
end
if GetInventoryItemTexture("player", 5) == nil
then
cht = 0
elseif
GetInventoryItemTexture("player", 5) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Cloth"
then
cht =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Leather"
then
cht =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Mail"
then
cht =1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ChestSlot")))})[7]=="Plate"
then
cht = 2
end
end
if GetInventoryItemTexture("player", 3) == nil
then
shd = 0
elseif
GetInventoryItemTexture("player", 3) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Cloth"
then
shd =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Leather"
then
shd =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Mail"
then
shd =1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("ShoulderSlot")))})[7]=="Plate"
then
shd = 2
end
end
if GetInventoryItemTexture("player", 1) == nil
then
hed = 0
elseif
GetInventoryItemTexture("player", 1) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Cloth"
then
hed =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Leather"
then
hed =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Mail"
then
hed = 1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HeadSlot")))})[7]=="Plate"
then
hed = 2
end
end
if GetInventoryItemTexture("player", 7) == nil
then
leg = 0
elseif
GetInventoryItemTexture("player", 7) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Cloth"
then
leg =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Leather"
then
leg =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Mail"
then
leg = 1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("LegsSlot" )))})[7]=="Plate"
then
leg = 2
end
end
if GetInventoryItemTexture("player", 10) == nil
then
hnd = 0
elseif
GetInventoryItemTexture("player", 10) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Cloth"
then
hnd =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Leather"
then
hnd =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Mail"
then
hnd = 1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("HandsSlot" )))})[7]=="Plate"
then
hnd = 2
end
end
if GetInventoryItemTexture("player", 8) == nil
then
fet = 0
elseif
GetInventoryItemTexture("player", 8) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Cloth"
then
fet =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Leather"
then
fet =0
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Mail"
then
fet = 1
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("FeetSlot" )))})[7]=="Plate"
then
fet = 2
end
end
local ah = cht+shd+hed+leg+hnd+fet;
if GetInventoryItemTexture("player", 13) == nil
then
mws = 7
elseif
GetInventoryItemTexture("player", 13) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Maces"
then
mws = 3
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Axes"
then
mws = 4
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="One-Handed Swords"
then
mws = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Staves"
then
mws = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Polearms"
then
mws = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Fist Weapons"
then
mws = 7
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Daggers"
then
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Axes"
then
mws = 4
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Maces"
then
mws = 3
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot")))})[7]=="Two-Handed Swords"
then
mws = 5
end
end
if GetInventoryItemTexture("player", 14) == nil
then
ows = 7
elseif
GetInventoryItemTexture("player", 14) ~= nil
then
if ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Maces"
then
ows = 3
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Axes"
then
ows = 4
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="One-Handed Swords"
then
ows = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Staves"
then
ows = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Polearms"
then
ows = 5
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Fist Weapons"
then
ows = 7
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Daggers"
then
ows = 6
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Axes"
then
ows = 4
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Maces"
then
ows = 3
elseif ({GetItemInfo(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")))})[7]=="Two-Handed Swords"
then
ows = 5
end
end
local ws = mws+ows
boab = false;
for i = 1,#(GHI_BuffList) do
if type(GHI_BuffList[i])=="table" then
if GHI_BuffList[i].name == "Blessing of Attack" then
boab = true;
end
end
end
if boab == true
then
boa = 10
end
if boab == false
then
boa = 0
end
rbcb = false;
for i = 1,#(GHI_BuffList) do
if type(GHI_BuffList[i])=="table" then
if GHI_BuffList[i].name == "Rune Blade Curse" then
rbcb = true;
end
end
end
if rbcb == true
then
rbc = 10
end
if rbcb == false
then
rbc = 0
end
local atk = rand+str+ws-ah+boa-rbc ;
local zone = GetZoneText();
local index = GetChannelName("LocalDefence - "..zone.."")
dis = false;
for i = 1,#(GHI_BuffList) do
if type(GHI_BuffList[i])=="table" then
if GHI_BuffList[i].name == "Disarmed" then
dis = true;
end
end
end
if dis == true
then
if msg then
SendChatMessage("","EMOTE");
if (index~=nil) then
SendChatMessage("<- is disarmed and can not attack","CHANNEL", nil, index);
end
end
end
stn = false;
for i = 1,#(GHI_BuffList) do
if type(GHI_BuffList[i])=="table" then
if GHI_BuffList[i].name == "Stuned" then
stn = true;
end
end
end
if stn == true
then
if msg then
SendChatMessage("","EMOTE");
if (index~=nil) then
SendChatMessage("<- is stuned and can not attack","CHANNEL", nil, index);
end
end
end
if stn == false or dis == false
then
if msg then
SendChatMessage("","EMOTE");
if (index~=nil) then
SendChatMessage("Attack Roll [(d100)"..rand.." + (Str)"..rts.." + (WS)"..ws.." (Buffs)+"..boa.."-"..rbc.." = "..atk.."]","CHANNEL", nil, index);
end
end
end
end
SlashCmdList["ATK"] = ATK_ChatCommand;
SLASH_ATK1 = "/ATK";
SLASH_ATK2 = "/atk";