Jump to content

darkmeistersp

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by darkmeistersp

  1. This is a simply but usefull mod. I use it to do a kind of quest mode. With this modification the players of your server will stop gaining exp at a certain level. You can level up the players with a script or with the @lvup command!

    Go to src/map/pc.c and find:

    if(!battle_config.pvp_exp && map[sd->bl.m].flag.pvp)  // [MouseJstr]
    return 0; // no exp on pvp maps

    Add below it:

    if(sd->status.base_level > 119)
    return 0; // Modo Quest [darkmeistersp]

    In this example, all the players above level 120 will not gain exp when they kill monsters, do quests...

    How to level up a player via NPC?

    Just do a normal Quest NPC and add this line at the end of the quest:

    atcommand strcharinfo(0)+"@lvup 1";
    close;
    

  2. Hi! With this little script you´ll be able to enable commands on the players who log in to your server.

    prontera,155,175,0 script NPC -1,{
    close;
    OnPCLoginEvent:
    	atcommand strcharinfo(0)+"@main on";
    	atcommand strcharinfo(0)+"@autoloot",
    	atcommand strcharinfo(0)+"@showexp",
    close;
    }
    

    The code above is an example. You can add the commands you want!

  3. I updated the guide with one more step.

    uhm is there a way to modify this so that only ppl with fid=1 ( sql column on login table ) can only read the msg and if they're not on the same fid they cannot use it thnx again

    Why don´t you simply change the GM level for the command in atcommand_athena to a level you want and give this GM level to the players?

  4. With this modification you will have a new chat, like @main for another purposes. In this example I use @trading as an example.

    1 -> Open src/map/atcommand.c and find:

     if(sd->state.mainchat)
      clif_displaymessage(fd, msg_txt(384)); // Main chat currently enabled. Usage: @main <on|off>, @main <message>.
     else
      clif_displaymessage(fd, msg_txt(385)); // Main chat currently disabled. Usage: @main <on|off>, @main <message>.
    }
    return 0;
    }
    

    Add below it:

    /*===================================
    * Trading chat chat [darkmeistersp]
    * Usage: @trading <on|off|message>
    *-----------------------------------*/
    ACMD_FUNC(trading)
    {
    if( message[0] ) {
     if(strcmpi(message, "on") == 0) {
      if(!sd->state.tradingchat) {
    sd->state.tradingchat = 1;
    clif_displaymessage(fd, msg_txt(950)); // trading chat has been activated.
      } else {
    clif_displaymessage(fd, msg_txt(951)); // trading chat already activated.
      }
     } else if(strcmpi(message, "off") == 0) {
      if(sd->state.tradingchat) {
    sd->state.tradingchat = 0;
    clif_displaymessage(fd, msg_txt(952)); // trading chat has been disabled.
      } else {
    clif_displaymessage(fd, msg_txt(953)); // trading chat already disabled.
      }
     } else {
      if(!sd->state.tradingchat) {
    sd->state.tradingchat = 1;
    clif_displaymessage(fd, msg_txt(950)); // trading chat has been activated.
      }
      if (sd->sc.data[sC_NOCHAT] && sd->sc.data[sC_NOCHAT]->val1&MANNER_NOCHAT) {
    clif_displaymessage(fd, msg_txt(957));
    return -1;
      }
      sprintf(atcmd_output, msg_txt(956), sd->status.name, message);
      // I use 0xFE000000 color for signalizing that this message is
      // trading chat message. 0xFE000000 is invalid color, same using
      // 0xFF000000 for simple (not colored) GM messages. [LuzZza]
      intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, 0xFE000000, 0, 0, 0, 0);
     }
    
    } else {
    
     if(sd->state.tradingchat)
      clif_displaymessage(fd, msg_txt(954)); // trading chat currently enabled. Usage: @trading <on|off>, @trading <message>.
     else
      clif_displaymessage(fd, msg_txt(955)); // trading chat currently disabled. Usage: @trading <on|off>, @trading <message>.
    }
    return 0;
    }
    

    Then you need to find this:

    { "font",			   1,1,	  atcommand_font },
    

    And add below it:

    { "trading",			1,1,	  atcommand_trading }, //[darkmeistersp]
    

    Save this file.

    2-> Open src/map/clif.c and find:

    case CHAT_MAINCHAT: //[LuzZza]
     iter = mapit_getallusers();
     while( (tsd = (TBL_PC*)mapit_next(iter)) != NULL )
     {
      if( tsd->state.mainchat && tsd->chatID == 0 && packet_db[tsd->packet_ver][RBUFW(buf,0)].len )
      { // packet must exist for the client version
    WFIFOHEAD(tsd->fd, len);
    memcpy(WFIFOP(tsd->fd,0), buf, len);
    WFIFOSET(tsd->fd,len);
      }
     }
     mapit_free(iter);
     break;
    

    Add below it:

    case CHAT_TRADINGCHAT: //[darkmeistersp]
     iter = mapit_getallusers();
     while( (tsd = (TBL_PC*)mapit_next(iter)) != NULL )
     {
      if( tsd->state.tradingchat && tsd->chatID == 0 && packet_db[tsd->packet_ver][RBUFW(buf,0)].len )
      { // packet must exist for the client version
    WFIFOHEAD(tsd->fd, len);
    memcpy(WFIFOP(tsd->fd,0), buf, len);
    WFIFOSET(tsd->fd,len);
      }
     }
     mapit_free(iter);
     break;
    

    Now find this in the same file:

    WBUFW(buf,0)=0x8d;
    WBUFW(buf,2)=len+8;
    WBUFL(buf,4)=0;
    safestrncpy((char *) WBUFP(buf,8),message,len);
    clif_send(buf,WBUFW(buf,2),NULL,CHAT_MAINCHAT);
    }
    

    And add below it:

    /*==========================================
    * Send trading chat message [darkmeistersp]
    *------------------------------------------*/
    void clif_TradingChatMessage(const char* message)
    {
    char buf[200];
    int len;
    
    if(!message)
     return;
    
    len = strlen(message)+1;
    if (len+8 > sizeof(buf)) {
     ShowDebug("clif_TradingChatMessage: Received message too long (len %d): %sn", len, message);
     len = sizeof(buf)-8;
    }
    WBUFW(buf,0)=0x8d;
    WBUFW(buf,2)=len+8;
    WBUFL(buf,4)=0;
    strncpy((char *) WBUFP(buf,8),message,len);
    clif_send((unsigned char *) buf,WBUFW(buf,2),NULL,CHAT_TRADINGCHAT);
    }
    

    Now find the next code:

     // Chat logging type 'M' / Main Chat
     if( log_config.chat&1 || (log_config.chat&32 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
      log_chat("M", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
     return;
    }
    

    And add below it:

    // Trading chat [darkmeistersp]
    if(strcmpi(target, trading_chat_nick) == 0)
    {
     if(!sd->state.tradingchat)
      clif_displaymessage(fd, msg_txt(958)); // You should enable trading chat with "@trading on" command.
     else {
      char output[256];
      snprintf(output, ARRAYLENGTH(output), msg_txt(956), sd->status.name, message);
      intif_broadcast2(output, strlen(output) + 1, 0xFE000000, 0, 0, 0, 0);
     }
    }
    

    Save this file.

    3-> Open src/map/clif.h and find this:

    CHAT_MAINCHAT,  // everyone on main chat
    

    Add below it:

    CHAT_TRADINGCHAT, //[darkmeistersp]
    

    In the same file find this line:

    void clif_MainChatMessage(const char* message); //luzza

    And add below it:

    void clif_TradingChatMessage(const char* message); //[darkmeistersp]

    Save this file.

    4-> Open src/map/map.c and find this:

    char main_chat_nick[16] = "Main";

    Add below this:

    char trading_chat_nick[16] = "Trading"; //[darkmeistersp]

    In the same file find:

    if(strcmpi(w1, "main_chat_nick")==0)
    safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick));

    And add below it:

    if(strcmpi(w1, "trading_chat_nick")==0) //[darkmeistersp]
    safestrncpy(trading_chat_nick, w2, sizeof(trading_chat_nick));

    Save this file.

    5 -> Now open src/map/map.h and find:

    extern char main_chat_nick[16];

    Add below it:

    extern char trading_chat_nick[16]; //[darkmeistersp]

    Save this file

    6 -> Open src/map/pc.h and find:

    unsigned int mainchat :1; //[LuzZza]

    And add below it:

    unsigned int tradingchat :1; //[darkmeistersp]

    Save this file.

    7 -> Open src/char/char.c and find:

     // check for reserved names
    
    if( strcmpi(name, main_chat_nick) == 0 || strcmpi(name, wisp_server_name) == 0 )
    	return -1; // nick reserved for internal server messages

    Replace it with:

    
    // check for reserved names
    if( strcmpi(name, main_chat_nick) == 0 || strcmpi(name, wisp_server_name) == 0 || strcmpi(name, trading_chat_nick) == 0) //[darkmeistersp]
    return -1; // nick reserved for internal server messages

    Save this file.

    8-> Open src/char/inter.c and find:

    char main_chat_nick[16] = "Main";

    Add below it:

    char trading_chat_nick[16] = "Trading"; //[darkmeistersp]

    Now find this in the same file:

    } else if(strcmpi(w1, "main_chat_nick")==0){ // Main chat nick [LuzZza]
    safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick));

    And add below it:

    } else if(strcmpi(w1, "trading_chat_nick")==0){ // trading chat nick [darkmeistersp]
    safestrncpy(trading_chat_nick, w2, sizeof(trading_chat_nick));

    Save this file.

    9-> Open src/char/inter.h and find:

    ​extern char main_chat_nick[16];

    Add below it:

    extern char trading_chat_nick[16]; //[darkmeistersp]

    Save this file.

    10-> Repeat the steps 7, 8 and 9 with the files char.c, inter.c and inter.h that are located in src/char_sql/

    11-> Open conf/msg_athena.conf and add at the end of the file:

    950: Trading chat has been activated.
    951: Trading chat already activated.
    952: Trading chat has been disabled.
    953: Trading chat already disabled.
    954: Trading chat is currently enabled. Usage: @trading <on|off>, @trading <message>.
    955: Trading chat is currently disabled. Usage: @trading <on|off>, @trading <message>.
    956: %s :Trading: %s
    957: You cannot use Trading chat while muted.
    958: You should enable trading chat with "@trading on" command.

    Save this file.

    12 -> Open conf/inter_athena.conf and find this:

    // Nick for sending mainchat
    // messages like whisper
    main_chat_nick: Main

    Add below it:

    // Nick trading chat [darkmeisterp]
    sell_chat_nick: trading

    Save this file.

    13 -> Open conf/atcommand_athena.conf and add at the end of the file:

    //Trading chat
    trading: 1,1
    

    screenDualRO041.jpg

    That´s all. Now you must compile your server and your new chat is ready! /oh

    Here you have the diff for this mod. Enjoy it!

    newchat.patch

    • Upvote 5
  5. With this modification you will be able to stop the HP and SP bonus at the level you want. It is a simple and quick edit.

    For the HP bonus open src/map/status.c and find this:

    static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct status_data* status)
    {
    unsigned int val = pc_class2idx(sd->status.class_);
    val = 35 + sd->status.base_level*hp_coefficient2[val]/100 + hp_sigma_val[val][sd->status.base_level];
    

    And now change this code to:

    static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct status_data* status)
    {
    unsigned int val = pc_class2idx(sd->status.class_);
    if (sd->status.base_level<99){
    val = 35 + sd->status.base_level*hp_coefficient2[val]/100 + hp_sigma_val[val][sd->status.base_level];
    }else{
    val = 35 + 99*hp_coefficient2[val]/100 + hp_sigma_val[val][99];
    }
    

    In this example I stopped the bonus at level 99, so if you want to change it to the level you want just change the 99 values for the level you want.

    For the SP bonus you must find this in the same file:

    static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *status)
    {
    unsigned int val;
    val = 10 + sd->status.base_level*sp_coefficient[pc_class2idx(sd->status.class_)]/100;
    val += val * status->int_/100;
    

    And now change this code to:

    static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *status)
    {
    unsigned int val;
    if (sd->status.base_level<99){
    val = 10 + sd->status.base_level*sp_coefficient[pc_class2idx(sd->status.class_)]/100;
    }else{
    val = 10 + 99*sp_coefficient[pc_class2idx(sd->status.class_)]/100;
    }
    val += val * status->int_/100;
    

    I used level 99 as an example, so if you want to change the level just change the 99 values to whatever you want.

    • Upvote 1
  6. I see now the official Spanish Section is DivineRO, I don´t have nothing wrong with DivineRO, but not all the Spanish Moderators have taken part in this change. I know is better because DivineRO is more active than the old Spanish Section of eAthena, but no one have asked the Spanish Moderators if wee agree with this change :) Now i´m not moderator anymore XD. Do whatever you think is better to the community.

  7. The critical formula is located on status.c. I think you are looking for this:

    case BL_MOB:
     if(battle_config.mob_critical_rate != 100)
      status->cri = status->cri*battle_config.mob_critical_rate/100;
     if(!status->cri && battle_config.mob_critical_rate)
     status->cri = 10;
     break;
    case BL_PC:
     //Players don't have a critical adjustment setting as of yet.
     break;
    default:
     if(battle_config.critical_rate != 100)
      status->cri = status->cri*battle_config.critical_rate/100;
     if (!status->cri && battle_config.critical_rate)
      status->cri = 10;
    }
    

    The formula for players starts when it says default:

    It is located in the status_calc_misc function.

×
×
  • Create New...