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/chars.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 
00010 
00015 #ifndef __CHARS_H
00016 #define __CHARS_H
00017 
00018 #include "ai.h"
00019 #include "object.h"
00020 #include "magic.h"
00021 
00022 #include "npcs.h"
00023 #include "msgboard.h"
00024 #include "target.h"
00025 #include "constants.h"
00026 #include "menu.h"
00027 #include "logsystem.h"
00028 #include "globals.h"
00029 
00030 #include "basics.h"
00031 #include "items.h"
00032 #include "cmds.h"
00033 
00034 #ifndef TIMEOUT
00035 #define TIMEOUT(X) (((X) <= uiCurrentTime) || overflow)
00036 #endif
00037 
00038 enum WanderMode {
00039         WANDER_NOMOVE = 0,
00040         WANDER_FOLLOW,
00041         WANDER_FREELY_CIRCLE,
00042         WANDER_FREELY_BOX,
00043         WANDER_FREELY,
00044         WANDER_FLEE,
00045         WANDER_AMX
00046 };
00047 
00052 enum AmxCharEvents
00053 {
00054         EVENT_CHR_ONDEATH               =  0,
00055         EVENT_CHR_ONBEFOREDEATH         =  0,
00056         EVENT_CHR_ONWOUNDED             =  1,
00057         EVENT_CHR_ONHIT                 =  2,
00058         EVENT_CHR_ONHITMISS             =  3,
00059         EVENT_CHR_ONGETHIT              =  4,
00060         EVENT_CHR_ONREPUTATIONCHG       =  5,
00061         EVENT_CHR_ONDISPEL              =  6,
00062         EVENT_CHR_ONRESURRECT           =  7,
00063         EVENT_CHR_ONFLAGCHG             =  8,
00064         EVENT_CHR_ONWALK                =  9,
00065         EVENT_CHR_ONADVANCESKILL        = 10,
00066         EVENT_CHR_ONADVANCESTAT         = 11,
00067         EVENT_CHR_ONBEGINATTACK         = 12,
00068         EVENT_CHR_ONBEGINDEFENSE        = 13,
00069         EVENT_CHR_ONTRANSFER            = 14,
00070         EVENT_CHR_ONMULTIENTER          = 15,
00071         EVENT_CHR_ONMULTILEAVE          = 16,
00072         EVENT_CHR_ONSNOOPED             = 17,
00073         EVENT_CHR_ONSTOLEN              = 18,
00074         EVENT_CHR_ONPOISONED            = 19,
00075         EVENT_CHR_ONREGIONCHANGE        = 20,
00076         EVENT_CHR_ONCASTSPELL           = 21,
00077         EVENT_CHR_ONGETSKILLCAP         = 22,
00078         EVENT_CHR_ONGETSTATCAP          = 23,
00079         EVENT_CHR_ONBLOCK               = 24,
00080         EVENT_CHR_ONSTART               = 25,
00081         EVENT_CHR_ONHEARTBEAT           = 26,
00082         EVENT_CHR_ONBREAKMEDITATION     = 27,
00083         EVENT_CHR_ONCLICK               = 28,
00084         EVENT_CHR_ONMOUNT               = 29,
00085         EVENT_CHR_ONDISMOUNT            = 30,
00086         EVENT_CHR_ONKILL                = 31,
00087         EVENT_CHR_ONHEARPLAYER          = 32,
00088         EVENT_CHR_ONDOCOMBAT            = 33,
00089         EVENT_CHR_ONCOMBATHIT           = 34,
00090         EVENT_CHR_ONSPEECH              = 35,
00091         EVENT_CHR_ONCHECKNPCAI          = 36,
00092         EVENT_CHR_ONDIED                = 37,
00093         EVENT_CHR_ONAFTERDEATH          = 37,
00094         EVENT_CHR_ONOPENCHAT            = 38,
00095         EVENT_CHR_ONOPENSTATUS          = 39,
00096         EVENT_CHR_ONOPENSKILLS          = 40,
00097     EVENT_CHR_ONDBLCLICK                =41,
00098         ALLCHAREVENTS                   = 42
00099 };
00100 
00101 enum DispelType
00102 {
00103         DISPELTYPE_UNKNOWN              = 0,
00104         DISPELTYPE_DISPEL,
00105         DISPELTYPE_TIMEOUT,
00106         DISPELTYPE_GMREMOVE
00107 };
00108 
00109 enum StatCap
00110 {
00111         STATCAP_CAP                     = 0,
00112         STATCAP_STR,
00113         STATCAP_DEX,
00114         STATCAP_INT
00115 };
00116 
00117 #define REPUTATION_KARMA                1
00118 #define REPUTATION_FAME                 2
00119 
00120 class cNxwClientObj;
00121 class cPath;
00122 class ClientCrypt;
00123 
00124 class cCharSaver
00125 {
00126 private:
00127         SI32 strength;
00128         SI32 dexterity;
00129         SI32 intelligence;
00130         SI32 mana;
00131         SI32 stamina;
00132         SI32 hitpoints;
00133         UI16 oldId;
00134         UI16 oldColor;
00135         std::string oldName;
00136         UI16 oldbeardstyle;
00137         UI16 oldbeardcolor;
00138         UI16 oldhairstyle;
00139         UI16 oldhaircolor;
00140 public:
00141         inline void setStrength(SI32 newStr)
00142         {       strength = newStr; };
00143         const inline SI32 getStrength()
00144         { return strength;};
00145         inline void setDexterity(SI32 newDex)
00146         {       dexterity = newDex; };
00147         const inline SI32 getDexterity()
00148         { return dexterity;};
00149         inline void setIntelligence(SI32 newInt)
00150         {       intelligence = newInt; };
00151         const inline SI32 getIntelligence()
00152         { return intelligence;};
00153         inline void setMana(SI32 newMana)
00154         {       mana = newMana; };
00155         const inline SI32 getMana()
00156         { return mana;};
00157         inline void setStamina(SI32 newStam)
00158         {       stamina = newStam; };
00159         const inline SI32 getStamina()
00160         { return stamina;};
00161         inline void setHitpoints(SI32 newHits)
00162         {       hitpoints = newHits; };
00163         const inline SI32 getHitpoints()
00164         { return hitpoints;};
00165         inline void setId( UI16 newId )
00166         { oldId = newId; }
00167         inline UI16 getId() 
00168         { return oldId; }
00169         inline void setColor( COLOR oldColor )
00170         { this->oldColor = oldColor; }
00171         inline COLOR getColor() 
00172         { return this->oldColor; }
00173         inline const string     getName() 
00174         { return oldName; }
00175         inline void             setName(string s)
00176         { oldName = s; }
00177         inline void setBeardStyle( UI16 beardstyle )
00178         { oldbeardstyle = beardstyle; }
00179         inline UI16 getBeardStyle() 
00180         { return oldbeardstyle; }
00181         inline void setBeardColor( COLOR beardcolor )
00182         { this->oldbeardcolor = beardcolor; }
00183         inline COLOR getBeardColor() 
00184         { return this->oldbeardcolor; }
00185         inline void setHairStyle( UI16 hairstyle )
00186         { oldhairstyle = hairstyle; }
00187         inline UI16 getHairStyle() 
00188         { return oldhairstyle; }
00189         inline void setHairColor( COLOR haircolor )
00190         { this->oldhaircolor = haircolor; }
00191         inline COLOR getHairColor() 
00192         { return this->oldhaircolor; }
00193 
00194 
00195 };
00196 
00200 class cChar : public cObject
00201 {
00202         public:
00203                 cChar( SERIAL ser );
00204                 ~cChar();
00205                 void setClient(NXWCLIENT client);
00206         private:
00207                 cNxwClientObj* m_client;
00208         public:
00209                 static void             archive();
00210                 static void             safeoldsave();
00211         public:
00212                 void                    MoveTo(Location newloc);
00213                 void                    loadEventFromScript(TEXT *script1, TEXT *script2);
00214 
00215                 inline void             MoveTo(SI32 x, SI32 y, SI32 z)
00216                 { MoveTo( Loc(x, y, z) ); }
00217         public:
00219 
00223 #if _MSC_VER == 1200 
00224                 enum {
00225                         flagGrey                = 0x01,
00226                         flagPermaGrey           = 0x02,
00227                         flagResistFire  = 0x04,
00228                         flagResistParalisys     = 0x08,
00229                         flagResistPoison        = 0x10,
00230                         flagWaterWalk           = 0x20,
00231                         flagSpellTelekinesys    = 0x40,
00232                         flagSpellProtection     = 0x80
00233                 };
00234                 enum {
00235                         flagKarmaMurderer       = 0x01,
00236                         flagKarmaCriminal       = 0x02,
00237                         flagKarmaInnocent       = 0x04
00238                 };
00239 #else 
00240                 static const UI08 flagGrey              = 0x01; 
00241                 static const UI08 flagPermaGrey         = 0x02; 
00242                 static const UI08 flagResistFire        = 0x04; 
00243                 static const UI08 flagResistParalisys   = 0x08; 
00244                 static const UI08 flagResistPoison      = 0x10; 
00245                 static const UI08 flagWaterWalk         = 0x20; 
00246                 static const UI08 flagSpellTelekinesys  = 0x40; 
00247                 static const UI08 flagSpellProtection   = 0x80; 
00248 
00249                 static const UI08 flagKarmaInnocent     = 0x04; 
00250                 static const UI08 flagKarmaMurderer     = 0x01; 
00251                 static const UI08 flagKarmaCriminal     = 0x02; 
00252 #endif
00253 
00254                 char                    nxwflags[4]; // for special nxw features
00255 
00256                 inline const LOGICAL resistsFire() const
00257                 { return nxwflags[0] & flagResistFire; }
00258 
00259                 inline const LOGICAL resistsFreeze() const
00260                 { return nxwflags[0] & flagResistParalisys; }
00261 
00263 
00268                 // Due to a bug in VC6 you cannot declare static const initializers 
00269 #if _MSC_VER == 1200 
00270         enum {
00271                 flagPrivGM = 0x01,
00272                 flagPrivBroadcast       = 0x02,
00273                 flagPrivInvulnerable    = 0x04,
00274                 flagPrivCanViewSerials= 0x08,
00275                 flagPrivNoSkillTitle    = 0x10,
00276                 flagPrivPageAble        = 0x20,
00277                 flagPrivCanSnoopAll     = 0x40,
00278                 flagPrivCounselor       = 0x80
00279         }; 
00280         enum {
00281                 flagPriv2AllMove        = 0x01,
00282                 flagPriv2Frozen = 0x02,
00283                 flagPriv2ViewHouseIcon= 0x04,
00284                 flagPriv2PermaHidden    = 0x08,
00285                 flagPriv2NoUseMana      = 0x10,
00286                 flagPriv2Dispellable    = 0x20,
00287                 flagPriv2Reflection     = 0x40,
00288                 flagPriv2NoUseReagents= 0x80,
00289                 flagPriv2Polymorphed = 0x100,
00290                 flagPriv2Poisoned = 0x200,
00291                 flagPriv2Mounted = 0x400,
00292                 flagPriv2Ridden = 0x800,
00293                 flagPriv2Incognito = 0x1000,
00294                 flagPriv2Dead = 0x2000,
00295                 flagPriv2canTrain = 0x4000,
00296                 flagPriv2shopkeeper = 0x8000
00297 
00298         }; 
00299 #else 
00300                 static const UI08 flagPrivGM            = 0x01; 
00301                 static const UI08 flagPrivBroadcast     = 0x02; 
00302                 static const UI08 flagPrivInvulnerable  = 0x04; 
00303                 static const UI08 flagPrivCanViewSerials= 0x08; 
00304                 static const UI08 flagPrivNoSkillTitle  = 0x10; 
00305                 static const UI08 flagPrivPageAble      = 0x20;
00306                 static const UI08 flagPrivCanSnoopAll   = 0x40;
00307                 static const UI08 flagPrivCounselor     = 0x80;
00308 
00309                 static const UI08 flagPriv2AllMove      = 0x01;
00310                 static const UI08 flagPriv2Frozen       = 0x02;
00311                 static const UI08 flagPriv2ViewHouseIcon= 0x04;
00312                 static const UI08 flagPriv2PermaHidden  = 0x08;
00313                 static const UI08 flagPriv2NoUseMana    = 0x10;
00314                 static const UI08 flagPriv2Dispellable  = 0x20;
00315                 static const UI08 flagPriv2Reflection   = 0x40;
00316                 static const UI08 flagPriv2NoUseReagents= 0x80;
00317                 static const UI08 flagPriv2Polymorphed = 0x100;
00318                 static const UI08 flagPriv2Poisoned = 0x200;
00319                 static const UI08 flagPriv2Mounted = 0x400;
00320                 static const UI08 flagPriv2Ridden = 0x800;
00321                 static const UI08 flagPriv2Incognito = 0x1000;
00322                 static const UI08 flagPriv2Dead = 0x2000;
00323                 static const UI08 flagPriv2canTrain = 0x4000;
00324                 static const UI08 flagPriv2shopkeeper = 0x8000;
00325 #endif // _MSC_VER == 1200
00326 
00327 
00329 
00332         protected:
00333                 // We really need so many vars?
00334                 UI08 priv;      
00335                 UI08 priv2;     
00336                 UI08 privLevel; 
00337 
00338                 inline void setPriv2(UI08 privFlag, LOGICAL set)
00339                 {
00340                         if ( set )
00341                                 priv2 |= privFlag;
00342                         else
00343                                 priv2 &= (UI08) ~privFlag;
00344                 }
00345 
00346         public:
00347                 inline const UI08               getPrivLevel() const
00348                 { return privLevel; }
00349 
00350                 inline void setPrivLevel ( UI08 pLevel ) 
00351                 { privLevel = pLevel; }
00352 
00353                 inline const LOGICAL    IsGM() const
00354                 { return ( privLevel > PRIVLEVEL_GM ); }
00355 
00356                 inline const LOGICAL    IsCounselor() const
00357                 { return ( privLevel > PRIVLEVEL_CNS ); }
00358 
00359                 inline const LOGICAL    IsGMorCounselor() const
00360                 { return IsCounselor(); }
00361 
00362                 inline const LOGICAL    IsInvul() const
00363                 { return priv & flagPrivInvulnerable; }
00364 
00365                 inline const LOGICAL    CanSnoop() const
00366                 { return priv & flagPrivCanSnoopAll; }
00367 
00368                 inline const LOGICAL    CanBroadcast() const
00369                 { return priv & flagPrivBroadcast; }
00370 
00371                 inline const LOGICAL    CanSeeSerials() const
00372                 { return priv & flagPrivCanViewSerials; }
00373 
00374                 inline const LOGICAL    isFrozen() const
00375                 { return (priv2 & flagPriv2Frozen); }
00376 
00377                 inline const LOGICAL    isPermaHidden() const
00378                 { return priv2 & flagPriv2PermaHidden; }
00379 
00380                 inline const LOGICAL    isDispellable() const
00381                 { return priv2 & flagPriv2Dispellable; }
00382 
00383                 inline const LOGICAL    canAllMove() const
00384                 { return priv2 & flagPriv2AllMove; }
00385 
00386                 inline const LOGICAL    dontUseMana() const
00387                 { return priv2 & flagPriv2NoUseMana; }
00388 
00389                 inline const LOGICAL    dontUseReagents() const
00390                 { return priv2 & flagPriv2NoUseReagents; }
00391 
00392                 inline const LOGICAL    hasReflection() const
00393                 { return priv2 & flagPriv2Reflection; }
00394 
00395                 inline const LOGICAL    canViewHouseIcon() const 
00396                 { return priv2 & flagPriv2ViewHouseIcon; }
00397                 inline void setAllMove(LOGICAL set = true)
00398                 { setPriv2(flagPriv2AllMove, set); }
00399 
00400                 inline void setViewHouseIcon(LOGICAL set = true)
00401                 { setPriv2(flagPriv2ViewHouseIcon, set); }
00402 
00403                 inline void setPermaHidden(LOGICAL set = true)
00404                 { setPriv2(flagPriv2PermaHidden, set); }
00405 
00406                 inline void setReflection(LOGICAL set = true)
00407                 { setPriv2(flagPriv2Reflection, set); }
00408 
00409 
00410                 inline const UI08       GetPriv() const
00411                 { return priv; }
00412 
00413                 inline void             SetPriv(UI08 p)
00414                 { priv = p; }
00415 
00416                 inline void             MakeInvulnerable()
00417                 { priv |= flagPrivInvulnerable; }
00418 
00419                 inline void             MakeVulnerable()
00420                 { priv &= ~flagPrivInvulnerable; }
00421 
00422                 inline const UI08       GetPriv2() const
00423                 { return priv2; }
00424 
00425                 inline void             SetPriv2(SI08 p)
00426                 { priv2 = p; }
00428 
00430 
00433         private:
00434                 SI32            karma;          
00435                 SI32            fame;           
00436         public: // will become private
00437                 LOGICAL         incognito;      
00438                 LOGICAL         polymorph;      
00439 
00440                 UI32            kills;          
00441                 UI32            deaths;         
00442                 LOGICAL         dead;           
00443                 R32             fstm;           
00444 
00445         public:
00446                 inline const LOGICAL IsInnocent() const
00447                 { return (flag & flagKarmaInnocent); }
00448 
00449                 inline const LOGICAL IsMurderer() const
00450                 { return (flag & flagKarmaMurderer); }
00451 
00452                 inline const LOGICAL IsCriminal() const
00453                 { return (flag & flagKarmaCriminal); }
00454 
00455                 LOGICAL const           IsGrey() const;
00456 
00457                 inline const LOGICAL    IsHidden() const
00458                 { return (hidden != UNHIDDEN); }
00459 
00460                 inline const LOGICAL    IsHiddenBySpell() const
00461                 { return (hidden & HIDDEN_BYSPELL); }
00462 
00463                 inline const LOGICAL    IsHiddenBySkill() const
00464                 { return (hidden & HIDDEN_BYSKILL); }
00465 
00466                 LOGICAL const           IsOverWeight();
00467                 LOGICAL const           IsOnline() const;
00468 
00469                 inline const LOGICAL    InGuardedArea() const
00470                 { return ::region[region].priv & RGNPRIV_GUARDED; }
00471 
00472 
00473                 LOGICAL const           CanDoGestures() const;
00474 
00475                 void                    SetMurderer();
00476                 void                    SetInnocent();
00477                 void                    SetCriminal();
00478 
00479                 inline void             SetPermaGrey()
00480                 { nxwflags[0] |= flagGrey|flagPermaGrey; }
00481 
00483                 void                    SetGrey()
00484                 { if (!npc) tempfx::add(this, this, tempfx::GREY, 0, 0, 0,0, 0x7FFF); }
00485 
00486                 inline                  void setTelekinesisFlag(LOGICAL state)
00487                 { nxwflags[0] |= (char) flagSpellTelekinesys*state; }
00488 
00489                 inline                  void setGreyFlag(LOGICAL state)
00490                 { nxwflags[0] |= (char) flagGrey*state; }
00491 
00492 
00493                 void                    unHide();
00494 
00496                 inline const SI32       GetKarma() const
00497                 { return karma; }
00498 
00500                 inline void             SetKarma(SI32 newkarma)
00501                 { karma = newkarma; }
00502 
00504                 inline const SI32       GetFame() const
00505                 { return fame; }
00506 
00507                 inline void             SetFame(SI32 newfame)
00508                 { fame=newfame; }
00509                 
00510                 void                    IncreaseKarma(SI32 value, P_CHAR pKilled = 0 );
00511                 void                    modifyFame( SI32 value );
00513 
00514 
00516 
00520         private:
00521                 TIMERVAL                creationday;                    
00522         public:
00524                 inline void             SetCreationDay(TIMERVAL day)
00525                 { creationday = day; }
00526 
00528                 inline const TIMERVAL   GetCreationDay() const
00529                 { return creationday; }
00531 
00533 
00537         private:
00538                 UI32_s                  str;                            
00539 
00540         public:
00541                 SI32                    st2;                            
00542                 SI32                    st3;                            
00543                 SI32                    dx;                             
00544                 SI32                    dx2;                            
00545                 SI32                    dx3;                            
00546                 SI32                    in;                             
00547                 SI32                    in2;                            
00548                 SI32                    in3;                            
00549                 SI32                    statGainedToday;                
00550 
00551                 void                    setStrength(UI32 val, bool check= true);
00552                 void                    checkSafeStats();
00553 
00555                 inline const SI32       getStrength() const
00556                 { return str.value; }
00557 
00567                 inline void             modifyStrength(SI32 mod, bool check= true)
00568                 { setStrength( str.value + mod, check ); }
00570 
00571         public:
00572                 void                    heartbeat();
00573 
00574         private:
00575                 void                    generic_heartbeat();
00576                 void                    pc_heartbeat();
00577                 void                    do_lsd();
00578                 void                    npc_heartbeat();
00579 
00581 
00584         public:
00585                 std::string             title;
00586 //              UI16                    oldhairstyle;
00587 //              UI16                    oldbeardstyle;
00588 //              UI16                    oldhaircolor;
00589 //              UI16                    oldbeardcolor;
00590 
00591                 inline const LOGICAL    HasHumanBody() const
00592                 { return (getId()==BODY_MALE) || (getId()==BODY_FEMALE); }
00593 
00594                 void                    showLongName( P_CHAR showToWho, LOGICAL showSerials );
00596 
00597 
00599 
00602         private:
00603                 LOGICAL                 attackfirst;            
00604 
00605         public:
00606                 LOGICAL                 HasAttackedFirst()
00607                 { return attackfirst; }
00608 
00609                 inline void             SetAttackFirst(LOGICAL af = true)
00610                 { attackfirst = af; }
00611 
00612                 inline void             ResetAttackFirst()
00613                 { SetAttackFirst(false); }
00614 
00615         private:
00616                 LOGICAL                 combatTimerOk();
00617                 void                    checkPoisoning(P_CHAR pc_def);
00618                 void                    doMissedSoundEffect();
00619                 SI32                    combatHitMessage(SI32 damage);
00620                 void                    doCombatSoundEffect(SI32 fightskill, P_ITEM pWeapon);
00621                 void                    undoCombat();
00622 
00623         public:
00624                 void                    checkPoisoning();
00625                 void                    fight(P_CHAR pOpponent);
00626                 void                    combatHit( P_CHAR pc_def, SI32 nTimeOut = 0 );
00627                 void                    doCombat();
00628                 void                    combatOnHorse();
00629                 void                    combatOnFoot();
00630                 void                    playCombatAction();
00631                 SI32                    calcAtt();
00632                 SI32                    calcDef(SI32 x = 0);
00633                 void                    setWresMove(SI32 move = 0);
00634                 SI32                    calcResist(DamageType typeofdamage);
00635                 void                    toggleCombat();
00636                 SI32                    getCombatSkill();
00637 
00645                 inline void             castSpell(magic::SpellId spellnumber, TargetLocation& dest, SI32 flags = 0, SI32 param = 0)
00646                 { magic::castSpell(spellnumber, dest, this, flags, param); }
00648 
00650 
00653         public:
00654                 inline const LOGICAL    IsWearing(P_ITEM pi) const
00655                 { return getSerial32() == pi->getContSerial(); }
00656 
00657                 SI32                    Equip(P_ITEM pi, LOGICAL drag = false);
00658                 SI32                    UnEquip(P_ITEM pi, LOGICAL drag = false);
00659                 void                    checkEquipement();
00660         #ifdef ENDY_NEW_WEAR
00661         public:
00662                 SERIAL wear[LAYER_COUNT];       
00663         #endif
00664 
00665 
00667 
00670         private:
00671                 cPath*                  path;                   
00672                 void                    walkNextStep();         
00673                 SERIAL_SLIST            sentObjects;
00674         public:
00675                 LOGICAL                 canSee( cObject &obj ); 
00676                 LOGICAL                 seeForFirstTime( cObject &obj, LOGICAL testCanSee=true );       
00677                 LOGICAL                 seeForLastTime( cObject &obj, LOGICAL testCanSee=true ); 
00678                 void                    walk();                 
00679                 inline LOGICAL          hasPath() { return (path!=NULL); } 
00680                 void                    follow( P_CHAR pc ); 
00681                 void flee( P_CHAR pc, SI32 seconds=INVALID ); 
00682                 void                    pathFind( Location pos, LOGICAL bOverrideCurrentPath = true );  
00683                 SI08                    dir;                    
00684                 UI32                    LastMoveTime;           
00685 
00686 
00687 
00689 
00692         public:
00693                 SI32                    party;
00695 
00697 
00700         public:
00701                 UI32                    lastNpcCheck; // timestamp used to reduce # of checkNPC calls in checkAuto() to 1 (Sparhawk)
00702                 char                    npc;                            
00703                 LOGICAL                 doorUse;                        
00704                 LOGICAL                 shopkeeper;                     
00705 
00706         public:
00707                 // Skyfire's NPC advancments.
00708                 Location workloc;                       
00709                 Location homeloc;                       
00710                 Location foodloc;                       
00711                 //Skyfire - End NPC's home/work/food vars'
00712 
00713                 /*UI08                  pathnum;
00714                 path_st                 path[PATHNUM];*/
00715 
00716                 TIMERVAL                nextAiCheck;
00717 
00718                 SI32                    hidamage;           
00719                 SI32                    lodamage;           
00720 
00721 
00723 
00726         public:
00727                 FUNCIDX         targetcallback;
00728                 UI08                    gmrestrict;                     
00729 
00730                 void                    doGmEffect();
00732 
00733         public:
00734                 bool jailed;
00735 
00737 
00740         public:
00741                 SERIAL custmenu;        
00742 
00744 
00745 
00747 
00750         public:
00751                 SERIAL  trainer;                
00752                 UI08    trainingplayerin;       
00753                 LOGICAL cantrain;
00754 
00755         public:
00756                 inline const LOGICAL    isBeingTrained() const
00757                 { return (trainer != INVALID); }
00758 
00759                 inline const SERIAL     getTrainer() const
00760                 { return trainer; }
00761 
00762                 inline const UI08       getSkillTaught() const
00763                 { return trainingplayerin; }
00764 
00765                 inline const LOGICAL    canTrain() const
00766                 { return cantrain; }
00767 
00768                 inline void             setCanTrain(LOGICAL c = true)
00769                 { cantrain = c; }
00770 
00771                 inline void             resetCanTrain()
00772                 { setCanTrain(false); }
00774 
00776 
00779         public:
00780                 bool                    mounted; 
00781 
00782         private:
00783                 LOGICAL                 onhorse; 
00784         public:
00785                 SI32                            unmountHorse();
00786                 void                    mounthorse( P_CHAR mount );
00787                 SERIAL                  getHorse();
00788                 void                    setOnHorse();
00789                 bool                    isMounting( );
00790                 bool                    isMounting( P_CHAR horse );
00792 
00794 
00797         private:
00798                 P_GUILD guild; 
00799                 P_GUILD_MEMBER member; 
00800                 short   guildType; // 0 normal, 1 order, 2 chaos
00801                 LOGICAL guildTraitor;
00802                 LOGICAL guildToggle;
00803                 SERIAL  guildFealty;
00804                 SI32    guildNumber;
00805 
00806         public:
00807                 bool    isGuilded();
00808                 void    setGuild( P_GUILD guild, P_GUILD_MEMBER member );
00809                 P_GUILD getGuild();
00810                 P_GUILD_MEMBER getGuildMember();
00811                 short   GetGuildType();
00812                 void    SetGuildType(short newGuildType);
00813                 LOGICAL IsGuildTraitor();
00814                 void    SetGuildTraitor();
00815                 void    ResetGuildTraitor();
00816                 LOGICAL HasGuildTitleToggle();
00817                 void    SetGuildTitleToggle();
00818                 void    ResetGuildTitleToggle();
00819                 SERIAL  GetGuildFealty();
00820                 void    SetGuildFealty(SERIAL newGuildFealty);
00821                 SI32    GetGuildNumber();
00822                 void    SetGuildNumber(SI32 newGuildNumber);
00823                 TEXT*   GetGuildTitle();
00824                 void    SetGuildTitle(TEXT* newGuildTitle);
00825 
00826 
00828 
00830 
00833 private:
00834         regen_st        regens[ALL_STATS]; 
00835 public:
00836         void setRegenRate( StatType stat, UI32 rate, VarType type );
00837         UI32 getRegenRate( StatType stat, VarType type );
00838         bool regenTimerOk( StatType stat );
00839         void updateRegenTimer( StatType stat );
00841 
00843 
00848 public:
00849         std::vector<vendor_item>*       vendorItemsSell; 
00850         std::vector<vendor_item>*       vendorItemsBuy; 
00851 
00853 
00854 public:
00855         TIMERVAL skilldelay;
00856         TIMERVAL objectdelay;
00857 public:
00858         inline void setSkillDelay( UI32 seconds = server_data.skilldelay )
00859         { skilldelay =  uiCurrentTime + seconds * MY_CLOCKS_PER_SEC; }
00860 
00861         inline const LOGICAL canDoSkillAction() const
00862         { return TIMEOUT( skilldelay ); }
00863 
00864         inline void setObjectDelay( UI32 seconds = server_data.objectdelay )
00865         { objectdelay = uiCurrentTime + seconds * MY_CLOCKS_PER_SEC; }
00866 
00867         inline const LOGICAL canDoObjectAction() const
00868         { return TIMEOUT( objectdelay ); }
00869 
00870 
00871         /********************************/
00872         /*     TO REMOVE/REPLACE        */
00873         /********************************/
00874         public:
00875                 void                    setMultiSerial(long mulser);
00876 
00877                 inline const LOGICAL    isOwnerOf(const cObject *obj) const
00878                 { return getSerial32() == obj->getOwnerSerial32(); }
00879 
00880         /********************************/
00881 
00882                 SERIAL                  keyserial;  
00883                 SERIAL                  packitemserial; 
00884                 SERIAL                  targserial; 
00885                 SERIAL                  runeserial; 
00886                 SERIAL                  attackerserial; 
00887                 SERIAL                  ftargserial; 
00888                 SERIAL                  swingtargserial; 
00889                 SI32                    namedeedserial;
00890 
00891                 SI32                    account; // changed to signed, lb
00892 
00893 
00894 
00895         public:
00896                 wstring profile; 
00897 
00898         private:
00899                 wstring* speechCurrent;
00900 
00901                 char* commandSpeech;
00902                 
00903                 //Commands Params
00904                 std::string param1;
00905                 std::string param2;
00906                 std::string param3;
00907                 std::string param4;
00908                 std::string param5;
00909                 std::string param6;
00910                 std::string param7;
00911                 std::string param8;
00912                 
00913 
00914                 SI32    hirefee;
00915 
00916         public:
00917                 
00918                 
00919                 inline char* getCommandSpeech()
00920                 { return commandSpeech; }
00921 
00922                 inline void setCommandSpeech(char* curr_speech)
00923                 { commandSpeech=curr_speech; }
00924 
00926                 void resetCommandParams();
00928                 void setCommandParams(int index, std::string param); 
00930                 TEXT* getCommandParams(int index);
00931                 
00932                 inline SI32 getHireFee()
00933                 { return hirefee; }
00934                 inline void setHireFee(SI32 newfee)
00935                 { hirefee=newfee; }
00936                 inline bool isHirable()
00937                 { return hirefee < 0 ? false : true; }
00938 
00940                 inline wstring* getSpeechCurrent() 
00941                 { return speechCurrent; }
00942 
00944                 inline void setSpeechCurrent( wstring* speech )
00945                 { speechCurrent=speech; }
00946 
00948                 inline void resetSpeechCurrent()
00949                 { setSpeechCurrent(NULL); }
00950 
00951                 void deleteSpeechCurrent();
00952 
00953         private:
00954                 SERIAL  stablemaster_serial; 
00955         public:
00957                 inline const LOGICAL isStabled() const
00958                 { return getStablemaster()!=INVALID; }
00959 
00961                 inline const SERIAL getStablemaster() const
00962                 { return stablemaster_serial; }
00963 
00964                 void stable( P_CHAR stablemaster );
00965                 void unStable();
00966 
00967         public:
00968                 SI32            npcaitype; 
00969 
00970         public:
00971 
00972 
00973                 SERIAL oldmenu; 
00974 
00975                 SI32                    stat3crc; // xan : future use to keep safe stats
00976                 class                   AmxEvent *amxevents[ALLCHAREVENTS];
00977                 SI32                    hp;  // HitpoSI32s
00978                 SI32                    stm; // Stamina
00979                 SI32                    mn;  // Mana
00980                 SI32                    mn2; // Reserved for calculation
00981                 UI16                    baseskill[ALLSKILLS+1]; // Base skills without stat modifiers
00982                 UI16                    skill[ALLSKILLS+1]; // List of skills (with stat modifiers)
00983 
00984 
00985                 SERIAL                  robe; // Serial number of generated death robe (If char is a ghost)
00986                 UI08                    fixedlight; // Fixed lighting level (For chars in dungeons, where they dont see the night)
00987                 char                    speech; // For NPCs: Number of the assigned speech block
00988                 SI32                    weight; //Total weight
00989                 UI32                    att; // Intrinsic attack (For monsters that cant carry weapons)
00990                 UI32                    def; // Intrinsic defense
00991                 char                    war; // War Mode
00992                 char                    wresmove; // Luxor: for Wrestling's special moves
00993 
00994                 TIMERVAL                timeout; // Combat timeout (For hitting)
00995                 TIMERVAL                timeout2; // memory of last shot timeout
00996 
00997                 TIMERVAL                npcmovetime; // Next time npc will walk
00998                 char                    npcWander; // NPC Wander Mode
00999                 char                    oldnpcWander; // Used for fleeing npcs
01000                 SI32                    fleeTimer;
01001                 R32                     npcMoveSpeed; // Used to controll npc walking speed
01002                 R32                     npcFollowSpeed; // Used to controll npc walking speed when following a target (npcwander = 1)
01003                 SI32                    fx1; //NPC Wander PoSI32 1 x
01004                 SI32                    fx2; //NPC Wander Point 2 x
01005                 SI32                    fy1; //NPC Wander Point 1 y
01006                 SI32                    fy2; //NPC Wander Point 2 y
01007                 signed char             fz1; //NPC Wander Point 1 z
01008                 std::map <SERIAL, TIMERVAL> speakCharMemory;
01009                 UI08                    hidden; // 0 = not hidden, 1 = hidden, 2 = invisible spell
01010                 TIMERVAL                invistimeout;
01011                 SI32                    hunger;  // Level of hungerness, 6 = full, 0 = "empty"
01012                 TIMERVAL                hungertime; // Timer used for hunger, one point is dropped every 20 min
01013                 //char region;
01014                 UI08                    region;
01015 
01016 
01017                 SI32                    combathitmessage;
01018                 SI32                    making; // skill number of skill using to make item, 0 if not making anything.
01019                 char                    blocked;
01020                 char                    dir2;
01021                 TIMERVAL                spiritspeaktimer; // Timer used for duration of spirit speak
01022                 SI32                    spattack;
01023                 TIMERVAL                spadelay;
01024                 TIMERVAL                spatimer;
01025                 SI32                    taming; //Skill level required for taming
01026                 TIMERVAL                summontimer; //Timer for summoned creatures.
01027                 TIMERVAL                fishingtimer; // Timer used to delay the catching of fish
01028 
01029         //SI32                  amxflags[16]; // for special things implemented by scripts :)
01030                 SI32