function QEV_CH_EVENT_KISAENG_110302()
EventID = 10185
SetEventOne(EventID, "SN_QEV_CH_EVENT_KISAENG_110302", 1, 1, 1)
SetEventTwo(2, "SN_TALK_QEV_CH_EVENT_KISAENG_090714_B", "SN_TALK_COMMON_EXIT")
NPC_COUNT = 1
LuaInsertNpc(NPC_COUNT, "NPC_CH_EVENT_KISAENG1") --npc which is related with event
InsertPayItemCodeName(13,
"ITEM_MALL_PREMIUM_GLOBAL_GOLDTIME",
"ITEM_MALL_REVERSE_RETURN_SCROLL",
"ITEM_MALL_GLOBAL_CHATTING",
"ITEM_MALL_REPAIR_HAMMER",
"ITEM_MALL_HP_SUPERSET_5_BAG",
"ITEM_MALL_MP_SUPERSET_5_BAG",
"ITEM_MALL_AVATAR_M_NASRUN",
"ITEM_MALL_AVATAR_W_NASRUN",
"ITEM_MALL_NASRUN_ARCHEMY_MAGICSTONE_UMDU",
"ITEM_ETC_NASRUN_ARCHEMY_UPGRADE_STONE",
"ITEM_ETC_E041225_CANDY_BLUE",
"ITEM_ETC_E051123_EVATION_SCROLL",
"ITEM_ETC_E051123_HIT_SCROLL"
) --reward item list
InsertPayItemRatio(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) --will item give as a reward or not??
LuaInsertDropItem(1, "ITEM_ETC_STARTER", 1.5) --drop item for event (1/rate*500= shows monster count for per drop) (here drop rate set as 1.5)
InsertMenuStringList("NPC_CH_EVENT_KISAENG1", 5,
"EVENT_MENUSTRING_GREETING", "SN_NPC_CH_EVENT_KISAENG1_QS",
"EVENT_MENUSTRING_REQUEST_ACCEPT_QUEST", "SN_TALK_QEV_CH_EVENT_KISAENG_090714_A",
"EVENT_MENUSTRING_NOT_ACHIEVED", "SN_TALK_QEV_CH_EVENT_KISAENG_090714_E",
"EVENT_MENUSTRING_INVENTORY_FULL", "SN_TALK_QEV_CH_EVENT_KISAENG_090714_D",
"EVENT_MENUSTRING_ACHIEVED", "SN_TALK_QEV_CH_EVENT_KISAENG_090714_C"
)
CONVERSATION_SINGLE = 0
LuaInsertFunctionStringList(1, "CONVERSATION_SINGLE", "KISAENG_110302_Conversation")
end
function KISAENG_110302_ItemCheck() --function of checking related event item
if 0 < LuaEventInQuireSameItem(0, "ITEM_ETC_STARTER", INQUIRE_SAMEITEM_OP_COUNT_FIRST_ITEM, -1) then
return 0
else
return 1
end
end
function KISAENG_110302_ItemDel() --function of deleting related event item
if 0 < LuaEventInQuireSameItem(0, "ITEM_ETC_STARTER", INQUIRE_SAMEITEM_OP_COUNT_ALL_SAMEITEM, 0) then
slot = LuaEventInQuireSameItem(0, "ITEM_ETC_STARTER", INQUIRE_SAMEITEM_OP_FIND_FIRST_SLOT, 0)
LuaDelItem_EXT(0, slot, 1, SYSOP_REASON_Event, 0)
end
end
function KISAENG_110302_GiveEventRewardItem() --function of giving item of related event
bGiveItemNum = 0
btErrorCode = 0
SYSOP_REASON_Event = 0
EventID = 10185
Gender = 0 --char gender selection (0 means male, 1 means female)
if LuaGetPlayerGender() == 0 then --loop for char gender
Gender = 1
end
RewardItemMax = 13 --total reward item count
RewardItemCount = {0,0,0,0,0,0,0,0,0,0,0,0,0} --total reward item count one by one
RewardItemRatio = {0,9500,19000,38000,76000,152000,304000,608000,1216000,2432000,4864000,9728000} --reward item rate (last 2 item is not included due to gender)
nEmptySlotCount = LuaGetCountEmptyInventory(0,-1) --selection of player empty inventory count
if 1 > nEmptySlotCount then --if player inventory full, then stop!!!
return
else --if player inventory is not full, continue the process
for j=1, nEmptySlotCount do --start loop !!WARNING!! process will continue until players inventory will be full
if KISAENG_110302_ItemCheck() == 0 then --check player has a related event item or not??
nGive = LuaRanged_rand_n(1, 10000) --select a random number which is between 1 and 10000
if 9990 < nGive then --if selected number higher than 9990 than give a player devil considering player gender male or female??
LuaAddItem_EXT(EventID, 0, RewardItemCount, SYSOP_REASON_Event, FALSE, FALSE, 26 + Gender)
else --if selected number equal or lower than 9990
for i = 1, RewardItemMax-2 do --start loop !!WARNING!! selection related reward [except devil spirit]
if nGive > RewardItemRatio and nGive <= RewardItemRatio[i + 1] then
LuaAddItem_EXT(EventID, 0, RewardItemCount, SYSOP_REASON_Event, FALSE, FALSE, i)
KISAENG_110302_ItemDel()
end
end
end
else --if player doesnt have related event item break the process!!
break
end
end
end
end
function KISAENG_110302_Conversation(EventID_Sub, CharName) --funtion of event dialog window
CONVERSATION_START = 0
CONVERSATION_RESPONSE = 2
EventID = 10185
EventID_Message = EventID_Sub
NpcHandlerNum = LuaNpcHandlerNum()
if CONVERSATION_START == EventID_Sub and CharName == "NPC_CH_EVENT_KISAENG1" then
CurPage = 1
LuaSetCurPage(CurPage)
CurString = 5
SelectionList_CommonIndex = 0
Button = 2
LuaShowMenu(CurString, EventID, SelectionList_CommonIndex, Button, NpcHandlerNum)
return
end
if CONVERSATION_RESPONSE == EventID_Sub then
if LuaGetCurPage() == 1 then
MenuOffset = LuaGetEventMenuResponse()
MenuOffset = MenuOffset - TALK_RESPONSE_LIST_BASE
if MenuOffset == 0 then
if KISAENG_110302_ItemCheck() == 0 then
if 0 < LuaGetCountEmptyInventory(0, -1) then
CurPage = 2
SelectionList_CommonIndex = 1
Button = 1
LuaSetCurPage(CurPage)
CurString = 3
LuaShowMenu(CurString, EventID, SelectionList_CommonIndex, Button, NpcHandlerNum)
KISAENG_110302_GiveEventRewardItem()
return
else
CurPage = 2
SelectionList_CommonIndex = 1
Button = 1
LuaSetCurPage(CurPage)
CurString = 2
LuaShowMenu(CurString, EventID, SelectionList_CommonIndex, Button, NpcHandlerNum)
return
end
else
CurPage = 2
SelectionList_CommonIndex = 1
Button = 1
LuaSetCurPage(CurPage)
CurString = 1
LuaShowMenu(CurString, EventID, SelectionList_CommonIndex, Button, NpcHandlerNum)
return
end
elseif MenuOffset == 1 then
LuaTerminateMenu()
return
end
else
LuaTerminateMenu()
return
end
end
end
--[[
=================
@EventList.lua !!WARNING!! dont forget to this section, otherwise event wont work, add the following section to eventlist.lua
=================
--------------------------
function EVENT_LIST()
TYPE_ID = 1
LuaInsertEvent(TYPE_ID, "event.sct", "QEV_CH_EVENT_KISAENG_110302")
end
--------------------------
=================
DATABASE SETTINGS !!WARNING!! change ID section according to your database, otherwise you will get a error!!
=================
--------------------------
_RefEvent
1 ID EVENT_KISAENG_110302 SN_QEV_CH_EVENT_KISAENG_110302 xxx 0
--------------------------
--------------------------
_RefEventReward
1 ID EVENT_KISAENG_110302 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 0 xxx 0 xxx 0 xxx
--------------------------
--------------------------
_RefEventRewardItems
1 2 EVENT_KISAENG_110302 ITEM_ETC_E051123_AGILITY_SCROLL 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E051123_EVATION_SCROLL 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E051123_HIT_SCROLL 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E0101850723_SKILL_EXP_5 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E0101850723_SKILL_EXP_10 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_BALLOON_MANGNYANG 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_BALLOON_MOVOI 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E051123_HP500_SCROLL 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E051123_MP500_SCROLL 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E041225_CANDY_RED 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_ETC_E041225_CANDY_BLUE 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_EVENT_AVATAR_M_NASRUN 1 1 xxx 0 xxx 0 xxx
1 2 EVENT_KISAENG_110302 ITEM_EVENT_AVATAR_W_NASRUN 1 1 xxx 0 xxx 0 xxx
--------------------------
]]