double to float explicit conversion

This commit is contained in:
Arthur Dene Ice 2014-05-05 19:03:27 -07:00
parent 554daf7b88
commit 5eb260b0cb
10 changed files with 86 additions and 86 deletions

View File

@ -1169,11 +1169,11 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
if (mysql_num_rows(result) > 0) { if (mysql_num_rows(result) > 0) {
row = mysql_fetch_row(result); row = mysql_fetch_row(result);
if (safe_x != 0) if (safe_x != 0)
*safe_x = atof(row[0]); *safe_x = (float)atof(row[0]);
if (safe_y != 0) if (safe_y != 0)
*safe_y = atof(row[1]); *safe_y = (float)atof(row[1]);
if (safe_z != 0) if (safe_z != 0)
*safe_z = atof(row[2]); *safe_z = (float)atof(row[2]);
if (minstatus != 0) if (minstatus != 0)
*minstatus = atoi(row[3]); *minstatus = atoi(row[3]);
if (minlevel != 0) if (minlevel != 0)
@ -1221,11 +1221,11 @@ bool Database::GetZoneLongName(const char* short_name, char** long_name, char* f
strcpy(file_name, row[1]); strcpy(file_name, row[1]);
} }
if (safe_x != 0) if (safe_x != 0)
*safe_x = atof(row[2]); *safe_x = (float)atof(row[2]);
if (safe_y != 0) if (safe_y != 0)
*safe_y = atof(row[3]); *safe_y = (float)atof(row[3]);
if (safe_z != 0) if (safe_z != 0)
*safe_z = atof(row[4]); *safe_z = (float)atof(row[4]);
if (graveyard_id != 0) if (graveyard_id != 0)
*graveyard_id = atoi(row[5]); *graveyard_id = atoi(row[5]);
if (maxclients) if (maxclients)
@ -1283,13 +1283,13 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
if(graveyard_zoneid != 0) if(graveyard_zoneid != 0)
*graveyard_zoneid = atoi(row[0]); *graveyard_zoneid = atoi(row[0]);
if(graveyard_x != 0) if(graveyard_x != 0)
*graveyard_x = atof(row[1]); *graveyard_x = (float)atof(row[1]);
if(graveyard_y != 0) if(graveyard_y != 0)
*graveyard_y = atof(row[2]); *graveyard_y = (float)atof(row[2]);
if(graveyard_z != 0) if(graveyard_z != 0)
*graveyard_z = atof(row[3]); *graveyard_z = (float)atof(row[3]);
if(graveyard_heading != 0) if(graveyard_heading != 0)
*graveyard_heading = atof(row[4]); *graveyard_heading = (float)atof(row[4]);
mysql_free_result(result); mysql_free_result(result);
return true; return true;
} }
@ -1852,11 +1852,11 @@ uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZo
if(oInstanceID) if(oInstanceID)
*oInstanceID = atoi(row[3]); *oInstanceID = atoi(row[3]);
if (oX) if (oX)
*oX = atof(row[4]); *oX = (float)atof(row[4]);
if (oY) if (oY)
*oY = atof(row[5]); *oY = (float)atof(row[5]);
if (oZ) if (oZ)
*oZ = atof(row[6]); *oZ = (float)atof(row[6]);
mysql_free_result(result); mysql_free_result(result);
return charid; return charid;
} }

View File

@ -1899,7 +1899,7 @@ ENCODE(OP_ZoneSpawns)
VARSTRUCT_ENCODE_STRING(Buffer, emu->name); VARSTRUCT_ENCODE_STRING(Buffer, emu->name);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spawnId); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spawnId);
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level);
VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7f); // Eye Height?
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC);
structs::Spawn_Struct_Bitfields *Bitfields = (structs::Spawn_Struct_Bitfields*)Buffer; structs::Spawn_Struct_Bitfields *Bitfields = (structs::Spawn_Struct_Bitfields*)Buffer;

View File

@ -1047,7 +1047,7 @@ ENCODE(OP_ZoneSpawns) {
} }
else else
{ {
VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7f); // Eye Height?
} }
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC);

View File

@ -1059,7 +1059,7 @@ ENCODE(OP_ZoneSpawns) {
} }
else else
{ {
VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7f); // Eye Height?
} }
VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC);

