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

cChar Class Reference

Character class. More...

#include <chars.h>

Inheritance diagram for cChar:

cObject List of all members.

Priviledges

const UI08 getPrivLevel () const
void setPrivLevel (UI08 pLevel)
const LOGICAL IsGM () const
const LOGICAL IsCounselor () const
const LOGICAL IsGMorCounselor () const
const LOGICAL IsInvul () const
const LOGICAL CanSnoop () const
const LOGICAL CanBroadcast () const
const LOGICAL CanSeeSerials () const
const LOGICAL isFrozen () const
const LOGICAL isPermaHidden () const
const LOGICAL isDispellable () const
const LOGICAL canAllMove () const
const LOGICAL dontUseMana () const
const LOGICAL dontUseReagents () const
const LOGICAL hasReflection () const
const LOGICAL canViewHouseIcon () const
void setAllMove (LOGICAL set=true)
void setViewHouseIcon (LOGICAL set=true)
void setPermaHidden (LOGICAL set=true)
void setReflection (LOGICAL set=true)
const UI08 GetPriv () const
void SetPriv (UI08 p)
void MakeInvulnerable ()
void MakeVulnerable ()
const UI08 GetPriv2 () const
void SetPriv2 (SI08 p)
void setPriv2 (UI08 privFlag, LOGICAL set)
UI08 priv
 see cchar_privs

UI08 priv2
 see cchar_privs

UI08 privLevel
 privilege level


Char Status

const LOGICAL IsInnocent () const
const LOGICAL IsMurderer () const
const LOGICAL IsCriminal () const
LOGICAL const IsGrey () const
const LOGICAL IsHidden () const
const LOGICAL IsHiddenBySpell () const
const LOGICAL IsHiddenBySkill () const
LOGICAL const IsOverWeight ()
 Checks char weight.

LOGICAL const IsOnline () const
 get online status

const LOGICAL InGuardedArea () const
LOGICAL const CanDoGestures () const
void SetMurderer ()
void SetInnocent ()
void SetCriminal ()
void SetPermaGrey ()
void SetGrey ()
 Makes a character temporary grey.

void setTelekinesisFlag (LOGICAL state)
void setGreyFlag (LOGICAL state)
void unHide ()
 Reveals the char if he was hidden.

const SI32 GetKarma () const
 Return the karma of the char.

void SetKarma (SI32 newkarma)
 Set the karma of the char.

const SI32 GetFame () const
 Return the fame of the char.

void SetFame (SI32 newfame)
void IncreaseKarma (SI32 value, P_CHAR pKilled=0)
 increase or decrease the karma of the char

void modifyFame (SI32 value)
 increase or decrease the fame of the char

LOGICAL incognito
 AntiChrist - true if under incognito effect.

LOGICAL polymorph
 AntiChrist - true if under polymorph effect.

UI32 kills
 PvP Kills.

UI32 deaths
 Number of deaths.

LOGICAL dead
 Is the character dead ?

R32 fstm
 Unavowed - stamina to remove the next step.

SI32 karma
 karma of the char

SI32 fame
 fame of the char


Date/Time

Date/Time related functions and attributes

void SetCreationDay (TIMERVAL day)
 Set the creation day of a character.

const TIMERVAL GetCreationDay () const
 Get the creation day of a character.

TIMERVAL creationday
 Day since EPOCH this character was created on.


Stats

Stats related functions and attributes

void setStrength (UI32 val, bool check=true)
void checkSafeStats ()
 Checks if the stats are regular.

const SI32 getStrength () const
 Get the strength-value.

void modifyStrength (SI32 mod, bool check=true)
 modify the strength

SI32 st2
 Reserved for calculation.

SI32 st3
 Luxor: safe strength value.

SI32 dx
 Dexterity.

SI32 dx2
 Reserved for calculation.

SI32 dx3
 Luxor: safe dexterity value.

SI32 in
 Intelligence.

SI32 in2
 Reserved for calculation.

SI32 in3
 Luxor: safe intelligence value.

SI32 statGainedToday
 xan :-> for stat-gain cap

UI32_s str
 Strength.


Appearence

const LOGICAL HasHumanBody () const
void showLongName (P_CHAR showToWho, LOGICAL showSerials)
std::string title

Combat

LOGICAL HasAttackedFirst ()
void SetAttackFirst (LOGICAL af=true)
void ResetAttackFirst ()
void checkPoisoning ()
void fight (P_CHAR pOpponent)
 makes a character fight the other

void combatHit (P_CHAR pc_def, SI32 nTimeOut=0)
 Attack a char.

void doCombat ()
 Does combat sequence.

void combatOnHorse ()
void combatOnFoot ()
void playCombatAction ()
 plays the combat animation

SI32 calcAtt ()
SI32 calcDef (SI32 x=0)
void setWresMove (SI32 move=0)
SI32 calcResist (DamageType typeofdamage)
 calculates resist power of a char

void toggleCombat ()
 Toggle war mode.

SI32 getCombatSkill ()
 returns char's combat skill

void castSpell (magic::SpellId spellnumber, TargetLocation &dest, SI32 flags=0, SI32 param=0)
 Makes the char casting a spell.

LOGICAL combatTimerOk ()
 Check for combat timeout.

void checkPoisoning (P_CHAR pc_def)
void doMissedSoundEffect ()
SI32 combatHitMessage (SI32 damage)
void doCombatSoundEffect (SI32 fightskill, P_ITEM pWeapon)
void undoCombat ()
 Abort combat sequence.

LOGICAL attackfirst
 0 = defending, 1 = attacked first


Movement

LOGICAL canSee (cObject &obj)
 can it see the object?

LOGICAL seeForFirstTime (cObject &obj, LOGICAL testCanSee=true)
 does it see the object for the first time?

LOGICAL seeForLastTime (cObject &obj, LOGICAL testCanSee=true)
 does it see the object for the first time?

void walk ()
 execute walk code <Luxor>

LOGICAL hasPath ()
 has a path set?

void follow (P_CHAR pc)
 follow pc

void flee (P_CHAR pc, SI32 seconds=-1)
 flee from pc

void pathFind (Location pos, LOGICAL bOverrideCurrentPath=true)
 Walk to position.

SI08 dir
 &0F=Direction

UI32 LastMoveTime
 server time of last move

void walkNextStep ()
 walk next path step

cPathpath
 current path

SERIAL_SLIST sentObjects

Others

void doGmEffect ()
 Function for the different gm movement effects.

FUNCIDX targetcallback
UI08 gmrestrict
 for restricting GMs to certain regions


Trainer

const LOGICAL isBeingTrained () const
const SERIAL getTrainer () const
const UI08 getSkillTaught () const
const LOGICAL canTrain () const
void setCanTrain (LOGICAL c=true)
void resetCanTrain ()
SERIAL trainer
 Serial of the NPC training the char, -1 if none.

UI08 trainingplayerin
 Index in skillname of the skill the NPC is training the player in.

LOGICAL cantrain

Mount

SI32 unmountHorse ()
 make char unmount horse (Remove horse item and spawn new horse)

void mounthorse (P_CHAR mount)
 Mount a creature.

SERIAL getHorse ()
 Get horse current mounted.

void setOnHorse ()
 Set on horse.

bool isMounting ()
 Check if is on horse.

bool isMounting (P_CHAR horse)
 Check if is on given horse.

bool mounted
 if now is mounted by a char

LOGICAL onhorse
 On a horse.


Guilds

bool isGuilded ()
 check if guilded

void setGuild (P_GUILD guild, P_GUILD_MEMBER member)
 set Guild

P_GUILD getGuild ()
 get Guild

P_GUILD_MEMBER getGuildMember ()
 get Guild member

short GetGuildType ()
 return the guild type

void SetGuildType (short newGuildType)
 set the guild type

LOGICAL IsGuildTraitor ()
 return guild traitor status

void SetGuildTraitor ()
 set guild traitor status

void ResetGuildTraitor ()
 reset guild traitor status

LOGICAL HasGuildTitleToggle ()
 return guild title toggle status

void SetGuildTitleToggle ()
 set guild title toggle

void ResetGuildTitleToggle ()
 reset guild title toggle

SERIAL GetGuildFealty ()
 return the guild fealty

void SetGuildFealty (SERIAL newGuildFealty)
 set the guild fealty

SI32 GetGuildNumber ()
 return the guild number

void SetGuildNumber (SI32 newGuildNumber)
 set the guild number

