1033 lines
33 KiB
Lua
1033 lines
33 KiB
Lua
--This File Was Created By Hatrick_xD
|
|
--Do Not Remove The CopyRights From this File
|
|
--By Hatrick 2019 03 22 (For Rappelz 9.5.2 Private Server)
|
|
|
|
function get_module_name()
|
|
return "ETC_Siege_Script"
|
|
end
|
|
|
|
|
|
|
|
function siege_time()
|
|
|
|
|
|
|
|
local siege_Time = {5 ,6 ,1 ,8 ,9 , 10 } -- siege time (Min 1, Max 12) 12 Hours system
|
|
local siege_type = {2 ,2 ,2 ,2 ,2 ,2 } -- siege type 1 == > AM // 2 ==> PM
|
|
|
|
|
|
|
|
|
|
local siege = {siege_type,siege_Time} -- siege time array
|
|
|
|
return siege
|
|
end
|
|
|
|
|
|
-- siege time definer
|
|
function guild_siege_monster_dead(id,x,y,layer)
|
|
|
|
local percentage = math.random(1,10)
|
|
|
|
if percentage < 4 + id then
|
|
drop_item(x,y,layer,2013527,1)
|
|
end
|
|
|
|
local is_siege = get_global_variable("is_siege")
|
|
local monster_count = get_env("game.guild_monster_count")
|
|
if monster_count == nil or monster_count == "" then monster_count = 0 end
|
|
if is_siege == nil or is_siege == "" then is_siege = 0 end
|
|
if is_siege == 1 then
|
|
-- if siege is do
|
|
if id == 3 then
|
|
monster_count = monster_count + 10
|
|
else
|
|
monster_count = monster_count + 1
|
|
end
|
|
|
|
set_env("game.guild_monster_count",monster_count)
|
|
guild_siege_monster_dead_check(monster_count)
|
|
end
|
|
if id == 2 then
|
|
add_npc(126631,111910,22300197,2)
|
|
end
|
|
|
|
end
|
|
-- check monster death count
|
|
function guild_siege_monster_dead_check(count)
|
|
local stage = get_env("game.guild_siege_stage")
|
|
local ENV_MSG = get_env("SP_MESSAGE_GP")
|
|
if ENV_MSG == nil or ENV_MSG == "" or ENV_MSG == "<NULL>" then ENV_MSG = 0 end
|
|
if stage == nil or stage == "" then stage = 0 end
|
|
if stage == 1 then
|
|
if count >= 40 then
|
|
-- do something
|
|
siege_open_gate(2)
|
|
siege_whisper(get_siege_gates_message(2,2))
|
|
end
|
|
elseif stage == 2 then
|
|
|
|
if count >= 65 then
|
|
-- do something
|
|
siege_open_gate(3)
|
|
siege_whisper(get_siege_gates_message(3,2))
|
|
end
|
|
|
|
elseif stage == 3 then
|
|
|
|
if count >= 112 and count < 137 then
|
|
-- do something
|
|
|
|
if ENV_MSG < 30 then
|
|
add_siege_monster(2)
|
|
set_env("SP_MESSAGE_GP",31)
|
|
siege_whisper(get_siege_gates_message(4,1))
|
|
end
|
|
|
|
elseif count >= 137 then
|
|
siege_open_gate(4)
|
|
siege_whisper(get_siege_gates_message(4,2))
|
|
|
|
end
|
|
|
|
elseif stage == 4 then
|
|
|
|
if count >= 221 and count < 246 then
|
|
-- do something
|
|
|
|
if ENV_MSG < 40 then
|
|
add_siege_monster(2)
|
|
set_env("SP_MESSAGE_GP",41)
|
|
siege_whisper(get_siege_gates_message(5,1))
|
|
end
|
|
|
|
elseif count >= 246 then
|
|
siege_open_gate(5)
|
|
siege_whisper(get_siege_gates_message(5,2))
|
|
end
|
|
|
|
elseif stage == 5 then
|
|
|
|
if count >= 402 then
|
|
-- do something 48
|
|
siege_whisper("@90610889")
|
|
siege_quest_check()
|
|
local tmp_portal = add_field_prop(90002, 240, 126631,111910, 0, 0, 0, 0, 0, 1, 1, 1)
|
|
set_env("_SEIGE_TMP",tmp_portal)
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
|
|
function siege_warp_checker()
|
|
-- check if is siege day
|
|
local hh = hours_convert(tonumber(get_os_date("%H")))
|
|
local siege_time = siege_time()
|
|
local guild_id = gv("guild_id")
|
|
local stored_guild_id,result
|
|
local ID = 0
|
|
local is_siege = get_global_variable("is_siege")
|
|
if is_siege == nil or is_siege == "" then
|
|
is_siege = 0
|
|
end
|
|
for i=1,#siege_time[2] do
|
|
-- get stored guild id
|
|
if siege_time[2][i] == hh[2] and siege_time[1][i] == hh[1] and is_siege == 1 then
|
|
ID = i
|
|
break
|
|
end
|
|
|
|
end
|
|
|
|
stored_guild_id = get_global_variable("siege_guild_id_"..ID)
|
|
if stored_guild_id == nil or stored_guild_id == "" then stored_guild_id = 0 end
|
|
-- check guild
|
|
if guild_id > 0 and stored_guild_id > 0 then
|
|
if guild_id == stored_guild_id then
|
|
result = true
|
|
else
|
|
result = false
|
|
end
|
|
else
|
|
result = false
|
|
end
|
|
|
|
return result
|
|
end
|
|
|
|
function siege_quest_check ()
|
|
local start_time = get_env("game.siege_time_record") -- siege start time
|
|
if start_time == nil or start_time == "" or start_time == "<NULL>" then start_time = 0 end
|
|
|
|
local curr_time = tonumber(get_os_time()) - tonumber(start_time) -- now time
|
|
|
|
local SP_LIST = get_SP_LIST()
|
|
local quest_progress_4060,quest_progress_4061,quest_progress_4062,quest_progress_4063,quest_progress_4064,quest_progress_4065,quest_progress_4066
|
|
if start_time ~= 0 then -- check if time exists
|
|
|
|
-- for each player registered in the record
|
|
for i=1,#SP_LIST do
|
|
|
|
quest_progress_4060 = get_quest_progress(4060,SP_LIST[i]) -- الحصار
|
|
quest_progress_4061 = get_quest_progress(4061,SP_LIST[i]) -- حصار القلعة (أسبوعياً)
|
|
quest_progress_4062 = get_quest_progress(4062,SP_LIST[i]) -- الحصار 1
|
|
quest_progress_4063 = get_quest_progress(4063,SP_LIST[i]) -- الحصار 2
|
|
quest_progress_4064 = get_quest_progress(4064,SP_LIST[i]) -- الحصار 3
|
|
quest_progress_4065 = get_quest_progress(4065,SP_LIST[i]) -- الحصار 4
|
|
quest_progress_4066 = get_quest_progress(4066,SP_LIST[i]) -- الحصار 5
|
|
|
|
if quest_progress_4060 == 1 then -- if quest is already started then complete it
|
|
set_quest_status(4060,1,1,SP_LIST[i])
|
|
end
|
|
|
|
if quest_progress_4061 == 1 then -- if quest is already started then complete it
|
|
set_quest_status(4061,1,1,SP_LIST[i])
|
|
|
|
elseif quest_progress_4061 == 255 then
|
|
if get_quest_status(4061,1,SP_LIST[i]) == 0 then
|
|
set_quest_status(4061,1,1,SP_LIST[i])
|
|
end
|
|
|
|
end
|
|
if quest_progress_4062 == 1 and curr_time <= 3300 then -- if quest is already started then complete it
|
|
set_quest_status(4062,1,1,SP_LIST[i])
|
|
end
|
|
if quest_progress_4063 == 1 and curr_time <= 3000 then -- if quest is already started then complete it
|
|
set_quest_status(4063,1,1,SP_LIST[i])
|
|
end
|
|
if quest_progress_4064 == 1 and curr_time <= 2700 then -- if quest is already started then complete it
|
|
set_quest_status(4064,1,1,SP_LIST[i])
|
|
end
|
|
if quest_progress_4065 == 1 and curr_time <= 2400 then -- if quest is already started then complete it
|
|
set_quest_status(4065,1,1,SP_LIST[i])
|
|
end
|
|
if quest_progress_4066 == 1 and curr_time <= 2100 then -- if quest is already started then complete it
|
|
set_quest_status(4066,1,1,SP_LIST[i])
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
---- function end
|
|
end
|
|
|
|
function siege_whisper(message)
|
|
local SP_LIST = get_SP_LIST()
|
|
for i=1,#SP_LIST do
|
|
whisper(SP_LIST[i],message)
|
|
-- message(SP_LIST[i])
|
|
end
|
|
|
|
end
|
|
|
|
function do_register_siege_player(name)
|
|
local playerList = get_SP_LIST()
|
|
if find_in_array(playerList,name) == false then
|
|
set_SP_LIST(playerList,name)
|
|
-- /run for i=1, #SP_LIST do message(SP_LIST[i]) message(i) end
|
|
end
|
|
|
|
end
|
|
|
|
function del_SP_OPEN()
|
|
|
|
for i = 1, 5 do
|
|
del_global_variable("SP_OPEN_"..i)
|
|
end
|
|
|
|
end
|
|
|
|
function is_SP_OPEN(id)
|
|
local result
|
|
local sp = get_global_variable("SP_OPEN_"..id)
|
|
if sp == nil or sp == "" then
|
|
set_global_variable("SP_OPEN_"..id,1)
|
|
result = true
|
|
else
|
|
result = false
|
|
end
|
|
return result
|
|
end
|
|
|
|
function del_SP_LIST()
|
|
|
|
for i=1,36 do
|
|
del_global_variable("SP_LIST_"..i)
|
|
end
|
|
|
|
end
|
|
|
|
function set_SP_LIST(list,name)
|
|
|
|
set_global_variable("SP_LIST_"..tonumber(#list + 1),name)
|
|
|
|
end
|
|
|
|
function get_SP_LIST()
|
|
local SP
|
|
local LIST = {}
|
|
for i=1,36 do
|
|
SP = get_global_variable("SP_LIST_"..i)
|
|
if SP == nil or SP == "" then
|
|
break
|
|
else
|
|
LIST[i] = SP
|
|
end
|
|
|
|
end
|
|
return LIST
|
|
|
|
end
|
|
|
|
|
|
function find_in_array(array,name)
|
|
|
|
for i=1,#array do
|
|
if array[i] == name then
|
|
return true
|
|
end
|
|
|
|
end
|
|
return false
|
|
|
|
end
|
|
|
|
function siege_warp(type)
|
|
|
|
local name = gv('name')
|
|
if is_siege_day() and siege_warp_checker() then
|
|
do_register_siege_player(name)
|
|
-- check and send whisper to all players
|
|
if is_SP_OPEN(type) then
|
|
siege_whisper(get_siege_gates_message(type,3))
|
|
|
|
end
|
|
|
|
-- check if is in the guild
|
|
if type == 1 then
|
|
|
|
warp(126746,108969,0)
|
|
|
|
elseif type == 2 then
|
|
|
|
warp(127670,108562,0)
|
|
|
|
elseif type == 3 then
|
|
|
|
warp(128286,109734)
|
|
|
|
elseif type == 4 then
|
|
|
|
warp(127277,109916,0)
|
|
|
|
elseif type == 5 then
|
|
|
|
warp(127455,110915,0)
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
-- add siege prop
|
|
function add_siege_prop()
|
|
set_global_variable("is_siege",0)
|
|
del_SP_LIST()
|
|
del_SP_OPEN()
|
|
add_npc_to_world (128781, 108794, 15106)
|
|
add_npc_to_world (128801, 108842, 15104)
|
|
add_npc_to_world (128853, 108835, 15103)
|
|
add_npc_to_world (128867, 108801, 15103)
|
|
add_npc_to_world (128877, 108756, 15103)
|
|
add_npc_to_world (128963, 108780, 15103)
|
|
add_npc_to_world (128958, 108821, 15103)
|
|
add_npc_to_world (128940, 108855, 15103)
|
|
add_npc_to_world (128838, 108700, 15107)
|
|
add_npc_to_world (128831, 108667, 15107)
|
|
add_npc_to_world (128780, 108667, 15105)
|
|
add_npc_to_world (129573, 108786, 15108)
|
|
add_npc_to_world (129621, 108814, 15110)
|
|
add_npc_to_world (129727, 109169, 15108)
|
|
add_npc_to_world (129726, 109236, 15108)
|
|
add_npc_to_world (137795, 105375, 15104)
|
|
add_field_prop( 1004, 0, 137764, 105365, 0, 0, 0, 0, 0.1, 1, 1, 1)
|
|
|
|
siege_open_closed_gates()
|
|
end
|
|
|
|
-- open all closed gates
|
|
function siege_open_closed_gates()
|
|
local _SIEGE = {}
|
|
_SIEGE[1] = add_field_prop(2101, 0, 126722,108976, 0)
|
|
_SIEGE[2] = add_field_prop(2102, 0, 127656,108571, 0)
|
|
_SIEGE[3] = add_field_prop(2103, 0, 128298,109697, 0)
|
|
_SIEGE[4] = add_field_prop(2104, 0, 127342,109934, 0)
|
|
_SIEGE[5] = add_field_prop(2105, 0, 127460,110856, 0)
|
|
for i = 1 ,#_SIEGE do
|
|
set_env("_SIEGE"..i,_SIEGE[i])
|
|
end
|
|
end
|
|
-- close all gates
|
|
function siege_close_gates()
|
|
local closer
|
|
for i=1 ,5 do
|
|
closer = get_env("_SIEGE"..i)
|
|
remove_npc(15110 + i)
|
|
remove_field_prop(closer)
|
|
end
|
|
siege_open_closed_gates()
|
|
end
|
|
-- open specified gate
|
|
function siege_open_gate(id)
|
|
add_siege_monster(id)
|
|
local gate = get_env("_SIEGE"..id)
|
|
remove_field_prop(gate)
|
|
local _SIEGE
|
|
if id == 1 then
|
|
set_env("game.guild_siege_stage",id)
|
|
_SIEGE = add_field_prop(2201, 0, 126722,108976, 0)
|
|
add_npc_to_world (126722, 108946, 15111)
|
|
add_npc_to_world (126720, 109000, 15111)
|
|
elseif id == 2 then
|
|
set_env("game.guild_siege_stage",id)
|
|
_SIEGE = add_field_prop(2202, 0, 127656,108571, 0)
|
|
add_npc_to_world (127627, 108562, 15112)
|
|
add_npc_to_world (127670, 108598, 15112)
|
|
elseif id == 3 then
|
|
set_env("game.guild_siege_stage",id)
|
|
_SIEGE = add_field_prop(2203, 0, 128298,109697, 0)
|
|
add_npc_to_world (128278, 109686, 15113)
|
|
add_npc_to_world (128315, 109697, 15113)
|
|
elseif id == 4 then
|
|
set_env("game.guild_siege_stage",id)
|
|
_SIEGE = add_field_prop(2204, 0, 127342,109934, 0)
|
|
add_npc_to_world (127352, 109917, 15114)
|
|
add_npc_to_world (127342, 109952, 15114)
|
|
elseif id == 5 then
|
|
set_env("game.guild_siege_stage",id)
|
|
_SIEGE = add_field_prop(2205, 0, 127460,110856, 0)
|
|
add_npc_to_world (127435, 110854, 15115)
|
|
add_npc_to_world (127476, 110845, 15115)
|
|
end
|
|
set_env("_SIEGE"..id,_SIEGE)
|
|
end
|
|
|
|
|
|
|
|
|
|
-- check if is siege day
|
|
function is_siege_day()
|
|
-- 1st check if the day correspond of the siege day
|
|
local siege_day = get_env("game.guild_siege_day") -- get the siege day from gs
|
|
local ref_time = 1555801200 -- get_os_second('2019-04-21 00:00:00') -- main reference date is sunday
|
|
local now_time = get_os_time() -- get now time
|
|
local now_day = get_day(get_os_difftime(now_time,ref_time)) -- get correspond day
|
|
-- check if correspond of the current day
|
|
if tonumber(siege_day) == tonumber(now_day) then -- if day is correspond day
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function siege_notice_message()
|
|
local notice =
|
|
{
|
|
"@Test@Siege Start in 55 minute",
|
|
"@Test@Siege Start in 50 minute",
|
|
"@Test@Siege Start in 45 minute",
|
|
"@Test@Siege Start in 40 minute",
|
|
"@Test@Siege Start in 35 minute",
|
|
"@Test@Siege Start in 30 minute",
|
|
"@Test@Siege Start in 25 minute",
|
|
"@Test@Siege Start in 20 minute",
|
|
"@Test@Siege Start in 15 minute",
|
|
"@Test@Siege Start in 10 minute",
|
|
"@Test@Siege Start in 5 minute",
|
|
}
|
|
local timer =
|
|
{
|
|
5,
|
|
10,
|
|
15,
|
|
20,
|
|
25,
|
|
30,
|
|
35,
|
|
40,
|
|
45,
|
|
50,
|
|
55,
|
|
}
|
|
local result = {timer,notice}
|
|
return result
|
|
end
|
|
|
|
function siege_close_time(currTime,Type)
|
|
if Type == 1 then
|
|
-- am
|
|
elseif Type == 2 then
|
|
-- pm
|
|
currTime = currTime + 12
|
|
end
|
|
local newTime = currTime - 1
|
|
if newTime == 0 then newTime = 24 end
|
|
return hours_convert(newTime)
|
|
end
|
|
-- siege opened door message
|
|
function get_siege_gates_message(gate_id,type_id)
|
|
local Gate = {
|
|
"@90610880",
|
|
"@90610881",
|
|
"@90610882",
|
|
"@90610883",
|
|
"@90610884",
|
|
}
|
|
local Type = {
|
|
"@90610886",
|
|
"@90610887",
|
|
"@90610888",
|
|
}
|
|
|
|
local text = sconv(Type[type_id],"#@gate@#",Gate[gate_id])
|
|
return text
|
|
end
|
|
|
|
-- on 1 minute pass by inside of the siege map
|
|
function on_siege_end(id)
|
|
local name = gv('name')
|
|
if is_siege_day() and siege_warp_checker() then
|
|
do_register_siege_player(name)
|
|
if id == 59 then
|
|
local siege_time = siege_time()
|
|
local hh = hours_convert(tonumber(get_os_date("%H")))
|
|
local guild_id
|
|
for i=1 ,#siege_time[2] do
|
|
guild_id = get_global_variable("siege_guild_id_"..i)
|
|
if guild_id == nil or guild_id == "" then guild_id = 0 end
|
|
if guild_id > 0 then
|
|
-- do something or something else
|
|
if siege_time[2][i] == hh[2] and siege_time[1][i] == hh[1] then
|
|
do_siege_end(i)
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
|
|
else
|
|
private_notice(sconv("@90610893","#@min@#",59 - id ))
|
|
end
|
|
|
|
else
|
|
warp_to_stored_position()
|
|
--notice('not suppose to be here')
|
|
end
|
|
|
|
end
|
|
-- when siege end
|
|
function do_siege_end(id)
|
|
local is_siege = get_global_variable("is_siege")
|
|
if is_siege == nil or is_siege == "" then is_siege = 0 end
|
|
if is_siege == 1 then
|
|
local endTime = get_os_time()
|
|
local startTime = get_env("game.siege_time_record")
|
|
local record = tonumber(endTime - startTime)
|
|
local tt = secondto(record)
|
|
local guild_id = get_global_variable("siege_guild_id_"..id)
|
|
set_global_variable("siege_guild_rec_"..id,record)
|
|
set_global_variable("siege_guild_rec_id_"..id,guild_id)
|
|
set_global_variable("is_siege",0)
|
|
local guild_name = get_guild_name(guild_id)
|
|
local currPos = get_current_position_siege(record)
|
|
if currPos ~= 0 then
|
|
notice(sconv("@90610891","#@guild@#",guild_name,"#@elapsed@#",tt[2]..":"..tt[1],"#@no@#",currPos))
|
|
else
|
|
notice(sconv("@90610890","#@guild@#",guild_name,"#@elapsed@#",tt[2]..":"..tt[1]))
|
|
end
|
|
|
|
siege_close_gates()
|
|
del_global_variable("siege_guild_id_"..id)
|
|
del_global_variable("siege_guild_point_"..id)
|
|
del_SP_LIST()
|
|
end
|
|
end
|
|
|
|
function get_current_position_siege(record)
|
|
local siege_time = siege_time()
|
|
local all_rec = {}
|
|
local currPos = 0
|
|
local tmp
|
|
for i=1,#siege_time[1] do
|
|
tmp = get_global_variable("siege_guild_rec_"..i)
|
|
|
|
if tmp == nil or tmp == "" then tmp = 0 end
|
|
--cprint(tmp)
|
|
all_rec[i] = tmp
|
|
end
|
|
|
|
table.sort(all_rec,function (a,b) return a > b end)
|
|
|
|
for i=1,#all_rec do
|
|
if all_rec[i] == record then
|
|
currPos = i
|
|
-- cprint(currPos)
|
|
end
|
|
end
|
|
return currPos
|
|
end
|
|
|
|
-- convert seconds to minutes ....
|
|
function secondto(data)
|
|
local minute = math.floor(data / 60)
|
|
local second = data - (minute * 60)
|
|
local result = {second,minute}
|
|
return result
|
|
end
|
|
|
|
function do_reset_siege_board()
|
|
local siege_id = get_global_variable("siege_cDay")
|
|
if siege_id == nil or siege_id == "" then siege_id = 0 end
|
|
local tt = 1555801200 -- get_os_second('2019-04-21 00:00:00') -- main reference date is sunday
|
|
local now = get_os_time()
|
|
local siege_curr_id = siege_day_count(tonumber(now - tt))
|
|
local list = siege_time()
|
|
if siege_id ~= siege_curr_id then
|
|
set_global_variable("siege_cDay",siege_curr_id)
|
|
-- siege_guild_rec_ // siege_guild_rec_id_
|
|
for i=1,#list[1] do
|
|
del_global_variable("siege_guild_rec_"..i)
|
|
del_global_variable("siege_guild_rec_id_"..i)
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
function siege_day_count(diff)
|
|
-- clear all the empty added weeks
|
|
local currDay = 1
|
|
local day = 86400
|
|
while diff >= day do
|
|
diff = diff - day
|
|
currDay = currDay + 1
|
|
end
|
|
return currDay
|
|
end
|
|
|
|
-- check time and siege trigger
|
|
function siege_trigger()
|
|
if is_siege_day() then
|
|
|
|
do_reset_siege_board()
|
|
|
|
--temp debug
|
|
-- notice("is siege day")
|
|
-- get hours and minutes
|
|
local hh = hours_convert(tonumber(get_os_date("%H")))
|
|
local mm = tonumber(get_os_date("%M"))
|
|
local siege_time = siege_time()
|
|
local is_siege = get_global_variable("is_siege")
|
|
if is_siege == nil or is_siege == "" then
|
|
is_siege = 0
|
|
end
|
|
local guild_name,guild_id,soon_time,env_time
|
|
local siege_notice = siege_notice_message()
|
|
|
|
--check time within the table
|
|
for i=1,#siege_time[2] do
|
|
guild_id = get_global_variable("siege_guild_id_"..i)
|
|
if guild_id == nil or guild_id == "" then guild_id = 0 end
|
|
soon_time = siege_close_time(siege_time[2][i],siege_time[1][i])
|
|
env_time = get_env("game.env_siege_time")
|
|
if env_time == nil or env_time == "" then env_time = 0 end
|
|
-- 3 possibilities 1 - time is match 2- time is soon 3 - no match
|
|
-- time is match
|
|
if guild_id > 0 then -- if there is a guild
|
|
|
|
-- when time comes and match
|
|
if siege_time[2][i] == hh[2] and siege_time[1][i] == hh[1] and is_siege == 0 and mm < 20 then
|
|
del_SP_LIST()
|
|
del_SP_OPEN()
|
|
guild_name = get_guild_name(guild_id)
|
|
set_env("game.guild_monster_count",0)
|
|
set_global_variable("is_siege",1)
|
|
siege_open_gate(1)
|
|
set_env("game.siege_time_record",get_os_time())
|
|
notice(sconv("@90610885","#@guild@#",guild_name))
|
|
local tmp_pr = get_env("_SEIGE_TMP")
|
|
if tmp_pr == nil or tmp_pr == "" or tmp_pr == "<NULL>" then
|
|
|
|
else
|
|
remove_field_prop(tmp_pr)
|
|
del_env("_SEIGE_TMP")
|
|
end
|
|
|
|
end
|
|
if siege_time[2][i] == hh[2] and siege_time[1][i] == hh[1] and is_siege == 1 and mm == 59 then
|
|
|
|
do_siege_end(i)
|
|
|
|
end
|
|
-- if is soon
|
|
if match_array(hh,soon_time) then
|
|
--temp debug
|
|
-- notice('its siege time soon ')
|
|
for tm = 1,#siege_notice[1] do
|
|
if siege_notice[1][tm] == mm and env_time ~= siege_notice[1][tm] then
|
|
set_env("game.env_siege_time",siege_notice[1][tm])
|
|
notice(siege_notice[2][tm])
|
|
end
|
|
end
|
|
end
|
|
|
|
--else
|
|
-- temp debug
|
|
-- notice("guild does not exists ")
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
-- temp falg
|
|
-- notice('not to day')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
-- convert hours to pm am system
|
|
function hours_convert(hh)
|
|
local type
|
|
if hh > 12 then
|
|
type = 2
|
|
hh = hh - 12
|
|
else
|
|
type = 1
|
|
end
|
|
return {type,hh}
|
|
end
|
|
|
|
-- get the day reference date is sunday
|
|
function get_day(diff)
|
|
-- clear all the empty added weeks
|
|
local currDay = 1
|
|
local week = 604800
|
|
local day = 86400
|
|
while diff >= week do
|
|
diff = diff - week
|
|
end
|
|
while diff >= day do
|
|
diff = diff - day
|
|
currDay = currDay + 1
|
|
end
|
|
return currDay
|
|
end
|
|
|
|
-- get difference between two times
|
|
function get_os_difftime(now,reference)
|
|
local diff = tonumber(now) - tonumber(reference)
|
|
|
|
return diff
|
|
end
|
|
|
|
function add_siege_monster(id)
|
|
if id == 1 then
|
|
-- 1st room MAX(40)
|
|
--1
|
|
add_npc(126885,108925,22300187, 1) --1
|
|
add_npc(126927,108918,22300187, 1) --2
|
|
add_npc(126949,108978,22300187, 1) --3
|
|
add_npc(126905,108982,22300187, 1) --4
|
|
add_npc(126930,108948,22300190, 1) --5
|
|
--2 --
|
|
add_npc(126964,108912,22300187, 1) --1
|
|
add_npc(126985,108974,22300187, 1) --2
|
|
add_npc(127038,108961,22300187, 1) --3
|
|
add_npc(127030,108905,22300187, 1) --4
|
|
add_npc(127056,108926,22300190, 1) --5
|
|
--3 --
|
|
add_npc(127066,108895,22300187, 1) --1
|
|
add_npc(127096,108948,22300187, 1) --2
|
|
add_npc(127142,108933,22300187, 1) --3
|
|
add_npc(127128,108875,22300187, 1) --4
|
|
add_npc(127169,108890,22300190, 1) --5
|
|
--4 --
|
|
add_npc(127178,108857,22300187, 1) --1
|
|
add_npc(127206,108906,22300187, 1) --2
|
|
add_npc(127250,108888,22300187, 1) --3
|
|
add_npc(127224,108837,22300187, 1) --4
|
|
add_npc(127274,108845,22300190, 1) --5
|
|
--5 --
|
|
add_npc(127274,108811,22300187, 1) --1
|
|
add_npc(127311,108859,22300187, 1) --2
|
|
add_npc(127353,108838,22300187, 1) --3
|
|
add_npc(127327,108783,22300187, 1) --4
|
|
add_npc(127382,108789,22300190, 1) --5
|
|
--6 --
|
|
add_npc(127372,108760,22300187, 1) --1
|
|
add_npc(127418,108803,22300187, 1) --2
|
|
add_npc(127467,108766,22300187, 1) --3
|
|
add_npc(127428,108716,22300187, 1) --4
|
|
add_npc(127474,108718,22300190, 1) --5
|
|
--7 --
|
|
add_npc(127464,108688,22300187, 1) --1
|
|
add_npc(127514,108731,22300187, 1) --2
|
|
add_npc(127558,108696,22300187, 1) --3
|
|
add_npc(127517,108648,22300187, 1) --4
|
|
add_npc(127555,108657,22300190, 1) --5
|
|
--8 --
|
|
add_npc(127548,108625,22300187, 1) --1
|
|
add_npc(127598,108664,22300187, 1) --2
|
|
add_npc(127617,108650,22300187, 1) --3
|
|
add_npc(127575,108605,22300187, 1) --4
|
|
add_npc(127619,108606,22300190, 1) --5
|
|
|
|
elseif id == 2 then
|
|
--2nd room MAX (25)
|
|
--middle field mage / archer // crystall falling
|
|
add_npc(127704,108256,22300176, 1) --1
|
|
--all class
|
|
-- count par class 6
|
|
--1
|
|
add_npc(127340,108190,22300177, 1) --2
|
|
add_npc(127390,108190,22300177, 1) --3
|
|
add_npc(127440,108190,22300177, 1) --4
|
|
add_npc(127490,108190,22300177, 1) --5
|
|
add_npc(127540,108190,22300177, 1) --6
|
|
add_npc(127590,108190,22300177, 1) --7
|
|
--2
|
|
add_npc(127340,108240,22300177, 1) --8
|
|
add_npc(127390,108240,22300177, 1) --9
|
|
add_npc(127440,108240,22300177, 1) --10
|
|
add_npc(127490,108240,22300177, 1) --11
|
|
add_npc(127540,108240,22300177, 1) --12
|
|
add_npc(127590,108240,22300177, 1) --13
|
|
--3
|
|
add_npc(127340,108290,22300177, 1) --14
|
|
add_npc(127390,108290,22300177, 1) --15
|
|
add_npc(127440,108290,22300177, 1) --16
|
|
add_npc(127490,108290,22300177, 1) --17
|
|
add_npc(127540,108290,22300177, 1) --18
|
|
add_npc(127590,108290,22300177, 1) --19
|
|
--4
|
|
add_npc(127340,108340,22300177, 1) --20
|
|
add_npc(127390,108340,22300177, 1) --21
|
|
add_npc(127440,108340,22300177, 1) --22
|
|
add_npc(127490,108340,22300177, 1) --23
|
|
add_npc(127540,108340,22300177, 1) --24
|
|
add_npc(127590,108340,22300177, 1) --25
|
|
|
|
elseif id == 3 then
|
|
-- 3rd room MAX(47)
|
|
-- tent
|
|
add_npc(128110,110420,22300185,1) --1
|
|
add_npc(127675,110035,22300185,1) --2
|
|
--1st chair --
|
|
add_npc(128285,110355,22300187,1) --3
|
|
add_npc(128270,110355,22300187,1) --4
|
|
add_npc(128255,110355,22300187,1) --5
|
|
add_npc(128278,110413,22300187,1) --6
|
|
add_npc(128264,110412,22300187,1) --7
|
|
add_npc(128252,110411,22300187,1) --8
|
|
add_npc(128275,110470,22300187,1) --9
|
|
add_npc(128260,110470,22300187,1) --10
|
|
add_npc(128245,110470,22300187,1) --11
|
|
--2nd chair --
|
|
add_npc(127945,110434,22300187,1) --12
|
|
add_npc(127960,110429,22300187,1) --13
|
|
add_npc(127970,110424,22300187,1) --14
|
|
add_npc(127990,110540,22300187,1) --15
|
|
add_npc(128005,110535,22300187,1) --16
|
|
add_npc(128015,110530,22300187,1) --17
|
|
add_npc(127970,110485,22300187,1) --18
|
|
add_npc(127980,110480,22300187,1) --19
|
|
add_npc(127990,110475,22300187,1) --20
|
|
--3rd chair --
|
|
add_npc(128237,110641,22300187,1) --21
|
|
add_npc(128232,110628,22300187,1) --22
|
|
add_npc(128230,110616,22300187,1) --23
|
|
add_npc(128178,110654,22300187,1) --24
|
|
add_npc(128175,110641,22300187,1) --25
|
|
add_npc(128174,110627,22300187,1) --26
|
|
add_npc(128122,110665,22300187,1) --27
|
|
add_npc(128120,110650,22300187,1) --28
|
|
add_npc(128118,110635,22300187,1) --29
|
|
--4th chair --
|
|
add_npc(127653,110185,22300187,1) --30
|
|
add_npc(127659,110170,22300187,1) --31
|
|
add_npc(127665,110160,22300187,1) --32
|
|
add_npc(127600,110152,22300187,1) --33
|
|
add_npc(127610,110142,22300187,1) --34
|
|
add_npc(127620,110132,22300187,1) --35
|
|
add_npc(127552,110122,22300187,1) --36
|
|
add_npc(127562,110112,22300187,1) --37
|
|
add_npc(127568,110102,22300187,1) --38
|
|
--5th chair --
|
|
add_npc(127689,109877,22300187,1) --39
|
|
add_npc(127683,109890,22300187,1) --40
|
|
add_npc(127678,109900,22300187,1) --41
|
|
add_npc(127738,109902,22300187,1) --42
|
|
add_npc(127733,109915,22300187,1) --43
|
|
add_npc(127729,109927,22300187,1) --44
|
|
add_npc(127792,109933,22300187,1) --45
|
|
add_npc(127784,109944,22300187,1) --46
|
|
add_npc(127778,109955,22300187,1) --47
|
|
|
|
elseif id == 4 then
|
|
--4th room MAX (84)
|
|
--tent
|
|
add_npc(126925,110205,22300185,1) --1
|
|
add_npc(127105,110435,22300185,1) --2
|
|
add_npc(127355,110605,22300185,1) --3
|
|
--1st chair --
|
|
add_npc(127060,109852,22300188,1) --4
|
|
add_npc(127060,109866,22300188,1) --5
|
|
add_npc(127060,109878,22300188,1) --6
|
|
add_npc(127004,109852,22300188,1) --7
|
|
add_npc(127002,109866,22300188,1) --8
|
|
add_npc(127000,109878,22300188,1) --9
|
|
add_npc(126945,109852,22300188,1) --10
|
|
add_npc(126945,109866,22300188,1) --11
|
|
add_npc(126945,109878,22300188,1) --12
|
|
--2nd chair --
|
|
add_npc(126795,109920,22300188,1) --13
|
|
add_npc(126805,109930,22300188,1) --14
|
|
add_npc(126815,109940,22300188,1) --15
|
|
add_npc(126760,109968,22300188,1) --16
|
|
add_npc(126770,109975,22300188,1) --17
|
|
add_npc(126780,109983,22300188,1) --18
|
|
add_npc(126725,110015,22300188,1) --19
|
|
add_npc(126737,110021,22300188,1) --20
|
|
add_npc(126746,110028,22300188,1) --21
|
|
--3rd chair --
|
|
add_npc(126658,110193,22300188,1) --22
|
|
add_npc(126671,110193,22300188,1) --23
|
|
add_npc(126682,110192,22300188,1) --24
|
|
add_npc(126675,110310,22300188,1) --25
|
|
add_npc(126689,110306,22300188,1) --26
|
|
add_npc(126701,110305,22300188,1) --27
|
|
add_npc(126668,110253,22300188,1) --28
|
|
add_npc(126680,110250,22300188,1) --29
|
|
add_npc(126694,110248,22300188,1) --30
|
|
--4th chair --
|
|
add_npc(126724,110484,22300188,1) --31
|
|
add_npc(126738,110480,22300188,1) --32
|
|
add_npc(126748,110475,22300188,1) --33
|
|
add_npc(126747,110536,22300188,1) --34
|
|
add_npc(126759,110531,22300188,1) --35
|
|
add_npc(126770,110528,22300188,1) --36
|
|
add_npc(126770,110593,22300188,1) --37
|
|
add_npc(126781,110585,22300188,1) --38
|
|
add_npc(126791,110582,22300188,1) --39
|
|
--5th chair --
|
|
add_npc(127137,110199,22300188,1) --40
|
|
add_npc(127130,110212,22300188,1) --41
|
|
add_npc(127123,110218,22300188,1) --42
|
|
add_npc(127180,110232,22300188,1) --43
|
|
add_npc(127170,110242,22300188,1) --44
|
|
add_npc(127167,110252,22300188,1) --45
|
|
add_npc(127231,110271,22300188,1) --46
|
|
add_npc(127220,110279,22300188,1) --47
|
|
add_npc(127212,110289,22300188,1) --48
|
|
--6th chair --
|
|
add_npc(126883,110695,22300188,1) --49
|
|
add_npc(126888,110682,22300188,1) --50
|
|
add_npc(126891,110670,22300188,1) --51
|
|
add_npc(126937,110711,22300188,1) --52
|
|
add_npc(126941,110699,22300188,1) --53
|
|
add_npc(126946,110687,22300188,1) --54
|
|
add_npc(127000,110730,22300188,1) --55
|
|
add_npc(127000,110715,22300188,1) --56
|
|
add_npc(127000,110705,22300188,1) --57
|
|
--7th chair --
|
|
add_npc(127165,110755,22300188,1) --58
|
|
add_npc(127170,110742,22300188,1) --59
|
|
add_npc(127175,110730,22300188,1) --60
|
|
add_npc(127220,110770,22300188,1) --61
|
|
add_npc(127225,110755,22300188,1) --62
|
|
add_npc(127230,110745,22300188,1) --63
|
|
add_npc(127280,110780,22300188,1) --64
|
|
add_npc(127282,110770,22300188,1) --65
|
|
add_npc(127284,110760,22300188,1) --66
|
|
--8th chair --
|
|
add_npc(127321,110351,22300188,1) --67
|
|
add_npc(127317,110362,22300188,1) --68
|
|
add_npc(127309,110371,22300188,1) --69
|
|
add_npc(127367,110384,22300188,1) --70
|
|
add_npc(127361,110395,22300188,1) --71
|
|
add_npc(127353,110406,22300188,1) --72
|
|
add_npc(127417,110420,22300188,1) --73
|
|
add_npc(127407,110430,22300188,1) --74
|
|
add_npc(127400,110440,22300188,1) --75
|
|
--9th chair --
|
|
add_npc(127526,110530,22300188,1) --76
|
|
add_npc(127515,110540,22300188,1) --77
|
|
add_npc(127507,110544,22300188,1) --78
|
|
add_npc(127560,110578,22300188,1) --79
|
|
add_npc(127547,110586,22300188,1) --80
|
|
add_npc(127538,110591,22300188,1) --81
|
|
add_npc(127590,110627,22300188,1) --82
|
|
add_npc(127580,110633,22300188,1) --83
|
|
add_npc(127570,110638,22300188,1) --84
|
|
elseif id == 5 then
|
|
--5th room /position MAX (36)
|
|
--road ordered by appearance
|
|
add_npc(127430,111118,22300195,1) --1
|
|
--
|
|
add_npc(127292,111307,22300195,1) --2
|
|
add_npc(127318,111330,22300195,1) --3
|
|
add_npc(127342,111356,22300195,1) --4
|
|
--
|
|
add_npc(127257,111485,22300195,1) --5
|
|
add_npc(127234,111468,22300195,1) --6
|
|
add_npc(127213,111450,22300195,1) --7
|
|
add_npc(127191,111432,22300195,1) --8
|
|
add_npc(127169,111414,22300195,1) --9
|
|
add_npc(127144,111392,22300195,1) --10
|
|
--
|
|
add_npc(127078,111514,22300195,1) --11
|
|
add_npc(127111,111562,22300195,1) --12
|
|
--
|
|
--1st chair --
|
|
add_npc(127275,111234,22300189,1) --13
|
|
add_npc(127285,111245,22300189,1) --14
|
|
add_npc(127292,111252,22300189,1) --15
|
|
add_npc(127238,111275,22300189,1) --16
|
|
add_npc(127246,111285,22300189,1) --17
|
|
add_npc(127254,111295,22300189,1) --18
|
|
add_npc(127197,111323,22300189,1) --19
|
|
add_npc(127208,111330,22300189,1) --20
|
|
add_npc(127217,111337,22300189,1) --21
|
|
|
|
--2nd chair
|
|
add_npc(127416,111369,22300189,1) --22
|
|
add_npc(127405,111363,22300189,1) --23
|
|
add_npc(127396,111357,22300189,1) --24
|
|
add_npc(127382,111410,22300189,1) --25
|
|
add_npc(127373,111402,22300189,1) --26
|
|
add_npc(127364,111397,22300189,1) --27
|
|
add_npc(127343,111461,22300189,1) --28
|
|
add_npc(127332,111450,22300189,1) --29
|
|
add_npc(127323,111445,22300189,1) --30
|
|
--
|
|
-- pillars --
|
|
add_npc(126946,112143,22300196,1) --31
|
|
add_npc(126581,112299,22300196,1) --32
|
|
add_npc(126264,112059,22300196,1) --33
|
|
add_npc(126311,111667,22300196,1) --34
|
|
add_npc(126677,111508,22300196,1) --35
|
|
add_npc(126994,111747,22300196,1) --36
|
|
|
|
|
|
end
|
|
|
|
end |