diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-07-27 19:06:40 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-07-27 19:06:40 +0000 |
commit | bba15f5d17900a5e9cb85c796555f8ed1591ea2a (patch) | |
tree | 37842cee4078170b560984ffb540a1ec329e1419 | |
parent | e82df73e8a0d6c1757ef10a8532545ab0cd80ac4 (diff) | |
download | hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.gz hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.bz2 hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.tar.xz hercules-bba15f5d17900a5e9cb85c796555f8ed1591ea2a.zip |
* Simplified exp gain equations (now more FPU-friendly and precise), also fixes the uninitialized variable problem
* Corrected one exp calculation overflow (mainly affected high-rate pk servers)
* Fixed Neuralizer item script typo
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10921 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | db/Changelog.txt | 2 | ||||
-rw-r--r-- | db/item_db.txt | 2 | ||||
-rw-r--r-- | npc/other/CashShop_Functions.txt | 186 | ||||
-rw-r--r-- | src/map/mob.c | 25 | ||||
-rw-r--r-- | src/map/pc.c | 13 |
6 files changed, 106 insertions, 124 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 8a6f8112e..737c0eb95 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/07/27 + * Simplified exp gain equations (now more FPU-friendly and precise) + - also fixes the uninitialized variable problem... sorry 'bout that >.> * Changed the way hit bonus is applied. http://www.eathena.ws/board/index.php?showtopic=157438 [Vicious] * Cleaned up mob drop code, crashfix is still needed though... diff --git a/db/Changelog.txt b/db/Changelog.txt index 964015a39..1922329a2 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -48,6 +48,8 @@ 13107 Western_Outlaw Need correct HIT and ASPD Rate ---- ======================== +07/27 + * Fixed Neuralizer item script typo [ultramage] 07/26 * Rev. 10917 Updated Cash Shop Skill Scrolls to behave more like official scrolls. [L0ne_W0lf] - Kafra Card, Neuralizer, Giant Fly Wing and Dungeon teleport scroll now call functions. diff --git a/db/item_db.txt b/db/item_db.txt index 9c3372ce4..1f4310783 100644 --- a/db/item_db.txt +++ b/db/item_db.txt @@ -2919,7 +2919,7 @@ 12210,Bubble_Gum,Bubble Gum,3,,,10,,,,,,,,,,,,,{},{},{} 12211,Kafra_Card,Kafra Card,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashStore"; },{},{} 12212,Giant_Fly_Wing,Giant Fly Wing,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashPartyCall"; },{},{} -12213,Neuralizer,Neuralizer,2,,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "C_CashReset"; },{},{} +12213,Neuralizer,Neuralizer,2,,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashReset"; },{},{} 12214,Convex_Mirror,Convex Mirror,3,20,,10,,,,,,,,,,,,,{},{},{} 12215,Blessing_10_Scroll,LV10 Blessing Scroll,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ skilleffect 34,0; sc_start SC_BLESSING,600000,10; },{},{} 12216,Inc_Agi_10_Scroll,LV10 Agil Scroll,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ skilleffect 29,0; sc_start SC_INCREASEAGI,600000,10; },{},{} diff --git a/npc/other/CashShop_Functions.txt b/npc/other/CashShop_Functions.txt index 209a6b29b..8dca165b5 100644 --- a/npc/other/CashShop_Functions.txt +++ b/npc/other/CashShop_Functions.txt @@ -1,94 +1,94 @@ -//===== eAthena Script =======================================
-//= Cash Shop Functions
-//===== By: ==================================================
-//= L0ne_W0lf
-//===== Current Version: =====================================
-//= 1.0
-//===== Compatible With: =====================================
-//= eAthena SVN
-//===== Description: =========================================
-//= Used explicitly in the Item Database for Cash shop items
-//= - Kafra Card
-//= - Giant Fly Wing
-//= - Neuralizer
-//= - Dungeon Teleport Scroll
-//===== Additional Comments: =================================
-//= 1.0 First version. [L0ne_W0lf]
-//= F_CashPartyCall Optimized by Trancid.
-//============================================================
-
-// Kafra Card
-//============================================================
-// - Open player's storage.
-// - No arguments.
-function script F_CashStore {
- cutin "kafra_01",2;
- mes "[Kafra Employee]";
- mes "Welcome to the Kafra Corporation.";
- mes "Here, let me open your Storage for you.";
- close2;
- openstorage;
- cutin "",255;
- return;
-}
-
-
-// Giant Fly Wing
-//============================================================
-// - Warp party leader to random spot on the map.
-// - Summon Party members on party leader map to that location.
-// - No arguments.
-function script F_CashPartyCall {
- warp "Random",0,0;
- if(getpartyleader(getcharid(1),2) == getcharid(0)) {
- getmapxy .@mapl$, .@xl, .@yl, 0;
- getpartymember getcharid(1);
- set .@partymembercount, $@partymembercount;
- copyarray .@partymembername$[0], $@partymembername$[0], .@partymembercount;
- for(set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1)
- if(!(getmapxy(.@mapm$, .@xm, .@ym, 0, .@partymembername$[.@i])) && (.@mapm$ == .@mapl$))
- warpchar .@mapl$, .@xl, .@yl, getcharid(0, .@partymembername$[.@i]);
- }
- return;
-}
-
-// Neuralizer
-//============================================================
-// - Reset players skills. Weight must be 0, options must be off.
-// - No arguments.
-function script F_CashReset {
- if (Class != Job_Novice) {
- if (Weight < 1) {
- if (checkriding() || checkfalcon() || checkcart()) return;
- else {
- resetskill;
- sc_end SC_ALL;
- }
- }
- }
- return;
-}
-
-// Dungeon Teleport Scroll
-//============================================================
-// - Warp player to random location of selected dungeon
-// due to lack of information.
-// - No arguments.
-function script F_CashDungeon {
- switch(select("Nogg Road:Mjolnir Dead Pit:Umbala Dungeon:Einbroch Mine Dungeon:Payon Dungeon:Toy Dungeon:Glast Heim Underprison:Louyang Dungeon:Hermit's Checkers:Izlude Dungeon:Turtle Island Dungeon:Clock Tower B3f:Clock Tower")) {
- case 1: warp "mag_dun01",0,0; end;
- case 2: warp "mjolnir_02",0,0; end;
- case 3: warp "um_dun01",0,0; end;
- case 4: warp "ein_dun01",0,0; end;
- case 5: warp "pay_dun00",0,0; end;
- case 6: warp "xmas_dun01",0,0; end;
- case 7: warp "gl_prison",0,0; end;
- case 8: warp "lou_dun01",0,0; end;
- case 9: warp "gon_dun02",0,0; end;
- case 10: warp "iz_dun00",0,0; end;
- case 11: warp "tur_dun02",0,0; end;
- case 12: warp "alde_dun03",0,0; end;
- case 13: warp "c_tower1",0,0; end;
- }
- return;
+//===== eAthena Script ======================================= +//= Cash Shop Functions +//===== By: ================================================== +//= L0ne_W0lf +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= eAthena SVN +//===== Description: ========================================= +//= Used explicitly in the Item Database for Cash shop items +//= - Kafra Card +//= - Giant Fly Wing +//= - Neuralizer +//= - Dungeon Teleport Scroll +//===== Additional Comments: ================================= +//= 1.0 First version. [L0ne_W0lf] +//= F_CashPartyCall Optimized by Trancid. +//============================================================ + +// Kafra Card +//============================================================ +// - Open player's storage. +// - No arguments. +function script F_CashStore { + cutin "kafra_01",2; + mes "[Kafra Employee]"; + mes "Welcome to the Kafra Corporation."; + mes "Here, let me open your Storage for you."; + close2; + openstorage; + cutin "",255; + return; +} + + +// Giant Fly Wing +//============================================================ +// - Warp party leader to random spot on the map. +// - Summon Party members on party leader map to that location. +// - No arguments. +function script F_CashPartyCall { + warp "Random",0,0; + if(getpartyleader(getcharid(1),2) == getcharid(0)) { + getmapxy .@mapl$, .@xl, .@yl, 0; + getpartymember getcharid(1); + set .@partymembercount, $@partymembercount; + copyarray .@partymembername$[0], $@partymembername$[0], .@partymembercount; + for(set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) + if(!(getmapxy(.@mapm$, .@xm, .@ym, 0, .@partymembername$[.@i])) && (.@mapm$ == .@mapl$)) + warpchar .@mapl$, .@xl, .@yl, getcharid(0, .@partymembername$[.@i]); + } + return; +} + +// Neuralizer +//============================================================ +// - Reset players skills. Weight must be 0, options must be off. +// - No arguments. +function script F_CashReset { + if (Class != Job_Novice) { + if (Weight < 1) { + if (checkriding() || checkfalcon() || checkcart()) return; + else { + resetskill; + sc_end SC_ALL; + } + } + } + return; +} + +// Dungeon Teleport Scroll +//============================================================ +// - Warp player to random location of selected dungeon +// due to lack of information. +// - No arguments. +function script F_CashDungeon { + switch(select("Nogg Road:Mjolnir Dead Pit:Umbala Dungeon:Einbroch Mine Dungeon:Payon Dungeon:Toy Dungeon:Glast Heim Underprison:Louyang Dungeon:Hermit's Checkers:Izlude Dungeon:Turtle Island Dungeon:Clock Tower B3f:Clock Tower")) { + case 1: warp "mag_dun01",0,0; end; + case 2: warp "mjolnir_02",0,0; end; + case 3: warp "um_dun01",0,0; end; + case 4: warp "ein_dun01",0,0; end; + case 5: warp "pay_dun00",0,0; end; + case 6: warp "xmas_dun01",0,0; end; + case 7: warp "gl_prison",0,0; end; + case 8: warp "lou_dun01",0,0; end; + case 9: warp "gon_dun02",0,0; end; + case 10: warp "iz_dun00",0,0; end; + case 11: warp "tur_dun02",0,0; end; + case 12: warp "alde_dun03",0,0; end; + case 13: warp "c_tower1",0,0; end; + } + return; }
\ No newline at end of file diff --git a/src/map/mob.c b/src/map/mob.c index 07fd60642..222f0130a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1813,9 +1813,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) for(i = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++) { int flag=1,zeny=0; - unsigned int base_exp,job_exp; + unsigned int base_exp, job_exp; double per; //Your share of the mob's exp - double jper; //For the job-exp int bonus; //Bonus on top of your share. if (!tmpsd[i]) continue; @@ -1856,28 +1855,16 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if(md->db->mexp > 0) zeny*=rand()%250; } - jper = per; if (map[m].flag.nobaseexp || !md->db->base_exp) base_exp = 0; - else { - if (map[m].bexp != 100) - temp = map[m].bexp*bonus/100; - if (temp != 100) - per = per*temp/100.; - - base_exp = (unsigned int)cap_value(md->db->base_exp * per, 1, UINT_MAX); - } + else + base_exp = (unsigned int)cap_value(md->db->base_exp * per * bonus/100. * map[m].bexp/100., 1, UINT_MAX); + if (map[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag) //Homun earned job-exp is always lost. job_exp = 0; - else { - if (map[m].jexp != 100) - temp = map[m].jexp*bonus/100; - if (temp != 100) - jper = jper*temp/100.; - - job_exp = (unsigned int)cap_value(md->db->job_exp * jper, 1, UINT_MAX); - } + else + job_exp = (unsigned int)cap_value(md->db->job_exp * per * bonus/100. * map[m].jexp/100., 1, UINT_MAX); if((temp = tmpsd[i]->status.party_id )>0 && !md->dmglog[i].flag) //Homun-done damage (flag 1) is not given to party { diff --git a/src/map/pc.c b/src/map/pc.c index 49d880767..ad57ef809 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4230,17 +4230,8 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi if (!bonus) return; - temp = *base_exp*bonus/100; - if (*base_exp > UINT_MAX - temp) - *base_exp = UINT_MAX; - else - *base_exp += temp; - - temp = *job_exp*bonus/100; - if (*job_exp > UINT_MAX - temp) - *job_exp = UINT_MAX; - else - *job_exp += temp; + *base_exp += (unsigned int) cap_value((double)*base_exp * bonus/100., 1, UINT_MAX); + *job_exp += (unsigned int) cap_value((double)*job_exp * bonus/100., 1, UINT_MAX); return; } |