TEXTGetGuildTitle ()
 return the guild title

void SetGuildTitle (TEXT *newGuildTitle)
 set the guild title

P_GUILD guild
 the guild

P_GUILD_MEMBER member
 the guild member info

short guildType
LOGICAL guildTraitor
LOGICAL guildToggle
SERIAL guildFealty
SI32 guildNumber

Stats regen rate info

void setRegenRate (StatType stat, UI32 rate, VarType type)
UI32 getRegenRate (StatType stat, VarType type)
bool regenTimerOk (StatType stat)
void updateRegenTimer (StatType stat)
regen_st regens [ALL_STATS]
 stats regen info


Talk and Emote stuff

void talkAll (TEXT *txt, LOGICAL antispam=1)
 shows speech text to all pcs near the char

void talk (NXWSOCKET s, TEXT *txt, LOGICAL antispam=1)
 Shows speech text of a char to the given char.

void emote (NXWSOCKET s, TEXT *txt, LOGICAL antispam,...)
 Shows emote text of a char.

void emoteall (char *txt, LOGICAL antispam,...)
 Shows emote text of a char to all near pcs.

void talkRunic (NXWSOCKET s, TEXT *txt, LOGICAL antispam=1)
 Shows runic speech text of a char to the given socket.

void talkAllRunic (TEXT *txt, LOGICAL antispam=0)
 Shows runic speech text to all pcs near the char.

UI16 emotecolor
 Color for emote messages.

UI08 fonttype
 Speech font to use.

UI16 saycolor
 Color for say messages.

LOGICAL unicode
 This is set to 1 if the player uses unicode speech, 0 if not.


possess stuff

Author:
Luxor


void possess (P_CHAR pc)
 shifts a player in the body of a npc, usually used only by GMs

SERIAL possessorSerial
SERIAL possessedSerial

Public Methods

 cChar (SERIAL ser)
 ~cChar ()
void setClient (NXWCLIENT client)
void MoveTo (Location newloc)
void loadEventFromScript (TEXT *script1, TEXT *script2)
void MoveTo (SI32 x, SI32 y, SI32 z)
const LOGICAL resistsFire () const
const LOGICAL resistsFreeze () const
void heartbeat ()
void setSkillDelay (UI32 seconds=server_data.skilldelay)
const LOGICAL canDoSkillAction () const
void setObjectDelay (UI32 seconds=server_data.objectdelay)
const LOGICAL canDoObjectAction () const
void setMultiSerial (long mulser)
const LOGICAL isOwnerOf (const cObject *obj) const
char * getCommandSpeech ()
void setCommandSpeech (char *curr_speech)
void resetCommandParams ()
 Reset all the Params strings.

void setCommandParams (int index, std::string param)
 Set a Param.

TEXTgetCommandParams (int index)
 Get a Param.

SI32 getHireFee ()
void setHireFee (SI32 newfee)
bool isHirable ()
wstring * getSpeechCurrent ()
 Return current speech.

void setSpeechCurrent (wstring *speech)
 Set current speech.

void resetSpeechCurrent ()
 Reset current speech.

void deleteSpeechCurrent ()
const LOGICAL isStabled () const
 Check if char is stabled.

const SERIAL getStablemaster () const
 Get the character's stablemaster.

void stable (P_CHAR stablemaster)
void unStable ()
void doSingleClick (SERIAL serial)
void onSingleClick (P_CHAR clickedBy)
const LOGICAL isRunning () const
 tells if a character is running

void setRunning ()
void updateStats (SI32 stat)
 Updates stats to nearbye players.

void setNextMoveTime (short tamediv=1)
void disturbMed ()
 stops meditation if necessary. Displays message if a socket is passed

void drink (P_ITEM pi)
 makes the character drinking something

void hideBySkill ()
 Hides a player by skill.

void hideBySpell (SI32 timer=-1)
 Hides a player by spell.

UI32 CountItems (short ID, short col=-1)
 count items of given id and color

UI32 CountItemsByType (short type)
 count items of given type

const UI32 CountGold ()
P_ITEM GetItemOnLayer (UI08 layer)
 Returns the item on the given layer, if any.

P_ITEM GetBankBox (short type=BANK_GOLD)
 get the bank box

void openBankBox (P_CHAR pc)
 open a bankbox

