mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9715] Implement required basic elements for dual spec learn gossips.
Required DB data for real work. This is final part required at core side for support. Also note that commit include * generic implementation money cost gossip menu items so let implement in DB many money cost gossip operations with _fixed_ cost. * useful CONDITION_SPELL that let implemtn menu item visible if specific spell known/don't known also wide used case for diff gossips. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
f1af55f162
commit
da253087cb
4 changed files with 41 additions and 3 deletions
|
|
@ -7381,6 +7381,15 @@ bool PlayerCondition::Meets(Player const * player) const
|
|||
}
|
||||
case CONDITION_NOITEM:
|
||||
return !player->HasItemCount(value1, value2);
|
||||
case CONDITION_SPELL:
|
||||
{
|
||||
switch(value2)
|
||||
{
|
||||
case 0: return player->HasSpell(value1);
|
||||
case 1: return !player->HasSpell(value1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -7578,6 +7587,22 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
|
|||
|
||||
break;
|
||||
}
|
||||
case CONDITION_SPELL:
|
||||
{
|
||||
if(!sSpellStore.LookupEntry(value1))
|
||||
{
|
||||
sLog.outErrorDb("Spell condition requires to have non existing spell (Id: %d), skipped", value1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value2 > 1)
|
||||
{
|
||||
sLog.outErrorDb("Spell condition has invalid argument %u (must be 0..1), skipped", value2);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CONDITION_NONE:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,9 +314,10 @@ enum ConditionType
|
|||
CONDITION_RACE_CLASS = 14, // race_mask class_mask
|
||||
CONDITION_LEVEL = 15, // player_level 0, 1 or 2 (0: equal to, 1: equal or higher than, 2: equal or less than)
|
||||
CONDITION_NOITEM = 16, // item_id count
|
||||
CONDITION_SPELL = 17, // spell_id 0, 1 (0: has spell, 1: hasn't spell)
|
||||
};
|
||||
|
||||
#define MAX_CONDITION 17 // maximum value in ConditionType enum
|
||||
#define MAX_CONDITION 18 // maximum value in ConditionType enum
|
||||
|
||||
struct PlayerCondition
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12688,8 +12688,20 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
|||
if (menuId != gossipmenu.GetMenuId())
|
||||
return;
|
||||
|
||||
uint32 gossipOptionId = gossipmenu.GetItem(gossipListId).m_gOptionId;
|
||||
GossipMenuItem const& menu_item = gossipmenu.GetItem(gossipListId);
|
||||
|
||||
uint32 gossipOptionId = menu_item.m_gOptionId;
|
||||
uint64 guid = pSource->GetGUID();
|
||||
uint32 moneyTake = menu_item.m_gBoxMoney;
|
||||
|
||||
// if this function called and player have money for pay MoneyTake or cheating, proccess both cases
|
||||
if (moneyTake > 0)
|
||||
{
|
||||
if (GetMoney() >= moneyTake)
|
||||
ModifyMoney(-int32(moneyTake));
|
||||
else
|
||||
return; // cheating
|
||||
}
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9714"
|
||||
#define REVISION_NR "9715"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue