-
Posts
272 -
Joined
-
Last visited
-
Days Won
3
Scofield last won the day on March 30
Scofield had the most liked content!
About Scofield
- Birthday 01/04/1988
Profile Information
-
Gender
Male
-
Location
Aracati
-
Server
JLHOST
-
Interests
conseguir conhecimento.
Scofield's Achievements
-
Automated Setup Script for rAthena on Ubuntu VPS
Scofield replied to Scofield's topic in Script Releases
#!/usr/sbin/nft -f flush ruleset table inet filter { # Conjunto dinâmico para IPs bloqueados set blocked_ips { type ipv4_addr flags dynamic, timeout timeout 1h } # Portas do Ragnarok Online set ragnarok_ports { type inet_service elements = { 6900, 6121, 5121, 8888 } } chain input { type filter hook input priority 0; policy drop; # Permitir tráfego de loopback iif "lo" accept # Permitir conexões estabelecidas e relacionadas ct state established,related accept # Proteção contra SYN Flood tcp flags syn \ tcp dport { 22, 80, 443, 6900, 6121, 5121, 8888 } \ meter syn_flood_protection { \ ip saddr limit rate 20/second burst 40 packets \ } \ accept # Permitir SSH, HTTP, HTTPS tcp dport { 22, 80, 443 } accept # Proteção contra flood nas portas do Ragnarok tcp dport @ragnarok_ports \ ct state new \ meter ragnarok_connections { \ ip saddr limit rate 100/second burst 50 packets \ add @blocked_ips { ip saddr timeout 1h } \ } # Bloquear IPs marcados como suspeitos ip saddr @blocked_ips \ tcp dport @ragnarok_ports \ log prefix "DDoS Attempt Blocked: " \ drop # Permitir conexões normais após verificação inicial tcp dport @ragnarok_ports accept # Bloquear pacotes inválidos ct state invalid drop # Logar e descartar pacotes não permitidos log prefix "nftables-drop: " drop } chain forward { type filter hook forward priority 0; policy drop; } chain output { type filter hook output priority 0; policy accept; } } etc/nftables.conf @Gidz Cross Install nftables on your VPS and then navigate to the /var/ directory. There, you will find a file named nftables.conf. Open it, and if you wish, you can use my rules. However, keep in mind that these rules still need to be adjusted. This means that I cannot guarantee they won’t block legitimate players. Probably not, but from what I remember, a normal player makes around 2 to 4 requests per second. So, stay alert and adjust as needed. -
Many people have questions about how to properly set up a newly acquired VPS to run the rAthena emulator. To simplify this process, I created an automated script that handles all the necessary configuration quickly and easily. Most tutorials available online focus on running the emulator on personal computers, but nowadays, the trend is to use a VPS for better performance and stability. With this script, you can set up your environment efficiently, even without advanced server knowledge. For those who want to start a professional rAthena project, here are some tips: 1. Use MariaDB instead of MySQL MariaDB is a community-developed fork of MySQL that offers several performance and optimization advantages, especially for large-scale applications like rAthena. While both database systems are compatible, MariaDB stands out due to its efficiency in handling intensive queries. Benefits of using MariaDB: Better Performance: MariaDB is optimized for handling large volumes of data and executes complex queries faster than MySQL. Improved Storage Engines: Supports advanced engines like Aria and TokuDB, which enhance performance and reduce data fragmentation. Faster Replication: Offers faster and safer master-slave replication, ensuring better data synchronization in distributed environments. Open Source & Active Development: Fully open-source with a more active development cycle, meaning better features and faster bug fixes. Optimized Thread Pooling: Handles multiple simultaneous connections efficiently, reducing CPU overhead and improving query response time. For an rAthena server, this translates to faster character loading, smoother gameplay, and better handling of concurrent player actions. 2. Use nftables instead of iptables nftables is a modern packet filtering framework that replaces the older iptables. It is now the default in most Linux distributions and provides better performance and flexibility when managing network rules, including basic DDoS protection. Benefits of using nftables: Higher Performance: Processes rules faster with a more optimized kernel implementation, reducing the impact on system resources. Simplified Rule Management: Uses a cleaner and unified syntax, making it easier to create and manage complex firewall rules. Better DDoS Mitigation: Supports more efficient rate limiting and packet inspection, allowing you to block basic DDoS attacks with minimal overhead. Dynamic Rules: Allows for dynamic rule adjustments without the need to reload the entire firewall configuration. IPv4/IPv6 Support: Handles both IPv4 and IPv6 rules natively, simplifying firewall management in modern environments. For a professional rAthena project, nftables ensures better network protection, faster packet processing, and more efficient handling of traffic spikes during large player events or attacks. Instructions to Use the Script: Upload the script to your VPS Use an SCP tool or copy-paste the script contents into a file called ubuntu.sh. Make the script executable: chmod +x ubuntu.sh Run the script with root privileges: sudo ./ubuntu.sh Follow the interactive prompts: Choose between MariaDB or MySQL. Input the database name, database user, and password. The script will: Update system packages. Install required dependencies for compiling rAthena. Set up MySQL or MariaDB. Install and configure phpMyAdmin at /phpmyadmin. After completing these steps, your VPS will be ready to compile and run rAthena. ubuntu.sh
-
BUILDIN_FUNC(mobremove) { struct block_list *bl = NULL; bl = map_id2bl( script_getnum(st,2) ); if ( bl && bl->type == BL_MOB ) unit_free(bl,CLR_OUTSIGHT); return SCRIPT_CMD_SUCCESS; } BUILDIN_DEF(mobremove,"i"),
-
a repository on github would be excellent, I would like to contribute
-
very good, breaking the bank
-
I'm trying to activate it so clans can attack each other on maps, like if it were a GvG in this case it would be a CvC I saw that in the Hercules production emulator there is already the CVC flag, in Rathena there is nothing similar yet? https://github.com/HerculesWS/Hercules/blob/stable/src/map/map.c#L5428
-
kkkkk nice-le
-
Hello community, I have a modification in my emulator called pvpmode. When I use it, the character enters PK mode, and in this system, it is possible to configure it to receive experience bonuses. I would like to implement the feature of receiving drop bonuses while the PK mode is active. Does anyone know how I could achieve this? Here is the part of the source code (src) that seems to be related to the experience bonus system. pc.c /*========================================== * Alters experienced based on self bonuses that do not get even shared to the party. *------------------------------------------*/ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) { int bonus = 0; struct status_data *status = status_get_status_data(src); struct region_data* rd; unsigned int ebonus = 0, jbonus = 0; if (sd->expaddrace[status->race]) bonus += sd->expaddrace[status->race]; bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS]; if (battle_config.pk_mode && (int)(status_get_lv(src) - sd->status.base_level) >= 20) bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris] if (sd->sc.data[SC_EXPBOOST]) bonus += sd->sc.data[SC_EXPBOOST]->val1; if( sd->status.iprank ) bonus += (sd->status.iprank * 2); if( pc_isPremium(sd) && battle_config.premium_bonusexp ) bonus += battle_config.premium_bonusexp; if( sd->state.pvpmode && battle_config.pvpmode_expbonus ) { int rank; if( (rank = pc_pvpfamerank(sd->status.char_id)) && rand()%100 < ((MAX_FAME_LIST + 1 - rank) * 4) ) bonus += battle_config.pvpmode_expbonus; } if (sd->sc.data[SC_JEXPBOOST]) jbonus += sd->sc.data[SC_JEXPBOOST]->val1; if( sd->status.guild_id && (rd = region_search(map[sd->bl.m].region_id)) != NULL && sd->status.guild_id == rd->guild_id ) { ebonus += rd->bonus_bexp; jbonus += rd->bonus_jexp; } if( !bonus && !ebonus && !jbonus ) return; *base_exp = (unsigned int) cap_value(*base_exp + (double)*base_exp * (bonus + ebonus)/100., 1, UINT_MAX); *job_exp = (unsigned int) cap_value(*job_exp + (double)*job_exp * (bonus + jbonus)/100., 1, UINT_MAX); return; } battle.c { "pvpmode_onlypc", &battle_config.pvpmode_onlypc, 1, 0, 1, }, { "pvpmode_gvgreductions", &battle_config.pvpmode_gvgreductions, 0, 0, 1, }, { "pvpmode_expbonus", &battle_config.pvpmode_expbonus, 0, 0, 100, }, { "pvpmode_nowarp_cmd", &battle_config.pvpmode_nowarp_cmd, 0, 0, 1, }, { "pvpmode_enable_delay", &battle_config.pvpmode_enable_delay, 120, 0, INT_MAX, }, { "pvpmode_disable_delay", &battle_config.pvpmode_disable_delay, 60, 0, INT_MAX, }, battle.h int pvpmode_onlypc; int pvpmode_gvgreductions; int pvpmode_expbonus; int pvpmode_nowarp_cmd; int pvpmode_enable_delay; int pvpmode_disable_delay;
-
What would it be like for merchants not to use the discount when they went to buy?
-
just use adelays.
-
+// Autor Goddameit +// Versão 20/12/2015 +// Web http://goo.gl/0vY9GV +// +// +- script bot_at -1,{ + função __onoff; +OnInit: + bindatcmd "boton",strnpcinfo(3)+"::OnDo"; + bindatcmd "botoff",strnpcinfo(3)+"::OnDo2"; + bindatcmd "botend",strnpcinfo(3)+"::OnDo2"; + fim; +OnDo: + sc_end SC_BOT; + .@SP_BOT_NA = 1; + enquanto(1) + { + .@C = select("[Terminar]","[Cancelar]","Ataque normal "+__onoff(.@SP_BOT_NA))k; + se( .@C == 1 ) + pausa; + senão se( .@C == 2 ) + fechar; + mais + interruptor(.@C) + { + caso 3: + .@SP_BOT_NA = !.@SP_BOT_NA; + pausa; + } + } + mensagem strcharinfo(0),"EXECUTAR"; + se( .@C == 1 || .@C > 2 ) + { + show "OK"; + fechar2; + } + sc_start4 SC_BOT,600000,.@SP_BOT_NA,0,0,0; + fim; +OnDo2: + sc_end SC_BOT; + mensagem strcharinfo(0),"END"; + fim; + função __onoff { + se(getarg(0) == 0) + retornar "^BEBEBE[OFF]^000000"; + mais + retornar "^000088[ON]^000000"; + } +} Didn't this NPC give errors?
-
Did the NPC work? did you make an error?
-
sc_config does not exist in rathena, this file only exists in the hercules emulator, I don't know which file in rathena has the same effect
-
Hello everyone, A few years ago, I made a post about the modification of BOT v.3, native to the Hercules emulator. I'm resurrecting this discussion in the hope of finding someone who can help adapt this bot to work on rathena. It seems that someone has already made this modification and even put it up for sale, but I don't have confirmed information. If anyone has knowledge about this or knows someone who can help, I would greatly appreciate it. I'm eager to bring this functionality to the rathena community. Thank you in advance for everyone's attention, and I look forward to any information or assistance you can provide. Index: db/const.txt =================================================================== --- db/const.txt (revision 14530) +++ db/const.txt (working copy) @@ -1258,6 +1258,7 @@ SC__CHAOS 577 SC__FEINTBOMB_MASTER 578 SC_FALLENEMPIRE 579 +SC_BOT 581 e_gasp 0 e_what 1 Index: db/sc_config.txt =================================================================== --- db/sc_config.txt (revision 14530) +++ db/sc_config.txt (working copy) @@ -14,6 +14,7 @@ //Example: //SC_ENDURE, 21 //SC_ENDURE: cannot be removed by death and dispell and cosidered as buff. (16 + 4 + 1 = 21) +SC_BOT, 6 SC_PROVOKE, 32 SC_ENDURE, 21 SC_CLOAKING, 2 Index: npc/bot.txt =================================================================== --- npc/bot.txt (revision 0) +++ npc/bot.txt (working copy) @@ -0,0 +1,51 @@ +// +// +// Author Goddameit +// Version 2015/12/20 +// Web http://goo.gl/0vY9GV +// +// +- script bot_at -1,{ + function __onoff ; +OnInit: + bindatcmd "boton",strnpcinfo(3)+"::OnDo"; + bindatcmd "botoff",strnpcinfo(3)+"::OnDo2"; + bindatcmd "botend",strnpcinfo(3)+"::OnDo2"; + end; +OnDo: + sc_end SC_BOT; + .@SP_BOT_NA = 1; + while(1) + { + .@C = select("[Finish]","[Cancel]","Normal Attack "+__onoff(.@SP_BOT_NA))k; + if( .@C == 1 ) + break; + else if( .@C == 2 ) + close; + else + switch(.@C) + { + case 3: + .@SP_BOT_NA = !.@SP_BOT_NA; + break; + } + } + message strcharinfo(0),"RUN"; + if( .@C == 1 || .@C > 2 ) + { + mes "OK"; + close2; + } + sc_start4 SC_BOT,600000,.@SP_BOT_NA,0,0,0; + end; +OnDo2: + sc_end SC_BOT; + message strcharinfo(0),"END"; + end; + function __onoff { + if(getarg(0) == 0) + return "^BEBEBE[OFF]^000000"; + else + return "^000088[ON]^000000"; + } +} \ No newline at end of file Index: src/map/status.c =================================================================== --- src/map/status.c (revision 14530) +++ src/map/status.c (working copy) @@ -8982,6 +8982,10 @@ if(val2 == MH_MD_FIGHTING) val2 = MH_MD_GRAPPLING; else val2 = MH_MD_FIGHTING; break; + case SC_BOT: + tick_time = 100; + val4 = tick / tick_time; + break; case SC_FULL_THROTTLE: status_percent_heal(bl,100,0); val2 = 7 - val1; @@ -9701,6 +9705,15 @@ } } } + + if (type == SC_BOT) + { + if (sc->data[type]->val4 > 0) + { + //Record how many time you left + pc->setreg(sd, script->add_str("@SP_BOT_LTICK"), sc->data[type]->val4 * 100); + } + } (sc->count)--; @@ -10464,6 +10477,145 @@ } while(0) switch(type) { + case SC_BOT: + if (--(sce->val4) > 0) { + { + int i_ = 0; + struct mmo_charstatus *sta = &sd->status; + unsigned short inf_ = 0; + int64 last_tick = (int64)time(NULL); + unsigned short idle_ = cap_value(DIFF_TICK32(last_tick, sd->idletime), 0, USHRT_MAX); + unsigned short tele_ = cap_value(DIFF_TICK32(last_tick, pc->readreg(sd, script->add_str("@SP_BOT_TELE"))), 0, USHRT_MAX); + unsigned int starget_id_ = bot_check_target_alive(bl, pc->readreg(sd, script->add_str("@SP_BOT_TGID"))); + {//Heal + unsigned short item_id_ = sta->hotkeys[9].id; + if ((sd->battle_status.hp * 100 / 80) < sd->battle_status.max_hp && item_id_ > 0) + { + i_ = pc->search_inventory(sd, item_id_); + if (i_ >= 0) + pc->useitem(sd, i_); + } + item_id_ = sta->hotkeys[10].id; + if ((sd->battle_status.sp * 100 / 80) < sd->battle_status.max_sp && item_id_ > 0) + { + i_ = pc->search_inventory(sd, item_id_); + if (i_ >= 0) + pc->useitem(sd, i_); + } + } + {//Buff + for (i_ = 2; i_ <= 6; i_++) + { + if ((inf_ = bot_chec_khotkeys_is_skill(sd, i_)) > 0) + { + unsigned short id_ = sta->hotkeys[i_].id; + if (inf_ == 4 || inf_ == 16) + { + if (!sc->data[status->skill2sc(id_)]) + unit->skilluse_id(bl, bl->id, id_, sta->hotkeys[i_].lv); + } + } + } + } + if (idle_ % 7 != 0)//Attack + { + { + unsigned short inf_ = 0; + starget_id_ = bot_check_target_alive(bl, pc->readreg(sd, script->add_str("@SP_BOT_TGID"))); + if (starget_id_ > 0) { + if (sce->val1 > 0) + { + switch (rand() % 10) + { + case 0: + case 1: + case 2: + inf_ = bot_chec_khotkeys_is_skill(sd, 7); + if (inf_ == 1) + { + unit->stop_attack(bl); + unit->skilluse_id(bl, starget_id_, sta->hotkeys[7].id, sta->hotkeys[7].lv); + } + break; + case 5: + case 6: + inf_ = bot_chec_khotkeys_is_skill(sd, 8); + if (inf_ == 1) + { + unit->stop_attack(bl); + unit->skilluse_id(bl, starget_id_, sta->hotkeys[8].id, sta->hotkeys[8].lv); + } + break; + default: + unit->attack(bl, starget_id_, 1); + break; + } + } + else + { + switch (rand() % 7) + { + case 0: + case 1: + case 2: + case 3: + case 4: + inf_ = bot_chec_khotkeys_is_skill(sd, 7); + if (inf_ == 1) + { + unit->skilluse_id(bl, starget_id_, sta->hotkeys[7].id, sta->hotkeys[7].lv); + } + break; + case 5: + case 6: + inf_ = bot_chec_khotkeys_is_skill(sd, 8); + if (inf_ == 1) + { + unit->skilluse_id(bl, starget_id_, sta->hotkeys[8].id, sta->hotkeys[8].lv); + } + break; + } + } + } + } + } + else + {//Move + bool flywing_ = false; + if (bot_check_target(bl, starget_id_) == false) + { + if (tele_ > 7) + { + if (sta->hotkeys[0].type == 0 && sta->hotkeys[0].id == 601 && sta->hotkeys[0].lv == 0) + { + i_ = pc->search_inventory(sd, 601); + if (i_ >= 0) + { + pc->useitem(sd, i_); + flywing_ = true; + } + } + if ((st->sp > 20) && (flywing_ == false) && (sta->hotkeys[1].type == 1 && sta->hotkeys[1].id == AL_TELEPORT && sta->hotkeys[1].lv > 0)) + { + if (pc->checkskill(sd, AL_TELEPORT) > 0) + { + pc->randomwarp(sd, CLR_TELEPORT); + status->heal(&sd->bl, 0, -(skill->get_sp(AL_TELEPORT, 1)), 1); + flywing_ = true; + } + } + if (flywing_ == true) + pc->setreg(sd, script->add_str("@SP_BOT_TELE"), last_tick); + } + } + if ((idle_ % 9 == 0 && idle_ > 0) || starget_id_ == 0) + unit->walktoxy(&sd->bl, sd->bl.x + (rand() % 2 == 0 ? -1 : 1)*(rand() % 10), sd->bl.y + (rand() % 2 == 0 ? -1 : 1)*(rand() % 10), 0); + } + } + sc_timer_next(100 + tick, status->change_timer, bl->id, data); + return 0; + } + break; case SC_MAXIMIZEPOWER: case SC_CLOAKING: if(!status->charge(bl, 0, 1)) @@ -12237,3 +12389,73 @@ status->readdb_refine = status_readdb_refine; status->readdb_scconfig = status_readdb_scconfig; } + +bool bot_check_target(struct block_list *src, unsigned int id) +{ + struct block_list *bl = map->id2bl(id); + if (bl) + { + if (path->search(NULL, src->m, src->x, src->y, bl->x, bl->y, 1, CELL_CHKNOREACH) && distance_xy(src->x, src->y, bl->x, bl->y) < 11) + { + TBL_MOB *md = BL_CAST(BL_MOB, bl); + if (md) + { + if (md->status.hp > 0) + { + return true; + } + } + } + } + return false; +} + +int buildin_autoattack_sub(struct block_list *bl, va_list ap) +{ + int *target_id = va_arg(ap, int *); + int src_id = va_arg(ap, int); + struct block_list *src = map->id2bl(src_id); + if (!src || !bl) + return 1; + if (bot_check_target(src, bl->id) == true) + *target_id = bl->id; + else + *target_id = 0; + return 1; +} + +short bot_chec_khotkeys_is_skill(struct map_session_data *sd, unsigned short idx) +{ + if (sd) + { + struct mmo_charstatus *sta = &sd->status; + if (sta) + { + if (sta->hotkeys[idx].type == 1 && pc->checkskill(sd, sta->hotkeys[idx].id) > 0 && sta->hotkeys[idx].lv > 0) + return skill->get_inf(sta->hotkeys[idx].id); + } + } + return -1; +} + +unsigned int bot_check_target_alive(struct block_list *src, unsigned int id) +{ + if (bot_check_target(src, id) == true) + return id; + { + int i_, target_id_; + for (i_ = 0; i_ < 15; i_++) + { + target_id_ = 0; + map->foreachinarea(buildin_autoattack_sub, src->m, src->x - i_, src->y - i_, src->x + i_, src->y + i_, BL_MOB, &target_id_, src->id); + if (target_id_) + { + pc->setreg(map->id2sd(src->id), script->add_str("@SP_BOT_TGID"), target_id_); + break; + } + } + if (target_id_) + return target_id_; + } + return 0; +} \ No newline at end of file Index: src/map/status.h =================================================================== --- src/map/status.h (revision 14530) +++ src/map/status.h (working copy) @@ -715,6 +715,7 @@ SC_FALLENEMPIRE, SC_FLASHCOMBO, + SC_BOT, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. } sc_type; @@ -2089,4 +2090,8 @@ void status_defaults(void); +bool bot_check_target(struct block_list *src, unsigned int id); +int buildin_autoattack_sub(struct block_list *bl, va_list ap); +short bot_chec_khotkeys_is_skill(struct map_session_data *sd, unsigned short idx); +unsigned int bot_check_target_alive(struct block_list *src, unsigned int id); #endif /* MAP_STATUS_H */