void openSpecialBank (P_CHAR pc)
 region specific bankbox

SI32 countBankGold ()
P_ITEM getWeapon ()
 finds the equipment weapon of a character

P_ITEM getShield ()
 finds the equipped shield of a character

void showContainer (P_ITEM pCont)
 Show a container to player.

P_ITEM getBackpack ()
LOGICAL isInBackpack (P_ITEM pi)
void showPaperdoll (P_CHAR viewer)
void showBackpack ()
 Show Backpack to player.

UI32 getSkillSum ()
SI32 getTeachingDelta (P_CHAR pPlayer, SI32 skill, SI32 sum)
 calculates how much the given player can learn from this teacher

void removeItemBonus (cItem *pi)
LOGICAL isSameAs (P_CHAR pc)
LOGICAL resist (SI32 n)
NXWCLIENT getClient () const
 get the client

NXWSOCKET getSocket () const
 gets the character current socket

void sysmsg (const TEXT *txt,...)
 easy wrapper to sysmsg

void attackStuff (P_CHAR pc)
 wrapper for AttackStuff()

void helpStuff (P_CHAR pc_i)
void applyPoison (PoisonType poisontype, SI32 secs=-1)
 applies a poison to a char

void setOwner (P_CHAR owner)
 Sets owner fields.

void curePoison ()
 Cures poison.

void resurrect (NXWCLIENT healer=NULL)
 Resurrects a char.

void unfreeze (LOGICAL calledByTempfx=false)
 unfreezes the char

void damage (SI32 amount, DamageType typeofdamage=DAMAGE_PURE, StatType stattobedamaged=STAT_HP)
 damages a character

void playAction (SI32 action)
 Makes the char doing an action.

UI32 distFrom (P_CHAR pc)
 Get char's distance from the given character.

UI32 distFrom (P_ITEM pi)
 Get char's distance from the given item.

void teleport (UI08 flags=TELEFLAG_SENDALL, NXWCLIENT cli=NULL)
 Teleports character to its current set coordinates.

void facexy (SI32 facex, SI32 facey)
 Changes the orientation of a player.

LOGICAL losFrom (P_CHAR pc)
 Returns line of sight from the char to the give char.

void playSFX (SI16 sound, LOGICAL onlyToMe=false)
 plays a sound effect on a char

void playMonsterSound (MonsterSound sfx)
 Plays a monster sound effect.

void freeze ()
 Freeze the char.

LOGICAL checkSkill (Skill sk, SI32 low, SI32 high, LOGICAL bRaise=true)
 Checks a skill for success.

SI32 delItems (short id, SI32 amount=1, short color=-1)
 Deletes items from backpack, by id.

const LOGICAL checkSkillSparrCheck (Skill sk, SI32 low, SI32 high, P_CHAR pcd)
 checks a skill for success (with sparring check)

UI32 getAmount (short id, short col=-1, bool onlyPrimaryBackpack=false)
 Get the amount of the given id, color.

void movingFX (P_CHAR destination, short id, SI32 speed, SI32 loop, LOGICAL explode, class ParticleFx *part=NULL)
 Plays a moving effect from this to target char.

void staticFX (short id, SI32 speed, SI32 loop, class ParticleFx *part=NULL)
 Plays a static effect on a char.

void boltFX (LOGICAL bNoParticles)
 Bolts a char.

void circleFX (short id)
 Plays circle of blood or similar effect.

P_ITEM getBeardItem ()
 Gets beard item.

P_ITEM getHairItem ()
 Gets hairs item.

void morph (short bodyid=-1, short skincolor=-1, short hairstyle=-1, short haircolor=-1, short beardstyle=-1, short beardcolor=-1, const char *newname=NULL, LOGICAL bBackup=true)
 Characters morphing (incognito, polymorph, etc).

void morph (SI32 npcNumber, LOGICAL bBackup)
 Characters morphing (incognito, polymorph, etc).

void jail (SI32 seconds=60 *60 *24)
 Jails a char.

void Kill ()
 Manages/causes character death.

void kick ()
 Kicks a char.

void goPlace (SI32)
 Teleports char to a goplace location.

LOGICAL knowsSpell (magic::SpellId spellnumber)
 Checks if a char knows a given spell.

void setNpcMoveTime ()
 Update npcmove timer.

