bool SceneUser::doArenaCmd(const Cmd::stArenaUserCmd *ptCmd, DWORD cmdLen) { using namespace Cmd; switch(ptCmd->byParam) { case SURPLUS_MOSAIGEM_USERCMD_ADD: { stArenaQueuingUserCmd * pCmd = (stArenaQueuingUserCmd*)ptCmd; switch(pCmd->Type) { case 0: //sky 用户单人排队 { if(pCmd->UserID == this->tempid) { Cmd::Session::t_Sports_AddMeToQueuing Cmd; Cmd.AddMeType = pCmd->AddMeType; Cmd.UserID = this->id; Cmd.Type = pCmd->Type; sessionClient->sendCmd(&Cmd, sizeof(Cmd::Session::t_Sports_AddMeToQueuing)); } } break; case 1: //sky 队伍排队形式 { TeamManager * teamM = SceneManager::getInstance().GetMapTeam(TeamThisID); if(teamM) { //sky 必须自己是队长才可以队排战场 if(this->tempid == teamM->getLeader()) { Cmd::Session::t_Sports_AddMeToQueuing Cmd; Cmd.AddMeType = pCmd->AddMeType; Cmd.Type = pCmd->Type; Cmd.UserID = teamM->getTeamtempId(); sessionClient->sendCmd(&Cmd, sizeof(Cmd::Session::t_Sports_AddMeToQueuing)); } } } break; default: break; } } break; default: break; } return true; }
/** * \brief 构造初始化消息实例 * \param u 队长角色对象 * \param n 新增队员角色对象 */ SendMemberDataExec(SceneUser *n, DWORD leaberID) { LeaberID = leaberID; nm = n; TeamManager * team = SceneManager::getInstance().GetMapTeam(nm->TeamThisID); if(team) { ret_1.dwTeamID = team->getTeamtempId(); //getLeader(); ret_1.dwHeadID = team->getLeader(); } else { ret_1.dwTeamID = 0; ret_1.dwHeadID = 0; } }
/** * \brief 回调方法将新成员发送给每个队员,将每个队员发送给新成员 * \param member 队员 * \return false 终止遍历 true 继续遍历 */ bool exec(TeamMember &member) { if(member.tempid == MEMBER_BEING_OFF) return true; SceneUser *pUser = SceneUserManager::getMe(). getUserByTempID(member.tempid); if (pUser) { TeamManager * team = SceneManager::getInstance().GetMapTeam(pUser->TeamThisID); ret_1.dwTeamID = team->getTeamtempId(); //getLeader(); ret_1.dwHeadID = team->getLeader(); strncpy(ret_1.data.pstrName,pUser->name,MAX_NAMESIZE); if (LeaberID == pUser->tempid) { ret_1.data.byHead = true; } else { ret_1.data.byHead = false; } ret_1.data.dwTempID = pUser->tempid; ret_1.data.dwMaxHealth = pUser->charstate.maxhp; ret_1.data.dwHealth = pUser->charbase.hp; ret_1.data.dwMaxMp = pUser->charstate.maxmp; ret_1.data.dwMp = pUser->charbase.mp; ret_1.data.wdFace = pUser->charbase.face; strncpy(ret_1.data.pstrName,pUser->name,MAX_NAMESIZE); pUser->sendCmdToMe(&ret_2,sizeof(ret_2)); Channel::sendSys(pUser,Cmd::INFO_TYPE_GAME,"%s加入队伍",ret_2.data.pstrName); nm->sendCmdToMe(&ret_1,sizeof(ret_1)); //Xlogger->debug("队伍(%ld)发出添加队员指令(%s,%ld)",ret_2.dwTeamID,nm->name,nm->id); return true; } return true; }