mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Merge commit 'origin/master' into 320
Conflicts: src/game/Map.cpp src/game/MapInstanced.cpp src/game/Player.cpp src/game/SpellEffects.cpp src/game/Totem.cpp
This commit is contained in:
commit
1a47420fe8
43 changed files with 1208 additions and 714 deletions
|
|
@ -541,7 +541,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
|||
for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
|
||||
m_items[i] = NULL;
|
||||
|
||||
SetMapId(info->mapId);
|
||||
SetLocationMapId(info->mapId);
|
||||
Relocate(info->positionX,info->positionY,info->positionZ);
|
||||
|
||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_);
|
||||
|
|
@ -551,6 +551,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
|||
return false;
|
||||
}
|
||||
|
||||
SetMap(MapManager::Instance().CreateMap(info->mapId, this));
|
||||
|
||||
uint8 powertype = cEntry->powerType;
|
||||
|
||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
|
|
@ -1496,7 +1498,12 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
uint32 enchants = GetUInt32ValueFromArray(data, visualbase + 1);
|
||||
for(uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot)
|
||||
{
|
||||
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchants >> enchantSlot*16))
|
||||
// values stored in 2 uint16
|
||||
uint32 enchantId = 0x0000FFFF & (enchants >> enchantSlot*16);
|
||||
if(!enchantId)
|
||||
continue;
|
||||
|
||||
if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1639,7 +1646,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
SetFallInformation(0, z);
|
||||
|
||||
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
|
||||
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
|
||||
// at client packet MSG_MOVE_TELEPORT_ACK
|
||||
SetSemaphoreTeleportNear(true);
|
||||
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
||||
|
|
@ -5566,7 +5573,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
|
|||
}
|
||||
|
||||
|
||||
// it create new button (NEW state) if need or return existed
|
||||
// it create new button (NEW state) if need or return existed
|
||||
ActionButton& ab = m_actionButtons[button];
|
||||
|
||||
// set data and update to CHANGED if not NEW
|
||||
|
|
@ -7334,7 +7341,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||
|
||||
if (go->getLootState() == GO_READY)
|
||||
{
|
||||
uint32 lootid = go->GetLootId();
|
||||
uint32 lootid = go->GetGOInfo()->GetLootId();
|
||||
|
||||
if (lootid)
|
||||
{
|
||||
|
|
@ -12027,7 +12034,11 @@ void Player::PrepareQuestMenu( uint64 guid )
|
|||
}
|
||||
else
|
||||
{
|
||||
GameObject *pGameObject = GetMap()->GetGameObject(guid);
|
||||
//we should obtain map pointer from GetMap() in 99% of cases. Special case
|
||||
//only for quests which cast teleport spells on player
|
||||
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
|
||||
ASSERT(_map);
|
||||
GameObject *pGameObject = _map->GetGameObject(guid);
|
||||
if( pGameObject )
|
||||
{
|
||||
pObject = (Object*)pGameObject;
|
||||
|
|
@ -12536,12 +12547,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
|
||||
if (pQuest->GetRewChoiceItemsCount() > 0)
|
||||
{
|
||||
if (pQuest->RewChoiceItemId[reward])
|
||||
if (uint32 itemId = pQuest->RewChoiceItemId[reward])
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] ) == EQUIP_ERR_OK)
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewChoiceItemCount[reward] ) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem( dest, pQuest->RewChoiceItemId[reward], true);
|
||||
Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
SendNewItem(item, pQuest->RewChoiceItemCount[reward], true, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -12551,12 +12562,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
{
|
||||
for (uint32 i=0; i < pQuest->GetRewItemsCount(); ++i)
|
||||
{
|
||||
if (pQuest->RewItemId[i])
|
||||
if (uint32 itemId = pQuest->RewItemId[i])
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] ) == EQUIP_ERR_OK)
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemId, pQuest->RewItemCount[i] ) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem( dest, pQuest->RewItemId[i], true);
|
||||
Item* item = StoreNewItem( dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
SendNewItem(item, pQuest->RewItemCount[i], true, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -13825,7 +13836,8 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
|||
m_name = fields[2].GetCppString();
|
||||
|
||||
Relocate(fields[3].GetFloat(),fields[4].GetFloat(),fields[5].GetFloat());
|
||||
SetMapId(fields[6].GetUInt32());
|
||||
SetLocationMapId(fields[6].GetUInt32());
|
||||
|
||||
// the instance id is not needed at character enum
|
||||
|
||||
m_Played_time[0] = fields[7].GetUInt32();
|
||||
|
|
@ -14106,7 +14118,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
// init saved position, and fix it later if problematic
|
||||
uint32 transGUID = fields[31].GetUInt32();
|
||||
Relocate(fields[13].GetFloat(),fields[14].GetFloat(),fields[15].GetFloat(),fields[17].GetFloat());
|
||||
SetMapId(fields[16].GetUInt32());
|
||||
SetLocationMapId(fields[16].GetUInt32());
|
||||
SetDungeonDifficulty(fields[39].GetUInt32()); // may be changed in _LoadGroup
|
||||
|
||||
_LoadGroup(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGROUP));
|
||||
|
|
@ -14181,7 +14193,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
else
|
||||
{
|
||||
const WorldLocation& _loc = GetBattleGroundEntryPoint();
|
||||
SetMapId(_loc.mapid);
|
||||
SetLocationMapId(_loc.mapid);
|
||||
Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation);
|
||||
//RemoveArenaAuras(true);
|
||||
}
|
||||
|
|
@ -14194,7 +14206,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
if(!mapEntry || mapEntry->IsBattleGroundOrArena())
|
||||
{
|
||||
// return to BG master
|
||||
SetMapId(fields[43].GetUInt32());
|
||||
SetLocationMapId(fields[43].GetUInt32());
|
||||
Relocate(fields[44].GetFloat(),fields[45].GetFloat(),fields[46].GetFloat(),fields[47].GetFloat());
|
||||
|
||||
// check entry point and fix to homebind if need
|
||||
|
|
@ -14248,7 +14260,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
m_transport = *iter;
|
||||
m_transport->AddPassenger(this);
|
||||
SetMapId(m_transport->GetMapId());
|
||||
SetLocationMapId(m_transport->GetMapId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -14281,11 +14293,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
// NOW player must have valid map
|
||||
// load the player's map here if it's not already loaded
|
||||
Map *map = GetMap();
|
||||
|
||||
// since the player may not be bound to the map yet, make sure subsequent
|
||||
// getmap calls won't create new maps
|
||||
SetInstanceId(map->GetInstanceId());
|
||||
SetMap(MapManager::Instance().CreateMap(GetMapId(), this));
|
||||
|
||||
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
|
||||
if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId()))
|
||||
|
|
@ -14463,15 +14471,19 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
{
|
||||
sLog.outError("Character %u have wrong data in taxi destination list, teleport to homebind.",GetGUIDLow());
|
||||
RelocateToHomebind();
|
||||
SaveRecallPosition(); // save as recall also to prevent recall and fall from sky
|
||||
}
|
||||
else // have start node, to it
|
||||
{
|
||||
sLog.outError("Character %u have too short taxi destination list, teleport to original node.",GetGUIDLow());
|
||||
SetMapId(nodeEntry->map_id);
|
||||
SetLocationMapId(nodeEntry->map_id);
|
||||
Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z,0.0f);
|
||||
SaveRecallPosition(); // save as recall also to prevent recall and fall from sky
|
||||
}
|
||||
|
||||
//we can be relocated from taxi and still have an outdated Map pointer!
|
||||
//so we need to get a new Map pointer!
|
||||
SetMap(MapManager::Instance().CreateMap(GetMapId(), this));
|
||||
SaveRecallPosition(); // save as recall also to prevent recall and fall from sky
|
||||
|
||||
m_taxi.ClearTaxiDestinations();
|
||||
}
|
||||
else if(uint32 node_id = m_taxi.GetTaxiSource())
|
||||
|
|
@ -19600,7 +19612,8 @@ uint32 Player::CalculateTalentsPoints() const
|
|||
if(getClass() != CLASS_DEATH_KNIGHT)
|
||||
return uint32(base_talent * sWorld.getRate(RATE_TALENT));
|
||||
|
||||
uint32 talentPointsForLevel = getLevel() < 56 ? 0 : getLevel() - 55 + m_questRewardTalentCount;
|
||||
uint32 talentPointsForLevel = getLevel() < 56 ? 0 : getLevel() - 55;
|
||||
talentPointsForLevel += m_questRewardTalentCount;
|
||||
|
||||
if(talentPointsForLevel > base_talent)
|
||||
talentPointsForLevel = base_talent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue