PDA

View Full Version : [TLBB] Xin Script Tân Mãng Thần Phù



vu620
28-10-16, 11:36 AM
Bác nào hảo tâm cho mình xin cái Script Tân mãng phù nuốt vào cái tàn Khuyết nó thành Liên nhung với ! Mình làm mãi không được ! Tks trước =((


-- ´´½¨ÈË[ QUFEI 2007-09-30 21:53 UPDATE BugID 25759 ]
-- ÐÞ¸ÄÈË[ ñÒÉÙ΢ 2008.5.20 Ìí¼Ó102c¤pÉñÆ÷toÕ ðµ ºÏ³ÉÅä·½ ]

-- ѪԡÉñ±øÍêÕûÖ÷²ÄtoÕ ðµ ºÏ³É»úÖÆʵÏÖ (¸Ä³ÉÕýÈ·Tên)
-- ItemID = 30505800~30505805(ÐÂçÉñ·û) 30505806 102c¤pÉñÆ÷
-- 335135
-- Ìá¸ßÉñ·ûÍê³É¶È¼°ÍêÕûÉñ·ûto Õ ðµ ºÏ³É
-- ÎïÆ·¿ÉÒÔʹÓÃ1´Î
-- ʹÓÃÍê¾Íɾ³ýÎïÆ·


--************************************************** ****************************
-- ÒÔϲ¿·ÖC¥n ÐúngC¥n ÐÞ¸ÄtoÕ ðµ ²¿·Ö
--************************************************** ****************************

--½Å±¾ºÅ (¸Ä³ÉÕýÈ·½Å±¾ºÅ)
x335135_g_scriptId = 335135

-- Ôö¼ÓÖµ (¸ù¾ÝÒªÇó¸Äд¾ßÌåÊýÖµ)
x335135_g_CompleteValue = 5 -- Éñ²ÄÔö¼ÓÍê³É¶È -- ñÒÉÙ΢,102ÉñÆ÷.·½±ã²âÊÔµ÷³É� �Ë50,²âÊÔÍê±Ïµ÷»Ø5¼´¿É.
--x335135_g_MaxCompleteValue = 100-- ×î´óÉñ²ÄÍê³É¶ÈÉÏÏÞ
x335135_g_MaxUseCount = 1 -- ×î´óʹÓôÎÊý1´Î

--±ê׼Ч¹ûID (¸Ä³ÉÉñ²ÄºÏ³ÉtoÕ ðµ ÌØЧ)
--g_ImpactID = 0

--Éñ²ÄºÏ³É¶ÔÓ¦±í
x335135_g_ShenCaiTable = {{sjid=30505700,sfid=30505800,lrid=30505900},
{sjid=30505701,sfid=30505801,lrid=30505901},
{sjid=30505702,sfid=30505802,lrid=30505902},
{sjid=30505703,sfid=30505803,lrid=30505903},
{sjid=30505704,sfid=30505804,lrid=30505904},
{sjid=30505705,sfid=30505805,lrid=30505905},
{sjid=30505706,sfid=30505806,lrid=30505906},} -- -- ñÒÉÙ΢ 2008.5.20. 102c¤pÉñÆ÷ÖýÔìͼÑù.²ÐȱtoÕ ðµ Éñ½Ú7c¤p,Tân mãng th¥n phù c¤p 7,Á¬ÈÖÉñ½Ú7c¤p.
x335135_g_MaxCompleteValue = {25,50,75,100,100,100,100}
-- µ±Ç°¿ÉÒԺϳÉtoÕ ðµ Éñ²ÄË÷ÒýºÅ
x335135_g_ShenCaiIndex = 0

-- ʹÓÃÐÂçÉñ·ûÔö¼ÓÍêÕû¶Èʱto Õ ðµ ÌØЧID
x335135_g_Impact_LevelUP = 47

-- ºÏ³É³öÁ¬ÈÖÉñ½ÚʱtoÕ ðµ ÌØЧID
x335135_g_Impact_Complete = 48

-- ñÒÉÙ΢,102ÉñÆ÷
x335135_g_XinMang7JiInfo = "Tân mãng th¥n phù c¤p 7"

--************************************************** ****************************
-- ÒÔÉϲ¿·ÖC¥n ÐúngC¥n ÐÞ¸ÄtoÕ ðµ ²¿·Ö
--************************************************** ****************************

--½Å±¾

--**********************************
--ʼþ½»»¥Èë¿Ú
--**********************************
function x335135_OnDefaultEvent( sceneId, selfId, bagIndex )
-- ²»C¥n Cái này ½Ó¿Ú,µ«Òª±£Áô¿Õº¯Êý
end

--**********************************
--Cái này ÎïÆ·toÕ ðµ ʹÓùý³ÌÐúng·ñÀàËÆÓÚ¼¼ÄÜ:
--H® th¯ng»áTÕi Ö´ÐпªÊ¼Ê±¼ì²âCái này º¯ÊýtoÕ ðµ Tr· v«Öµ,Èç¹ûTr· v«th¤t bÕiÔòºöÂÔºóÃætoÕ ðµ ÀàËƼ¼ÄÜtoÕ ðµ Ö´ÐÐ.
--Tr· v«1: ¼¼ÄÜÀàËÆtoÕ ðµ ÎïÆ·,¿ÉÒÔ¼ÌÐøÀàËƼ¼ÄÜtoÕ ðµ Ö´ÐУ»Tr· v«0: ºöÂÔºóÃætoÕ ðµ ²Ù×÷.
--**********************************
function x335135_IsSkillLikeScript( sceneId, selfId)
return 1 --Cái này ½Å±¾C¥n ¶¯×÷Ö§³Ö
end

--**********************************
--Ìõ¼þ¼ì²âÈë¿Ú:
--H® th¯ng»áTÕi ¼¼Äܼì²âtoÕ ðµ ʱ¼ä ði¬mµ÷ÓÃCái này ½Ó¿Ú,²¢¸ù¾ÝCái này º¯ÊýtoÕ ðµ Tr· v«ÖµXác nh§nÒÔºótoÕ ðµ Á÷³ÌÐúng·ñÖ´ÐÐ.
--Tr· v«1: Ìõ¼þ¼ì²âͨ¹ý,¿ÉÒÔ¼ÌÐøÖ´ÐÐ� �»Tr· v«0: Ìõ¼þ¼ì²âth¤t bÕi,ÖжϺóÐøÖ´ÐÐ.
--**********************************
function x335135_OnConditionCheck( sceneId, selfId )
-- PrintStr("OnConditionCheck...")

--УÑéʹÓÃtoÕ ðµ ÎïÆ·
if(1~=LuaFnVerifyUsedItem(sceneId, selfId)) then
return 0
end

-- ði¬mµ½µ±Ç°ÕýTÕi ʹÓÃtoÕ ðµ ÎïÆ·toÕ ðµ trí tay näi
local nIndex = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )

-- ði¬mµ½µ±Ç°ÕýTÕi ʹÓÃtoÕ ðµ ÎïÆ·toÕ ðµ ID
local Item01 = LuaFnGetItemTableIndexByIndex(sceneId, selfId, nIndex)

-- PrintStr("Item01 ="..Item01)

-- ñÒÉÙ΢ 2008.5.20. 102c¤pÉñÆ÷ÖýÔìͼÑù.ÆßcáiÐÂÃ§É ñ·û.
for i=1, 7 do --for i=1, 6 do
if Item01 == x335135_g_ShenCaiTable[i].sfid then
x335135_g_ShenCaiIndex = i
-- PrintStr("x335135_g_ShenCaiIndex ="..x335135_g_ShenCaiIndex)
break
end
-- PrintStr("sfid ="..x335135_g_ShenCaiTable[i].sfid)
end

-- PrintStr("x335135_g_ShenCaiIndex ="..x335135_g_ShenCaiIndex)

-- ñÒÉÙ΢ 2008.5.20. 102c¤pÉñÆ÷ÖýÔìͼÑù.Ìí¼ÓÐÂtoÕ ðµ ÐÂçÉñ·û
if Item01 < 30505800 or Item01 > 30505806 then -- if Item01 < 30505800 or Item01 > 30505805 then
local strNotice = "Chï có th¬ dùng tân mãng th¥n phù hþp thành" -- ÐÂçÉñ·û
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

-- PrintStr("sjid ="..x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid)

local ItemCount = LuaFnGetAvailableItemCount( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid )
if ItemCount < 1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

local bagbegin = GetBasicBagStartPos(sceneId, selfId)
local bagend = GetBasicBagEndPos(sceneId, selfId)
-- PrintStr("bagbegin ="..bagbegin)
-- PrintStr("bagend ="..bagend)
local ItemEX
-- ðÕt ðßþcµ±Ç°¿ÉÒԺϳÉtoÕ ðµ µÚmµt cáiÉñ½ÚTÕi ±³°üÖÐtoÕ ðµ λÖÃ
local sjbagpos = -1
for i=bagbegin, bagend do
if LuaFnIsItemAvailable( sceneId, selfId, i ) == 1 then
ItemEX = LuaFnGetItemTableIndexByIndex(sceneId, selfId, i)
if ItemEX == x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid then
-- PrintStr("ItemEX ="..ItemEX)
sjbagpos = i
break
end
end
end

-- PrintStr("sjbagpos ="..sjbagpos)

if sjbagpos == -1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

-- PrintStr("sjbagpos ="..sjbagpos)

local CheckParam = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )

