SHOW:
|
|
- or go back to the newest paste.
1 | - | local Entry = 1000001 -- NPC entry |
1 | + | local Entry = 180001 -- NPC entry |
2 | local npc_text = 700000 | |
3 | local T = | |
4 | { | |
5 | -- {icon, "Name", npc_text+X}, | |
6 | {0, "I would like to know how the server works", npc_text+1}, | |
7 | {0, "Section A", npc_text+2}, | |
8 | {0, "Section B", npc_text+3}, | |
9 | {0, "Other Information", npc_text+4}, | |
10 | -- {0, "More info", npc_text+4}, | |
11 | - | local D = #T |
11 | + | -- {0, "More info", npc_text+5}, |
12 | -- {0, "More info", npc_text+6}, | |
13 | - | function T.Hello(pUnit, event, pPlayer) |
13 | + | -- {0, "More info", npc_text+7}, |
14 | -- {0, "More info", npc_text+8}, | |
15 | } | |
16 | - | pUnit:GossipMenuAddItem(v[1], v[2], D+k, 0, '', 0) |
16 | + | local Start = 1 |
17 | ||
18 | local function Hello(pUnit, event, pPlayer) | |
19 | pUnit:GossipCreateMenu(npc_text, pPlayer, 0) | |
20 | for k, v in ipairs(T) do | |
21 | - | function T.Select(pUnit, event, pPlayer, id, intid, code) |
21 | + | pUnit:GossipMenuAddItem(v[1], v[2], Start+k, 0, '', 0) |
22 | - | if(intid > D) then |
22 | + | |
23 | - | pUnit:GossipCreateMenu(T[intid-D][3], pPlayer, 0) |
23 | + | |
24 | end | |
25 | ||
26 | local function Select(pUnit, event, pPlayer, id, intid, code) | |
27 | if(intid == 1) then | |
28 | - | T.Hello(pUnit, event, pPlayer) |
28 | + | pPlayer:GossipComplete() |
29 | return | |
30 | elseif(intid > Start) then | |
31 | - | RegisterUnitGossipEvent(100001, 1, T.Hello) |
31 | + | pUnit:GossipCreateMenu(T[intid-Start][3], pPlayer, 0) |
32 | - | RegisterUnitGossipEvent(100001, 1, T.Select) |
32 | + | |
33 | pUnit:GossipSendMenu(pPlayer) | |
34 | return | |
35 | end | |
36 | Hello(pUnit, event, pPlayer) | |
37 | end | |
38 | ||
39 | RegisterUnitGossipEvent(Entry, 1, Hello) | |
40 | RegisterUnitGossipEvent(Entry, 2, Select) |