virtual void Delete ()
 sends a remove packet to everyone nearby and deletes itself

cCharSavergetBackupStats ()
void setBackupStats (cCharSaver *saver)
void serialize (ofstream *out)
Char Equipment
const LOGICAL IsWearing (P_ITEM pi) const
SI32 Equip (P_ITEM pi, LOGICAL drag=false)
 Equip an item.

SI32 UnEquip (P_ITEM pi, LOGICAL drag=false)
 Unequip an item.

void checkEquipement ()
 unequip items that you can nop longer wear/use


Static Public Methods

void archive ()
void safeoldsave ()

Public Attributes

char nxwflags [4]
bool jailed
TIMERVAL skilldelay
TIMERVAL objectdelay
SERIAL keyserial
 for renaming keys

SERIAL packitemserial
 Only used during character creation.

SERIAL targserial
 Current combat target.

SERIAL runeserial
 Used for naming runes.

SERIAL attackerserial
 Character who attacked this character.

SERIAL ftargserial
 NPC Follow Target.

SERIAL swingtargserial
 Target they are going to hit after they swing.

SI32 namedeedserial
SI32 account
wstring profile
 player profile

SI32 npcaitype
 NPC ai.

SERIAL oldmenu
 old menu serial

SI32 stat3crc
AmxEventamxevents [ALLCHAREVENTS]
SI32 hp
SI32 stm
SI32 mn
SI32 mn2
UI16 baseskill [ALLSKILLS+1]
UI16 skill [ALLSKILLS+1]
SERIAL robe
UI08 fixedlight
char speech
SI32 weight
UI32 att
UI32 def
char war
char wresmove
TIMERVAL timeout
TIMERVAL timeout2
TIMERVAL npcmovetime
char npcWander
char oldnpcWander
SI32 fleeTimer
R32 npcMoveSpeed
R32 npcFollowSpeed
SI32 fx1
SI32 fx2
SI32 fy1
SI32 fy2
signed char fz1
std::map< SERIAL, TIMERVALspeakCharMemory
UI08 hidden
TIMERVAL invistimeout
SI32 hunger
TIMERVAL hungertime
UI08 region
SI32 combathitmessage
SI32 making
char blocked
char dir2
TIMERVAL spiritspeaktimer
SI32 spattack
TIMERVAL spadelay
TIMERVAL spatimer
SI32 taming
TIMERVAL summontimer
TIMERVAL fishingtimer
SI32 magicsphere
SI32 resists [MAX_RESISTANCE_INDEX]
LOGICAL holydamaged
LOGICAL lightdamaged
DamageType damagetype
SI32 advobj
SI32 poison
PoisonType poisoned
TIMERVAL poisontime
TIMERVAL poisontxt
TIMERVAL poisonwearofftime
SI32 fleeat
SI32 reattackat
SI32 trigger
std::string trigword
UI16 envokeid
SI32 envokeitem
SI32 split
SI32 splitchnc
SI32 targtrig
char ra
char flag
TIMERVAL tempflagtime
wstring * staticProfile
 player static profile

TIMERVAL murderrate
TIMERVAL murdersave
TIMERVAL crimflag
SI32 casting
TIMERVAL spelltime
magic::SpellId spell
SI32 spellaction
magic::CastingType spelltype
TIMERVAL nextact
TargetLocationspellTL
SI32 squelched
TIMERVAL mutetime
SI32 med
UI08 lockSkill [ALLSKILLS+1]
SI32 stealth
UI32 running
UI32 lastRunning
SI32 logout
TIMERVAL clientidletime
UI32 holdg
char fly_steps
LOGICAL tamed
LOGICAL guarded
TIMERVAL smoketimer
TIMERVAL smokedisplaytimer
TIMERVAL antispamtimer
TIMERVAL antiguardstimer
SI32 carve
SERIAL hairserial
SERIAL beardserial
TIMERVAL begging_timer
MsgBoards::PostType postType
MsgBoards::QuestType questType
SI32 questDestRegion
SI32 questOrigRegion
SI32 questBountyReward
SERIAL questBountyPostSerial
SERIAL murdererSer
SI32 prevX
SI32 prevY
signed char prevZ
LOGICAL morphed
char npc_type
TIMERVAL time_unused
TIMERVAL timeused_last
SI32 gmMoveEff
std::vector< UI32lootVector
Party
SI32 party
NPCs
UI32 lastNpcCheck
char npc
 1=Character is an NPC

