[8320] Imporovements in wild summoned gameobjects work.

* Not set owner for will summoned gameobjects.
  Its not expected to have owner, and must be accessable to all players (or team).
* Set for all objects summoned by spells: despawned by deafult for proper despawn withut owner.
* Cleanup Spell::EffectSummonObjectWild.
This commit is contained in:
VladimirMangos 2009-08-06 00:40:35 +04:00
parent 82782779f7
commit 0d96fc06a6
3 changed files with 39 additions and 33 deletions

View file

@ -567,14 +567,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
bool IsTransport() const; bool IsTransport() const;
void SetOwnerGUID(uint64 owner)
{
m_spawnedByDefault = false; // all object with owner is despawned after delay
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
}
uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
Unit* GetOwner() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
@ -593,6 +585,21 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
bool LoadFromDB(uint32 guid, Map *map); bool LoadFromDB(uint32 guid, Map *map);
void DeleteFromDB(); void DeleteFromDB();
void SetOwnerGUID(uint64 owner)
{
m_spawnedByDefault = false; // all object with owner is despawned after delay
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
}
uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
Unit* GetOwner() const;
void SetSpellId(uint32 id)
{
m_spawnedByDefault = false; // all summoned object is despawned after delay
m_spellId = id;
}
uint32 GetSpellId() const { return m_spellId;}
time_t GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTime() const { return m_respawnTime; }
time_t GetRespawnTimeEx() const time_t GetRespawnTimeEx() const
{ {
@ -619,8 +626,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
uint32 GetRespawnDelay() const { return m_respawnDelayTime; } uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
void Refresh(); void Refresh();
void Delete(); void Delete();
void SetSpellId(uint32 id) { m_spellId = id;}
uint32 GetSpellId() const { return m_spellId;}
void getFishLoot(Loot *loot, Player* loot_owner); void getFishLoot(Loot *loot, Player* loot_owner);
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }

View file

@ -4737,39 +4737,40 @@ void Spell::EffectSummonObjectWild(uint32 i)
} }
int32 duration = GetSpellDuration(m_spellInfo); int32 duration = GetSpellDuration(m_spellInfo);
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetSpellId(m_spellInfo->Id);
if(pGameObj->GetGoType() != GAMEOBJECT_TYPE_FLAGDROP) // make dropped flag clickable for other players (not set owner guid (created by) for this)... // Wild object not have owner and check clickable by players
m_caster->AddGameObject(pGameObj);
map->Add(pGameObj); map->Add(pGameObj);
if(pGameObj->GetMapId() == 489 && pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP) //WS if(pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
if(m_caster->GetTypeId() == TYPEID_PLAYER) Player *pl = (Player*)m_caster;
BattleGround* bg = ((Player *)m_caster)->GetBattleGround();
switch(pGameObj->GetMapId())
{ {
Player *pl = (Player*)m_caster; case 489: //WS
BattleGround* bg = ((Player *)m_caster)->GetBattleGround();
if(bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
{ {
uint32 team = ALLIANCE; if(bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
{
uint32 team = ALLIANCE;
if(pl->GetTeam() == team) if(pl->GetTeam() == team)
team = HORDE; team = HORDE;
((BattleGroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(),team); ((BattleGroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(),team);
}
break;
} }
} case 566: //EY
}
if(pGameObj->GetMapId() == 566 && pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP) //EY
{
if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
BattleGround* bg = ((Player *)m_caster)->GetBattleGround();
if(bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
{ {
((BattleGroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID()); if(bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
{
((BattleGroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
}
break;
} }
} }
} }
@ -4783,7 +4784,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id); linkedGO->SetSpellId(m_spellInfo->Id);
m_caster->AddGameObject(linkedGO); // Wild object not have owner and check clickable by players
map->Add(linkedGO); map->Add(linkedGO);
} }
else else

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8319" #define REVISION_NR "8320"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__