Fixed issue with #showstats window, should probably be refactored to completely use stringstream or to_string whenever VS2010 support is dropped

This commit is contained in:
Michael Cook 2013-09-30 22:17:34 -04:00
parent 478f7b8e49
commit 2bde0b40bb
2 changed files with 27 additions and 23 deletions

View File

@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 09/30/2013 == == 09/30/2013 ==
Sorvani: Changed SummonItem to only summon an item with max charges when said default value is present and not on zero charges Sorvani: Changed SummonItem to only summon an item with max charges when said default value is present and not on zero charges
demonstar55: Fixed issue with #showstats showing your level for a bunch of values
== 09/13/2013 == == 09/13/2013 ==
demonstar55: Add support for /pet hold on and /pet hold off (UF and RoF) demonstar55: Add support for /pet hold on and /pet hold off (UF and RoF)

View File

@ -18,6 +18,7 @@
#include "../common/debug.h" #include "../common/debug.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <sstream>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -6620,34 +6621,36 @@ void Client::SendStatsWindow(Client* client, bool use_window)
indP + "Wind: " + itoa(GetWindMod()) + "<br>"; indP + "Wind: " + itoa(GetWindMod()) + "<br>";
} }
std::string final_stats = "" + std::ostringstream final_string;
/* C/L/R */ indP + "Class: " + class_Name + indS + "Level: " + itoa(GetLevel()) + indS + "Race: " + race_Name + "<br>" + final_string <<
/* Runes */ indP + "Rune: " + itoa(rune_number) + indL + indS + "Spell Rune: " + itoa(magic_rune_number) + "<br>" + /* C/L/R */ indP << "Class: " << class_Name << indS << "Level: " << static_cast<int>(GetLevel()) << indS << "Race: " << race_Name << "<br>" <<
/* HP/M/E */ HME_row + /* Runes */ indP << "Rune: " << rune_number << indL << indS << "Spell Rune: " << magic_rune_number << "<br>" <<
/* DS */ indP + "DS: " + itoa(itembonuses.DamageShield + spellbonuses.DamageShield*-1) + " (Spell: " + itoa(spellbonuses.DamageShield*-1) + " + Item: " + itoa(itembonuses.DamageShield) + " / " + itoa(RuleI(Character, ItemDamageShieldCap)) + ")<br>" + /* HP/M/E */ HME_row <<
/* Atk */ indP + "<c \"#CCFF00\">ATK: " + itoa(GetTotalATK()) + "</c><br>" + /* DS */ indP << "DS: " << (itembonuses.DamageShield + spellbonuses.DamageShield*-1) << " (Spell: " << (spellbonuses.DamageShield*-1) << " + Item: " << itembonuses.DamageShield << " / " << RuleI(Character, ItemDamageShieldCap) << ")<br>" <<
/* Atk2 */ indP + "- Base: " + itoa(GetATKRating()) + " | Item: " + itoa(itembonuses.ATK) + " (" + itoa(RuleI(Character, ItemATKCap)) + ")~Used: " + itoa((itembonuses.ATK * 1.342)) + " | Spell: " + itoa(spellbonuses.ATK) + "<br>" + /* Atk */ indP << "<c \"#CCFF00\">ATK: " << GetTotalATK() << "</c><br>" <<
/* AC */ indP + "<c \"#CCFF00\">AC: " + itoa(CalcAC()) + "</c><br>" + /* Atk2 */ indP << "- Base: " << GetATKRating() << " | Item: " << itembonuses.ATK << " (" << RuleI(Character, ItemATKCap) << ")~Used: " << (itembonuses.ATK * 1.342) << " | Spell: " << spellbonuses.ATK << "<br>" <<
/* AC2 */ indP + "- Mit: " + itoa(GetACMit()) + " | Avoid: " + itoa(GetACAvoid()) + " | Spell: " + itoa(spellbonuses.AC) + " | Shield: " + itoa(shield_ac) + "<br>" + /* AC */ indP << "<c \"#CCFF00\">AC: " << CalcAC() << "</c><br>" <<
/* Haste */ indP + "<c \"#CCFF00\">Haste: " + itoa(GetHaste()) + "</c><br>" + /* AC2 */ indP << "- Mit: " << GetACMit() << " | Avoid: " << GetACAvoid() << " | Spell: " << spellbonuses.AC << " | Shield: " << shield_ac << "<br>" <<
/* Haste2 */ indP + " - Item: " + itoa(itembonuses.haste) + " + Spell: " + itoa(spellbonuses.haste + spellbonuses.hastetype2) + " (Cap: " + itoa(RuleI(Character, HasteCap)) + ") | Over: " + itoa(spellbonuses.hastetype3 + ExtraHaste) + "<br><br>" + /* Haste */ indP << "<c \"#CCFF00\">Haste: " << GetHaste() << "</c><br>" <<
/* RegenLbl */ indL + indS + "Regen<br>" + indS + indP + indP + " Base | Items (Cap) " + indP + " | Spell | A.A.s | Total<br>" + /* Haste2 */ indP << " - Item: " << itembonuses.haste << " + Spell: " << (spellbonuses.haste + spellbonuses.hastetype2) << " (Cap: " << RuleI(Character, HasteCap) << ") | Over: " << (spellbonuses.hastetype3 + ExtraHaste) << "<br><br>" <<
/* Regen */ regen_string + "<br>" + /* RegenLbl */ indL << indS << "Regen<br>" << indS << indP << indP << " Base | Items (Cap) " << indP << " | Spell | A.A.s | Total<br>" <<
/* Stats */ stat_field + "<br><br>" + /* Regen */ regen_string << "<br>" <<
/* Mod2s */ mod2_field + "<br>" + /* Stats */ stat_field << "<br><br>" <<
/* HealAmt */ indP + "Heal Amount: " + itoa(GetHealAmt()) + " / " + itoa(RuleI(Character, ItemHealAmtCap)) + "<br>" + /* Mod2s */ mod2_field << "<br>" <<
/* SpellDmg*/ indP + "Spell Dmg: " + itoa(GetSpellDmg()) + " / " + itoa(RuleI(Character, ItemSpellDmgCap)) + "<br>" + /* HealAmt */ indP << "Heal Amount: " << GetHealAmt() << " / " << RuleI(Character, ItemHealAmtCap) << "<br>" <<
/* Clair */ indP + "Clairvoyance: " + itoa(GetClair()) + " / " + itoa(RuleI(Character, ItemClairvoyanceCap)) + "<br>" + /* SpellDmg*/ indP << "Spell Dmg: " << GetSpellDmg() << " / " << RuleI(Character, ItemSpellDmgCap) << "<br>" <<
/* DSMit */ indP + "Dmg Shld Mit: " + itoa(GetDSMit()) + " / " + itoa(RuleI(Character, ItemDSMitigationCap)) + "<br><br>"; /* Clair */ indP << "Clairvoyance: " << GetClair() << " / " << RuleI(Character, ItemClairvoyanceCap) << "<br>" <<
/* DSMit */ indP << "Dmg Shld Mit: " << GetDSMit() << " / " << RuleI(Character, ItemDSMitigationCap) << "<br><br>";
if(GetClass() == BARD) if(GetClass() == BARD)
final_stats += bard_info + "<br>"; final_string << bard_info << "<br>";
if(skill_mods.size() > 0) if(skill_mods.size() > 0)
final_stats += skill_mods + "<br>"; final_string << skill_mods << "<br>";
if(skill_dmgs.size() > 0) if(skill_dmgs.size() > 0)
final_stats += skill_dmgs + "<br>"; final_string << skill_dmgs << "<br>";
if(faction_item_string.size() > 0) if(faction_item_string.size() > 0)
final_stats += faction_item_string; final_string << faction_item_string;
std::string final_stats = final_string.str();
if(use_window) { if(use_window) {
if(final_stats.size() < 4096) if(final_stats.size() < 4096)