Planeshift

usermanager.h

Go to the documentation of this file.
00001 /*
00002  * usermanager.h - Author: Keith Fulton
00003  *
00004  * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 
00026 #ifndef __USERMANAGER_H__
00027 #define __USERMANAGER_H__
00028 
00029 //=============================================================================
00030 // Crystal Space Includes
00031 //=============================================================================
00032 
00033 //=============================================================================
00034 // Project Includes
00035 //=============================================================================
00036 
00037 //=============================================================================
00038 // Local Includes
00039 //=============================================================================
00040 #include "msgmanager.h"             // Parent class
00041 
00043 // FORWARD DECLARATIONS
00045 class ClientConnectionSet;
00046 class PendingDuelInvite;
00047 class BankManager;
00048 class EntityManager;
00049 
00053 class UserManager : public MessageManager<UserManager>
00054 {
00055 public:
00056 
00057     UserManager(ClientConnectionSet* pCCS, CacheManager* cachemanager, BankManager* bankmanager, EntityManager* entitymanager);
00058     virtual ~UserManager();
00059 
00060     virtual bool Initialize(GEMSupervisor* gemsupervisor)
00061     {
00062         gem = gemsupervisor;
00063         return true;
00064     }
00065 
00074     void NotifyBuddies(Client* client, bool loggedon);
00075 
00084     void NotifyPlayerBuddies(Client* client, bool loggedon);
00085 
00092     void NotifyGuildBuddies(Client* client, bool loggedon);
00093 
00102     void NotifyAllianceBuddies(Client* client, bool loggedon);
00103 
00104     enum
00105     {
00106         LOGGED_OFF = 0,
00107         LOGGED_ON  = 1
00108     };
00109 
00119     void BuddyList(Client* client, int clientnum, bool filter);
00120 
00121     void UserStatRegeneration();
00122     void Ready();
00123 
00129     void AcceptDuel(PendingDuelInvite* invite);
00130 
00135     void CalculateComparativeDifference(psCharacter* myCharData, psCharacter* theirCharData,
00136                                         int &theirPhysicalLevel, int &theirMagicalLevel,
00137                                         int &physicalDiff, int &magicalDiff, int &overallLevelComparison);
00138 
00144     void SendCharacterDescription(Client* client, gemActor* actor, bool full, bool simple, const csString &requestor);
00145 
00146     void Attack(Stance stance, Client* client);
00147 
00148     void SendPlayerMoney(Client* client);
00149 
00150 
00157     void HandleLoot(psUserCmdMessage &msg, Client* client);
00158 
00165     bool CheckTargetLootable(gemActor* actor, Client* client);
00166 
00174     void Loot(Client* client);
00175 
00184     void LootMoney(gemActor* actor, Client* client);
00185 
00197     void LootItems(gemActor* actor, Client* client, csString categories = "all", uint8_t lootAction = 0);
00198 
00206     bool LoadEmotes(const char* xmlfile, iVFS* vfs);
00207 
00215     bool CheckForEmote(csString command, bool execute, gemActor* actor);
00216 
00225     void Emote(csString general, csString specific, csString animation, gemActor* actor);
00226 
00231     bool Animation(csString animation, gemActor* actor);
00232 
00238     void Mount(gemActor* rider, gemActor* mount);
00239 
00240 protected:
00249     void Who(psUserCmdMessage &msg, Client* client);
00250 
00251 
00262     bool WhoProcessClient(Client* curr, int guildId, csString* message, csString filter, bool check, unsigned* count);
00263 
00269     void StrToLowerCase(csString &str);
00270 
00279     void Buddy(psUserCmdMessage &msg,Client* client);
00280 
00281     enum
00282     {
00283         ALL_PLAYERS=0,
00284         PLAYER_BUDDIES=1
00285     };
00286 
00287 
00294     void RollDice(psUserCmdMessage &msg, Client* client);
00295 
00296 
00303     void ReportPosition(psUserCmdMessage &msg, Client* client);
00304 
00305 
00306     /*
00307      * Moves a player back to the default start point for their race.
00308      *
00309      * @param msg The incoming user command message.
00310      * @param client The client that request the command..
00311      *
00312     void MoveToSpawnPos(psUserCmdMessage& msg,Client *client,int clientnum); */
00313 
00320     void HandleUnstick(psUserCmdMessage &msg,Client* client);
00321 
00327     void LogStuck(Client* client);
00328 
00334     void StopAllCombat(Client* client);
00335 
00343     void HandleAttack(psUserCmdMessage &msg, Client* client);
00344 
00345 
00352     void HandleQueueAttack(psUserCmdMessage& msg, Client *client);
00353 
00359     void HandleStopAttack(psUserCmdMessage& msg,Client *client);
00360 
00361 
00368     void ChallengeToDuel(psUserCmdMessage &msg, Client* client);
00369 
00375     void YieldDuel(Client* client);
00376 
00383     void HandleYield(psUserCmdMessage &msg, Client* client);
00384 
00388     void StartTrading(psUserCmdMessage &msg, Client* client);
00389 
00393     void StopTrading(psUserCmdMessage &msg, Client* client);
00394 
00401     void HandleMarriage(psUserCmdMessage &msg,Client* client);
00402 
00408     void HandleQuests(Client* client);
00409 
00416     void HandleQuestsCommand(psUserCmdMessage &msg,Client* client);
00417 
00423     void HandleGMEvents(Client* client);
00424 
00431     void GiveTip(psUserCmdMessage &msg, Client* client);
00432 
00439     void GiveMOTD(psUserCmdMessage &msg, Client* client);
00440 
00447     void ShowNpcMenu(psUserCmdMessage &msg, Client* client);
00448 
00455     void HandleSit(psUserCmdMessage &msg, Client* client);
00456 
00463     void HandleAdminCommand(psUserCmdMessage &msg, Client* client);
00464 
00471     void HandleStand(psUserCmdMessage &msg, Client* client);
00472 
00479     void HandleDie(psUserCmdMessage &msg, Client* client);
00480 
00487     void HandleTraining(psUserCmdMessage &msg, Client* client);
00488 
00495     void HandleBanking(psUserCmdMessage &msg, Client* client);
00496 
00500     void HandlePickup(psUserCmdMessage &msg, Client* client);
00501 
00508     void Pickup(Client* client, csString target);
00509 
00516     void HandleMount(psUserCmdMessage &msg, Client* client);
00517 
00524     void HandleUnmount(psUserCmdMessage &msg, Client* client);
00525 
00529     void HandleGuard(psUserCmdMessage &msg, Client* client);
00530 
00541     void Guard(Client* client, gemObject* object, csString action);
00542 
00546     void HandleRotate(psUserCmdMessage &msg, Client* client);
00547 
00555     void Rotate(Client* client, gemObject* target, csString action);
00556 
00563     void HandleUse(Client* client, bool on);
00564 
00571     void Assist(psUserCmdMessage &msg, Client* client);
00572 
00579     void HandleMOTDRequest(MsgEntry* me,Client* client);
00580 
00584     void HandleUserCommand(MsgEntry* me,Client* client);
00585 
00589     void HandleCharDescUpdate(MsgEntry* me,Client* client);
00590 
00594     void HandleCharDetailsRequest(MsgEntry* me,Client* client);
00595 
00599     void HandleTargetEvent(MsgEntry* me,Client* client);
00600 
00604     void HandleEntranceMessage(MsgEntry* me, Client* client);
00605 
00609     void HandleClientReady(MsgEntry* me, Client* client);
00610 
00617     void HandleTakeAll(psUserCmdMessage &me, Client* client);
00618 
00625     void HandleTakeStackAll(psUserCmdMessage &me, Client* client);
00626 
00630     void SwitchAttackTarget(Client* targeter, Client* targeted);
00631     void HandleRename(psUserCmdMessage &msg, Client* client);
00632  
00633     void Rename(Client *client, csString *target, psItem *item);
00634 
00636     struct EMOTE
00637     {
00638         csString command;
00639         csString general;
00640         csString specific;
00641         csString anim;
00642     };
00643 
00644     csHash<EMOTE*, csString> emoteHash;
00645 
00646     ClientConnectionSet*     clients;
00647 
00649     typedef void (UserManager::*userCmdPointer)(psUserCmdMessage &msg, Client* client);
00651     csHash<userCmdPointer, csString> userCommandHash;
00652 
00653     CacheManager* cacheManager;
00654     GEMSupervisor* gem;
00655     BankManager* bankManager;
00656     EntityManager* entityManager;
00657 };
00658 
00659 #endif