viewing paste ra_scsnochat | 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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17352)
+++ src/map/atcommand.c (working copy)
@@ -1126,14 +1126,14 @@
    memset(item_name, '\0', sizeof(item_name));
 
    if (!strcmpi(command+1,"itembound") && (!message || !*message || (
-       sscanf(message, "\"%99[^\"]\" %d %d", item_name, &number, &bound) < 2 && 
-       sscanf(message, "%99s %d %d", item_name, &number, &bound) < 2 
+       sscanf(message, "\"%99[^\"]\" %d %d", item_name, &number, &bound) < 2 &&
+       sscanf(message, "%99s %d %d", item_name, &number, &bound) < 2
    ))) {
        clif_displaymessage(fd, msg_txt(sd,295)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity> <bound_type>).
        return -1;
    } else if (!message || !*message || (
-       sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && 
-       sscanf(message, "%99s %d", item_name, &number) < 1 
+       sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
+       sscanf(message, "%99s %d", item_name, &number) < 1
    )) {
        clif_displaymessage(fd, msg_txt(sd,983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
        return -1;
@@ -6167,9 +6167,7 @@
    bool ifcolor=(*(command + 8) != 'c' && *(command + 8) != 'C')?0:1;
    unsigned long color=0;
 
-   if (sd->sc.count && //no "chatting" while muted.
-       (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
-       (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
+   if (sd->sc.cant.chat)
        return -1;
 
    if(!ifcolor) {
@@ -6218,10 +6216,8 @@
        return -1;
    }
 
-   if (sd->sc.count && //no "chatting" while muted.
-       (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
-       (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
-       return -1;
+   if (sd->sc.cant.chat)
+       return -1; //no "chatting" while muted.
 
    if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) {
        clif_displaymessage(fd, msg_txt(sd,1224)); // Please enter a message (usage: @pettalk <message>).
@@ -7052,10 +7048,8 @@
        sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
    }
 
-   if (sd->sc.count && //no "chatting" while muted.
-       (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
-       (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
-       return -1;
+   if (sd->sc.cant.chat)
+       return -1; //no "chatting" while muted.
 
    if ( !merc_is_hom_active(sd->hd) ) {
        clif_displaymessage(fd, msg_txt(sd,1254)); // You do not have a homunculus.
@@ -7439,10 +7433,8 @@
    memset(tempmes, '\0', sizeof(tempmes));
    memset(atcmd_output, '\0', sizeof(atcmd_output));
 
-   if (sd->sc.count && //no "chatting" while muted.
-       (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
-       (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
-       return -1;
+   if (sd->sc.cant.chat)
+       return -1; //no "chatting" while muted.
 
    if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) {
        clif_displaymessage(fd, msg_txt(sd,1302)); // Please enter a message (usage: @me <message>).
Index: src/map/status.c
===================================================================
--- src/map/status.c    (revision 17352)
+++ src/map/status.c    (working copy)
@@ -1026,6 +1026,7 @@
    StatusChangeStateTable[SC_MEIKYOUSISUI]        |= SCS_NOMOVE;
    StatusChangeStateTable[SC_KAGEHUMI]            |= SCS_NOMOVE;
    StatusChangeStateTable[SC_KYOUGAKU]            |= SCS_NOMOVE;
+   StatusChangeStateTable[SC_PARALYSIS]           |= SCS_NOMOVE;
 
    /* StatusChangeState (SCS_) NOPICKUPITEMS */
    StatusChangeStateTable[SC_HIDING]              |= SCS_NOPICKITEM;
@@ -1055,9 +1056,12 @@
    StatusChangeStateTable[SC_CURSEDCIRCLE_TARGET] |= SCS_NOCAST;
    StatusChangeStateTable[SC_SILENCE]             |= SCS_NOCAST;
 
-   //Homon S
-   StatusChangeStateTable[SC_PARALYSIS]               |= SCS_NOMOVE;
-
+   /* StatusChangeState (SCS_) NOCHAT (skills) */
+   StatusChangeStateTable[SC_BERSERK]             |= SCS_NOCHAT;
+   StatusChangeStateTable[SC_SATURDAYNIGHTFEVER]  |= SCS_NOCHAT;
+   StatusChangeStateTable[SC_DEEPSLEEP]           |= SCS_NOCHAT;
+   StatusChangeStateTable[SC__BLOODYLUST]         |= SCS_NOCHAT;
+   StatusChangeStateTable[SC_NOCHAT]              |= SCS_NOCHAT|SCS_NOCHATCOND;
 }
 
 static void initDummyData(void)
@@ -3589,9 +3593,16 @@
        }
    }
 
+   /* can't chat */
+   if( flag&SCS_NOCHAT ) {
+       if( !(flag&SCS_NOCHATCOND) ) {
+           sc->cant.chat += ( start ? 1 : -1 );
+       } else if(sc->data[SC_NOCHAT] && sc->data[SC_NOCHAT]->val1&MANNER_NOCHAT)
+           sc->cant.chat += ( start ? 1 : -1 );
+   }
+
    /* player-only states */
    if( bl->type == BL_PC ) {
-
        /* can pick items? */
        if( flag&SCS_NOPICKITEM ) {
            if( !(flag&SCS_NOPICKITEMCOND) ) {
Index: src/map/status.h
===================================================================
--- src/map/status.h    (revision 17352)
+++ src/map/status.h    (working copy)
@@ -1550,6 +1550,8 @@
    SCS_NODROPITEM      = 0x00000020, /* player unable to drop items */
    SCS_NOCASTCOND      = 0x00000040, /* cond flag for nocast */
    SCS_NOCAST          = 0x00000080, /* unit unable to cast skills */
+   SCS_NOCHAT          = 0x00000100, /* unit can't talk */
+   SCS_NOCHATCOND      = 0x00000200, /* cond flag for notalk */
 };
 
 //Define flags for the status_calc_bl function. [Skotlex]
@@ -1706,6 +1708,7 @@
        unsigned char pickup;
        unsigned char drop;
        unsigned char cast;
+       unsigned char chat;
    } cant;/* status change state flags */
    //int sg_id; //ID of the previous Storm gust that hit you
    short comet_x, comet_y; // Point where src casted Comet - required to calculate damage from this point
Index: src/map/clif.c
===================================================================
--- src/map/clif.c  (revision 17352)
+++ src/map/clif.c  (working copy)
@@ -6598,7 +6598,7 @@
        WBUFW(buf,0)=0x109;
        WBUFW(buf,2)=len+8;
        WBUFL(buf,4)=account_id;
-        safestrncpy((char *)WBUFP(buf,8), mes, len);
+       safestrncpy((char *)WBUFP(buf,8), mes, len);
        clif_send(buf,len+8,&sd->bl,PARTY);
    }
 }
@@ -9673,7 +9673,7 @@
    if( is_atcommand(fd, sd, message, 1)  )
        return;
 
-   if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+   if( sd->sc.cant.chat )
        return;
 
    if( battle_config.min_chat_delay ) { //[Skotlex]
@@ -9994,7 +9994,7 @@
    if ( is_atcommand(fd, sd, message, 1) )
        return;
 
-   if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))
+   if (sd->sc.cant.chat)
        return;
 
    if (battle_config.min_chat_delay) { //[Skotlex]
@@ -11668,7 +11668,7 @@
    if( is_atcommand(fd, sd, message, 1)  )
        return;
 
-   if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+   if( sd->sc.cant.chat )
        return;
 
    if( battle_config.min_chat_delay )
@@ -12213,7 +12213,7 @@
    if( is_atcommand(fd, sd, message, 1) )
        return;
 
-   if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+   if( sd->sc.cant.chat )
        return;
 
    if( battle_config.min_chat_delay )
@@ -14443,7 +14443,6 @@
 }
 #endif
 
-
 /// Adoption System
 ///
 
@@ -15078,7 +15077,7 @@
    if( is_atcommand(fd, sd, message, 1) )
        return;
 
-   if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+   if( sd->sc.cant.chat )
        return;
 
    if( battle_config.min_chat_delay ) {
 
Viewed 1663 times, submitted by lighta.