From: Xordan <mg...@us...> - 2007-01-20 21:35:17
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6364 Modified Files: usermanager.cpp usermanager.h Log Message: - Small refactor of emotes. Added Emote function to process emotes, and changed /greet to use it. Index: usermanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/usermanager.cpp,v retrieving revision 1.282 retrieving revision 1.283 diff -C2 -d -r1.282 -r1.283 *** usermanager.cpp 20 Jan 2007 15:37:48 -0000 1.282 --- usermanager.cpp 20 Jan 2007 21:35:15 -0000 1.283 *************** *** 263,273 **** else if (msg.command == "/greet" ) { ! psSystemMessage newmsg(me->clientnum, MSG_INFO_BASE, "%s greets %s.", ! client->GetActor()->GetName(), ! (client->GetTargetObject())?client->GetTargetObject()->GetName():"everyone" ); ! newmsg.Multicast(client->GetActor()->GetMulticastClients(),0,CHAT_SAY_RANGE); ! ! psUserActionMessage anim(me->clientnum, client->GetActor()->GetEntity()->GetID(),"greet"); ! anim.Multicast( client->GetActor()->GetMulticastClients(),0,PROX_LIST_ANY_RANGE ); } else if (msg.command == "/sit" ) --- 263,267 ---- else if (msg.command == "/greet" ) { ! Emote("%s greets everyone.", "%s greets %s.", "greet", CHAT_SAY_RANGE, client->GetTargetObject(), me, client); } else if (msg.command == "/sit" ) *************** *** 379,382 **** --- 373,396 ---- } + void UserManager::Emote(csString general, csString specific, csString animation, int range, gemObject* target, MsgEntry *me, Client *client) + { + if (target) + { + psSystemMessage newmsg(me->clientnum, MSG_INFO_BASE, specific, client->GetActor()->GetName(), client->GetTargetObject()->GetName()); + newmsg.Multicast(client->GetActor()->GetMulticastClients(), 0, range); + } + else + { + psSystemMessage newmsg(me->clientnum, MSG_INFO_BASE, general, client->GetActor()->GetName()); + newmsg.Multicast(client->GetActor()->GetMulticastClients(), 0, range); + } + + if (animation != "noanim") + { + psUserActionMessage anim(me->clientnum, client->GetActor()->GetEntity()->GetID(), animation); + anim.Multicast(client->GetActor()->GetMulticastClients(), 0, PROX_LIST_ANY_RANGE); + } + } + void UserManager::HandleCharDetailsRequest(MsgEntry *me,Client *client) { Index: usermanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/usermanager.h,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** usermanager.h 21 Dec 2006 11:54:52 -0000 1.58 --- usermanager.h 20 Jan 2007 21:35:15 -0000 1.59 *************** *** 297,300 **** --- 297,310 ---- void StopDuel(Client *loser, Client *winner,bool award = true); + /** Process an emote command. + * + * @param general The phrase to broadcast if no target is selected. + * @param specific The phrase to broadcast if a target is selected. + * @param animation The animation for the emote. If there isn't one pass "noanim". + * @param range The range of the broadcast. + * @param target The target, if there is one. + */ + void Emote(csString general, csString specific, csString animation, int range, gemObject* target, MsgEntry *me, Client *client); + ClientConnectionSet *clients; // psDatabase *database; |