mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Merge commit 'origin/master' into 310
This commit is contained in:
commit
526cf21d33
5 changed files with 75 additions and 66 deletions
|
|
@ -78,6 +78,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
|
||||
switch(criteria->requiredType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
|
||||
|
|
@ -92,6 +93,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
{
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED:
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
|
||||
if(!creature.id || !objmgr.GetCreatureTemplate(creature.id))
|
||||
|
|
@ -185,6 +187,22 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
|
||||
if(difficalty.difficalty >= TOTAL_DIFFICULTIES)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) have wrong difficulty in value1 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,dataType,difficalty.difficalty);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
|
||||
if(map_players.maxcount <= 0)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) have wrong max players count in value1 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,dataType,map_players.maxcount);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType);
|
||||
return false;
|
||||
|
|
@ -201,9 +219,7 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
|
|||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
|
||||
if (!target || target->GetTypeId()!=TYPEID_UNIT)
|
||||
return false;
|
||||
if (target->GetEntry() != creature.id)
|
||||
return false;
|
||||
return true;
|
||||
return target->GetEntry() == creature.id;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
|
||||
if (!target || target->GetTypeId()!=TYPEID_PLAYER)
|
||||
return false;
|
||||
|
|
@ -241,6 +257,12 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
|
|||
if (!target)
|
||||
return false;
|
||||
return target->getGender() == gender.gender;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED:
|
||||
return false; // always fail
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
|
||||
return source->GetMap()->GetSpawnMode()==difficalty.difficalty;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
|
||||
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -661,61 +683,24 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
// specialized cases
|
||||
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
|
||||
{
|
||||
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
|
||||
if(!miscvalue1)
|
||||
continue;
|
||||
if(achievementCriteria->kill_creature.creatureID != miscvalue1)
|
||||
continue;
|
||||
|
||||
// LOT achievement->ID required special custom checks
|
||||
switch(achievement->ID)
|
||||
{
|
||||
// Just heroic
|
||||
case 489: case 490: case 491: case 492: case 493: case 494: case 495:
|
||||
case 496: case 497: case 498: case 499: case 500: case 563: case 565:
|
||||
case 567: case 569: case 573: case 575: case 577: case 623: case 625:
|
||||
case 667: case 668: case 669: case 670: case 671: case 672: case 673:
|
||||
case 674: case 675: case 676: case 677: case 678: case 679: case 680:
|
||||
case 681: case 682: case 1367: case 1368: case 1378: case 1379:
|
||||
case 1380: case 1381: case 1382: case 1383: case 1384: case 1385:
|
||||
case 1386: case 1387: case 1388: case 1389: case 1390: case 1393:
|
||||
case 1394: case 1400: case 1402: case 1504: case 1505: case 1506:
|
||||
case 1507: case 1508: case 1509: case 1510: case 1511: case 1512:
|
||||
case 1513: case 1514: case 1515: case 1721: case 1754: case 1756:
|
||||
case 1768: case 1817: case 1865:
|
||||
if(GetPlayer()->GetDifficulty()!=DIFFICULTY_HEROIC)
|
||||
continue;
|
||||
break;
|
||||
// Heroic + other
|
||||
case 579: case 1296: case 1297: case 1816: case 1834: case 1857: case 1859:
|
||||
case 1860: case 1861: case 1862: case 1864: case 1866: case 1867: case 1868:
|
||||
case 1870: case 1871: case 1872: case 1873: case 1875: case 1877: case 1919:
|
||||
case 2036: case 2037: case 2038: case 2039: case 2040: case 2041: case 2042:
|
||||
case 2043: case 2044: case 2045: case 2046: case 2048: case 2052: case 2053:
|
||||
case 2054: case 2056: case 2057: case 2058: case 2139: case 2140: case 2147:
|
||||
case 2149: case 2150: case 2151: case 2152: case 2154: case 2155: case 2156:
|
||||
case 2157: case 2179: case 2181: case 2183: case 2185: case 2186:
|
||||
if(GetPlayer()->GetDifficulty()!=DIFFICULTY_HEROIC)
|
||||
continue;
|
||||
// FIX ME: mark as fail always until implement
|
||||
continue;
|
||||
// Normal + other
|
||||
case 578: case 624: case 1790: case 1856: case 1858: case 1869: case 1874:
|
||||
case 1996: case 1997: case 2047: case 2049: case 2050: case 2051: case 2146:
|
||||
case 2148: case 2153: case 2178: case 2180: case 2182: case 2184: case 2187:
|
||||
if(GetPlayer()->GetDifficulty()!=DIFFICULTY_NORMAL)
|
||||
continue;
|
||||
// FIX ME: mark as fail always until implement
|
||||
continue;
|
||||
// Just Normal
|
||||
default:
|
||||
if(GetPlayer()->GetDifficulty()!=DIFFICULTY_NORMAL)
|
||||
continue;
|
||||
break;
|
||||
};
|
||||
// those requirements couldn't be found in the dbc
|
||||
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
|
||||
if(!data)
|
||||
continue;
|
||||
|
||||
if(!data->Meets(GetPlayer(),unit))
|
||||
continue;
|
||||
|
||||
SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL:
|
||||
SetCriteriaProgress(achievementCriteria, GetPlayer()->getLevel());
|
||||
break;
|
||||
|
|
@ -1759,6 +1744,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
}
|
||||
|
||||
uint32 count = 0;
|
||||
uint32 disabled_count = 0;
|
||||
barGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
|
|
@ -1776,14 +1762,19 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
|
||||
AchievementCriteriaData data(fields[1].GetUInt32(),fields[2].GetUInt32(),fields[3].GetUInt32());
|
||||
|
||||
if(!data.IsValid(criteria))
|
||||
if (!data.IsValid(criteria))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// this will allocate empty data set storage
|
||||
AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id];
|
||||
|
||||
if (data.dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED)
|
||||
++disabled_count;
|
||||
|
||||
// add real data only for not NONE data types
|
||||
if(data.dataType!=ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
|
||||
if (data.dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
|
||||
dataSet.Add(data);
|
||||
|
||||
// counting data by and data types
|
||||
|
|
@ -1801,6 +1792,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
|
||||
switch(criteria->requiredType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
|
||||
break; // any cases
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: // need skip generic cases
|
||||
if(criteria->win_rated_arena.flag!=ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
|
||||
continue;
|
||||
|
|
@ -1820,11 +1813,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
}
|
||||
|
||||
if(!GetCriteriaDataSet(criteria))
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
|
||||
}
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u additional achievement criteria data.",count);
|
||||
sLog.outString(">> Loaded %u additional achievement criteria data (%u disabled).",count,disabled_count);
|
||||
}
|
||||
|
||||
void AchievementGlobalMgr::LoadCompletedAchievements()
|
||||
|
|
|
|||
|
|
@ -53,9 +53,12 @@ enum AchievementCriteriaDataType
|
|||
ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8, // minvalue value provided with achievement update must be not less that limit
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9, // minlevel minlevel of target
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10,// gender 0=male; 1=female
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement createria complete if not all requirement implemented and listed in table
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12,// difficulty normal/heroic difficulty for current event map
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13,// count "with less than %u people in the zone"
|
||||
};
|
||||
|
||||
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 11 // maximum value in AchievementCriteriaDataType enum
|
||||
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 14 // maximum value in AchievementCriteriaDataType enum
|
||||
|
||||
class Player;
|
||||
class Unit;
|
||||
|
|
@ -65,54 +68,66 @@ struct AchievementCriteriaData
|
|||
AchievementCriteriaDataType dataType;
|
||||
union
|
||||
{
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0 (no data)
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
} creature;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2
|
||||
struct
|
||||
{
|
||||
uint32 class_id;
|
||||
uint32 race_id;
|
||||
} classRace;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH = 3
|
||||
struct
|
||||
{
|
||||
uint32 percent;
|
||||
} health;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4
|
||||
struct
|
||||
{
|
||||
uint32 own_team_flag;
|
||||
} player_dead;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA = 7
|
||||
struct
|
||||
{
|
||||
uint32 spell_id;
|
||||
uint32 effect_idx;
|
||||
} aura;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
} area;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8
|
||||
struct
|
||||
{
|
||||
uint32 minvalue;
|
||||
} value;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9
|
||||
struct
|
||||
{
|
||||
uint32 minlevel;
|
||||
} level;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10
|
||||
struct
|
||||
{
|
||||
uint32 gender;
|
||||
} gender;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11 (no data)
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12
|
||||
struct
|
||||
{
|
||||
uint32 difficalty;
|
||||
} difficalty;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13
|
||||
struct
|
||||
{
|
||||
uint32 maxcount;
|
||||
} map_players;
|
||||
// ...
|
||||
struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void PetAI::MoveInLineOfSight(Unit *u)
|
|||
|
||||
void PetAI::AttackStart(Unit *u)
|
||||
{
|
||||
if( inCombat || !u || (m_creature->isPet() && ((Pet*)m_creature)->getPetType() == MINI_PET) )
|
||||
if(!u || (m_creature->isPet() && ((Pet*)m_creature)->getPetType() == MINI_PET))
|
||||
return;
|
||||
|
||||
if(m_creature->Attack(u,true))
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ template<class T>
|
|||
void PointMovementGenerator<T>::Initialize(T &unit)
|
||||
{
|
||||
unit.StopMoving();
|
||||
unit.addUnitState(UNIT_STAT_MOVING);
|
||||
Traveller<T> traveller(unit);
|
||||
i_destinationHolder.SetDestination(traveller,i_x,i_y,i_z);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7975"
|
||||
#define REVISION_NR "7979"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue