* 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://svn.code.sf.net/p/rathena/svn/trunk@10921 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-07-27 19:06:40 +00:00
parent 43e5652fb6
commit 0711d4375e
6 changed files with 106 additions and 124 deletions

View File

@ -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...

View File

@ -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.

View File

@ -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; },{},{}

View File

@ -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;
}

View File

@ -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
{

View File

@ -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;
}