-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevent.lua
124 lines (97 loc) · 4.93 KB
/
event.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
-- Author Alerino
-- Version 1.0
-- Date 12.06.2020
-- Github https://github.com/Alerinos
quest event begin
state start begin
-- Komunikat
when login with pc.in_dungeon() == false begin
local timestmp = os.time(os.date("!*t"))
-- GM LEVEL
-- 0 - player
-- 1 - low_wizard
-- 2 - wizard
-- 3 - hight_wizard
-- 4 - god
-- 5 - implementor
if pc.get_gm_level() >= 3 then
send_letter("[GM] Event")
end
if game.get_event_flag("event_gold_bar") > 0 and game.get_event_flag("event_gold_bar_time") >= timestmp then
notice("[EVENT] Gold Bar. It's still left "..secondsToTime(game.get_event_flag("event_gold_bar_time") - timestmp))
end
if game.get_event_flag("event_valentine") > 0 and game.get_event_flag("event_valentine_time") >= timestmp then
notice("[EVENT] Valentine's Day. It's still left "..secondsToTime(game.get_event_flag("event_valentine_time") - timestmp))
end
if game.get_event_flag("event_moonlight") > 0 and game.get_event_flag("event_moonlight_time") >= timestmp then
notice("[EVENT] "..item_name(50011)..". It's still left "..secondsToTime(game.get_event_flag("event_moonlight_time") - timestmp))
end
if game.get_event_flag("event_cards") > 0 and game.get_event_flag("event_cards_time") >= timestmp then
notice("[EVENT] "..item_name(79505).." min. level 35. It's still left "..secondsToTime(game.get_event_flag("event_cards_time") - timestmp))
cmdchat("cards icon")
end
end
when kill with not npc.is_pc() and pc.in_dungeon() == false begin
local min = npc.get_level0() - 15
local max = npc.get_level0() + 15
local lvl = pc.get_level()
local timestmp = os.time(os.date("!*t"))
-- Szkatułka blasku
if pc.get_map_index() ~= 1 and math.random(1000) <= game.get_event_flag("event_moonlight") and lvl >= min and lvl <= max and game.get_event_flag("event_moonlight_time") >= timestmp then
pc.give_item2(50011)
end
-- Walentynki
if pc.get_map_index() ~= 1 and math.random(1000) <= game.get_event_flag("event_valentine") and lvl >= min and lvl <= max and game.get_event_flag("event_valentine_time") >= timestmp then
pc.give_item2(71146)
end
-- Sztabki
if pc.get_map_index() ~= 1 and math.random(1000) <= game.get_event_flag("event_gold_bar") and lvl >= min and lvl <= max and game.get_event_flag("event_gold_bar_time") >= timestmp then
local rand = math.random(1, 100)
if rand >= 80 then
game.drop_item_with_ownership(80007)
elseif rand >= 50 then
game.drop_item_with_ownership(80006)
else
game.drop_item_with_ownership(80005)
end
end
-- okey
if lvl <= 35 and math.random(1000) <= game.get_event_flag("event_cards") and lvl >= min and lvl <= max and game.get_event_flag("event_cards_time") >= timestmp then
pc.give_item2(79505)
if pc.count_item(79505) >= 24 then
pc.remove_item(79505, 24)
pc.give_item2(79506)
end
end
end
when button or info with pc.get_gm_level() >= 3 begin
local timestmp = os.time(os.date("!*t"))
say("Event name")
say("- moonlight")
say("- valentine")
say("- gold_bar")
say("- cards")
local name = input()
say("Percent 0-1000, 10 = 1%")
local percent = input()
say("Day")
local d = input()
say("Month")
local m = input()
say("Hour")
local h = input()
local t = os.time({year=os.date("%Y"), month=m, day=d, hour=h, min=0, sec=0})
say("Event: "..name)
say("Percent "..(percent/10).."%")
say("Valid until")
say(d.."."..m.."."..os.date("%Y").." "..h..":00:00")
say("It will end in "..secondsToTime(t - timestmp))
if select("Accept", "Cancel") == 1 then
game.set_event_flag("event_"..name, percent)
game.set_event_flag("event_"..name.."_time", t)
syschat("Active event")
notice_all("The event has been activated. You must make a relog.")
end
end
end
end