Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/home/groups/n/no/noxwizard/cvs/src/addmenu.h

Go to the documentation of this file.
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 __ADDMENU_H
00017 #define __ADDMENU_H
00018 
00019 
00020 #include "menu.h"
00021 #include "oldmenu.h"
00022 #include "utils.h"
00023 #include "chars.h"
00024 #include "client.h"
00025 
00026 
00027 class cRawItem {
00028 
00029 public:
00030 
00031     SI32 id;
00032     COLOR color;
00033     UI32 number;
00034 
00035         cRawItem( std::string& s );
00036         cRawItem( SI32 id=0, COLOR color=0, UI32 number=0 );
00037         ~cRawItem();
00038 
00039 };
00040 
00041 
00045 class cMakeItem {
00046 
00047 public:
00048 
00049     cScriptCommand* command;
00050     SI32 skillToCheck;
00051     SI32 minskill;
00052     SI32 maxskill;
00053         cRawItem reqitems[2];
00054 
00055     
00056         cMakeItem();
00057         ~cMakeItem();
00058     bool checkReq( P_CHAR pc, bool inMenu = false, cRawItem* def = NULL );
00059 };
00060 
00061 class cMakeMenu : public cBasicMenu 
00062 {
00063 
00064         private:
00065                 std::vector<cMakeItem*> makeItems;
00066 
00067         protected:
00068 
00069                 SERIAL section;
00070                 P_OLDMENU oldmenu;
00071 
00072                 virtual void loadFromScript( P_CHAR pc );
00073                 std::string cleanString( std::string s );
00074                 void execMake( NXWCLIENT ps, UI32 item );
00075 
00076         protected:
00077                 virtual cServerPacket* build();
00078 
00079         public:
00080 
00081                 int skill;
00082                 cRawItem mat[2];
00083                 
00084                 cMakeMenu( SERIAL section );
00085                 cMakeMenu( SERIAL section, P_CHAR pc, int skill, UI16 firstId=0, COLOR firstColor=0, UI16 secondId=0, COLOR secondColor=0 );
00086 
00087                 ~cMakeMenu();
00088 
00089                 virtual void handleButton( NXWCLIENT ps, cClientPacket* pkg  );
00090 
00091 };
00092 
00093 class cAddMenu : public cMakeMenu 
00094 {
00095 
00096         private:
00097                 std::vector< cScriptCommand > commands;
00098                 virtual void loadFromScript( P_CHAR pc );
00099 
00100         public:
00101                 cAddMenu( SERIAL section, P_CHAR pc );
00102                 ~cAddMenu();
00103 
00104                 virtual void handleButton( NXWCLIENT ps, cClientPacket* pkg  );
00105 
00106 };
00107 
00108 void showAddMenu( P_CHAR pc, int menu );
00109 
00114 inline void itemmenu( NXWSOCKET s, SI32 m )
00115 {
00116         P_CHAR pc = MAKE_CHAR_REF( currchar[s] );
00117         if( ISVALIDPC( pc ) )
00118         {
00119                 showAddMenu( pc, m ); 
00120         }
00121 }
00122 
00127 inline void gmmenu( NXWSOCKET s, SI32 m )
00128 {
00129         itemmenu( s, 7009+m );
00130 }
00131 
00132 
00133 
00134 #endif
SourceForge.net Logo