-- PrintStr("CheckParam ="..CheckParam)

if CheckParam < x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] and CheckParam + x335135_g_CompleteValue >= x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] then -- µ±ÍêÕû¶È´ïµ½100ʱÐúng·ñ»¹ÓÐ� �Õ¼ä
local FreeSpace = LuaFnGetPropertyBagSpace( sceneId, selfId )
if( FreeSpace < 1 ) then
local strNotice = "Ô ðÕo cø không có không gian, c¥n sØa sang lÕi."
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end
end


-- ñÒÉÙ΢,102ÉñÆ÷.Èç¹ûʹÓÃtoÕ ðµ ÐúngTân mãng th¥n phù c¤p 7
if Item01 == 30505806 then
x335135_g_XinMang7JiInfo = GetBagItemTransfer( sceneId, selfId, nIndex )
--PrintStr(x335135_g_XinMang7JiInfo)
end


return 1; --²»C¥n ÈκÎÌõ¼þ,²¢ÇÒʼÖÕTr· v«1.
end

--**********************************
--ÏûºÄ¼ì²â¼°´¦ÀíÈë¿Ú:
--H® th¯ng»áTÕi ¼¼ÄÜÏûºÄtoÕ ðµ ʱ¼ä ði¬mµ÷ÓÃCái này ½Ó¿Ú,²¢¸ù¾ÝCái này º¯ÊýtoÕ ðµ Tr· v«ÖµXác nh§nÒÔºótoÕ ðµ Á÷³ÌÐúng·ñÖ´ÐÐ.
--Tr· v«1: ÏûºÄ´¦Àíͨ¹ý,¿ÉÒÔ¼ÌÐøÖ´ÐÐ� �»Tr· v«0: ÏûºÄ¼ì²âth¤t bÕi,ÖжϺóÐøÖ´ÐÐ.
--×¢Òâ: Õâ²»¹â¸ºÔðÏûºÄtoÕ ðµ ¼ì²âÒ²¸ºÔðÏûºÄtoÕ ðµ Ö´ÐÐ.
--**********************************
function x335135_OnDeplete( sceneId, selfId )
if(0<LuaFnDepletingUsedItem(sceneId, selfId)) then
return 1
end
return 0
end

