summaryrefslogtreecommitdiff
path: root/npc/functions/guild.txt
blob: 92a0a380203917c41b6beeb25eb6ba3195960bef (plain) (blame)
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
// TMW2 Script
// Author:
//  Jesusalva
// Description:
//  Guild System Utils

// Usage: getguildrole (guildid, accid, {type})
// Returns a string if TYPE is set. Otherwise, Returns the GPOS_*
// On failure, returns "null" or -1
function	script	getguildrole	{
    .@gid=getarg(0);
    .@aid=getarg(1);
    .@type=getarg(2,0);
    .@pos=-1;
    getguildmember(.@gid, 2);
    for (.@i=0; .@i < $@guildmembercount; .@i++) {
        //debugmes "Found AID %d - Position %d", $@guildmemberaid[.@i], $@guildmemberpos[.@i];
        if (.@aid == $@guildmemberaid[.@i]) {
            .@pos=$@guildmemberpos[.@i];
            break;
        }
    }
    if (!.@type)
        return .@pos;

    // Wait, we now have a command for this
    return getguildpostitle(.@gid, .@pos);

    // Legacy behavior
    switch (.@pos) {
    case GPOS_GUILDMASTER:
        return "Guild Master";
    case GPOS_VICELEADER:
        return "Vice Leader";
    case GPOS_RECRUITER:
        return "Guild Recruiter";
    case GPOS_TREASURER:
        return "Guild Treasurer";
    case GPOS_5:
        return "Member";
    case GPOS_NEWBIE:
        return "Newbie";
    default:
        return "null";
    }
}