Merge commit 'origin/master' into 320

Conflicts:
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-07-11 07:55:53 +04:00
commit 153410971d
24 changed files with 735 additions and 180 deletions

View file

@ -138,7 +138,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
if (player_dead.own_team_flag > 1)
{
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong boolean value1 (%u).",
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) have wrong boolean value1 (%u).",
criteria->ID, criteria->requiredType,dataType,player_dead.own_team_flag);
return false;
}

View file

@ -187,7 +187,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
if(f)
{
char buf[100];
snprintf(buf,100," (exist, but have %d fields instead %d) Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
snprintf(buf,100," (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
errlist.push_back(dbc_filename + buf);
fclose(f);
}

View file

@ -504,7 +504,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: %u)",internal_event_id,mGameEventCreatureGuids.size());
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
}
@ -537,7 +537,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: %u)",internal_event_id,mGameEventGameobjectGuids.size());
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
}
@ -571,7 +571,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: %u)",internal_event_id,mGameEventPoolIds.size());
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
}
@ -587,7 +587,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if(internal_event_id < 0 || internal_event_id >= mGameEventCreatureGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: %u)",internal_event_id,mGameEventCreatureGuids.size());
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventCreatureGuids.size());
return;
}
@ -605,7 +605,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if(internal_event_id < 0 || internal_event_id >= mGameEventGameobjectGuids.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: %u)",internal_event_id,mGameEventGameobjectGuids.size());
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventGameobjectGuids.size());
return;
}
@ -622,7 +622,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
}
if(internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size())
{
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: %u)",internal_event_id,mGameEventPoolIds.size());
sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size());
return;
}

View file

@ -80,7 +80,7 @@ void GameObject::CleanupsBeforeDelete()
owner->RemoveGameObject(this,false);
else
{
char * ownerType = "creature";
const char * ownerType = "creature";
if(IS_PLAYER_GUID(owner_guid))
ownerType = "player";
else if(IS_PET_GUID(owner_guid))

View file

@ -44,7 +44,7 @@ class Player;
#define MAX_NUMBER_OF_CELLS 4
#define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
#define CENTER_GRID_CELL_ID 128
#define CENTER_GRID_CELL_ID (MAX_NUMBER_OF_CELLS*MAX_NUMBER_OF_GRIDS/2)
#define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
#define TOTAL_NUMBER_OF_CELLS_PER_MAP (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)

View file

@ -281,7 +281,7 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
std::string name = m_ranks[i].name;
uint32 rights = m_ranks[i].rights;
CharacterDatabase.escape_string(name);
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", GuildId, i+1, name.c_str(), rights);
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", GuildId, uint32(i+1), name.c_str(), rights);
}
CharacterDatabase.CommitTransaction();
}
@ -1991,4 +1991,4 @@ bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const
return true;
return false;
}
}

View file

@ -29,6 +29,15 @@
#include "Language.h"
#include "DBCStores.h"
enum MailShowFlags
{
MAIL_SHOW_UNK0 = 0x0001,
MAIL_SHOW_DELETE = 0x0002, // forced show delete button instead return button
MAIL_SHOW_AUCTION = 0x0004, // from old comment
MAIL_SHOW_COD = 0x0008, // show subject prefix
MAIL_SHOW_UNK4 = 0x0010,
};
void MailItem::deleteItem( bool inDB )
{
if(item)
@ -601,6 +610,14 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
if(data.wpos()+next_mail_size > maxPacketSize)
break;
uint32 show_flags = 0;
if ((*itr)->messageType != MAIL_NORMAL)
show_flags |= MAIL_SHOW_DELETE;
if ((*itr)->messageType == MAIL_AUCTION)
show_flags |= MAIL_SHOW_AUCTION;
if ((*itr)->COD)
show_flags |= MAIL_SHOW_COD;
data << (uint16) 0x0040; // unknown 2.3.0, different values
data << (uint32) (*itr)->messageID; // Message ID
data << (uint8) (*itr)->messageType; // Message Type
@ -624,7 +641,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
data << (uint32) 0; // unknown
data << (uint32) (*itr)->stationery; // stationery (Stationery.dbc)
data << (uint32) (*itr)->money; // Gold
data << (uint32) 0x04; // unknown, 0x4 - auction, 0x10 - normal
data << (uint32) show_flags; // unknown, 0x4 - auction, 0x10 - normal
// Time
data << (float) ((*itr)->expire_time-time(NULL))/DAY;
data << (uint32) (*itr)->mailTemplateId; // mail template (MailTemplate.dbc)

View file

@ -227,7 +227,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if(recv_data.size() != recv_data.rpos())
{
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is %u bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
KickPlayer();
return;
}

View file

@ -572,6 +572,7 @@ class ObjectMgr
uint32 GeneratePetNumber();
uint32 CreateItemText(std::string text);
void AddItemText(uint32 itemTextId, std::string text) { mItemTexts[itemTextId] = text; }
std::string GetItemText( uint32 id )
{
ItemTextMap::const_iterator itr = mItemTexts.find( id );

View file

@ -1496,7 +1496,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
uint32 enchants = GetUInt32ValueFromArray(data, visualbase + 1);
for(uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot)
{
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantSlot >> enchantSlot*16))
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchants >> enchantSlot*16))
break;
}
@ -6667,7 +6667,8 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
}
// Add armor bonus from ArmorDamageModifier if > 0
if (proto->ArmorDamageModifier > 0)
armor+=proto->ArmorDamageModifier;
armor += uint32(proto->ArmorDamageModifier);
if (armor)
HandleStatModifier(UNIT_MOD_ARMOR, BASE_VALUE, float(armor), apply);

View file

