summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-15 09:29:31 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-15 09:29:31 -0300
commit0ef89a7106f81e02426f2fb3d6499176098085df (patch)
tree29ab27c0da489c92322af7e0cace8e902051975a /npc
parent6e9a11a712f320762f4eaeb206bf6aec03b64be7 (diff)
downloadserverdata-0ef89a7106f81e02426f2fb3d6499176098085df.tar.gz
serverdata-0ef89a7106f81e02426f2fb3d6499176098085df.tar.bz2
serverdata-0ef89a7106f81e02426f2fb3d6499176098085df.tar.xz
serverdata-0ef89a7106f81e02426f2fb3d6499176098085df.zip
Introduce the "Normal Member" and the "Treasurer" guild roles.
Only Normal Member and above can use the Guild Storage.
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/guild.txt42
-rw-r--r--npc/guilds/management.txt16
-rw-r--r--npc/guilds/storage.txt5
-rw-r--r--npc/scripts.conf1
4 files changed, 62 insertions, 2 deletions
diff --git a/npc/functions/guild.txt b/npc/functions/guild.txt
new file mode 100644
index 000000000..09422946d
--- /dev/null
+++ b/npc/functions/guild.txt
@@ -0,0 +1,42 @@
+// 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;
+
+ 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";
+ }
+}
diff --git a/npc/guilds/management.txt b/npc/guilds/management.txt
index 4b099adee..cd1f5ae78 100644
--- a/npc/guilds/management.txt
+++ b/npc/guilds/management.txt
@@ -14,9 +14,13 @@ guilds,35,30,0 script Guild Management NPC_NO_SPRITE,{
else
mesc l("Guild Lv @@, @@/@@ EXP to level up", getguildlvl(.@gid), getguildexp(.@gid), "???");
+ // mesc l("The average player level is @@", getguildavg(.@gid));
+ mesc l("Your position on the guild: @@", getguildrole(.@gid, getcharid(3), true));
+
// I forgot a function to get player title and allow any guildmaster to change this
if (strcharinfo(0) == getguildmaster(.@gid))
{
+ next;
do
{
gmaster();
@@ -35,8 +39,8 @@ guilds,35,30,0 script Guild Management NPC_NO_SPRITE,{
l("Guild Master"), GPOS_GUILDMASTER,
l("Vice Leader"), GPOS_VICELEADER,
l("Recruiter"), GPOS_RECRUITER,
- l("Position 4"), GPOS_4,
- l("Position 5"), GPOS_5,
+ l("Treasurer"), GPOS_TREASURER,
+ l("Normal Member"), GPOS_5,
l("Newbie"), GPOS_NEWBIE;
mes "";
.@idx=0+@menuret;
@@ -60,6 +64,14 @@ guilds,35,30,0 script Guild Management NPC_NO_SPRITE,{
.@name$="Recruiter";
.@perm=GPERM_INVITE;
break;
+ case GPOS_TREASURER:
+ .@name$="Treasurer";
+ .@perm=0;
+ break;
+ case GPOS_5:
+ .@name$="Member";
+ .@perm=0;
+ break;
case GPOS_NEWBIE:
.@name$="Newbie";
.@perm=0;
diff --git a/npc/guilds/storage.txt b/npc/guilds/storage.txt
index 97218fbb1..316071d9f 100644
--- a/npc/guilds/storage.txt
+++ b/npc/guilds/storage.txt
@@ -12,6 +12,11 @@ guilds,33,28,0 script Guild Storage NPC_NO_SPRITE,{
}
else
{
+ if (getguildrole(.@gid, getcharid(3)) > GPOS_5)
+ {
+ dispbottom l("Your position must be the one of a regular member or above.");
+ end;
+ }
if (guildopenstorage())
{
npctalkonce l("Someone else is using the guild storage right now. Please wait.");
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 448596ddc..892e15718 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -41,6 +41,7 @@
"npc/functions/doors.txt",
"npc/functions/event.txt",
"npc/functions/fishing.txt",
+"npc/functions/guild.txt",
"npc/functions/hammocks.txt",
"npc/functions/lockpicks.txt",
"npc/functions/TODO.txt",