LOGICAL doorUse
 True if npc can open doors.

LOGICAL shopkeeper
 true=npc shopkeeper

Location workloc
 work location (not used for now)

Location homeloc
 home location (not used for now)

Location foodloc
 food location (not used for now)

TIMERVAL nextAiCheck
SI32 hidamage
 NPC Hi Damage.

SI32 lodamage
 NPC Lo Damage.

Menu
SERIAL custmenu
 legacy code, used for old mnu_ and hard coded menu

Npc Vendor
Note:
fist draft.. need to make map with id used in recive for make faster


std::vector< vendor_item > * vendorItemsSell
 all items sell by vendor

std::vector< vendor_item > * vendorItemsBuy
 all items sell by vendor


Static Public Attributes

nxwflags_chars
Flags used for the char

const UI08 flagGrey = 0x01
 Char is grey.

const UI08 flagPermaGrey = 0x02
 Char is permanent grey.

const UI08 flagResistFire = 0x04
 Char resists to fire (unused).

const UI08 flagResistParalisys = 0x08
 Char resists to paralisys (unused).

const UI08 flagResistPoison = 0x10
 Char resists to poison (unused).

const UI08 flagWaterWalk = 0x20
 Char walks on water (npc only).

const UI08 flagSpellTelekinesys = 0x40
 Char under telekinesys spell (Luxor).

const UI08 flagSpellProtection = 0x80
 Char under protection spell (Luxor).

const UI08 flagKarmaInnocent = 0x04
 Char is innocent.

const UI08 flagKarmaMurderer = 0x01
 Char is murderer.

const UI08 flagKarmaCriminal = 0x02
 Char is criminal.

cchar_privs
Priv variables used by priv and priv2

const UI08 flagPrivGM = 0x01
 Char is GM.

const UI08 flagPrivBroadcast = 0x02
 Char can broadcast.

const UI08 flagPrivInvulnerable = 0x04
 Char is invulnerable.

const UI08 flagPrivCanViewSerials = 0x08
 Char can view serial codes.

const UI08 flagPrivNoSkillTitle = 0x10
 Char hasn't skill title.

const UI08 flagPrivPageAble = 0x20
const UI08 flagPrivCanSnoopAll = 0x40
const UI08 flagPrivCounselor = 0x80
const UI08 flagPriv2AllMove = 0x01
const UI08 flagPriv2Frozen = 0x02
const UI08 flagPriv2ViewHouseIcon = 0x04
const UI08 flagPriv2PermaHidden = 0x08
const UI08 flagPriv2NoUseMana = 0x10
const UI08 flagPriv2Dispellable = 0x20
const UI08 flagPriv2Reflection = 0x40
const UI08 flagPriv2NoUseReagents = 0x80
const UI08 flagPriv2Polymorphed = 0x100
const UI08 flagPriv2Poisoned = 0x200
const UI08 flagPriv2Mounted = 0x400
const UI08 flagPriv2Ridden = 0x800
const UI08 flagPriv2Incognito = 0x1000
const UI08 flagPriv2Dead = 0x2000
const UI08 flagPriv2canTrain = 0x4000
const UI08 flagPriv2shopkeeper = 0x8000

Private Methods

void generic_heartbeat ()
void pc_heartbeat ()
void do_lsd ()
void npc_heartbeat ()
void resetBaseSkill ()
void resetSkill ()
void resetNxwFlags ()
void resetAmxEvents ()
void resetResists ()
void resetLockSkills ()
void doSingleClickOnCharacter (SERIAL serial)
void doSingleClickOnItem (SERIAL serial)

Private Attributes

cNxwClientObjm_client
wstring * speechCurrent
char * commandSpeech
std::string param1
std::string param2
std::string param3
std::string param4
std::string param5
std::string param6
std::string param7
std::string param8
SI32 hirefee
SERIAL stablemaster_serial
 the stablemaster serial

cCharSaverbackupStats

Detailed Description

Character class.


Constructor & Destructor Documentation

cChar::cChar SERIAL    ser
 

cChar::~cChar  
 


Member Function Documentation

void cChar::applyPoison PoisonType    poisontype,