[9425] More achievement types support.

Implemented new achievement criteria requirement:
* ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM_LVL (item level and item quality equiped in specific slot)

Implemented suppoprt achievement types:
* ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM (required DB data)
* ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL (required DB data)

Also achievment types used only for statistics:
* ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION
* ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS
* ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS
* ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS
* ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM
* ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM
This commit is contained in:
VladimirMangos 2010-02-21 03:12:29 +03:00
parent 8bb13412e5
commit df652c56c0
10 changed files with 123 additions and 17 deletions

View file

@ -89,7 +89,9 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: // only hardcoded list case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: // only hardcoded list
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
@ -241,6 +243,14 @@ bool AchievementCriteriaRequirement::IsValid(AchievementCriteriaEntry const* cri
return false; return false;
} }
return true; return true;
case ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM:
if(equipped_item.item_quality >= MAX_ITEM_QUALITY)
{
sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) have unknown quality state in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,requirementType,equipped_item.item_quality);
return false;
}
return true;
default: default:
sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,requirementType); sLog.outErrorDb( "Table `achievement_criteria_requirement` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,requirementType);
return false; return false;
@ -317,6 +327,7 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return bg->IsTeamScoreInRange(source->GetTeam()==ALLIANCE ? HORDE : ALLIANCE,bg_loss_team_score.min_score,bg_loss_team_score.max_score); return bg->IsTeamScoreInRange(source->GetTeam()==ALLIANCE ? HORDE : ALLIANCE,bg_loss_team_score.min_score,bg_loss_team_score.max_score);
} }
case ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT: case ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT:
{
if (!source->IsInWorld()) if (!source->IsInWorld())
return false; return false;
Map* map = source->GetMap(); Map* map = source->GetMap();
@ -334,6 +345,15 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
return false; return false;
} }
return data->CheckAchievementCriteriaMeet(criteria_id, source, target, miscvalue1); return data->CheckAchievementCriteriaMeet(criteria_id, source, target, miscvalue1);
}
case ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM:
{
Item* item = source->GetItemByPos(INVENTORY_SLOT_BAG_0,miscvalue1);
if (!item)
return false;
ItemPrototype const* proto = item->GetProto();
return proto->ItemLevel >= equipped_item.item_level && proto->Quality >= equipped_item.item_quality;
}
} }
return false; return false;
} }
@ -713,6 +733,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST:
case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS:
case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS: /* FIXME: for online player only currently */
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED:
case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
@ -724,12 +746,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break; break;
// std case: increment at miscvalue1 // std case: increment at miscvalue1
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS:
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD: case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:/* FIXME: for online player only currently */
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
@ -1194,6 +1218,21 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, 1); SetCriteriaProgress(achievementCriteria, 1);
break; break;
} }
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
{
// miscvalue1 = equip_slot+1 (for avoid use 0)
if(!miscvalue1)
continue;
uint32 item_slot = miscvalue1-1;
if(item_slot != achievementCriteria->equip_epic_item.itemSlot)
continue;
// those requirements couldn't be found in the dbc
AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria);
if(!data || !data->Meets(GetPlayer(),unit,item_slot))
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_SET);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT:
{ {
@ -1269,6 +1308,23 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if (!miscvalue1)
continue;
// those requirements couldn't be found in the dbc
AchievementCriteriaRequirementSet const* data = sAchievementMgr.GetCriteriaRequirementSet(achievementCriteria);
if (!data)
continue;
if (!data->Meets(GetPlayer(),unit))
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
if (!miscvalue1) if (!miscvalue1)
continue; continue;
@ -1324,6 +1380,18 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetVisibleFactionCount()); SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetVisibleFactionCount());
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
{
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if (!miscvalue1)
continue;
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(miscvalue1);
if (!proto || proto->Quality < ITEM_QUALITY_EPIC)
continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
{ {
if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_line.skillLine) if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_line.skillLine)
@ -1379,18 +1447,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING:
case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING: case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING:
case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK: case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS: case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS:
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS:
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE:
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE: case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS: case ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS:
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION: case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS:
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
break; // Not implemented yet :( break; // Not implemented yet :(
} }
if(IsCompletedCriteria(achievementCriteria,achievement)) if(IsCompletedCriteria(achievementCriteria,achievement))
@ -1501,6 +1562,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return progress->counter >= achievementCriteria->gain_exalted_reputation.numberOfExaltedFactions; return progress->counter >= achievementCriteria->gain_exalted_reputation.numberOfExaltedFactions;
case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP: case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP:
return progress->counter >= achievementCriteria->visit_barber.numberOfVisits; return progress->counter >= achievementCriteria->visit_barber.numberOfVisits;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
return progress->counter >= achievementCriteria->equip_epic_item.count;
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT:
return progress->counter >= achievementCriteria->roll_greed_on_loot.count; return progress->counter >= achievementCriteria->roll_greed_on_loot.count;
@ -1518,6 +1581,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return progress->counter >= achievementCriteria->loot_money.goldInCopper; return progress->counter >= achievementCriteria->loot_money.goldInCopper;
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
return progress->counter >= achievementCriteria->use_gameobject.useCount; return progress->counter >= achievementCriteria->use_gameobject.useCount;
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:
return progress->counter >= achievementCriteria->special_pvp_kill.killCount;
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
return progress->counter >= achievementCriteria->fish_in_gameobject.lootCount; return progress->counter >= achievementCriteria->fish_in_gameobject.lootCount;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
@ -1539,17 +1604,23 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER: case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER:
case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM: case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM:
case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS:
case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL: case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL:
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
@ -1983,10 +2054,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaRequirements()
if(criteria->win_rated_arena.flag!=ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE) if(criteria->win_rated_arena.flag!=ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE)
continue; continue;
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: // any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases
if(criteria->do_emote.count==0) if(criteria->do_emote.count==0)
continue; continue;
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL:// any cases
break;
case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: // skip statistics case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: // skip statistics
if(criteria->win_duel.duelCount==0) if(criteria->win_duel.duelCount==0)
continue; continue;

