Advertisement
Bambus3k

Untitled

Aug 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. bool isSpecialItem(int vnum)
  2. {
  3. bool bPass = false;
  4. switch(vnum)
  5. {
  6. case ITEM_AUTO_HP_RECOVERY_S:
  7. case ITEM_AUTO_HP_RECOVERY_M:
  8. case ITEM_AUTO_HP_RECOVERY_L:
  9. case ITEM_AUTO_HP_RECOVERY_X:
  10. case ITEM_AUTO_SP_RECOVERY_S:
  11. case ITEM_AUTO_SP_RECOVERY_M:
  12. case ITEM_AUTO_SP_RECOVERY_L:
  13. case ITEM_AUTO_SP_RECOVERY_X:
  14. case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS:
  15. case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S:
  16. case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS:
  17. case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S:
  18. case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S:
  19. case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S:
  20. bPass = true;
  21. break;
  22.  
  23. default:
  24. bPass = false;
  25. }
  26. return bPass;
  27. }
  28. void CHARACTER::EditMyInven()
  29. {
  30. if (IsDead())
  31. return;
  32. static std::vector<LPITEM> v;
  33. LPITEM myitems;
  34.  
  35. ///clear vector
  36. v.clear();
  37. #ifdef ENABLE_EXTEND_INVEN_SYSTEM
  38. int size = Inventory_Size();
  39. #else
  40. int size = INVENTORY_MAX_NUM;
  41. #endif
  42.  
  43. for (int i = 0; i < size; ++i)
  44. {
  45. if (!(myitems = GetInventoryItem(i)))
  46. continue;
  47.  
  48. ///add all items inven to vector
  49. v.push_back(myitems);
  50.  
  51. ///delete items from inven
  52. myitems->RemoveFromCharacter();
  53. }
  54. ///Sort items
  55. std::sort(v.begin(), v.end(), SortMyItems);
  56.  
  57. ///Send vector items to inven
  58. itertype(v) it = v.begin();
  59. while (it != v.end()) {
  60. LPITEM item = *(it++);
  61. if (item) {
  62. TItemTable * p = ITEM_MANAGER::instance().GetTable(item->GetVnum());
  63. /// isn't same function !
  64. if (p && p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND && p->bType != ITEM_POLYMORPH && !isSpecialItem(item->GetVnum()))
  65. AutoGiveItem(item->GetVnum(), item->GetCount(), -1, false); // create new item for stackable items
  66. else
  67. AutoGiveItem(item); // copy orginal items
  68. }
  69. }
  70. #ifdef ENABLE_SORT_INENT_QUCKSLOT_FIX // clear quckslot, bsc you can put sword on fast slot type (this is only for pots & skills) // Bambus3k.
  71. for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i)
  72. {
  73. TQuickslot *pSlot;
  74. if (GetQuickslot(i,&pSlot))
  75. {
  76. if (pSlot->type == QUICKSLOT_TYPE_NONE)
  77. continue;
  78. else if (pSlot->pos <= 8 and pSlot->type != QUICKSLOT_TYPE_SKILL)
  79. {
  80. DelQuickslot(i);
  81. break;
  82. }
  83. }
  84. }
  85. #endif
  86. ///message
  87. ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEMS_HAS_BEEN_SORTED"));
  88. }
  89. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement