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/npcs.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 
00015 #ifndef NPCS_INCLUDE
00016 #define NPCS_INCLUDE
00017 
00018 char* getRandomName(char * namelist);
00019 void setrandomname(P_CHAR pc, char * namelist);
00020 COLOR addrandomcolor(cObject* po, char *colorlist);
00021 
00022 namespace npcs
00023 {
00024         enum {
00025                 MAGIC_SPHERE_CLASSIC = 0,
00026                 MAGIC_SPHERE_WATER,
00027                 MAGIC_SPHERE_FIRE,
00028                 MAGIC_SPHERE_EARTH,
00029                 MAGIC_SPHERE_AIR,
00030                 MAGIC_SPHERE_MENTAL,
00031                 MAGIC_SPHERE_CLERICAL,
00032                 MAGIC_SPHERE_NECROMANCY,
00033                 MAGIC_SPHERE_POISON,
00034                 MAGIC_MAXSPHERES
00035         };
00036 
00037         void SpawnGuard( P_CHAR pc, P_CHAR pc_i, Location where);               // added by Anthalir
00038         void SpawnGuard( P_CHAR pc, P_CHAR pc_i, int x, int y, signed char z);
00039         void initNpcSpells();
00040         void npcCastSpell(P_CHAR pc_att, P_CHAR pc_def);
00041         void npcMagicAttack(P_CHAR pc_att, P_CHAR pc_def);
00042 
00043         P_CHAR AddNPC(NXWSOCKET s, P_ITEM pi, int npcNum, UI16 x1, UI16 y1, SI08 z1);
00044         P_CHAR AddNPC(NXWSOCKET s, P_ITEM pi, int npcNum, Location where);      // added by Anthalir
00045         P_CHAR addNpc(int npcNum, UI16 x, UI16 y, SI08 z);
00046 
00047         P_CHAR AddRespawnNPC(P_ITEM pi, int npcNum);
00048         P_CHAR AddRespawnNPC(P_CHAR pc, int npcNum);
00049 
00050         P_CHAR AddNPCxyz(NXWSOCKET s, int npcNum, Location where);              // added by anthalir
00051         P_CHAR AddNPCxyz(NXWSOCKET s, int npcNum, int x1, int y1, signed char z1);
00052 
00053         P_ITEM AddRandomLoot(P_ITEM pack, char * lootlist);
00054 
00055         int AddRandomNPC(int s, char *npclist);
00056         
00057         void checkAI(P_CHAR pc );
00058 
00059         P_CHAR SpawnRandomMonster(P_CHAR pc, char* cList, char* cNpcID);
00060 
00061 
00062 }       //namespace npcs
00063 
00064 
00065 typedef struct {
00066         SERIAL script;
00067         COLOR color;
00068         UI32 amount;
00069         UI32 id;
00070 } vendor_item;
00071 
00072 
00073 
00074 /*
00075 \soundflags     
00076         0 - normal, 5 sounds (attack-started, idle, attack, defence, dying, see nxwcommn.h)
00077         1 - birds .. only one "bird-shape" and zillions of sounds ...
00078         2 - only 3 sounds -> (attack,defence,dying)
00079         3 - only 4 sounds ->    (attack-started,attack,defnce,dying)
00080         4 - only 1 sound !!
00081 \who_am_i
00082         1 - creature can fly (must have the animations, so better dont change)
00083         2 - anti-blink: these creatures dont have animation,  if not set creaure will randomly dissapear in battle
00084                                         if you find a creature that blinks while fighting, set that bit
00085 icon: used for tracking, to set the appropriate icon
00086 */
00087 
00088 #define CREATURE_CAN_FLY 1
00089 #define CREATURE_ANTI_BLINK 2
00090 
00091 class cCreatureInfo {
00092 
00093 private:
00094 
00095         std::vector<SOUND>* sounds[ALL_MONSTER_SOUND];
00096 
00097 public:
00098 
00099         UI08 flag;
00100         SERIAL icon;
00101 
00102         cCreatureInfo();
00103         ~cCreatureInfo();
00104 
00105         bool canFly() { return flag&CREATURE_CAN_FLY; }
00106         bool needAntiBlink() { return flag&CREATURE_ANTI_BLINK; }
00107         SOUND getSound( MonsterSound type );
00108         void addSound( MonsterSound type, SOUND sound );
00109 
00110 };
00111 
00112 typedef cCreatureInfo* P_CREATURE_INFO;
00113 
00114 #define CREATURE_COUNT 2048
00115 
00116 class cAllCreatures {
00117 
00118         P_CREATURE_INFO allCreatures[CREATURE_COUNT];
00119 
00120 public:
00121 
00122         cAllCreatures();
00123         ~cAllCreatures();
00124 
00125         void load();
00126         P_CREATURE_INFO getCreature( UI16 id );
00127 
00128 };
00129 
00130 extern cAllCreatures creatures;
00131 
00132 #endif
SourceForge.net Logo