View file

@ -60,10 +60,11 @@ enum AchievementCriteriaRequirementType
ACHIEVEMENT_CRITERIA_REQUIRE_S_DRUNK = 15, // drunken_state 0 (enum DrunkenState) of player ACHIEVEMENT_CRITERIA_REQUIRE_S_DRUNK = 15, // drunken_state 0 (enum DrunkenState) of player
ACHIEVEMENT_CRITERIA_REQUIRE_HOLIDAY = 16, // holiday_id 0 event in holiday time ACHIEVEMENT_CRITERIA_REQUIRE_HOLIDAY = 16, // holiday_id 0 event in holiday time
ACHIEVEMENT_CRITERIA_REQUIRE_BG_LOSS_TEAM_SCORE = 17, // min_score max_score player's team win bg and opposition team have team score in range ACHIEVEMENT_CRITERIA_REQUIRE_BG_LOSS_TEAM_SCORE = 17, // min_score max_score player's team win bg and opposition team have team score in range
ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT = 18, // 0 0 maker instance script call for check curent criteria requirements fit ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT = 18, // 0 0 maker instance script call for check current criteria requirements fit
ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM = 19, // item_level item_quality fir equipped item in slot `misc1` to item level and quality
}; };
#define MAX_ACHIEVEMENT_CRITERIA_REQUIREMENT_TYPE 19 // maximum value in AchievementCriteriaRequirementType enum #define MAX_ACHIEVEMENT_CRITERIA_REQUIREMENT_TYPE 20 // maximum value in AchievementCriteriaRequirementType enum
class Player; class Player;
class Unit; class Unit;
@ -154,6 +155,13 @@ struct AchievementCriteriaRequirement
uint32 min_score; uint32 min_score;
uint32 max_score; uint32 max_score;
} bg_loss_team_score; } bg_loss_team_score;
// ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT = 18 (no data)
// ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM = 19
struct
{
uint32 item_level;
uint32 item_quality;
} equipped_item;
// ... // ...
struct struct
{ {

View file

@ -276,6 +276,8 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK); SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
} }
//this function is called when client bids or buys out auction //this function is called when client bids or buys out auction

View file

@ -143,7 +143,11 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction )
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
if (bidder) if (bidder)
{
bidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template); bidder->GetSession()->SendAuctionBidderNotification( auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
// FIXME: for offline player need also
bidder->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
else else
RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !! RemoveAItem(pItem->GetGUIDLow()); // we have to remove the item, before we delete it !!
@ -225,6 +229,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction )
if (owner) if (owner)
{ {
//FIXME: what do if owner offline //FIXME: what do if owner offline
owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit);
owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid); owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid);
//send auction owner notification, bidder must be current! //send auction owner notification, bidder must be current!
owner->GetSession()->SendAuctionOwnerNotification( auction ); owner->GetSession()->SendAuctionOwnerNotification( auction );

