Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-11-06 11:25:35 +03:00
commit 5a0428c4f3
28 changed files with 247 additions and 133 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_8770_01_mangos_quest_template` bit(1) default NULL
`required_8777_02_mangos_gameobject` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -1062,6 +1062,8 @@ DROP TABLE IF EXISTS `creature_template`;
CREATE TABLE `creature_template` (
`entry` mediumint(8) unsigned NOT NULL default '0',
`difficulty_entry_1` mediumint(8) unsigned NOT NULL default '0',
`difficulty_entry_2` mediumint(8) unsigned NOT NULL default '0',
`difficulty_entry_3` mediumint(8) unsigned NOT NULL default '0',
`KillCredit1` int(11) unsigned NOT NULL default '0',
`KillCredit2` int(11) unsigned NOT NULL default '0',
`modelid_A` mediumint(8) unsigned NOT NULL default '0',

View file

@ -0,0 +1,6 @@
ALTER TABLE db_version CHANGE COLUMN required_8770_01_mangos_quest_template required_8775_01_mangos_creature_template bit;
ALTER TABLE `creature_template` ADD `difficulty_entry_2` MEDIUMINT(8) unsigned
NOT NULL default 0 AFTER `difficulty_entry_1`;
ALTER TABLE `creature_template` ADD `difficulty_entry_3` MEDIUMINT(8) unsigned
NOT NULL default 0 AFTER `difficulty_entry_2`;

View file

@ -0,0 +1,10 @@
ALTER TABLE db_version CHANGE COLUMN required_8775_01_mangos_creature_template required_8775_02_mangos_creature bit;
-- cause bgs now have different spawnmodes all creatures on those maps must go
-- to all spwanmodes.. maybe this isn't valid for all creatures - but i won't
-- destroy again all bgs :p
-- 0x1 = 2^0 - normal
-- 0x2 = 2^1 - difficulty_1
-- 0x4 = 2^2 - difficulty_2
-- 0x8 = 2^3 - difficulty_3
UPDATE creature SET spawnMask = (0x1 | 0x2 | 0x4 | 0x8) WHERE map IN (30, 489, 529, 566);

View file

@ -0,0 +1,6 @@
ALTER TABLE db_version CHANGE COLUMN required_8775_02_mangos_creature required_8775_03_mangos_gameobject bit;
-- cause bgs now have different spawnmodes all gameobjects on those maps must go
-- to all spwanmodes.. maybe this isn't valid for all gameobjects - but i won't
-- destroy again all bgs :p
UPDATE gameobject SET spawnMask = (0x1 | 0x2 | 0x4 | 0x8) WHERE map IN (30, 489, 529, 566);

View file

@ -0,0 +1,4 @@
ALTER TABLE db_version CHANGE COLUMN required_8775_03_mangos_gameobject required_8777_01_mangos_creature bit;
UPDATE creature SET spawnMask = 0x1 WHERE map IN (489, 529, 566);
UPDATE creature SET spawnMask = (0x1 | 0x2 | 0x4) WHERE map IN (30);

View file

@ -0,0 +1,4 @@
ALTER TABLE db_version CHANGE COLUMN required_8777_01_mangos_creature required_8777_02_mangos_gameobject bit;
UPDATE gameobject SET spawnMask = 0x1 WHERE map IN (489, 529, 566);
UPDATE gameobject SET spawnMask = (0x1 | 0x2 | 0x4) WHERE map IN (30);

View file

@ -148,6 +148,11 @@ pkgdata_DATA = \
8749_01_mangos_mail_loot_template.sql \
8769_01_mangos_mail_level_reward.sql \
8770_01_mangos_quest_template.sql \
8775_01_mangos_creature_template.sql \
8775_02_mangos_creature.sql \
8775_03_mangos_gameobject.sql \
8777_01_mangos_creature.sql \
8777_02_mangos_gameobject.sql \
README
## Additional files to include when running 'make dist'
@ -276,4 +281,9 @@ EXTRA_DIST = \
8749_01_mangos_mail_loot_template.sql \
8769_01_mangos_mail_level_reward.sql \
8770_01_mangos_quest_template.sql \
8775_01_mangos_creature_template.sql \
8775_02_mangos_creature.sql \
8775_03_mangos_gameobject.sql \
8777_01_mangos_creature.sql \
8777_02_mangos_gameobject.sql \
README

View file

@ -136,7 +136,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) >= 6)
{
if (m_stats.rating < 1000)
newmember.personal_rating = m_stats.rating;
newmember.personal_rating = 0;
else
newmember.personal_rating = 1000;
}
@ -513,8 +513,8 @@ float ArenaTeam::GetChanceAgainst(uint32 own_rating, uint32 enemy_rating)
// ELO system
if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) >= 6)
if (enemy_rating < 1500)
enemy_rating = 1500;
if (enemy_rating < 1000)
enemy_rating = 1000;
return 1.0f/(1.0f+exp(log(10.0f)*(float)((float)enemy_rating - (float)own_rating)/400.0f));
}
@ -542,8 +542,9 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating)
// called when the team has won
// 'chance' calculation - to beat the opponent
float chance = GetChanceAgainst(m_stats.rating, againstRating);
// calculate the rating modification (ELO system with k=32)
int32 mod = (int32)floor(32.0f * (1.0f - chance));
float K = (m_stats.rating < 1000) ? 48.0f : 32.0f;
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
int32 mod = (int32)floor(K* (1.0f - chance));
// modify the team stats accordingly
FinishGame(mod);
m_stats.wins_week += 1;
@ -558,8 +559,9 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating)
// called when the team has lost
//'chance' calculation - to loose to the opponent
float chance = GetChanceAgainst(m_stats.rating, againstRating);
// calculate the rating modification (ELO system with k=32)
int32 mod = (int32)ceil(32.0f * (0.0f - chance));
float K = (m_stats.rating < 1000) ? 48.0f : 32.0f;
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
int32 mod = (int32)floor(K* (1.0f - chance));
// modify the team stats accordingly
FinishGame(mod);
@ -576,7 +578,9 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)ceil(32.0f * (0.0f - chance));
float K = (m_stats.rating < 1000) ? 48.0f : 32.0f;
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
int32 mod = (int32)floor(K* (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal played stats
itr->games_week += 1;
@ -598,7 +602,9 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating)
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)ceil(32.0f * (0.0f - chance));
float K = (m_stats.rating < 1000) ? 48.0f : 32.0f;
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
int32 mod = (int32)floor(K* (1.0f - chance));
if (int32(itr->personal_rating) + mod < 0)
itr->personal_rating = 0;
else
@ -620,7 +626,9 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)floor(32.0f * (1.0f - chance));
float K = (m_stats.rating < 1000) ? 48.0f : 32.0f;
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
int32 mod = (int32)floor(K* (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week += 1;

View file

@ -492,11 +492,10 @@ class BattleGround
// can be extended in in BG subclass
/* event related */
// generic implementation in BattleGround-class
// called when a creature gets added to map (NOTE: only triggered if
// a player activates the cell of the creature)
virtual void OnObjectDBLoad(Creature* /*creature*/);
virtual void OnObjectDBLoad(GameObject* /*obj*/);
void OnObjectDBLoad(Creature* /*creature*/);
void OnObjectDBLoad(GameObject* /*obj*/);
// (de-)spawns creatures and gameobjects from an event
void SpawnEvent(uint8 event1, uint8 event2, bool spawn);
bool IsActiveEvent(uint8 event1, uint8 event2)
@ -510,9 +509,6 @@ class BattleGround
void OpenDoorEvent(uint8 event1, uint8 event2 = 0);
bool IsDoor(uint8 event1, uint8 event2);
/* other things */
virtual void OnCreatureRespawn(Creature* /*creature*/) {}
void HandleTriggerBuff(uint64 const& go_guid);
// TODO: make this protected:

View file

@ -232,23 +232,6 @@ void BattleGroundAV::UpdateScore(BattleGroundTeamId team, int32 points )
UpdateWorldState(((team == BG_TEAM_HORDE) ? BG_AV_Horde_Score : BG_AV_Alliance_Score), m_TeamScores[team]);
}
void BattleGroundAV::OnObjectDBLoad(Creature* creature)
{
uint32 level = creature->getLevel();
if (level != 0)
level += GetMaxLevel() - 60; // maybe we can do this more generic for custom level - range.. actually it's ok
creature->SetLevel(level);
BattleGround::OnObjectDBLoad(creature);
}
void BattleGroundAV::OnCreatureRespawn(Creature* creature)
{
uint32 level = creature->getLevel();
if (level != 0)
level += GetMaxLevel() - 60; // maybe we can do this more generic for custom level - range.. actually it's ok
creature->SetLevel(level);
}
void BattleGroundAV::Update(uint32 diff)
{
BattleGround::Update(diff);

View file

@ -308,8 +308,6 @@ class BattleGroundAV : public BattleGround
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
virtual void OnObjectDBLoad(Creature* creature);
virtual void OnCreatureRespawn(Creature* creature);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();

View file

@ -191,20 +191,24 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
// get difficulty 1 mode entry
uint32 actualEntry = Entry;
CreatureInfo const *cinfo = normalInfo;
if(normalInfo->DifficultyEntry1)
// TODO correctly implement spawnmodes for non-bg maps
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
{
//we already have valid Map pointer for current creature!
//FIXME: spawn modes 2-3 must have own case DifficultyEntryN
if(GetMap()->GetSpawnMode() > 0)
if (normalInfo->DifficultyEntry[diff])
{
cinfo = objmgr.GetCreatureTemplate(normalInfo->DifficultyEntry1);
if(!cinfo)
// we already have valid Map pointer for current creature!
if (GetMap()->GetSpawnMode() > diff)
{
sLog.outErrorDb("Creature::UpdateEntry creature difficulty 1 entry %u does not exist.", actualEntry);
cinfo = objmgr.GetCreatureTemplate(normalInfo->DifficultyEntry[diff]);
if (!cinfo)
{
// maybe check such things already at startup
sLog.outErrorDb("Creature::UpdateEntry creature difficulty %u entry %u does not exist.", diff + 1, actualEntry);
return false;
}
}
}
}
SetEntry(Entry); // normal entry always
m_creatureInfo = cinfo; // map mode related always
@ -362,9 +366,6 @@ void Creature::Update(uint32 diff)
else
setDeathState( JUST_ALIVED );
if (GetMap()->IsBattleGround() && ((BattleGroundMap*)GetMap())->GetBG())
((BattleGroundMap*)GetMap())->GetBG()->OnCreatureRespawn(this); // for alterac valley needed to adjust the correct level again
//Call AI respawn virtual function
i_AI->JustRespawned();
@ -1525,29 +1526,29 @@ float Creature::GetAttackDistance(Unit const* pl) const
void Creature::setDeathState(DeathState s)
{
if((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
{
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
// always save boss respawn time at death to prevent crash cheating
if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
if (sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
SaveRespawnTime();
if (canFly() && FallGround())
return;
if(!IsStopped())
if (!IsStopped())
StopMoving();
}
Unit::setDeathState(s);
if(s == JUST_DIED)
if (s == JUST_DIED)
{
SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if(!isPet() && GetCreatureInfo()->SkinLootId)
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
if (!isPet() && GetCreatureInfo()->SkinLootId)
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
if (canFly() && FallGround())
@ -1556,7 +1557,7 @@ void Creature::setDeathState(DeathState s)
SetNoSearchAssistance(false);
Unit::setDeathState(CORPSE);
}
if(s == JUST_ALIVED)
if (s == JUST_ALIVED)
{
SetHealth(GetMaxHealth());
SetLootRecipient(NULL);

View file

@ -158,7 +158,7 @@ enum CreatureFlagsExtra
struct CreatureInfo
{
uint32 Entry;
uint32 DifficultyEntry1;
uint32 DifficultyEntry[MAX_DIFFICULTY - 1];
uint32 KillCredit[MAX_KILL_CREDIT];
uint32 DisplayID_A[2];
uint32 DisplayID_H[2];

View file

@ -488,10 +488,8 @@ void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner)
GetZoneAndAreaId(zone,subzone);
// if subzone loot exist use it
if(LootTemplates_Fishing.HaveLootFor(subzone))
fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner,true);
// else use zone loot
else
if (!fishloot->FillLoot(subzone, LootTemplates_Fishing, loot_owner, true, true))
// else use zone loot (must exist in like case)
fishloot->FillLoot(zone, LootTemplates_Fishing, loot_owner,true);
}

View file

@ -386,18 +386,19 @@ void Loot::AddItem(LootStoreItem const & item)
}
// Calls processor of corresponding LootTemplate (which handles everything including references)
void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal)
bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError)
{
// Must be provided
if(!loot_owner)
return;
return false;
LootTemplate const* tab = store.GetLootFor(loot_id);
if (!tab)
{
if (!noEmptyError)
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.",store.GetName(),loot_id);
return;
return false;
}
items.reserve(MAX_NR_LOOT_ITEMS);
@ -416,6 +417,8 @@ void Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
// ... for personal loot
else
FillNotNormalLootFor(loot_owner);
return true;
}
void Loot::FillNotNormalLootFor(Player* pl)

View file

@ -287,7 +287,7 @@ struct Loot
void RemoveLooter(uint64 GUID) { PlayersLooting.erase(GUID); }
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount);
void FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal);
bool FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError = false);
// Inserts the item into the loot (called by LootTemplate processors)
void AddItem(LootStoreItem const & item);

View file

@ -270,11 +270,11 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
uint64 mailbox;
uint32 mailId;
recv_data >> mailbox;
recv_data >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
recv_data >> mailId;
Player *pl = _player;
Mail *m = pl->GetMail(mailId);
if (m)
@ -381,12 +381,12 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
uint32 mailId;
uint32 itemId;
recv_data >> mailbox;
recv_data >> mailId;
recv_data >> itemId; // item guid low
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
recv_data >> mailId;
recv_data >> itemId; // item guid low?
Player* pl = _player;
Mail* m = pl->GetMail(mailId);
@ -529,6 +529,13 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
// packet send mail count as uint8, prevent overflow
if(mailsCount >= 254)
{
realCount += 1;
continue;
}
// skip deleted or not delivered (deliver delay not expired) mails
if ((*itr)->state == MAIL_STATE_DELETED || cur_time < (*itr)->deliver_time)
continue;
@ -830,7 +837,8 @@ void MailDraft::prepareItems(Player* receiver)
Loot mailLoot;
mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver,true);
// can be empty
mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver, true, true);
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
for(uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)

View file

@ -23,6 +23,8 @@
struct AuctionEntry;
class Item;
class Object;
class Player;
#define MAIL_BODY_ITEM_TEMPLATE 8383 // - plain letter, A Dusty Unsent Letter: 889
#define MAX_MAIL_ITEMS 12
@ -36,6 +38,27 @@ enum MailMessageType
MAIL_ITEM = 5, // client send CMSG_ITEM_QUERY on this mailmessagetype
};
enum MailCheckMask
{
MAIL_CHECK_MASK_NONE = 0x00,
MAIL_CHECK_MASK_READ = 0x01,
MAIL_CHECK_MASK_AUCTION = 0x04,
MAIL_CHECK_MASK_COD_PAYMENT = 0x08,
MAIL_CHECK_MASK_RETURNED = 0x10
};
// gathered from Stationery.dbc
enum MailStationery
{
MAIL_STATIONERY_UNKNOWN = 1,
MAIL_STATIONERY_NORMAL = 41,
MAIL_STATIONERY_GM = 61,
MAIL_STATIONERY_AUCTION = 62,
MAIL_STATIONERY_VAL = 64,
MAIL_STATIONERY_CHR = 65,
MAIL_STATIONERY_ORP = 67, // new in 3.2.2
};
enum MailState
{
MAIL_STATE_UNCHANGED = 1,

View file

@ -2628,8 +2628,8 @@ uint32 InstanceMap::GetMaxPlayers() const
/* ******* Battleground Instance Maps ******* */
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent)
: Map(id, expiry, InstanceId, DUNGEON_DIFFICULTY_NORMAL, _parent)
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
: Map(id, expiry, InstanceId, spawnMode, _parent)
{
//lets initialize visibility distance for BG/Arenas
BattleGroundMap::InitVisibilityDistance();
@ -2988,6 +2988,36 @@ void Map::ScriptsProcess()
break;
}
case SCRIPT_COMMAND_KILL_CREDIT:
{
// accept player in any one from target/source arg
if (!target && !source)
{
sLog.outError("SCRIPT_COMMAND_KILL_CREDIT call for NULL object.");
break;
}
// must be only Player
if((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER))
{
sLog.outError("SCRIPT_COMMAND_KILL_CREDIT call for non-player (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0);
break;
}
Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
if (step.script->datalong2)
{
pSource->RewardPlayerAndGroupAtEvent(step.script->datalong, pSource);
}
else
{
pSource->KilledMonsterCredit(step.script->datalong, 0);
}
break;
}
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
if(!step.script->datalong) // creature not specified

View file

@ -612,7 +612,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
class MANGOS_DLL_SPEC BattleGroundMap : public Map
{
public:
BattleGroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent);
BattleGroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattleGroundMap();
bool Add(Player *);

View file

@ -24,7 +24,7 @@
#include "InstanceSaveMgr.h"
#include "World.h"
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, 0)
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL)
{
// initialize instanced maps list
m_InstancedMaps.clear();
@ -216,7 +216,12 @@ BattleGroundMap* MapInstanced::CreateBattleGroundMap(uint32 InstanceId, BattleGr
sLog.outDebug("MapInstanced::CreateBattleGroundMap: instance:%d for map:%d and bgType:%d created.", InstanceId, GetId(), bg->GetTypeID());
BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId, this);
// 0-59 normal spawn 60-69 difficulty_1, 70-79 difficulty_2, 80 dufficulty_3
uint8 spawnMode = (bg->GetQueueId() > QUEUE_ID_MAX_LEVEL_59) ? (bg->GetQueueId() - QUEUE_ID_MAX_LEVEL_59) : 0;
// some bgs don't have different spawnmodes, with this we can stay close to dbc-data
while (!GetMapDifficultyData(GetId(), Difficulty(spawnMode)))
spawnMode--;
BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode);
ASSERT(map->IsBattleGroundOrArena());
map->SetBG(bg);
bg->SetBgMap(map);

View file

@ -118,7 +118,7 @@ MapManager::_createBaseMap(uint32 id)
}
else
{
m = new Map(id, i_gridCleanUpDelay, 0, 0);
m = new Map(id, i_gridCleanUpDelay, 0, DUNGEON_DIFFICULTY_NORMAL);
}
i_maps[id] = m;
}

View file

@ -473,8 +473,8 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outString( ">> Loaded %u creature definitions", sCreatureStorage.RecordCount );
sLog.outString();
std::set<uint32> difficultyEntries1; // already loaded difficulty 1 value in creatures
std::set<uint32> hasDifficultyEntries1; // already loaded creatures with difficulty 1 values
std::set<uint32> difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures
std::set<uint32> hasDifficultyEntries[MAX_DIFFICULTY - 1]; // already loaded creatures with difficulty 1 values
// check data correctness
for(uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
@ -483,84 +483,105 @@ void ObjectMgr::LoadCreatureTemplates()
if (!cInfo)
continue;
if (cInfo->DifficultyEntry1)
bool ok = true; // bool to allow continue outside this loop
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry1);
if (!cInfo->DifficultyEntry[diff])
continue;
ok = false; // will be set to true at the end of this loop again
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
if (!difficultyInfo)
{
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_1`=%u but creature entry %u not exist.", i, cInfo->DifficultyEntry1, cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_%u`=%u but creature entry %u not exist.",
i, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
continue;
}
if (difficultyEntries1.find(i)!=difficultyEntries1.end())
if (difficultyEntries[diff].find(i) != difficultyEntries[diff].end())
{
sLog.outErrorDb("Creature (Entry: %u) listed as difficulty 1 but have value in `difficulty_entry_1`.",i);
sLog.outErrorDb("Creature (Entry: %u) listed as difficulty %u but have value in `difficulty_entry_1`.", i, diff + 1);
continue;
}
if (difficultyEntries1.find(cInfo->DifficultyEntry1)!=difficultyEntries1.end())
bool ok2 = true;
for (uint32 diff2 = 0; diff2 < MAX_DIFFICULTY - 1 && ok2; ++diff2)
{
sLog.outErrorDb("Creature (Entry: %u) already listed as difficulty 1 for another entry.",cInfo->DifficultyEntry1);
ok2 = false;
if (difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != difficultyEntries[diff2].end())
{
sLog.outErrorDb("Creature (Entry: %u) already listed as difficulty %u for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
if (hasDifficultyEntries1.find(cInfo->DifficultyEntry1)!=hasDifficultyEntries1.end())
if (hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != hasDifficultyEntries[diff2].end())
{
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_1`=%u but creature entry %u have difficulty 1 entry also.",i,cInfo->DifficultyEntry1,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) have `difficulty_entry_%u`=%u but creature entry %u have difficulty %u entry also.",
i, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
ok2 = true;
}
if (!ok2)
continue;
if (cInfo->unit_class != difficultyInfo->unit_class)
{
sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty 1 mode (Entry: %u, class %u).",i, cInfo->unit_class, cInfo->DifficultyEntry1, difficultyInfo->unit_class);
sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
i, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
continue;
}
if (cInfo->npcflag != difficultyInfo->npcflag)
{
sLog.outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty 1 mode (Entry: %u).",i,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_class != difficultyInfo->trainer_class)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty 1 mode (Entry: %u).",i,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_race != difficultyInfo->trainer_race)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty 1 mode (Entry: %u).",i,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_type != difficultyInfo->trainer_type)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty 1 mode (Entry: %u).",i,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
{
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty 1 mode (Entry: %u).",i,cInfo->DifficultyEntry1);
sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", i, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (difficultyInfo->AIName && *difficultyInfo->AIName)
{
sLog.outErrorDb("Difficulty 1 mode creature (Entry: %u) has `AIName`, but in any case will used difficulty 0 mode creature (Entry: %u) AIName.",cInfo->DifficultyEntry1,i);
sLog.outErrorDb("Difficulty %u mode creature (Entry: %u) has `AIName`, but in any case will used difficulty 0 mode creature (Entry: %u) AIName.",
diff, cInfo->DifficultyEntry[diff], i);
continue;
}
if (difficultyInfo->ScriptID)
{
sLog.outErrorDb("Difficulty 1 mode creature (Entry: %u) has `ScriptName`, but in any case will used difficulty 0 mode creature (Entry: %u) ScriptName.",cInfo->DifficultyEntry1,i);
sLog.outErrorDb("Difficulty %u mode creature (Entry: %u) has `ScriptName`, but in any case will used difficulty 0 mode creature (Entry: %u) ScriptName.",
diff, cInfo->DifficultyEntry[diff], i);
continue;
}
hasDifficultyEntries1.insert(i);
difficultyEntries1.insert(cInfo->DifficultyEntry1);
hasDifficultyEntries[diff].insert(i);
difficultyEntries[diff].insert(cInfo->DifficultyEntry[diff]);
ok = true;
}
if (!ok)
continue;
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A);
if (!factionTemplate)
@ -1032,11 +1053,12 @@ void ObjectMgr::LoadCreatures()
}
// build single time for check creature data
std::set<uint32> difficultyCreatures1;
for(uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
if(cInfo->DifficultyEntry1)
difficultyCreatures1.insert(cInfo->DifficultyEntry1);
std::set<uint32> difficultyCreatures[MAX_DIFFICULTY - 1];
for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
if (cInfo->DifficultyEntry[diff])
difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
// build single time for check spawnmask
std::map<uint32,uint32> spawnMasks;
@ -1095,11 +1117,18 @@ void ObjectMgr::LoadCreatures()
if (data.spawnMask & ~spawnMasks[data.mapid])
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).",guid, data.spawnMask, data.mapid );
if(difficultyCreatures1.find(data.id)!=difficultyCreatures1.end())
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty 1 template (entry: %u) in `creature_template`, skipped.",guid, data.id );
continue;
if (difficultyCreatures[diff].find(data.id) != difficultyCreatures[diff].end())
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id );
ok = false;
}
}
if (!ok)
continue;
if(data.equipmentId > 0) // -1 no equipment, 0 use default
{
@ -3191,7 +3220,7 @@ void ObjectMgr::LoadGroups()
uint32 diff = fields[4].GetUInt8();
if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff);
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
}
@ -4100,6 +4129,16 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
break;
}
case SCRIPT_COMMAND_KILL_CREDIT:
{
if (!GetCreatureTemplate(tmp.datalong))
{
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",tablename,tmp.datalong,tmp.id);
continue;
}
break;
}
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))

View file

@ -2620,27 +2620,6 @@ enum BattleGroundTypeId
};
#define MAX_BATTLEGROUND_TYPE_ID 33
enum MailCheckMask
{
MAIL_CHECK_MASK_NONE = 0x00,
MAIL_CHECK_MASK_READ = 0x01,
MAIL_CHECK_MASK_AUCTION = 0x04,
MAIL_CHECK_MASK_COD_PAYMENT = 0x08,
MAIL_CHECK_MASK_RETURNED = 0x10
};
// gathered from Stationery.dbc
enum MailStationery
{
MAIL_STATIONERY_UNKNOWN = 1,
MAIL_STATIONERY_NORMAL = 41,
MAIL_STATIONERY_GM = 61,
MAIL_STATIONERY_AUCTION = 62,
MAIL_STATIONERY_VAL = 64,
MAIL_STATIONERY_CHR = 65,
MAIL_STATIONERY_ORP = 67, // new in 3.2.2
};
enum MailResponseType
{
MAIL_SEND = 0,

View file

@ -343,6 +343,7 @@ enum RealmZone
#define SCRIPT_COMMAND_FLAG_REMOVE 5 // source = any, datalong = field_id, datalog2 = bitmask
#define SCRIPT_COMMAND_TELEPORT_TO 6 // source or target with Player, datalong = map_id, x/y/z
#define SCRIPT_COMMAND_QUEST_EXPLORED 7 // one from source or target must be Player, another GO/Creature, datalong=quest_id, datalong2=distance or 0
#define SCRIPT_COMMAND_KILL_CREDIT 8 // source or target with Player, datalong = creature entry, datalong2 = bool (0=personal credit, 1=group credit)
#define SCRIPT_COMMAND_RESPAWN_GAMEOBJECT 9 // source = any (summoner), datalong=db_guid, datalong2=despawn_delay
#define SCRIPT_COMMAND_TEMP_SUMMON_CREATURE 10 // source = any (summoner), datalong=creature entry, datalong2=despawn_delay
#define SCRIPT_COMMAND_OPEN_DOOR 11 // source = unit, datalong=db_guid, datalong2=reset_delay

View file

@ -25,8 +25,8 @@ extern DatabasePostgre WorldDatabase;
extern DatabaseMysql WorldDatabase;
#endif
const char CreatureInfosrcfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis";
const char CreatureInfodstfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii";
const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis";
const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii";
const char CreatureDataAddonInfofmt[]="iiiiiis";
const char CreatureModelfmt[]="iffbi";
const char CreatureInfoAddonInfofmt[]="iiiiiis";

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8770"
#define REVISION_NR "8779"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_8721_01_characters_guild"
#define REVISION_DB_MANGOS "required_8770_01_mangos_quest_template"
#define REVISION_DB_MANGOS "required_8777_02_mangos_gameobject"
#define REVISION_DB_REALMD "required_8728_01_realmd_account"
#endif // __REVISION_SQL_H__