Advertisement
VVish

client lib

Aug 28th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.31 KB | None | 0 0
  1. #include "fonline_tla.h"
  2.  
  3. // Slot/parameters allowing
  4. EXPORT bool allowSlot_Hand1( uint8, Item &, Critter &, Critter & toCr );
  5.  
  6. // Initialization
  7.  
  8. // In this functions (DllMain and DllLoad) all global variables is NOT initialized, use FONLINE_DLL_ENTRY instead
  9. #if defined ( FO_WINDOWS )
  10. int __stdcall DllMain( void* module, unsigned long reason, void* reserved ) { return 1; }
  11. #elif defined ( FO_LINUX )
  12. void __attribute__( ( constructor ) ) DllLoad() {}
  13. void __attribute__( ( destructor ) ) DllUnload() {}
  14. #endif
  15.  
  16. void RegisterASExtensions();
  17.  
  18. void RegisterASExtensions()
  19. {
  20. // ASEngine;
  21. #ifdef __SERVER
  22. #define SCRIPT_ITEM_STR "Item"
  23. #endif
  24. #ifdef __CLIENT
  25. #define SCRIPT_ITEM_STR "ItemCl"
  26. #endif
  27. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val0_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 0);
  28. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val0_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 1);
  29. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val0_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 2);
  30. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val0_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 3);
  31.  
  32. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val1_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 4);
  33. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val1_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 5);
  34. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val1_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 6);
  35. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val1_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 7);
  36.  
  37. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val2_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 8);
  38. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val2_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 9);
  39. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val2_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 10);
  40. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val2_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 11);
  41.  
  42. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val3_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 12);
  43. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val3_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 13);
  44. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val3_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 14);
  45. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val3_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 15);
  46.  
  47. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val4_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 16);
  48. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val4_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 17);
  49. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val4_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 18);
  50. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val4_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 19);
  51.  
  52. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val5_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 20);
  53. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val5_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 21);
  54. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val5_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 22);
  55. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val5_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 23);
  56.  
  57. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val6_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 24);
  58. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val6_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 25);
  59. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val6_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 26);
  60. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val6_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 27);
  61.  
  62. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val7_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 28);
  63. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val7_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 29);
  64. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val7_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 30);
  65. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val7_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 31);
  66.  
  67. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val8_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 32);
  68. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val8_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 33);
  69. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val8_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 34);
  70. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val8_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 35);
  71.  
  72. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val9_b0", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 36);
  73. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val9_b1", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 37);
  74. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val9_b2", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 38);
  75. ASEngine->RegisterObjectProperty(SCRIPT_ITEM_STR, "int8 val9_b3", asOFFSET(Item, Data) + asOFFSET(Item::_Data, ScriptValues) + 39);
  76.  
  77. Log("Registered vals offsets on" + SCRIPT_ITEM_STR + "\n");
  78. }
  79.  
  80.  
  81.  
  82. }
  83.  
  84. FONLINE_DLL_ENTRY( isCompiler )
  85. {
  86. RegisterASExtensions();
  87. }
  88.  
  89. // Slot/parameters allowing
  90.  
  91. EXPORT bool allowSlot_Hand1( uint8, Item&, Critter&, Critter& toCr )
  92. {
  93. return toCr.Params[ PE_AWARENESS ] != 0;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement