//付款收信 void CMailManager::PayMoneyMail(CMail *pMail,CPlayer *pPlayer) { char strSysMsg[128]; if (pPlayer==NULL || pMail->GetGold()==0) return; _snprintf(strSysMsg, 128, CStringReading::LoadString(IDS_WGS_SYSMAIL,STR_WS_SYSMAIL_SIXTH)); long lPayGold = pMail->GetGold(); string strReceiver; string strSubject = strSysMsg; strReceiver = pMail->GetWriter(); tagMailParam *ptgMailParam = OBJ_CREATE(tagMailParam); ptgMailParam->lType = SENDGOLD_MAIL; ptgMailParam->lGold = lPayGold; ptgMailParam->strWriter = pPlayer->GetName(); ptgMailParam->strReceiverList.push_back(strReceiver); ptgMailParam->WriterGuid = pPlayer->GetExID(); ptgMailParam->strSubject=strSubject; CMail *pPayMail = MP_NEW CMail(ptgMailParam); if(AddMail(pPayMail,pPlayer)) { pMail->SetGold(0); if (pMail->GetMGoodsContainer().size()>0) { pMail->SetType(AFFIX_MAIL); } else { pMail->SetType(COMMON_MAIL); } SendPayMailMsg(pMail->GetExID(),BYTE(AFFIX_MAIL),pPlayer); CMessage msg(MSG_S2W_MAIL_PAY); msg.Add(pMail->GetExID()); msg.Send(); } }
void CMailView::CreateDemo(BOOL bRedraw/* = TRUE*/) { CBCGPReportCtrl* pReportCtrl = GetReportCtrl (); ASSERT_VALID (pReportCtrl); pReportCtrl->RemoveAll (); #define NAMES_NUM 7 LPCTSTR arNames [NAMES_NUM] = { _T("John Smith"), _T("Support Team"), _T("Peter Brown"), _T("Matt Johnson"), _T("James Lee"), _T("Customer Service"), _T("Webmaster"), }; #define SUBJ_NUM 8 LPCTSTR arSubjs [SUBJ_NUM] = { _T("Important information"), _T("Customer Newsletter"), _T("Question"), _T("Business proposal"), _T("Request more info about your products"), _T("Thank you!"), _T("Your application has been approved"), _T("Please read this message"), }; srand( (unsigned)time( NULL ) ); for (int i = 0; i < 100; i++) { COleDateTime now = COleDateTime::GetCurrentTime (); COleDateTimeSpan span ( Rand (5), Rand (23), Rand (59), 0); COleDateTimeSpan span2 ( 0, Rand (2), Rand (59), Rand (59)); AddMail (Rand (2), // Icon arNames [Rand (NAMES_NUM)], arNames [Rand (NAMES_NUM)], arSubjs [Rand (SUBJ_NUM)], now - span - span2, now - span, Rand (200), (IMPORTANCE) Rand (3), Rand (2), Rand (7)); } if (bRedraw) { pReportCtrl->AdjustLayout (); } }
//同意赠送 void CMailManager::AgreeToPresent(CMail *pMail,CPlayer *pPlayer,BYTE bType) { long lNum = 0;//计算元宝数量 if (pPlayer==NULL) return; if (bType==0) { if (CheckPresentGoods(pMail,pPlayer,lNum)) { //成功 CMessage msg(MSG_S2C_MAIL_PRESENT_OK); msg.Add(pMail->GetExID()); msg.Add(lNum); msg.SendToPlayer(pPlayer->GetExID()); } else { //存在过期道具 CMessage msg(MSG_S2C_MAIL_PRESENT_FAILED); msg.Add(pMail->GetExID()); msg.Add((long)pMail->GetSGood().size()); list<tagSGoods*>::iterator it=pMail->GetSGood().begin(); for (; it!=pMail->GetSGood().end();++it) { msg.Add((*it)->lIndex); msg.Add((*it)->lNum); } msg.SendToPlayer(pPlayer->GetExID()); } } else { CheckPresentGoods(pMail,pPlayer,lNum); if (lNum>pPlayer->GetYuanbao()) { char* strRes=CStringReading::LoadString(22,22); if(strRes) pPlayer->SendNotifyMessage(strRes); return; } char strSysMsg[128]; _snprintf(strSysMsg, 128, CStringReading::LoadString(IDS_WGS_SYSMAIL,STR_WS_SYSMAIL_SEVENTH),pMail->GetSubject().c_str()); tagMailParam *ptgMailParam = OBJ_CREATE(tagMailParam); CMail *pSendMail = MP_NEW CMail(ptgMailParam); string strReceiver = pMail->GetWriter(); pSendMail->SetExID(pMail->GetExID()); pSendMail->SetWriter(pPlayer->GetName()); pSendMail->SetReceiverList(strReceiver.c_str()); pSendMail->SetType(PRESENT_MAIL); pSendMail->SetSubject(strSysMsg); pSendMail->SetSGoods(pMail->GetSGood()); if(AddMail(pSendMail)) { list<CGUID> lGuid; lGuid.push_back(pMail->GetExID()); DeleteMailToWS(lGuid,pPlayer); } } }