Auto Party

Descrição

Auto party com !party kick inativos.

Autor:

                
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
125
126
127
128
129
130
131
132
133
134
local infoTime = 0 local talkTime = 0 local maxLevel = 0 local minLevel = 0 local justForInfo = true local canSeeInfo = true local partyMembersCount = 0 local partyLeaderHuntWidget = macro(1000, "Party Leader Hunt", function() if not player:isPartyLeader() then justForInfo = true partyMembersCount = 0 return end if justForInfo and canSeeInfo then sayChannel(getChannelId("party"), "!party info") return end if talkTime > 0 then talkTime = talkTime - 1 end if player:getShield() == 10 then infoTime = infoTime + 1 if infoTime >= 20 then sayChannel(getChannelId("party"), "!party info") infoTime = 0 end else infoTime = 0 end end) addLabel("maxLevel", "Max Level:") addTextEdit("maxLevel", storage.maxLevel or "", function(widget, text) if tonumber(text) then maxLevel = tonumber(text) else sayChannel(getChannelId("party"), "!party info") end storage.maxLevel = tonumber(text) end) addLabel("minLevel", "Min Level:") addTextEdit("minLevel", storage.minLevel or "", function(widget, text) if tonumber(text) then minLevel = tonumber(text) else sayChannel(getChannelId("party"), "!party info") end storage.minLevel = tonumber(text) end) onTalk(function(name, level, mode, text, channelId, pos) if partyLeaderHuntWidget:isOn() then if name == player:getName() then return end if text:lower():find("pt") or (text:lower():find("party") and not text:lower():find("!party")) then for _, spec in ipairs(getSpectators()) do if spec:getName() == name then if spec:isPartyMember() then return end if spec:getShield() == 2 then g_game.talkPrivate(5, name, name .. ", I already invited you") return end if level > maxLevel or level < minLevel then g_game.talkPrivate(5, name, name .. ", the minimum level is " .. minLevel .. " and the maximum is " .. maxLevel) return end if partyMembersCount >= 30 then g_game.talkPrivate(5, name, name .. ", the party already has 30 players for a better use of the shared experience.") return end g_game.partyInvite(spec:getId()) end end end end end) onLoginAdvice(function(text) if partyLeaderHuntWidget:isOn() then local explode1 = string.explode(text, "*") local explode2 = string.explode(explode1[8], ":")[2] if not storage.maxLevel then maxLevel = math.ceil(tonumber(string.explode(explode1[4], ":")[2])*3/2) else maxLevel = storage.maxLevel end if not storage.minLevel then minLevel = math.ceil(tonumber(string.explode(explode1[3], ":")[2])*2/3) else minLevel = storage.minLevel end partyMembersCount = tonumber(string.explode(explode1[2], ":")[2]) if justForInfo then justForInfo = false return end if explode2:find(",") then local names = string.explode(explode2, ",") for i = 1, #names do canSeeInfo = false schedule(1000 * i, function() if i == #names then canSeeInfo = true end sayChannel(getChannelId("party"), "!party kick," .. names[i]) end) end elseif explode2 ~= "" then schedule(1000, function() sayChannel(getChannelId("party"), "!party kick," .. explode2) end) end end end) onCreatureAppear(function(creature) if partyLeaderHuntWidget:isOn() then if not creature:isPlayer() then return end if creature:isLocalPlayer() then return end if creature:getShield() == 2 then return end if creature:isPartyMember() then return end if talkTime == 0 and partyMembersCount < 30 then say("If you want to join the party, say 'pt' so I can invite you") talkTime = 15 end end end) onTextMessage(function(mode, text) if partyLeaderHuntWidget:isOn() then if text:lower():find("you are now the leader of the party.") or text:lower():find("has joined the party.") or (text:lower():find("has left the party.") and canSeeInfo) then justForInfo = true end end end)