--**********************************
--Ö»»áÖ´ÐÐmµt ´ÎÈë¿Ú:
--¾ÛÆøºÍ˲·¢¼¼ÄÜ»áTÕi ÏûºÄÍê³Éºóµ÷ÓÃCái này ½Ó¿Ú(¾ÛÆø½áÊø²¢ÇÒ¸÷ÖÖÌõ¼þ� �¼Thöa mãntoÕ ðµ ʱºò),¶øÒýµ¼
--¼¼ÄÜÒ²»áTÕi ÏûºÄÍê³Éºóµ÷ÓÃCái này ½Ó¿Ú(¼¼ÄÜtoÕ ðµ mµt ¿ªÊ¼,ÏûºÄ³É¹¦Ö´ÐÐÖ®ºó).
--Tr· v«1: ´¦Àí³É¹¦£»Tr· v«0: ´¦Àíth¤t bÕi.
--×¢: ÕâÀïÐúng¼¼ÄÜÉúЧmµt ´ÎtoÕ ðµ Èë¿Ú
--**********************************
function x335135_OnActivateOnce( sceneId, selfId )

-- PrintStr("OnActivateOnce...")
local ItemCount = LuaFnGetAvailableItemCount( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid )

if ItemCount < 1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

-- ði¬mµ½µ±Ç°ÕýTÕi ʹÓÃtoÕ ðµ ÎïÆ·toÕ ðµ trí tay näi
local nIndex = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )

-- PrintStr("nIndex ="..nIndex)

-- ði¬mµ½µ±Ç°ÕýTÕi ʹÓÃtoÕ ðµ ÎïÆ·toÕ ðµ ID
local Item01 = x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sfid

-- PrintStr("Item01 ="..Item01)

--ÏûºÄÑ¡ÖÐtoÕ ðµ ÐÂçÉñ·û
-- ret = LuaFnDelAvailableItem(sceneId, selfId, Item01, 1)
local bagbegin = GetBasicBagStartPos(sceneId, selfId)
local bagend = GetBasicBagEndPos(sceneId, selfId)
-- PrintStr("bagbegin ="..bagbegin)
-- PrintStr("bagend ="..bagend)
local ItemEX
-- ðÕt ðßþcµ±Ç°¿ÉÒԺϳÉtoÕ ðµ µÚmµt cáiÉñ½ÚTÕi ±³°üÖÐtoÕ ðµ λÖÃ
local sjbagpos = -1
for i=bagbegin, bagend do
if LuaFnIsItemAvailable( sceneId, selfId, i ) == 1 then
ItemEX = LuaFnGetItemTableIndexByIndex(sceneId, selfId, i)
if ItemEX == x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid then
-- PrintStr("ItemEX ="..ItemEX)
sjbagpos = i
break
end
end
end

-- PrintStr("sjbagpos ="..sjbagpos)

if sjbagpos == -1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

-- ðÕt ðßþcµ±Ç°ºÏ³ÉtoÕ ðµ Éñ½ÚÍêÕû¶È
local CompleteValue = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )
-- PrintStr("CompleteValue ="..CompleteValue)

if nIndex >= 0 then

-- ¼Ç¼ͳ¼ÆÐÅÏ¢
LuaFnAuditShenCai(sceneId, selfId, Item01)

CompleteValue = CompleteValue + x335135_g_CompleteValue

-- PrintStr("CompleteValue ="..CompleteValue)

SetBagItemParam( sceneId, selfId, sjbagpos, 8, 2, CompleteValue ) --ÉèÖÃÍê³É¶È

-- ñÒÉÙ΢,2008.5.22 Ìí¼ÓÊÀ½çH® th¯ng¹«¸æ #ISØ døng mµt cáiÐÂçÉñ·û#G7c¤p#I,ÀëÖý³É¾øÊÀ ÉñÆ÷ÓÖ½üÁËmµt ²½.
if Item01 == 30505806 then
local playername = GetName(sceneId, selfId)
local strText = format("#{_INFOUSR%s}#{DQSJ_20080512_12}#{_INFOMSG%s}#{DQS J_20080512_13}", playername, x335135_g_XinMang7JiInfo)
BroadMsgByChatPipe(sceneId,selfId, strText, 4)
end

--------------²ÎÊýÉèÖð²È«ÐÔ¼ì²â,ËäÈ»Àí� �ÛÉϲÎÊýÉèÖò»»áth¤t bÕi
local CheckParam = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )

-- PrintStr("CheckParam ="..CheckParam)

if CheckParam ~= CompleteValue then
return 0
end
--------------²ÎÊýÉèÖð²È«ÐÔ¼ì²â,ËäÈ»Àí� �ÛÉϲÎÊýÉèÖò»»áth¤t bÕi

local strNotice = "Cüa ngß½i ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}".."Ð¥y ðü ðµ gia tång 1 r°i" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)

LuaFnRefreshItemInfo( sceneId, selfId, sjbagpos ) --ˢб³°üÐÅÏ¢

if CompleteValue >= x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] then -- µ±ÍêÕû¶È´ïµ½100ʱ

local EraseRet = EraseItem( sceneId, selfId, sjbagpos )

if EraseRet < 0 then --Èç¹ûɾ³ýth¤t bÕi,½«²»»á²úÉúÈκÎЧ¹û
return 0
end

-- PrintStr("lrid ="..x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].lrid)

BeginAddItem( sceneId )
AddItem( sceneId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].lrid, 1 )
ret = EndAddItem( sceneId, selfId )

if ret > 0 then
TryRecieveItem( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].lrid, QUALITY_MUST_BE_CHANGE ) -- ·Å²»Ï¾ÍûÓÐÁË

else
BeginEvent(sceneId)
strText = "Ô ðÕo cø ho£c nguyên li®u không ðü không gian, thïnh sØa sang lÕi sau lÕi ðªn lînh."
AddText(sceneId,strText);
EndEvent(sceneId)
DispatchMissionTips(sceneId,selfId)
return 0
end
LuaFnSendSpecificImpactToUnit( sceneId, selfId, selfId, selfId, x335135_g_Impact_Complete, 0 )
else
LuaFnSendSpecificImpactToUnit( sceneId, selfId, selfId, selfId, x335135_g_Impact_LevelUP, 0 )
end

else
local strMsg = "Hþp thành th¤t bÕi"
x335135_ShowMsg( sceneId, selfId, strMsg)
return 0
end

-- Ö÷²ÄºÏ³ÉÍê±Ï

-- LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, g_ImpactID, 0)
return 1
end

--**********************************
--Òýµ¼ÐÄÌø´¦ÀíÈë¿Ú:
--Òýµ¼¼¼ÄÜ»áTÕi ÿ´ÎÐÄÌø½áÊøʱµ÷ÓÃCái này ½Ó¿Ú.
--Tr· v«: 1¼ÌÐøÏ´ÎÐÄÌø£»0: ÖжÏÒýµ¼.
--×¢: ÕâÀïÐúng¼¼ÄÜÉúЧmµt ´ÎtoÕ ðµ Èë¿Ú
--**********************************
function x335135_OnActivateEachTick( sceneId, selfId )
return 1
end

--**********************************
--Ö±½ÓHuÖ böЧ¹û:
--H® th¯ng»áÖ±½Óµ÷ÓÃCái này ½Ó¿Ú,²¢¸ù¾ÝCái này º¯ÊýtoÕ ðµ Tr· v«ÖµXác nh§nÒÔºótoÕ ðµ Á÷³ÌÐúng·ñÖ´ÐÐ.
--Tr· v«1: ÒѾ­HuÖ bö¶ÔӦЧ¹û,²»ÔÙÖ´ÐкóÐø²Ù× ÷£»Tr· v«0: ûÓмì²âµ½Ïà¹ØЧ¹û,¼ÌÐøÖ´� �Ð.
function x335135_CancelImpacts( sceneId, selfId )
return 0 --²»C¥n Cái này ½Ó¿Ú,µ«Òª±£Áô¿Õº¯Êý,²¢ÇÒʼ ÖÕTr· v«0.
end

function x335135_ShowMsg( sceneId, selfId, strMsg)
BeginEvent( sceneId )
AddText( sceneId, strMsg )
EndEvent( sceneId )
DispatchMissionTips( sceneId, selfId )
end

makute7413
31-10-16, 07:45 PM
Script Tân Mãng Thần Phù




x335135_g_scriptId = 335135

x335135_g_CompleteValue = 5
x335135_g_MaxUseCount = 1
x335135_g_MaxCompleteValue = {25,50,75,100,100,100,100}
x335135_g_ShenCaiTable = { {sjid=30505700,sfid=30505800,lrid=30505900},
{sjid=30505701,sfid=30505801,lrid=30505901},
{sjid=30505702,sfid=30505802,lrid=30505902},
{sjid=30505703,sfid=30505803,lrid=30505903},
{sjid=30505704,sfid=30505804,lrid=30505904},
{sjid=30505705,sfid=30505805,lrid=30505905},
{sjid=30505706,sfid=30505806,lrid=30505906},}
x335135_g_ShenCaiIndex = 0

x335135_g_Impact_LevelUP = 47

x335135_g_Impact_Complete = 48

x335135_g_XinMang7JiInfo = "Tân Mãng Th¥n Phù C¤p 7"

--************************************************** ****************************

function x335135_OnDefaultEvent( sceneId, selfId, bagIndex )
end

--**********************************
--**********************************
function x335135_IsSkillLikeScript( sceneId, selfId)
return 1
end
--**********************************
function x335135_OnConditionCheck( sceneId, selfId )

if(1~=LuaFnVerifyUsedItem(sceneId, selfId)) then
return 0
end

local nIndex = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )

local Item01 = LuaFnGetItemTableIndexByIndex(sceneId, selfId, nIndex)

for i=1, 7 do
if Item01 == x335135_g_ShenCaiTable[i].sfid then
x335135_g_ShenCaiIndex = i
break
end
end

