viewing paste topic/4320- getserverdef.diff | Diff

Posted on the
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
 db/const.txt            | 14 ++++++++++++++
 doc/script_commands.txt | 17 +++++++++++++++++
 src/map/chat.h          |  4 +++-
 src/map/script.c        | 25 +++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 1 deletion(-)
 
diff --git a/db/const.txt b/db/const.txt
index 577fbc2..2149c7d 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -3337,3 +3337,17 @@ NST_ZENY 0
 NST_CASH   1
 NST_MARKET 2
 NST_CUSTOM 3
+
+VAR_PACKETVER  0
+VAR_MAX_LEVEL  1
+VAR_MAX_STORAGE    2
+VAR_MAX_INVENTORY  3
+VAR_MAX_ZENY   4
+VAR_MAX_PARTY  5
+VAR_MAX_GUILD  6
+VAR_MAX_GUILDLEVEL 7
+VAR_MAX_GUILD_STORAGE  8
+VAR_MAX_BG_MEMBERS 9
+//VAR_VIP_SCRIPT   10
+//VAR_MIN_STORAGE  11
+VAR_MAX_CHATROOM_SIZE  12
\ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index aa86984..63ce081 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3864,6 +3864,23 @@ by the type parameter.
  6 - RENEWAL_ASPD (renewal ASPD)
 
 ---------------------------------------
+
+*getserverdef(<type>);
+
+Returns a server definition. Valid types are listed in 'db/const.txt':
+   VAR_PACKETVER   0
+   VAR_MAX_LEVEL   1
+   VAR_MAX_STORAGE 2
+   VAR_MAX_INVENTORY   3
+   VAR_MAX_ZENY    4
+   VAR_MAX_PARTY   5
+   VAR_MAX_GUILD   6
+   VAR_MAX_GUILDLEVEL  7
+   VAR_MAX_GUILD_STORAGE   8
+   VAR_MAX_BG_MEMBERS  9
+   VAR_MAX_CHATROOM_SIZE   12
+
+---------------------------------------
 \\
 3,1.- Item-related commands
 \\
diff --git a/src/map/chat.h b/src/map/chat.h
index 71e5a11..3460713 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -7,6 +7,8 @@
 
 #include "map.h" // struct block_list, CHATROOM_TITLE_SIZE
 
+#define MAX_CHATROOM_SIZE 20
+
 struct map_session_data;
 struct chat_data;
 
@@ -21,7 +23,7 @@ struct chat_data {
    uint32 zeny;                         // required zeny to join
    uint32 minLvl;                   // minimum base level to join
    uint32 maxLvl;                   // maximum base level allowed to join
-   struct map_session_data* usersd[20];
+   struct map_session_data* usersd[MAX_CHATROOM_SIZE];
    struct block_list* owner;
    char npc_event[EVENT_NAME_LENGTH];
    /* isn't this a waste? there is a enormous overhead, wouldn't something like skill_blockpc_start be better here? [Ind] */
diff --git a/src/map/script.c b/src/map/script.c
index 4fb4e72..1addf04 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18502,11 +18502,36 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)
    return script->add_builtin(&buildin, true);
 }
 
+BUILDIN(getserverdef) {
+   int type = script_getnum(st,2);
+   switch(type){
+       case 0: script_pushint(st,PACKETVER); break;
+       case 1: script_pushint(st,MAX_LEVEL); break;
+       case 2: script_pushint(st,MAX_STORAGE); break;
+       case 3: script_pushint(st,MAX_INVENTORY); break;
+       case 4: script_pushint(st,MAX_ZENY); break;
+       case 5: script_pushint(st,MAX_PARTY); break;
+       case 6: script_pushint(st,MAX_GUILD); break;
+       case 7: script_pushint(st,MAX_GUILDLEVEL); break;
+       case 8: script_pushint(st,MAX_GUILD_STORAGE); break;
+       case 9: script_pushint(st,MAX_BG_MEMBERS); break;
+//     case 10: script_pushint(st,VIP_SCRIPT); break;
+//     case 11: script_pushint(st,MIN_STORAGE); break;
+       case 12: script_pushint(st,MAX_CHATROOM_SIZE); break;
+       default:
+           ShowWarning("buildin_getserverdef: unknown type %d.\n", type);
+           script_pushint(st,0);
+           break;
+   }
+   return true;
+}
+
 #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args }
 #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args }
 void script_parse_builtin(void) {
    struct script_function BUILDIN[] = {
        // NPC interaction
+       BUILDIN_DEF(getserverdef,"i"),
        BUILDIN_DEF(mes,"s*"),
        BUILDIN_DEF(next,""),
        BUILDIN_DEF(close,""),
 
Viewed 1326 times, submitted by AnnieRuru.