PHP Code:
-- ÖØÖý½ðÎÚ×°±¸
Include("\\script\\lib\\composeex.lua")
Include("\\script\\misc\\eventsys\\type\\npc.lua")
Include("\\script\\lib\\log.lua")
Include("\\script\\event\\equip_publish\\baihu\\equiptable.lua")
tbBaiHuRefineEquip = tbActivityCompose:new()
tbBaiHuRefineList =
{
[1]= {szName="B¹ch Hæ H¹ng Liªn", nStone = 1, nWidth = 2, nHeight = 1, nFreeItemCellLimit = 1},
[2]= {szName="B¹ch Hæ Kh«i", nStone = 2, nWidth = 2, nHeight = 2, nFreeItemCellLimit = 1},
[3]= {szName="B¹ch Hæ Thîng Giíi ChØ", nStone = 2, nWidth = 1, nHeight = 1, nFreeItemCellLimit = 1},
[4]= {szName="B¹ch Hæ Hé UyÓn", nStone = 1, nWidth = 1, nHeight = 2, nFreeItemCellLimit = 1},
[5]= {szName="B¹ch Hæ Yªu §¸i", nStone = 2, nWidth = 2, nHeight = 1, nFreeItemCellLimit = 1},
[6]= {szName="B¹ch Hæ Y Phôc", nStone = 3, nWidth = 2, nHeight = 3, nFreeItemCellLimit = 1},
[7]= {szName="B¹ch Hæ Vò KhÝ", nStone = 4, nWidth = 2, nHeight = 4, nFreeItemCellLimit = 1},
[8]= {szName="B¹ch Hæ Hµi", nStone = 3, nWidth = 2, nHeight = 2, nFreeItemCellLimit = 1},
[9]= {szName="B¹ch Hæ Béi", nStone = 3, nWidth = 1, nHeight = 2, nFreeItemCellLimit = 1},
[10]={szName="B¹ch Hæ H¹ Giíi ChØ", nStone = 2, nWidth = 1, nHeight = 1, nFreeItemCellLimit = 1},
}
function tbBaiHuRefineEquip:ComposeGiveUI()
local szTitle = format(" %-15s\t%s", "Trang bÞ B¹ch Hæ", "B¹ch Hæ Trïng LuyÖn Ngäc")
local strDesc = format(" %-21s\t%d", "B¹ch Hæ Kh«i", 2)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Y Phôc", 3)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Hµi", 3)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Yªu §¸i", 2)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Hé UyÓn", 1)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Ngäc Béi", 3)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ H¹ng Liªn", 1)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Giíi ChØ", 2)
strDesc = strDesc..format("\n %-21s\t%d", "B¹ch Hæ Vò KhÝ", 4)
g_GiveItemUI(szTitle, strDesc, {self.GiveUIOk, {self}}, nil, self.bAccessBindItem)
end
function tbBaiHuRefineEquip:Compose(nComposeCount)
nComposeCount = nComposeCount or 1
if type(self.tbFormula.pLimitFun) == "function" then
if self.tbFormula:pLimitFun(nComposeCount) ~= 1 then
return 0
end
end
-- È¡µÃ½ðÎÚÖØÁ·Ê¯µÄÊýÁ¿
local tbRoomItems = self:GetRoomItems(self.nRoomType) -- ÿ´Î¶¼ÖØлñÈ¡£¬ÒÔ·ÀÖ¹Óб仯
local tbGoldEquip = nil
local nEquType = 0 -- ÎäÆ÷Àà±ð
local nEqIndex = 0
for i = 1, getn(tbRoomItems) do
nItemQuality = GetItemQuality(tbRoomItems[i])
--¼ì²éÎïÆ·Æ·ÖÊ
if nItemQuality == 1 then
nEqIndex = GetGlodEqIndex(tbRoomItems[i])
if nEqIndex >= 2285 and nEqIndex <= 2314 then -- ½ðÎÚ×°±¸
--¼ì²é°ó¶¨×´Ì¬
local nBindState = GetItemBindState(tbRoomItems[i])
if nBindState ~= 0 then
Say("Trang bÞ cña ng¬i ®ang trong tr¹ng th¸i khãa, kh«ng thÓ trïng luyÖn.")
return 0
end
--¼ì²éÊÇ·ñÊÇÆÆËð×°±¸
local nG, _, _ = GetItemProp(tbRoomItems[i])
if nG == 7 then
Say("Trang bÞ cña ng¬i ®· bÞ h h¹i kh«ng thÓ trïng luyÖn.")
return 0
end
nEquType = mod(nEqIndex - 2285, 10) + 1
tbGoldEquip = {0, nEqIndex}
break
end
end
end
if tbGoldEquip == nil then
Say("Ng¬i cha ®Æt trang bÞ B¹ch Hæ nµo vµo ®©y c¶.")
return 0
end
local nFreeItemCellLimit = tbBaiHuRefineList[nEquType].nFreeItemCellLimit or 1
nFreeItemCellLimit = ceil(nFreeItemCellLimit * nComposeCount)
if tbBaiHuRefineList[nEquType].nWidth ~= 0 and tbBaiHuRefineList[nEquType].nHeight ~= 0 and CountFreeRoomByWH(tbBaiHuRefineList[nEquType].nWidth, tbBaiHuRefineList[nEquType].nHeight, nFreeItemCellLimit) < nFreeItemCellLimit then
Say(format("§Ó b¶o ®¶m tµi s¶n cña ®¹i hiÖp, xin h·y ®Ó trèng %d %dx%d hµnh trang", nFreeItemCellLimit, tbBaiHuRefineList[nEquType].nWidth, tbBaiHuRefineList[nEquType].nHeight))
return 0
end
local tbItem = {szName = "Ngäc Trïng LuyÖn B¹ch Hæ", tbProp = {6,1,3187,1,0,0}, nCount = tbBaiHuRefineList[nEquType].nStone}
local nCount = self:CalcItemCount(tbRoomItems, tbItem)
if nCount < tbBaiHuRefineList[nEquType].nStone then
local szMsg = self.tbFormula.szFailMsg or "<color=red>B¹ch Hæ Trïng LuyÖn Ngäc mµ ng¬i ®Æt vµo kh«ng ®ñ. <color>"
Talk(1, "", szMsg)
return 0;
end
local nIdx = floor((nEqIndex - 2285)/10) + 1
local tbProduct = tbEquip_baihu[nEquType][nIdx]
local tbMaterial = {{szName = tbProduct.szName, tbProp = tbGoldEquip, nCount = 1}, tbItem}
if self:ConsumeMaterial(tbMaterial, nComposeCount, self.szLogTitle) ~= 1 then
--Say("ÖÆ×÷ʧ°Ü£¬²¿·ÖÎïÆ·¶ªÊ§¡£",0)
Msg2Player("ChÕ t¹o thÊt b¹i, mÊt ®i mét sè nguyªn liÖu.")
return 0;
end
tbAwardTemplet:GiveAwardByList(tbProduct, self.szLogTitle, nComposeCount)
if type(self.tbFormula.pProductFun) == "function" then
self.tbFormula:pProductFun(nComposeCount)
end
return 1;
end
function refine_baihu()
local strDesc = "<npc>LÊy <color=yellow>trang bÞ B¹ch Hæ <color> muèn trïng luyÖn vµ sè lîng <color=yellow> B¹ch Hæ Trïng LuyÖn Ngäc<color> t¬ng øng ®Æt vµo phÝa díi"
strDesc = strDesc..format("\n\t\t\t\t\t%-29s%s", "Trang bÞ B¹ch Hæ", "B¹ch Hæ Trïng LuyÖn Ngäc")
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Kh«i", 2)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Y Phôc", 3)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Hµi", 3)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Yªu §¸i", 2)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Hé UyÓn", 1)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Ngäc Béi", 3)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ H¹ng Liªn", 1)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Giíi ChØ", 2)
strDesc = strDesc..format("\n\t\t\t<color=yellow>%-34s<color=red>%d<color>", "B¹ch Hæ Vò KhÝ", 4)
local tbOpt = {}
local tbMate = {
tbMaterial =
{
{szName = "Trang bÞ B¹ch Hæ", tbProp = {0, {2285,2314}}, nQuality = 1 },
{szName = "Ngäc Trïng LuyÖn B¹ch Hæ", tbProp = {6,1,3187,1,0,0},},
},
tbProduct = {szName="Trang bÞ B¹ch Hæ", tbProp={0, {2285,2314}}},
}
local p = tbBaiHuRefineEquip:new(tbMate, "BaiHuRefineEquip", INVENTORY_ROOM.room_giveitem)
tinsert(tbOpt, {"Trïng luyÖn trang bÞ B¹ch Hæ", p.ComposeGiveUI, {p}})
tinsert(tbOpt, {"Hñy bá "})
CreateNewSayEx(strDesc, tbOpt);
end