• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

xml attribute problem

Zuxus

Learning C++ and Lua
Joined
Jul 2, 2007
Messages
108
Reaction score
0
Location
Norway
I was wondering if it existed a increaseMagicPercent attribute on tfs, but I didn't find any, so is it possible to add:

This is what I found in another items.cpp:
Code:
#ifdef __ROGIER_WEAPONMOD__
	attackSpeedIncreasePercent = 0;
	attackBonus = 0;
	defenseBonus = 0;
	increaseMagicPercent = 0;
#endif
Code:
#ifdef __ROGIER_WEAPONMOD__ 
 							else if(strcasecmp(strValue.c_str(), "increasePhysicalPercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.increasePhysicalPercent = std::max(0, intValue);
 								}
 							}                            
 							else if(strcasecmp(strValue.c_str(), "increaseMagicPercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.increaseMagicPercent = std::max(0, intValue);
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "attackSpeedIncreasePercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.attackSpeedIncreasePercent = intValue;
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "attackBonus") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.attackBonus = intValue;
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "defenseBonus") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.defenseBonus = intValue;
 								}
 							}
#endif

in to tfs source somewhere?

Any suggestions?
 
I was wondering if it existed a increaseMagicPercent attribute on tfs, but I didn't find any, so is it possible to add:

This is what I found in another items.cpp:
Code:
#ifdef __ROGIER_WEAPONMOD__
	attackSpeedIncreasePercent = 0;
	attackBonus = 0;
	defenseBonus = 0;
	increaseMagicPercent = 0;
#endif
Code:
#ifdef __ROGIER_WEAPONMOD__ 
 							else if(strcasecmp(strValue.c_str(), "increasePhysicalPercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.increasePhysicalPercent = std::max(0, intValue);
 								}
 							}                            
 							else if(strcasecmp(strValue.c_str(), "increaseMagicPercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.increaseMagicPercent = std::max(0, intValue);
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "attackSpeedIncreasePercent") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.attackSpeedIncreasePercent = intValue;
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "attackBonus") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.attackBonus = intValue;
 								}
 							}
 							else if(strcasecmp(strValue.c_str(), "defenseBonus") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.defenseBonus = intValue;
 								}
 							}
#endif

in to tfs source somewhere?

Any suggestions?



Not sure if there is code anywhere but combining old attributes to create new ones is childs play :)
You don't need to create any addtional code or an #ifdef and #endif

Adding additional attributes is as simple as copy and paste :)
Also since your dealing primarily with integer values these attributes can be easily assigned to one another without any conflicts or divide by 0 errors.

PHP:
else if(strcasecmp(strValue.c_str(), "badass") == 0)
 							{
 								if(readXMLInteger(itemAttributesNode, "value", intValue)) {
 									it.attackBonus += intValue;
									it.defenseBonus += intValue;
									it.attackSpeedIncreasePercent += intValue;
									it.increaseMagicPercent += std::max(0, intValue);
									it.increasePhysicalPercent += std::max(0, intValue);
 								}
									
 								}
 							}
 
Back
Top