aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/1657_world.sql2
-rw-r--r--sql/updates/CMakeLists.txt3
-rw-r--r--src/game/ObjectAccessor.cpp2
-rw-r--r--src/game/Player.cpp11
-rw-r--r--src/game/Unit.cpp76
-rw-r--r--src/shared/Database/DBCStructure.h34
-rw-r--r--src/shared/revision_nr.h2
7 files changed, 84 insertions, 46 deletions
diff --git a/sql/updates/1657_world.sql b/sql/updates/1657_world.sql
new file mode 100644
index 00000000000..ca31075612f
--- /dev/null
+++ b/sql/updates/1657_world.sql
@@ -0,0 +1,2 @@
+DELETE FROM trinity_string where entry=1010;
+INSERT INTO trinity_string (entry, content_default) VALUES(1010, "| Account | Character | IP | GM | EXP |");
diff --git a/sql/updates/CMakeLists.txt b/sql/updates/CMakeLists.txt
index 559a4d00c89..d2652bb6f72 100644
--- a/sql/updates/CMakeLists.txt
+++ b/sql/updates/CMakeLists.txt
@@ -56,4 +56,5 @@ INSTALL(FILES
1618_world.sql
1646_mangos_7369_01_world_quest_template.sql
1654_world.sql
-DESTINATION share/trinity/sql/updates) \ No newline at end of file
+1657_world.sql
+DESTINATION share/trinity/sql/updates)
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index e832aec0c57..af365f51517 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -86,7 +86,7 @@ ObjectAccessor::GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint3
if(factionTemplate)
{
FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction);
- if( faction->reputationListID >= 0 && player.GetReputationRank(faction) <= REP_UNFRIENDLY)
+ if( faction && faction->reputationListID >= 0 && player.GetReputationRank(faction) <= REP_UNFRIENDLY)
return NULL;
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index cde74b4a66b..ac261b90529 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5757,7 +5757,8 @@ void Player::SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId)
if(!factionTemplateEntry)
return;
- SetFactionVisibleForFactionId(factionTemplateEntry->faction);
+ if(factionTemplateEntry->faction)
+ SetFactionVisibleForFactionId(factionTemplateEntry->faction);
}
void Player::SetFactionVisibleForFactionId(uint32 FactionId)
@@ -10172,6 +10173,12 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pBag )
{
+ pBagProto = pBag->GetProto();
+
+ // special bag already checked
+ if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
+ continue;
+
for(uint32 j = 0; j < pBag->GetBagSize(); j++)
{
if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 )
@@ -19241,7 +19248,7 @@ BGQueueIdBasedOnLevel Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId
float Player::GetReputationPriceDiscount( Creature const* pCreature ) const
{
FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry();
- if(!vendor_faction)
+ if(!vendor_faction || !vendor_faction->faction)
return 1.0f;
ReputationRank rank = GetReputationRank(vendor_faction->faction);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 425eddae924..6771dfdaa80 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7382,28 +7382,34 @@ bool Unit::IsHostileTo(Unit const* unit) const
if(tester->GetTypeId()==TYPEID_PLAYER)
{
// forced reaction
- ForcedReactions::const_iterator forceItr = ((Player*)tester)->m_forcedReactions.find(target_faction->faction);
- if(forceItr!=((Player*)tester)->m_forcedReactions.end())
- return forceItr->second <= REP_HOSTILE;
+ if(target_faction->faction)
+ {
+ ForcedReactions::const_iterator forceItr = ((Player*)tester)->m_forcedReactions.find(target_faction->faction);
+ if(forceItr!=((Player*)tester)->m_forcedReactions.end())
+ return forceItr->second <= REP_HOSTILE;
- // if faction have reputation then hostile state for tester at 100% dependent from at_war state
- if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
- if(raw_target_faction->reputationListID >=0)
- if(FactionState const* factionState = ((Player*)tester)->GetFactionState(raw_target_faction))
- return (factionState->Flags & FACTION_FLAG_AT_WAR);
+ // if faction have reputation then hostile state for tester at 100% dependent from at_war state
+ if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
+ if(raw_target_faction->reputationListID >=0)
+ if(FactionState const* factionState = ((Player*)tester)->GetFactionState(raw_target_faction))
+ return (factionState->Flags & FACTION_FLAG_AT_WAR);
+ }
}
// CvP forced reaction and reputation case
else if(target->GetTypeId()==TYPEID_PLAYER)
{
// forced reaction
- ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
- if(forceItr!=((Player const*)target)->m_forcedReactions.end())
- return forceItr->second <= REP_HOSTILE;
+ if(tester_faction->faction)
+ {
+ ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
+ if(forceItr!=((Player const*)target)->m_forcedReactions.end())
+ return forceItr->second <= REP_HOSTILE;
- // apply reputation state
- FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction);
- if(raw_tester_faction && raw_tester_faction->reputationListID >=0 )
- return ((Player const*)target)->GetReputationRank(raw_tester_faction) <= REP_HOSTILE;
+ // apply reputation state
+ FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction);
+ if(raw_tester_faction && raw_tester_faction->reputationListID >=0 )
+ return ((Player const*)target)->GetReputationRank(raw_tester_faction) <= REP_HOSTILE;
+ }
}
// common faction based case (CvC,PvC,CvP)
@@ -7491,28 +7497,34 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
if(tester->GetTypeId()==TYPEID_PLAYER)
{
// forced reaction
- ForcedReactions::const_iterator forceItr = ((Player const*)tester)->m_forcedReactions.find(target_faction->faction);
- if(forceItr!=((Player const*)tester)->m_forcedReactions.end())
- return forceItr->second >= REP_FRIENDLY;
+ if(target_faction->faction)
+ {
+ ForcedReactions::const_iterator forceItr = ((Player const*)tester)->m_forcedReactions.find(target_faction->faction);
+ if(forceItr!=((Player const*)tester)->m_forcedReactions.end())
+ return forceItr->second >= REP_FRIENDLY;
- // if faction have reputation then friendly state for tester at 100% dependent from at_war state
- if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
- if(raw_target_faction->reputationListID >=0)
- if(FactionState const* FactionState = ((Player*)tester)->GetFactionState(raw_target_faction))
- return !(FactionState->Flags & FACTION_FLAG_AT_WAR);
+ // if faction have reputation then friendly state for tester at 100% dependent from at_war state
+ if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
+ if(raw_target_faction->reputationListID >=0)
+ if(FactionState const* FactionState = ((Player*)tester)->GetFactionState(raw_target_faction))
+ return !(FactionState->Flags & FACTION_FLAG_AT_WAR);
+ }
}
// CvP forced reaction and reputation case
else if(target->GetTypeId()==TYPEID_PLAYER)
{
// forced reaction
- ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
- if(forceItr!=((Player const*)target)->m_forcedReactions.end())
- return forceItr->second >= REP_FRIENDLY;
+ if(tester_faction->faction)
+ {
+ ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
+ if(forceItr!=((Player const*)target)->m_forcedReactions.end())
+ return forceItr->second >= REP_FRIENDLY;
- // apply reputation state
- if(FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction))
- if(raw_tester_faction->reputationListID >=0 )
- return ((Player const*)target)->GetReputationRank(raw_tester_faction) >= REP_FRIENDLY;
+ // apply reputation state
+ if(FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction))
+ if(raw_tester_faction->reputationListID >=0 )
+ return ((Player const*)target)->GetReputationRank(raw_tester_faction) >= REP_FRIENDLY;
+ }
}
// common faction based case (CvC,PvC,CvP)
@@ -7522,7 +7534,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
bool Unit::IsHostileToPlayers() const
{
FactionTemplateEntry const* my_faction = getFactionTemplateEntry();
- if(!my_faction)
+ if(!my_faction || !my_faction->faction)
return false;
FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
@@ -7535,7 +7547,7 @@ bool Unit::IsHostileToPlayers() const
bool Unit::IsNeutralToAll() const
{
FactionTemplateEntry const* my_faction = getFactionTemplateEntry();
- if(!my_faction)
+ if(!my_faction || !my_faction->faction)
return true;
FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h
index 975dbf300f1..bfbdbf59c6c 100644
--- a/src/shared/Database/DBCStructure.h
+++ b/src/shared/Database/DBCStructure.h
@@ -735,24 +735,40 @@ struct FactionTemplateEntry
{
if(ID == entry.ID)
return true;
- if(enemyFaction[0] == entry.faction || enemyFaction[1] == entry.faction || enemyFaction[2] == entry.faction || enemyFaction[3] == entry.faction )
- return false;
- if(friendFaction[0] == entry.faction || friendFaction[1] == entry.faction || friendFaction[2] == entry.faction || friendFaction[3] == entry.faction )
- return true;
+ if(entry.faction)
+ {
+ for(int i = 0; i < 4; ++i)
+ if (enemyFaction[i] == entry.faction)
+ return false;
+ for(int i = 0; i < 4; ++i)
+ if (friendFaction[i] == entry.faction)
+ return true;
+ }
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
if(ID == entry.ID)
return false;
- if(enemyFaction[0] == entry.faction || enemyFaction[1] == entry.faction || enemyFaction[2] == entry.faction || enemyFaction[3] == entry.faction )
- return true;
- if(friendFaction[0] == entry.faction || friendFaction[1] == entry.faction || friendFaction[2] == entry.faction || friendFaction[3] == entry.faction )
- return false;
+ if(entry.faction)
+ {
+ for(int i = 0; i < 4; ++i)
+ if (enemyFaction[i] == entry.faction)
+ return true;
+ for(int i = 0; i < 4; ++i)
+ if (friendFaction[i] == entry.faction)
+ return false;
+ }
return (hostileMask & entry.ourMask) != 0;
}
bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) !=0; }
- bool IsNeutralToAll() const { return hostileMask == 0 && friendlyMask == 0 && enemyFaction[0]==0 && enemyFaction[1]==0 && enemyFaction[2]==0 && enemyFaction[3]==0; }
+ bool IsNeutralToAll() const
+ {
+ for(int i = 0; i < 4; ++i)
+ if (enemyFaction[i] != 0)
+ return false;
+ return hostileMask == 0 && friendlyMask == 0;
+ }
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD)!=0; }
};
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index 3645f73bb00..f58ae1cc2eb 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 "7373"
+ #define REVISION_NR "7374"
#endif // __REVISION_NR_H__