00001 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 00002 || NoX-Wizard UO Server Emulator (NXW) [http://noxwizard.sourceforge.net] || 00003 || || 00004 || This software is free software released under GPL2 license. || 00005 || You can find detailed license information in nox-wizard.cpp file. || 00006 || || 00007 || For any question post to NoX-Wizard forums. || 00008 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 00009 00016 #ifndef __EXTRACTION_SKILLS_H 00017 #define __EXTRACTION_SKILLS_H 00018 00019 #include "sndpkg.h" 00020 #include "amx/amxcback.h" 00021 #include "globals.h" 00022 00023 #undef AMXMINING 00024 #define AMXMINING "__nxw_sk_mining" 00025 00026 class cResource { 00027 public: 00028 00029 cResource( ) { this->consumed=0; timer=uiCurrentTime; } 00030 00031 TIMERVAL timer; 00032 UI32 consumed; 00033 00034 }; 00035 00036 typedef cResource* P_RESOURCE; 00037 00038 typedef std::map< UI64, cResource > RESOURCE_MAP; 00039 00040 class cResources { 00041 00042 00043 private: 00044 00045 RESOURCE_MAP resources; 00046 00047 UI64 getBlocks( Location location ); 00048 P_RESOURCE createBlock( Location location ); 00049 void deleteBlock( Location Location ); 00050 bool checkRes( P_RESOURCE res ); 00051 00052 public: 00053 00054 00055 UI32 n; 00056 TIMERVAL time; 00057 TIMERVAL rate; 00058 SI32 stamina; 00059 UI32 area_width; 00060 UI32 area_height; 00061 00062 cResources( UI32 areawidth = 10, UI32 areaheight = 10 ); 00063 ~cResources(); 00064 00065 void setDimArea( UI32 areawidth, UI32 areaheight ); 00066 00067 P_RESOURCE getResource( Location location ); 00068 void checkResource( Location location, P_RESOURCE& res ); 00069 void decreaseResource( Location location, P_RESOURCE res = NULL ); 00070 bool thereAreSomething( P_RESOURCE res ); 00071 00072 void checkAll(); 00073 00074 }; 00075 00076 00077 extern cResources ores; 00078 00079 00080 #endif 00081