if Item01 < 30505800 or Item01 > 30505806 then
local strNotice = "Chï có th¬ dùng tân mãng th¥n phù hþp thành"
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end
local ItemCount = LuaFnGetAvailableItemCount( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid )
if ItemCount < 1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

local bagbegin = GetBasicBagStartPos(sceneId, selfId)
local bagend = GetBasicBagEndPos(sceneId, selfId)
local ItemEX
local sjbagpos = -1
for i=bagbegin, bagend do
if LuaFnIsItemAvailable( sceneId, selfId, i ) == 1 then
ItemEX = LuaFnGetItemTableIndexByIndex(sceneId, selfId, i)
if ItemEX == x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid then
sjbagpos = i
break
end
end
end


if sjbagpos == -1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end


local CheckParam = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )


if CheckParam < x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] and CheckParam + x335135_g_CompleteValue >= x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] then -- µ±ÍêÕû¶È´ïµ½100ʱÐúng·ñ»¹ÓÐ� �Õ¼ä
local FreeSpace = LuaFnGetPropertyBagSpace( sceneId, selfId )
if( FreeSpace < 1 ) then
local strNotice = "Ô ðÕo cø không có không gian, c¥n sØa sang lÕi."
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end
end


if Item01 == 30505806 then
x335135_g_XinMang7JiInfo = GetBagItemTransfer( sceneId, selfId, nIndex )
end


return 1;
end

--**********************************
function x335135_OnDeplete( sceneId, selfId )
if(0 < LuaFnDepletingUsedItem(sceneId, selfId)) then
return 1
end
return 0
end

--**********************************
--**********************************
function x335135_OnActivateOnce( sceneId, selfId )
if(1~=LuaFnVerifyUsedItem(sceneId, selfId)) then
return 0
end

local nIndex = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )
local Item001 = LuaFnGetItemTableIndexByIndex(sceneId, selfId, nIndex)
for i=1, 7 do --for i=1, 6 do
if Item001 == x335135_g_ShenCaiTable[i].sfid then
x335135_g_ShenCaiIndex = i
break
end
end

local ItemCount = LuaFnGetAvailableItemCount( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid )

if ItemCount < 1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}"
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

local Item01 = x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sfid

local bagbegin = GetBasicBagStartPos(sceneId, selfId)
local bagend = GetBasicBagEndPos(sceneId, selfId)
local ItemEX
local sjbagpos = -1
for i = bagbegin, bagend do
if LuaFnIsItemAvailable( sceneId, selfId, i ) == 1 then
ItemEX = LuaFnGetItemTableIndexByIndex(sceneId, selfId, i)
if ItemEX == x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid then
sjbagpos = i
break
end
end
end

if sjbagpos == -1 then
local strNotice = "Ngß½i c¥n ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)
return 0
end

local CompleteValue = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )

if 0 == 0 then
LuaFnDelAvailableItem(sceneId,selfId,Item001,1)

LuaFnAuditShenCai(sceneId, selfId, Item01)

CompleteValue = CompleteValue + x335135_g_CompleteValue


SetBagItemParam( sceneId, selfId, sjbagpos, 8, 2, CompleteValue ) --ÉèÖÃÍê³É¶È

if Item01 == 30505806 then
local playername = GetName(sceneId, selfId)
local strText = format("#G#{_INFOUSR%s}#{DQSJ_20080512_12} "..x335135_g_XinMang7JiInfo.."#{DQSJ_20080512_13}", playername)
BroadMsgByChatPipe(sceneId,selfId, strText, 4)
end

local CheckParam = GetBagItemParam( sceneId, selfId, sjbagpos, 8, 2 )

if CheckParam ~= CompleteValue then
return 0
end

local strNotice = "Cüa ngß½i ".."#{_ITEM"..(x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].sjid).."}".." ð¥y ðü gia tång 1 r°i" -- ²ÐȱtoÕ ðµ Éñ½Ú
x335135_ShowMsg( sceneId, selfId, strNotice)

LuaFnRefreshItemInfo( sceneId, selfId, sjbagpos ) --ˢб³°üÐÅÏ¢

if CompleteValue >= x335135_g_MaxCompleteValue[x335135_g_ShenCaiIndex] then -- µ±ÍêÕû¶È´ïµ½100ʱ

local EraseRet = EraseItem( sceneId, selfId, sjbagpos )

if EraseRet < 0 then --Èç¹ûɾ³ýth¤t bÕi,½«²»»á²úÉúÈκÎЧ¹û
return 0
end

