aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-03-02 23:59:42 +0100
committerShauren <shauren.trinity@gmail.com>2013-03-02 23:59:42 +0100
commit6be5bc71eb667536d5f289aa8723766a912105da (patch)
tree014904a9e6f496b2f003fa6bb2189a9e7011b71a
parent1baaaf1bf07aa93a49b255c2e4d018375471ea21 (diff)
Core/GameObjects
* Removed long deprecated code for mining nodes (multiple uses, artifact of TBC) * Made fishing pools generate use count only on spawn (and respawn) instead of randomizing use count on every fishing attempt - prevents early despawning in some cases
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp35
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h9
-rw-r--r--src/server/game/Handlers/LootHandler.cpp52
-rw-r--r--src/server/game/Spells/Spell.cpp2
-rw-r--r--src/server/game/World/World.cpp2
-rw-r--r--src/server/game/World/World.h2
-rw-r--r--src/server/worldserver/worldserver.conf.dist14
7 files changed, 33 insertions, 83 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index c41c8e71a44..a2c0b4b8c92 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -224,6 +224,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
switch (goinfo->type)
{
+ case GAMEOBJECT_TYPE_FISHINGHOLE:
+ SetGoAnimProgress(animprogress);
+ m_goValue.FishingHole.MaxOpens = urand(GetGOInfo()->fishinghole.minSuccessOpens, GetGOInfo()->fishinghole.maxSuccessOpens);
+ break;
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
m_goValue.Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
m_goValue.Building.MaxHealth = m_goValue.Building.Health;
@@ -377,22 +381,27 @@ void GameObject::Update(uint32 diff)
//we need to open doors if they are closed (add there another condition if this code breaks some usage, but it need to be here for battlegrounds)
if (GetGoState() != GO_STATE_READY)
ResetDoorOrButton();
- //flags in AB are type_button and we need to add them here so no break!
+ break;
+ case GAMEOBJECT_TYPE_FISHINGHOLE:
+ // Initialize a new max fish count on respawn
+ m_goValue.FishingHole.MaxOpens = urand(GetGOInfo()->fishinghole.minSuccessOpens, GetGOInfo()->fishinghole.maxSuccessOpens);
+ break;
default:
- if (!m_spawnedByDefault) // despawn timer
- {
- // can be despawned or destroyed
- SetLootState(GO_JUST_DEACTIVATED);
- return;
- }
- // respawn timer
- uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0;
- if (poolid)
- sPoolMgr->UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
- else
- GetMap()->AddToMap(this);
break;
}
+
+ if (!m_spawnedByDefault) // despawn timer
+ {
+ // can be despawned or destroyed
+ SetLootState(GO_JUST_DEACTIVATED);
+ return;
+ }
+ // respawn timer
+ uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0;
+ if (poolid)
+ sPoolMgr->UpdatePool<GameObject>(poolid, GetDBTableGUIDLow());
+ else
+ GetMap()->AddToMap(this);
}
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 1049285605e..556e4275edc 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -91,8 +91,8 @@ struct GameObjectTemplate
uint32 lootId; //1
uint32 chestRestockTime; //2
uint32 consumable; //3
- uint32 minSuccessOpens; //4
- uint32 maxSuccessOpens; //5
+ uint32 minSuccessOpens; //4 Deprecated, pre 3.0 was used for mining nodes but since WotLK all mining nodes are usable once and grant all loot with a single use
+ uint32 maxSuccessOpens; //5 Deprecated, pre 3.0 was used for mining nodes but since WotLK all mining nodes are usable once and grant all loot with a single use
uint32 eventId; //6 lootedEvent
uint32 linkedTrapId; //7
uint32 questId; //8 not used currently but store quest required for GO activation for player
@@ -529,6 +529,11 @@ class OPvPCapturePoint;
union GameObjectValue
{
+ //25 GAMEOBJECT_TYPE_FISHINGHOLE
+ struct
+ {
+ uint32 MaxOpens;
+ } FishingHole;
//29 GAMEOBJECT_TYPE_CAPTURE_POINT
struct
{
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index b9a615052bb..2129b386d8c 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -277,61 +277,15 @@ void WorldSession::DoLootRelease(uint64 lguid)
}
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
{
- // GO is mineral vein? so it is not removed after its looted
- if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
- {
- uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
- uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
-
- // only vein pass this check
- if (go_min != 0 && go_max > go_min)
- {
- float amount_rate = sWorld->getRate(RATE_MINING_AMOUNT);
- float min_amount = go_min*amount_rate;
- float max_amount = go_max*amount_rate;
-
- go->AddUse();
- float uses = float(go->GetUseCount());
-
- if (uses < max_amount)
- {
- if (uses >= min_amount)
- {
- float chance_rate = sWorld->getRate(RATE_MINING_NEXT);
-
- int32 ReqValue = 175;
- LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
- if (lockInfo)
- ReqValue = lockInfo->Skill[0];
- float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25);
- double chance = pow(0.8*chance_rate, 4*(1/double(max_amount))*double(uses));
- if (roll_chance_f((float)(100*chance+skill)))
- {
- go->SetLootState(GO_READY);
- }
- else // not have more uses
- go->SetLootState(GO_JUST_DEACTIVATED);
- }
- else // 100% chance until min uses
- go->SetLootState(GO_READY);
- }
- else // max uses already
- go->SetLootState(GO_JUST_DEACTIVATED);
- }
- else // not vein
- go->SetLootState(GO_JUST_DEACTIVATED);
- }
- else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
+ if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
{ // The fishing hole used once more
go->AddUse(); // if the max usage is reached, will be despawned in next tick
- if (go->GetUseCount() >= urand(go->GetGOInfo()->fishinghole.minSuccessOpens, go->GetGOInfo()->fishinghole.maxSuccessOpens))
- {
+ if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
go->SetLootState(GO_JUST_DEACTIVATED);
- }
else
go->SetLootState(GO_READY);
}
- else // not chest (or vein/herb/etc)
+ else
go->SetLootState(GO_JUST_DEACTIVATED);
loot->clear();
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 342f0cfbddf..6f1aa6e38ad 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3073,7 +3073,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
// set target for proper facing
if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT)
- m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID());
+ m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID());
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD))
TriggerGlobalCooldown();
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index bcd69ec70ed..12aa8c9587b 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -497,8 +497,6 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_AUCTION_DEPOSIT] = ConfigMgr::GetFloatDefault("Rate.Auction.Deposit", 1.0f);
rate_values[RATE_AUCTION_CUT] = ConfigMgr::GetFloatDefault("Rate.Auction.Cut", 1.0f);
rate_values[RATE_HONOR] = ConfigMgr::GetFloatDefault("Rate.Honor", 1.0f);
- rate_values[RATE_MINING_AMOUNT] = ConfigMgr::GetFloatDefault("Rate.Mining.Amount", 1.0f);
- rate_values[RATE_MINING_NEXT] = ConfigMgr::GetFloatDefault("Rate.Mining.Next", 1.0f);
rate_values[RATE_INSTANCE_RESET_TIME] = ConfigMgr::GetFloatDefault("Rate.InstanceResetTime", 1.0f);
rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 154e9972218..bb87be89a61 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -385,8 +385,6 @@ enum Rates
RATE_AUCTION_DEPOSIT,
RATE_AUCTION_CUT,
RATE_HONOR,
- RATE_MINING_AMOUNT,
- RATE_MINING_NEXT,
RATE_TALENT,
RATE_CORPSE_DECAY_LOOTED,
RATE_INSTANCE_RESET_TIME,
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 7c8aff9ce3a..612793649b2 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -1883,20 +1883,6 @@ Rate.Auction.Cut = 1
Rate.Honor = 1
#
-# Rate.Mining.Amount
-# Description: Rate for minimum/maximum times a deposit can be used.
-# Default: 1
-
-Rate.Mining.Amount = 1
-
-#
-# Rate.Mining.Next
-# Description: Mining rates.
-# Default: Chance to to mine a deposit again.
-
-Rate.Mining.Next = 1
-
-#
# Rate.Talent
# Description: Talent point rate.
# Default: 1