mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 17:38:26 +00:00
Merge
This commit is contained in:
+129
-181
@@ -62,7 +62,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
||||
skills[r] = database.GetSkillCap(GetClass(),(SkillUseTypes)r,GetLevel());
|
||||
}
|
||||
|
||||
GetMercSize();
|
||||
size = d->size;
|
||||
CalcBonuses();
|
||||
|
||||
SetHP(GetMaxHP());
|
||||
@@ -112,131 +112,66 @@ void Merc::CalcBonuses()
|
||||
rooted = FindType(SE_Root);
|
||||
}
|
||||
|
||||
void Merc::GetMercSize() {
|
||||
float Merc::GetDefaultSize() {
|
||||
|
||||
float MercSize = GetSize();
|
||||
|
||||
switch(this->GetRace()) {
|
||||
case 1: // Humans have no race bonus
|
||||
break;
|
||||
case 2: // Barbarian
|
||||
MercSize = 7.0;
|
||||
break;
|
||||
case 3: // Erudite
|
||||
break;
|
||||
case 4: // Wood Elf
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 5: // High Elf
|
||||
break;
|
||||
case 6: // Dark Elf
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 7: // Half Elf
|
||||
MercSize = 5.5;
|
||||
break;
|
||||
case 8: // Dwarf
|
||||
MercSize = 4.0;
|
||||
break;
|
||||
case 9: // Troll
|
||||
MercSize = 8.0;
|
||||
break;
|
||||
case 10: // Ogre
|
||||
MercSize = 9.0;
|
||||
break;
|
||||
case 11: // Halfling
|
||||
MercSize = 3.5;
|
||||
break;
|
||||
case 12: // Gnome
|
||||
MercSize = 3.0;
|
||||
break;
|
||||
case 128: // Iksar
|
||||
break;
|
||||
case 130: // Vah Shir
|
||||
MercSize = 7.0;
|
||||
break;
|
||||
case 330: // Froglok
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 522: // Drakkin
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
switch(this->GetRace())
|
||||
{
|
||||
case 1: // Humans
|
||||
MercSize = 6.0;
|
||||
break;
|
||||
case 2: // Barbarian
|
||||
MercSize = 7.0;
|
||||
break;
|
||||
case 3: // Erudite
|
||||
MercSize = 6.0;
|
||||
break;
|
||||
case 4: // Wood Elf
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 5: // High Elf
|
||||
MercSize = 6.0;
|
||||
break;
|
||||
case 6: // Dark Elf
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 7: // Half Elf
|
||||
MercSize = 5.5;
|
||||
break;
|
||||
case 8: // Dwarf
|
||||
MercSize = 4.0;
|
||||
break;
|
||||
case 9: // Troll
|
||||
MercSize = 8.0;
|
||||
break;
|
||||
case 10: // Ogre
|
||||
MercSize = 9.0;
|
||||
break;
|
||||
case 11: // Halfling
|
||||
MercSize = 3.5;
|
||||
break;
|
||||
case 12: // Gnome
|
||||
MercSize = 3.0;
|
||||
break;
|
||||
case 128: // Iksar
|
||||
MercSize = 6.0;
|
||||
break;
|
||||
case 130: // Vah Shir
|
||||
MercSize = 7.0;
|
||||
break;
|
||||
case 330: // Froglok
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
case 522: // Drakkin
|
||||
MercSize = 5.0;
|
||||
break;
|
||||
default:
|
||||
MercSize = 6.0;
|
||||
break;
|
||||
}
|
||||
|
||||
this->size = MercSize;
|
||||
}
|
||||
|
||||
void Merc::GenerateAppearance() {
|
||||
// Randomize facial appearance
|
||||
int iFace = 0;
|
||||
if(this->GetRace() == 2) { // Barbarian w/Tatoo
|
||||
iFace = MakeRandomInt(0, 79);
|
||||
}
|
||||
else {
|
||||
iFace = MakeRandomInt(0, 7);
|
||||
}
|
||||
|
||||
int iHair = 0;
|
||||
int iBeard = 0;
|
||||
int iBeardColor = 1;
|
||||
if(this->GetRace() == 522) {
|
||||
iHair = MakeRandomInt(0, 8);
|
||||
iBeard = MakeRandomInt(0, 11);
|
||||
iBeardColor = MakeRandomInt(0, 3);
|
||||
}
|
||||
else if(this->GetGender()) {
|
||||
iHair = MakeRandomInt(0, 2);
|
||||
if(this->GetRace() == 8) { // Dwarven Females can have a beard
|
||||
if(MakeRandomInt(1, 100) < 50) {
|
||||
iFace += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
iHair = MakeRandomInt(0, 3);
|
||||
iBeard = MakeRandomInt(0, 5);
|
||||
iBeardColor = MakeRandomInt(0, 19);
|
||||
}
|
||||
|
||||
int iHairColor = 0;
|
||||
if(this->GetRace() == 522) {
|
||||
iHairColor = MakeRandomInt(0, 3);
|
||||
}
|
||||
else {
|
||||
iHairColor = MakeRandomInt(0, 19);
|
||||
}
|
||||
|
||||
uint8 iEyeColor1 = (uint8)MakeRandomInt(0, 9);
|
||||
uint8 iEyeColor2 = 0;
|
||||
if(this->GetRace() == 522) {
|
||||
iEyeColor1 = iEyeColor2 = (uint8)MakeRandomInt(0, 11);
|
||||
}
|
||||
else if(MakeRandomInt(1, 100) > 96) {
|
||||
iEyeColor2 = MakeRandomInt(0, 9);
|
||||
}
|
||||
else {
|
||||
iEyeColor2 = iEyeColor1;
|
||||
}
|
||||
|
||||
int iHeritage = 0;
|
||||
int iTattoo = 0;
|
||||
int iDetails = 0;
|
||||
if(this->GetRace() == 522) {
|
||||
iHeritage = MakeRandomInt(0, 6);
|
||||
iTattoo = MakeRandomInt(0, 7);
|
||||
iDetails = MakeRandomInt(0, 7);
|
||||
}
|
||||
|
||||
this->luclinface = iFace;
|
||||
this->hairstyle = iHair;
|
||||
this->beard = iBeard;
|
||||
this->beardcolor = iBeardColor;
|
||||
this->haircolor = iHairColor;
|
||||
this->eyecolor1 = iEyeColor1;
|
||||
this->eyecolor2 = iEyeColor2;
|
||||
this->drakkin_heritage = iHeritage;
|
||||
this->drakkin_tattoo = iTattoo;
|
||||
this->drakkin_details = iDetails;
|
||||
return MercSize;
|
||||
}
|
||||
|
||||
int Merc::CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat)
|
||||
@@ -1258,7 +1193,6 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||
ns->spawn.guildrank = 0;
|
||||
ns->spawn.showhelm = 1;
|
||||
ns->spawn.flymode = 0;
|
||||
ns->spawn.size = 0;
|
||||
ns->spawn.NPC = 1; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
ns->spawn.IsMercenary = 1;
|
||||
|
||||
@@ -1523,7 +1457,7 @@ void Merc::AI_Process() {
|
||||
meleeDistance = meleeDistance * .30;
|
||||
}
|
||||
else {
|
||||
meleeDistance *= (float)MakeRandomFloat(.50, .85);
|
||||
meleeDistance *= (float)zone->random.Real(.50, .85);
|
||||
}
|
||||
if(IsMercCaster() && GetLevel() > 12) {
|
||||
if(IsMercCasterCombatRange(GetTarget()))
|
||||
@@ -1624,7 +1558,7 @@ void Merc::AI_Process() {
|
||||
|
||||
if (GetTarget() && flurrychance)
|
||||
{
|
||||
if(MakeRandomInt(0, 100) < flurrychance)
|
||||
if(zone->random.Roll(flurrychance))
|
||||
{
|
||||
Message_StringID(MT_NPCFlurry, YOU_FLURRY);
|
||||
Attack(GetTarget(), MainPrimary, false);
|
||||
@@ -1635,7 +1569,7 @@ void Merc::AI_Process() {
|
||||
int16 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance;
|
||||
|
||||
if (GetTarget() && ExtraAttackChanceBonus) {
|
||||
if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus)
|
||||
if(zone->random.Roll(ExtraAttackChanceBonus))
|
||||
{
|
||||
Attack(GetTarget(), MainPrimary, false);
|
||||
}
|
||||
@@ -1669,10 +1603,8 @@ void Merc::AI_Process() {
|
||||
int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance;
|
||||
DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f;
|
||||
|
||||
float random = MakeRandomFloat(0, 1);
|
||||
|
||||
// Max 78% of DW
|
||||
if (random < DualWieldProbability)
|
||||
if (zone->random.Roll(DualWieldProbability))
|
||||
{
|
||||
Attack(GetTarget(), MainSecondary); // Single attack with offhand
|
||||
|
||||
@@ -1934,7 +1866,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance,
|
||||
return false;
|
||||
|
||||
if (iChance < 100) {
|
||||
int8 tmp = MakeRandomInt(1, 100);
|
||||
int8 tmp = zone->random.Int(1, 100);
|
||||
if (tmp > iChance)
|
||||
return false;
|
||||
}
|
||||
@@ -2030,7 +1962,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) {
|
||||
return false;
|
||||
|
||||
if (iChance < 100) {
|
||||
if (MakeRandomInt(0, 100) > iChance){
|
||||
if (zone->random.Int(0, 100) > iChance){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2315,14 +2247,14 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) {
|
||||
|
||||
if(selectedMercSpell.spellid == 0 && !tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned()) {
|
||||
uint8 stunChance = 15;
|
||||
if(MakeRandomInt(1, 100) <= stunChance) {
|
||||
if(zone->random.Roll(stunChance)) {
|
||||
selectedMercSpell = GetBestMercSpellForStun(this);
|
||||
}
|
||||
}
|
||||
|
||||
if(selectedMercSpell.spellid == 0) {
|
||||
uint8 lureChance = 25;
|
||||
if(MakeRandomInt(1, 100) <= lureChance) {
|
||||
if(zone->random.Roll(lureChance)) {
|
||||
selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar);
|
||||
}
|
||||
}
|
||||
@@ -2742,14 +2674,14 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
|
||||
|
||||
int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals.
|
||||
|
||||
if (MakeRandomInt(1,100) <= chance){
|
||||
if (zone->random.Roll(chance)) {
|
||||
Critical = true;
|
||||
ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease;
|
||||
ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack;
|
||||
}
|
||||
|
||||
else if (GetClass() == CASTERDPS && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (MakeRandomInt(1,100) <= RuleI(Spells, WizCritChance))) {
|
||||
ratio = MakeRandomInt(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio.
|
||||
else if (GetClass() == CASTERDPS && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Roll(RuleI(Spells, WizCritChance)))) {
|
||||
ratio = zone->random.Int(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio.
|
||||
Critical = true;
|
||||
}
|
||||
|
||||
@@ -2833,7 +2765,7 @@ int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
|
||||
if (spellbonuses.CriticalHealDecay)
|
||||
chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay);
|
||||
|
||||
if(chance && (MakeRandomInt(0,99) < chance)) {
|
||||
if(chance && zone->random.Roll(chance)) {
|
||||
Critical = true;
|
||||
modifier = 2; //At present time no critical heal amount modifier SPA exists.
|
||||
}
|
||||
@@ -2864,7 +2796,7 @@ int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
|
||||
if (spellbonuses.CriticalRegenDecay)
|
||||
chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay);
|
||||
|
||||
if(chance && (MakeRandomInt(0,99) < chance))
|
||||
if(chance && zone->random.Roll(chance))
|
||||
return (value * 2);
|
||||
}
|
||||
|
||||
@@ -2876,7 +2808,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
|
||||
// Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
|
||||
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
|
||||
{
|
||||
int16 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100;
|
||||
int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100;
|
||||
// Doesnt generate mana, so best case is a free spell
|
||||
if(mana_back > cost)
|
||||
mana_back = cost;
|
||||
@@ -2893,7 +2825,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
|
||||
|
||||
if(focus_redux > 0)
|
||||
{
|
||||
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux);
|
||||
PercentManaReduction += zone->random.Real(1, (double)focus_redux);
|
||||
}
|
||||
|
||||
cost -= (cost * (PercentManaReduction / 100));
|
||||
@@ -3825,17 +3757,17 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) {
|
||||
}
|
||||
|
||||
//check of we even want to cast an AE nuke
|
||||
if(MakeRandomInt(1, 100) <= initialCastChance) {
|
||||
if(zone->random.Roll(initialCastChance)) {
|
||||
|
||||
result = GetBestMercSpellForAERainNuke(caster, tar);
|
||||
|
||||
//check if we have a spell & allow for other AE nuke types
|
||||
if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) {
|
||||
if(result.spellid == 0 && zone->random.Roll(castChanceFalloff)) {
|
||||
|
||||
result = GetBestMercSpellForPBAENuke(caster, tar);
|
||||
|
||||
//check if we have a spell & allow for other AE nuke types
|
||||
if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) {
|
||||
if(result.spellid == 0 && zone->random.Roll(castChanceFalloff)) {
|
||||
|
||||
result = GetBestMercSpellForTargetedAENuke(caster, tar);
|
||||
}
|
||||
@@ -3879,7 +3811,7 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) {
|
||||
&& !IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
uint8 numTargets = 0;
|
||||
if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) {
|
||||
if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) {
|
||||
if(numTargets >= numTargetsCheck && zone->random.Roll(castChance)) {
|
||||
result.spellid = mercSpellListItr->spellid;
|
||||
result.stance = mercSpellListItr->stance;
|
||||
result.type = mercSpellListItr->type;
|
||||
@@ -3929,7 +3861,7 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) {
|
||||
if(IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
uint8 numTargets = 0;
|
||||
if(CheckAENuke(caster, caster, mercSpellListItr->spellid, numTargets)) {
|
||||
if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) {
|
||||
if(numTargets >= numTargetsCheck && zone->random.Roll(castChance)) {
|
||||
result.spellid = mercSpellListItr->spellid;
|
||||
result.stance = mercSpellListItr->stance;
|
||||
result.type = mercSpellListItr->type;
|
||||
@@ -3976,7 +3908,7 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) {
|
||||
|
||||
for(std::list<MercSpell>::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsAERainNukeSpell(mercSpellListItr->spellid) && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
if(IsAERainNukeSpell(mercSpellListItr->spellid) && zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
uint8 numTargets = 0;
|
||||
if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) {
|
||||
if(numTargets >= numTargetsCheck) {
|
||||
@@ -4015,7 +3947,7 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) {
|
||||
for(std::list<MercSpell>::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid)
|
||||
&& MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
&& zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) {
|
||||
result.spellid = mercSpellListItr->spellid;
|
||||
result.stance = mercSpellListItr->stance;
|
||||
result.type = mercSpellListItr->type;
|
||||
@@ -4447,7 +4379,7 @@ bool Merc::CheckConfidence() {
|
||||
ConfidenceLossChance = 25 - ( 5 * (GetTierID() - 1));
|
||||
}
|
||||
|
||||
if(MakeRandomInt(0 ,100) < ConfidenceLossChance) {
|
||||
if(zone->random.Roll(ConfidenceLossChance)) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
@@ -4593,7 +4525,7 @@ void Merc::DoClassAttacks(Mob *target) {
|
||||
break;
|
||||
case TANK:{
|
||||
if(level >= RuleI(Combat, NPCBashKickLevel)){
|
||||
if(MakeRandomInt(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference.
|
||||
if(zone->random.Int(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference.
|
||||
{
|
||||
DoAnim(animKick);
|
||||
int32 dmg = 0;
|
||||
@@ -4606,7 +4538,7 @@ void Merc::DoClassAttacks(Mob *target) {
|
||||
if(RuleB(Combat, UseIntervalAC))
|
||||
dmg = GetKickDamage();
|
||||
else
|
||||
dmg = MakeRandomInt(1, GetKickDamage());
|
||||
dmg = zone->random.Int(1, GetKickDamage());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4628,7 +4560,7 @@ void Merc::DoClassAttacks(Mob *target) {
|
||||
if(RuleB(Combat, UseIntervalAC))
|
||||
dmg = GetBashDamage();
|
||||
else
|
||||
dmg = MakeRandomInt(1, GetBashDamage());
|
||||
dmg = zone->random.Int(1, GetBashDamage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4756,7 +4688,7 @@ const char* Merc::GetRandomName(){
|
||||
bool valid = false;
|
||||
|
||||
while(!valid) {
|
||||
int rndnum=MakeRandomInt(0, 75),n=1;
|
||||
int rndnum=zone->random.Int(0, 75),n=1;
|
||||
bool dlc=false;
|
||||
bool vwl=false;
|
||||
bool dbl=false;
|
||||
@@ -4777,18 +4709,18 @@ const char* Merc::GetRandomName(){
|
||||
rndname[0]=vowels[rndnum];
|
||||
vwl=true;
|
||||
}
|
||||
int namlen=MakeRandomInt(5, 10);
|
||||
int namlen=zone->random.Int(5, 10);
|
||||
for (int i=n;i<namlen;i++)
|
||||
{
|
||||
dlc=false;
|
||||
if (vwl) //last char was a vowel
|
||||
{ // so pick a cons or cons pair
|
||||
rndnum=MakeRandomInt(0, 62);
|
||||
rndnum=zone->random.Int(0, 62);
|
||||
if (rndnum>46)
|
||||
{ // pick a cons pair
|
||||
if (i>namlen-3) // last 2 chars in name?
|
||||
{ // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng"
|
||||
rndnum=MakeRandomInt(0, 7)*2;
|
||||
rndnum=zone->random.Int(0, 7)*2;
|
||||
}
|
||||
else
|
||||
{ // pick any from the set
|
||||
@@ -4806,12 +4738,12 @@ const char* Merc::GetRandomName(){
|
||||
}
|
||||
else
|
||||
{ // select a vowel
|
||||
rndname[i]=vowels[MakeRandomInt(0, 16)];
|
||||
rndname[i]=vowels[zone->random.Int(0, 16)];
|
||||
}
|
||||
vwl=!vwl;
|
||||
if (!dbl && !dlc)
|
||||
{ // one chance at double letters in name
|
||||
if (!MakeRandomInt(0, i+9)) // chances decrease towards end of name
|
||||
if (!zone->random.Int(0, i+9)) // chances decrease towards end of name
|
||||
{
|
||||
rndname[i+1]=rndname[i];
|
||||
dbl=true;
|
||||
@@ -4940,22 +4872,37 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
|
||||
}
|
||||
snprintf(npc_type->name, 64, "%s", c->GetMercInfo().merc_name);
|
||||
}
|
||||
uint8 gender = 0;
|
||||
if(merchant_id > 0) {
|
||||
|
||||
npc_type->race = merc_template->RaceID;
|
||||
|
||||
// Use the Gender and Size of the Merchant if possible
|
||||
uint8 tmpgender = 0;
|
||||
float tmpsize = 6.0f;
|
||||
if(merchant_id > 0)
|
||||
{
|
||||
NPC* tar = entity_list.GetNPCByID(merchant_id);
|
||||
if(tar) {
|
||||
gender = Mob::GetDefaultGender(npc_type->race, tar->GetGender());
|
||||
if(tar)
|
||||
{
|
||||
tmpgender = tar->GetGender();
|
||||
tmpsize = tar->GetSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpgender = Mob::GetDefaultGender(npc_type->race, c->GetMercInfo().Gender);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
gender = c->GetMercInfo().Gender;
|
||||
else
|
||||
{
|
||||
tmpgender = c->GetMercInfo().Gender;
|
||||
tmpsize = c->GetMercInfo().MercSize;
|
||||
}
|
||||
|
||||
sprintf(npc_type->lastname, "%s's %s", c->GetName(), "Mercenary");
|
||||
npc_type->gender = gender;
|
||||
sprintf(npc_type->lastname, "%s's Mercenary", c->GetName());
|
||||
npc_type->gender = tmpgender;
|
||||
npc_type->size = tmpsize;
|
||||
npc_type->loottable_id = 0; // Loottable has to be 0, otherwise we'll be leavin' some corpses!
|
||||
npc_type->npc_id = 0; //NPC ID has to be 0, otherwise db gets all confuzzled.
|
||||
npc_type->race = merc_template->RaceID;
|
||||
npc_type->class_ = merc_template->ClassID;
|
||||
npc_type->maxlevel = 0; //We should hard-set this to override scalerate's functionality in the NPC class when it is constructed.
|
||||
|
||||
@@ -4975,6 +4922,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
|
||||
snprintf(merc->name, 64, "%s", c->GetMercInfo().merc_name);
|
||||
merc->SetSuspended(c->GetMercInfo().IsSuspended);
|
||||
merc->gender = c->GetMercInfo().Gender;
|
||||
merc->size = c->GetMercInfo().MercSize;
|
||||
merc->SetHP(c->GetMercInfo().hp <= 0 ? merc->GetMaxHP() : c->GetMercInfo().hp);
|
||||
merc->SetMana(c->GetMercInfo().hp <= 0 ? merc->GetMaxMana() : c->GetMercInfo().mana);
|
||||
merc->SetEndurance(c->GetMercInfo().endurance);
|
||||
@@ -4989,6 +4937,11 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
|
||||
merc->drakkin_tattoo = c->GetMercInfo().drakkinTattoo;
|
||||
merc->drakkin_details = c->GetMercInfo().drakkinDetails;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Give Random Features to newly hired Mercs
|
||||
merc->RandomizeFeatures(false, true);
|
||||
}
|
||||
|
||||
if(merc->GetMercID()) {
|
||||
database.LoadMercBuffs(merc);
|
||||
@@ -5008,7 +4961,8 @@ void Merc::UpdateMercInfo(Client *c) {
|
||||
snprintf(c->GetMercInfo().merc_name, 64, "%s", name);
|
||||
c->GetMercInfo().mercid = GetMercID();
|
||||
c->GetMercInfo().IsSuspended = IsSuspended();
|
||||
c->GetMercInfo().Gender = gender;
|
||||
c->GetMercInfo().Gender = GetGender();
|
||||
c->GetMercInfo().MercSize = GetSize();
|
||||
c->GetMercInfo().hp = GetHP();
|
||||
c->GetMercInfo().mana = GetMana();
|
||||
c->GetMercInfo().endurance = GetEndurance();
|
||||
@@ -5540,7 +5494,7 @@ void Client::SpawnMercOnZone() {
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 TimeDiff = GetMercInfo().SuspendedTime + RuleI(Mercs, SuspendIntervalS) - time(nullptr);
|
||||
int32 TimeDiff = GetMercInfo().SuspendedTime - time(nullptr);
|
||||
if (TimeDiff > 0)
|
||||
{
|
||||
if (!GetPTimers().Enabled(pTimerMercSuspend))
|
||||
@@ -5558,6 +5512,11 @@ void Client::SpawnMercOnZone() {
|
||||
Message(7, "Mercenary Debug: SpawnMercOnZone Suspended Merc.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No Merc Hired
|
||||
SendClearMercInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void Client::SendMercTimer(Merc* merc) {
|
||||
@@ -5604,9 +5563,6 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
|
||||
SetMerc(merc);
|
||||
merc->Unsuspend(setMaxStats);
|
||||
merc->SetStance(GetMercInfo().Stance);
|
||||
GetMercInfo().SuspendedTime = 0;
|
||||
|
||||
//SendMercTimer(merc);
|
||||
|
||||
if (MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: SpawnMerc Success.");
|
||||
@@ -5666,7 +5622,6 @@ bool Client::MercOnlyOrNoGroup() {
|
||||
bool Merc::Unsuspend(bool setMaxStats) {
|
||||
|
||||
Client* mercOwner = nullptr;
|
||||
bool loaded = false;
|
||||
|
||||
if(GetMercOwner()) {
|
||||
mercOwner = GetMercOwner();
|
||||
@@ -5694,12 +5649,8 @@ bool Merc::Unsuspend(bool setMaxStats) {
|
||||
if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false))
|
||||
mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend);
|
||||
|
||||
MercJoinClientGroup();
|
||||
|
||||
if(loaded)
|
||||
if (MercJoinClientGroup())
|
||||
{
|
||||
LoadMercSpells();
|
||||
|
||||
if(setMaxStats)
|
||||
{
|
||||
SetHP(GetMaxHP());
|
||||
@@ -5977,7 +5928,7 @@ Merc* Client::GetMerc() {
|
||||
if(GetMercID() == 0)
|
||||
{
|
||||
if (MERC_DEBUG > 0)
|
||||
//Message(7, "Mercenary Debug: GetMerc 0.");
|
||||
Message(7, "Mercenary Debug: GetMerc 0.");
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
@@ -5998,9 +5949,6 @@ Merc* Client::GetMerc() {
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
if (MERC_DEBUG > 0)
|
||||
//Message(7, "Mercenary Debug: GetMerc Success.");
|
||||
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
@@ -6073,7 +6021,7 @@ void Client::SetMerc(Merc* newmerc) {
|
||||
GetMercInfo().IsSuspended = newmerc->IsSuspended();
|
||||
GetMercInfo().SuspendedTime = 0;
|
||||
GetMercInfo().Gender = newmerc->GetGender();
|
||||
//GetMercInfo().State = newmerc->GetStance();
|
||||
GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL;
|
||||
snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName());
|
||||
if (MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: SetMerc New Merc.");
|
||||
|
||||
Reference in New Issue
Block a user