BeginAddItem( sceneId )
AddItem( sceneId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].lrid, 1 )
ret = EndAddItem( sceneId, selfId )

if ret > 0 then

local equip = TryRecieveItem( sceneId, selfId, x335135_g_ShenCaiTable[x335135_g_ShenCaiIndex].lrid, QUALITY_MUST_BE_CHANGE ) -- ·Å²»Ï¾ÍûÓÐÁË
local equipinfo = GetBagItemTransfer( sceneId, selfId, equip )

local playername = GetName(sceneId, selfId)
local strText = format("#YChúc m×ng #{_INFOUSR%s}#Y sau bao nhiêu v¤t vä ðã có ðßþc #G#{_INFOMSG%s}", playername,equipinfo)
BroadMsgByChatPipe(sceneId,selfId, strText, 4)

else
BeginEvent(sceneId)
strText = "Ô ðÕo cø ho£c nguyên li®u không ðü không gian, thïnh sØa sang lÕi sau lÕi ðªn lînh."
AddText(sceneId,strText);
EndEvent(sceneId)
DispatchMissionTips(sceneId,selfId)
return 0
end
LuaFnSendSpecificImpactToUnit( sceneId, selfId, selfId, selfId, 48, 0 )
else
LuaFnSendSpecificImpactToUnit( sceneId, selfId, selfId, selfId, 47, 0 )
end

else
local strMsg = "Hþp thành th¤t bÕi"
x335135_ShowMsg( sceneId, selfId, strMsg)
return 0
end

return 1
end

--**********************************
function x335135_OnActivateEachTick( sceneId, selfId )
return 1
end

--**********************************
function x335135_CancelImpacts( sceneId, selfId )
return 0
end

function x335135_ShowMsg( sceneId, selfId, strMsg)
BeginEvent( sceneId )
AddText( sceneId, strMsg )
EndEvent( sceneId )
DispatchMissionTips( sceneId, selfId )
end


Khai báo Vật Phẩm trong CommonItem.txt


30505800 3 5 5 800 Shenqi_1_9 Tân Mãng Th¥n Phù C¤p 1 V§t ph¦m #G[c¤p 1]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 42#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/5#W cho Tàn Khuyªt Th¥n Khí 1 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 1 0 2005 -1 1 0 0
30505801 3 5 5 801 Shenqi_1_10 Tân Mãng Th¥n Phù C¤p 2 V§t ph¦m #G[c¤p 2]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 52#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/10#W cho Tàn Khuyªt Th¥n Khí 2 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 2 0 2005 -1 1 0 0
30505802 3 5 5 802 Shenqi_1_11 Tân Mãng Th¥n Phù C¤p 3 V§t ph¦m #G[c¤p 3]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 62#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/15#W cho Tàn Khuyªt Th¥n Khí 3 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 3 0 2005 -1 1 0 0
30505803 3 5 5 803 Shenqi_1_12 Tân Mãng Th¥n Phù C¤p 4 V§t ph¦m #G[c¤p 4]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 72#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/20#W cho Tàn Khuyªt Th¥n Khí 4 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 4 0 2005 -1 1 0 0
30505804 3 5 5 804 Shenqi_1_13 Tân Mãng Th¥n Phù C¤p 5 V§t ph¦m #G[c¤p 5]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 82#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/20#W cho Tàn Khuyªt Th¥n Khí 5 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 5 0 2005 -1 1 0 0
30505805 3 5 5 805 Shenqi_1_14 Tân Mãng Th¥n Phù C¤p 6 V§t ph¦m #G[c¤p 6]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 92#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/20#W cho Tàn Khuyªt Th¥n Khí 6 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 6 0 2005 -1 1 0 0
30505806 3 5 5 806 Shenqi_1_15 Tân Mãng Th¥n Phù C¤p 7 V§t ph¦m #G[c¤p 7]#W dùng ð¬ sØa chæa nguyên li®u chính cüa Th¥n Khí #G c¤p 102#W, m²i l¥n có th¬ gia tång ðµ hoàn thành #G1/20#W cho Tàn Khuyªt Th¥n Khí 7 #r#c00FF00 (Nh¤n chuµt phäi sØ døng) 1 4 1 5 250 335135 78 0 -1 -1 -1 4 Ng.li®u th¥n khí 7 0 2005 -1 1 0 0