Hello, I've tried to figure this out for about 5h+, but since I'm a total noob at C++, I still haven't figured it out and I ask for help.
What I'm trying to do is to get the min/max change in class WeaponWand.
In weapons.h(and class WeaponWand):
and in weapons.cpp:
also
So, I'm trying to get the min/max change to get the wand damage. The min/max is written in weapons.xml, but I don't know how to get the values.
I tried with (u)int32_t getblabla() const {return minChange;} and then WeaponWand->getblabla() but that didn't do it.
I made a lua function:
(with extern Weapons* g_weapons)
The multiplier is probably self explanatory.
Sorry if this is totally wrong, but I just tried, copied some lines from other codes
Thanks in advance, Sherice.
What I'm trying to do is to get the min/max change in class WeaponWand.
In weapons.h(and class WeaponWand):
Code:
int32_t minChange, maxChange;
and in weapons.cpp:
Code:
WeaponWand::WeaponWand(LuaInterface* _interface):
Weapon(_interface)
{
minChange = 0;
maxChange = 0;
params.blockedByArmor = false;
params.blockedByShield = false;
}
also
Code:
bool WeaponWand::configureEvent(xmlNodePtr p)
{
if(!Weapon::configureEvent(p))
return false;
int32_t intValue;
if(readXMLInteger(p, "min", intValue))
minChange = intValue;
if(readXMLInteger(p, "max", intValue))
maxChange = intValue;
return true;
}
So, I'm trying to get the min/max change to get the wand damage. The min/max is written in weapons.xml, but I don't know how to get the values.
I tried with (u)int32_t getblabla() const {return minChange;} and then WeaponWand->getblabla() but that didn't do it.
I made a lua function:
Code:
Item* item = player->getWeapon(false);
const Weapon* weapon = g_weapons->getWeapon(item);
float multiplier = 1.0f;
if(Vocation* vocation = player->getVocation())
multiplier = vocation->getMultiplier(MULTIPLIER_WAND);
int32_t maxValue = (int32_t)(weapon->getMinChange() * multiplier);
lua_pushnumber(L, maxValue);
The multiplier is probably self explanatory.
Sorry if this is totally wrong, but I just tried, copied some lines from other codes
Thanks in advance, Sherice.