View file

@ -326,6 +326,7 @@ struct AchievementCriteriaEntry
struct struct
{ {
uint32 itemSlot; // 3 uint32 itemSlot; // 3
uint32 count; // 4
} equip_epic_item; } equip_epic_item;
// ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50 // ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50

View file

@ -573,7 +573,10 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
_player->AddItemToBuyBackSlot( pItem ); _player->AddItemToBuyBackSlot( pItem );
} }
_player->ModifyMoney( pProto->SellPrice * count ); uint32 money = pProto->SellPrice * count;
_player->ModifyMoney( money );
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
} }
else else
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
@ -621,6 +624,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
_player->ModifyMoney( -(int32)price ); _player->ModifyMoney( -(int32)price );
_player->RemoveItemFromBuyBackSlot( slot, false ); _player->RemoveItemFromBuyBackSlot( slot, false );
_player->ItemAddedQuestCheck( pItem->GetEntry(), pItem->GetCount()); _player->ItemAddedQuestCheck( pItem->GetEntry(), pItem->GetCount());
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
_player->StoreItem( dest, pItem, true ); _player->StoreItem( dest, pItem, true );
} }
else else

View file

@ -151,6 +151,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
player->SendNewItem(newitem, uint32(item->count), false, false, true); player->SendNewItem(newitem, uint32(item->count), false, false, true);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count);
} }
else else
player->SendEquipError( msg, NULL, NULL ); player->SendEquipError( msg, NULL, NULL );
@ -505,6 +506,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
target->SendNewItem(newitem, uint32(item.count), false, false, true ); target->SendNewItem(newitem, uint32(item.count), false, false, true );
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count);
// mark as looted // mark as looted
item.count=0; item.count=0;

View file

@ -10472,6 +10472,7 @@ Item* Player::StoreNewItem( ItemPosCountVec const& dest, uint32 item, bool updat
if( pItem ) if( pItem )
{ {
ItemAddedQuestCheck( item, count ); ItemAddedQuestCheck( item, count );
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
if(randomPropertyId) if(randomPropertyId)
pItem->SetItemRandomProperties(randomPropertyId); pItem->SetItemRandomProperties(randomPropertyId);
pItem = StoreItem( dest, pItem, update ); pItem = StoreItem( dest, pItem, update );
@ -10613,6 +10614,7 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update )
if (Item *pItem = Item::CreateItem( item, 1, this )) if (Item *pItem = Item::CreateItem( item, 1, this ))
{ {
ItemAddedQuestCheck( item, 1 ); ItemAddedQuestCheck( item, 1 );
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
return EquipItem( pos, pItem, update ); return EquipItem( pos, pItem, update );
} }
@ -10715,6 +10717,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
// only for full equip instead adding to stack // only for full equip instead adding to stack
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, slot+1);
return pItem; return pItem;
} }
@ -10736,6 +10739,7 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem)
} }
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, slot+1);
} }
} }
@ -10879,6 +10883,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
{ {
// update quest counters // update quest counters
ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount()); ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
// store item // store item
Item* pLastItem = StoreItem(dest, pItem, update); Item* pLastItem = StoreItem(dest, pItem, update);

View file

@ -697,14 +697,18 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
{ {
DEBUG_LOG("DealDamage: victim just died"); DEBUG_LOG("DealDamage: victim just died");
if (pVictim->GetTypeId() == TYPEID_PLAYER)
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
// find player: owner of controlled `this` or `this` itself maybe // find player: owner of controlled `this` or `this` itself maybe
Player *player = GetCharmerOrOwnerPlayerOrPlayerItself(); Player *player = GetCharmerOrOwnerPlayerOrPlayerItself();
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient()) if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
player = ((Creature*)pVictim)->GetLootRecipient(); player = ((Creature*)pVictim)->GetLootRecipient();
if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
if (player)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL,1,0,pVictim);
}
// Reward player, his pets, and group/raid members // Reward player, his pets, and group/raid members
// call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
if(player && player!=pVictim) if(player && player!=pVictim)

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 "9424" #define REVISION_NR "9425"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__