Jump to content

nitrous

Developer
  • Posts

    141
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by nitrous

  1. To make the automated build work.

    I split the mobdb and mobdrop tables in the database, which requires me to fix this script.

    The first SQL statement should return a list of letters in alphabetical order so that there exists at least one normal monster that drops a card that starts with that letter.

     

  2. Hey guys, looks like I need some help.

    I have 3 tables, mob_db_re, mob_drop_re, and item_db_re.
    mob_drop_re is created with this ddl statement:

    CREATE TABLE `mob_drop_re` (
        `mobid` mediumint(9) unsigned NOT NULL default '0',
        `dtype` smallint(5) unsigned NOT NULL default '0',
        `index` smallint(5) unsigned NOT NULL,
        `nameid` smallint(5) unsigned NOT NULL default '0',
        `rate` smallint(9) unsigned NOT NULL default '0',
        `stealProtected` bool default false,
        `randomOptionGroup` text,
    
        PRIMARY KEY (`mobId`, `dtype`, `index`)
    
    ) ENGINE=MyISAM;

     

    I'm working on the card_seller in npc/custom/card_seller.txt, and I get an error at the first query_sql call. Here's the code:

    OnInit:
        if (checkre(0)) {
            .@mob_db$  = "mob_db_re";
            .@mob_drop$ = "mob_drop_re";
            .@item_db$ = "item_db_re";
        } else {
            .@mob_db$  = "mob_db";
            .@mob_drop$ = "mob_drop";
            .@item_db$ = "item_db";
        }
        freeloop 1;
        .@total = query_sql("SELECT DISTINCT LEFT(`name_japanese`, 1) AS alphabets FROM `"+ .@item_db$ +"` RIGHT JOIN `"+ .@mob_drop$ +"` ON `"+ .@mob_drop$ +"`.`nameid` = `"+ .@item_db$ +"`.`id` RIGHT JOIN `"+.@mob_db$ +"` ON `"+ .@mob_db$ +"`.`ID` = `"+ .@mob_drop$ +"`.`mobid` WHERE `"+ .@item_db$ +"`.`type` = 6 AND `name_english` LIKE '%_Card' AND ~(`MODE`) & 0x4000000 ORDER BY alphabets;", .alphabet$);
        for ( .@i = 0; .@i < .@total; .@i++ ) {
            .alphabet_menu$ = .alphabet_menu$ + .alphabet$[.@i] +" Cards:";
            .@nb = query_sql("SELECT `"+.@item_db$ +"`.`id` FROM `"+ .@item_db$ +"` RIGHT JOIN `"+ .@mob_drop$ +"` ON `"+ .@mob_drop$ +"`.`nameid` = `"+ .@item_db$ +"`.`id` RIGHT JOIN `"+.@mob_db$ +"` ON `"+ .@mob_db$ +"`.`ID` = `"+ .@mob_drop$ +"`.`mobid` WHERE `"+ .@item_db$ +"`.`type` = 6 AND `name_english` LIKE '%_Card' AND ~(`MODE`) & 0x4000000 AND LEFT(`name_japanese`, 1) = '"+ .alphabet$[.@i]+"' GROUP BY `name_japanese` ORDER BY `name_japanese` LIMIT 128;", .@id);
            npcshopdelitem "card_mob#"+ .alphabet$[.@i], 501;
            for ( .@j = 0; .@j < .@nb; .@j++ )
                npcshopadditem "card_mob#"+ .alphabet$[.@i], .@id[.@j], 1000000;
        }
        freeloop 0;
        end;

     

    The script creates a sql statement as so:

     

    SELECT DISTINCT LEFT(`name_japanese`, 1) AS alphabets FROM `item_db_re` RIGHT JOIN `mob_drop_re` ON `mob_drop_re`.`nameid` = `item_db_re`.`id` RIGHT JOIN `mob_db_re` ON `mob_db_re`.`ID` = `mob_drop_re`.`mobid` WHERE `item_db_re`.`type` = 6 AND `name_english` LIKE '%_Card' AND ~(`MODE`) &0x4000000 ORDER BY alphabets;

     

    It works fine on MySQL Workbench, but produces an error when using it in the script:

    [SQL]: DB error - Unknown column 'mob_drop_re.nameid' in 'on clause'
    [Debug]: at script.cpp:16666 - SELECT DISTINCT LEFT(`name_japanese`, 1) AS alpha
    bets FROM `item_db_re` RIGHT JOIN `mob_drop_re` ON `mob_drop_re`.`nameid` = `ite
    m_db_re`.`id` RIGHT JOIN `mob_db_re` ON `mob_db_re`.`ID` = `mob_drop_re`.`mobid`
     WHERE `item_db_re`.`type` = 6 AND `name_english` LIKE '%_Card' AND ~(`MODE`) &
    0x4000000 ORDER BY alphabets;
    [Debug]: Source (NPC): Card Seller at prontera (155,177)

     

    Can anyone help?

  3.  

    [SQL]: DB error - Unknown column 'last_mac' in 'field list'
    [Debug]: at script.cpp:16625 - SELECT `last_mac` FROM `login` WHERE `account_id` = '2000004'
    [Debug]: Source (NPC): Guild Master at prontera (203,135)
    [SQL]: DB error - Unknown column 'last_cpu' in 'field list'
    [Debug]: at script.cpp:16625 - SELECT `last_cpu` FROM `login` WHERE `account_id` = '2000004'
    [Debug]: Source (NPC): Guild Master at prontera (203,135)
    [SQL]: DB error - Unknown column 'last_motherboard' in 'field list'
    [Debug]: at script.cpp:16625 - SELECT `last_motherboard` FROM `login` WHERE `account_id` = '2000004'
    [Debug]: Source (NPC): Guild Master at prontera (203,135)

    These are because you haven't changed your login table to have `last_mac`, `last_cpu`, `last_motherboard`.

    [SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `guild_package` WHERE `acc_id` = '2000004'' at line 1
    [Debug]: at script.cpp:16625 - SELECT FROM `guild_package` WHERE `acc_id` = '2000004'
    [Debug]: Source (NPC): Guild Master at prontera (203,135)
    [SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `guild_package` WHERE `claim_ip` = '180'' at line 1
    [Debug]: at script.cpp:16625 - SELECT FROM `guild_package` WHERE `claim_ip` = '180'
    [Debug]: Source (NPC): Guild Master at prontera (203,135)

    These are because your SQL syntax is wrong. You need to use `SELECT *  FROM blahblahblah`

  4. When someone quits the game, the socket closes with EOF. This gets parsed in logclif_parse(login server), chclif_parse(char server), and clif_parse(map server).

    In the login server, when it reads EOF it just closes the socket.

    In the char server, if a character is already loaded, it might set the character offline, thereby saving the changes.

    In the map server, depending on how the client quits, it will either use map_quit, use clif_quitsave which calls map_quit, or nothing (in the case of autotrading).

    • MVP 1
  5. It can be done through source edits/additions.

    You would need to create a new timer function and make it trigger 5 minutes before the spawn of the monster. That function will send the announcement that the monster will spawn.

    In mob_setdelayspawn, you will have to check if the mob is an MvP, then call add_timer with the current tick of the server + spawn time - 5 minutes.

  6. This is the part of the code that's the problem:

    struct instance_db *db = instance_searchname_db(name);
    
    nullpo_retr(-1, db);

    The name you pass into instance_create is not being found in the instance database.

    EDIT: Looking further into this, the entry in instance_db.txt is incorrect. The correct format is:

    // ID,Name,LimitTime,IdleTimeOut,EnterMap,EnterX,EnterY,Map2,Map3,...,Map255

     

    • Upvote 2
  7. On 7/20/2017 at 11:36 AM, whodhell said:

     

    
    		case 2:
    			query_sql("SELECT `guild_id`, `gcode`,`status` FROM `gpack_code` ORDER BY `status` DESC",.@glist,.@codeview$,.@stts);
    			dispbottom "Status | GPack Code";
    			for(set @ei,0; @ei < getarraysize(.@codeview$); set @ei,@ei + 1){
    				query_sql("`SELECT `name` FROM `guild` WHERE `guild_id` = '"+.@glist[@ei]+"'",.@gn$);
    				dispbottom ""+.@stts[@ei]+" | "+.@codeview$[@ei]+"  |  "+.@gn$+"";
    			}
    			close;
    			break;

     

     

×
×
  • Create New...