標題: LUA宠物进化 [打印本頁] 作者: sizi 時間: 2012-4-13 09:12 標題: LUA宠物进化
function PETTALK_Default_Owner( petindex, talkerindex, msg, color, channel)
--這裡檢查玩家是否站在NPC面前
if(NLG.CheckInFront(talkerindex, petindex, 1) == false) then
return ;
end
--面向玩家
local i;
i = Char.GetData(talkerindex, %对象_方向%);
if i >= 4 then
i = i - 4;
else
i = i + 4;
end
Char.SetData(petindex, %对象_方向%,i);
NLG.UpChar( petindex);
Char.SetWindowTalkedEvent(nil,"PETTALK_Default_OwnerWindow",petindex);
NLG.ShowWindowTalked(talkerindex, 2, 0, 0,
"4\n"..
"\n"..
"\n 【对 话 选 单】"..
"\n"..
"\n 【 聊 天 】"..
"\n 【 进 化 】"..
"\n 【 踹 一 脚 】"..
"\n 【 离 开 】",
petindex);
return ;
end
function PETTALK_Default_Stranger( petindex, talkerindex, msg, color, channel)
--這裡檢查玩家是否站在NPC面前
if(NLG.CheckInFront(talkerindex, petindex, 1) == false) then
return ;
end
--面向玩家
local i;
i = Char.GetData(talkerindex, %对象_方向%);
if i >= 4 then
i = i - 4;
else
i = i + 4;
end
Char.SetData(petindex, %对象_方向%,i);
NLG.UpChar( petindex);
NLG.TalkToCli(talkerindex, "与陌生人说话", _Color, 0);
end
function PETTALK_Default_Gossip( petindex,charaindex)
local talktext = { "吼吼吼~~~~","很无奈的样子","一副很生气的样子"};
local tbl_evolevel = {140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140};
local tblttl = 10;
local num = 0;
local evoid = 0;
num = PETTALK_Evolution_tblCheck_evopet(petindex,tbl_evopet,tbl_evolevel,tblttl);
if num > 0 then
if PETTALK_Evolution_tblCheck_evoitem(charaindex,tbl_evoitem,num) < 0 then
NLG.ShowWindowTalked(charaindex, 2, 0, 1,
"6\n"..
"\n"..
"\n 【 进 化 】"..
"\n"..
"\n 缺少进化所需材料"..
"\n"..
"\n 【 离 开 】",
petindex);
return -1;
end
evoid = PETTALK_Evolution_tblCheck_evotarget(tbl_evotarget[num]);
local oldname = Char.GetData(petindex,%对象_原名%);
Char.PetEvolution(petindex,charaindex,evoid,evoimg);
local newname = Char.GetData(petindex,%对象_原名%);
NLG.TalkToCli(-1,"恭喜"..Char.GetData(charaindex,%对象_原名%).."的"..oldname.."进化成"..newname.."!",%红色%)
return 0;
end
function PETTALK_Evolution_tblCheck_evotarget(tbl)
return tbl[math.floor(math.random(2,tbl[1]+1))];
end
function PETTALK_Evolution_tblCheck_evopet(petindex,tbl,tbl2,max)
local petid = Char.GetData(petindex,%对象_P最高%);
local petlevel = Char.GetData(petindex,%对象_等级%);
while(max>0)do
if petid == tbl[max] then
if petlevel < tbl2[max] then
return -1;
end
return max;
end
max = max - 1;
end
return -1
end
function PETTALK_Evolution_tblCheck_evoitem(charaindex,tbl,num)
if (tbl[num][1] < 0) or (tbl[num][2] < 0 )then
return 0;
end
if Plus_CheckItem(charaindex,tbl[num][1]) < tbl[num][2] then
return -1
end
if NLG.DelItem( charaindex, tbl[num][1], tbl[num][2]) == true then
return 0;
end
return -1;
end
function Plus_CheckItem( _PlayerIndex, _ItemID)
local Item_Amount = 0;
local i = 9;
while(i <= 23)do
if( Char.GetItemId( _PlayerIndex, i) == _ItemID )then
--if( Item.GetData( Char.GetItemIndex( _PlayerIndex, i), %笵ㄣ_帮舼%) > 1) then
Item_Amount = Item_Amount + Item.GetData( Char.GetItemIndex( _PlayerIndex, i), %道具_堆叠%);
--else
--Item_Amount = Item_Amount + 1;
--end
end
i = i + 1;
end
return Item_Amount;
end
function Plus_Checkrepet( _PlayerIndex)
local repet = 0;
if Char.GetPetIndex( _PlayerIndex,%宠栏_1%) <= 0 then
repet = repet + 1;
end
if Char.GetPetIndex( _PlayerIndex,%宠栏_2%) <= 0 then
repet = repet + 1;
end
if Char.GetPetIndex( _PlayerIndex,%宠栏_3%) <= 0 then
repet = repet + 1;
end
if Char.GetPetIndex( _PlayerIndex,%宠栏_4%) <= 0 then
repet = repet + 1;
end
if Char.GetPetIndex( _PlayerIndex,%宠栏_5%) <= 0 then
repet = repet + 1;
end
return repet;
end
function Plus_Checkreitem( _PlayerIndex)
local reitem = 0;
local i = 9;
while(i <= 23)do
if( Char.GetItemIndex( _PlayerIndex, i) < 0 )then
reitem = reitem + 1;
end
i=i+1;
end
return reitem;
end 作者: 屁力狼 時間: 2012-4-13 10:21
看到原本就是繁體的東西被轉成簡體,然後現在又被丟回來要自己轉繁來用真的覺得蠻好笑
[ 本帖最後由 屁力狼 於 2012-4-13 10:34 編輯 ]
歡迎光臨 We Love SA 石器時代研討中心 (http://lab.welovesa.com/)