马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 mjc1232009 于 2023-4-23 16:10 编辑
根据物品升级那个lua修改的,实测可用
1、这个是在数据库新建1个表 item_xl
[Lua] 纯文本查看 复制代码 CREATE TABLE `item_xl` (
`id` int(255) NOT NULL,
`upid` int(255) NOT NULL DEFAULT '0',
`amount` tinyint(255) NOT NULL DEFAULT '0',
`id1` int(255) NOT NULL DEFAULT '0',
`amount1` int(255) NOT NULL DEFAULT '0',
`id2` int(255) NOT NULL DEFAULT '0',
`amount2` int(255) NOT NULL DEFAULT '0',
`chance` int(255) NOT NULL DEFAULT '0',
`baoshi` int(255) NOT NULL DEFAULT '0',
`crazing` tinyint(255) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2、这是附魔洗练lua的代码
[Lua] 纯文本查看 复制代码 --[[
简介: ELUNA 物品升级
原作者:5L
修改:烟雨江南
致谢:ayase,愈
]]--
print(">>Script: Itemxilian.lua loading...OK")
math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6)))
local ITEMID = 199023 --洗炼宝石
UP ={};
function Item_Up(event, player, item, target)
player:MoveTo(0,player:GetX()+0.01,player:GetY(),player:GetZ())
U = target:GetEntry();
--------------------------0----1------2-------3-------4--------5-----6------7---------8---
Q = WorldDBQuery("SELECT id1, id2, amount, amount1, amount2, upid, chance, crazing, baoshi FROM item_xl WHERE `id` = '"..U.."';");
if (Q == nil) then
player:SendBroadcastMessage("★★★|CFFFF0000这件装备无法洗炼|R★★★")
return;
end
UP[U] = {
upid = Q:GetString(5), --升级后的ID
amount = Q:GetString(2), --原始装备的数量
chance = Q:GetString(6), --成功几率
crazing = Q:GetString(7), --失败是否碎裂:0不碎,1碎
id1 = Q:GetString(0), --需要的物品1的ID
amount1 = Q:GetString(3), --需要的物品1的数量
id2 = Q:GetString(1), --需要的物品2的ID
amount2 = Q:GetString(4), --需要的物品2的数量
baoshi = Q:GetString(8) --防爆宝石ID
};
player:GossipClearMenu();
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Tradeskill_Inscription_JadeSerpent.blp:30|t 需要:"..GetItemLink(U).."×"..UP[U].amount.."",0,99);
if (tonumber(UP[U].id1) > 0 and tonumber(UP[U].amount1) > 0) then
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Tradeskill_Inscription_RedCrane.blp:30|t 需要材料:"..GetItemLink(UP[U].id1).."×"..UP[U].amount1.."个",0,99);
end
if (tonumber(UP[U].id2) > 0 and tonumber(UP[U].amount2) > 0) then
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Tradeskill_Inscription_BlackOx.blp:30|t 需要材料:"..GetItemLink(UP[U].id2).."×"..UP[U].amount2.."个",0,99);
end
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Spell_Priest_VowofUnity.blp:30|t 洗炼后的装备原属性不变\n |CFFFF0000只改变|R|cff0000ff随机附魔属性|R",0,99);
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Spell_Priest_VowofUnity.blp:30|t 成功几率:"..UP[U].chance.."%",0,99);
if (tonumber(UP[U].crazing) == 0) then
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\INV_Ingot_Trillium.blp:30|t 同一件装备可以|cff0000ff洗炼无数次|R",0,99);
end
if (tonumber(UP[U].crazing) == 1) then
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\INV_Ingot_Titansteel_red.blp:30|t 洗炼的装备永远不会消失",0,99);
end
player:GossipMenuAddItem(1,"|TInterface\\ICONS\\Spell_Holy_HopeAndGrace.blp:50|t ★|CFFFF1100确认洗炼|R★",1,1);
player:GossipSendMenu(1,item);
end
function Item_Select(event, player, object, sender, intid, code, menu_id)
if (intid == 1) then
local ChanceUp = math.random(0,100)
if player:HasItem(U, tonumber(UP[U].amount)) and (tonumber(UP[U].id1) == 0 or tonumber(UP[U].amount1) == 0 or player:HasItem(tonumber(UP[U].id1), tonumber(UP[U].amount1))) and (tonumber(UP[U].id2) == 0 or tonumber(UP[U].amount2) == 0 or player:HasItem(tonumber(UP[U].id2), tonumber(UP[U].amount2))) then
if tonumber(UP[U].id1) > 0 and tonumber(UP[U].amount1) > 0 then
player:RemoveItem(UP[U].id1, UP[U].amount1);
end
if tonumber(UP[U].id2) > 0 and tonumber(UP[U].amount2) > 0 then
player:RemoveItem(UP[U].id2, UP[U].amount2);
end
if tonumber(UP[U].chance) >= ChanceUp then
if player:HasItem(tonumber(UP[U].baoshi), 1) then
player:RemoveItem(tonumber(UP[U].baoshi), 1);
end
player:RemoveItem(U,UP[U].amount);
player:SendBroadcastMessage("★★★★★★★★★★|CFFFF0000洗炼成功|R★★★★★★★★★★");
player:AddItem(UP[U].upid, 1);
else
if (tonumber(UP[U].crazing) == 0) then
player:SendBroadcastMessage("|CFFFF0000合成失败!!|R");
elseif player:HasItem(tonumber(UP[U].baoshi), 1) then
player:RemoveItem(tonumber(UP[U].baoshi), 1);
player:SendBroadcastMessage("|CFFFF0000合成失败!防爆宝石保存了原有道具,但无法保存材料!!|R");
else
player:RemoveItem(U, UP[U].amount);
player:SendBroadcastMessage("★★★★★|CFFFF0000合成失败!物品破碎!|R★★★★★");
end
end
else
player:SendBroadcastMessage("★★★★★|CFFFF0000装备或材料数量不足|R★★★★★");
end
player:GossipComplete();
end
if(intid == 99) then
player:SendBroadcastMessage("★★★★★请点击确认洗炼按钮★★★★★");
player:GossipComplete();
end
end
RegisterItemEvent(ITEMID, 2, Item_Up);
RegisterItemGossipEvent(ITEMID, 2, Item_Select);
3、然后在item_template新建1个物品
199023 15 1 -1 洗练卷 56320 7 268435520 0 1 0 0 0 -1 -1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90000 0 0 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 0 0 -1 0 -1 0 洗练装备随即附魔 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 12340
图片展示:
下载地址:
|