View File

@ -171,7 +171,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas
_log(RULES__CHANGE, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); _log(RULES__CHANGE, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]);
break; break;
case RealRule: case RealRule:
m_RuleRealValues[index] = atof(rule_value); m_RuleRealValues[index] = (float)atof(rule_value);
_log(RULES__CHANGE, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); _log(RULES__CHANGE, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]);
break; break;
case BoolRule: case BoolRule:

View File

@ -1220,9 +1220,9 @@ bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfi
if (current_zone) if (current_zone)
strcpy(current_zone, row[1]); strcpy(current_zone, row[1]);
pp->zone_id = GetZoneID(row[1]); pp->zone_id = GetZoneID(row[1]);
pp->x = atof(row[2]); pp->x = (float)atof(row[2]);
pp->y = atof(row[3]); pp->y = (float)atof(row[3]);
pp->z = atof(row[4]); pp->z = (float)atof(row[4]);
pp->zoneInstance = atoi(row[6]); pp->zoneInstance = atoi(row[6]);
if (pp->x == -1 && pp->y == -1 && pp->z == -1) if (pp->x == -1 && pp->y == -1 && pp->z == -1)
GetSafePoints(pp->zone_id, GetInstanceVersion(pp->zoneInstance), &pp->x, &pp->y, &pp->z); GetSafePoints(pp->zone_id, GetInstanceVersion(pp->zoneInstance), &pp->x, &pp->y, &pp->z);

View File

