Changed: use one lua bind to retrieve itemInfo

--HG--
branch : patches-from-atys
Inky 6 years ago
parent 89c22b04a2
commit 00d31f09c6

@ -135,54 +135,40 @@ int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
}
// ***************************************************************************
int CDBCtrlSheet::luaGetHpBuff(CLuaState &ls)
int CDBCtrlSheet::luaGetItemInfo(CLuaState &ls)
{
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
uint32 itemSlotId = getInventory().getItemSlotId(ctrlSheet);
CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId);
ls.push(itemInfo.HpBuff);
ls.newTable();
CLuaObject out(ls);
// for now all but magic
out.setValue("CurrentDamage", itemInfo.CurrentDamage);
out.setValue("MaxDamage", itemInfo.MaxDamage);
out.setValue("DodgeModifier", itemInfo.DodgeModifier);
out.setValue("ParryModifier", itemInfo.ParryModifier);
out.setValue("AdversaryDodgeModifier", itemInfo.AdversaryDodgeModifier);
out.setValue("AdversaryParryModifier", itemInfo.AdversaryParryModifier);
out.setValue("Hp", itemInfo.Hp);
out.setValue("HpMax", itemInfo.HpMax);
out.setValue("Range", itemInfo.Range);
out.setValue("HpBuff", itemInfo.HpBuff);
out.setValue("SapBuff", itemInfo.SapBuff);
out.setValue("StaBuff", itemInfo.StaBuff);
out.setValue("FocusBuff", itemInfo.FocusBuff);
out.setValue("SapLoadCurrent", itemInfo.SapLoadCurrent);
out.setValue("SapLoadMax", itemInfo.SapLoadMax);
out.setValue("ProtectionFactor", itemInfo.ProtectionFactor);
out.setValue("MaxSlashingProtection", itemInfo.MaxSlashingProtection);
out.setValue("MaxPiercingProtection", itemInfo.MaxPiercingProtection);
out.setValue("MaxBluntProtection", itemInfo.MaxBluntProtection);
out.setValue("WearEquipmentMalus", itemInfo.WearEquipmentMalus);
out.push();
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetSapBuff(CLuaState &ls)
{
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet);
CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId);
ls.push(itemInfo.SapBuff);
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetFocusBuff(CLuaState &ls)
{
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet);
CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId);
ls.push(itemInfo.FocusBuff);
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetStaBuff(CLuaState &ls)
{
CDBCtrlSheet *ctrlSheet = const_cast<CDBCtrlSheet*>(this);
uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet);
CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId);
ls.push(itemInfo.StaBuff);
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetName(CLuaState &ls)
{

@ -279,22 +279,16 @@ public:
REFLECT_STRING ("on_drop_params", getParamsOnDrop, setParamsOnDrop);
REFLECT_STRING ("on_can_drop", getActionOnCanDrop, setActionOnCanDrop);
REFLECT_STRING ("on_can_drop_params", getParamsOnCanDrop, setParamsOnCanDrop);
REFLECT_LUA_METHOD("getDraggedSheet", luaGetDraggedSheet)
REFLECT_LUA_METHOD("getHpBuff", luaGetHpBuff)
REFLECT_LUA_METHOD("getSapBuff", luaGetSapBuff)
REFLECT_LUA_METHOD("getFocusBuff", luaGetFocusBuff)
REFLECT_LUA_METHOD("getStaBuff", luaGetStaBuff)
REFLECT_LUA_METHOD("getName", luaGetName)
REFLECT_LUA_METHOD("getCreatorName", luaGetCreatorName)
REFLECT_LUA_METHOD("waitInfo", luaWaitInfo)
REFLECT_LUA_METHOD("buildCrystallizedSpellListBrick", luaBuildCrystallizedSpellListBrick)
REFLECT_LUA_METHOD("getDraggedSheet", luaGetDraggedSheet);
REFLECT_LUA_METHOD("getItemInfo", luaGetItemInfo);
REFLECT_LUA_METHOD("getName", luaGetName);
REFLECT_LUA_METHOD("getCreatorName", luaGetCreatorName);
REFLECT_LUA_METHOD("waitInfo", luaWaitInfo);
REFLECT_LUA_METHOD("buildCrystallizedSpellListBrick", luaBuildCrystallizedSpellListBrick);
REFLECT_EXPORT_END
int luaGetDraggedSheet(CLuaState &ls);
int luaGetHpBuff(CLuaState &ls);
int luaGetSapBuff(CLuaState &ls);
int luaGetFocusBuff(CLuaState &ls);
int luaGetStaBuff(CLuaState &ls);
int luaGetItemInfo(CLuaState &ls);
int luaGetName(CLuaState &ls);
int luaGetCreatorName(CLuaState &ls);
int luaWaitInfo(CLuaState &ls);

Loading…
Cancel
Save