//活动日期(星期)
int week_day_limit = 0;
for(int i=0;i<ac;i++)
{
week_day_limit |= 1 << (atoi(av[i])-1);
}
item.start.weekday = week_day_limit;
item.end.weekday = week_day_limit;
void GetWanfaTonggaoTime(SWanfaTime &start, SWanfaTime &tonggao, int beforeMinute)
{
int totalMin = start.hour * 60 + start.minute;
if(totalMin >= beforeMinute)
{
tonggao.hour = (totalMin - beforeMinute) / 60;
tonggao.minute = (totalMin - beforeMinute) % 60;
tonggao.weekday = start.weekday;
}
else
{
tonggao.hour = (totalMin + 24 * 60 - beforeMinute) / 60;
tonggao.minute = (totalMin + 24 * 60 - beforeMinute) % 60;
tonggao.weekday = ((start.weekday >> 1) | ((start.weekday & 0x1) << 6));
}
}
//让玩家获得距自己等级
const int itemAward[][4] = {
{30,851,2,5},{30,2370,2,5},{30,506,2,5},
{35,613,2,5},{35,614,2,5},{43,610,2,5},
{43,611,1,5},{46,2310,2,5},{52,2251,1,5}
}; //等级,道具id,道具数量,权重
int r = Random(1,100);
int sum = 0;
for(uint8 k=0;k < sizeof(itemAward)/sizeof(itemAward[0]);k++)
{
if(level < itemAward[k][0])
break;
sum += itemAward[k][3];
if(r <= sum)
{
pHots[i]->AddBangDingPackage(itemAward[k][1],itemAward[k][2]);
char temp[64];
snprintf(temp,sizeof(temp),LANGUAGE_TRANSFORM_531,GetItemName(itemAward[k][1]),itemAward[k][2]);
strcat(buf,temp);
break;
}
}
//boost 绑定方法
CNetMessage sysMsg;
sysMsg.SetType(PRO_SYSTEM_INFO);
sysMsg<<msg;
CSocketServer &sock = SingletonSocket::instance();
SingletonOnlineUser::instance().ForEachUser(boost::bind(SendNianShouInfo,&sock,&sysMsg,_1, min_level));
void COnlineUser::ForEachUser(boost::function<void(CUser*)> f)
{
boost::recursive_mutex::scoped_lock lk(m_mutex);
m_roleIdList.ForEach(boost::bind(EachUser,_1,_2,&f));
}
static bool EachUser(uint32,ShareUserPtr pUser,boost::function<void(CUser*)> *f)
{
CUser *p = pUser.get();
if(p != NULL)
{
(*f)(p);
}
return true;
}
static void SendNianShouInfo(CSocketServer *pSock,CNetMessage *pMsg,CUser *pUser, int wanfa_min_level = 0)
{
if(pUser->GetLevel() >= wanfa_min_level)
{
pSock->SendMsg(pUser->GetSock(),*pMsg);
}
}
pFight->SetCallback(boost::bind(&CFishManager::GrabFishFightEnd,this,_1,_2,_3));
typedef boost::function<void(CUser*,bool,CFight*)> FightEndCallback;
void SetCallback(FightEndCallback fun)
{
m_cbfun=fun;
}
void CFishManager::GrabFishFightEnd(CUser *pUser,bool win,CFight *pFight)
void CFight::SpecialFightEnd()
{
CUser *pUser = GetUser(GROUP2_MAIN_POS);
bool win=false;
if(m_fightRes==1)
win = true;
if(m_cbfun)
{
m_cbfun(pUser,win,this);
}