mirror of
https://github.com/mangosfour/server.git
synced 2025-12-23 07:37:01 +00:00
Merge remote branch 'origin/master' into 330
This commit is contained in:
commit
72b9dc318e
69 changed files with 683 additions and 213 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include "AccountMgr.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Util.h"
|
||||
|
|
|
|||
|
|
@ -923,7 +923,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
continue;
|
||||
|
||||
//FIXME: work only for instances where max==min for players
|
||||
if(((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
|
||||
if (map->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
|
||||
continue;
|
||||
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "World.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "ArenaTeam.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Util.h"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "Guild.h"
|
||||
#include "UpdateMask.h"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Chat.h"
|
||||
|
|
@ -54,6 +55,7 @@
|
|||
// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click
|
||||
// |color|Htaxinode:id|h[name]|h|r
|
||||
// |color|Htele:id|h[name]|h|r
|
||||
// |color|Htitle:id|h[name]|h|r
|
||||
// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click
|
||||
|
||||
bool ChatHandler::load_command_table = true;
|
||||
|
|
@ -121,6 +123,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL },
|
||||
{ "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL },
|
||||
{ "reputation", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterReputationCommand, "", NULL },
|
||||
{ "titles", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterTitlesCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
|
@ -293,6 +296,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL },
|
||||
{ "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL },
|
||||
{ "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL },
|
||||
{ "title", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupTitleCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
|
@ -314,7 +318,6 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "faction", SEC_MODERATOR, false, &ChatHandler::HandleModifyFactionCommand, "", NULL },
|
||||
{ "spell", SEC_MODERATOR, false, &ChatHandler::HandleModifySpellCommand, "", NULL },
|
||||
{ "tp", SEC_MODERATOR, false, &ChatHandler::HandleModifyTalentCommand, "", NULL },
|
||||
{ "titles", SEC_MODERATOR, false, &ChatHandler::HandleModifyKnownTitlesCommand, "", NULL },
|
||||
{ "mount", SEC_MODERATOR, false, &ChatHandler::HandleModifyMountCommand, "", NULL },
|
||||
{ "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL },
|
||||
{ "rep", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyRepCommand, "", NULL },
|
||||
|
|
@ -551,6 +554,15 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand titlesCommandTable[] =
|
||||
{
|
||||
{ "add", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesAddCommand, "", NULL },
|
||||
{ "current", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesCurrentCommand, "", NULL },
|
||||
{ "remove", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesRemoveCommand, "", NULL },
|
||||
{ "setmask", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesSetMaskCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand unbanCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL },
|
||||
|
|
@ -584,6 +596,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable },
|
||||
{ "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable },
|
||||
{ "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable },
|
||||
{ "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable },
|
||||
{ "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable },
|
||||
{ "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable },
|
||||
{ "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ class ChatHandler
|
|||
bool HandleCharacterLevelCommand(const char* args);
|
||||
bool HandleCharacterRenameCommand(const char * args);
|
||||
bool HandleCharacterReputationCommand(const char* args);
|
||||
bool HandleCharacterTitlesCommand(const char* args);
|
||||
|
||||
bool HandleDebugAnimCommand(const char* args);
|
||||
bool HandleDebugArenaCommand(const char * args);
|
||||
|
|
@ -238,8 +239,8 @@ class ChatHandler
|
|||
bool HandleLookupSpellCommand(const char* args);
|
||||
bool HandleLookupTaxiNodeCommand(const char * args);
|
||||
bool HandleLookupTeleCommand(const char * args);
|
||||
bool HandleLookupTitleCommand(const char * args);
|
||||
|
||||
bool HandleModifyKnownTitlesCommand(const char* args);
|
||||
bool HandleModifyHPCommand(const char* args);
|
||||
bool HandleModifyManaCommand(const char* args);
|
||||
bool HandleModifyRageCommand(const char* args);
|
||||
|
|
@ -420,6 +421,11 @@ class ChatHandler
|
|||
bool HandleTeleGroupCommand(const char* args);
|
||||
bool HandleTeleNameCommand(const char* args);
|
||||
|
||||
bool HandleTitlesAddCommand(const char* args);
|
||||
bool HandleTitlesCurrentCommand(const char* args);
|
||||
bool HandleTitlesRemoveCommand(const char* args);
|
||||
bool HandleTitlesSetMaskCommand(const char* args);
|
||||
|
||||
bool HandleUnBanAccountCommand(const char* args);
|
||||
bool HandleUnBanCharacterCommand(const char* args);
|
||||
bool HandleUnBanIPCommand(const char* args);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Opcodes.h"
|
||||
#include "GossipDef.h"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "QuestDef.h"
|
||||
|
|
@ -306,14 +307,13 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
|||
SetCanModifyStats(true);
|
||||
UpdateAllStats();
|
||||
|
||||
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->faction_A);
|
||||
if (factionTemplate) // check and error show at loading templates
|
||||
// checked and error show at loading templates
|
||||
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetCreatureInfo()->faction_A))
|
||||
{
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction);
|
||||
if (factionEntry)
|
||||
if( !(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) &&
|
||||
(factionEntry->team == ALLIANCE || factionEntry->team == HORDE) )
|
||||
SetPvP(true);
|
||||
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP)
|
||||
SetPvP(true);
|
||||
else
|
||||
SetPvP(false);
|
||||
}
|
||||
|
||||
for(int i=0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
|
|
@ -1971,12 +1971,12 @@ bool Creature::LoadCreaturesAddon(bool reload)
|
|||
if (cainfo->bytes2 != 0)
|
||||
{
|
||||
// 0 SheathState
|
||||
// 1 Bytes2Flags
|
||||
// 1 UnitPVPStateFlags Set at Creature::UpdateEntry (SetPvp())
|
||||
// 2 UnitRename Pet only, so always 0 for default creature
|
||||
// 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
|
||||
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF));
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
|
||||
//SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF));
|
||||
//SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF));
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
|
||||
//SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF));
|
||||
|
|
|
|||
|
|
@ -236,6 +236,8 @@ enum AreaFlags
|
|||
|
||||
enum Difficulty
|
||||
{
|
||||
REGULAR_DIFFICULTY = 0,
|
||||
|
||||
DUNGEON_DIFFICULTY_NORMAL = 0,
|
||||
DUNGEON_DIFFICULTY_HEROIC = 1,
|
||||
|
||||
|
|
@ -251,7 +253,7 @@ enum Difficulty
|
|||
|
||||
enum SpawnMask
|
||||
{
|
||||
SPAWNMASK_CONTINENT = 1, // any any maps without spawn modes
|
||||
SPAWNMASK_REGULAR = (1 << REGULAR_DIFFICULTY),// any any maps without spawn modes (continents/subway) or in minimal spawnmode
|
||||
|
||||
SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL),
|
||||
SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC),
|
||||
|
|
@ -270,7 +272,8 @@ enum SpawnMask
|
|||
|
||||
enum FactionTemplateFlags
|
||||
{
|
||||
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
|
||||
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
|
||||
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
|
||||
};
|
||||
|
||||
enum FactionMasks
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ DBCStorage <MapEntry> sMapStore(MapEntryfmt);
|
|||
|
||||
// DBC used only for initialization sMapDifficultyMap at startup.
|
||||
DBCStorage <MapDifficultyEntry> sMapDifficultyStore(MapDifficultyEntryfmt); // only for loading
|
||||
typedef std::map<uint32/*pair32(map,diff)*/,MapDifficulty> MapDifficultyMap;
|
||||
MapDifficultyMap sMapDifficultyMap;
|
||||
|
||||
DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT
|
|||
void Zone2MapCoordinates(float& x,float& y,uint32 zone);
|
||||
void Map2ZoneCoordinates(float& x,float& y,uint32 zone);
|
||||
|
||||
typedef std::map<uint32/*pair32(map,diff)*/,MapDifficulty> MapDifficultyMap;
|
||||
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
|
||||
|
||||
uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls);
|
||||
|
|
@ -113,6 +114,7 @@ extern DBCStorage <LockEntry> sLockStore;
|
|||
extern DBCStorage <MailTemplateEntry> sMailTemplateStore;
|
||||
extern DBCStorage <MapEntry> sMapStore;
|
||||
//extern DBCStorage <MapDifficultyEntry> sMapDifficultyStore; -- use GetMapDifficultyData insteed
|
||||
extern MapDifficultyMap sMapDifficultyMap;
|
||||
extern DBCStorage <MovieEntry> sMovieStore;
|
||||
extern DBCStorage <QuestSortEntry> sQuestSortStore;
|
||||
extern DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore;
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ struct CharTitlesEntry
|
|||
{
|
||||
uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId()
|
||||
//uint32 unk1; // 1 flags?
|
||||
//char* name[16]; // 2-17, unused
|
||||
char* name[16]; // 2-17
|
||||
// 18 string flag, unused
|
||||
//char* name2[16]; // 19-34, unused
|
||||
// 35 string flag, unused
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const char BankBagSlotPricesEntryfmt[]="ni";
|
|||
const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
|
||||
const char BattlemasterListEntryfmt[]="niiiiiiiiiixssssssssssssssssxxx";
|
||||
const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
|
||||
const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
|
||||
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
|
||||
// ChatChannelsEntryfmt, index not used (more compact store)
|
||||
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Database/SQLStorage.h"
|
||||
#include "GMTicketMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Player.h"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "GameEventMgr.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "PoolManager.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Language.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Group.h"
|
||||
#include "Formulas.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@
|
|||
#define WITHDRAW_MONEY_UNLIMITED 0xFFFFFFFF
|
||||
#define WITHDRAW_SLOT_UNLIMITED 0xFFFFFFFF
|
||||
|
||||
#include "Common.h"
|
||||
#include "Item.h"
|
||||
#include "ObjectDefines.h"
|
||||
|
||||
class Item;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,13 +100,13 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
|||
{
|
||||
// initialize reset time
|
||||
// for normal instances if no creatures are killed the instance will reset in two hours
|
||||
if(entry->map_type == MAP_RAID || difficulty == DUNGEON_DIFFICULTY_HEROIC)
|
||||
resetTime = GetResetTimeFor(mapId);
|
||||
if(entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
|
||||
resetTime = GetResetTimeFor(mapId,difficulty);
|
||||
else
|
||||
{
|
||||
resetTime = time(NULL) + 2 * HOUR;
|
||||
// normally this will be removed soon after in InstanceMap::Add, prevent error
|
||||
ScheduleReset(true, resetTime, InstResetEvent(0, mapId, instanceId));
|
||||
ScheduleReset(true, resetTime, InstResetEvent(0, mapId, difficulty, instanceId));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -378,18 +378,26 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
// get the current reset times for normal instances (these may need to be updated)
|
||||
// these are only kept in memory for InstanceSaves that are loaded later
|
||||
// resettime = 0 in the DB for raid/heroic instances so those are skipped
|
||||
typedef std::map<uint32, std::pair<uint32, time_t> > ResetTimeMapType;
|
||||
ResetTimeMapType InstResetTime;
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id, map, resettime FROM instance WHERE resettime > 0");
|
||||
typedef std::pair<uint32 /*PAIR32(map,difficulty)*/, time_t> ResetTimeMapDiffType;
|
||||
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
||||
InstResetTimeMapDiffType instResetTime;
|
||||
|
||||
// index instance ids by map/difficulty pairs for fast reset warning send
|
||||
typedef std::multimap<uint32 /*PAIR32(map,difficulty)*/, uint32 /*instanceid*/ > ResetTimeMapDiffInstances;
|
||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||
if( result )
|
||||
{
|
||||
do
|
||||
{
|
||||
if(time_t resettime = time_t((*result)[2].GetUInt64()))
|
||||
if(time_t resettime = time_t((*result)[3].GetUInt64()))
|
||||
{
|
||||
uint32 id = (*result)[0].GetUInt32();
|
||||
uint32 mapid = (*result)[1].GetUInt32();
|
||||
InstResetTime[id] = std::pair<uint32, uint64>(mapid, resettime);
|
||||
uint32 difficulty = (*result)[2].GetUInt32();
|
||||
instResetTime[id] = ResetTimeMapDiffType(MAKE_PAIR32(mapid,difficulty), resettime);
|
||||
mapDiffResetInstances.insert(ResetTimeMapDiffInstances::value_type(MAKE_PAIR32(mapid,difficulty),id));
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
|
@ -404,8 +412,8 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
Field *fields = result->Fetch();
|
||||
uint32 instance = fields[1].GetUInt32();
|
||||
time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR);
|
||||
ResetTimeMapType::iterator itr = InstResetTime.find(instance);
|
||||
if(itr != InstResetTime.end() && itr->second.second != resettime)
|
||||
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
|
||||
if(itr != instResetTime.end() && itr->second.second != resettime)
|
||||
{
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
|
||||
itr->second.second = resettime;
|
||||
|
|
@ -416,59 +424,65 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
}
|
||||
|
||||
// schedule the reset times
|
||||
for(ResetTimeMapType::iterator itr = InstResetTime.begin(); itr != InstResetTime.end(); ++itr)
|
||||
for(InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
|
||||
if(itr->second.second > now)
|
||||
ScheduleReset(true, itr->second.second, InstResetEvent(0, itr->second.first, itr->first));
|
||||
ScheduleReset(true, itr->second.second, InstResetEvent(0, PAIR32_LOPART(itr->second.first),Difficulty(PAIR32_HIPART(itr->second.first)),itr->first));
|
||||
}
|
||||
|
||||
// load the global respawn times for raid/heroic instances
|
||||
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
||||
m_resetTimeByMapId.resize(sMapStore.GetNumRows()+1);
|
||||
result = CharacterDatabase.Query("SELECT mapid, resettime FROM instance_reset");
|
||||
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
|
||||
if(result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
uint32 mapid = fields[0].GetUInt32();
|
||||
if(!ObjectMgr::GetInstanceTemplate(mapid))
|
||||
Difficulty difficulty = Difficulty(fields[1].GetUInt32());
|
||||
uint64 oldresettime = fields[2].GetUInt64();
|
||||
|
||||
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
|
||||
if(!mapDiff)
|
||||
{
|
||||
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid %u in instance_reset!", mapid);
|
||||
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u'", mapid);
|
||||
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
|
||||
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty);
|
||||
continue;
|
||||
}
|
||||
|
||||
// update the reset time if the hour in the configs changes
|
||||
uint64 oldresettime = fields[1].GetUInt64();
|
||||
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
||||
if(oldresettime != newresettime)
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", newresettime, mapid);
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
|
||||
|
||||
m_resetTimeByMapId[mapid] = newresettime;
|
||||
SetResetTimeFor(mapid,difficulty,newresettime);
|
||||
} while(result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// clean expired instances, references to them will be deleted in CleanupInstances
|
||||
// must be done before calculating new reset times
|
||||
_DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)now, (uint64)now);
|
||||
_DelHelper(CharacterDatabase, "id, map, instance.difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map AND instance.difficulty = instance_reset.difficulty WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)now, (uint64)now);
|
||||
|
||||
// calculate new global reset times for expired instances and those that have never been reset yet
|
||||
// add the global reset times to the priority queue
|
||||
for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
|
||||
for(MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
|
||||
{
|
||||
InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(i);
|
||||
if(!temp || temp->reset_delay == 0)
|
||||
uint32 map_diff_pair = itr->first;
|
||||
uint32 mapid = PAIR32_LOPART(map_diff_pair);
|
||||
Difficulty difficulty = Difficulty(PAIR32_HIPART(map_diff_pair));
|
||||
MapDifficulty const* mapDiff = &itr->second;
|
||||
if (!mapDiff->resetTime)
|
||||
continue;
|
||||
|
||||
uint32 period = temp->reset_delay * DAY;
|
||||
assert(period != 0);
|
||||
time_t t = m_resetTimeByMapId[temp->map];
|
||||
// the reset_delay must be at least one day
|
||||
uint32 period = (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
|
||||
|
||||
time_t t = GetResetTimeFor(mapid,difficulty);
|
||||
if(!t)
|
||||
{
|
||||
// initialize the reset time
|
||||
t = today + period + diff;
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"UI64FMTD"')", i, (uint64)t);
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
|
||||
}
|
||||
|
||||
if(t < now)
|
||||
|
|
@ -477,17 +491,23 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
// calculate the next reset time
|
||||
t = (t / DAY) * DAY;
|
||||
t += ((today - t) / period + 1) * period + diff;
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", (uint64)t, i);
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
|
||||
}
|
||||
|
||||
m_resetTimeByMapId[temp->map] = t;
|
||||
SetResetTimeFor(mapid,difficulty,t);
|
||||
|
||||
// schedule the global reset/warning
|
||||
uint8 type = 1;
|
||||
static int tim[4] = {3600, 900, 300, 60};
|
||||
for(; type < 4; type++)
|
||||
if(t - tim[type-1] > now) break;
|
||||
ScheduleReset(true, t - tim[type-1], InstResetEvent(type, i));
|
||||
if(t - tim[type-1] > now)
|
||||
break;
|
||||
|
||||
for(ResetTimeMapDiffInstances::const_iterator in_itr = mapDiffResetInstances.lower_bound(map_diff_pair);
|
||||
in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
|
||||
{
|
||||
ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, in_itr->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -528,8 +548,8 @@ void InstanceSaveManager::Update()
|
|||
else
|
||||
{
|
||||
// global reset/warning for a certain map
|
||||
time_t resetTime = GetResetTimeFor(event.mapid);
|
||||
_ResetOrWarnAll(event.mapid, event.type != 4, resetTime - now);
|
||||
time_t resetTime = GetResetTimeFor(event.mapid,event.difficulty);
|
||||
_ResetOrWarnAll(event.mapid, event.difficulty, event.type != 4, resetTime - now);
|
||||
if(event.type != 4)
|
||||
{
|
||||
// schedule the next warning/reset
|
||||
|
|
@ -580,29 +600,28 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
|||
else sObjectMgr.DeleteRespawnTimeForInstance(instanceId); // even if map is not loaded
|
||||
}
|
||||
|
||||
void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLeft)
|
||||
void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, uint32 timeLeft)
|
||||
{
|
||||
// global reset for all instances of the given map
|
||||
// note: this isn't fast but it's meant to be executed very rarely
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid);
|
||||
if(!map->Instanceable())
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(mapid);
|
||||
if (!mapEntry->Instanceable())
|
||||
return;
|
||||
|
||||
uint64 now = (uint64)time(NULL);
|
||||
|
||||
if(!warn)
|
||||
if (!warn)
|
||||
{
|
||||
// this is called one minute before the reset time
|
||||
InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(mapid);
|
||||
if(!temp || !temp->reset_delay)
|
||||
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
|
||||
if (!mapDiff || !mapDiff->resetTime)
|
||||
{
|
||||
sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid);
|
||||
sLog.outError("InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid);
|
||||
return;
|
||||
}
|
||||
|
||||
// remove all binds to instances of the given map
|
||||
for(InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end();)
|
||||
{
|
||||
if(itr->second->GetMapId() == mapid)
|
||||
if (itr->second->GetMapId() == mapid && itr->second->GetDifficulty() == difficulty)
|
||||
_ResetSave(itr);
|
||||
else
|
||||
++itr;
|
||||
|
|
@ -617,12 +636,14 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
|
|||
|
||||
// calculate the next reset time
|
||||
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
||||
uint32 period = temp->reset_delay * DAY;
|
||||
uint32 period = mapDiff->resetTime * DAY;
|
||||
uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
|
||||
// update it in the DB
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d'", next_reset, mapid);
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
|
||||
}
|
||||
|
||||
// note: this isn't fast but it's meant to be executed very rarely
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid); // _not_ include difficulty
|
||||
MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps();
|
||||
MapInstanced::InstancedMaps::iterator mitr;
|
||||
for(mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "Utilities/UnorderedMap.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "ObjectDefines.h"
|
||||
|
||||
struct InstanceTemplate;
|
||||
struct MapEntry;
|
||||
|
|
@ -118,28 +119,39 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSav
|
|||
InstanceSaveManager();
|
||||
~InstanceSaveManager();
|
||||
|
||||
typedef std::map<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveMap;
|
||||
typedef UNORDERED_MAP<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveHashMap;
|
||||
typedef std::map<uint32 /*mapId*/, InstanceSaveMap> InstanceSaveMapMap;
|
||||
typedef UNORDERED_MAP<uint32 /*mapId*/, InstanceSaveHashMap> InstanceSaveMapMap;
|
||||
|
||||
/* resetTime is a global propery of each (raid/heroic) map
|
||||
all instances of that map reset at the same time */
|
||||
struct InstResetEvent
|
||||
{
|
||||
uint8 type;
|
||||
Difficulty difficulty:8;
|
||||
uint16 mapid;
|
||||
uint16 instanceId;
|
||||
InstResetEvent(uint8 t = 0, uint16 m = 0, uint16 i = 0) : type(t), mapid(m), instanceId(i) {}
|
||||
|
||||
InstResetEvent() : type(0), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {}
|
||||
InstResetEvent(uint8 t, uint32 _mapid, Difficulty d, uint16 _instanceid)
|
||||
: type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {}
|
||||
bool operator == (const InstResetEvent& e) { return e.instanceId == instanceId; }
|
||||
};
|
||||
typedef std::multimap<time_t /*resetTime*/, InstResetEvent> ResetTimeQueue;
|
||||
typedef std::vector<time_t /*resetTime*/> ResetTimeVector;
|
||||
typedef UNORDERED_MAP<uint32 /*PAIR32(map,difficulty)*/,time_t /*resetTime*/> ResetTimeByMapDifficultyMap;
|
||||
|
||||
void CleanupInstances();
|
||||
void PackInstances();
|
||||
|
||||
void LoadResetTimes();
|
||||
time_t GetResetTimeFor(uint32 mapid) { return m_resetTimeByMapId[mapid]; }
|
||||
time_t GetResetTimeFor(uint32 mapid, Difficulty d) const
|
||||
{
|
||||
ResetTimeByMapDifficultyMap::const_iterator itr = m_resetTimeByMapDifficulty.find(MAKE_PAIR32(mapid,d));
|
||||
return itr != m_resetTimeByMapDifficulty.end() ? itr->second : 0;
|
||||
}
|
||||
void SetResetTimeFor(uint32 mapid, Difficulty d, time_t t)
|
||||
{
|
||||
m_resetTimeByMapDifficulty[MAKE_PAIR32(mapid,d)] = t;
|
||||
}
|
||||
void ScheduleReset(bool add, time_t time, InstResetEvent event);
|
||||
|
||||
void Update();
|
||||
|
|
@ -156,7 +168,7 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSav
|
|||
uint32 GetNumBoundGroupsTotal();
|
||||
|
||||
private:
|
||||
void _ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeleft);
|
||||
void _ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, uint32 timeleft);
|
||||
void _ResetInstance(uint32 mapid, uint32 instanceId);
|
||||
void _ResetSave(InstanceSaveHashMap::iterator &itr);
|
||||
void _DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...);
|
||||
|
|
@ -164,8 +176,8 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSav
|
|||
bool lock_instLists;
|
||||
// fast lookup by instance id
|
||||
InstanceSaveHashMap m_instanceSaveById;
|
||||
// fast lookup for reset times
|
||||
ResetTimeVector m_resetTimeByMapId;
|
||||
// fast lookup for reset times (always use existed functions for access/set)
|
||||
ResetTimeByMapDifficultyMap m_resetTimeByMapDifficulty;
|
||||
ResetTimeQueue m_resetTimeQueue;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "Common.h"
|
||||
#include "Item.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
|
|
|
|||
|
|
@ -332,7 +332,15 @@ enum MangosStrings
|
|||
LANG_CUSTOMIZE_PLAYER_GUID = 346,
|
||||
LANG_COMMAND_GOTAXINODENOTFOUND = 347,
|
||||
LANG_GAMEOBJECT_HAVE_INVALID_DATA = 348,
|
||||
// Room for more level 2 349-399 not used
|
||||
LANG_TITLE_LIST_CHAT = 349,
|
||||
LANG_TITLE_LIST_CONSOLE = 350,
|
||||
LANG_COMMAND_NOTITLEFOUND = 351,
|
||||
LANG_INVALID_TITLE_ID = 352,
|
||||
LANG_TITLE_ADD_RES = 353,
|
||||
LANG_TITLE_REMOVE_RES = 354,
|
||||
LANG_TITLE_CURRENT_RES = 355,
|
||||
LANG_CURRENT_TITLE_RESET = 356,
|
||||
// Room for more level 2 357-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
|
|
|
|||
|
|
@ -637,42 +637,6 @@ bool ChatHandler::HandleRecallCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
//Edit Player KnownTitles
|
||||
bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
uint64 titles = 0;
|
||||
|
||||
sscanf((char*)args, UI64FMTD, &titles);
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
if (!chr)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
uint64 titles2 = titles;
|
||||
|
||||
for(uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||
if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
||||
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
||||
|
||||
titles &= ~titles2; // remove not existed titles
|
||||
|
||||
chr->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
|
||||
SendSysMessage(LANG_DONE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Edit Player HP
|
||||
bool ChatHandler::HandleModifyHPCommand(const char* args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "Item.h"
|
||||
#include "GameObject.h"
|
||||
|
|
@ -4202,3 +4204,303 @@ bool ChatHandler::HandleWaterwalkCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLookupTitleCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
// can be NULL in console call
|
||||
Player* target = getSelectedPlayer();
|
||||
|
||||
// title name have single string arg for player name
|
||||
char const* targetName = target ? target->GetName() : "NAME";
|
||||
|
||||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if(!Utf8toWStr(namepart,wnamepart))
|
||||
return false;
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
wstrToLower( wnamepart );
|
||||
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
// Search in CharTitles.dbc
|
||||
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
|
||||
{
|
||||
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
if(titleInfo)
|
||||
{
|
||||
int loc = GetSessionDbcLocale();
|
||||
std::string name = titleInfo->name[loc];
|
||||
if(name.empty())
|
||||
continue;
|
||||
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
loc = 0;
|
||||
for(; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if(loc==GetSessionDbcLocale())
|
||||
continue;
|
||||
|
||||
name = titleInfo->name[loc];
|
||||
if(name.empty())
|
||||
continue;
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(loc < MAX_LOCALE)
|
||||
{
|
||||
char const* knownStr = target && target->HasTitle(titleInfo) ? GetMangosString(LANG_KNOWN) : "";
|
||||
|
||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
|
||||
? GetMangosString(LANG_ACTIVE)
|
||||
: "";
|
||||
|
||||
char titleNameStr[80];
|
||||
snprintf(titleNameStr,80,name.c_str(),targetName);
|
||||
|
||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr);
|
||||
else
|
||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,titleNameStr,localeNames[loc],knownStr,activeStr);
|
||||
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTitlesAddCommand(const char* args)
|
||||
{
|
||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||
char* id_p = extractKeyFromLink((char*)args,"Htitle");
|
||||
if(!id_p)
|
||||
return false;
|
||||
|
||||
int32 id = atoi(id_p);
|
||||
if (id <= 0)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player * target = getSelectedPlayer();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
if(!titleInfo)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string tNameLink = GetNameLink(target);
|
||||
|
||||
char const* targetName = target->GetName();
|
||||
char titleNameStr[80];
|
||||
snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName);
|
||||
|
||||
target->SetTitle(titleInfo);
|
||||
PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
|
||||
{
|
||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||
char* id_p = extractKeyFromLink((char*)args,"Htitle");
|
||||
if(!id_p)
|
||||
return false;
|
||||
|
||||
int32 id = atoi(id_p);
|
||||
if (id <= 0)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player * target = getSelectedPlayer();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
if(!titleInfo)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->SetTitle(titleInfo,true);
|
||||
|
||||
std::string tNameLink = GetNameLink(target);
|
||||
|
||||
char const* targetName = target->GetName();
|
||||
char titleNameStr[80];
|
||||
snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName);
|
||||
|
||||
PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());
|
||||
|
||||
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
||||
{
|
||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
|
||||
PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Edit Player KnownTitles
|
||||
bool ChatHandler::HandleTitlesSetMaskCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
uint64 titles = 0;
|
||||
|
||||
sscanf((char*)args, UI64FMTD, &titles);
|
||||
|
||||
Player *target = getSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
uint64 titles2 = titles;
|
||||
|
||||
for(uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||
if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
||||
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
||||
|
||||
titles &= ~titles2; // remove not existed titles
|
||||
|
||||
target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
|
||||
SendSysMessage(LANG_DONE);
|
||||
|
||||
if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE)))
|
||||
{
|
||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
|
||||
PSendSysMessage(LANG_CURRENT_TITLE_RESET,GetNameLink(target).c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleCharacterTitlesCommand(const char* args)
|
||||
{
|
||||
Player* target;
|
||||
if(!extractPlayerTarget((char*)args,&target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = GetSessionDbcLocale();
|
||||
char const* targetName = target->GetName();
|
||||
char const* knownStr = GetMangosString(LANG_KNOWN);
|
||||
|
||||
// Search in CharTitles.dbc
|
||||
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
|
||||
{
|
||||
CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
if (titleInfo && target->HasTitle(titleInfo))
|
||||
{
|
||||
std::string name = titleInfo->name[loc];
|
||||
if(name.empty())
|
||||
continue;
|
||||
|
||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE)==titleInfo->bit_index
|
||||
? GetMangosString(LANG_ACTIVE)
|
||||
: "";
|
||||
|
||||
char titleNameStr[80];
|
||||
snprintf(titleNameStr,80,name.c_str(),targetName);
|
||||
|
||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr);
|
||||
else
|
||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,name.c_str(),localeNames[loc],knownStr,activeStr);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTitlesCurrentCommand(const char* args)
|
||||
{
|
||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||
char* id_p = extractKeyFromLink((char*)args,"Htitle");
|
||||
if(!id_p)
|
||||
return false;
|
||||
|
||||
int32 id = atoi(id_p);
|
||||
if (id <= 0)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player * target = getSelectedPlayer();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||
if(!titleInfo)
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TITLE_ID, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string tNameLink = GetNameLink(target);
|
||||
|
||||
target->SetTitle(titleInfo); // to be sure that title now known
|
||||
target->SetUInt32Value(PLAYER_CHOSEN_TITLE,titleInfo->bit_index);
|
||||
|
||||
PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name[GetSessionDbcLocale()], tNameLink.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1048,7 +1048,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args)
|
|||
|
||||
if(!target->GetSkillValue(skill))
|
||||
{
|
||||
PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[0]);
|
||||
PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1059,7 +1059,7 @@ bool ChatHandler::HandleSetSkillCommand(const char* args)
|
|||
return false;
|
||||
|
||||
target->SetSkill(skill, level, max);
|
||||
PSendSysMessage(LANG_SET_SKILL, skill, sl->name[0], tNameLink.c_str(), level, max);
|
||||
PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3511,7 +3511,6 @@ bool ChatHandler::HandleReviveCommand(const char* args)
|
|||
{
|
||||
target->ResurrectPlayer(0.5f);
|
||||
target->SpawnCorpseBones();
|
||||
target->SaveToDB();
|
||||
}
|
||||
else
|
||||
// will resurrected at login without corpse
|
||||
|
|
@ -6394,4 +6393,4 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
|
|||
ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, GetNameLink().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "GameObject.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "WorldSession.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Object.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Unit.h"
|
||||
|
|
|
|||
|
|
@ -1127,6 +1127,23 @@ void Map::UnloadAll(bool pForce)
|
|||
}
|
||||
}
|
||||
|
||||
MapDifficulty const* Map::GetMapDifficulty() const
|
||||
{
|
||||
return GetMapDifficultyData(GetId(),GetDifficulty());
|
||||
}
|
||||
|
||||
uint32 Map::GetMaxPlayers() const
|
||||
{
|
||||
MapDifficulty const* mapDiff = GetMapDifficulty();
|
||||
return mapDiff ? mapDiff->maxPlayers : 0;
|
||||
}
|
||||
|
||||
uint32 Map::GetMaxResetDelay() const
|
||||
{
|
||||
MapDifficulty const* mapDiff = GetMapDifficulty();
|
||||
return mapDiff ? mapDiff->resetTime : 0;
|
||||
}
|
||||
|
||||
//*****************************
|
||||
// Grid function
|
||||
//*****************************
|
||||
|
|
@ -2610,22 +2627,14 @@ void InstanceMap::SetResetSchedule(bool on)
|
|||
// only for normal instances
|
||||
// the reset time is only scheduled when there are no payers inside
|
||||
// it is assumed that the reset time will rarely (if ever) change while the reset is scheduled
|
||||
if(IsDungeon() && !HavePlayers() && !IsRaid() && !IsHeroic())
|
||||
if(IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
|
||||
{
|
||||
InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId());
|
||||
if(!save) sLog.outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, no save available for instance %d of %d", on ? "on" : "off", GetInstanceId(), GetId());
|
||||
else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), GetInstanceId()));
|
||||
else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
|
||||
}
|
||||
}
|
||||
|
||||
uint32 InstanceMap::GetMaxPlayers() const
|
||||
{
|
||||
InstanceTemplate const* iTemplate = ObjectMgr::GetInstanceTemplate(GetId());
|
||||
if(!iTemplate)
|
||||
return 0;
|
||||
return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
|
||||
}
|
||||
|
||||
/* ******* Battleground Instance Maps ******* */
|
||||
|
||||
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
|
||||
|
|
@ -3560,4 +3569,3 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
|
|||
ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,9 +227,6 @@ struct InstanceTemplate
|
|||
uint32 parent;
|
||||
uint32 levelMin;
|
||||
uint32 levelMax;
|
||||
uint32 maxPlayers;
|
||||
uint32 maxPlayersHeroic;
|
||||
uint32 reset_delay; // FIX ME: now exist normal/heroic raids with possible different time of reset.
|
||||
float startLocX;
|
||||
float startLocY;
|
||||
float startLocZ;
|
||||
|
|
@ -365,15 +362,25 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
bool CheckGridIntegrity(Creature* c, bool moved) const;
|
||||
|
||||
uint32 GetInstanceId() const { return i_InstanceId; }
|
||||
uint8 GetSpawnMode() const { return (i_spawnMode); }
|
||||
virtual bool CanEnter(Player* /*player*/) { return true; }
|
||||
const char* GetMapName() const;
|
||||
|
||||
// have meaning only for instanced map (that have set real difficulty), NOT USE its for BaseMap
|
||||
// _currently_ spawnmode == difficulty, but this can be changes later, so use appropriate spawmmode/difficult functions
|
||||
// for simplify later code support
|
||||
// regular difficulty = continent/dungeon normal/first raid normal difficulty
|
||||
uint8 GetSpawnMode() const { return (i_spawnMode); }
|
||||
Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
|
||||
bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DIFFICULTY; }
|
||||
uint32 GetMaxPlayers() const; // dependent from map difficulty
|
||||
uint32 GetMaxResetDelay() const; // dependent from map difficulty
|
||||
MapDifficulty const* GetMapDifficulty() const; // dependent from map difficulty
|
||||
|
||||
bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
|
||||
// NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable
|
||||
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
|
||||
bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
|
||||
bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
|
||||
bool IsRaidOrHeroicDungeon() const { return IsRaid() || GetDifficulty() > DUNGEON_DIFFICULTY_NORMAL; }
|
||||
bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); }
|
||||
bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
|
||||
bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); }
|
||||
|
|
@ -599,7 +606,6 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
|
|||
bool CanEnter(Player* player);
|
||||
void SendResetWarnings(uint32 timeLeft) const;
|
||||
void SetResetSchedule(bool on);
|
||||
uint32 GetMaxPlayers() const;
|
||||
|
||||
virtual void InitVisibilityDistance();
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ MapManager::_createBaseMap(uint32 id)
|
|||
}
|
||||
else
|
||||
{
|
||||
m = new Map(id, i_gridCleanUpDelay, 0, DUNGEON_DIFFICULTY_NORMAL);
|
||||
m = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
|
||||
}
|
||||
i_maps[id] = m;
|
||||
}
|
||||
|
|
@ -184,13 +184,11 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||
MapDifficulty const* mapDiff = GetMapDifficultyData(entry->MapID,player->GetDifficulty(entry->map_type == MAP_RAID));
|
||||
if (!mapDiff)
|
||||
{
|
||||
bool isNormalTargetMap = entry->map_type == MAP_RAID
|
||||
? (player->GetRaidDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
|
||||
: (player->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL);
|
||||
bool isRegularTargetMap = player->GetDifficulty(entry->IsRaid()) == REGULAR_DIFFICULTY;
|
||||
|
||||
//Send aborted message
|
||||
// FIX ME: what about absent normal/heroic mode with specific players limit...
|
||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Auth/BigNumber.h"
|
||||
#include "Auth/Sha1.h"
|
||||
|
|
@ -669,8 +670,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
|
|||
if(!GetPlayer()->isRessurectRequestedBy(guid))
|
||||
return;
|
||||
|
||||
GetPlayer()->ResurectUsingRequestData();
|
||||
GetPlayer()->SaveToDB();
|
||||
GetPlayer()->ResurectUsingRequestData(); // will call spawncorpsebones
|
||||
}
|
||||
|
||||
void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
||||
|
|
@ -810,12 +810,10 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
|||
if(!mapEntry)
|
||||
return;
|
||||
|
||||
bool isNormalTargetMap = mapEntry->IsRaid()
|
||||
? (GetPlayer()->GetRaidDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
|
||||
: (GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL);
|
||||
bool isRegularTargetMap = GetPlayer()->GetDifficulty(mapEntry->IsRaid()) == REGULAR_DIFFICULTY;
|
||||
|
||||
uint32 missingKey = 0;
|
||||
if (!isNormalTargetMap)
|
||||
if (!isRegularTargetMap)
|
||||
{
|
||||
if(at->heroicKey)
|
||||
{
|
||||
|
|
@ -828,7 +826,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
uint32 missingQuest = 0;
|
||||
if (!isNormalTargetMap)
|
||||
if (!isRegularTargetMap)
|
||||
{
|
||||
if (at->requiredQuestHeroic && !GetPlayer()->GetQuestRewardStatus(at->requiredQuestHeroic))
|
||||
missingQuest = at->requiredQuestHeroic;
|
||||
|
|
@ -845,7 +843,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
|||
if(missingItem)
|
||||
SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, ObjectMgr::GetItemPrototype(missingItem)->Name1);
|
||||
else if(missingKey)
|
||||
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
||||
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
||||
else if(missingQuest)
|
||||
SendAreaTriggerMessage(at->requiredFailedText.c_str());
|
||||
else if(missingLevel)
|
||||
|
|
|
|||
|
|
@ -141,20 +141,13 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
}
|
||||
}
|
||||
|
||||
if (mInstance)
|
||||
if (mInstance && mEntry->IsDungeon())
|
||||
{
|
||||
if(mEntry->IsRaid())
|
||||
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
|
||||
if (uint32 timeReset = sInstanceSaveMgr.GetResetTimeFor(GetPlayer()->GetMapId(),diff))
|
||||
{
|
||||
uint32 timeleft = sInstanceSaveMgr.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL);
|
||||
GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetRaidDifficulty(), timeleft);
|
||||
}
|
||||
else if(mEntry->IsNonRaidDungeon() && GetPlayer()->GetDungeonDifficulty() > DUNGEON_DIFFICULTY_NORMAL)
|
||||
{
|
||||
if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,GetPlayer()->GetDungeonDifficulty()))
|
||||
{
|
||||
uint32 timeleft = sInstanceSaveMgr.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL);
|
||||
GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDungeonDifficulty(), timeleft);
|
||||
}
|
||||
uint32 timeleft = timeReset - time(NULL);
|
||||
GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), diff, timeleft);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "Player.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "UpdateData.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "World.h"
|
||||
|
|
@ -4593,42 +4594,14 @@ void ObjectMgr::LoadInstanceTemplate()
|
|||
if(!temp)
|
||||
continue;
|
||||
|
||||
const MapEntry* entry = sMapStore.LookupEntry(temp->map);
|
||||
if(!entry)
|
||||
{
|
||||
if(!MapManager::IsValidMAP(temp->map))
|
||||
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map);
|
||||
continue;
|
||||
}
|
||||
|
||||
//FIXME: now exist heroic instance, normal/heroic raid instances
|
||||
// entry->resetTimeHeroic store reset time for both heroic mode instance (raid and non-raid)
|
||||
// entry->resetTimeRaid store reset time for normal raid only
|
||||
// for current state entry->resetTimeRaid == entry->resetTimeHeroic in case raid instances with heroic mode.
|
||||
// but at some point wee need implement reset time dependent from raid instance mode
|
||||
if(temp->reset_delay == 0)
|
||||
if(!MapManager::IsValidMapCoord(temp->parent,temp->startLocX,temp->startLocY,temp->startLocZ,temp->startLocO))
|
||||
{
|
||||
MapDifficulty const* mapDiffNorm = GetMapDifficultyData(temp->map,DUNGEON_DIFFICULTY_NORMAL);
|
||||
MapDifficulty const* mapDiffHeroic = GetMapDifficultyData(temp->map,DUNGEON_DIFFICULTY_HEROIC);
|
||||
|
||||
// no reset time
|
||||
if ((!mapDiffNorm || mapDiffNorm->resetTime == 0) &&
|
||||
(!mapDiffHeroic || mapDiffHeroic->resetTime == 0))
|
||||
continue;
|
||||
|
||||
// use defaults from the DBC
|
||||
if(mapDiffHeroic && mapDiffHeroic->resetTime) // for both raid and non raids, read above
|
||||
{
|
||||
temp->reset_delay = mapDiffHeroic->resetTime / DAY;
|
||||
}
|
||||
else if (mapDiffNorm && mapDiffNorm->resetTime && entry->map_type == MAP_RAID)
|
||||
// for normal raid only
|
||||
{
|
||||
temp->reset_delay = mapDiffNorm->resetTime / DAY;
|
||||
}
|
||||
sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad parent entrance coordinates for map id %d template!", temp->map);
|
||||
temp->parent = 0; // will have wrong continent 0 parent, at least existed
|
||||
}
|
||||
|
||||
// the reset_delay must be at least one day
|
||||
temp->reset_delay = std::max((uint32)1, (uint32)(temp->reset_delay * sWorld.getRate(RATE_INSTANCE_RESET_TIME)));
|
||||
}
|
||||
|
||||
sLog.outString( ">> Loaded %u Instance Template definitions", sInstanceTemplate.RecordCount );
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "WorldSession.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Guild.h"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "CellImpl.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Formulas.h"
|
||||
#include "Group.h"
|
||||
|
|
@ -4318,7 +4319,8 @@ void Player::CreateCorpse()
|
|||
void Player::SpawnCorpseBones()
|
||||
{
|
||||
if(sObjectAccessor.ConvertCorpseForPlayer(GetGUID()))
|
||||
SaveToDB(); // prevent loading as ghost without corpse
|
||||
if (!GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
|
||||
SaveToDB(); // prevent loading as ghost without corpse
|
||||
}
|
||||
|
||||
Corpse* Player::GetCorpse() const
|
||||
|
|
@ -14471,6 +14473,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
// clear charm/summon related fields
|
||||
SetCharm(NULL);
|
||||
SetPet(NULL);
|
||||
SetTargetGUID(0);
|
||||
SetChannelObjectGUID(0);
|
||||
SetCharmerGUID(0);
|
||||
SetOwnerGUID(0);
|
||||
SetCreatorGUID(0);
|
||||
|
|
@ -15619,6 +15623,7 @@ bool Player::_LoadHomeBind(QueryResult *result)
|
|||
|
||||
void Player::SaveToDB()
|
||||
{
|
||||
// we should assure this: assert((m_nextSave != sWorld.getConfig(CONFIG_INTERVAL_SAVE)));
|
||||
// delay auto save at any saves (manual, in code, or autosave)
|
||||
m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "PoolManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "NPCHandler.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "World.h"
|
||||
#include "Util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2319,7 +2319,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
{
|
||||
if (m_target->GetMap()->IsDungeon())
|
||||
{
|
||||
uint32 spellId = m_target->GetMap()->IsHeroic() ? 46163 : 44190;
|
||||
uint32 spellId = m_target->GetMap()->IsRegularDifficulty() ? 44190 : 46163;
|
||||
|
||||
m_target->CastSpell(m_target, spellId, true, NULL, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1399,14 +1399,22 @@ void Spell::EffectDummy(uint32 i)
|
|||
return;
|
||||
|
||||
uint32 rage = m_caster->GetPower(POWER_RAGE);
|
||||
// Glyph of Execution bonus
|
||||
if (Aura *aura = m_caster->GetDummyAura(58367))
|
||||
rage+=aura->GetModifier()->m_amount;
|
||||
|
||||
int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
|
||||
// up to max 30 rage cost
|
||||
if(rage > 30)
|
||||
rage = 30;
|
||||
|
||||
// Glyph of Execution bonus
|
||||
uint32 rage_modified = rage;
|
||||
|
||||
if (Aura *aura = m_caster->GetDummyAura(58367))
|
||||
rage_modified += aura->GetModifier()->m_amount;
|
||||
|
||||
int32 basePoints0 = damage+int32(rage_modified * m_spellInfo->DmgMultiplier[i] +
|
||||
m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
|
||||
|
||||
m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
|
||||
m_caster->SetPower(POWER_RAGE, 0);
|
||||
m_caster->SetPower(POWER_RAGE, m_caster->GetPower(POWER_RAGE)-rage);
|
||||
return;
|
||||
}
|
||||
// Slam
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Transports.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Path.h"
|
||||
|
||||
#include "WorldPacket.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "WorldSession.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Unit.h"
|
||||
#include "QuestDef.h"
|
||||
|
|
@ -683,7 +684,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
|
||||
if(m->IsDungeon() && creditedPlayer)
|
||||
{
|
||||
if(m->IsRaid() || m->IsHeroic())
|
||||
if (m->IsRaidOrHeroicDungeon())
|
||||
{
|
||||
if(cVictim->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||
((InstanceMap *)m)->PermBindAllPlayers(creditedPlayer);
|
||||
|
|
|
|||
|
|
@ -137,13 +137,18 @@ enum UnitStandStateType
|
|||
UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5,
|
||||
UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6,
|
||||
UNIT_STAND_STATE_DEAD = 7,
|
||||
UNIT_STAND_STATE_KNEEL = 8
|
||||
UNIT_STAND_STATE_KNEEL = 8,
|
||||
UNIT_STAND_STATE_SUBMERGED = 9
|
||||
};
|
||||
|
||||
// byte flag value (UNIT_FIELD_BYTES_1,2)
|
||||
enum UnitStandFlags
|
||||
{
|
||||
UNIT_STAND_FLAGS_UNK1 = 0x01,
|
||||
UNIT_STAND_FLAGS_CREEP = 0x02,
|
||||
UNIT_STAND_FLAGS_UNK3 = 0x04,
|
||||
UNIT_STAND_FLAGS_UNK4 = 0x08,
|
||||
UNIT_STAND_FLAGS_UNK5 = 0x10,
|
||||
UNIT_STAND_FLAGS_ALL = 0xFF
|
||||
};
|
||||
|
||||
|
|
@ -151,6 +156,7 @@ enum UnitStandFlags
|
|||
enum UnitBytes1_Flags
|
||||
{
|
||||
UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01,
|
||||
UNIT_BYTE1_FLAG_UNK_2 = 0x02,
|
||||
UNIT_BYTE1_FLAG_UNTRACKABLE = 0x04,
|
||||
UNIT_BYTE1_FLAG_ALL = 0xFF
|
||||
};
|
||||
|
|
@ -195,7 +201,7 @@ enum SheathState
|
|||
#define MAX_SHEATH_STATE 3
|
||||
|
||||
// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
|
||||
enum UnitBytes2_Flags
|
||||
enum UnitPVPStateFlags
|
||||
{
|
||||
UNIT_BYTE2_FLAG_PVP = 0x01,
|
||||
UNIT_BYTE2_FLAG_UNK1 = 0x02,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8
|
|||
LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
|
||||
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
|
||||
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)),
|
||||
_logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false),
|
||||
_logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_playerSave(false),
|
||||
m_latency(0), m_TutorialsChanged(false)
|
||||
{
|
||||
if (sock)
|
||||
|
|
@ -292,6 +292,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
HandleMoveWorldportAckOpcode();
|
||||
|
||||
m_playerLogout = true;
|
||||
m_playerSave = Save;
|
||||
|
||||
if (_player)
|
||||
{
|
||||
|
|
@ -454,6 +455,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
}
|
||||
|
||||
m_playerLogout = false;
|
||||
m_playerSave = false;
|
||||
m_playerRecentlyLogout = true;
|
||||
LogoutRequest(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
|
||||
bool PlayerLoading() const { return m_playerLoading; }
|
||||
bool PlayerLogout() const { return m_playerLogout; }
|
||||
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
|
||||
|
||||
|
||||
void SizeError(WorldPacket const& packet, uint32 size) const;
|
||||
|
||||
|
|
@ -751,6 +753,7 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
bool m_playerLoading; // code processed in LoginPlayer
|
||||
bool m_playerLogout; // code processed in LogoutPlayer
|
||||
bool m_playerRecentlyLogout;
|
||||
bool m_playerSave; // code processed in LogoutPlayer with save request
|
||||
LocaleConstant m_sessionDbcLocale;
|
||||
int m_sessionDbLocaleIndex;
|
||||
uint32 m_latency;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "BattleGroundMgr.h"
|
||||
#include <fstream>
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ extern int main(int argc, char **argv)
|
|||
sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
if (SSLeay() < 0x009080bfL )
|
||||
{
|
||||
sLog.outDetail("WARNING: Outdated version of OpenSSL lib. Logins to server impossible!");
|
||||
sLog.outDetail("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");
|
||||
sLog.outDetail("WARNING: Minimal required version [OpenSSL 0.9.8k]");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -414,12 +414,19 @@ bool Master::_StartDB()
|
|||
}
|
||||
|
||||
if(!WorldDatabase.CheckRequiredField("db_version",REVISION_DB_MANGOS))
|
||||
{
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
dbstring = sConfig.GetStringDefault("CharacterDatabaseInfo", "");
|
||||
if(dbstring.empty())
|
||||
{
|
||||
sLog.outError("Character Database not specified in configuration file");
|
||||
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
sLog.outString("Character Database: %s", dbstring.c_str());
|
||||
|
|
@ -428,17 +435,29 @@ bool Master::_StartDB()
|
|||
if(!CharacterDatabase.Initialize(dbstring.c_str()))
|
||||
{
|
||||
sLog.outError("Cannot connect to Character database %s",dbstring.c_str());
|
||||
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!CharacterDatabase.CheckRequiredField("character_db_version",REVISION_DB_CHARACTERS))
|
||||
{
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
CharacterDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get login database info from configuration file
|
||||
dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
|
||||
if(dbstring.empty())
|
||||
{
|
||||
sLog.outError("Login database not specified in configuration file");
|
||||
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
CharacterDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -447,17 +466,32 @@ bool Master::_StartDB()
|
|||
if(!loginDatabase.Initialize(dbstring.c_str()))
|
||||
{
|
||||
sLog.outError("Cannot connect to login database %s",dbstring.c_str());
|
||||
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
CharacterDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!loginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD))
|
||||
{
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
CharacterDatabase.HaltDelayThread();
|
||||
loginDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get the realm Id from the configuration file
|
||||
realmID = sConfig.GetIntDefault("RealmID", 0);
|
||||
if(!realmID)
|
||||
{
|
||||
sLog.outError("Realm ID not defined in configuration file");
|
||||
|
||||
///- Wait for already started DB delay threads to end
|
||||
WorldDatabase.HaltDelayThread();
|
||||
CharacterDatabase.HaltDelayThread();
|
||||
loginDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ extern int main(int argc, char **argv)
|
|||
sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
if (SSLeay() < 0x009080bfL )
|
||||
{
|
||||
sLog.outDetail("WARNING: Outdated version of OpenSSL lib. Logins to server impossible!");
|
||||
sLog.outDetail("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");
|
||||
sLog.outDetail("WARNING: Minimal required version [OpenSSL 0.9.8k]");
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,11 @@ bool StartDB()
|
|||
}
|
||||
|
||||
if(!loginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD))
|
||||
{
|
||||
///- Wait for already started DB delay threads to end
|
||||
loginDatabase.HaltDelayThread();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
|
|||
const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii";
|
||||
const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii";
|
||||
const char PageTextfmt[]="isi";
|
||||
const char InstanceTemplatesrcfmt[]="iiiiiiiffffs";
|
||||
const char InstanceTemplatedstfmt[]="iiiiiiiffffi";
|
||||
const char InstanceTemplatesrcfmt[]="iiiiffffs";
|
||||
const char InstanceTemplatedstfmt[]="iiiiffffi";
|
||||
|
||||
SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "entry","creature_template");
|
||||
SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt,"guid","creature_addon");
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ libmangosshared_a_SOURCES = \
|
|||
Util.h \
|
||||
WorldPacket.h \
|
||||
revision_nr.h \
|
||||
revision_sql.h \
|
||||
revision.h
|
||||
|
||||
# Get revision (git or svn)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8823"
|
||||
#define REVISION_NR "8840"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -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_8818_01_mangos_mangos_string"
|
||||
#define REVISION_DB_CHARACTERS "required_8828_01_characters_instance_reset"
|
||||
#define REVISION_DB_MANGOS "required_8840_01_mangos_spell_proc_event"
|
||||
#define REVISION_DB_REALMD "required_8728_01_realmd_account"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue