- Joined
- Dec 26, 2013
- Messages
- 1,635
- Solutions
- 11
- Reaction score
- 880
Hello Otland.
Here today I bring a modified code to be compatible with TFS 1.0
I don't take any credits for this code
I ONLY take credits for being the first to modify it for TFS 1.0 and releasing it on otland.
Now what does the code do?
It allows you to add this tag into items.xml
<attribute key="weaponType" value="fist"/>
And is fully functional, you can make any weapon into a fist weapon and it counts for your fist skill while killing with it. Yes I know this is possible thru lua. Blah blah blah, Idc, I wanted it for xml attribute and so here it is.
First open up your const.h
Replace
with this
In combat.cpp replace
with this
In Items.cpp replace
with this
Here today I bring a modified code to be compatible with TFS 1.0
I don't take any credits for this code
I ONLY take credits for being the first to modify it for TFS 1.0 and releasing it on otland.
Now what does the code do?
It allows you to add this tag into items.xml
<attribute key="weaponType" value="fist"/>
And is fully functional, you can make any weapon into a fist weapon and it counts for your fist skill while killing with it. Yes I know this is possible thru lua. Blah blah blah, Idc, I wanted it for xml attribute and so here it is.
First open up your const.h
Replace
Code:
enumWeaponType_t{
WEAPON_NONE=0,
WEAPON_SWORD=1,
WEAPON_CLUB=2,
WEAPON_AXE=3,
WEAPON_SHIELD=4,
WEAPON_DIST=5,
WEAPON_WAND=6,
WEAPON_AMMO=7
};
with this
Code:
enum WeaponType_t {
WEAPON_NONE = 0,
WEAPON_SWORD = 1,
WEAPON_CLUB = 2,
WEAPON_AXE = 3,
WEAPON_SHIELD = 4,
WEAPON_DIST = 5,
WEAPON_WAND = 6,
WEAPON_AMMO = 7,
WEAPON_FIST = 8
};
In combat.cpp replace
Code:
void Combat::addDistanceEffect(Creature* caster, const Position& fromPos, const Position& toPos, uint8_t effect)
{
if (caster && effect == NM_SHOOT_WEAPONTYPE) {
switch (caster->getWeaponType()) {
case WEAPON_AXE:
effect = NM_SHOOT_WHIRLWINDAXE;
break;
case WEAPON_SWORD:
effect = NM_SHOOT_WHIRLWINDSWORD;
break;
case WEAPON_CLUB:
effect = NM_SHOOT_WHIRLWINDCLUB;
break;
default:
effect = NM_SHOOT_NONE;
break;
}
}
with this
Code:
void Combat::addDistanceEffect(Creature* caster, const Position& fromPos, const Position& toPos, uint8_t effect)
{
if (caster && effect == NM_SHOOT_WEAPONTYPE) {
switch (caster->getWeaponType()) {
case WEAPON_AXE:
effect = NM_SHOOT_WHIRLWINDAXE;
break;
case WEAPON_SWORD:
effect = NM_SHOOT_WHIRLWINDSWORD;
break;
case WEAPON_CLUB:
effect = NM_SHOOT_WHIRLWINDCLUB;
break;
case WEAPON_FIST:
effect = NM_SHOOT_LARGEROCK;
break;
default:
effect = NM_SHOOT_NONE;
break;
}
}
In Items.cpp replace
Code:
} else if (tmpStrValue == "club") {
it.weaponType = WEAPON_CLUB;
} else if (tmpStrValue == "axe") {
it.weaponType = WEAPON_AXE;
} else if (tmpStrValue == "shield") {
it.weaponType = WEAPON_SHIELD;
} else if (tmpStrValue == "distance") {
it.weaponType = WEAPON_DIST;
} else if (tmpStrValue == "wand") {
it.weaponType = WEAPON_WAND;
} else if (tmpStrValue == "ammunition") {
it.weaponType = WEAPON_AMMO;
} else {
std::cout << "[Warning - Items::parseItemNode] Unknown weaponType: " << valueAttribute.as_string() << std::endl;
}
with this
Code:
} else if (tmpStrValue == "club") {
it.weaponType = WEAPON_CLUB;
} else if (tmpStrValue == "axe") {
it.weaponType = WEAPON_AXE;
} else if (tmpStrValue == "shield") {
it.weaponType = WEAPON_SHIELD;
} else if (tmpStrValue == "distance") {
it.weaponType = WEAPON_DIST;
} else if (tmpStrValue == "wand") {
it.weaponType = WEAPON_WAND;
}else if (tmpStrValue == "ammunition") {
it.weaponType = WEAPON_AMMO;
}else if (tmpStrValue == "fist") {
it.weaponType = WEAPON_FIST;
} else {
std::cout << "[Warning - Items::parseItemNode] Unknown weaponType: " << valueAttribute.as_string() << std::endl;
}