Added exp for level mod, misc fixes.

This commit is contained in:
root 2013-05-22 07:19:09 -05:00
parent 1e5d6b0e34
commit 930fda07c9
4 changed files with 64 additions and 33 deletions

View File

@ -1130,6 +1130,7 @@ public:
void mod_client_death_duel(Mob* killerMob); void mod_client_death_duel(Mob* killerMob);
void mod_client_death_env(); void mod_client_death_env();
int32 mod_client_xp(int32 in_exp, NPC *npc); int32 mod_client_xp(int32 in_exp, NPC *npc);
uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level);
protected: protected:
friend class Mob; friend class Mob;

View File

@ -485,7 +485,10 @@ uint32 Client::GetEXPForLevel(uint16 check_level)
mod *= 1000; mod *= 1000;
return(uint32(base * mod)); uint32 finalxp = (uint32)(base * mod);
finalxp = mod_client_xp_for_level(finalxp, check_level);
return(finalxp);
} }
void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) { void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) {

View File

@ -96,7 +96,7 @@ int NPC::mod_npc_damage(int damage, SkillType skillinuse, int hand, const Item_S
if(weapon) if(weapon)
{ {
damage += (int)ceil(((float)weapon->Damage / (float)weapon->Delay) * (float)GetLevel()); damage += (int)ceil(((float)weapon->Damage / (float)weapon->Delay) * (float)GetOwner()->GetLevel());
} }
damage = (int)ceil( (float)damage * chbonus ); damage = (int)ceil( (float)damage * chbonus );
@ -495,9 +495,22 @@ int32 Client::mod_client_xp(int32 in_xp, NPC *npc) {
return( (int32)((float)in_xp * xpmult) ); return( (int32)((float)in_xp * xpmult) );
} }
//Client XP formula. Changes here will cause clients to change level after gaining or losing xp.
//Either modify this before your server goes live, or be prepared to write a quest script that fixes levels.
uint32 Client::mod_client_xp_for_level(uint32 xp, uint16 check_level) {
uint16 check_levelm1 = check_level-1;
float mod;
mod = 4;
float base = (check_levelm1)*(check_levelm1)*(check_levelm1);
mod *= 1000;
return(uint32(base * mod));
}
//effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc. //effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc.
int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster) { int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster) {
if(IsClient()) { return(effect_value); } // if(IsClient()) { return(effect_value); }
if(!caster) { return(effect_value); } if(!caster) { return(effect_value); }
if(!caster->IsClient()) { return(effect_value); } if(!caster->IsClient()) { return(effect_value); }
@ -505,24 +518,31 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo
float spbonus = 0.0f; float spbonus = 0.0f;
float spadd = 0.0f; float spadd = 0.0f;
if(caster->GetClass() == BARD) int adval = caster->CastToClient()->Admin();
{ // adval = 0;
spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 150;
spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 150; if(caster->GetCasterClass() == 'W')
}
else if(caster->GetCasterClass() == 'W')
{ {
spbonus = (float)(caster->CastToClient()->GetActWIS() - DW_STATBASE) / 400; spbonus = (float)(caster->CastToClient()->GetActWIS() - DW_STATBASE) / 400;
spbonus += (float)(caster->CastToClient()->GetActSTA() - DW_STATBASE) / 400; spbonus += (float)(caster->CastToClient()->GetActSTA() - DW_STATBASE) / 400;
} }
else if(caster->GetCasterClass() == 'I') else if(caster->GetCasterClass() == 'I')
{ {
spbonus = (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400; if(caster->GetClass() == BARD)
spbonus += (float)(caster->CastToClient()->GetActDEX() - DW_STATBASE) / 400; {
spbonus = (float)(caster->CastToClient()->GetActCHA() - DW_STATBASE) / 150;
spbonus += (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 150;
}
else
{
spbonus = (float)(caster->CastToClient()->GetActINT() - DW_STATBASE) / 400;
spbonus += (float)(caster->CastToClient()->GetActDEX() - DW_STATBASE) / 400;
}
} }
else else
{ {
//No proc/click bonuses for non casters //No proc/click bonuses for non casters
if(adval > 80) { caster->Message(315, "CASTER CLASS NOT FOUND"); }
return(effect_value); return(effect_value);
} }
@ -625,6 +645,7 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo
break; break;
default: default:
if(adval > 80) { caster->Message(315, "Generic effect - ignored"); }
return(effect_value); return(effect_value);
break; break;
} }
@ -632,6 +653,7 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo
//Shroud of the bear //Shroud of the bear
if(caster->FindBuff(5045)) if(caster->FindBuff(5045))
{ {
if(adval > 80) { caster->Message(315, "Shroud of bear nerf"); }
spadd = spadd * -1; spadd = spadd * -1;
mult = 1.0f; mult = 1.0f;
} }
@ -641,6 +663,8 @@ int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mo
effect_value *= mult; effect_value *= mult;
if(adval > 80) { caster->Message(315, "Spell Bonus: %d, %d, %d", effect_value, spadd, effect_type); }
return( (int)(ceil(effect_value)) ); return( (int)(ceil(effect_value)) );
} }
@ -966,41 +990,44 @@ int Mob::mod_spell_stack(uint16 spellid1, int caster_level1, Mob* caster1, uint1
int Mob::mod_spell_resist(int resist_chance, int level_mod, int resist_modifier, int target_resist, uint8 resist_type, uint16 spell_id, Mob* caster) { int Mob::mod_spell_resist(int resist_chance, int level_mod, int resist_modifier, int target_resist, uint8 resist_type, uint16 spell_id, Mob* caster) {
int final = resist_chance + level_mod + resist_modifier + target_resist; int final = resist_chance + level_mod + resist_modifier + target_resist;
int temp_level_diff = GetLevel() - caster->GetLevel();
if(temp_level_diff > 15 && caster->GetLevel() < 46)
{
if(caster->IsClient())
{
if(caster->CastToClient()->GetAAXP() < 100)
{
return(0);
}
}
}
if(final > 185) { final = 185; } // Cap resist so it's always possible to land a spell (unless we hit the client level diff max). if(final > 185) { final = 185; } // Cap resist so it's always possible to land a spell (unless we hit the client level diff max).
if(!IsClient()) { return(final); }
if(!caster) { return(final); }
int temp_level_diff = GetLevel() - caster->GetLevel();
if(temp_level_diff > 15 && caster->GetLevel() < 46)
{
if(caster->IsClient())
{
if(caster->CastToClient()->GetAAXP() < 100)
{
return(0);
}
}
}
if(!caster->IsClient()) { return(final); }
float resistmod = 1.0f; float resistmod = 1.0f;
//Make charisma a part of all resists //Make charisma a part of all resists
resistmod += ((float)CastToClient()->GetActCHA() - DW_STATBASE) / 20; resistmod += ((float)caster->CastToClient()->GetActCHA() - DW_STATBASE) / 20;
//The other half is the casting stat //The other half is the casting stat
if(GetClass() == BARD) if(caster->GetClass() == BARD)
{ {
resistmod += ((float)CastToClient()->GetActCHA() - DW_STATBASE) / 20; resistmod += ((float)caster->CastToClient()->GetActCHA() - DW_STATBASE) / 20;
} }
else if(GetCasterClass() == 'W') else if(caster->GetCasterClass() == 'W')
{ {
resistmod += ((float)CastToClient()->GetActWIS() - DW_STATBASE) / 20; resistmod += ((float)caster->CastToClient()->GetActWIS() - DW_STATBASE) / 20;
} }
else if(GetCasterClass() == 'I') else if(caster->GetCasterClass() == 'I')
{ {
resistmod += ((float)CastToClient()->GetActINT() - DW_STATBASE) / 20; resistmod += ((float)caster->CastToClient()->GetActINT() - DW_STATBASE) / 20;
} }
final += resistmod; final -= resistmod;
if(caster->GetLevel() > 50) if(caster->GetLevel() > 50)
{ {

View File

@ -834,7 +834,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
spells[curspell].classes[initiator->GetPP().class_-1] <= max_level && //maximum level spells[curspell].classes[initiator->GetPP().class_-1] <= max_level && //maximum level
spells[curspell].classes[initiator->GetPP().class_-1] >= min_level && //minimum level spells[curspell].classes[initiator->GetPP().class_-1] >= min_level && //minimum level
spells[curspell].skill != 52 && spells[curspell].skill != 52 &&
( !RuleB(Spells, UseCHAScribeHack) || spells[curspell].effectid[EFFECT_COUNT - 1] != 10 ) spells[curspell].effectid[EFFECT_COUNT - 1] != 10
) )
{ {
if (book_slot == -1) //no more book slots if (book_slot == -1) //no more book slots