diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index 9dffa0048..57dc16b22 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -16,7 +16,23 @@ #include "loadlib/adt.h" #include "loadlib/wdt.h" +#include +#if defined( __GNUC__ ) + #define _open open + #define _close close + #ifndef O_BINARY + #define O_BINARY 0 + #endif +#else + #include +#endif + +#ifdef O_LARGEFILE + #define OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE) +#else + #define OPEN_FLAGS (O_RDONLY | O_BINARY) +#endif extern ArchiveSet gOpenArchives; typedef struct @@ -81,9 +97,10 @@ void CreateDir( const std::string& Path ) bool FileExists( const char* FileName ) { - if(FILE* fp = fopen( FileName, "rb" )) + int fp = _open(FileName, OPEN_FLAGS); + if(fp != -1) { - fclose(fp); + _close(fp); return true; } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index f38503e30..d9cb0880d 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -55,6 +55,7 @@ GameObject::GameObject() : WorldObject() m_goInfo = NULL; m_DBTableGuid = 0; + m_rotation = 0; } GameObject::~GameObject() @@ -120,8 +121,8 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa SetFloatValue(GAMEOBJECT_PARENTROTATION+0, rotation0); SetFloatValue(GAMEOBJECT_PARENTROTATION+1, rotation1); - SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); - SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rotation3); + + UpdateRotationFields(rotation2,rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3 SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); @@ -1296,3 +1297,31 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const return GetName(); } + +void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 /*=0.0f*/) +{ + int64 rotation = 0; + + double f_rot1 = sin(GetOrientation() / 2.0f); + int64 i_rot1 = int64(f_rot1 / atan(pow(2.0f, -20.0f))); + rotation |= (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; + + //float f_rot2 = sin(0.0f / 2.0f); + //int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f)); + //rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000; + + //float f_rot3 = sin(0.0f / 2.0f); + //int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f)); + //rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000; + + m_rotation = rotation; + + if(rotation2==0.0f && rotation3==0.0f) + { + rotation2 = sin(GetOrientation()/2); + rotation3 = cos(GetOrientation()/2); + } + + SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); + SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rotation3); +} diff --git a/src/game/GameObject.h b/src/game/GameObject.h index f34364bc5..bc19abf4c 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -441,6 +441,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } + void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); + void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); } @@ -577,6 +579,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject GridReference &GetGridRef() { return m_gridRef; } bool isActiveObject() const { return false; } + uint64 GetRotation() const { return m_rotation; } protected: uint32 m_charges; // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22) uint32 m_spellId; @@ -593,6 +596,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid GameObjectInfo const* m_goInfo; + uint64 m_rotation; private: void SwitchDoorOrButton(bool activate); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 200068aa1..f3fb36a6c 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -156,7 +156,7 @@ void InstanceSave::SaveToDB() // save instance data too std::string data; - Map *map = MapManager::Instance().FindMap(m_instanceid, GetMapId()); + Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid); if(map) { assert(map->IsDungeon()); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index fd97a033a..db016a1ce 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -511,7 +511,7 @@ bool ChatHandler::HandleGonameCommand(const char* args) // remember current position as entry point for return at bg end teleportation _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation()); } - else if(cMap->IsDungeon() && cMap->Instanceable()) + else if(cMap->IsDungeon()) { // we have to go to instance, and can go to player only if: // 1) we are in his group (either as leader or as member) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 297b4433a..a8f1d0c19 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1787,16 +1787,11 @@ bool ChatHandler::HandleTurnObjectCommand(const char* args) o = chr->GetOrientation(); } - float rot2 = sin(o/2); - float rot3 = cos(o/2); - Map* map = obj->GetMap(); map->Remove(obj,false); obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); - - obj->SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rot2); - obj->SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rot3); + obj->UpdateRotationFields(); map->Add(obj); @@ -3653,13 +3648,10 @@ bool ChatHandler::HandleGameObjectCommand(const char* args) float o = float(chr->GetOrientation()); Map *map = chr->GetMap(); - float rot2 = sin(o/2); - float rot3 = cos(o/2); - GameObject* pGameObj = new GameObject; uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0, 0, rot2, rot3, 0, 1)) + if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) { delete pGameObj; return false; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index f7d5ab2d6..ad9bb65d3 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2137,76 +2137,80 @@ bool InstanceMap::Add(Player *player) if(!CanEnter(player)) return false; - // get or create an instance save for the map - InstanceSave *mapSave = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); - if(!mapSave) + // Dungeon only code + if(IsDungeon()) { - sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); - mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), GetSpawnMode(), 0, true); - } - - // check for existing instance binds - InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), GetSpawnMode()); - if(playerBind && playerBind->perm) - { - // cannot enter other instances if bound permanently - if(playerBind->save != mapSave) + // get or create an instance save for the map + InstanceSave *mapSave = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); + if(!mapSave) { - sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); - assert(false); + sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); + mapSave = sInstanceSaveManager.AddInstanceSave(GetId(), GetInstanceId(), GetSpawnMode(), 0, true); } - } - else - { - Group *pGroup = player->GetGroup(); - if(pGroup) + + // check for existing instance binds + InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), GetSpawnMode()); + if(playerBind && playerBind->perm) { - // solo saves should be reset when entering a group - InstanceGroupBind *groupBind = pGroup->GetBoundInstance(GetId(), GetSpawnMode()); - if(playerBind) + // cannot enter other instances if bound permanently + if(playerBind->save != mapSave) { - sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); - if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); + sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); assert(false); } - // bind to the group or keep using the group save - if(!groupBind) - pGroup->BindToInstance(mapSave, false); - else - { - // cannot jump to a different instance without resetting it - if(groupBind->save != mapSave) - { - sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(pGroup->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); - if(mapSave) - sLog.outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); - else - sLog.outError("MapSave NULL"); - if(groupBind->save) - sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); - else - sLog.outError("GroupBind save NULL"); - assert(false); - } - // if the group/leader is permanently bound to the instance - // players also become permanently bound when they enter - if(groupBind->perm) - { - WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); - data << uint32(0); - player->GetSession()->SendPacket(&data); - player->BindToInstance(mapSave, true); - } - } } else { - // set up a solo bind or continue using it - if(!playerBind) - player->BindToInstance(mapSave, false); + Group *pGroup = player->GetGroup(); + if(pGroup) + { + // solo saves should be reset when entering a group + InstanceGroupBind *groupBind = pGroup->GetBoundInstance(GetId(), GetSpawnMode()); + if(playerBind) + { + sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); + if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); + assert(false); + } + // bind to the group or keep using the group save + if(!groupBind) + pGroup->BindToInstance(mapSave, false); + else + { + // cannot jump to a different instance without resetting it + if(groupBind->save != mapSave) + { + sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(pGroup->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); + if(mapSave) + sLog.outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); + else + sLog.outError("MapSave NULL"); + if(groupBind->save) + sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); + else + sLog.outError("GroupBind save NULL"); + assert(false); + } + // if the group/leader is permanently bound to the instance + // players also become permanently bound when they enter + if(groupBind->perm) + { + WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); + data << uint32(0); + player->GetSession()->SendPacket(&data); + player->BindToInstance(mapSave, true); + } + } + } else - // cannot jump to a different instance without resetting it - assert(playerBind->save == mapSave); + { + // set up a solo bind or continue using it + if(!playerBind) + player->BindToInstance(mapSave, false); + else + // cannot jump to a different instance without resetting it + assert(playerBind->save == mapSave); + } } } @@ -2327,6 +2331,9 @@ bool InstanceMap::Reset(uint8 method) void InstanceMap::PermBindAllPlayers(Player *player) { + if(!IsDungeon()) + return; + InstanceSave *save = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); if(!save) { @@ -2356,12 +2363,6 @@ void InstanceMap::PermBindAllPlayers(Player *player) } } -time_t InstanceMap::GetResetTime() -{ - InstanceSave *save = sInstanceSaveManager.GetInstanceSave(GetInstanceId()); - return save ? save->GetDifficulty() : DIFFICULTY_NORMAL; -} - void InstanceMap::UnloadAll(bool pForce) { if(HavePlayers()) @@ -2391,7 +2392,7 @@ 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(!HavePlayers() && !IsRaid() && !IsHeroic()) + if(IsDungeon() && !HavePlayers() && !IsRaid() && !IsHeroic()) { InstanceSave *save = sInstanceSaveManager.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()); diff --git a/src/game/Map.h b/src/game/Map.h index b40a46a4a..ca027b8ec 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -530,7 +530,6 @@ class MANGOS_DLL_SPEC InstanceMap : public Map uint32 GetScriptId() { return i_script_id; } InstanceData* GetInstanceData() { return i_data; } void PermBindAllPlayers(Player *player); - time_t GetResetTime(); void UnloadAll(bool pForce); bool CanEnter(Player* player); void SendResetWarnings(uint32 timeLeft) const; diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 172d4bd49..054172660 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -902,7 +902,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) if(decompressedSize == 0) // erase { - SetAccountData(type, timestamp, ""); + SetAccountData(type, 0, ""); WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4+4); data << uint32(type); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 271c15f0f..013d14f16 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -585,22 +585,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2 // 0x200 if(flags & UPDATEFLAG_UNK2) { - // may be precalculate it? - int64 rotation = 0; - float ang = ((WorldObject *)this)->GetOrientation(); - - float f_rot1 = sin(ang / 2.0f); - int64 i_rot1 = f_rot1 / atan(pow(2.0f, -20.0f)); - rotation |= (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; - - //float f_rot2 = sin(0.0f / 2.0f); - //int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f)); - //rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000; - - //float f_rot3 = sin(0.0f / 2.0f); - //int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f)); - //rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000; - *data << uint64(rotation); + *data << uint64(((GameObject*)this)->GetRotation()); } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 24253e6ff..bdf2b63a5 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1076,6 +1076,24 @@ void ObjectMgr::LoadGameobjects() int16 gameEvent = fields[16].GetInt16(); int16 PoolId = fields[17].GetInt16(); + if(data.rotation2 < -1.0f || data.rotation2 > 1.0f) + { + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip",guid,data.id,data.rotation2 ); + continue; + } + + if(data.rotation3 < -1.0f || data.rotation3 > 1.0f) + { + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip",guid,data.id,data.rotation3 ); + continue; + } + + if(!MapManager::IsValidMapCoord(data.mapid,data.posX,data.posY,data.posZ,data.orientation)) + { + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip",guid,data.id ); + continue; + } + if(data.phaseMask==0) { sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); @@ -2710,7 +2728,14 @@ void ObjectMgr::LoadGroups() } } - InstanceSave *save = sInstanceSaveManager.AddInstanceSave(fields[1].GetUInt32(), fields[2].GetUInt32(), fields[4].GetUInt8(), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); + MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32()); + if(!mapEntry || !mapEntry->IsDungeon()) + { + sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32()); + continue; + } + + InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), fields[4].GetUInt8(), (time_t)fields[5].GetUInt64(), (fields[6].GetUInt32() == 0), true); group->BindToInstance(save, fields[3].GetBool(), true); }while( result->NextRow() ); delete result; diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 65963ae44..a94c2daf6 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1251,4 +1251,6 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4C6*/ { "UMSG_UNKNOWN_1222", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x4C7*/ { "SMSG_UNKNOWN_1223", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x4C8*/ { "SMSG_UNKNOWN_1224", STATUS_NEVER, &WorldSession::Handle_ServerSide }, + /*0x4C9*/ { "UMSG_UNKNOWN_1225", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x4CA*/ { "UMSG_UNKNOWN_1226", STATUS_NEVER, &WorldSession::Handle_NULL }, }; diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index ad6ad7b4a..38730c065 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1257,9 +1257,11 @@ enum Opcodes UMSG_UNKNOWN_1220 = 0x4C4, // not found UMSG_UNKNOWN_1221 = 0x4C5, // not found UMSG_UNKNOWN_1222 = 0x4C6, // not found - SMSG_UNKNOWN_1223 = 0x4C7, // arena pet? + SMSG_UNKNOWN_1223 = 0x4C7, // uint64, arena pet? SMSG_UNKNOWN_1224 = 0x4C8, // uint32 "Can't change arena team..." - NUM_MSG_TYPES = 0x4C9 + UMSG_UNKNOWN_1225 = 0x4C9, // not found + UMSG_UNKNOWN_1226 = 0x4CA, // not found + NUM_MSG_TYPES = 0x4CB }; /// Player state diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 01404bd7c..c47b15274 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3529,7 +3529,7 @@ void Player::InitVisibleBits() // item entry updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENTRYID + offset); // enchant - updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_PERMANENTENCHANTMENT + offset); + updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + offset); } updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE); @@ -3554,7 +3554,7 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { if(m_items[i] == NULL) continue; @@ -3587,7 +3587,7 @@ void Player::DestroyForPlayer( Player *target ) const m_items[i]->DestroyForPlayer( target ); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { if(m_items[i] == NULL) continue; @@ -8315,10 +8315,10 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap slots[0] = EQUIPMENT_SLOT_RANGED; break; case INVTYPE_BAG: - slots[0] = INVENTORY_SLOT_BAG_1; - slots[1] = INVENTORY_SLOT_BAG_2; - slots[2] = INVENTORY_SLOT_BAG_3; - slots[3] = INVENTORY_SLOT_BAG_4; + slots[0] = INVENTORY_SLOT_BAG_START + 0; + slots[1] = INVENTORY_SLOT_BAG_START + 1; + slots[2] = INVENTORY_SLOT_BAG_START + 2; + slots[3] = INVENTORY_SLOT_BAG_START + 3; break; case INVTYPE_RELIC: { @@ -8420,7 +8420,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const return EQUIP_ERR_OK; } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8462,7 +8462,7 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) @@ -8522,7 +8522,7 @@ Item* Player::GetItemByGuid( uint64 guid ) const if( pItem && pItem->GetGUID() == guid ) return pItem; } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetGUID() == guid ) @@ -8568,7 +8568,7 @@ Item* Player::GetItemByPos( uint16 pos ) const Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const { - if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < QUESTBAG_SLOT_END ) ) + if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) return m_items[slot]; else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END || bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) @@ -8646,7 +8646,7 @@ bool Player::IsInventoryPos( uint8 bag, uint8 slot ) return true; if( bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END ) return true; - if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < QUESTBAG_SLOT_END ) ) + if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) return true; return false; } @@ -8767,7 +8767,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8934,7 +8934,7 @@ bool Player::HasItemTotemCategory( uint32 TotemCategory ) const if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) return true; } - for(uint8 i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory )) @@ -8974,18 +8974,10 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV if(slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // vanitypet case (not use, vanity pets stored as spells) - if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END) - return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // currencytoken case (disabled until proper implement) if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS*/)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // guestbag case (disabled until proper implement) - if(slot >= QUESTBAG_SLOT_START && slot < QUESTBAG_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS*/)) - return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // prevent cheating if(slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END || slot >= PLAYER_SLOT_END) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; @@ -9231,7 +9223,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 { if( bag == INVENTORY_SLOT_BAG_0 ) // inventory { - res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,true,pItem,bag,slot); + res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) { if(no_space_count) @@ -9319,8 +9311,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - // Vanity pet case skipped as not used - /* until proper implementation else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9343,28 +9333,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } */ - /* until proper implementation - else if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; - - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9414,7 +9382,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 // search stack for merge to if( pProto->Stackable != 1 ) { - res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,true,pItem,bag,slot); + res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) { if(no_space_count) @@ -9513,8 +9481,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - // Vanity pet case skipped as not used - /* until proper implementation else if(false pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9537,28 +9503,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } */ - /* until proper implementation - else if(false pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; - - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { @@ -9630,13 +9574,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const int inv_bags[INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; int inv_keys[KEYRING_SLOT_END-KEYRING_SLOT_START]; int inv_tokens[CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START]; - int inv_quests[QUESTBAG_SLOT_END-QUESTBAG_SLOT_START]; memset(inv_slot_items,0,sizeof(int)*(INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START)); memset(inv_bags,0,sizeof(int)*(INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START)*MAX_BAG_SIZE); memset(inv_keys,0,sizeof(int)*(KEYRING_SLOT_END-KEYRING_SLOT_START)); memset(inv_tokens,0,sizeof(int)*(CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START)); - memset(inv_quests,0,sizeof(int)*(QUESTBAG_SLOT_END-QUESTBAG_SLOT_START)); for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { @@ -9658,8 +9600,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - // Vanity pet case skipped as not used - for(int i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9670,16 +9610,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = QUESTBAG_SLOT_START; i < QUESTBAG_SLOT_END; i++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - - if (pItem2 && !pItem2->IsInTrade()) - { - inv_quests[i-QUESTBAG_SLOT_START] = pItem2->GetCount(); - } - } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) @@ -9739,8 +9669,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - // Vanity pet case skipped as not used - for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; t++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); @@ -9753,18 +9681,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; t++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_quests[t-QUESTBAG_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) - { - inv_quests[t-QUESTBAG_SLOT_START] += pItem->GetCount(); - b_found = true; - break; - } - } - if (b_found) continue; - for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; t++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); @@ -9817,8 +9733,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; - // Vanity pet case skipped as not used - /* until proper implementation if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9833,22 +9747,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - if (b_found) continue; - */ - /* until proper implementation - if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - for(uint32 t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; ++t) - { - if( inv_quests[t-QUESTBAG_SLOT_START] == 0 ) - { - inv_quests[t-QUESTBAG_SLOT_START] = 1; - b_found = true; - break; - } - } - } - if (b_found) continue; */ @@ -10708,12 +10606,12 @@ void Player::SetVisibleItemSlot(uint8 slot, Item *pItem) if(pItem) { SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), pItem->GetEntry()); - SetUInt32Value(PLAYER_VISIBLE_ITEM_1_PERMANENTENCHANTMENT + (slot * 2), pItem->GetEnchantmentId(EnchantmentSlot(0))); + SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), pItem->GetEnchantmentId(EnchantmentSlot(0))); } else { SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), 0); - SetUInt32Value(PLAYER_VISIBLE_ITEM_1_PERMANENTENCHANTMENT + (slot * 2), 0); + SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0); } } @@ -10949,7 +10847,8 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq } } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -11054,7 +10953,7 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); @@ -12172,7 +12071,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a // visualize enchantment at player and equipped items if(slot == PERM_ENCHANTMENT_SLOT) { - SetUInt32Value(PLAYER_VISIBLE_ITEM_1_PERMANENTENCHANTMENT + (item->GetSlot() * 2), apply ? item->GetEnchantmentId(slot) : 0); + SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), apply ? item->GetEnchantmentId(slot) : 0); } if(apply_dur) @@ -15446,6 +15345,14 @@ void Player::_LoadBoundInstances(QueryResult *result) // so the value read from the DB may be wrong here but only if the InstanceSave is loaded // and in that case it is not used + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + if(!mapEntry || !mapEntry->IsDungeon()) + { + sLog.outError("_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName(), GetGUIDLow(), mapId); + CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId); + continue; + } + if(!perm && group) { sLog.outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d,%d,%d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetLeaderGUID()), mapId, instanceId, difficulty); diff --git a/src/game/Player.h b/src/game/Player.h index fc000230d..5bb1c594a 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -560,11 +560,13 @@ enum PlayerSlots // first slot for item stored (in any way in player m_items data) PLAYER_SLOT_START = 0, // last+1 slot for item stored (in any way in player m_items data) - PLAYER_SLOT_END = 200, + PLAYER_SLOT_END = 150, PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START) }; -enum EquipmentSlots +#define INVENTORY_SLOT_BAG_0 255 + +enum EquipmentSlots // 19 slots { EQUIPMENT_SLOT_START = 0, EQUIPMENT_SLOT_HEAD = 0, @@ -591,119 +593,45 @@ enum EquipmentSlots enum InventorySlots { - INVENTORY_SLOT_BAG_0 = 255, - INVENTORY_SLOT_BAG_START = 19, - INVENTORY_SLOT_BAG_1 = 19, - INVENTORY_SLOT_BAG_2 = 20, - INVENTORY_SLOT_BAG_3 = 21, - INVENTORY_SLOT_BAG_4 = 22, - INVENTORY_SLOT_BAG_END = 23, + INVENTORY_SLOT_BAG_START = 19, // 4 slots + INVENTORY_SLOT_BAG_END = 23 +}; - INVENTORY_SLOT_ITEM_START = 23, - INVENTORY_SLOT_ITEM_1 = 23, - INVENTORY_SLOT_ITEM_2 = 24, - INVENTORY_SLOT_ITEM_3 = 25, - INVENTORY_SLOT_ITEM_4 = 26, - INVENTORY_SLOT_ITEM_5 = 27, - INVENTORY_SLOT_ITEM_6 = 28, - INVENTORY_SLOT_ITEM_7 = 29, - INVENTORY_SLOT_ITEM_8 = 30, - INVENTORY_SLOT_ITEM_9 = 31, - INVENTORY_SLOT_ITEM_10 = 32, - INVENTORY_SLOT_ITEM_11 = 33, - INVENTORY_SLOT_ITEM_12 = 34, - INVENTORY_SLOT_ITEM_13 = 35, - INVENTORY_SLOT_ITEM_14 = 36, - INVENTORY_SLOT_ITEM_15 = 37, - INVENTORY_SLOT_ITEM_16 = 38, +enum InventoryPackSlots +{ + INVENTORY_SLOT_ITEM_START = 23, // 16 slots INVENTORY_SLOT_ITEM_END = 39 }; -enum BankSlots +enum BankItemSlots { - BANK_SLOT_ITEM_START = 39, - BANK_SLOT_ITEM_1 = 39, - BANK_SLOT_ITEM_2 = 40, - BANK_SLOT_ITEM_3 = 41, - BANK_SLOT_ITEM_4 = 42, - BANK_SLOT_ITEM_5 = 43, - BANK_SLOT_ITEM_6 = 44, - BANK_SLOT_ITEM_7 = 45, - BANK_SLOT_ITEM_8 = 46, - BANK_SLOT_ITEM_9 = 47, - BANK_SLOT_ITEM_10 = 48, - BANK_SLOT_ITEM_11 = 49, - BANK_SLOT_ITEM_12 = 50, - BANK_SLOT_ITEM_13 = 51, - BANK_SLOT_ITEM_14 = 52, - BANK_SLOT_ITEM_15 = 53, - BANK_SLOT_ITEM_16 = 54, - BANK_SLOT_ITEM_17 = 55, - BANK_SLOT_ITEM_18 = 56, - BANK_SLOT_ITEM_19 = 57, - BANK_SLOT_ITEM_20 = 58, - BANK_SLOT_ITEM_21 = 59, - BANK_SLOT_ITEM_22 = 60, - BANK_SLOT_ITEM_23 = 61, - BANK_SLOT_ITEM_24 = 62, - BANK_SLOT_ITEM_25 = 63, - BANK_SLOT_ITEM_26 = 64, - BANK_SLOT_ITEM_27 = 65, - BANK_SLOT_ITEM_28 = 66, - BANK_SLOT_ITEM_END = 67, + BANK_SLOT_ITEM_START = 39, // 28 slots + BANK_SLOT_ITEM_END = 67 +}; - BANK_SLOT_BAG_START = 67, - BANK_SLOT_BAG_1 = 67, - BANK_SLOT_BAG_2 = 68, - BANK_SLOT_BAG_3 = 69, - BANK_SLOT_BAG_4 = 70, - BANK_SLOT_BAG_5 = 71, - BANK_SLOT_BAG_6 = 72, - BANK_SLOT_BAG_7 = 73, +enum BankBagSlots +{ + BANK_SLOT_BAG_START = 67, // 7 slots BANK_SLOT_BAG_END = 74 }; -enum BuyBackSlots +enum BuyBackSlots // 12 slots { // stored in m_buybackitems BUYBACK_SLOT_START = 74, - BUYBACK_SLOT_1 = 74, - BUYBACK_SLOT_2 = 75, - BUYBACK_SLOT_3 = 76, - BUYBACK_SLOT_4 = 77, - BUYBACK_SLOT_5 = 78, - BUYBACK_SLOT_6 = 79, - BUYBACK_SLOT_7 = 80, - BUYBACK_SLOT_8 = 81, - BUYBACK_SLOT_9 = 82, - BUYBACK_SLOT_10 = 83, - BUYBACK_SLOT_11 = 84, - BUYBACK_SLOT_12 = 85, BUYBACK_SLOT_END = 86 }; -enum KeyRingSlots +enum KeyRingSlots // 32 slots { KEYRING_SLOT_START = 86, KEYRING_SLOT_END = 118 }; -enum VanityPetSlots +enum CurrencyTokenSlots // 32 slots { - VANITYPET_SLOT_START = 118, // not use, vanity pets stored as spells - VANITYPET_SLOT_END = 136 // not alloed any content in. -}; - -enum CurrencyTokenSlots -{ - CURRENCYTOKEN_SLOT_START = 136, - CURRENCYTOKEN_SLOT_END = 168 -}; - -enum QuestBagSlots -{ - QUESTBAG_SLOT_START = 168, - QUESTBAG_SLOT_END = 200 + CURRENCYTOKEN_SLOT_START = 118, + CURRENCYTOKEN_SLOT_END = 150 }; enum EquipmentSetUpdateState @@ -751,15 +679,19 @@ enum TradeSlots enum TransferAbortReason { - TRANSFER_ABORT_ERROR = 0x00, - TRANSFER_ABORT_MAX_PLAYERS = 0x01, // Transfer Aborted: instance is full - TRANSFER_ABORT_NOT_FOUND = 0x02, // Transfer Aborted: instance not found - TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x03, // You have entered too many instances recently. - TRANSFER_ABORT_ZONE_IN_COMBAT = 0x05, // Unable to zone in while an encounter is in progress. - TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x06, // You must have expansion installed to access this area. - TRANSFER_ABORT_DIFFICULTY = 0x07, // difficulty mode is not available for %s. - TRANSFER_ABORT_UNIQUE_MESSAGE = 0x08, // Until you've escaped TLK's grasp, you cannot leave this place! - TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x09 // Additional instances cannot be launched, please try again later. + TRANSFER_ABORT_NONE = 0x00, + TRANSFER_ABORT_ERROR = 0x01, + TRANSFER_ABORT_MAX_PLAYERS = 0x02, // Transfer Aborted: instance is full + TRANSFER_ABORT_NOT_FOUND = 0x03, // Transfer Aborted: instance not found + TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x04, // You have entered too many instances recently. + TRANSFER_ABORT_ZONE_IN_COMBAT = 0x06, // Unable to zone in while an encounter is in progress. + TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x07, // You must have expansion installed to access this area. + TRANSFER_ABORT_DIFFICULTY = 0x08, // difficulty mode is not available for %s. + TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place! + TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later. + TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1 + TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 + TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 }; enum InstanceResetWarningType @@ -799,11 +731,6 @@ struct MovementInfo x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_unk = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f; t_guid = 0; } - - void SetMovementFlags(uint32 _flags) - { - flags = _flags; - } }; // flags that use in movement check for example at spell casting diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9c9e40eb3..c17afd8a2 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1489,8 +1489,13 @@ void Aura::TriggerSpell() // case 27746: break; // // Steam Tank Passive // case 27747: break; -// // Frost Blast -// case 27808: break; + // Frost Blast + case 27808: + { + int32 bpDamage = target->GetMaxHealth()*26/100; + caster->CastCustomSpell(target,29879,&bpDamage,NULL,NULL,true,NULL,this); + return; + } // // Detonate Mana // case 27819: break; // // Controller Timer diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index aaa0ed905..c4d405160 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -796,7 +796,7 @@ void Spell::EffectDummy(uint32 i) // create before death for get proper coordinates if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), - creatureTarget->GetOrientation(), 0, 0, 0, 0, 100, 1) ) + creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1) ) { delete pGameObj; return; @@ -4590,7 +4590,7 @@ void Spell::EffectSummonObjectWild(uint32 i) Map *map = target->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, - m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0, 0, 0, 0, 100, 1)) + m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) { delete pGameObj; return; @@ -4638,7 +4638,7 @@ void Spell::EffectSummonObjectWild(uint32 i) { GameObject* linkedGO = new GameObject; if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map, - m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0, 0, 0, 0, 100, 1)) + m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); linkedGO->SetSpellId(m_spellInfo->Id); @@ -5263,7 +5263,7 @@ void Spell::EffectDuel(uint32 i) m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 , m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 , m_caster->GetPositionZ(), - m_caster->GetOrientation(), 0, 0, 0, 0, 0, 1)) + m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) { delete pGameObj; return; @@ -5639,9 +5639,6 @@ void Spell::EffectSummonObject(uint32 i) GameObject* pGameObj = new GameObject; - float rot2 = sin(m_caster->GetOrientation()/2); - float rot3 = cos(m_caster->GetOrientation()/2); - float x,y,z; // If dest location if present if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) @@ -5656,7 +5653,7 @@ void Spell::EffectSummonObject(uint32 i) Map *map = m_caster->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, - m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0, 0, rot2, rot3, 0, 1)) + m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, 1)) { delete pGameObj; return; @@ -6246,7 +6243,7 @@ void Spell::EffectTransmitted(uint32 effIndex) GameObject* pGameObj = new GameObject; if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, - m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0, 0, 0, 0, 100, 1)) + m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) { delete pGameObj; return; @@ -6259,10 +6256,6 @@ void Spell::EffectTransmitted(uint32 effIndex) case GAMEOBJECT_TYPE_FISHINGNODE: { m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,pGameObj->GetGUID()); - // Orientation3 - pGameObj->SetFloatValue(GAMEOBJECT_PARENTROTATION + 2, 0.88431775569915771 ); - // Orientation4 - pGameObj->SetFloatValue(GAMEOBJECT_PARENTROTATION + 3, -0.4668855369091033 ); m_caster->AddGameObject(pGameObj); // will removed at spell cancel // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) @@ -6317,7 +6310,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { GameObject* linkedGO = new GameObject; if(linkedGO->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap, - m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0, 0, 0, 0, 100, 1)) + m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, 1)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); @@ -6386,26 +6379,55 @@ void Spell::EffectSkill(uint32 /*i*/) void Spell::EffectSummonDemon(uint32 i) { - float px = m_targets.m_destX; - float py = m_targets.m_destY; - float pz = m_targets.m_destZ; + // select center of summon position + float center_x = m_targets.m_destX; + float center_y = m_targets.m_destY; + float center_z = m_targets.m_destZ; - Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], px, py, pz, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,3600000); - if (!Charmed) - return; + float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - // might not always work correctly, maybe the creature that dies from CoD casts the effect on itself and is therefore the caster? - Charmed->SetLevel(m_caster->getLevel()); + int32 amount = damage > 0 ? damage : 1; - // TODO: Add damage/mana/hp according to level - - if (m_spellInfo->EffectMiscValue[i] == 89) // Inferno summon + for(int32 count = 0; count < amount; ++count) { - // Enslave demon effect, without mana cost and cooldown - m_caster->CastSpell(Charmed, 20882, true); // FIXME: enslave does not scale with level, level 62+ minions cannot be enslaved + float px, py, pz; + // If dest location if present + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + { + // Summon 1 unit in dest location + if (count == 0) + { + px = m_targets.m_destX; + py = m_targets.m_destY; + pz = m_targets.m_destZ; + } + // Summon in random point all other units if location present + else + m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz); + } + // Summon if dest location not present near caster + else + m_caster->GetClosePoint(px,py,pz,3.0f); - // Inferno effect - Charmed->CastSpell(Charmed, 22703, true, 0); + int32 duration = GetSpellDuration(m_spellInfo); + + Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], px, py, pz, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,duration); + if (!Charmed) // something fatal, not attempt more + return; + + // might not always work correctly, maybe the creature that dies from CoD casts the effect on itself and is therefore the caster? + Charmed->SetLevel(m_caster->getLevel()); + + // TODO: Add damage/mana/hp according to level + + if (m_spellInfo->EffectMiscValue[i] == 89) // Inferno summon + { + // Enslave demon effect, without mana cost and cooldown + m_caster->CastSpell(Charmed, 20882, true); // FIXME: enslave does not scale with level, level 62+ minions cannot be enslaved + + // Inferno effect + Charmed->CastSpell(Charmed, 22703, true, 0); + } } } diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index b1d88b420..6771cc7d5 100644 --- a/src/game/UpdateFields.h +++ b/src/game/UpdateFields.h @@ -19,7 +19,7 @@ #ifndef _UPDATEFIELDS_AUTO_H #define _UPDATEFIELDS_AUTO_H -// Auto generated for version 0, 1, 0, 9684 +// Auto generated for version 0, 1, 0, 9704 enum EObjectFields { @@ -285,43 +285,43 @@ enum EUnitFields PLAYER_QUEST_LOG_25_3 = UNIT_END + 0x006C, // Size: 1, Type: BYTES, Flags: PRIVATE PLAYER_QUEST_LOG_25_4 = UNIT_END + 0x006D, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_VISIBLE_ITEM_1_ENTRYID = UNIT_END + 0x006E, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_1_PERMANENTENCHANTMENT = UNIT_END + 0x006F, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_1_ENCHANTMENT = UNIT_END + 0x006F, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_2_ENTRYID = UNIT_END + 0x0070, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_2_PERMANENTENCHANTMENT = UNIT_END + 0x0071, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_2_ENCHANTMENT = UNIT_END + 0x0071, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_3_ENTRYID = UNIT_END + 0x0072, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_3_PERMANENTENCHANTMENT = UNIT_END + 0x0073, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_3_ENCHANTMENT = UNIT_END + 0x0073, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_4_ENTRYID = UNIT_END + 0x0074, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_4_PERMANENTENCHANTMENT = UNIT_END + 0x0075, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_4_ENCHANTMENT = UNIT_END + 0x0075, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_5_ENTRYID = UNIT_END + 0x0076, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_5_PERMANENTENCHANTMENT = UNIT_END + 0x0077, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_5_ENCHANTMENT = UNIT_END + 0x0077, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_6_ENTRYID = UNIT_END + 0x0078, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_6_PERMANENTENCHANTMENT = UNIT_END + 0x0079, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_6_ENCHANTMENT = UNIT_END + 0x0079, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_7_ENTRYID = UNIT_END + 0x007A, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_7_PERMANENTENCHANTMENT = UNIT_END + 0x007B, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_7_ENCHANTMENT = UNIT_END + 0x007B, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_8_ENTRYID = UNIT_END + 0x007C, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_8_PERMANENTENCHANTMENT = UNIT_END + 0x007D, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_8_ENCHANTMENT = UNIT_END + 0x007D, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_9_ENTRYID = UNIT_END + 0x007E, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_9_PERMANENTENCHANTMENT = UNIT_END + 0x007F, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_9_ENCHANTMENT = UNIT_END + 0x007F, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_10_ENTRYID = UNIT_END + 0x0080, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_10_PERMANENTENCHANTMENT = UNIT_END + 0x0081, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_10_ENCHANTMENT = UNIT_END + 0x0081, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_11_ENTRYID = UNIT_END + 0x0082, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_11_PERMANENTENCHANTMENT = UNIT_END + 0x0083, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_11_ENCHANTMENT = UNIT_END + 0x0083, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_12_ENTRYID = UNIT_END + 0x0084, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_12_PERMANENTENCHANTMENT = UNIT_END + 0x0085, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_12_ENCHANTMENT = UNIT_END + 0x0085, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_13_ENTRYID = UNIT_END + 0x0086, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_13_PERMANENTENCHANTMENT = UNIT_END + 0x0087, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_13_ENCHANTMENT = UNIT_END + 0x0087, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_14_ENTRYID = UNIT_END + 0x0088, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_14_PERMANENTENCHANTMENT = UNIT_END + 0x0089, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_14_ENCHANTMENT = UNIT_END + 0x0089, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_15_ENTRYID = UNIT_END + 0x008A, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_15_PERMANENTENCHANTMENT = UNIT_END + 0x008B, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_15_ENCHANTMENT = UNIT_END + 0x008B, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_16_ENTRYID = UNIT_END + 0x008C, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_16_PERMANENTENCHANTMENT = UNIT_END + 0x008D, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_16_ENCHANTMENT = UNIT_END + 0x008D, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_17_ENTRYID = UNIT_END + 0x008E, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_17_PERMANENTENCHANTMENT = UNIT_END + 0x008F, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_17_ENCHANTMENT = UNIT_END + 0x008F, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_18_ENTRYID = UNIT_END + 0x0090, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_18_PERMANENTENCHANTMENT = UNIT_END + 0x0091, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_18_ENCHANTMENT = UNIT_END + 0x0091, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_VISIBLE_ITEM_19_ENTRYID = UNIT_END + 0x0092, // Size: 1, Type: INT, Flags: PUBLIC - PLAYER_VISIBLE_ITEM_19_PERMANENTENCHANTMENT = UNIT_END + 0x0093, // Size: 1, Type: INT, Flags: PUBLIC + PLAYER_VISIBLE_ITEM_19_ENCHANTMENT = UNIT_END + 0x0093, // Size: 1, Type: TWO_SHORT, Flags: PUBLIC PLAYER_CHOSEN_TITLE = UNIT_END + 0x0094, // Size: 1, Type: INT, Flags: PUBLIC PLAYER_FIELD_PAD_0 = UNIT_END + 0x0095, // Size: 1, Type: INT, Flags: NONE PLAYER_FIELD_INV_SLOT_HEAD = UNIT_END + 0x0096, // Size: 46, Type: LONG, Flags: PRIVATE @@ -330,64 +330,62 @@ enum EUnitFields PLAYER_FIELD_BANKBAG_SLOT_1 = UNIT_END + 0x011C, // Size: 14, Type: LONG, Flags: PRIVATE PLAYER_FIELD_VENDORBUYBACK_SLOT_1 = UNIT_END + 0x012A, // Size: 24, Type: LONG, Flags: PRIVATE PLAYER_FIELD_KEYRING_SLOT_1 = UNIT_END + 0x0142, // Size: 64, Type: LONG, Flags: PRIVATE - PLAYER_FIELD_VANITYPET_SLOT_1 = UNIT_END + 0x0182, // Size: 36, Type: LONG, Flags: PRIVATE - PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 = UNIT_END + 0x01A6, // Size: 64, Type: LONG, Flags: PRIVATE - PLAYER_FIELD_QUESTBAG_SLOT_1 = UNIT_END + 0x01E6, // Size: 64, Type: LONG, Flags: PRIVATE - PLAYER_FARSIGHT = UNIT_END + 0x0226, // Size: 2, Type: LONG, Flags: PRIVATE - PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x0228, // Size: 2, Type: LONG, Flags: PRIVATE - PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x022A, // Size: 2, Type: LONG, Flags: PRIVATE - PLAYER_FIELD_KNOWN_CURRENCIES = UNIT_END + 0x022C, // Size: 2, Type: LONG, Flags: PRIVATE - PLAYER_XP = UNIT_END + 0x022E, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x022F, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_SKILL_INFO_1_1 = UNIT_END + 0x0230, // Size: 384, Type: TWO_SHORT, Flags: PRIVATE - PLAYER_CHARACTER_POINTS1 = UNIT_END + 0x03B0, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_CHARACTER_POINTS2 = UNIT_END + 0x03B1, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_TRACK_CREATURES = UNIT_END + 0x03B2, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_TRACK_RESOURCES = UNIT_END + 0x03B3, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_BLOCK_PERCENTAGE = UNIT_END + 0x03B4, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_DODGE_PERCENTAGE = UNIT_END + 0x03B5, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_PARRY_PERCENTAGE = UNIT_END + 0x03B6, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_EXPERTISE = UNIT_END + 0x03B7, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_OFFHAND_EXPERTISE = UNIT_END + 0x03B8, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_CRIT_PERCENTAGE = UNIT_END + 0x03B9, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_RANGED_CRIT_PERCENTAGE = UNIT_END + 0x03BA, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_OFFHAND_CRIT_PERCENTAGE = UNIT_END + 0x03BB, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_SPELL_CRIT_PERCENTAGE1 = UNIT_END + 0x03BC, // Size: 7, Type: FLOAT, Flags: PRIVATE - PLAYER_SHIELD_BLOCK = UNIT_END + 0x03C3, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE = UNIT_END + 0x03C4, // Size: 1, Type: FLOAT, Flags: PRIVATE - PLAYER_EXPLORED_ZONES_1 = UNIT_END + 0x03C5, // Size: 128, Type: BYTES, Flags: PRIVATE - PLAYER_REST_STATE_EXPERIENCE = UNIT_END + 0x0445, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_COINAGE = UNIT_END + 0x0446, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_DAMAGE_DONE_POS = UNIT_END + 0x0447, // Size: 7, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_DAMAGE_DONE_NEG = UNIT_END + 0x044E, // Size: 7, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_DAMAGE_DONE_PCT = UNIT_END + 0x0455, // Size: 7, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_HEALING_DONE_POS = UNIT_END + 0x045C, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x045D, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE = UNIT_END + 0x045E, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BYTES = UNIT_END + 0x045F, // Size: 1, Type: BYTES, Flags: PRIVATE - PLAYER_AMMO_ID = UNIT_END + 0x0460, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_SELF_RES_SPELL = UNIT_END + 0x0461, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x0462, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x0463, // Size: 12, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x046F, // Size: 12, Type: INT, Flags: PRIVATE - PLAYER_FIELD_KILLS = UNIT_END + 0x047B, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE - PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x047C, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x047D, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x047E, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_BYTES2 = UNIT_END + 0x047F, // Size: 1, Type: BYTES, Flags: PRIVATE - PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x0480, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x0481, // Size: 25, Type: INT, Flags: PRIVATE - PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x049A, // Size: 18, Type: INT, Flags: PRIVATE - PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x04AC, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x04AD, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x04AE, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x04AF, // Size: 25, Type: INT, Flags: PRIVATE - PLAYER_RUNE_REGEN_1 = UNIT_END + 0x04C8, // Size: 4, Type: FLOAT, Flags: PRIVATE - PLAYER_NO_REAGENT_COST_1 = UNIT_END + 0x04CC, // Size: 3, Type: INT, Flags: PRIVATE - PLAYER_FIELD_GLYPH_SLOTS_1 = UNIT_END + 0x04CF, // Size: 6, Type: INT, Flags: PRIVATE - PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x04D5, // Size: 6, Type: INT, Flags: PRIVATE - PLAYER_GLYPHS_ENABLED = UNIT_END + 0x04DB, // Size: 1, Type: INT, Flags: PRIVATE - PLAYER_END = UNIT_END + 0x04DC, + PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 = UNIT_END + 0x0182, // Size: 64, Type: LONG, Flags: PRIVATE + PLAYER_FARSIGHT = UNIT_END + 0x01C2, // Size: 2, Type: LONG, Flags: PRIVATE + PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x01C4, // Size: 2, Type: LONG, Flags: PRIVATE + PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x01C6, // Size: 2, Type: LONG, Flags: PRIVATE + PLAYER_FIELD_KNOWN_CURRENCIES = UNIT_END + 0x01C8, // Size: 2, Type: LONG, Flags: PRIVATE + PLAYER_XP = UNIT_END + 0x01CA, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x01CB, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_SKILL_INFO_1_1 = UNIT_END + 0x01CC, // Size: 384, Type: TWO_SHORT, Flags: PRIVATE + PLAYER_CHARACTER_POINTS1 = UNIT_END + 0x034C, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_CHARACTER_POINTS2 = UNIT_END + 0x034D, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_TRACK_CREATURES = UNIT_END + 0x034E, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_TRACK_RESOURCES = UNIT_END + 0x034F, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_BLOCK_PERCENTAGE = UNIT_END + 0x0350, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_DODGE_PERCENTAGE = UNIT_END + 0x0351, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_PARRY_PERCENTAGE = UNIT_END + 0x0352, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_EXPERTISE = UNIT_END + 0x0353, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_OFFHAND_EXPERTISE = UNIT_END + 0x0354, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_CRIT_PERCENTAGE = UNIT_END + 0x0355, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_RANGED_CRIT_PERCENTAGE = UNIT_END + 0x0356, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_OFFHAND_CRIT_PERCENTAGE = UNIT_END + 0x0357, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_SPELL_CRIT_PERCENTAGE1 = UNIT_END + 0x0358, // Size: 7, Type: FLOAT, Flags: PRIVATE + PLAYER_SHIELD_BLOCK = UNIT_END + 0x035F, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE = UNIT_END + 0x0360, // Size: 1, Type: FLOAT, Flags: PRIVATE + PLAYER_EXPLORED_ZONES_1 = UNIT_END + 0x0361, // Size: 128, Type: BYTES, Flags: PRIVATE + PLAYER_REST_STATE_EXPERIENCE = UNIT_END + 0x03E1, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_COINAGE = UNIT_END + 0x03E2, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_DAMAGE_DONE_POS = UNIT_END + 0x03E3, // Size: 7, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_DAMAGE_DONE_NEG = UNIT_END + 0x03EA, // Size: 7, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_DAMAGE_DONE_PCT = UNIT_END + 0x03F1, // Size: 7, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_HEALING_DONE_POS = UNIT_END + 0x03F8, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_TARGET_RESISTANCE = UNIT_END + 0x03F9, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE = UNIT_END + 0x03FA, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BYTES = UNIT_END + 0x03FB, // Size: 1, Type: BYTES, Flags: PRIVATE + PLAYER_AMMO_ID = UNIT_END + 0x03FC, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_SELF_RES_SPELL = UNIT_END + 0x03FD, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_PVP_MEDALS = UNIT_END + 0x03FE, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BUYBACK_PRICE_1 = UNIT_END + 0x03FF, // Size: 12, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BUYBACK_TIMESTAMP_1 = UNIT_END + 0x040B, // Size: 12, Type: INT, Flags: PRIVATE + PLAYER_FIELD_KILLS = UNIT_END + 0x0417, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE + PLAYER_FIELD_TODAY_CONTRIBUTION = UNIT_END + 0x0418, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_YESTERDAY_CONTRIBUTION = UNIT_END + 0x0419, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_LIFETIME_HONORBALE_KILLS = UNIT_END + 0x041A, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_BYTES2 = UNIT_END + 0x041B, // Size: 1, Type: BYTES, Flags: PRIVATE + PLAYER_FIELD_WATCHED_FACTION_INDEX = UNIT_END + 0x041C, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_COMBAT_RATING_1 = UNIT_END + 0x041D, // Size: 25, Type: INT, Flags: PRIVATE + PLAYER_FIELD_ARENA_TEAM_INFO_1_1 = UNIT_END + 0x0436, // Size: 18, Type: INT, Flags: PRIVATE + PLAYER_FIELD_HONOR_CURRENCY = UNIT_END + 0x0448, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_ARENA_CURRENCY = UNIT_END + 0x0449, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_MAX_LEVEL = UNIT_END + 0x044A, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_FIELD_DAILY_QUESTS_1 = UNIT_END + 0x044B, // Size: 25, Type: INT, Flags: PRIVATE + PLAYER_RUNE_REGEN_1 = UNIT_END + 0x0464, // Size: 4, Type: FLOAT, Flags: PRIVATE + PLAYER_NO_REAGENT_COST_1 = UNIT_END + 0x0468, // Size: 3, Type: INT, Flags: PRIVATE + PLAYER_FIELD_GLYPH_SLOTS_1 = UNIT_END + 0x046B, // Size: 6, Type: INT, Flags: PRIVATE + PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0471, // Size: 6, Type: INT, Flags: PRIVATE + PLAYER_GLYPHS_ENABLED = UNIT_END + 0x0477, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_END = UNIT_END + 0x0478, }; enum EGameObjectFields diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 86c600194..03d14e2cd 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -25,11 +25,15 @@ ConfVersion=2008080101 # WorldDatabaseInfo # CharacterDatabaseInfo # Database connection settings for the world server. -# Default: hostname;port;username;password;database -# .;somenumber;username;password;database - use named pipes at Windows -# Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini -# .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux -# Unix sockets: experimental, not tested +# Default: +# ---MYSQL--- +# hostname;port;username;password;database +# .;somenumber;username;password;database - use named pipes at Windows +# Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini +# .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux +# ---PGSQL--- +# hostname;port;username;password;database +# .;/path/to/unix_socket/DIRECTORY or . for default path;username;password;database - use Unix sockets at Unix/Linux # # MaxPingTime # Settings for maximum database-ping interval (minutes between pings) diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index c379da01b..f3f3973ed 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -66,8 +66,8 @@ enum LoginResult // we need to stick to 1 version or half of the stuff will work for someone // others will not and opposite -// will only support WoW, WoW:TBC and WoW:WotLK 3.1.0 client build 9684... +// will only support WoW, WoW:TBC and WoW:WotLK 3.1.0 client build 9704... -#define EXPECTED_MANGOS_CLIENT_BUILD {9684, 0} +#define EXPECTED_MANGOS_CLIENT_BUILD {9704, 0} #endif diff --git a/src/shared/Database/DatabasePostgre.cpp b/src/shared/Database/DatabasePostgre.cpp index a572a8320..e8f713ee9 100644 --- a/src/shared/Database/DatabasePostgre.cpp +++ b/src/shared/Database/DatabasePostgre.cpp @@ -77,14 +77,14 @@ bool DatabasePostgre::Initialize(const char *infoString) Tokens::iterator iter; - std::string host, port_or_socket, user, password, database; + std::string host, port_or_socket_dir, user, password, database; iter = tokens.begin(); if(iter != tokens.end()) host = *iter++; if(iter != tokens.end()) - port_or_socket = *iter++; + port_or_socket_dir = *iter++; if(iter != tokens.end()) user = *iter++; if(iter != tokens.end()) @@ -92,7 +92,10 @@ bool DatabasePostgre::Initialize(const char *infoString) if(iter != tokens.end()) database = *iter++; - mPGconn = PQsetdbLogin(host.c_str(), port_or_socket.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); + if (host == ".") + mPGconn = PQsetdbLogin(NULL, port_or_socket_dir == "." ? NULL : port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); + else + mPGconn = PQsetdbLogin(host.c_str(), port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); /* check to see that the backend connection was successfully made */ if (PQstatus(mPGconn) != CONNECTION_OK) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b84930cc1..016a30ddf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7483" + #define REVISION_NR "7490" #endif // __REVISION_NR_H__