Jump to content

IndieRO

Members
  • Content Count

    286
  • Joined

  • Last visited

  • Days Won

    13

Reputation Activity

  1. Upvote
    IndieRO reacted to Yommy in I miss Ind :'(   
    If you read this, please email or message me.
    I miss you lots
    <3
  2. Upvote
    IndieRO reacted to Kyoya G in Tictac with required zeny   
    Try this:
    If you got any problem just tell me here.
  3. Upvote
    IndieRO got a reaction from w0wZukuBg in LATEST FULL KRO CLIENT?   
    HERE
  4. Upvote
    IndieRO reacted to w0wZukuBg in [w0w] Xpalace   
    Xpalace

    File Name: prtbar
    File Submitter: w0wZukuBg
    File Submitted: 17 June 2018
    File Category: Maps & Textures
    Download Link: Click here to download
     
  5. Upvote
    IndieRO reacted to Rytech in r853 - Job Restriction System / Doram Style/Dye Ranges / Number of Bug Fixes   
    =General
    *Added ranges of styles/dyes for Doram's.
    -This is a range seprate from the regular ones since Doram's officially have a
    -different set number of hair styles and cloth dyes. As of 2018-06-05 they have
    -6 hair styles, 8 hair dyes, and no cloth dyes (tho kRO says their will be a few
    -added soon).
    *min_doram_hair_style
    *max_doram_hair_style
    *min_doram_hair_color
    *max_doram_hair_color
    *min_doram_cloth_color
    *max_doram_cloth_color
    +Added these configs to the client config file.
    -These are a seprate set of style/dye ranges for Doram characters.
    -This is needed since they have different maxes from humans.
    *Updated a few commands to pickup on the style/dye ranges for Doram characters.
    *Updated default setting for "max_hair_style" to 29.
    *Corrected default setting for "max_hair_color" to 8.
    *clif_spiritball_single
    *clif_soulball_single
    +Changed the packet these functions use to 0x1d0 (ZC_SPIRITS).
    -This change fixes a issue where Rebellion's Coin sphere's and Soul Reaper's
    -Soul Energy sphere's would look like regular spirit sphere's when the player
    -warps to another map, refreshes, and also appear as spirit sphere's to other
    -players who walk into view range of the one with the spheres.
    -It also fixes a issue where the sphere's may not vanish properly from view
    -when the player dies.
    *Added job restriction system.
    +This allows setting restrictions to different jobs that prevent's them from
    -entering certain maps. Attempts of entering a map as a banned job will just
    -result in no warpping. Basicly, something as simple as walking into a regular
    -map warp won't do anything if the player's job is banned from entering the map.
    -This works for teleporting, warping, any warp commands, walking into NPC warp,
    -put something else here and it will likely fail as well.
    -Should a player playing a job banned from that map somehow login on that map,
    -the player will be warped out into Prontera's graveyard behind the church.
    -These restrictions can be set in the "job_notallowed" database file.
    *Added a missing timer function list entry for the soul energy system.
     
    =Database
    *Updated const file to support detection of new style/dye ranges for Doram
    -characters in NPC scripts.
    *Added the "job_notallowed" file.
    -This file is used to set jobs that are banned from entering certain maps.
    -It basicly works just like item_noequip and skill_nocast_db.
    *Rebuilt the map cache.
    -This is due to prontera being reverted back to the original version.
     
    =NPC
    *Updated the 3CeAM super stylist to detect the ranges of styles/dyes for Doram
    -character's.
     
    =Skills
    *RL_MASS_SPIRAL
    +Fixed a issue where the skill would deal extremely high damage on targets with
    -negeative DEF.
  6. Upvote
    IndieRO reacted to Rytech in 3CeAM-Flux r6 - Star Emperor and Soul Reaper Support   
    =Update Notes
    *Added support for Star Emperor and Soul Reaper jobs.
  7. Upvote
    IndieRO reacted to bWolfie in [Idea] BUILDIN(getplayerdata) - feedback needed   
    Hi all,
    For the longest time I've been creating custom script commands simply so I can read a value from struct map_session_data{}. For example, I wanted to return the value of sd->state.showzeny, so I created a simple buildin just for that purpose.It would go something like this:
     
    BUILDIN(read_showzeny) {     struct map_session_data *sd =  script->rid2sd(st);     if (sd != NULL)         script_pushint(st, sd->state.showzeny);     else         script_pushint(st, -1);     return true; } Seems not bad, right? But then it got me thinking. I'm creating all these script commands for one simple action. Surely there's a better way? That's when I stumbled across the getunitdata() command.
    Then it came to me - create a script command which can fetch this data for a player.
    The Goal
    Create a script command which can fetch the data which map_session_data provides. It would work similar to getunitdata():
    *getplayerdata(<account id>, <DataType>{,<Variable>})
    Maybe also setplayerdata()?
    Helped needed: The one thing is, not all the stuff in there is useful. Maybe it would be best to selectively choose what can be retrieved as data? I made a list for this stuff. Let me know what you think.
     
  8. Upvote
    IndieRO got a reaction from Kiel in LATEST FULL KRO CLIENT?   
    yes, just patch it
    no problem
     
  9. Upvote
    IndieRO got a reaction from Kiel in LATEST FULL KRO CLIENT?   
    HERE
  10. Upvote
    IndieRO reacted to AnnieRuru in [AutoEvent] Trivia   
    function GetQuestion { return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]"); } function GetAnswer { return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]"); } function GetHint { return getd(".hint_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]"); } I believe you made it opposite ?
    assuming that you are still using eathena, when script engine was still 128 elements
    it should be
    return getd(".question_" + (getarg(0) / 128) + "$[" + (getarg(0) % 128) + "]"); although there is no need to do like this anymore because our script engine no longer has such limitation
    2nd thing is ...
    L_loop: do set .@i, rand( .numQuestions ); // Randomly picks a fact. while( .Q_session & 1 << .@i && .Q_session && .count < .numQuestions ); set .Q_session, .Q_session | 1 << .@i;// max 32 questions rather than using a loop, can use shuffle algorithm
     
    EDIT: for below
     
  11. Upvote
    IndieRO reacted to Begin in Modify reward script   
    Hi All,
    May I request for a Hourly Point NPC with a Target Hours before you get the reward?
    There is a menu with Start, Stop and Pause button for logging out/offline purpose.
    I already tried my best to edit a hourlypoint script but I failed.
    Thanks in advance!
    ---Solved. Already found it. Sorry for not patiently testing all the topics that I saw.

    Hi All,
    Can you help me edit this script? Need to change the settings. You must not get the reward once you talked. You must only get the reward if you only reached the target time.
    In the photo attached, I talked to NPC in the first time and the NPC already gave the reward. I want if possible, you will only get the reward when you stayed online for 5 hours straight without logging out/disconnect/offline.
    Also a menu with Start, Stop and Pause for a player if he will logout of the game.
    Thank you.

     
    prontera,155,160,5 script Reward NPC 4_F_FAIRYKID4,{ .@npc_name$ = "[P NPC]"; for (.@i = 0; .@i < getarraysize($ip_reward$); .@i+=2) { if ($ip_reward$[.@i] != getcharip()) continue; .@delays = atoi($ip_reward$[.@i+1]) + .delay; if (.@delays > gettimetick(2)) { mes .@npc_name$; mes "Do you want a surprise item from me?"; mes "You have to wait for "+callfunc("Time2Str", .@delays); mes "To claim the reward!"; close; } .@index = .@i+1; break; } mes .@npc_name$; mes "Hello "+strcharinfo(0)+",I"; mes "am here to give you a daily"; mes "Surprise Reward. Do you want to have it?"; next; switch (select("-Yes, sure!:-No, bye!:-Cancel")) { case 1: mes .@npc_name$; for (.@j = 0; .@j < getarraysize(.reward); .@j+=2) getitem .reward[.@j], .reward[.@j+1]; mes "Okay have fun with it!"; if (.@index) $ip_reward$[.@index] = gettimetick(2); else { .@index = getarraysize($ip_reward$); $ip_reward$[.@index] = getcharip(); $ip_reward$[.@index+1] = gettimetick(2); } close; default: mes .@npc_name$; mes "Okay goodbye!"; close; } OnInit: setarray .reward, 601, 1; // <item id>, <item amount>{, <item id>, <item amount>,...} .delay = 60; // Delay time before reward can be re-claimed. time set in second, default 24 Hours = 86400 seconds end; }  
  12. Upvote
    IndieRO reacted to Cabrera in [Release] 2018 Clients translated tipbox   
    Hello everyone, I present to you a modified tip box which has been completely translated to English. 
    Tested on: 2018-04-04c RagexeRE and worked like a charm.
    In your System folder in Client side, replace your tipbox.lub with my translated tipbox i have attached below:
    tipbox.lub
    Then, Patch your client with whatever settings you want and then open the patched client in hexeditor ( I used XV132 for this)
    IMPORTANT NOTE : Make sure you hex a "patched" client. DO NOT do it on an unpatched client or else NEMO will show errors for random "recommended patches" that you select while patching it.
    Find the following and replace with hex for english translation : for checkbox: BD C3 C0 DB C7 D2 20 B6 A7 20 BF AD B1 E2 English translation: 53 61 76 65 20 54 69 70 3F 20 20 20 20 20 for close button : B4 DD B1 E2 English translation : 44 6F 6E 65 (korean translation of close has only 4 strings so I had to replace it with "Done" to match the string size -_-) OR go to your NEMO folder/patches/TranslateClient.txt and add this at the end of it then patch your clients: (Thanks to @Asheraf for telling me about this xD)
    M: Translate Tip box ------------------------------ F: BD C3 C0 DB C7 D2 20 B6 A7 20 BF AD B1 E2 R: 'Save Tip?' F: B4 DD B1 E2 R: 'Done' if you did everything as said, this will be your result :
    Old tip box:

    New translated tipbox:
     

     
    -- On a funny Note, I had no clue what the korean translation for the Check box was LOL so I just randomly translated it to "Save tip?" instead cuz it was a logical solution LMAO 
  13. Upvote
    IndieRO reacted to luizragna in Script command execute for all players in the map   
    Thank you, guys!
     
    The full script:
    universe,40,40,4 script Tester#OP 4_M_REINDEER,{ .@count = getunits(BL_PC, .@units, false, "universe"); // Adds all BL_PC on prontera type to the array .@units for (.@i = 0; .@i < .@count; .@i++) addtimer(0, "Tester#OP::OnMyEvent", .@units[.@i]); end; OnMyEvent: mes "Hello"; close; }  
  14. Upvote
    IndieRO reacted to bWolfie in [Guide] Mapcache Generation 2018   
    As of Release v2018.03.13, the method to generate mapcache for Hercules has changed. A lot of people. myself included, were confused as to how it works. In this thread, I will do my best to explain the new way to generate your cache. This guide is intended to help people using the old system, not to aid new people (i.e. never generated mapcache before), so if you are new, some of it may seem like alien talk.
    Old (your source predates [is older than] Feb 18, 2018)
    In the old system, there were two ways to generate mapcache
    You could run the mapcache executable in Hercules root folder. Or use a program such as WeeMapCache to edit in your required mapcache. These two methods would generate or alter your required mapcache located in db/[pre-re or re]/map_cache.dat. However, they are no longer supported.
    New (your source is using Release v2018.03.13 or newer)
    The new system involves the use of the new 'mapcache' plugin to generate files. Some quick points:
    db/[pre-re or re]/map_cache.dat has been dropped (no longer supported). In its place are individual .mcache files for every map located in maps/[pre-re or re]/ Mapcache executable has been removed. Replaced with the mapcache plugin (src/plugins/mapcache.c). How to generate the mapcache?
    Same as before, check conf/map/maps.conf and db/map_index.txt have all the maps you want to cache. Your maps need to exist somewhere in your repository! There are two ways for the plugin to find them:
    a. Place all your maps, including resnametable.txt, inside the data folder of your Hercules repo. I.e. Hercules/data/prontera.gat/gnd/gnd/rsw (note: I forget if all three files are needed).
    b. OR Configure your conf/grf-files.txt to tell it where to find your GRF(s) which contains your maps. Build the mapcache plugin. On linux, this can be done by running the following command:
    make plugin.mapcache
    If using MSVC, compile as you would any other plugin. Execute plugin. This can be done using the following command:
    ./map-server --load-plugin mapcache [param]
    In windows, just remove the './' and run the commands in your command prompt. The params:
    The first thing you should do is run
    ./map-server --load-plugin mapcache --help
    A list of usable parameters will appear. Here are the ones you need to know for mapcache:
    [Info]:   --convert-old-mapcache         Converts an old db/pre-re/map_cache.dat file to the new format. [Mapcache] [Info]:   --rebuild-mapcache             Rebuilds the entire mapcache folder (maps/pre-re/), using db/map_index.txt as index. [Mapcache] [Info]:   --map <name>                   Rebuilds an individual map's cache into maps/pre-re/ (usage: --map <map_name_without_extension>). [Mapcache] [Info]:   --fix-md5                      Updates the checksum for the files in maps/pre-re/, using db/map_index.txt as index (see PR #1981). [Mapcache] ./map-server --load-plugin mapcache --convert-old-mapcache
    Rebuild all the .mcache files using your old db/[pre-re or re]map_cache.dat file.
    NOTE: You should only run this command when you have an old map_cache.dat file you need to convert.
    ./map-server --load-plugin mapcache --rebuild-mapcache
    Rebuild all the .mcache files using your map files specified in step 2 of generation.
    NOTE: You should only run this command in special circumstances. This erases ALL the existing mapcache and rebuilds it with whatever files you provide it. If you don't have the required files, the build will fail and you will be left with missing mapcache files, meaning you won't be able to access those particular maps.
    ./map-server --load-plugin mapcache --map <name>
    Rebuild the .mcache file for the map name you specify. E.g. if you replace <name> with prontera, the maps/[pre-re or re]/prontera.mcache file will be rebuilt.
    NOTE: This is the best command to run, as it only caches a single map at a time.
    ./map-server --load-plugin mapcache --fix-md5
    I don't know what checksum is for.
    The End
    Feel free to ask for help here. I'll try to answer questions re: mapcache if possible. And if you think anything needs correcting or added, let me know.
    Hope this helps!
  15. Upvote
    IndieRO reacted to Rytech in r846 - Kagerou/Oboro Skill Revisit (Updates And Bug Fixes)   
    =General
    *This is the revisiting of the Kagerou/Oboro skills to bug fix and update the skills for them.
    *Cleaned up and optomized some code.
     
    =Skills
    *Kagerou/Oboro
    +Fixed a issue where none of the skill cast times were interruptable.
    *KO_HAPPOKUNAI (Spray Kunai)
    +Recoded the skill.
    +Damage is now ranged physical. Basicly a stronger version of Throw Kunai.
    *KO_MUCHANAGE (Over Throw)
    +Recoded the skill.
    +Damage is no longer reduced in GvG/BG areas.
    +Damage is no longer reduced by half on enemy players.
    +Success chance of hitting is now seprate for each enemy target.
    +Damage is now divided between enemys detected in AoE.
    -This means its divided based on the number of enemy's detected in the AoE
    -and not by the number of enemys hit.
    *KO_HUUMARANKA (Launch Huuma Shuriken)
    +Damage no longer split between targets.
    *KO_MAKIBISHI (Makibishi)
    +Recoded the skill.
    +Fixed a issue where it didn't follow the rules of AoE placement.
    +No longer ignores elemental adjustments.
    +No longer stacks on top of each other.
    +Stun duration is now fixed and can't be reduced.
    +Now places the proper number of makibishi depending on skill level used.
    *KO_MEIKYOUSISUI (Clear Meditation)
    +Recoded the skill.
    +Skill now makes the caster sit when the status starts. If the caster stands up
    -at will or gets forced to stand up, the status will end. This also prevent's
    -the caster from being able to move or use any skills while active due to sitting.
    +Now has a chance of making any attack completely miss the caster while active.
    +Now removes a single debuff by random on use. The following can be removed....
    -Poison / Curse / Silence / Blind / Fear / Burning / Frost / Crystalize.
    +This behavior is official according to zone scans but a bug does exist on official
    -where the skill use animation would stop the caster from sitting, allowing
    -exploiting of skill uses. I coded it to prevent this issue from happening.
    *KO_KYOUGAKU (Illusion - Shock)
    +Recoded the skill.
    +Now has a success chance reduceable by the target's INT.
    +Duration is now reduceable by the target's INT.
    +Now only usable in GvG and Battleground maps and on enemy players only.
    +Will now fail if used on a target already affected by this skill.
    +Affected target can no longer switch or unequip equips.
    *KO_JYUSATSU (Illusion - Killing Curse)
    +Now only usable on enemy players.
    +Now reduces the affected target's current HP if the chance of curse is successful.
    *KO_ZENKAI (Spread Seals)
    +Can no longer be stacked on top of each other.
    +Random status chance is now applied every second.
    +Random status success chance is now 100%, but is reduceable by stats and equips.
    +Durations of the random status's is now set to their original defaults.
    +Friendly player's standing in the AoE will now get a WATK increase if the weapon
    -element is the same as the AoE's element.
    *KO_IZAYOI (16th Night)
    +Updated the MATK increase formula.
    +Corrected the animation handling.
    *KG_KAGEHUMI (Shadow Hold)
    +Corrected the animation handling.
    +Fixed a issue where affected player's didn't stop moving.
    +Affected targets will not beable to use the following skills for the duration...
    -Hiding / Cloaking / Cloaking Exceed / Camouflage / Shadow Form / Dark Cloud
    -Also blocks the use of any teleporting methods including fly/butterfly wings.
  16. Upvote
    IndieRO reacted to Rytech in 3CeAM SVN/GIT And Group   
    3CeAM has both a SVN and a GIT you can access. There's also a group if interested in joining. Below are links to the different sites....
     
    Note: This project emu uses pre-renewal (classic) game mechanics. THIS IS NOT A FULL RENEWAL PROJECT!!!
     
    3CeAM SVN At SourceForge
    https://sourceforge.net/projects/v1-3ceam/
     
    3CeAM-Flux Control Panel
    https://sourceforge.net/projects/v1-3ceam-flux/
     
    3CeAM GIT At GitHub
    https://github.com/3CeAM/3CeAM
     
    3CeAM Group At Facebook
    https://www.facebook.com/groups/3CeAM/
     
    3CeAM Discord
    https://discord.gg/R3c3FwN
  17. Upvote
    IndieRO reacted to Rytech in r845 - Max Level And Stats Increase For Players And Homunculus / Bonus Stat From Job Levels Updated   
    =General
    *Added the "load_custom_exp_tables" config setting in the exp battle file.
    +This sets if the server should load the official exp tables (exp.txt) or custom
    -exp tables (exp2.txt). No more do you have to rename the exp2 file to exp to use it.
    *The "use_renewal_statpoints" config is renamed to "renewal_stats_handling".
    +The function of the config is still the same. Just want to name to better reflect
    -what it does. It is also now on by default for balance reasons. Read the
    -description for the config for more info on what all it does.
    *The following battle config settings defaults are changed....
    +max_homunculus_parameter: Changed from 150 to 175.
    +max_aspd_renewal_jobs: Changed from 190 to 193.
    +max_parameter_renewal_jobs: Changed from 120 to 130.
    +max_baby_parameter_renewal_jobs: Changed from 108 to 117.
    +base_lv_skill_effect_limit: Changed from 150 to 175.
    +job_lv_skill_effect_limit: Changed from 50 to 60.
    -These are the latest official limits for players (RE Era Jobs) and homunculus.
     
    =Database
    *Updated the exp_homun file with official exp tables for up to level 175.
    *Updated the statpoint_renewal file with official stat point values for levels
    -up to 175.
     
    =Jobs
    *Renewal Era Jobs (Jobs introduced during RE era)
    +The following caps have been increased....
    -Base Level: 175
    -Job Level: 60 (Except for Summoners)
    -Max Base Stats: 130 (117 for Babys)
    -Max ASPD: 193
    +Stat bonuses for job levels 51 to 60 have been added.
     
    =Homunculus
    *Mutated Homunculus
    +The following caps have been increased....
    -Base Level: 175
    -Max Stats: 175
    *Fixed a issue where mutated homunculus were getting a extra skill point.
  18. Upvote
    IndieRO reacted to bWolfie in How to convert pet_db2.txt   
    Locate to tools folder where it's located and run
    ./petdbconverter.py pre-re ../ ../db/pet_db2.txt > pet_db2.conf
    should generate conf file in the tools folder
    change pre-re to re if renewal
  19. Upvote
    IndieRO reacted to AnnieRuru in Advance SQL commands   
    1. When to use escape_sql script command
     
    .
    input .@haha$; dispbottom .@haha$; dispbottom escape_sql(.@haha$); it doesn't has much differences, because it only affect 3 special characters
    ' <- single quotation mark
    " <- double quotation mark
    \ <- left slash
    if I input -> haha"lala'hehe <-
    it will return -> haha\"lala\'hehe <-
    this is what we call, Escape a character
    in hercules script, we also know we can use " symbol in any string input
    mes "Susan says :\" Today I ate 3 eggs \"."; where in the game client, you can see the " symbol in the npc msg box
    let's say I have a sql script like this
    prontera,153,171,5 script Show Characters 1_F_MARIA,{ mes "input name, I'll show you all characters name it has on that player's account"; input .@name$; .@nb = query_sql("SELECT `char_id`, `name` FROM `char` WHERE `name` LIKE '"+ .@name$ +"'", .@cid, .@name$); if ( !.@nb ) { mes "no result"; close; } for ( .@i = 0; .@i < .@nb; ++.@i ) mes .@cid[.@i] +" "+ .@name$[.@i]; close; } this script has a possibility to be hacked
    because to perform sql injection, I can enclose the string with quotation mark, then use another sql command to hack
    BUT with an escape_sql command, if the user want to enclose the string with quotation mark to hack the script
    the escape_sql command escaped the string, the quotation mark the user input will be escaped
    thus the script will become impossible to hack
    just now that script was for string input
    prontera,153,171,5 script Show Characters 1_F_MARIA,{ mes "input account ID, I'll show you all characters name it has on that player's account"; input .@aid$; .@nb = query_sql("SELECT `char_id`, `name` FROM `char` WHERE `account_id` = "+ escape_sql(.@aid$), .@cid, .@name$); if ( !.@nb ) { mes "no result"; close; } for ( .@i = 0; .@i < .@nb; ++.@i ) mes .@cid[.@i] +" "+ .@name$[.@i]; close; } this is another stupid case.
    1. the scripter use string input while the script just needed a number
    2. even with escape_sql command over there, there is no quotation mark at all
    yes this script also has a risk to be hack
    because escape_sql only escape quotation mark.
    that hacker don't even have to input quotation mark because it is a number
    and an injection query can be sent without any quotation mark input
    there are 2 ways to solve this
    either use numeric variable for the input command
    or enclose that ....
    ..... WHERE `account_id` = '"+ escape_sql(.@aid$) +"'", .... with single quotation mark, when the hacker input a quotation mark will be escaped by escape_sql command
    Reference : https://www.w3schools.com/sql/sql_injection.asp
    escape_sql command for another thing is
    if the player register their names containing ' or ", these characters are escaped
    only happens when the server have no restriction on the creation of players name
    hercules\conf\char\char-server.conf
    // Manage possible letters/symbol in the name of charater. Control character (0x00-0x1f) are never accepted. Possible values are: // NOTE: Applies to character, party and guild names. // 0: no restriction (default) // 1: only letters/symbols in 'name_letters' option. // 2: Letters/symbols in 'name_letters' option are forbidden. All others are possibles. name_option: 1  
    and this was what happened to my SQL dota pvpladder script
    Silo's Babies <-- this is a guild name
    you can see the 5th string has a single quotation mark
    with escape_sql command, that string will turn into
    Silo\'s Babies <-- the quotation mark is escaped when send to sql query
  20. Upvote
    IndieRO reacted to AnnieRuru in Advance SQL commands   
    2. How to build a case-sensitive table
    this is the answer I found
    http://dba.stackexchange.com/questions/15250/how-to-do-a-case-sensitive-search-in-where-clause
    by default, the table creation use charset = latin1;
    means it couldn't do a case-sensitive search
    if you want to do a case-sensitive in a query, use BINARY
    SELECT * FROM `char` WHERE `name` = BINARY('AnnieRuru'); however using BINARY might have performance hit if it is a big table
    so its more recommend to convert your SQL table to collate with latin1_general_cs

    let's say this is a sample table
    CREATE TABLE `test` ( `id` INT(11) PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(23) )ENGINE = InnoDB; do an ALTER table syntax
    ALTER TABLE `test` MODIFY COLUMN `name` VARCHAR(23) COLLATE latin1_general_cs; or just put it into the table creation
    CREATE TABLE `test` ( `id` INT(11) PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(23) )ENGINE = InnoDB DEFAULT CHARSET = latin1 COLLATE latin1_general_cs;  
  21. Upvote
    IndieRO reacted to AnnieRuru in Advance SQL commands   
    3. Choose a table type, MyISAM or InnoDB ?
    https://stackoverflow.com/questions/20148/myisam-versus-innodb
    Before MySQL 5.5,
    MyISAM is mostly use for read-heavy + table locking storage engine = such as pvp ladder ( always select ... order by kill desc )
    InnoDB is mostly use for write-heavy + row locking storage engine = such as quest script ( select ... from char_id ... only 1 row is retrieve )
    After MySQL 5.6, (currently is 8.0)
    just stick to InnoDB
    there is only 1 reason MyISAM is better than InnoDB
    - MyISAM use smaller disk usage than InnoDB
    let's take a look at our MyISAM to InnoDB converter
    https://github.com/HerculesWS/Hercules/blob/stable/sql-files/tools/convert_engine_innodb.sql
    This converter is useful if you are using MySQL 5.6 or above
    There are 4 tables that are commented out
    the reason is simple, these 4 tables only read once and forgotten when server is live
    since MyISAM is good at reading (SELECT) + smaller disk usage, its no use to convert these 4 tables into InnoDB
    3a How to index a table properly
    http://mysql.rjweb.org/doc.php/index_cookbook_mysql
    http://www.dbta.com/Columns/DBA-Corner/Top-10-Steps-to-Building-Useful-Database-Indexes-100498.aspx
    a simple thumb of rule, anything that is SELECT .... WHERE `field` = .....
    that `field` has to be index
    let's take a look at this PVP Ladder script that use Kill/Death ratio
    CREATE TABLE `pvpladder` ( `char_id` INT(11), `name` VARCHAR(23), `kills` INT(11), `death` INT(11), PRIMARY KEY (`char_id`), KEY (`kills`, `death`) ) ENGINE = InnoDB; prontera,155,186,6 script PVP Ladder 1_F_MARIA,{ .@nb = query_sql( "SELECT `name`, `kills`/(`death`+1) FROM `pvpladder` WHERE `kills` > 0 ORDER BY `kills`/(`death`+1) DESC LIMIT 10", .@name$, .@ratio$ ); if ( !.@nb ) { mes "no entry"; close; } mes "Current Ranking :"; for ( .@i = 0; .@i < .@nb; ++.@i ) mes "No."+(.@i +1)+" ["+ .@name$[.@i] +"] "+ .@ratio$[.@i] +" kill"; close; OnPCKillEvent: if ( killedrid == getcharid(3) ) { // killing self should only increase death count. EG: Grand-cross query_sql "INSERT INTO `pvpladder` VALUES ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) )+"', 0,1 ) ON DUPLICATE KEY UPDATE `death` = `death` +1"; end; } query_sql "INSERT INTO `pvpladder` VALUES ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) )+"', 1,0 ) ON DUPLICATE KEY UPDATE `kills` = `kills` +1"; attachrid killedrid; query_sql "INSERT INTO `pvpladder` VALUES ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) )+"', 0,1 ) ON DUPLICATE KEY UPDATE `death` = `death` +1"; end; } This kind of query -> ORDER BY kills/death, needs to index them together like this
    KEY (`kills`, `death`) 3b. Why you shouldn't use `char_reg_num_db` table
    blame Euphy for spreading this technique
    There are 2 reasons why you shouldn't even touch all these variable tables
    Reason no.1 This table is sorely meant for server usage
    Once these data is loaded, it is process internally, and only save character data according to this configuration
    Reason no.2 The `value` field is not index !
    This line has ORDER BY `value`, try recheck our main.sql file
    CREATE TABLE IF NOT EXISTS `acc_reg_num_db` ( `account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', `key` VARCHAR(32) BINARY NOT NULL DEFAULT '', `index` INT(11) UNSIGNED NOT NULL DEFAULT '0', `value` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`account_id`,`key`,`index`), KEY `account_id` (`account_id`) ) ENGINE=MyISAM; SQL will search through every single line in the `value` field if that column isn't index
    Of course you can ... do ALTER table to add KEY to the `value` field
    but this table has already optimized in that way for server usage
    the more field you index into the table, the more disk usage space it use
    Conclusion : If you want to make a custom script, then make a custom table. Leave these table alone !
  22. Upvote
    IndieRO reacted to AnnieRuru in Advance SQL commands   
    4. AUTO_INCREMENT
    CREATE TABLE `support_ticket` ( `id` INT(11) AUTO_INCREMENT, `title` VARCHAR(70), `message` VARCHAR(255), PRIMARY KEY (`id`) ) ENGINE = InnoDB; In this kind of query that has AUTO_INCREMENT, many people do ....
    $support_ticket_id++; query_sql "INSERT INTO `support_ticket` VALUES ( "+ $support_ticket_id +", '"+ escape_sql(.@title$) ... can be optimize .... using NULL
    query_sql "INSERT INTO `support_ticket` VALUES ( NULL, '"+ escape_sql(.@title$) ... can retrieve the last row with
    query_sql "SELECT MAX(`id`) FROM `support_ticket`", .@id; // ----- OR ----- query_sql "SELECT LAST_INSERT_ID()", .@id;  
    Question : This question was asked on eathena forum board
    One of my friend touched my custom table and the AUTO_INCREMENT has jump off the value
    | 1 | <data set 1> | 2 | <data set 2> | 3 | <data set 3> | 25854 | <data set 4> | 25855 | <data set 5> | 25856 | <data set 6> I want to make the value return back to normal as shown
    | 1 | <data set 1> | 2 | <data set 2> | 3 | <data set 3> | 4 | <data set 4> | 5 | <data set 5> | 6 | <data set 6> How to do this WITHOUT losing any of the current data ?
    Answer: The trick is ... just drop that column and rebuild it
    ALTER TABLE `inventory` DROP COLUMN `id`; ALTER TABLE `inventory` ADD COLUMN `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; convert the table into MyISAM will process the query much faster
  23. Upvote
    IndieRO reacted to AnnieRuru in Advance SQL commands   
    5. How to do IF-ELSE in SQL query ?
    Question : I have a PVP ladder script that runs on Points system. Each kill plus 1 point and each death minus 1 point.
    The problem is, this query will make the points go into negative value if the player is being kill repeatedly
    query_sql "UPDATE `pvp_points` SET `points` = `points` - 1 WHERE `char_id` = "+ getcharid(0); How do I make the points stop at 0 if the player is already at 0 points ?
     
    Answer :
    query_sql "UPDATE `pvp_points` SET `points` = IF(`points` = 0, 0, `points` - 1) WHERE `char_id` = "+ getcharid(0); query_sql "UPDATE `pvp_points` SET `points` = (CASE WHEN `points` = 0 THEN 0 ELSE `points` - 1 END) WHERE `char_id` = "+ getcharid(0);  
    Explanations:
    similar to hercules script language,
    if (<condition>) <execute true condition>; else <execute false condition>; in SQL language
    IF(<condition>, <execute true condition>, <execute false condition>) CASE WHEN <condition> THEN <execute true condition> ELSE <execute false condition> END  
    Reference : https://www.w3schools.com/sql/func_mysql_if.asp
    https://stackoverflow.com/questions/63447/how-do-i-perform-an-if-then-in-an-sql-select
    5a. How to update multiple rows on different conditions in a single query
    This query will update multiple rows on different condition
    UPDATE `pvpladder` SET `points` = CASE WHEN `char_id` = 150000 THEN `points` +1 WHEN `char_id` = 150001 THEN `points` -1 END WHERE `char_id` IN (150000,150001); Reference : https://stackoverflow.com/questions/20255138/sql-update-multiple-records-in-one-query
  24. Upvote
    IndieRO reacted to AnnieRuru in :hide:   
    anyone miss meh?
  25. Upvote
    IndieRO got a reaction from yashin16 in how to fix this??   
    Edit: problem solve 
    How to solve this problem, just add new function on luafile514\lua files\SkillInfoz\skillinfo_f.lub
    GetSkillScale = function(in_SKID, in_Level) local obj = SKILL_INFO_LIST[in_SKID] local x = 0 local y = 0 if nil ~= obj then obj = SKILL_INFO_LIST[in_SKID].SkillScale end if nil ~= obj then obj = SKILL_INFO_LIST[in_SKID].SkillScale[in_Level] end if nil ~= obj then x = SKILL_INFO_LIST[in_SKID].SkillScale[in_Level].x if nil == x then return 0, 0 else y = SKILL_INFO_LIST[in_SKID].SkillScale[in_Level].y if nil == y then return 0, 0 end end end return x, y end  
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.