@@ -498,8 +498,7 @@ bool CUIActorMenu::ToSlot(CUICellItem* itm, bool force_place, u16 slot_id)
498498 {
499499 return true ; // fake, sorry (((
500500 }
501-
502- if (slot_id == OUTFIT_SLOT)
501+ else if (slot_id == OUTFIT_SLOT)
503502 {
504503 CCustomOutfit* pOutfit = smart_cast<CCustomOutfit*>(iitem);
505504 if (pOutfit && !pOutfit->bIsHelmetAvaliable )
@@ -785,7 +784,7 @@ void CUIActorMenu::TryHidePropertiesBox()
785784void CUIActorMenu::ActivatePropertiesBox ()
786785{
787786 TryHidePropertiesBox ();
788- if (!(m_currMenuMode == mmInventory || m_currMenuMode == mmDeadBodySearch || m_currMenuMode == mmUpgrade))
787+ if (!(m_currMenuMode == mmInventory || m_currMenuMode == mmDeadBodySearch || m_currMenuMode == mmUpgrade || m_currMenuMode == mmTrade ))
789788 {
790789 return ;
791790 }
@@ -818,7 +817,14 @@ void CUIActorMenu::ActivatePropertiesBox()
818817 {
819818 PropertiesBoxForRepair (item, b_show);
820819 }
821-
820+ // Alundaio: Ability to donate item to npc during trade
821+ else if (m_currMenuMode == mmTrade)
822+ {
823+ CUIDragDropListEx* invlist = GetListByType (iActorBag);
824+ if (invlist->IsOwner (cell_item))
825+ PropertiesBoxForDonate (item, b_show);
826+ }
827+ // -Alundaio
822828 if (b_show)
823829 {
824830 m_UIPropertiesBox->AutoUpdateSize ();
@@ -843,8 +849,7 @@ void CUIActorMenu::PropertiesBoxForSlots(PIItem item, bool& b_show)
843849 bool bAlreadyDressed = false ;
844850 u16 cur_slot = item->BaseSlot ();
845851
846- if (!pOutfit && !pHelmet && cur_slot != NO_ACTIVE_SLOT && !inv.SlotIsPersistent (cur_slot) &&
847- inv.CanPutInSlot (item, cur_slot))
852+ if (!pOutfit && !pHelmet && cur_slot != NO_ACTIVE_SLOT && !inv.SlotIsPersistent (cur_slot) /* && inv.CanPutInSlot(item, cur_slot)*/ )
848853 {
849854 m_UIPropertiesBox->AddItem (" st_move_to_slot" , NULL , INVENTORY_TO_SLOT_ACTION);
850855 b_show = true ;
@@ -1092,6 +1097,22 @@ void CUIActorMenu::PropertiesBoxForUsing(PIItem item, bool& b_show)
10921097 m_UIPropertiesBox->AddItem (act_str, nullptr , INVENTORY_EAT3_ACTION);
10931098 b_show = true ;
10941099 }
1100+
1101+ // 3rd Custom Use action
1102+ act_str = READ_IF_EXISTS (pSettings, r_string, section_name, " use3_text" , 0 );
1103+ if (act_str)
1104+ {
1105+ m_UIPropertiesBox->AddItem (act_str, nullptr , INVENTORY_EAT4_ACTION);
1106+ b_show = true ;
1107+ }
1108+
1109+ // 4th Custom Use action
1110+ act_str = READ_IF_EXISTS (pSettings, r_string, section_name, " use4_text" , 0 );
1111+ if (act_str)
1112+ {
1113+ m_UIPropertiesBox->AddItem (act_str, nullptr , INVENTORY_EAT5_ACTION);
1114+ b_show = true ;
1115+ }
10951116}
10961117
10971118void CUIActorMenu::PropertiesBoxForPlaying (PIItem item, bool & b_show)
@@ -1132,6 +1153,14 @@ void CUIActorMenu::PropertiesBoxForRepair(PIItem item, bool& b_show)
11321153 }
11331154}
11341155
1156+ // Alundaio: Ability to donate item during trade
1157+ void CUIActorMenu::PropertiesBoxForDonate (PIItem item, bool & b_show)
1158+ {
1159+ m_UIPropertiesBox->AddItem (" st_donate" , nullptr , INVENTORY_DONATE_ACTION);
1160+ b_show = true ;
1161+ }
1162+ // -Alundaio
1163+
11351164void CUIActorMenu::ProcessPropertiesBoxClicked (CUIWindow* w, void * d)
11361165{
11371166 PIItem item = CurrentIItem ();
@@ -1147,6 +1176,7 @@ void CUIActorMenu::ProcessPropertiesBoxClicked(CUIWindow* w, void* d)
11471176 case INVENTORY_TO_SLOT_ACTION: ToSlot (cell_item, true , item->BaseSlot ()); break ;
11481177 case INVENTORY_TO_BELT_ACTION: ToBelt (cell_item, false ); break ;
11491178 case INVENTORY_TO_BAG_ACTION: ToBag (cell_item, false ); break ;
1179+ case INVENTORY_DONATE_ACTION: DonateCurrentItem (cell_item); break ;
11501180 case INVENTORY_EAT_ACTION: TryUseItem (cell_item); break ;
11511181 case INVENTORY_EAT2_ACTION:
11521182 {
@@ -1178,6 +1208,36 @@ void CUIActorMenu::ProcessPropertiesBoxClicked(CUIWindow* w, void* d)
11781208 }
11791209 break ;
11801210 }
1211+ case INVENTORY_EAT4_ACTION:
1212+ {
1213+ CGameObject* GO = smart_cast<CGameObject*>(item);
1214+ const pcstr functor_name = READ_IF_EXISTS (pSettings, r_string, GO->cNameSect (), " use3_functor" , 0 );
1215+ if (functor_name)
1216+ {
1217+ luabind::functor<bool > funct3;
1218+ if (ai ().script_engine ().functor (functor_name, funct3))
1219+ {
1220+ if (funct3 (GO->lua_game_object ()))
1221+ TryUseItem (cell_item);
1222+ }
1223+ }
1224+ break ;
1225+ }
1226+ case INVENTORY_EAT5_ACTION:
1227+ {
1228+ CGameObject* GO = smart_cast<CGameObject*>(item);
1229+ const pcstr functor_name = READ_IF_EXISTS (pSettings, r_string, GO->cNameSect (), " use4_functor" , 0 );
1230+ if (functor_name)
1231+ {
1232+ luabind::functor<bool > funct4;
1233+ if (ai ().script_engine ().functor (functor_name, funct4))
1234+ {
1235+ if (funct4 (GO->lua_game_object ()))
1236+ TryUseItem (cell_item);
1237+ }
1238+ }
1239+ break ;
1240+ }
11811241 case INVENTORY_DROP_ACTION:
11821242 {
11831243 void * d = m_UIPropertiesBox->GetClickedItem ()->GetData ();
0 commit comments