@ -302,19 +302,19 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
// collect guids
switch ( type )
{
case DTT_INVENTORY:
StoreGUID(result,3,items); break; // item guid collection
case DTT_ITEM:
StoreGUID(result,0,ITEM_FIELD_ITEM_TEXT_ID,texts); break;
// item text id collection
case DTT_PET:
StoreGUID(result,0,pets); break; // pet guid collection
case DTT_MAIL:
StoreGUID(result,0,mails); // mail id collection
StoreGUID(result,6,texts); break; // item text id collection
case DTT_MAIL_ITEM:
StoreGUID(result,1,items); break; // item guid collection
default: break;
case DTT_INVENTORY:
StoreGUID(result,3,items); break; // item guid collection
case DTT_ITEM:
StoreGUID(result,0,ITEM_FIELD_ITEM_TEXT_ID,texts); break;
// item text id collection
case DTT_PET:
StoreGUID(result,0,pets); break; // pet guid collection
case DTT_MAIL:
StoreGUID(result,0,mails); // mail id collection
StoreGUID(result,7,texts); break; // item text id collection
case DTT_MAIL_ITEM:
StoreGUID(result,1,items); break; // item guid collection
default: break;
}
dump += CreateDumpString(tableTo, result);
@ -452,6 +452,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
std::map<uint32,uint32> items;
std::map<uint32,uint32> mails;
std::map<uint32,uint32> itemTexts;
char buf[32000] = "";
typedef std::map<uint32, uint32> PetIds; // old->new petid relation
@ -546,8 +547,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (result)
{
delete result;
// rename on login: `at_login` field 30 in raw field list
if(!changenth(line, 30, "1"))
if(!changenth(line, 37, "1")) // rename on login: `at_login` field 37 in raw field list
ROLLBACK(DUMP_FILE_BROKEN);
}
}
@ -580,6 +581,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
ROLLBACK(DUMP_FILE_BROKEN);
if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changetokGuid(vals, ITEM_FIELD_ITEM_TEXT_ID+1, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 3, vals.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
break;
@ -637,10 +640,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
}
case DTT_MAIL: // mail
{
// id,messageType,stationery,sender,receiver
// id,messageType,stationery,mailtemplate,sender,receiver,subject,itemText
if(!changeGuid(line, 1, mails, objmgr.m_mailid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 5, newguid))
if(!changenth(line, 6, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changeGuid(line, 8, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
@ -655,6 +660,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_ITEM_TEXT: // item_text
{
// id
if(!changeGuid(line, 1, itemTexts, objmgr.m_ItemTextId))
ROLLBACK(DUMP_FILE_BROKEN);
// add it to cache
uint32 id= atoi(getnth(line,1).c_str());
std::string text = getnth(line,2);
objmgr.AddItemText(id,text);
break;
}
default:
sLog.outError("Unknown dump table type: %u",type);
break;
@ -668,6 +685,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
objmgr.m_hiItemGuid += items.size();
objmgr.m_mailid += mails.size();
objmgr.m_ItemTextId += itemTexts.size();
if(incHighest)
++objmgr.m_hiCharGuid;

View file

@ -29,7 +29,7 @@ class TemporarySummon : public Creature
virtual ~TemporarySummon(){};
void Update(uint32 time);
void Summon(TempSummonType type, uint32 lifetime);
void UnSummon();
void MANGOS_DLL_SPEC UnSummon();
void SaveToDB();
Unit* GetSummoner() const { return m_summoner ? ObjectAccessor::GetUnit(*this, m_summoner) : NULL; }
private:

View file

@ -5408,7 +5408,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (dummySpell->SpellFamilyFlags & UI64LIT(0x4000000000000))
{
uint32 maxmana = GetMaxPower(POWER_MANA);
basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f;
basepoints0 = int32(maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f);
target = this;
triggered_spell_id = 34075;

View file

@ -78,7 +78,7 @@ WorldSession::~WorldSession()
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
{
sLog.outError("Client (account %u) send packet %s (%u) with size %u but expected %u (attempt crash server?), skipped",
sLog.outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt crash server?), skipped",
GetAccountId(),LookupOpcodeName(packet.GetOpcode()),packet.GetOpcode(),packet.size(),size);
}

View file

@ -555,13 +555,13 @@ bool ChatHandler::HandleDebugGetItemState(const char* args)
if (item->GetOwnerGUID() != player->GetGUID())
{
PSendSysMessage("queue(%d): for the an item (guid %d), the owner's guid (%d) and player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the owner's guid (%d) and player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
error = true; continue;
}
if (item->GetQueuePos() != i)
{
PSendSysMessage("queue(%d): for the an item (guid %d), the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow());
PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow());
error = true; continue;
}
@ -570,13 +570,13 @@ bool ChatHandler::HandleDebugGetItemState(const char* args)
if (test == NULL)
{
PSendSysMessage("queue(%d): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have an item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow());
PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have an item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow());
error = true; continue;
}
if (test != item)
{
PSendSysMessage("queue(%d): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the item with guid %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the item with guid %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
error = true; continue;
}
}

View file

@ -146,6 +146,8 @@
#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER
#define SI64LIT(N) ACE_INT64_LITERAL(N)
#define SIZEFMTD ACE_SIZE_T_FORMAT_SPECIFIER
inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; }
#define atol(a) strtoul( a, NULL, 10)

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "ProgressBar.h"
char const* const barGoLink::empty = " ";

View file

@ -18,7 +18,6 @@
#ifndef MANGOSSERVER_PROGRESSBAR_H
#define MANGOSSERVER_PROGRESSBAR_H
#include <stdio.h>
#include "Platform/Define.h"
class MANGOS_DLL_SPEC barGoLink

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8147"
#define REVISION_NR "8159"
#endif // __REVISION_NR_H__