|
Planeshift
|
Handle all network messages inn and out of the NPC Client. More...
#include <networkmgr.h>
Public Member Functions | |
| void | Authenticate (csString &host, int port, csString &user, csString &pass) |
| void | CheckCommandsOverrun (size_t neededSize) |
| Checks if the npc command message could overrun if the neededSize is tried to be added. More... | |
| void | DequeueDRData (NPC *npc) |
| Call to remove queued dr updates when entities are removed/deleted. More... | |
| void | Disconnect () |
| const char * | GetCommonString (uint32_t cstr_id) |
| Convert a common string id into the corresponding string. More... | |
| uint32_t | GetCommonStringID (const char *string) |
| Convert a string into a common string id. More... | |
| csStringHashReversible * | GetMsgStrings () |
| Get the message string table. More... | |
| virtual void | HandleMessage (MsgEntry *pMsg) |
| Handle all messages from server and send them to specefic Handle functions for each message type. More... | |
| bool | IsReady () |
| NetworkManager (MsgHandler *mh, psNetConnection *conn, iEngine *engine) | |
| Construct the network manager. More... | |
| void | PrepareCommandMessage () |
| Prepare a new command message allow for queuing of new commands. More... | |
| void | QueueAnimationCommand (gemNPCActor *npc, const csString &cmd) |
| Send an animation command to server. More... | |
| void | QueueAssessCommand (gemNPCActor *entity, gemNPCObject *target, const csString &physicalAssessmentPerception, const csString &magicalAssessmentPerception, const csString &overallAssessmentPerception) |
| Send a command to do an assessment. More... | |
| void | QueueAttackCommand (gemNPCActor *attacker, gemNPCActor *target, const char *stance, const char *attack_type) |
| Queue an Attack Command for an NPC to the server. More... | |
| void | QueueBusyCommand (gemNPCActor *entity, bool busy) |
| Send a command to change the busy state. More... | |
| void | QueueCastCommand (gemNPCActor *entity, gemNPCObject *target, const csString &spell, float kFactor) |
| Send a command to start cast a spell. More... | |
| void | QueueControlCommand (gemNPCActor *controllingEntity, gemNPCActor *controlledEntity) |
| Send a command start controll an entity. More... | |
| void | QueueDeleteNPCCommand (NPC *npcx) |
| Send a command to delete a npc. More... | |
| void | QueueDequipCommand (gemNPCActor *entity, csString slot) |
| Send a command to dequip an equipment. More... | |
| void | QueueDRData (NPC *npc) |
| Queue the NPC for an DR Update to the server. More... | |
| void | QueueDRData2 (NPC *npc) |
| Queue the NPC for an DR Update to the server. More... | |
| void | QueueDropCommand (gemNPCActor *entity, csString slot) |
| Send a command to drop the content of a slot. More... | |
| void | QueueEmoteCommand (gemNPCActor *npc, gemNPCObject *target, const csString &cmd) |
| Send an emote command to server. More... | |
| void | QueueEquipCommand (gemNPCActor *entity, csString item, csString slot, int count) |
| Send a command to equip an equipment. More... | |
| void | QueueLootCommand (gemNPCActor *entity, EID targetEID, const csString &type) |
| Send a command to loot selected target. More... | |
| void | QueuePickupCommand (gemNPCActor *entity, gemNPCObject *item, int count) |
| Queue a command to pickup a item. More... | |
| void | QueueResurrectCommand (csVector3 where, float rot, iSector *sector, PID character_id) |
| Send a command to resurrect. More... | |
| void | QueueScriptCommand (gemNPCActor *npc, gemNPCObject *target, const csString &scriptName) |
| Send a script command to server. More... | |
| void | QueueSequenceCommand (csString name, int cmd, int count) |
| Send a command to start a sequence. More... | |
| void | QueueSitCommand (gemNPCActor *npc, gemNPCObject *target, bool sit) |
| Send a sit command to server. More... | |
| void | QueueSpawnBuildingCommand (gemNPCActor *spawner, csVector3 where, iSector *sector, const char *buildingName, int tribeID, bool pickupable) |
| Send a spawn building command to server. More... | |
| void | QueueSpawnCommand (gemNPCActor *mother, gemNPCActor *father, const csString &tribeMemberType) |
| Send a spawn command to server. More... | |
| void | QueueSystemInfoCommand (uint32_t clientNum, const char *reply,...) |
| Send an system info command to the client. More... | |
| void | QueueTalkCommand (gemNPCActor *speaker, gemNPCActor *target, psNPCCommandsMessage::PerceptionTalkType talkType, bool publicTalk, const char *text) |
| Queue a talk command to the server. More... | |
| void | QueueTemporarilyImperviousCommand (gemNPCActor *entity, bool impervious) |
| Send a command to change the temporarily impervious status. More... | |
| void | QueueTransferCommand (gemNPCActor *entity, csString item, int count, csString target) |
| Send a command to transfere an item between two entities. More... | |
| void | QueueUnbuildCommand (gemNPCActor *unbuilder, gemNPCItem *building) |
| Send a unbuild command to server. More... | |
| void | QueueVisibilityCommand (gemNPCActor *entity, bool status) |
| Queue a change in visibility. More... | |
| void | QueueWorkCommand (gemNPCActor *entity, const csString &type, const csString &resource) |
| Send a command to start working. More... | |
| void | ReAuthenticate () |
| Reauthenicate with the server. More... | |
| void | ReConnect () |
| Reconnect to the server server. More... | |
| void | SendAllCommands (bool final=false) |
| Send the queued commands. More... | |
| void | SendConsoleCommand (const char *cmd) |
| Send a console command. More... | |
| virtual | ~NetworkManager () |
| Destructor. More... | |
Public Member Functions inherited from psClientNetSubscriber | |
| virtual void | HandleMessage (MsgEntry *msg, Client *) |
| Interprets a received message and executes the command. More... | |
| virtual bool | Verify (MsgEntry *, unsigned int, Client *&) |
| virtual | ~psClientNetSubscriber () |
Public Attributes | |
| bool | reconnect |
| Set to true if reconnect should be done. More... | |
Protected Member Functions | |
| void | HandleActor (MsgEntry *msg) |
| Handle an actor from server. More... | |
| void | HandleAllEntities (MsgEntry *message) |
| Handle list of all entities from server. More... | |
| void | HandleConsoleCommand (MsgEntry *me) |
| void | HandleDisconnect (MsgEntry *msg) |
| Handle command to disconnect from server. More... | |
| void | HandleHiredNPCScript (MsgEntry *me) |
| Handle Hired npc script from server. More... | |
| void | HandleItem (MsgEntry *me) |
| Handle a new item from server. More... | |
| void | HandleLocation (MsgEntry *me) |
| Handle location changes from server. More... | |
| bool | HandleMapList (MsgEntry *msg) |
| Handle the map list received from server. More... | |
| void | HandleNewNpc (MsgEntry *msg) |
| Handle information from server about NPCs to use. More... | |
| void | HandleNpcDeleted (MsgEntry *msg) |
| Handle information from server about deleted NPC. More... | |
| bool | HandleNPCList (MsgEntry *msg) |
| Handle a list of npcs received from server. More... | |
| void | HandleNPCWorkDone (MsgEntry *msg) |
| Handle information from server that work is done. More... | |
| void | HandleObjectRemoval (MsgEntry *me) |
| Handle removal of an object from server. More... | |
| void | HandlePathNetwork (MsgEntry *me) |
| Handle changes to path network from server. More... | |
| void | HandlePerceptions (MsgEntry *msg) |
| Handle perceptions from the server. More... | |
| void | HandlePersistMessage (MsgEntry *msg) |
| Handle new entities from server. More... | |
| void | HandlePositionUpdates (MsgEntry *msg) |
| Handle update update of positions from server. More... | |
| void | HandleRaceList (MsgEntry *me) |
| Handle list of races from server. More... | |
| void | HandleTimeUpdate (MsgEntry *msg) |
| Handle time updates from server. More... | |
| void | RequestAllObjects () |
| Number of command messages queued. More... | |
Protected Attributes | |
| int | cmd_count |
| Entities queued for sending of DR. More... | |
| csHash< NPC *, PID > | cmd_dr_outbound |
| bool | connected |
| psNetConnection * | connection |
| csString | host |
| MsgHandler * | msghandler |
| psNPCCommandsMessage * | outbound |
| csString | password |
| int | port |
| bool | ready |
| csString | user |
Handle all network messages inn and out of the NPC Client.
Definition at line 56 of file networkmgr.h.
| NetworkManager::NetworkManager | ( | MsgHandler * | mh, |
| psNetConnection * | conn, | ||
| iEngine * | engine | ||
| ) |
Construct the network manager.
|
virtual |
Destructor.
| void NetworkManager::Authenticate | ( | csString & | host, |
| int | port, | ||
| csString & | user, | ||
| csString & | pass | ||
| ) |
| void NetworkManager::CheckCommandsOverrun | ( | size_t | neededSize | ) |
Checks if the npc command message could overrun if the neededSize is tried to be added.
Automatically sends the message in case it could overrun.
| neededSize | The size of data we are going to attempt to add to the npc commands message. |
| void NetworkManager::DequeueDRData | ( | NPC * | npc | ) |
Call to remove queued dr updates when entities are removed/deleted.
| void NetworkManager::Disconnect | ( | ) |
| const char* NetworkManager::GetCommonString | ( | uint32_t | cstr_id | ) |
Convert a common string id into the corresponding string.
| uint32_t NetworkManager::GetCommonStringID | ( | const char * | string | ) |
Convert a string into a common string id.
| csStringHashReversible* NetworkManager::GetMsgStrings | ( | ) |
Get the message string table.
|
protected |
Handle an actor from server.
| msg | The undecoded message to handle. |
|
protected |
Handle list of all entities from server.
| message | The undecoded message to handle. |
|
protected |
| me | The undecoded message to handle. |
|
protected |
Handle command to disconnect from server.
| msg | The undecoded message to handle. |
|
protected |
Handle Hired npc script from server.
| msg | The undecoded message to handle. |
|
protected |
Handle a new item from server.
| me | The undecoded message to handle. |
|
protected |
Handle location changes from server.
| me | The undecoded message to handle. |
|
protected |
Handle the map list received from server.
| msg | The undecoded message to handle. |
|
virtual |
Handle all messages from server and send them to specefic Handle functions for each message type.
| pMsg | The undecoded message to handle. |
Implements psClientNetSubscriber.
|
protected |
Handle information from server about NPCs to use.
| msg | The undecoded message to handle. |
|
protected |
Handle information from server about deleted NPC.
| msg | The undecoded message to handle. |
|
protected |
Handle a list of npcs received from server.
| msg | The undecoded message to handle. |
|
protected |
Handle information from server that work is done.
| msg | The undecoded message to handle. |
|
protected |
Handle removal of an object from server.
| me | The undecoded message to handle. |
|
protected |
Handle changes to path network from server.
| me | The undecoded message to handle. |
|
protected |
Handle perceptions from the server.
| msg | The undecoded message to handle. |
|
protected |
Handle new entities from server.
| msg | The undecoded message to handle. |
|
protected |
Handle update update of positions from server.
| msg | The undecoded message to handle. |
|
protected |
Handle list of races from server.
| me | The undecoded message to handle. |
|
protected |
Handle time updates from server.
| msg | The undecoded message to handle. |
|
inline |
Definition at line 227 of file networkmgr.h.
| void NetworkManager::PrepareCommandMessage | ( | ) |
Prepare a new command message allow for queuing of new commands.
| void NetworkManager::QueueAnimationCommand | ( | gemNPCActor * | npc, |
| const csString & | cmd | ||
| ) |
Send an animation command to server.
| npc | The npc that has an animation |
| cmd | The animation |
| void NetworkManager::QueueAssessCommand | ( | gemNPCActor * | entity, |
| gemNPCObject * | target, | ||
| const csString & | physicalAssessmentPerception, | ||
| const csString & | magicalAssessmentPerception, | ||
| const csString & | overallAssessmentPerception | ||
| ) |
Send a command to do an assessment.
| void NetworkManager::QueueAttackCommand | ( | gemNPCActor * | attacker, |
| gemNPCActor * | target, | ||
| const char * | stance, | ||
| const char * | attack_type | ||
| ) |
| void NetworkManager::QueueBusyCommand | ( | gemNPCActor * | entity, |
| bool | busy | ||
| ) |
Send a command to change the busy state.
| void NetworkManager::QueueCastCommand | ( | gemNPCActor * | entity, |
| gemNPCObject * | target, | ||
| const csString & | spell, | ||
| float | kFactor | ||
| ) |
Send a command to start cast a spell.
| void NetworkManager::QueueControlCommand | ( | gemNPCActor * | controllingEntity, |
| gemNPCActor * | controlledEntity | ||
| ) |
Send a command start controll an entity.
| void NetworkManager::QueueDeleteNPCCommand | ( | NPC * | npcx | ) |
Send a command to delete a npc.
| void NetworkManager::QueueDequipCommand | ( | gemNPCActor * | entity, |
| csString | slot | ||
| ) |
Send a command to dequip an equipment.
| void NetworkManager::QueueDRData | ( | NPC * | npc | ) |
| void NetworkManager::QueueDRData2 | ( | NPC * | npc | ) |
| void NetworkManager::QueueDropCommand | ( | gemNPCActor * | entity, |
| csString | slot | ||
| ) |
Send a command to drop the content of a slot.
| void NetworkManager::QueueEmoteCommand | ( | gemNPCActor * | npc, |
| gemNPCObject * | target, | ||
| const csString & | cmd | ||
| ) |
Send an emote command to server.
| npc | The npc that has an emotion |
| target | The current target of then npc |
| cmd | The emotion |
| void NetworkManager::QueueEquipCommand | ( | gemNPCActor * | entity, |
| csString | item, | ||
| csString | slot, | ||
| int | count | ||
| ) |
Send a command to equip an equipment.
| void NetworkManager::QueueLootCommand | ( | gemNPCActor * | entity, |
| EID | targetEID, | ||
| const csString & | type | ||
| ) |
Send a command to loot selected target.
| void NetworkManager::QueuePickupCommand | ( | gemNPCActor * | entity, |
| gemNPCObject * | item, | ||
| int | count | ||
| ) |
Queue a command to pickup a item.
| entity | The entity that should pick up a item. |
| item | The item to pick up. |
| count | The number of items to pick up of a stack. |
| void NetworkManager::QueueResurrectCommand | ( | csVector3 | where, |
| float | rot, | ||
| iSector * | sector, | ||
| PID | character_id | ||
| ) |
Send a command to resurrect.
| void NetworkManager::QueueScriptCommand | ( | gemNPCActor * | npc, |
| gemNPCObject * | target, | ||
| const csString & | scriptName | ||
| ) |
Send a script command to server.
| npc | The npc that sit/stand |
| target | The current target of then npc |
| scriptName | The name of the progression script to run at server |
Send a command to start a sequence.
| void NetworkManager::QueueSitCommand | ( | gemNPCActor * | npc, |
| gemNPCObject * | target, | ||
| bool | sit | ||
| ) |
Send a sit command to server.
| npc | The npc that sit/stand |
| target | The current target of then npc |
| sit | True if sitting, false if standing |
| void NetworkManager::QueueSpawnBuildingCommand | ( | gemNPCActor * | spawner, |
| csVector3 | where, | ||
| iSector * | sector, | ||
| const char * | buildingName, | ||
| int | tribeID, | ||
| bool | pickupable | ||
| ) |
Send a spawn building command to server.
| spawner | The entity that spawned the building |
| where | Containing the desired location |
| sector | The sector in which we want a spawn. |
| buildingName | The name of the building. Or more exactly... of the mesh for it. |
| tribeID | The owner of this building |
| pickupable | Should the building be possible to pick up |
| void NetworkManager::QueueSpawnCommand | ( | gemNPCActor * | mother, |
| gemNPCActor * | father, | ||
| const csString & | tribeMemberType | ||
| ) |
Send a spawn command to server.
| mother | The mother of the spawn |
| father | If the father is known point to the father, use mother if unknow. |
| tribeMemberType | What type of tribe member is this. |
| void NetworkManager::QueueSystemInfoCommand | ( | uint32_t | clientNum, |
| const char * | reply, | ||
| ... | |||
| ) |
Send an system info command to the client.
| clientNum | The client that should receive the system info. |
| reply | The reply to send back. |
| void NetworkManager::QueueTalkCommand | ( | gemNPCActor * | speaker, |
| gemNPCActor * | target, | ||
| psNPCCommandsMessage::PerceptionTalkType | talkType, | ||
| bool | publicTalk, | ||
| const char * | text | ||
| ) |
Queue a talk command to the server.
The speaker will send a talk event say/action to target or nearby targets.
| speaker | The npc that speaks. |
| target | The current target. |
| talkType | What kind of talk is this. |
| publicTalk | True if this should be published. False will be a wisper. |
| text | The text to talk. |
| void NetworkManager::QueueTemporarilyImperviousCommand | ( | gemNPCActor * | entity, |
| bool | impervious | ||
| ) |
Send a command to change the temporarily impervious status.
'
| entity | The entity to change. |
| impervious | Set to true if temporarily impervious should be turned on. |
| void NetworkManager::QueueTransferCommand | ( | gemNPCActor * | entity, |
| csString | item, | ||
| int | count, | ||
| csString | target | ||
| ) |
Send a command to transfere an item between two entities.
| void NetworkManager::QueueUnbuildCommand | ( | gemNPCActor * | unbuilder, |
| gemNPCItem * | building | ||
| ) |
Send a unbuild command to server.
| unbuilder | The entity that unbuild the building |
| building | The building. |
| void NetworkManager::QueueVisibilityCommand | ( | gemNPCActor * | entity, |
| bool | status | ||
| ) |
Queue a change in visibility.
| entity | The entity to change visibility. |
| status | The new visibility status. True or False. |
| void NetworkManager::QueueWorkCommand | ( | gemNPCActor * | entity, |
| const csString & | type, | ||
| const csString & | resource | ||
| ) |
Send a command to start working.
| void NetworkManager::ReAuthenticate | ( | ) |
Reauthenicate with the server.
| void NetworkManager::ReConnect | ( | ) |
Reconnect to the server server.
|
protected |
Number of command messages queued.
| void NetworkManager::SendAllCommands | ( | bool | final = false | ) |
Send the queued commands.
| final | True if this is the final. And a forced sending should be done. |
| void NetworkManager::SendConsoleCommand | ( | const char * | cmd | ) |
Send a console command.
| cmd | The command to send. |
|
protected |
Entities queued for sending of DR.
Definition at line 67 of file networkmgr.h.
|
protected |
Definition at line 66 of file networkmgr.h.
|
protected |
Definition at line 62 of file networkmgr.h.
|
protected |
Definition at line 60 of file networkmgr.h.
|
protected |
Definition at line 204 of file networkmgr.h.
|
protected |
Definition at line 59 of file networkmgr.h.
|
protected |
Definition at line 65 of file networkmgr.h.
|
protected |
Definition at line 204 of file networkmgr.h.
|
protected |
Definition at line 205 of file networkmgr.h.
|
protected |
Definition at line 61 of file networkmgr.h.
| bool NetworkManager::reconnect |
Set to true if reconnect should be done.
Definition at line 510 of file networkmgr.h.
|
protected |
Definition at line 204 of file networkmgr.h.