summaryrefslogtreecommitdiff
path: root/npc/guilds/management.txt
blob: d8a54151e49cae1c0eb5c90d8943550bbe55fa66 (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
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
// Moubootaur Legends Script
// Author:
//    Jesusalva
// Description:
//  Guild Facility - Guild Settings (for guildmaster)

guilds,35,30,0	script	Guild Management	NPC_NO_SPRITE,{
    function gmaster;
    .@gid=getcharid(2);
    .@admin=(getguildrole(.@gid, getcharid(3)) == GPOS_GUILDMASTER);
    .@pos=getguildrole(.@gid, getcharid(3));

    if (is_admin() && strcharinfo(0) == "Monster King") {
        mesc ".:: Jesusalva's Interface ::.", 1;
        mesc "Write Guild ID to modify - DO NOT INPUT IF YOU DON'T KNOW EXACTLY WHAT YOU ARE DOING", 1;
        mesc "THAT IS IRREVERSIBLE, DON'T BE A DUMMY", 1;
        next;
        mesc("Correct gid: " + .@gid);
        input .@gid;
        if (.@gid <= 0)
            close;
        .@admin=true;
        logmes(strcharinfo(0)+" logged in as super user in guild: "+getguildname(.@gid), LOGMES_ATCOMMAND);
    }

    mesc (".:: "+getguildname(.@gid)+" ::."), 1;
    mesc l("Guild Master: @@", getguildmaster(.@gid)), 3;
    if (getguildnxp(.@gid) > 0)
        mesc l("Guild Lv @@, @@/@@ EXP to level up", getguildlvl(.@gid), format_number(getguildexp(.@gid)), format_number(getguildnxp(.@gid)));
    else
        mesc l("Guild Lv @@, @@/@@ EXP to level up", getguildlvl(.@gid), format_number(getguildexp(.@gid)), "???");

    //         mesc l("The average player level is @@", getguildavg(.@gid));
    //mesc l("Your position on the guild: @@", getguildrole(.@gid, getcharid(3), true));
    mesc l("You are the guild's \"%s\", and you contribute with %02d%% EXP.",
    getguildpostitle(.@gid, .@pos),
    getguildpostax(.@gid, .@pos));
    //getguildpostitle(.@gid, .@pos)

    // I forgot a function to get player title and allow any guildmaster to change this
    if (.@admin)
    {
        next;
        do
        {
            gmaster();
            next;
            mesc l("Do you want to do something else?");
        } while (askyesno() == ASK_YES);
    }
    close;

    function gmaster {
        .@gid=getcharid(2);
        mesn;
        mesc l("Please select the Guild Position you want to change.");
        menuint
            l("Abort"), -1,
            l("Guild Master"), GPOS_GUILDMASTER,
            l("Vice Leader"), GPOS_VICELEADER,
            l("Recruiter"), GPOS_RECRUITER,
            l("Treasurer"), GPOS_TREASURER,
            l("Normal Member"), GPOS_MEMBER,
            l("Newbie"), GPOS_NEWBIE;
        mes "";
        .@idx=0+@menuret;
        if (.@idx < 0)
            return;
        mesc l("The guild's \"%s\" currently contribute with %02d%% EXP.", getguildpostitle(.@gid, .@pos), getguildpostax(.@gid, .@idx));
        mesc l("Please write how much in percent is EXP Tax for member (range: 0~50)"), 1;
        input .@exptax;
        if (.@exptax < 0 || .@exptax > 50)
            return;
        mesc l("Applying...");
        switch (.@idx) {
            case GPOS_GUILDMASTER:
                .@name$="GuildMaster";
                .@perm=GPERM_ALL;
                break;
            case GPOS_VICELEADER:
                .@name$="ViceLeader";
                .@perm=GPERM_ALL;
                break;
            case GPOS_RECRUITER:
                .@name$="Recruiter";
                .@perm=GPERM_INVITE;
                break;
            case GPOS_TREASURER:
                .@name$="Treasurer";
                .@perm=0;
                break;
            case GPOS_MEMBER:
                .@name$="Member";
                .@perm=0;
                break;
            case GPOS_NEWBIE:
                .@name$="Newbie";
                .@perm=0;
                break;
            default:
                .@name$="Position "+(.@idx+1);
                .@perm=0;
                break;
        }
        //debugmes "setguildrole(%d,%d,%d,%d,\"%s\")", .@gid, .@idx, .@perm, .@exptax, .@name$;
        setguildrole(.@gid, .@idx, .@perm, .@exptax, .@name$);
        mesc l("Done!"), 3;
        return;
    }

OnInit:
    .distance=1;
    end;
}