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/house.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 
00014 #ifndef _HOUSE_H_
00015 #define _HOUSE_H_
00016 
00017 #include "worldmain.h"
00018 #include "items.h"
00019 
00020 int     add_hlist(int c, int h, int t);
00021 void buildhouse( NXWCLIENT ps, P_TARGET t );
00022 int     del_hlist(int c, int h);
00023 int             on_hlist(P_ITEM pi, unsigned char s1, unsigned char s2, unsigned char s3, unsigned char s4, int *li);
00024 void    mtarget(int s, int a1, int a2, int a3, int a4, char b1, char b2, char *txt);
00025 
00026 
00027 class cMulti
00028 {
00029 protected:
00030         SERIAL serial;
00031         SERIAL owner;
00032         SI32    keycode;
00033         LOGICAL norealmulti, nokey, boat;
00034         SI08 spacex1, spacey1,spacex2, spacey2; // how many tiles are used for the house zone, x1 north elongation, y1 west
00035         SI32 char_x, char_y, char_z;
00036         SI32 deed;
00037         SI16 lockedItems, securedItems;
00038         SI16 maxLockedItems, maxSecuredItems;
00039 
00040 public:
00041         cMulti();
00042         SERIAL getSerial();
00043         void setSerial(SERIAL itemLink);
00044         SERIAL getOwner();
00045         void setOwner(SERIAL newOwner);
00046         SI32 getKeycode();
00047         void setKeycode(SI32 keycode);
00048         void getCorners(SI32 &x1, SI32 &x2, SI32 &y1, SI32 &y2 );
00049         void setCorners(SI32 x1, SI32 x2, SI32 y1, SI32 y2 );
00050         void getCharPos( int &x,  int &y,  int &z);
00051         void setCharPos( int x,  int y,  int z);
00052         int getUpperYRange();
00053         int getLowerYRange();
00054         int getLeftXRange();
00055         int getRightXRange();
00056         void changeLocks();
00057         SI32 getDeed();
00058         void setDeed(SI32 newID);
00059         void createMulti(UI32 multinumber, P_ITEM multiItem);
00060         bool isRealMulti();
00061         static void makeKeys(cMulti* pMulti, P_CHAR pc);
00062         static void cMulti::target_buildmulti( NXWCLIENT ps, P_TARGET t );
00063         static void cMulti::buildmulti( P_CHAR builder, P_ITEM deed);
00064         bool increaseLockedItems(unsigned int amount=1);
00065         bool decreaseLockedItems(unsigned int amount=1);
00066         void setLockedItems(unsigned int amount);
00067         unsigned int getLockedItems();
00068         unsigned int getMaxLockedItems();
00069         void setMaxLockedItems(unsigned int amount);
00070         bool increaseSecuredItems(unsigned int amount=1);
00071         bool decreaseSecuredItems(unsigned int amount=1);
00072         void setSecuredItems(unsigned int amount);
00073         unsigned int getSecuredItems();
00074         unsigned int getMaxSecuredItems();
00075         void setMaxSecuredItems(unsigned int amount);
00076 };
00077 
00078 extern std::map< SERIAL, P_HOUSE > houses;
00079 
00080 class cHouse :public cMulti
00081 {
00082 private:
00083         LOGICAL publicHouse;
00084         std::vector<SERIAL> friends;
00085         std::vector<SERIAL> coowners;
00086         std::vector<SERIAL> banned;
00087 protected:
00088 
00089 public:
00090 
00091         cHouse();
00092         void deedhouse(NXWSOCKET  s, P_ITEM pi);
00093         void deedhouse(P_CHAR owner);
00094         bool isInsideHouse(P_ITEM pi);
00095         bool isInsideHouse(P_CHAR pc);
00096         bool isInsideHouse(Location where);
00097         bool isInsideHouse(int x, int y, int z);
00098         bool inHouse(P_ITEM pi);
00099         bool inHouse(P_CHAR pc);
00100         bool inHouse(Location where);
00101         bool inHouse(int x, int y);
00102         void remove();
00103         bool isPublicHouse();
00104         void setPublicState(bool state);
00105         void togglePublicState();
00106         std::vector<SERIAL>::iterator getHouseFriends();
00107         std::vector<SERIAL>::iterator getHouseCoOwners();
00108         std::vector<SERIAL>::iterator getHouseBans();
00109         void addFriend(P_CHAR newfriend);
00110         void removeFriend(P_CHAR newfriend);
00111         bool isFriend(P_CHAR pc);
00112         std::vector<SERIAL> getHouseFriendsList();
00113         void addCoOwner(P_CHAR newCoOwner);
00114         void removeCoOwner(P_CHAR newCoOwner);
00115         bool isCoOwner(P_CHAR pc);
00116         std::vector<SERIAL> getHouseCoOwnerList();
00117         void addBan(P_CHAR newBanned);
00118         void removeBan(P_CHAR newBanned);
00119         bool isBanned(P_CHAR pc);
00120         std::vector<SERIAL> getHouseBannedList();
00121 
00122         SI32 getCurrentZPosition(P_CHAR pc);
00123         void createHouse(UI32 houseNumber);
00124         void transfer(SERIAL newOwner);
00125         void save(ofstream  *output);
00126         void load(cStringFile& input);
00127 
00128 };
00129 
00130 
00131 class cHouses
00132 {
00133 
00134         static std::map< SERIAL, P_HOUSE > houses;
00135         static std::map< int, UI32VECTOR> houseitems;
00136 public:
00137         static cHouse *findHouse(Location loc);
00138         static cHouse *findHouse(int x, int y);
00139         static cHouse *cHouses::findHouse(SERIAL houseSerial);
00140         static std::map< SERIAL, P_HOUSE >::iterator findHouses(SERIAL owner);
00141         static void killkeys(SERIAL serial);
00142         static void buildhouse( P_CHAR builder, P_ITEM housedeed );
00143         static void target_buildhouse( NXWCLIENT ps, P_TARGET t );
00144         static void target_houseOwner( NXWCLIENT ps, P_TARGET t );
00145         static void target_houseEject( NXWCLIENT ps, P_TARGET t );
00146         static void target_houseBan( NXWCLIENT ps, P_TARGET t );
00147         static void target_houseFriend( NXWCLIENT ps, P_TARGET t );
00148         static void target_houseUnlist( NXWCLIENT ps, P_TARGET t );
00149         static void target_houseLockdown( NXWCLIENT ps, P_TARGET t );
00150         static void target_houseRelease( NXWCLIENT ps, P_TARGET t );
00151         static void target_houseSecureDown( NXWCLIENT ps, P_TARGET t );
00152         static LOGICAL house_speech( P_CHAR pc, NXWSOCKET socket, std::string &talk);
00153         static int      check_house_decay();
00154         static void cHouses::Delete(SERIAL houseserial);
00155         static void cHouses::makeKeys(P_HOUSE phouse, P_CHAR pc);
00156         static void cHouses::safeoldsave();
00157         static bool cHouses::save( );
00158         static bool cHouses::load();
00159         static void cHouses::addHouseItem(int housenumber, int itemnumber);
00160         static UI32VECTOR  getHouseItems(int housenumber);
00161         static void cHouses::addHouse(P_HOUSE newHouse );
00162         static void cHouses::makeHouseItems(int housenumber, P_CHAR owner, P_ITEM multi);
00163         static std::map< SERIAL, P_HOUSE > cHouses::findOwnedHouses(SERIAL owner);
00164         static void cHouses::archive();
00165 
00166 };
00167 
00168 #endif
SourceForge.net Logo