From dbde28d58750225c967796e0c39ab4d4b709a4a2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 11 Oct 2020 16:25:51 +0000 Subject: AFKing System MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented at the Rusty Pick Inn (Hurnscald) only. Red Plush Inn will be next. Right now, beer/red plush wine/etc. do not affect EXP gain, only players nearby do. MAX_IDLE is using the same variable form as Moubootaur Legends. It can be set to a constant if needed. Wandering storytellers not yet implemented, I believe @toams will use Kfahr and Janus to do that later™ ---- close evol-all#108 --- conf/map/battle/status.conf | 8 ++-- db/constants.conf | 5 +++ db/re/item_db.conf | 14 ++----- db/sc_config.conf | 7 ++++ npc/001-2-28/note.txt | 22 ++++++++++- npc/008-2-2/ledmitz.txt | 19 +--------- npc/008-2-2/note.txt | 23 ++++++++---- npc/functions/afk.txt | 69 ++++++++++++++++++++++++++++++++++ npc/functions/global_event_handler.txt | 1 + npc/functions/main.txt | 25 ++++++++++++ npc/functions/scoreboards.txt | 23 ++++++++++++ npc/functions/util.txt | 5 --- npc/scripts.conf | 1 + 13 files changed, 175 insertions(+), 47 deletions(-) create mode 100644 npc/functions/afk.txt diff --git a/conf/map/battle/status.conf b/conf/map/battle/status.conf index 8ba76199..5f6fe68d 100644 --- a/conf/map/battle/status.conf +++ b/conf/map/battle/status.conf @@ -38,10 +38,10 @@ status_cast_cancel: 0 // Adjustment for the natural rate of resistance from status changes. // If 50, status defense is halved, and you need twice as much stats to block // them (eg: 200 vit to completely block stun) -pc_status_def_rate: 100 -mob_status_def_rate: 100 +pc_status_def_rate: 50 +mob_status_def_rate: 50 // Maximum resistance to status changes. (100 = 100%) // NOTE: Cards and equipment can go over this limit, so it only applies to natural resist. -pc_max_status_def: 100 -mob_max_status_def: 100 +pc_max_status_def: 75 +mob_max_status_def: 75 diff --git a/db/constants.conf b/db/constants.conf index 56657b1a..551da2c3 100644 --- a/db/constants.conf +++ b/db/constants.conf @@ -4763,6 +4763,11 @@ more than one separator can be used in a row (so 12_3___456 is illegal). SI_SUHIDE: 933 SI_SPRITEMABLE: 937 SI_MADOGEAR: 1149 + // Hercules SI end at 1150 and our start right after + // (Which is annoying because they may be saved to SQL) + // So expect we jumping from 1151 to 1500 in future + SI_CONFUSION: 1151 + /* ==================================================== */ /** evol constants **/ diff --git a/db/re/item_db.conf b/db/re/item_db.conf index a2045f69..f3519779 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -711,11 +711,8 @@ item_db: ( Delay: 500 UseEffect: "EFFECT_HEAL" Script: <" - @min = 40; - @max = 90; - @delay = 5; - @type = 1; - doevent "rand_sc_heal::OnUse"; + // 30 minutes + sc_start(SC_CONFUSION, 1800000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK); "> }, { @@ -898,11 +895,8 @@ item_db: ( Delay: 750 UseEffect: "EFFECT_HEAL" Script: <" - @min = 60; - @max = 110; - @delay = 8; - @type = 1; - doevent "rand_sc_heal::OnUse"; + // 15 minutes + sc_start(SC_CONFUSION, 900000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK); "> }, { diff --git a/db/sc_config.conf b/db/sc_config.conf index 46f89308..b6cf8530 100644 --- a/db/sc_config.conf +++ b/db/sc_config.conf @@ -47,6 +47,13 @@ SC_TYPE: { Icon: (string, defaults to SI_BLANK) The status icon attached to the SC } **************************************************************************/ +SC_CONFUSION: { + Flags: { + NoSave: true + NoBoss: true + } + Icon: "SI_CONFUSION" +} SC_PROVOKE: { Flags: { Debuff: true diff --git a/npc/001-2-28/note.txt b/npc/001-2-28/note.txt index c57a3f21..2c41adb7 100644 --- a/npc/001-2-28/note.txt +++ b/npc/001-2-28/note.txt @@ -4,8 +4,9 @@ // Qwerty Dragon // Reid // WildX +// Jesusalva // Description: -// A small note presenting the 7 main rules of Evol Online. +// A small note presenting the main rules of Evol Online. 001-2-28,36,28,0 script Note#001-2-28 NPC_PAPER_NOTE,{ narrator S_LAST_NEXT, @@ -15,7 +16,8 @@ narrator S_NO_NPC_NAME, l("Following these lines are some other writings on this paper."), - l("Do not give the password of your room to anybody! Keep it secret and try not to use the same one in any other room in the future. - Jenna"); + l("Do not give the password of your room to anybody! Keep it secret and try not to use the same one in any other room in the future. - Jenna"), + l("You'll gain experience if you hang around here with friends. Ask Jenna for drinks and pay a round for them! - Management"); close; @@ -23,3 +25,19 @@ OnInit: .distance = 2; end; } + +// This is part of AFKing Experience +001-2-28,60,30,0 script #AFKArtis NPC_HIDDEN,0,1,{ + end; + +OnTouch: + addtimer2(3000, "#AFKArtis::OnSpeeching"); + end; + +OnSpeeching: + AFKLoop("#AFKArtis::OnSpeeching", "001-2-28", 36, 27, 60, 42); + end; +} + +001-2-28,36,31,0 duplicate(#AFKArtis) #AFKArtis2 NPC_HIDDEN,0,1 + diff --git a/npc/008-2-2/ledmitz.txt b/npc/008-2-2/ledmitz.txt index 4e310961..3ed94009 100644 --- a/npc/008-2-2/ledmitz.txt +++ b/npc/008-2-2/ledmitz.txt @@ -18,15 +18,6 @@ OnTalk: OnInit: .bodytype = BODYTYPE_3; .distance = 3; - -////////// UNFINISHED ////////// -//////////////////////////////// -// REMOVE THIS CODE WHEN THIS // -// NPC IS NO LONGER A WIP ////// -//////////////////////////////// -//if (!debug) disablenpc(.name$); -///////// UNFINISHED /////////// - end; } @@ -42,14 +33,6 @@ OnTalk: OnInit: .bodytype = BODYTYPE_3; .distance = 3; - -////////// UNFINISHED ////////// -//////////////////////////////// -// REMOVE THIS CODE WHEN THIS // -// NPC IS NO LONGER A WIP ////// -//////////////////////////////// -//if (!debug) disablenpc(.name$); -///////// UNFINISHED /////////// - end; } + diff --git a/npc/008-2-2/note.txt b/npc/008-2-2/note.txt index 7c6de412..a19fa50e 100644 --- a/npc/008-2-2/note.txt +++ b/npc/008-2-2/note.txt @@ -1,6 +1,7 @@ // Evol scripts. // Author: // gumi +// Jesusalva 008-2-2,32,28,0 script Note#Hurnscald:pub NPC_PAPER_NOTE,{ narrator(8, @@ -10,19 +11,25 @@ "• " + l("Can't walk without stopping after every step")); // In case you don't get the joke, know that it's a parody on Illutia. - + mesc l("PS. You'll gain experience if you hang around here with friends. Ask Melinda for drinks and pay a round for them! - Management"); close; OnInit: .distance = 3; + end; +} -////////// UNFINISHED ////////// -//////////////////////////////// -// REMOVE THIS CODE WHEN THIS // -// NPC IS NO LONGER A WIP ////// -//////////////////////////////// -//if (!debug) disablenpc(.name$); -///////// UNFINISHED /////////// +// This is part of AFKing Experience +008-2-2,28,33,0 script #AFKHurns NPC_HIDDEN,0,0,{ + end; +OnTouch: + addtimer2(3000, "#AFKHurns::OnSpeeching"); + end; + +OnSpeeching: + AFKLoop("#AFKHurns::OnSpeeching", "008-2-2", 33, 27, 48, 38); end; } + +008-2-2,50,30,0 duplicate(#AFKHurns) #AFKHurns2 NPC_HIDDEN,1,0 diff --git a/npc/functions/afk.txt b/npc/functions/afk.txt new file mode 100644 index 00000000..9790ea1a --- /dev/null +++ b/npc/functions/afk.txt @@ -0,0 +1,69 @@ +// Moubootaur Legends Script +// Author: +// Jesusalva +// Hocus Pocus Fidibus +// Micksha +// Description: +// Professor - allows you to gain EXP for idling (Speech skill) +// Modified for The Mana World. Please update the bottom of this file always. + +// AFKLoop(label, map, x1, y1, x2, y2) +function script AFKLoop { + deltimer(getarg(0)); // safeguard + .@m$=getarg(1); + .@x1=getarg(2); + .@y1=getarg(3); + .@x2=getarg(4); + .@y2=getarg(5); + + // Limit maximum AFK TIme using the same rule as Moubootaur Legends + // Max AFK time is determined as 30 minutes + 1 second every 10 minutes AFKed + // Capped at 2 hours (you've AFK'ed 37 days and 12 hours - 900 hours) + .@maxafk=min(7200, 1800+(AFKING/600)); + + // Check if this timer is still relevant + if (getmap() != .@m$) + return false; + + addtimer2(3000, getarg(0)); + + // To receive AFK experience, you must be sitting at the table... + if (!isin(.@m$, .@x1, .@y1, .@x2, .@y2)) + return false; + + // ...And be idle for less than .@maxafk + if (checkidle() > .@maxafk) + return false; + + // Calculate amount of EXP based on players in the square + // Every 2 players grant you 1 XP, capped at 10 xp + // For job experience, it is twice as difficult. + .@ppl=getareausers(.@m$, .@x1, .@y1, .@x2, .@y2); + .@bxp=cap_value(1+.@ppl/2 , 1, 10); + .@jxp=cap_value(1+.@ppl/4 , 1, 5); + + // Beer and Red Plush Wine modifiers + if (getstatus(SC_CONFUSION)) { + .@bxp+=1; + //.@jxp+=1; + } else { + .@bxp=1; + .@jxp=1; + } + + // Increase time AFK'ed timers and grant experience + AFKING+=1; + getexp .@bxp, .@jxp; + return true; +} + +// Record memory for player login, re-firing timers when player is in a bar. +function script AFKLogin { + .@m$=getmap(); + if (.@m$ == "008-2-2") + addtimer2(3000, "#AFKHurns::OnSpeeching"); + else if (.@m$ == "001-2-28") + addtimer2(3000, "#AFKArtis::OnSpeeching"); + return; +} + diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt index 91cd12ef..08bbc7ab 100644 --- a/npc/functions/global_event_handler.txt +++ b/npc/functions/global_event_handler.txt @@ -24,6 +24,7 @@ OnPCLoginEvent: callfunc("ReceiveScheduledBroadcast"); callfunc("FixBankVault"); callfunc("GrantSuperSkill"); + callfunc("AFKLogin"); end; OnPCLogoutEvent: diff --git a/npc/functions/main.txt b/npc/functions/main.txt index f3b58d01..eef24ed4 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -338,3 +338,28 @@ function script delinventorylist { @inventorylist_count=0; return; } + +// isin( map, x1, y1, {[x2, y2][radius]} ) +function script isin { + if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0) + return false; + if (.@mapName$ != getarg(0)) + return false; + + if (getarg(4,-1) < 0) { + // Radius Based + if (.@xpos >= getarg(1)-getarg(3) && .@xpos <= getarg(1)+getarg(3) && .@ypos >= getarg(2)-getarg(3) && .@ypos <= getarg(2)+getarg(3)) + return true; + } else { + // Coordinate based + if (.@xpos >= getarg(1) && .@xpos <= getarg(3) && .@ypos >= getarg(2) && .@ypos <= getarg(4)) + return true; + } + return false; +} + +// Shortcut for getmapname() +function script getmap { + return getmapname(); +} + diff --git a/npc/functions/scoreboards.txt b/npc/functions/scoreboards.txt index 120425ee..d3ceb9a7 100644 --- a/npc/functions/scoreboards.txt +++ b/npc/functions/scoreboards.txt @@ -117,6 +117,23 @@ function script HallOfATL { return; } +// Hall of AFK +function script HallOfAFK { + mes ""; + mes l("##BHall Of AFK: TOP 10##b"); + mesf("1. %s (%dh%02dm)", $@afk_name$[0], $@afk_value[0]/1200, $@afk_value[0]%1200/60*3); + mesf("2. %s (%dh%02dm)", $@afk_name$[1], $@afk_value[1]/1200, $@afk_value[1]%1200/60*3); + mesf("3. %s (%dh%02dm)", $@afk_name$[2], $@afk_value[2]/1200, $@afk_value[2]%1200/60*3); + mesf("4. %s (%dh%02dm)", $@afk_name$[3], $@afk_value[3]/1200, $@afk_value[3]%1200/60*3); + mesf("5. %s (%dh%02dm)", $@afk_name$[4], $@afk_value[4]/1200, $@afk_value[4]%1200/60*3); + mesf("6. %s (%dh%02dm)", $@afk_name$[5], $@afk_value[5]/1200, $@afk_value[5]%1200/60*3); + mesf("7. %s (%dh%02dm)", $@afk_name$[6], $@afk_value[6]/1200, $@afk_value[6]%1200/60*3); + mesf("8. %s (%dh%02dm)", $@afk_name$[7], $@afk_value[7]/1200, $@afk_value[7]%1200/60*3); + mesf("9. %s (%dh%02dm)", $@afk_name$[8], $@afk_value[8]/1200, $@afk_value[8]%1200/60*3); + mesf("10. %s (%dh%02dm)", $@afk_name$[9], $@afk_value[9]/1200, $@afk_value[9]%1200/60*3); + return; +} + // HallOfGame() function script HallOfGame { if ($MOST_HEROIC$) @@ -176,6 +193,7 @@ OnInit: .@nb = query_sql("select name, guild_lv from `guild` ORDER BY guild_lv DESC LIMIT 5", $@hoguild_name$, $@hoguild_value); .@nb = query_sql("SELECT c.name, i.amount FROM `storage` AS i, `char` AS c WHERE i.nameid="+Acorn+" AND i.account_id=c.account_id ORDER BY i.amount DESC LIMIT 15", $@hoa_name$, $@hoa_value); .@nb = query_sql("SELECT c.name, i.value FROM `char_reg_num_db` AS i, `char` AS c WHERE i.key='ATLRANK' AND i.char_id=c.char_id ORDER BY i.value DESC LIMIT 10", $@atl_name$, $@atl_value); + .@nb = query_sql("SELECT c.name, i.value FROM `char_reg_num_db` AS i, `char` AS c WHERE i.key='AFKING' AND i.char_id=c.char_id ORDER BY i.value DESC LIMIT 10", $@afk_name$, $@afk_value); consolemes(CONSOLEMES_DEBUG, "Scoreboards reloaded"); if (!$@SCOREBOARD_BIND) { bindatcmd "scoreboard", "@scoreboard::OnCall", 0, 100, 0; @@ -198,6 +216,7 @@ OnCall: l("Hall Of Guilds"), l("Hall Of Acorns"), l("Hall Of Artis Legion Training Arena"), + l("Hall Of AFK King"), l("Game Statistics"), l("Quit"); mes ""; @@ -227,6 +246,10 @@ OnCall: next; break; case 7: + HallOfAFK(); + next; + break; + case 8: HallOfGame(); next; break; diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 49801982..cedd4202 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -65,11 +65,6 @@ function script setqtime { return; } -// Shortcut for getmapname() -function script getmap { - return getmapname(); -} - // gettimeparam(GETTIME_X) // Returns the number of seconds/minutes/hours/days/months/years since 01/01/1970 // This is for truly daily quests, which doesn't imposes a timed wait in hours diff --git a/npc/scripts.conf b/npc/scripts.conf index d3598405..9701efce 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -54,6 +54,7 @@ "npc/functions/bank.txt", "npc/functions/confused-tree-dict.txt", "npc/functions/treasure.txt", +"npc/functions/afk.txt", // May rely on custom functions and thus must be handled by last "npc/functions/util.txt", -- cgit v1.2.3-70-g09d2