@ -222,22 +222,22 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
{ {
if(level_difference >= -range) if(level_difference >= -range)
{ {
chancetohit += (level_difference / range) * RuleR(Combat,HitFalloffMinor); //5 chancetohit += (float)((level_difference / range) * RuleR(Combat,HitFalloffMinor)); //5
} }
else if (level_difference >= -(range+3.0)) else if (level_difference >= -(range+3.0))
{ {
chancetohit -= RuleR(Combat,HitFalloffMinor); chancetohit -= RuleR(Combat,HitFalloffMinor);
chancetohit += ((level_difference+range) / (3.0)) * RuleR(Combat,HitFalloffModerate); //7 chancetohit += (float)(((level_difference+range) / (3.0)) * RuleR(Combat,HitFalloffModerate)); //7
} }
else else
{ {
chancetohit -= (RuleR(Combat,HitFalloffMinor) + RuleR(Combat,HitFalloffModerate)); chancetohit -= (RuleR(Combat,HitFalloffMinor) + RuleR(Combat,HitFalloffModerate));
chancetohit += ((level_difference+range+3.0)/12.0) * RuleR(Combat,HitFalloffMajor); //50 chancetohit += (float)(((level_difference+range+3.0)/12.0) * RuleR(Combat,HitFalloffMajor)); //50
} }
} }
else else
{ {
chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); chancetohit += (float)(RuleR(Combat,HitBonusPerLevel) * level_difference);
} }
mlog(COMBAT__TOHIT, "Chance to hit after level diff calc %.2f", chancetohit); mlog(COMBAT__TOHIT, "Chance to hit after level diff calc %.2f", chancetohit);
@ -340,7 +340,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
// Did we hit? // Did we hit?
// //
float tohit_roll = MakeRandomFloat(0, 100); float tohit_roll = (float)MakeRandomFloat(0, 100);
mlog(COMBAT__TOHIT, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); mlog(COMBAT__TOHIT, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll);
@ -393,7 +393,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
} }
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetDEX()/200); bonus = 2.0f + skill/60.0f + (GetDEX()/200);
bonus *= riposte_chance; bonus *= riposte_chance;
bonus = mod_riposte_chance(bonus, attacker); bonus = mod_riposte_chance(bonus, attacker);
RollTable[0] = bonus + (itembonuses.HeroicDEX / 25); // 25 heroic = 1%, applies to ripo, parry, block RollTable[0] = bonus + (itembonuses.HeroicDEX / 25); // 25 heroic = 1%, applies to ripo, parry, block
@ -433,7 +433,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
} }
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/35.0 + (GetDEX()/200); bonus = 2.0f + skill/35.0f + (GetDEX()/200);
bonus = mod_block_chance(bonus, attacker); bonus = mod_block_chance(bonus, attacker);
RollTable[1] = RollTable[0] + (bonus * block_chance); RollTable[1] = RollTable[0] + (bonus * block_chance);
} }
@ -477,7 +477,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
} }
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetDEX()/200); bonus = 2.0f + skill/60.0f + (GetDEX()/200);
bonus *= parry_chance; bonus *= parry_chance;
bonus = mod_parry_chance(bonus, attacker); bonus = mod_parry_chance(bonus, attacker);
RollTable[2] = RollTable[1] + bonus; RollTable[2] = RollTable[1] + bonus;
@ -500,7 +500,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
} }
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetAGI()/200); bonus = 2.0f + skill/60.0f + (GetAGI()/200);
bonus *= dodge_chance; bonus *= dodge_chance;
//DCBOOMKAR //DCBOOMKAR
bonus = mod_dodge_chance(bonus, attacker); bonus = mod_dodge_chance(bonus, attacker);
@ -512,7 +512,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
} }
if(damage > 0){ if(damage > 0){
roll = MakeRandomFloat(0,100); roll = (float)MakeRandomFloat(0,100);
if(roll <= RollTable[0]){ if(roll <= RollTable[0]){
damage = -3; damage = -3;
} }
@ -544,8 +544,8 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
spellbonuses.CombatStability) / 100.0f; spellbonuses.CombatStability) / 100.0f;
if (RuleB(Combat, UseIntervalAC)) { if (RuleB(Combat, UseIntervalAC)) {
float softcap = (GetSkill(SkillDefense) + GetLevel()) * float softcap = (float)((GetSkill(SkillDefense) + GetLevel()) *
RuleR(Combat, SoftcapFactor) * (1.0 + aa_mit); RuleR(Combat, SoftcapFactor) * (1.0f + aa_mit));
float mitigation_rating = 0.0; float mitigation_rating = 0.0;
float attack_rating = 0.0; float attack_rating = 0.0;
int shield_ac = 0; int shield_ac = 0;
@ -557,7 +557,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
if (IsClient()) { if (IsClient()) {
armor = CastToClient()->GetRawACNoShield(shield_ac); armor = CastToClient()->GetRawACNoShield(shield_ac);
weight = (CastToClient()->CalcCurrentWeight() / 10.0); weight = (CastToClient()->CalcCurrentWeight() / 10.0f);
} else if (IsNPC()) { } else if (IsNPC()) {
armor = CastToNPC()->GetRawAC(); armor = CastToNPC()->GetRawAC();
@ -634,17 +634,17 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
if (GetClass() == WIZARD || GetClass() == MAGICIAN || if (GetClass() == WIZARD || GetClass() == MAGICIAN ||
GetClass() == NECROMANCER || GetClass() == ENCHANTER) GetClass() == NECROMANCER || GetClass() == ENCHANTER)
mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 4.0) + armor + 1; mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 4.0f) + armor + 1;
else else
mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 3.0) + (armor * 1.333333) + 1; mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 3.0f) + (armor * 1.333333f) + 1;
mitigation_rating *= 0.847; mitigation_rating *= 0.847f;
mitigation_rating = mod_mitigation_rating(mitigation_rating, attacker); mitigation_rating = mod_mitigation_rating(mitigation_rating, attacker);
if (attacker->IsClient()) if (attacker->IsClient())
attack_rating = (attacker->CastToClient()->CalcATK() + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); attack_rating = (attacker->CastToClient()->CalcATK() + ((attacker->GetSTR()-66) * 0.9f) + (attacker->GetSkill(SkillOffense)*1.345f));
else else
attack_rating = (attacker->GetATK() + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); attack_rating = (attacker->GetATK() + (attacker->GetSkill(SkillOffense)*1.345f) + ((attacker->GetSTR()-66) * 0.9f));
attack_rating = attacker->mod_attack_rating(attack_rating, this); attack_rating = attacker->mod_attack_rating(attack_rating, this);
@ -673,7 +673,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
int acrandom=300; int acrandom=300;
if (database.GetVariable("ACreduction", tmp, 9)) if (database.GetVariable("ACreduction", tmp, 9))
{ {
acreduction=atof(tmp); acreduction=(float)atof(tmp);
if (acreduction>100) acreduction=100; if (acreduction>100) acreduction=100;
} }
@ -715,8 +715,8 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
float mit_rating, float atk_rating) float mit_rating, float atk_rating)
{ {
float d = 10.0; float d = 10.0;
float mit_roll = MakeRandomFloat(0, mit_rating); float mit_roll = (float)MakeRandomFloat(0, mit_rating);
float atk_roll = MakeRandomFloat(0, atk_rating); float atk_roll = (float)MakeRandomFloat(0, atk_rating);
if (atk_roll > mit_roll) { if (atk_roll > mit_roll) {
float a_diff = atk_roll - mit_roll; float a_diff = atk_roll - mit_roll;
@ -725,7 +725,7 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
if (thac0 > thac0cap) if (thac0 > thac0cap)
thac0 = thac0cap; thac0 = thac0cap;
d -= 10.0 * (a_diff / thac0); d -= (float)10.0 * (a_diff / thac0);
} else if (mit_roll > atk_roll) { } else if (mit_roll > atk_roll) {
float m_diff = mit_roll - atk_roll; float m_diff = mit_roll - atk_roll;
float thac20 = mit_rating * RuleR(Combat, ACthac20Factor); float thac20 = mit_rating * RuleR(Combat, ACthac20Factor);
@ -733,7 +733,7 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
if (thac20 > thac20cap) if (thac20 > thac20cap)
thac20 = thac20cap; thac20 = thac20cap;
d += 10.0 * (m_diff / thac20); d += 10.0f * (m_diff / thac20);
} }
if (d < 0.0) if (d < 0.0)
@ -741,7 +741,7 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
else if (d > 20.0) else if (d > 20.0)
d = 20.0; d = 20.0;
float interval = (damage - minhit) / 20.0; float interval = (damage - minhit) / 20.0f;
damage -= ((int)d * interval); damage -= ((int)d * interval);
damage -= (minhit * itembonuses.MeleeMitigation / 100); damage -= (minhit * itembonuses.MeleeMitigation / 100);
@ -757,16 +757,16 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit,
return Mob::GetMeleeMitDmg(attacker, damage, minhit, mit_rating, atk_rating); return Mob::GetMeleeMitDmg(attacker, damage, minhit, mit_rating, atk_rating);
int d = 10; int d = 10;
// floats for the rounding issues // floats for the rounding issues
float dmg_interval = (damage - minhit) / 19.0; float dmg_interval = (damage - minhit) / 19.0f;
float dmg_bonus = minhit - dmg_interval; float dmg_bonus = minhit - dmg_interval;
float spellMeleeMit = spellbonuses.MeleeMitigation / 100.0; float spellMeleeMit = spellbonuses.MeleeMitigation / 100.0f;
if (GetClass() == WARRIOR) if (GetClass() == WARRIOR)
spellMeleeMit += 0.05; spellMeleeMit += 0.05;
dmg_bonus -= dmg_bonus * (itembonuses.MeleeMitigation / 100.0); dmg_bonus -= (float)(dmg_bonus * (itembonuses.MeleeMitigation / 100.0));
dmg_interval -= dmg_interval * spellMeleeMit; dmg_interval -= dmg_interval * spellMeleeMit;
float mit_roll = MakeRandomFloat(0, mit_rating); float mit_roll = (float)MakeRandomFloat(0, mit_rating);
float atk_roll = MakeRandomFloat(0, atk_rating); float atk_roll = (float)MakeRandomFloat(0, atk_rating);
if (atk_roll > mit_roll) { if (atk_roll > mit_roll) {
float a_diff = atk_roll - mit_roll; float a_diff = atk_roll - mit_roll;
@ -4294,7 +4294,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
if(MakeRandomFloat(0, 1) < critChance){ if(MakeRandomFloat(0, 1) < critChance){
int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1];
damage = (damage*SlayDmgBonus*2.25)/100; damage = (damage*SlayDmgBonus*2.25f)/100;
entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s cleanses %s target!(%d)", GetCleanName(), this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its", damage); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s cleanses %s target!(%d)", GetCleanName(), this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its", damage);
return; return;
} }

View File

@ -3667,7 +3667,7 @@ void Bot::AI_Process() {
float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget()); float meleeDistance = GetMaxMeleeRangeToTarget(GetTarget());
if(botClass == SHADOWKNIGHT || botClass == PALADIN || botClass == WARRIOR) { if(botClass == SHADOWKNIGHT || botClass == PALADIN || botClass == WARRIOR) {
meleeDistance = meleeDistance * .30; meleeDistance = meleeDistance * .30f;
} }
else { else {
meleeDistance *= (float)MakeRandomFloat(.50, .85); meleeDistance *= (float)MakeRandomFloat(.50, .85);
@ -4141,8 +4141,8 @@ void Bot::PetAIProcess() {
{ {
if(botPet->GetOwner()->GetLevel() >= 24) if(botPet->GetOwner()->GetLevel() >= 24)
{ {
float DualWieldProbability = (botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f; float DualWieldProbability = (float)((botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f);
DualWieldProbability -= MakeRandomFloat(0, 1); DualWieldProbability -= (float)MakeRandomFloat(0, 1);
if(DualWieldProbability < 0){ if(DualWieldProbability < 0){
botPet->Attack(botPet->GetTarget(), 14); botPet->Attack(botPet->GetTarget(), 14);
if (botPet->CanThisClassDoubleAttack()) if (botPet->CanThisClassDoubleAttack())
@ -7814,7 +7814,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
skill = GetSkill(SkillRiposte); skill = GetSkill(SkillRiposte);
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetDEX()/200); bonus = 2.0f + skill/60.0f + (GetDEX()/200);
bonus *= riposte_chance; bonus *= riposte_chance;
RollTable[0] = bonus + (itembonuses.HeroicDEX / 25); // 25 heroic = 1%, applies to ripo, parry, block RollTable[0] = bonus + (itembonuses.HeroicDEX / 25); // 25 heroic = 1%, applies to ripo, parry, block
} }
@ -7850,7 +7850,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
skill = GetSkill(SkillBlock); skill = GetSkill(SkillBlock);
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/35.0 + (GetDEX()/200); bonus = 2.0f + skill/35.0f + (GetDEX()/200);
RollTable[1] = RollTable[0] + (bonus * block_chance) - riposte_chance; RollTable[1] = RollTable[0] + (bonus * block_chance) - riposte_chance;
block_chance *= bonus; // set this so we can remove it from the parry calcs block_chance *= bonus; // set this so we can remove it from the parry calcs
} }
@ -7898,7 +7898,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
skill = GetSkill(SkillParry); skill = GetSkill(SkillParry);
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetDEX()/200); bonus = 2.0f + skill/60.0f + (GetDEX()/200);
bonus *= parry_chance; bonus *= parry_chance;
RollTable[2] = RollTable[1] + bonus - block_chance; RollTable[2] = RollTable[1] + bonus - block_chance;
} }
@ -7917,7 +7917,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
skill = GetSkill(SkillDodge); skill = GetSkill(SkillDodge);
if (!ghit) { //if they are not using a garunteed hit discipline if (!ghit) { //if they are not using a garunteed hit discipline
bonus = 2.0 + skill/60.0 + (GetAGI()/200); bonus = 2.0f + skill/60.0f + (GetAGI()/200);
bonus *= dodge_chance; bonus *= dodge_chance;
RollTable[3] = RollTable[2] + bonus - (itembonuses.HeroicDEX / 25) + (itembonuses.HeroicAGI / 25) - parry_chance; // Remove the dex as it doesnt count for dodge RollTable[3] = RollTable[2] + bonus - (itembonuses.HeroicDEX / 25) + (itembonuses.HeroicAGI / 25) - parry_chance; // Remove the dex as it doesnt count for dodge
} }
@ -9382,11 +9382,11 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
break; break;
} }
bonus += 0.05 * GetAA(aaAdvancedSpellCastingMastery); bonus += 0.05f * GetAA(aaAdvancedSpellCastingMastery);
if(SuccessChance <= (SpecializeSkill * 0.3 * bonus)) if(SuccessChance <= (SpecializeSkill * 0.3 * bonus))
{ {
PercentManaReduction = 1 + 0.05 * SpecializeSkill; PercentManaReduction = 1.05f * SpecializeSkill;
switch(GetAA(aaSpellCastingMastery)) switch(GetAA(aaSpellCastingMastery))
{ {
case 1: case 1:
@ -9418,7 +9418,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
if(focus_redux > 0) if(focus_redux > 0)
{ {
PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); PercentManaReduction += (float)MakeRandomFloat(1, (double)focus_redux);
} }
cost -= (cost * (PercentManaReduction / 100)); cost -= (cost * (PercentManaReduction / 100));

View File

@ -1337,7 +1337,7 @@ void command_zone(Client *c, const Seperator *sep)
if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){ if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){
//zone to specific coords //zone to specific coords
c->MovePC(zoneid, (float)atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0); c->MovePC(zoneid, (float)atof(sep->arg[2]), (float)atof(sep->arg[3]), (float)atof(sep->arg[4]), 0.0f, 0);
} }
else else
//zone to safe coords //zone to safe coords
@ -1759,16 +1759,16 @@ void command_zclip(Client *c, const Seperator *sep)
else if(atoi(sep->arg[1])>atoi(sep->arg[2])) else if(atoi(sep->arg[1])>atoi(sep->arg[2]))
c->Message(0, "ERROR: Min clip is greater than max clip!"); c->Message(0, "ERROR: Min clip is greater than max clip!");
else { else {
zone->newzone_data.minclip = atof(sep->arg[1]); zone->newzone_data.minclip = (float)atof(sep->arg[1]);
zone->newzone_data.maxclip = atof(sep->arg[2]); zone->newzone_data.maxclip = (float)atof(sep->arg[2]);
if(sep->arg[3][0]!=0) if(sep->arg[3][0]!=0)
zone->newzone_data.fog_minclip[0]=atof(sep->arg[3]); zone->newzone_data.fog_minclip[0]=(float)atof(sep->arg[3]);
if(sep->arg[4][0]!=0) if(sep->arg[4][0]!=0)
zone->newzone_data.fog_minclip[1]=atof(sep->arg[4]); zone->newzone_data.fog_minclip[1]=(float)atof(sep->arg[4]);
if(sep->arg[5][0]!=0) if(sep->arg[5][0]!=0)
zone->newzone_data.fog_maxclip[0]=atof(sep->arg[5]); zone->newzone_data.fog_maxclip[0]=(float)atof(sep->arg[5]);
if(sep->arg[6][0]!=0) if(sep->arg[6][0]!=0)
zone->newzone_data.fog_maxclip[1]=atof(sep->arg[6]); zone->newzone_data.fog_maxclip[1]=(float)atof(sep->arg[6]);
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
entity_list.QueueClients(c, outapp); entity_list.QueueClients(c, outapp);
@ -4355,7 +4355,7 @@ void command_zuwcoords(Client *c, const Seperator *sep)
if(sep->arg[1][0]==0) if(sep->arg[1][0]==0)
c->Message(0, "Usage: #zuwcoords <under world coords>"); c->Message(0, "Usage: #zuwcoords <under world coords>");
else { else {
zone->newzone_data.underworld = atof(sep->arg[1]); zone->newzone_data.underworld = (float)atof(sep->arg[1]);
//float newdata = atof(sep->arg[1]); //float newdata = atof(sep->arg[1]);
//memcpy(&zone->zone_header_data[130], &newdata, sizeof(float)); //memcpy(&zone->zone_header_data[130], &newdata, sizeof(float));
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
@ -4370,7 +4370,7 @@ void command_zunderworld(Client *c, const Seperator *sep)
if(sep->arg[1][0]==0) if(sep->arg[1][0]==0)
c->Message(0, "Usage: #zunderworld <zcoord>"); c->Message(0, "Usage: #zunderworld <zcoord>");
else { else {
zone->newzone_data.underworld = atof(sep->arg[1]); zone->newzone_data.underworld = (float)atof(sep->arg[1]);
} }
} }
@ -4380,9 +4380,9 @@ void command_zsafecoords(Client *c, const Seperator *sep)
if(sep->arg[3][0]==0) if(sep->arg[3][0]==0)
c->Message(0, "Usage: #zsafecoords <safe x> <safe y> <safe z>"); c->Message(0, "Usage: #zsafecoords <safe x> <safe y> <safe z>");
else { else {
zone->newzone_data.safe_x = atof(sep->arg[1]); zone->newzone_data.safe_x = (float)atof(sep->arg[1]);
zone->newzone_data.safe_y = atof(sep->arg[2]); zone->newzone_data.safe_y = (float)atof(sep->arg[2]);
zone->newzone_data.safe_z = atof(sep->arg[3]); zone->newzone_data.safe_z = (float)atof(sep->arg[3]);
//float newdatax = atof(sep->arg[1]); //float newdatax = atof(sep->arg[1]);
//float newdatay = atof(sep->arg[2]); //float newdatay = atof(sep->arg[2]);
//float newdataz = atof(sep->arg[3]); //float newdataz = atof(sep->arg[3]);
@ -9457,10 +9457,10 @@ void command_object(Client *c, const Seperator *sep)
{ {
col = 0; col = 0;
id = atoi(row[col++]); id = atoi(row[col++]);
od.x = atof(row[col++]); od.x = (float)atof(row[col++]);
od.y = atof(row[col++]); od.y = (float)atof(row[col++]);
od.z = atof(row[col++]); od.z = (float)atof(row[col++]);
od.heading = atof(row[col++]); od.heading = (float)atof(row[col++]);
itemid = atoi(row[col++]); itemid = atoi(row[col++]);
strn0cpy(od.object_name, row[col++], sizeof(od.object_name)); strn0cpy(od.object_name, row[col++], sizeof(od.object_name));
od.object_name[sizeof(od.object_name) - 1] = '\0'; // Required if strlen(row[col++]) exactly == sizeof(object_name) od.object_name[sizeof(od.object_name) - 1] = '\0'; // Required if strlen(row[col++]) exactly == sizeof(object_name)
@ -10135,10 +10135,10 @@ void command_object(Client *c, const Seperator *sep)
} }
else // Move to x, y, z [h] else // Move to x, y, z [h]
{ {
od.x = atof(sep->arg[3]); od.x = (float)atof(sep->arg[3]);
if (sep->argnum > 3) if (sep->argnum > 3)
{ {
od.y = atof(sep->arg[4]); od.y = (float)atof(sep->arg[4]);
} }
else else
{ {
@ -10147,7 +10147,7 @@ void command_object(Client *c, const Seperator *sep)
if (sep->argnum > 4) if (sep->argnum > 4)
{ {
od.z = atof(sep->arg[5]); od.z = (float)atof(sep->arg[5]);
} }
else else
{ {
@ -10707,10 +10707,10 @@ void command_object(Client *c, const Seperator *sep)
memset(&od, 0, sizeof(od)); memset(&od, 0, sizeof(od));
col = 0; col = 0;
od.x = atof(row[col++]); od.x = (float)atof(row[col++]);
od.y = atof(row[col++]); od.y = (float)atof(row[col++]);
od.z = atof(row[col++]); od.z = (float)atof(row[col++]);
od.heading = atof(row[col++]); od.heading = (float)atof(row[col++]);
strn0cpy(od.object_name, row[col++], sizeof(od.object_name)); strn0cpy(od.object_name, row[col++], sizeof(od.object_name));
od.object_type = atoi(row[col++]); od.object_type = atoi(row[col++]);
icon = atoi(row[col++]); icon = atoi(row[col++]);

View File

@ -716,15 +716,15 @@ bool Client::CheckFizzle(uint16 spell_id)
// if you have high int/wis you fizzle less, you fizzle more if you are stupid // if you have high int/wis you fizzle less, you fizzle more if you are stupid
if(GetClass() == BARD) if(GetClass() == BARD)
{ {
diff -= (GetCHA() - 110) / 20.0; diff -= (float)(GetCHA() - 110) / 20.0;
} }
else if (GetCasterClass() == 'W') else if (GetCasterClass() == 'W')
{ {
diff -= (GetWIS() - 125) / 20.0; diff -= (float)(GetWIS() - 125) / 20.0;
} }
else if (GetCasterClass() == 'I') else if (GetCasterClass() == 'I')
{ {
diff -= (GetINT() - 125) / 20.0; diff -= (float)(GetINT() - 125) / 20.0;
} }
// base fizzlechance is lets say 5%, we can make it lower for AA skills or whatever // base fizzlechance is lets say 5%, we can make it lower for AA skills or whatever