PHP Code:
quest craftingwindow begin
state start begin
function getSingleValueCount(t, s)
local n, r = {}, {}
table.foreach(t, function(i, p) n[p] = n[p] and n[p]+1 or 1 end)
for key,value in pairs(n) do table.insert(r, {key, value}) end
return r
end
when login begin
cmdchat("CraftingSystem index/"..q.getcurrentquestindex())
end
when 16091.click begin
cmdchat("CraftingSystem Open/weapon")
end
when 16092.click begin
cmdchat("CraftingSystem Open/armor")
end
when 16093.click begin
cmdchat("CraftingSystem Open/juwelery")
end
when 16090.click begin
cmdchat("CraftingSystem Open/legendary")
end
when button begin
cmdchat("getinputbegin")
local INPUT = split(input(cmdchat("CraftingSystem input/")), "/")
cmdchat("getinputend")
if INPUT[2] =="-1,-1,-1,-1,-1,-1,-1,-1,-1" then cmdchat("CraftingSystem craftitem/0/0") return end
local InWindow = split(INPUT[2], ",")
local CRAFT = ""
for i=1, table.getn(InWindow), 1 do
if InWindow[i]!="-1" then
if item.select_cell(InWindow[i]) then
CRAFT = (i==1 and (item.get_vnum()!=0 and (item.get_vnum()..","..item.get_count()) or ("0,0")) or (CRAFT.."|"..(item.get_vnum()!=0 and (item.get_vnum()..","..item.get_count()) or ("0,0"))))
else
syschat("Da ist was falsch gelaufen...")
cmdchat("CraftingSystem craftitem/0/0")
return
end
else
CRAFT = (i==1 and ("0,0") or CRAFT.."|0,0")
end
end
-- Aufbau
-- erste Reihe des Craftfeldes
-- 0,0,0 (von oben nach unten)
-- zweite Reihe des Craftfeldes
-- 0,0,0 (von oben nach unten)
-- dritte Reihe des Craftfeldes
-- 0,0,0 (von oben nach unten)
local CRAFTING_POSSIBILITIES = {
["3209,1|0,0|0,0|3209,1|0,0|0,0|0,0|0,0|0,0"] = {7479, 1} -- Chuánqi Klinge-Rohling
["2379,1|0,0|0,0|2379,1|0,0|0,0|0,0|0,0|0,0"] = {7481, 1} -- Chuánqi Bogen-Rohling
["5339,1|0,0|0,0|5339,1|0,0|0,0|0,0|0,0|0,0"] = {7483, 1} -- Chuánqi Stab-Rohling
["1349,1|0,0|0,0|1349,1|0,0|0,0|0,0|0,0|0,0"] = {7485, 1} -- Chuánqi Dolche-Rohling
["239,1|0,0|0,0|239,1|0,0|0,0|0,0|0,0|0,0"] = {7487, 1} -- Chuánqi Schwert-Rohling
["7189,1|0,0|0,0|7189,1|0,0|0,0|0,0|0,0|0,0"] = {7489, 1} -- Chuánqi Fächer-Rohling
["269,1|0,0|0,0|269,1|0,0|0,0|0,0|0,0|0,0"] = {7491, 1} -- Chuánqi Magieschwert-Rohling
["7409,1|0,0|0,0|7409,1|0,0|0,0|0,0|0,0|0,0"] = {7480, 1} -- Kaiseraxt-Rohling
["7419,1|0,0|0,0|7419,1|0,0|0,0|0,0|0,0|0,0"] = {7482, 1} -- Kaiserbogen-Rohling
["7429,1|0,0|0,0|7429,1|0,0|0,0|0,0|0,0|0,0"] = {7484, 1} -- Kaiserstab-Rohling
["7439,1|0,0|0,0|7439,1|0,0|0,0|0,0|0,0|0,0"] = {7486, 1} -- Kaiserdolche-Rohling
["7449,1|0,0|0,0|7449,1|0,0|0,0|0,0|0,0|0,0"] = {7488, 1} -- Kaiserschwert-Rohling
["7459,1|0,0|0,0|7459,1|0,0|0,0|0,0|0,0|0,0"] = {7490, 1} -- Kaiserfächer-Rohling
["7469,1|0,0|0,0|7469,1|0,0|0,0|0,0|0,0|0,0"] = {7492, 1} -- Kaisermagieschwert-Rohling
["42019,1|0,0|0,0|42019,1|0,0|0,0|0,0|0,0|0,0"] = {42050, 1} -- Chuánqi-Panzer Rohling
["44019,1|0,0|0,0|44019,1|0,0|0,0|0,0|0,0|0,0"] = {44050, 1} -- Chuánqi-Anzug Rohling
["46019,1|0,0|0,0|46019,1|0,0|0,0|0,0|0,0|0,0"] = {46050, 1} -- Chuánqi-Rüstung Rohling
["48019,1|0,0|0,0|48019,1|0,0|0,0|0,0|0,0|0,0"] = {48050, 1} -- Chuánqi-Kleidung Rohling
["42069,1|0,0|0,0|42069,1|0,0|0,0|0,0|0,0|0,0"] = {42051, 1} -- Kaiser-Panzer Rohling
["44069,1|0,0|0,0|44069,1|0,0|0,0|0,0|0,0|0,0"] = {44051, 1} -- Kaiser-Anzug Rohling
["46069,1|0,0|0,0|46069,1|0,0|0,0|0,0|0,0|0,0"] = {46051, 1} -- Kaiser-Rüstung Rohling
["48069,1|0,0|0,0|48069,1|0,0|0,0|0,0|0,0|0,0"] = {48051, 1} -- Kaiser-Kleidung Rohling
["13369,1|0,0|0,0|13369,1|0,0|0,0|0,0|0,0|0,0"] = {13606, 1} -- DämonenJägerhelm-Rohling
["13359,1|0,0|0,0|13359,1|0,0|0,0|0,0|0,0|0,0"] = {13701, 1} -- Jaktohelm-Rohling
["12909,1|0,0|0,0|12909,1|0,0|0,0|0,0|0,0|0,0"] = {13604, 1} -- Ritterhelm-Rohling
["12809,1|0,0|0,0|12809,1|0,0|0,0|0,0|0,0|0,0"] = {13602, 1} -- Himmelshelm-Rohling
["13219,1|0,0|0,0|13219,1|0,0|0,0|0,0|0,0|0,0"] = {13600, 1} -- Dämonenkönighelm-Rohling
["17119,1|0,0|0,0|17119,1|0,0|0,0|0,0|0,0|0,0"] = {13605, 1} -- Schwarzhelm-Rohling
["13139,1|0,0|0,0|13139,1|0,0|0,0|0,0|0,0|0,0"] = {13601, 1} -- Capterhelm-Rohling
["13909,1|0,0|0,0|13909,1|0,0|0,0|0,0|0,0|0,0"] = {13603, 1} -- Jägerhelm-Rohling
["13209,1|0,0|0,0|13209,1|0,0|0,0|0,0|0,0|0,0"] = {13607, 1} -- Halsblau-Rohling
["13309,1|0,0|0,0|13309,1|0,0|0,0|0,0|0,0|0,0"] = {13608, 1} -- Armbandblau-Rohling
["13339,1|0,0|0,0|13339,1|0,0|0,0|0,0|0,0|0,0"] = {13702, 1} -- Ohrringblau-Rohling
["14449,1|0,0|0,0|14449,1|0,0|0,0|0,0|0,0|0,0"] = {13704, 1} -- SchwarzLederschuhe-Rohling
["13319,1|0,0|0,0|13319,1|0,0|0,0|0,0|0,0|0,0"] = {13607, 1} -- Halsgrün-Rohling
["13399,1|0,0|0,0|13399,1|0,0|0,0|0,0|0,0|0,0"] = {13700, 1} -- Armbandgrün-Rohling
["12609,1|0,0|0,0|12609,1|0,0|0,0|0,0|0,0|0,0"] = {13703, 1} -- Ohrringgrün-Rohling
["11199,1|0,0|0,0|11199,1|0,0|0,0|0,0|0,0|0,0"] = {13705, 1} -- Metallschuhe-Rohling
}
if INPUT[1]=="itemin" then
if CRAFTING_POSSIBILITIES[CRAFT] then
cmdchat("CraftingSystem craftitem/"..CRAFTING_POSSIBILITIES[CRAFT][1].."/"..CRAFTING_POSSIBILITIES[CRAFT][2])
else
cmdchat("CraftingSystem craftitem/0/0")
end
elseif INPUT[1]=="WRONG_WEARFLEG" then
syschat("Das ist nicht der richtige Schmied um diesen Gegenstand zu verbessern")
return
elseif INPUT[1]=="craftplease" then
if CRAFTING_POSSIBILITIES[CRAFT] then
local InWindow, Cells = split(CRAFT, "|"), split(INPUT[2], ",")
for i=1, table.getn(InWindow), 1 do InWindow[i] = split(InWindow[i], ",")
end
for i=1, table.getn(InWindow), 1 do
if Cells[i]!="-1" and InWindow[i][1]!="0" and InWindow[i][2]!="0" then
if item.select_cell(tonumber(Cells[i])) then
if item.get_vnum()!=tonumber(InWindow[i][1]) or item.get_count()!=tonumber(InWindow[i][2]) then
cmdchat("CraftingSystem craftitem/0/0")
syschat("Da ist was falsch gelaufen...")
return
end
else
cmdchat("CraftingSystem craftitem/0/0")
syschat("Da ist was falsch gelaufen...")
return
end
end
end
for i=1, table.getn(InWindow), 1 do
if Cells[i]!="-1" and InWindow[i][1]!="0" and InWindow[i][2]!="0" then
if item.select_cell(tonumber(Cells[i])) then
item.remove()
else
cmdchat("CraftingSystem craftitem/0/0")
syschat("Wrong!")
return
end
end
end
pc.give_item2(CRAFTING_POSSIBILITIES[CRAFT][1], CRAFTING_POSSIBILITIES[CRAFT][2])
cmdchat("CraftingSystem itemclear/")
else
cmdchat("CraftingSystem craftitem/0/0")
end
end
end
end
end
Bei der Quest soll man Items per craftingwindow hoch ziehen können. Wenn ich die Quest aber so einfüge, zeigt er mir folgenden Fehler:
Zudem ist das Problem dass ich die sachen die eig. nur beim legendary typ geuppt werden sollen auch beim waffen schmied gehen.