This commit is contained in:
tomrus88 2009-08-10 10:35:21 +04:00
parent 9a18da03a6
commit 027ea38d54
2 changed files with 91 additions and 91 deletions

View file

@ -168,13 +168,15 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
delete result;
}
}
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
if (mails_count > 100)
{
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
return;
}
// test the receiver's Faction...
// check the receiver's Faction...
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && GetSecurity() == SEC_PLAYER)
{
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
@ -582,11 +584,9 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
Player* pl = _player;
// load players mails, and mailed items
if(!pl->m_mailsLoaded)
pl ->_LoadMail();
if(!_player->m_mailsLoaded)
_player->_LoadMail();
// client can't work with packets > max int16 value
const uint32 maxPacketSize = 32767;
@ -599,7 +599,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
data << uint8(0); // mail's count
time_t cur_time = time(NULL);
for(PlayerMails::iterator itr = pl->GetmailBegin(); itr != pl->GetmailEnd(); ++itr)
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
// skip deleted or not delivered (deliver delay not expired) mails
if ((*itr)->state == MAIL_STATE_DELETED || cur_time < (*itr)->deliver_time)
@ -656,7 +656,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
for(uint8 i = 0; i < item_count; ++i)
{
Item *item = pl->GetMItem((*itr)->items[i].item_guid);
Item *item = _player->GetMItem((*itr)->items[i].item_guid);
// item index (0-6?)
data << uint8(i);
// item guid low?
@ -784,12 +784,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ )
if( _player->unReadMails > 0 )
{
data << (uint32) 0; // float
data << (uint32) 0; // count
data << uint32(0); // float
data << uint32(0); // count
uint32 count = 0;
time_t now = time(NULL);
for(PlayerMails::iterator itr = _player->GetmailBegin(); itr != _player->GetmailEnd(); ++itr)
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
Mail *m = (*itr);
// must be not checked yet
@ -800,22 +800,23 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ )
if(now < m->deliver_time)
continue;
data << (uint64) m->sender; // sender guid
data << uint64(m->sender); // sender guid
switch(m->messageType)
{
case MAIL_AUCTION:
data << (uint32) 2;
data << (uint32) 2;
data << (uint32) m->stationery;
data << uint32(2);
data << uint32(2);
data << uint32(m->stationery);
break;
default:
data << (uint32) 0;
data << (uint32) 0;
data << (uint32) m->stationery;
data << uint32(0);
data << uint32(0);
data << uint32(m->stationery);
break;
}
data << (uint32) 0xC6000000; // float unk, time or something
data << uint32(0xC6000000); // float unk, time or something
++count;
if(count == 2) // do not display more than 2 mails
@ -825,8 +826,8 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ )
}
else
{
data << (uint32) 0xC7A8C000;
data << (uint32) 0x00000000;
data << uint32(0xC7A8C000);
data << uint32(0x00000000);
}
SendPacket(&data);
}

View file

@ -1050,8 +1050,8 @@ class MANGOS_DLL_SPEC Player : public Unit
bool ToggleAFK();
bool ToggleDND();
bool isAFK() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_AFK); };
bool isDND() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_DND); };
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
uint8 chatTag() const;
std::string afkMsg;
std::string dndMsg;
@ -1089,8 +1089,8 @@ class MANGOS_DLL_SPEC Player : public Unit
time_t m_logintime;
time_t m_Last_tick;
uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; };
uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; };
uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; }
uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; }
void setDeathState(DeathState s); // overwrite Unit::setDeathState
@ -1101,21 +1101,21 @@ class MANGOS_DLL_SPEC Player : public Unit
inn_pos_y = y;
inn_pos_z = z;
time_inn_enter = time;
};
}
float GetRestBonus() const { return m_rest_bonus; };
float GetRestBonus() const { return m_rest_bonus; }
void SetRestBonus(float rest_bonus_new);
RestType GetRestType() const { return rest_type; };
void SetRestType(RestType n_r_type) { rest_type = n_r_type; };
RestType GetRestType() const { return rest_type; }
void SetRestType(RestType n_r_type) { rest_type = n_r_type; }
uint32 GetInnPosMapId() const { return inn_pos_mapid; };
float GetInnPosX() const { return inn_pos_x; };
float GetInnPosY() const { return inn_pos_y; };
float GetInnPosZ() const { return inn_pos_z; };
uint32 GetInnPosMapId() const { return inn_pos_mapid; }
float GetInnPosX() const { return inn_pos_x; }
float GetInnPosY() const { return inn_pos_y; }
float GetInnPosZ() const { return inn_pos_z; }
int GetTimeInnEnter() const { return time_inn_enter; };
void UpdateInnerTime (int time) { time_inn_enter = time; };
int GetTimeInnEnter() const { return time_inn_enter; }
void UpdateInnerTime (int time) { time_inn_enter = time; }
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
void RemoveMiniPet();
@ -1371,12 +1371,12 @@ class MANGOS_DLL_SPEC Player : public Unit
void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count );
void SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count );
uint64 GetDivider() { return m_divider; };
void SetDivider( uint64 guid ) { m_divider = guid; };
uint64 GetDivider() { return m_divider; }
void SetDivider( uint64 guid ) { m_divider = guid; }
uint32 GetInGameTime() { return m_ingametime; };
uint32 GetInGameTime() { return m_ingametime; }
void SetInGameTime( uint32 time ) { m_ingametime = time; };
void SetInGameTime( uint32 time ) { m_ingametime = time; }
void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); }
@ -1462,15 +1462,14 @@ class MANGOS_DLL_SPEC Player : public Unit
void AddNewMailDeliverTime(time_t deliver_time);
bool IsMailsLoaded() const { return m_mailsLoaded; }
//void SetMail(Mail *m);
void RemoveMail(uint32 id);
void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo
uint32 GetMailSize() { return m_mail.size();};
uint32 GetMailSize() { return m_mail.size(); }
Mail* GetMail(uint32 id);
PlayerMails::iterator GetmailBegin() { return m_mail.begin();};
PlayerMails::iterator GetmailEnd() { return m_mail.end();};
PlayerMails::iterator GetMailBegin() { return m_mail.begin();}
PlayerMails::iterator GetMailEnd() { return m_mail.end();}
/*********************************************************/
/*** MAILED ITEMS SYSTEM ***/
@ -1600,7 +1599,7 @@ class MANGOS_DLL_SPEC Player : public Unit
m_resurrectZ = Z;
m_resurrectHealth = health;
m_resurrectMana = mana;
};
}
void clearResurrectRequestData() { setResurrectRequestData(0,0,0.0f,0.0f,0.0f,0,0); }
bool isRessurectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; }
bool isRessurectRequested() const { return m_resurrectGUID != 0; }
@ -2058,8 +2057,8 @@ class MANGOS_DLL_SPEC Player : public Unit
bool isRested() const { return GetRestTime() >= 10*IN_MILISECONDS; }
uint32 GetXPRestBonus(uint32 xp);
uint32 GetRestTime() const { return m_restTime;};
void SetRestTime(uint32 v) { m_restTime = v;};
uint32 GetRestTime() const { return m_restTime; }
void SetRestTime(uint32 v) { m_restTime = v; }
/*********************************************************/
/*** ENVIROMENTAL SYSTEM ***/