mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9201] Fix typo from [9200] and clean up code in function.
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
95f9ec5fb2
commit
55b6b0eb26
2 changed files with 44 additions and 45 deletions
|
|
@ -873,13 +873,14 @@ void GameObject::Use(Unit* user)
|
|||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: //0
|
||||
case GAMEOBJECT_TYPE_BUTTON: //1
|
||||
{
|
||||
//doors/buttons never really despawn, only reset to default state/flags
|
||||
UseDoorOrButton();
|
||||
|
||||
// activate script
|
||||
GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this);
|
||||
return;
|
||||
|
||||
}
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: //2
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
|
|
@ -891,14 +892,13 @@ void GameObject::Use(Unit* user)
|
|||
player->SendPreparedGossip(this);
|
||||
return;
|
||||
}
|
||||
//Sitting: Wooden bench, chairs enzz
|
||||
case GAMEOBJECT_TYPE_CHAIR: //7
|
||||
case GAMEOBJECT_TYPE_CHAIR: //7 Sitting: Wooden bench, chairs
|
||||
{
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
if(!info)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
|
@ -906,7 +906,7 @@ void GameObject::Use(Unit* user)
|
|||
// a chair may have n slots. we have to calculate their positions and teleport the player to the nearest one
|
||||
|
||||
// check if the db is sane
|
||||
if(info->chair.slots > 0)
|
||||
if (info->chair.slots > 0)
|
||||
{
|
||||
float lowestDist = DEFAULT_VISIBILITY_DISTANCE;
|
||||
|
||||
|
|
@ -935,7 +935,7 @@ void GameObject::Use(Unit* user)
|
|||
helper->MonsterSay(output.str().c_str(), LANG_UNIVERSAL, 0);
|
||||
*/
|
||||
|
||||
if(thisDistance <= lowestDist)
|
||||
if (thisDistance <= lowestDist)
|
||||
{
|
||||
lowestDist = thisDistance;
|
||||
x_lowest = x_i;
|
||||
|
|
@ -955,9 +955,10 @@ void GameObject::Use(Unit* user)
|
|||
case GAMEOBJECT_TYPE_SPELL_FOCUS:
|
||||
{
|
||||
// triggering linked GO
|
||||
if (uint32 trapEntry = GetGOInfo()->goober.linkedTrapId)
|
||||
if (uint32 trapEntry = GetGOInfo()->spellFocus.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
|
||||
// some may be activated in addition? Conditions for this? (ex: entry 181616)
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_GOOBER: //10
|
||||
|
|
@ -1024,7 +1025,7 @@ void GameObject::Use(Unit* user)
|
|||
if(!info)
|
||||
return;
|
||||
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
|
@ -1037,15 +1038,14 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
return;
|
||||
}
|
||||
//fishing bobber
|
||||
case GAMEOBJECT_TYPE_FISHINGNODE: //17
|
||||
case GAMEOBJECT_TYPE_FISHINGNODE: //17 fishing bobber
|
||||
{
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
||||
if(player->GetGUID() != GetOwnerGUID())
|
||||
if (player->GetGUID() != GetOwnerGUID())
|
||||
return;
|
||||
|
||||
switch(getLootState())
|
||||
|
|
@ -1059,12 +1059,12 @@ void GameObject::Use(Unit* user)
|
|||
uint32 zone, subzone;
|
||||
GetZoneAndAreaId(zone,subzone);
|
||||
|
||||
int32 zone_skill = sObjectMgr.GetFishingBaseSkillLevel( subzone );
|
||||
if(!zone_skill)
|
||||
zone_skill = sObjectMgr.GetFishingBaseSkillLevel( zone );
|
||||
int32 zone_skill = sObjectMgr.GetFishingBaseSkillLevel(subzone);
|
||||
if (!zone_skill)
|
||||
zone_skill = sObjectMgr.GetFishingBaseSkillLevel(zone);
|
||||
|
||||
//provide error, no fishable zone or area should be 0
|
||||
if(!zone_skill)
|
||||
if (!zone_skill)
|
||||
sLog.outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.",subzone);
|
||||
|
||||
int32 skill = player->GetSkillValue(SKILL_FISHING);
|
||||
|
|
@ -1073,7 +1073,7 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
DEBUG_LOG("Fishing check (skill: %i zone min skill: %i chance %i roll: %i",skill,zone_skill,chance,roll);
|
||||
|
||||
if(skill >= zone_skill && chance >= roll)
|
||||
if (skill >= zone_skill && chance >= roll)
|
||||
{
|
||||
// prevent removing GO at spell cancel
|
||||
player->RemoveGameObject(this,false);
|
||||
|
|
@ -1118,10 +1118,9 @@ void GameObject::Use(Unit* user)
|
|||
player->FinishSpell(CURRENT_CHANNELED_SPELL);
|
||||
return;
|
||||
}
|
||||
|
||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
|
||||
{
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
|
@ -1130,27 +1129,27 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
|
||||
if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
|
||||
if (!caster || caster->GetTypeId()!=TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// accept only use by player from same group for caster except caster itself
|
||||
if(((Player*)caster)==player || !((Player*)caster)->IsInSameRaidWith(player))
|
||||
if (((Player*)caster) == player || !((Player*)caster)->IsInSameRaidWith(player))
|
||||
return;
|
||||
|
||||
AddUniqueUse(player);
|
||||
|
||||
// full amount unique participants including original summoner
|
||||
if(GetUniqueUseCount() < info->summoningRitual.reqParticipants)
|
||||
if (GetUniqueUseCount() < info->summoningRitual.reqParticipants)
|
||||
return;
|
||||
|
||||
// in case summoning ritual caster is GO creator
|
||||
spellCaster = caster;
|
||||
|
||||
if(!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
if (!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
return;
|
||||
|
||||
spellId = info->summoningRitual.spellId;
|
||||
if(spellId==62330) // GO store not existed spell, replace by expected
|
||||
if (spellId == 62330) // GO store not existed spell, replace by expected
|
||||
{
|
||||
// spell have reagent and mana cost but it not expected use its
|
||||
// it triggered spell in fact casted at currently channeled GO
|
||||
|
|
@ -1172,16 +1171,16 @@ void GameObject::Use(Unit* user)
|
|||
SetUInt32Value(GAMEOBJECT_FLAGS,2);
|
||||
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
if(!info)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if(info->spellcaster.partyOnly)
|
||||
if (info->spellcaster.partyOnly)
|
||||
{
|
||||
Unit* caster = GetOwner();
|
||||
if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
|
||||
if (user->GetTypeId() != TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1194,7 +1193,7 @@ void GameObject::Use(Unit* user)
|
|||
{
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
|
@ -1202,37 +1201,37 @@ void GameObject::Use(Unit* user)
|
|||
Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetSelection());
|
||||
|
||||
// accept only use by player from same group for caster except caster itself
|
||||
if(!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
|
||||
if (!targetPlayer || targetPlayer == player || !targetPlayer->IsInSameGroupWith(player))
|
||||
return;
|
||||
|
||||
//required lvl checks!
|
||||
uint8 level = player->getLevel();
|
||||
if (level < info->meetingstone.minLevel || level > info->meetingstone.maxLevel)
|
||||
return;
|
||||
|
||||
level = targetPlayer->getLevel();
|
||||
if (level < info->meetingstone.minLevel || level > info->meetingstone.maxLevel)
|
||||
return;
|
||||
|
||||
if(info->id==194097)
|
||||
if (info->id == 194097)
|
||||
spellId = 61994; // Ritual of Summoning
|
||||
else
|
||||
spellId = 59782; // Summoning Stone Effect
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
|
||||
{
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
||||
if( player->CanUseBattleGroundObject() )
|
||||
if (player->CanUseBattleGroundObject())
|
||||
{
|
||||
// in battleground check
|
||||
BattleGround *bg = player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
// BG flag click
|
||||
// AB:
|
||||
|
|
@ -1248,16 +1247,16 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
case GAMEOBJECT_TYPE_FLAGDROP: // 26
|
||||
{
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
||||
if( player->CanUseBattleGroundObject() )
|
||||
if (player->CanUseBattleGroundObject())
|
||||
{
|
||||
// in battleground check
|
||||
BattleGround *bg = player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
// BG flag dropped
|
||||
// WS:
|
||||
|
|
@ -1266,7 +1265,7 @@ void GameObject::Use(Unit* user)
|
|||
// EotS:
|
||||
// 184142 - Netherstorm Flag
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
if(info)
|
||||
if (info)
|
||||
{
|
||||
switch(info->id)
|
||||
{
|
||||
|
|
@ -1294,10 +1293,10 @@ void GameObject::Use(Unit* user)
|
|||
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
|
||||
{
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
if(!info)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if(user->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = (Player*)user;
|
||||
|
|
@ -1316,11 +1315,11 @@ void GameObject::Use(Unit* user)
|
|||
break;
|
||||
}
|
||||
|
||||
if(!spellId)
|
||||
if (!spellId)
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
|
||||
if(!spellInfo)
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue