Fixed appearance validation
Implemented proper facial hair validation Implemented transmog Set fix interaction of spells like Shadowmeld with Threat reducing effects
This commit is contained in:
@@ -38,13 +38,13 @@ namespace Framework.Collections
|
|||||||
|
|
||||||
public void delink()
|
public void delink()
|
||||||
{
|
{
|
||||||
if (isInList())
|
if (!isInList())
|
||||||
{
|
return;
|
||||||
iNext.iPrev = iPrev;
|
|
||||||
iPrev.iNext = iNext;
|
iNext.iPrev = iPrev;
|
||||||
iNext = null;
|
iPrev.iNext = iNext;
|
||||||
iPrev = null;
|
iNext = null;
|
||||||
}
|
iPrev = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertBefore(LinkedListElement pElem)
|
public void insertBefore(LinkedListElement pElem)
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ namespace Framework.Constants
|
|||||||
Player = 0x1,
|
Player = 0x1,
|
||||||
Account = 0x2,
|
Account = 0x2,
|
||||||
Guild = 0x4,
|
Guild = 0x4,
|
||||||
Scenario = 0x8
|
Scenario = 0x8,
|
||||||
|
QuestObjective = 0x10
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CriteriaCondition
|
public enum CriteriaCondition
|
||||||
@@ -398,6 +399,7 @@ namespace Framework.Constants
|
|||||||
// 202 - 0 criterias (Legion - 23420)
|
// 202 - 0 criterias (Legion - 23420)
|
||||||
CompleteWorldQuest = 203,
|
CompleteWorldQuest = 203,
|
||||||
// 204 - Special criteria type to award players for some external events? Comes with what looks like an identifier, so guessing it's not unique.
|
// 204 - Special criteria type to award players for some external events? Comes with what looks like an identifier, so guessing it's not unique.
|
||||||
|
TransmogSetUnlocked = 205,
|
||||||
TotalTypes = 208
|
TotalTypes = 208
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -899,6 +899,20 @@ namespace Framework.Constants
|
|||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum CharBaseSectionVariation : byte
|
||||||
|
{
|
||||||
|
Skin = 0,
|
||||||
|
Face = 1,
|
||||||
|
FacialHair = 2,
|
||||||
|
Hair = 3,
|
||||||
|
Underwear = 4,
|
||||||
|
CustomDisplay1 = 5,
|
||||||
|
CustomDisplay2 = 6,
|
||||||
|
CustomDisplay3 = 7,
|
||||||
|
|
||||||
|
Max
|
||||||
|
}
|
||||||
|
|
||||||
public enum CharSectionFlags
|
public enum CharSectionFlags
|
||||||
{
|
{
|
||||||
Player = 0x01,
|
Player = 0x01,
|
||||||
@@ -923,7 +937,9 @@ namespace Framework.Constants
|
|||||||
CustomDisplay2LowRes = 12,
|
CustomDisplay2LowRes = 12,
|
||||||
CustomDisplay2 = 13,
|
CustomDisplay2 = 13,
|
||||||
CustomDisplay3LowRes = 14,
|
CustomDisplay3LowRes = 14,
|
||||||
CustomDisplay3 = 15
|
CustomDisplay3 = 15,
|
||||||
|
|
||||||
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChrSpecializationFlag
|
public enum ChrSpecializationFlag
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Framework.Constants
|
|||||||
CreatureTemplateVehicle = 16,
|
CreatureTemplateVehicle = 16,
|
||||||
Spell = 17,
|
Spell = 17,
|
||||||
SpellClickEvent = 18,
|
SpellClickEvent = 18,
|
||||||
QuestAccept = 19,
|
QuestAvailable = 19,
|
||||||
// Condition source type 20 unused
|
// Condition source type 20 unused
|
||||||
VehicleSpell = 21,
|
VehicleSpell = 21,
|
||||||
SmartEvent = 22,
|
SmartEvent = 22,
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace Framework.Constants
|
|||||||
public const int MaxBankSlots = 98;
|
public const int MaxBankSlots = 98;
|
||||||
public const int BankMoneyLogsTab = 100;
|
public const int BankMoneyLogsTab = 100;
|
||||||
|
|
||||||
public const int WithdrawMoneyUnlimited = -1;
|
public const uint WithdrawMoneyUnlimited = 0xFFFFFFFF;
|
||||||
public const int WithdrawSlotUnlimited = -1;
|
public const uint WithdrawSlotUnlimited = 0xFFFFFFFF;
|
||||||
public const uint EventLogGuidUndefined = 0xFFFFFFFF;
|
public const uint EventLogGuidUndefined = 0xFFFFFFFF;
|
||||||
|
|
||||||
public const uint ChallengesTypes = 6;
|
public const uint ChallengesTypes = 6;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Framework.Constants
|
|||||||
|
|
||||||
public const int ReqPrimaryTreeTalents = 31;
|
public const int ReqPrimaryTreeTalents = 31;
|
||||||
public const int ExploredZonesSize = 256;
|
public const int ExploredZonesSize = 256;
|
||||||
public const long MaxMoneyAmount = long.MaxValue;
|
public const ulong MaxMoneyAmount = ulong.MaxValue;
|
||||||
public const int MaxActionButtons = 132;
|
public const int MaxActionButtons = 132;
|
||||||
public const int MaxActionButtonActionValue = 0x00FFFFFF + 1;
|
public const int MaxActionButtonActionValue = 0x00FFFFFF + 1;
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace Framework.Constants
|
|||||||
AddPctModifier = 108,
|
AddPctModifier = 108,
|
||||||
AddTargetTrigger = 109,
|
AddTargetTrigger = 109,
|
||||||
ModPowerRegenPercent = 110,
|
ModPowerRegenPercent = 110,
|
||||||
AddCasterHitTrigger = 111,
|
InterceptMeleeRangedAttacks = 111,
|
||||||
OverrideClassScripts = 112,
|
OverrideClassScripts = 112,
|
||||||
ModRangedDamageTaken = 113,
|
ModRangedDamageTaken = 113,
|
||||||
ModRangedDamageTakenPct = 114,
|
ModRangedDamageTakenPct = 114,
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ namespace Framework.Database
|
|||||||
PrepareStatement(CharStatements.SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?");
|
PrepareStatement(CharStatements.SEL_CHARACTER_SPELL, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, timer FROM character_queststatus WHERE guid = ? AND status <> 0");
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS, "SELECT quest, status, timer FROM character_queststatus WHERE guid = ? AND status <> 0");
|
||||||
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES, "SELECT quest, objective, data FROM character_queststatus_objectives WHERE guid = ?");
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES, "SELECT quest, objective, data FROM character_queststatus_objectives WHERE guid = ?");
|
||||||
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA, "SELECT questObjectiveId FROM character_queststatus_objectives_criteria WHERE guid = ?");
|
||||||
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS, "SELECT criteriaId, counter, date FROM character_queststatus_objectives_criteria_progress WHERE guid = ?");
|
||||||
|
|
||||||
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?");
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_WEEKLY, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?");
|
PrepareStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_WEEKLY, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?");
|
||||||
@@ -249,8 +251,9 @@ namespace Framework.Database
|
|||||||
PrepareStatement(CharStatements.UPD_GUILD_RANK_BANK_MONEY, "UPDATE guild_rank SET BankMoneyPerDay = ? WHERE rid = ? AND guildid = ?"); // 0: uint32, 1: uint8, 2: uint32
|
PrepareStatement(CharStatements.UPD_GUILD_RANK_BANK_MONEY, "UPDATE guild_rank SET BankMoneyPerDay = ? WHERE rid = ? AND guildid = ?"); // 0: uint32, 1: uint8, 2: uint32
|
||||||
PrepareStatement(CharStatements.UPD_GUILD_BANK_TAB_TEXT, "UPDATE guild_bank_tab SET TabText = ? WHERE guildid = ? AND TabId = ?"); // 0: string, 1: uint32, 2: uint8
|
PrepareStatement(CharStatements.UPD_GUILD_BANK_TAB_TEXT, "UPDATE guild_bank_tab SET TabText = ? WHERE guildid = ? AND TabId = ?"); // 0: string, 1: uint32, 2: uint8
|
||||||
|
|
||||||
PrepareStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW, "INSERT INTO guild_member_withdraw (guid, tab0, tab1, tab2, tab3, tab4, tab5, tab6, tab7, money) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) " +
|
PrepareStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_TABS, "INSERT INTO guild_member_withdraw (guid, tab0, tab1, tab2, tab3, tab4, tab5, tab6, tab7) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) " +
|
||||||
"ON DUPLICATE KEY UPDATE tab0 = VALUES (tab0), tab1 = VALUES (tab1), tab2 = VALUES (tab2), tab3 = VALUES (tab3), tab4 = VALUES (tab4), tab5 = VALUES (tab5), tab6 = VALUES (tab6), tab7 = VALUES (tab7), money = VALUES (money)");
|
"ON DUPLICATE KEY UPDATE tab0 = VALUES (tab0), tab1 = VALUES (tab1), tab2 = VALUES (tab2), tab3 = VALUES (tab3), tab4 = VALUES (tab4), tab5 = VALUES (tab5), tab6 = VALUES (tab6), tab7 = VALUES (tab7)");
|
||||||
|
PrepareStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_MONEY, "INSERT INTO guild_member_withdraw (guid, money) VALUES (?, ?) ON DUPLICATE KEY UPDATE money = VALUES (money)");
|
||||||
PrepareStatement(CharStatements.DEL_GUILD_MEMBER_WITHDRAW, "TRUNCATE guild_member_withdraw");
|
PrepareStatement(CharStatements.DEL_GUILD_MEMBER_WITHDRAW, "TRUNCATE guild_member_withdraw");
|
||||||
|
|
||||||
// 0: uint32, 1: uint32, 2: uint32
|
// 0: uint32, 1: uint32, 2: uint32
|
||||||
@@ -543,6 +546,9 @@ namespace Framework.Database
|
|||||||
PrepareStatement(CharStatements.UPD_CHAR_TAXIMASK, "UPDATE characters SET taximask = ? WHERE guid = ?");
|
PrepareStatement(CharStatements.UPD_CHAR_TAXIMASK, "UPDATE characters SET taximask = ? WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS, "DELETE FROM character_queststatus WHERE guid = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS, "DELETE FROM character_queststatus WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES, "DELETE FROM character_queststatus_objectives WHERE guid = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES, "DELETE FROM character_queststatus_objectives WHERE guid = ?");
|
||||||
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA, "DELETE FROM character_queststatus_objectives_criteria WHERE guid = ?");
|
||||||
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS, "DELETE FROM character_queststatus_objectives_criteria_progress WHERE guid = ?");
|
||||||
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS_BY_CRITERIA, "DELETE FROM character_queststatus_objectives_criteria_progress WHERE guid = ? AND criteriaId = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID, "DELETE FROM character_social WHERE guid = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID, "DELETE FROM character_social WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND, "DELETE FROM character_social WHERE friend = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND, "DELETE FROM character_social WHERE friend = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT, "DELETE FROM character_achievement WHERE achievement = ? AND guid = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT, "DELETE FROM character_achievement WHERE achievement = ? AND guid = ?");
|
||||||
@@ -590,11 +596,14 @@ namespace Framework.Database
|
|||||||
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_BY_QUEST, "DELETE FROM character_queststatus WHERE guid = ? AND quest = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_BY_QUEST, "DELETE FROM character_queststatus WHERE guid = ? AND quest = ?");
|
||||||
PrepareStatement(CharStatements.REP_CHAR_QUESTSTATUS_OBJECTIVES, "REPLACE INTO character_queststatus_objectives (guid, quest, objective, data) VALUES (?, ?, ?, ?)");
|
PrepareStatement(CharStatements.REP_CHAR_QUESTSTATUS_OBJECTIVES, "REPLACE INTO character_queststatus_objectives (guid, quest, objective, data) VALUES (?, ?, ?, ?)");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST, "DELETE FROM character_queststatus_objectives WHERE guid = ? AND quest = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST, "DELETE FROM character_queststatus_objectives WHERE guid = ? AND quest = ?");
|
||||||
|
PrepareStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA, "INSERT INTO character_queststatus_objectives_criteria (guid, questObjectiveId) VALUES (?, ?)");
|
||||||
|
PrepareStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS, "INSERT INTO character_queststatus_objectives_criteria_progress (guid, criteriaId, counter, date) VALUES (?, ?, ?, ?)");
|
||||||
PrepareStatement(CharStatements.INS_CHAR_QUESTSTATUS_REWARDED, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest, active) VALUES (?, ?, 1)");
|
PrepareStatement(CharStatements.INS_CHAR_QUESTSTATUS_REWARDED, "INSERT IGNORE INTO character_queststatus_rewarded (guid, quest, active) VALUES (?, ?, 1)");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, "DELETE FROM character_queststatus_rewarded WHERE guid = ? AND quest = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST, "DELETE FROM character_queststatus_rewarded WHERE guid = ? AND quest = ?");
|
||||||
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE, "UPDATE character_queststatus_rewarded SET quest = ? WHERE quest = ? AND guid = ?");
|
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE, "UPDATE character_queststatus_rewarded SET quest = ? WHERE quest = ? AND guid = ?");
|
||||||
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE, "UPDATE character_queststatus_rewarded SET active = 1 WHERE guid = ?");
|
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE, "UPDATE character_queststatus_rewarded SET active = 1 WHERE guid = ?");
|
||||||
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST, "UPDATE character_queststatus_rewarded SET active = 0 WHERE quest = ? AND guid = ?");
|
PrepareStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST, "UPDATE character_queststatus_rewarded SET active = 0 WHERE quest = ? AND guid = ?");
|
||||||
|
PrepareStatement(CharStatements.DEL_INVALID_QUEST_PROGRESS_CRITERIA, "DELETE FROM character_queststatus_objectives_criteria WHERE questObjectiveId = ?");
|
||||||
PrepareStatement(CharStatements.DEL_CHAR_SKILL_BY_SKILL, "DELETE FROM character_skills WHERE guid = ? AND skill = ?");
|
PrepareStatement(CharStatements.DEL_CHAR_SKILL_BY_SKILL, "DELETE FROM character_skills WHERE guid = ? AND skill = ?");
|
||||||
PrepareStatement(CharStatements.INS_CHAR_SKILLS, "INSERT INTO character_skills (guid, skill, value, max) VALUES (?, ?, ?, ?)");
|
PrepareStatement(CharStatements.INS_CHAR_SKILLS, "INSERT INTO character_skills (guid, skill, value, max) VALUES (?, ?, ?, ?)");
|
||||||
PrepareStatement(CharStatements.UPD_CHAR_SKILLS, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?");
|
PrepareStatement(CharStatements.UPD_CHAR_SKILLS, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?");
|
||||||
@@ -778,6 +787,8 @@ namespace Framework.Database
|
|||||||
|
|
||||||
SEL_CHARACTER_QUESTSTATUS,
|
SEL_CHARACTER_QUESTSTATUS,
|
||||||
SEL_CHARACTER_QUESTSTATUS_OBJECTIVES,
|
SEL_CHARACTER_QUESTSTATUS_OBJECTIVES,
|
||||||
|
SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA,
|
||||||
|
SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS,
|
||||||
SEL_CHARACTER_QUESTSTATUS_DAILY,
|
SEL_CHARACTER_QUESTSTATUS_DAILY,
|
||||||
SEL_CHARACTER_QUESTSTATUS_WEEKLY,
|
SEL_CHARACTER_QUESTSTATUS_WEEKLY,
|
||||||
SEL_CHARACTER_QUESTSTATUS_MONTHLY,
|
SEL_CHARACTER_QUESTSTATUS_MONTHLY,
|
||||||
@@ -913,7 +924,8 @@ namespace Framework.Database
|
|||||||
UPD_GUILD_BANK_MONEY,
|
UPD_GUILD_BANK_MONEY,
|
||||||
UPD_GUILD_RANK_BANK_MONEY,
|
UPD_GUILD_RANK_BANK_MONEY,
|
||||||
UPD_GUILD_BANK_TAB_TEXT,
|
UPD_GUILD_BANK_TAB_TEXT,
|
||||||
INS_GUILD_MEMBER_WITHDRAW,
|
INS_GUILD_MEMBER_WITHDRAW_TABS,
|
||||||
|
INS_GUILD_MEMBER_WITHDRAW_MONEY,
|
||||||
DEL_GUILD_MEMBER_WITHDRAW,
|
DEL_GUILD_MEMBER_WITHDRAW,
|
||||||
SEL_CHAR_DATA_FOR_GUILD,
|
SEL_CHAR_DATA_FOR_GUILD,
|
||||||
DEL_GUILD_ACHIEVEMENT,
|
DEL_GUILD_ACHIEVEMENT,
|
||||||
@@ -1157,6 +1169,9 @@ namespace Framework.Database
|
|||||||
UPD_CHAR_TAXIMASK,
|
UPD_CHAR_TAXIMASK,
|
||||||
DEL_CHAR_QUESTSTATUS,
|
DEL_CHAR_QUESTSTATUS,
|
||||||
DEL_CHAR_QUESTSTATUS_OBJECTIVES,
|
DEL_CHAR_QUESTSTATUS_OBJECTIVES,
|
||||||
|
DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA,
|
||||||
|
DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS,
|
||||||
|
DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS_BY_CRITERIA,
|
||||||
DEL_CHAR_SOCIAL_BY_GUID,
|
DEL_CHAR_SOCIAL_BY_GUID,
|
||||||
DEL_CHAR_SOCIAL_BY_FRIEND,
|
DEL_CHAR_SOCIAL_BY_FRIEND,
|
||||||
DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT,
|
DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT,
|
||||||
@@ -1204,11 +1219,14 @@ namespace Framework.Database
|
|||||||
DEL_CHAR_QUESTSTATUS_BY_QUEST,
|
DEL_CHAR_QUESTSTATUS_BY_QUEST,
|
||||||
REP_CHAR_QUESTSTATUS_OBJECTIVES,
|
REP_CHAR_QUESTSTATUS_OBJECTIVES,
|
||||||
DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST,
|
DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST,
|
||||||
|
INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA,
|
||||||
|
INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS,
|
||||||
INS_CHAR_QUESTSTATUS_REWARDED,
|
INS_CHAR_QUESTSTATUS_REWARDED,
|
||||||
DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST,
|
DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST,
|
||||||
UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE,
|
UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE,
|
||||||
UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE,
|
UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE,
|
||||||
UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST,
|
UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST,
|
||||||
|
DEL_INVALID_QUEST_PROGRESS_CRITERIA,
|
||||||
DEL_CHAR_SKILL_BY_SKILL,
|
DEL_CHAR_SKILL_BY_SKILL,
|
||||||
INS_CHAR_SKILLS,
|
INS_CHAR_SKILLS,
|
||||||
UPD_CHAR_SKILLS,
|
UPD_CHAR_SKILLS,
|
||||||
|
|||||||
@@ -123,9 +123,16 @@ namespace Framework.Database
|
|||||||
"EmoteDelay3, UnkEmoteID, Language, Type, SoundID1, SoundID2, PlayerConditionID FROM broadcast_text ORDER BY ID DESC");
|
"EmoteDelay3, UnkEmoteID, Language, Type, SoundID1, SoundID2, PlayerConditionID FROM broadcast_text ORDER BY ID DESC");
|
||||||
PrepareStatement(HotfixStatements.SEL_BROADCAST_TEXT_LOCALE, "SELECT ID, MaleText_lang, FemaleText_lang FROM broadcast_text_locale WHERE locale = ?");
|
PrepareStatement(HotfixStatements.SEL_BROADCAST_TEXT_LOCALE, "SELECT ID, MaleText_lang, FemaleText_lang FROM broadcast_text_locale WHERE locale = ?");
|
||||||
|
|
||||||
|
// CharacterFacialHairStyles.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_CHARACTER_FACIAL_HAIR_STYLES, "SELECT ID, Geoset1, Geoset2, Geoset3, Geoset4, Geoset5, RaceID, SexID, VariationID" +
|
||||||
|
" FROM character_facial_hair_styles ORDER BY ID DESC");
|
||||||
|
|
||||||
|
// CharBaseSection.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_CHAR_BASE_SECTION, "SELECT ID, Variation, ResolutionVariation, Resolution FROM char_base_section ORDER BY ID DESC");
|
||||||
|
|
||||||
// CharSections.db2
|
// CharSections.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_CHAR_SECTIONS, "SELECT ID, TextureFileDataID1, TextureFileDataID2, TextureFileDataID3, Flags, Race, Gender, GenType, " +
|
PrepareStatement(HotfixStatements.SEL_CHAR_SECTIONS, "SELECT ID, TextureFileDataID1, TextureFileDataID2, TextureFileDataID3, Flags, RaceID, SexID, " +
|
||||||
"Type, Color FROM char_sections ORDER BY ID DESC");
|
"BaseSection, VariationIndex, ColorIndex FROM char_sections ORDER BY ID DESC");
|
||||||
|
|
||||||
// CharStartOutfit.db2
|
// CharStartOutfit.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_CHAR_START_OUTFIT, "SELECT ID, ItemID1, ItemID2, ItemID3, ItemID4, ItemID5, ItemID6, ItemID7, ItemID8, ItemID9, " +
|
PrepareStatement(HotfixStatements.SEL_CHAR_START_OUTFIT, "SELECT ID, ItemID1, ItemID2, ItemID3, ItemID4, ItemID5, ItemID6, ItemID7, ItemID8, ItemID9, " +
|
||||||
@@ -926,6 +933,21 @@ namespace Framework.Database
|
|||||||
PrepareStatement(HotfixStatements.SEL_TOY, "SELECT ItemID, Description, Flags, CategoryFilter, ID FROM toy ORDER BY ID DESC");
|
PrepareStatement(HotfixStatements.SEL_TOY, "SELECT ItemID, Description, Flags, CategoryFilter, ID FROM toy ORDER BY ID DESC");
|
||||||
PrepareStatement(HotfixStatements.SEL_TOY_LOCALE, "SELECT ID, Description_lang FROM toy_locale WHERE locale = ?");
|
PrepareStatement(HotfixStatements.SEL_TOY_LOCALE, "SELECT ID, Description_lang FROM toy_locale WHERE locale = ?");
|
||||||
|
|
||||||
|
// TransmogHoliday.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_HOLIDAY, "SELECT ID, HolidayID FROM transmog_holiday ORDER BY ID DESC");
|
||||||
|
|
||||||
|
// TransmogSet.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_SET, "SELECT Name, BaseSetID, UIOrder, ExpansionID, ID, Flags, QuestID, ClassMask, ItemNameDescriptionID, " +
|
||||||
|
"TransmogSetGroupID FROM transmog_set ORDER BY ID DESC");
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_SET_LOCALE, "SELECT ID, Name_lang FROM transmog_set_locale WHERE locale = ?");
|
||||||
|
|
||||||
|
// TransmogSetGroup.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_SET_GROUP, "SELECT Label, ID FROM transmog_set_group ORDER BY ID DESC");
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_SET_GROUP_LOCALE, "SELECT ID, Label_lang FROM transmog_set_group_locale WHERE locale = ?");
|
||||||
|
|
||||||
|
// TransmogSetItem.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_TRANSMOG_SET_ITEM, "SELECT ID, TransmogSetID, ItemModifiedAppearanceID, Flags FROM transmog_set_item ORDER BY ID DESC");
|
||||||
|
|
||||||
// TransportAnimation.db2
|
// TransportAnimation.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_TRANSPORT_ANIMATION, "SELECT ID, TransportID, TimeIndex, PosX, PosY, PosZ, SequenceID FROM transport_animation" +
|
PrepareStatement(HotfixStatements.SEL_TRANSPORT_ANIMATION, "SELECT ID, TransportID, TimeIndex, PosX, PosY, PosZ, SequenceID FROM transport_animation" +
|
||||||
" ORDER BY ID DESC");
|
" ORDER BY ID DESC");
|
||||||
@@ -1050,6 +1072,10 @@ namespace Framework.Database
|
|||||||
SEL_BROADCAST_TEXT,
|
SEL_BROADCAST_TEXT,
|
||||||
SEL_BROADCAST_TEXT_LOCALE,
|
SEL_BROADCAST_TEXT_LOCALE,
|
||||||
|
|
||||||
|
SEL_CHARACTER_FACIAL_HAIR_STYLES,
|
||||||
|
|
||||||
|
SEL_CHAR_BASE_SECTION,
|
||||||
|
|
||||||
SEL_CHAR_SECTIONS,
|
SEL_CHAR_SECTIONS,
|
||||||
|
|
||||||
SEL_CHAR_START_OUTFIT,
|
SEL_CHAR_START_OUTFIT,
|
||||||
@@ -1462,6 +1488,16 @@ namespace Framework.Database
|
|||||||
SEL_TOY,
|
SEL_TOY,
|
||||||
SEL_TOY_LOCALE,
|
SEL_TOY_LOCALE,
|
||||||
|
|
||||||
|
SEL_TRANSMOG_HOLIDAY,
|
||||||
|
|
||||||
|
SEL_TRANSMOG_SET,
|
||||||
|
SEL_TRANSMOG_SET_LOCALE,
|
||||||
|
|
||||||
|
SEL_TRANSMOG_SET_GROUP,
|
||||||
|
SEL_TRANSMOG_SET_GROUP_LOCALE,
|
||||||
|
|
||||||
|
SEL_TRANSMOG_SET_ITEM,
|
||||||
|
|
||||||
SEL_TRANSPORT_ANIMATION,
|
SEL_TRANSPORT_ANIMATION,
|
||||||
|
|
||||||
SEL_TRANSPORT_ROTATION,
|
SEL_TRANSPORT_ROTATION,
|
||||||
|
|||||||
@@ -94,12 +94,9 @@ namespace Framework.Dynamic
|
|||||||
|
|
||||||
public void clearReferences()
|
public void clearReferences()
|
||||||
{
|
{
|
||||||
LinkedListElement curr;
|
Reference<TO, FROM> refe;
|
||||||
while ((curr = base.GetFirstElement()) != null)
|
while ((refe = getFirst()) != null)
|
||||||
{
|
refe.invalidate();
|
||||||
((Reference<TO, FROM>)curr).invalidate();
|
|
||||||
curr.delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
go = g;
|
go = g;
|
||||||
_scheduler = new TaskScheduler();
|
_scheduler = new TaskScheduler();
|
||||||
|
_events = new EventMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UpdateAI(uint diff) { }
|
public virtual void UpdateAI(uint diff) { }
|
||||||
@@ -56,6 +57,7 @@ namespace Game.AI
|
|||||||
public virtual void EventInform(uint eventId) { }
|
public virtual void EventInform(uint eventId) { }
|
||||||
|
|
||||||
protected TaskScheduler _scheduler;
|
protected TaskScheduler _scheduler;
|
||||||
|
protected EventMap _events;
|
||||||
|
|
||||||
public GameObject go;
|
public GameObject go;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,8 +218,7 @@ namespace Game.AI
|
|||||||
int index = RandomHelper.IRand(0, targetSpellStore.Count - 1);
|
int index = RandomHelper.IRand(0, targetSpellStore.Count - 1);
|
||||||
var tss = targetSpellStore[index];
|
var tss = targetSpellStore[index];
|
||||||
|
|
||||||
Spell spell = tss.Item2;
|
(Unit target, Spell spell) = tss;
|
||||||
Unit target = tss.Item1;
|
|
||||||
|
|
||||||
targetSpellStore.RemoveAt(index);
|
targetSpellStore.RemoveAt(index);
|
||||||
|
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ namespace Game
|
|||||||
|
|
||||||
public void UpdateAccountAccess(RBACData rbac, uint accountId, byte securityLevel, int realmId)
|
public void UpdateAccountAccess(RBACData rbac, uint accountId, byte securityLevel, int realmId)
|
||||||
{
|
{
|
||||||
if (rbac != null && securityLevel == rbac.GetSecurityLevel())
|
if (rbac != null && securityLevel != rbac.GetSecurityLevel())
|
||||||
rbac.SetSecurityLevel(securityLevel);
|
rbac.SetSecurityLevel(securityLevel);
|
||||||
|
|
||||||
PreparedStatement stmt;
|
PreparedStatement stmt;
|
||||||
|
|||||||
@@ -332,6 +332,16 @@ namespace Game.Achievements
|
|||||||
case CriteriaTypes.ReachGuildLevel:
|
case CriteriaTypes.ReachGuildLevel:
|
||||||
SetCriteriaProgress(criteria, miscValue1, referencePlayer);
|
SetCriteriaProgress(criteria, miscValue1, referencePlayer);
|
||||||
break;
|
break;
|
||||||
|
case CriteriaTypes.TransmogSetUnlocked:
|
||||||
|
if (miscValue1 != criteria.Entry.Asset)
|
||||||
|
continue;
|
||||||
|
SetCriteriaProgress(criteria, 1, referencePlayer, ProgressType.Accumulate);
|
||||||
|
break;
|
||||||
|
case CriteriaTypes.AppearanceUnlockedBySlot:
|
||||||
|
if (miscValue2 == 0 /*login case*/ || miscValue1 != criteria.Entry.Asset)
|
||||||
|
continue;
|
||||||
|
SetCriteriaProgress(criteria, 1, referencePlayer, ProgressType.Accumulate);
|
||||||
|
break;
|
||||||
// FIXME: not triggered in code as result, need to implement
|
// FIXME: not triggered in code as result, need to implement
|
||||||
case CriteriaTypes.CompleteRaid:
|
case CriteriaTypes.CompleteRaid:
|
||||||
case CriteriaTypes.PlayArena:
|
case CriteriaTypes.PlayArena:
|
||||||
@@ -749,6 +759,7 @@ namespace Game.Achievements
|
|||||||
case CriteriaTypes.Currency:
|
case CriteriaTypes.Currency:
|
||||||
case CriteriaTypes.PlaceGarrisonBuilding:
|
case CriteriaTypes.PlaceGarrisonBuilding:
|
||||||
case CriteriaTypes.OwnBattlePetCount:
|
case CriteriaTypes.OwnBattlePetCount:
|
||||||
|
case CriteriaTypes.AppearanceUnlockedBySlot:
|
||||||
return progress.Counter >= requiredAmount;
|
return progress.Counter >= requiredAmount;
|
||||||
case CriteriaTypes.CompleteAchievement:
|
case CriteriaTypes.CompleteAchievement:
|
||||||
case CriteriaTypes.CompleteQuest:
|
case CriteriaTypes.CompleteQuest:
|
||||||
@@ -758,6 +769,7 @@ namespace Game.Achievements
|
|||||||
case CriteriaTypes.OwnBattlePet:
|
case CriteriaTypes.OwnBattlePet:
|
||||||
case CriteriaTypes.HonorLevelReached:
|
case CriteriaTypes.HonorLevelReached:
|
||||||
case CriteriaTypes.PrestigeReached:
|
case CriteriaTypes.PrestigeReached:
|
||||||
|
case CriteriaTypes.TransmogSetUnlocked:
|
||||||
return progress.Counter >= 1;
|
return progress.Counter >= 1;
|
||||||
case CriteriaTypes.LearnSkillLevel:
|
case CriteriaTypes.LearnSkillLevel:
|
||||||
return progress.Counter >= (requiredAmount * 75);
|
return progress.Counter >= (requiredAmount * 75);
|
||||||
@@ -1444,19 +1456,34 @@ namespace Game.Achievements
|
|||||||
scenarioCriteriaTreeIds[scenarioStep.CriteriaTreeID] = scenarioStep;
|
scenarioCriteriaTreeIds[scenarioStep.CriteriaTreeID] = scenarioStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary<uint /*criteriaTreeID*/, QuestObjective> questObjectiveCriteriaTreeIds = new Dictionary<uint, QuestObjective>();
|
||||||
|
foreach (var pair in Global.ObjectMgr.GetQuestTemplates())
|
||||||
|
{
|
||||||
|
foreach (QuestObjective objective in pair.Value.Objectives)
|
||||||
|
{
|
||||||
|
if (objective.Type != QuestObjectiveType.CriteriaTree)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (objective.ObjectID != 0)
|
||||||
|
questObjectiveCriteriaTreeIds[(uint)objective.ObjectID] = objective;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load criteria tree nodes
|
// Load criteria tree nodes
|
||||||
foreach (CriteriaTreeRecord tree in CliDB.CriteriaTreeStorage.Values)
|
foreach (CriteriaTreeRecord tree in CliDB.CriteriaTreeStorage.Values)
|
||||||
{
|
{
|
||||||
// Find linked achievement
|
// Find linked achievement
|
||||||
AchievementRecord achievement = GetEntry(achievementCriteriaTreeIds, tree);
|
AchievementRecord achievement = GetEntry(achievementCriteriaTreeIds, tree);
|
||||||
ScenarioStepRecord scenarioStep = GetEntry(scenarioCriteriaTreeIds, tree);
|
ScenarioStepRecord scenarioStep = GetEntry(scenarioCriteriaTreeIds, tree);
|
||||||
if (achievement == null && scenarioStep == null)
|
QuestObjective questObjective = GetEntry(questObjectiveCriteriaTreeIds, tree);
|
||||||
|
if (achievement == null && scenarioStep == null && questObjective == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CriteriaTree criteriaTree = new CriteriaTree();
|
CriteriaTree criteriaTree = new CriteriaTree();
|
||||||
criteriaTree.ID = tree.Id;
|
criteriaTree.ID = tree.Id;
|
||||||
criteriaTree.Achievement = achievement;
|
criteriaTree.Achievement = achievement;
|
||||||
criteriaTree.ScenarioStep = scenarioStep;
|
criteriaTree.ScenarioStep = scenarioStep;
|
||||||
|
criteriaTree.QuestObjective = questObjective;
|
||||||
criteriaTree.Entry = tree;
|
criteriaTree.Entry = tree;
|
||||||
|
|
||||||
_criteriaTrees[criteriaTree.Entry.Id] = criteriaTree;
|
_criteriaTrees[criteriaTree.Entry.Id] = criteriaTree;
|
||||||
@@ -1491,6 +1518,7 @@ namespace Game.Achievements
|
|||||||
uint criterias = 0;
|
uint criterias = 0;
|
||||||
uint guildCriterias = 0;
|
uint guildCriterias = 0;
|
||||||
uint scenarioCriterias = 0;
|
uint scenarioCriterias = 0;
|
||||||
|
uint questObjectiveCriterias = 0;
|
||||||
foreach (CriteriaRecord criteriaEntry in CliDB.CriteriaStorage.Values)
|
foreach (CriteriaRecord criteriaEntry in CliDB.CriteriaStorage.Values)
|
||||||
{
|
{
|
||||||
Contract.Assert(criteriaEntry.Type < CriteriaTypes.TotalTypes, string.Format("CRITERIA_TYPE_TOTAL must be greater than or equal to {0} but is currently equal to {1}", criteriaEntry.Type + 1, CriteriaTypes.TotalTypes));
|
Contract.Assert(criteriaEntry.Type < CriteriaTypes.TotalTypes, string.Format("CRITERIA_TYPE_TOTAL must be greater than or equal to {0} but is currently equal to {1}", criteriaEntry.Type + 1, CriteriaTypes.TotalTypes));
|
||||||
@@ -1522,6 +1550,8 @@ namespace Game.Achievements
|
|||||||
}
|
}
|
||||||
else if (tree.ScenarioStep != null)
|
else if (tree.ScenarioStep != null)
|
||||||
criteria.FlagsCu |= CriteriaFlagsCu.Scenario;
|
criteria.FlagsCu |= CriteriaFlagsCu.Scenario;
|
||||||
|
else if (tree.QuestObjective != null)
|
||||||
|
criteria.FlagsCu |= CriteriaFlagsCu.QuestObjective;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (criteria.FlagsCu.HasAnyFlag(CriteriaFlagsCu.Player | CriteriaFlagsCu.Account))
|
if (criteria.FlagsCu.HasAnyFlag(CriteriaFlagsCu.Player | CriteriaFlagsCu.Account))
|
||||||
@@ -1542,6 +1572,12 @@ namespace Game.Achievements
|
|||||||
_scenarioCriteriasByType.Add(criteriaEntry.Type, criteria);
|
_scenarioCriteriasByType.Add(criteriaEntry.Type, criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (criteria.FlagsCu.HasAnyFlag(CriteriaFlagsCu.QuestObjective))
|
||||||
|
{
|
||||||
|
++questObjectiveCriterias;
|
||||||
|
_questObjectiveCriteriasByType.Add(criteriaEntry.Type, criteria);
|
||||||
|
}
|
||||||
|
|
||||||
if (criteriaEntry.StartTimer != 0)
|
if (criteriaEntry.StartTimer != 0)
|
||||||
_criteriasByTimedType.Add(criteriaEntry.StartEvent, criteria);
|
_criteriasByTimedType.Add(criteriaEntry.StartEvent, criteria);
|
||||||
}
|
}
|
||||||
@@ -1549,7 +1585,7 @@ namespace Game.Achievements
|
|||||||
foreach (var p in _criteriaTrees)
|
foreach (var p in _criteriaTrees)
|
||||||
p.Value.Criteria = GetCriteria(p.Value.Entry.CriteriaID);
|
p.Value.Criteria = GetCriteria(p.Value.Entry.CriteriaID);
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} criteria, {1} guild criteria and {2} scenario criteria in {3} ms.", criterias, guildCriterias, scenarioCriterias, Time.GetMSTimeDiffToNow(oldMSTime));
|
Log.outInfo(LogFilter.ServerLoading, "Loaded {criterias} criteria, {guildCriterias} guild criteria, {scenarioCriterias} scenario criteria and {questObjectiveCriterias} quest objective criteria in {Time.GetMSTimeDiffToNow(oldMSTime)} ms.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadCriteriaData()
|
public void LoadCriteriaData()
|
||||||
@@ -1640,6 +1676,11 @@ namespace Game.Achievements
|
|||||||
return _scenarioCriteriasByType.LookupByKey(type);
|
return _scenarioCriteriasByType.LookupByKey(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Criteria> GetQuestObjectiveCriteriaByType(CriteriaTypes type)
|
||||||
|
{
|
||||||
|
return _questObjectiveCriteriasByType[type];
|
||||||
|
}
|
||||||
|
|
||||||
public List<CriteriaTree> GetCriteriaTreesByCriteria(uint criteriaId)
|
public List<CriteriaTree> GetCriteriaTreesByCriteria(uint criteriaId)
|
||||||
{
|
{
|
||||||
return _criteriaTreeByCriteria.LookupByKey(criteriaId);
|
return _criteriaTreeByCriteria.LookupByKey(criteriaId);
|
||||||
@@ -1693,6 +1734,7 @@ namespace Game.Achievements
|
|||||||
MultiMap<CriteriaTypes, Criteria> _criteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
MultiMap<CriteriaTypes, Criteria> _criteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
||||||
MultiMap<CriteriaTypes, Criteria> _guildCriteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
MultiMap<CriteriaTypes, Criteria> _guildCriteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
||||||
MultiMap<CriteriaTypes, Criteria> _scenarioCriteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
MultiMap<CriteriaTypes, Criteria> _scenarioCriteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
||||||
|
MultiMap<CriteriaTypes, Criteria> _questObjectiveCriteriasByType = new MultiMap<CriteriaTypes, Criteria>();
|
||||||
|
|
||||||
MultiMap<CriteriaTimedTypes, Criteria> _criteriasByTimedType = new MultiMap<CriteriaTimedTypes, Criteria>();
|
MultiMap<CriteriaTimedTypes, Criteria> _criteriasByTimedType = new MultiMap<CriteriaTimedTypes, Criteria>();
|
||||||
}
|
}
|
||||||
@@ -1717,6 +1759,7 @@ namespace Game.Achievements
|
|||||||
public CriteriaTreeRecord Entry;
|
public CriteriaTreeRecord Entry;
|
||||||
public AchievementRecord Achievement;
|
public AchievementRecord Achievement;
|
||||||
public ScenarioStepRecord ScenarioStep;
|
public ScenarioStepRecord ScenarioStep;
|
||||||
|
public QuestObjective QuestObjective;
|
||||||
public Criteria Criteria;
|
public Criteria Criteria;
|
||||||
public List<CriteriaTree> Children = new List<CriteriaTree>();
|
public List<CriteriaTree> Children = new List<CriteriaTree>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Game
|
|||||||
return mNeutralAuctions;
|
return mNeutralAuctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAuctionDeposit(AuctionHouseRecord entry, uint time, Item pItem, uint count)
|
public ulong GetAuctionDeposit(AuctionHouseRecord entry, uint time, Item pItem, uint count)
|
||||||
{
|
{
|
||||||
uint MSV = pItem.GetTemplate().GetSellPrice();
|
uint MSV = pItem.GetTemplate().GetSellPrice();
|
||||||
|
|
||||||
@@ -60,12 +60,12 @@ namespace Game
|
|||||||
|
|
||||||
float multiplier = MathFunctions.CalculatePct((float)entry.DepositRate, 3);
|
float multiplier = MathFunctions.CalculatePct((float)entry.DepositRate, 3);
|
||||||
uint timeHr = (((time / 60) / 60) / 12);
|
uint timeHr = (((time / 60) / 60) / 12);
|
||||||
uint deposit = (uint)(((multiplier * MSV * count / 3) * timeHr * 3) * WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit));
|
ulong deposit = (ulong)(((multiplier * MSV * count / 3) * timeHr * 3) * WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit));
|
||||||
|
|
||||||
Log.outDebug(LogFilter.Auctionhouse, "MSV: {0}", MSV);
|
Log.outDebug(LogFilter.Auctionhouse, $"MSV: {MSV}");
|
||||||
Log.outDebug(LogFilter.Auctionhouse, "Items: {0}", count);
|
Log.outDebug(LogFilter.Auctionhouse, $"Items: {count}");
|
||||||
Log.outDebug(LogFilter.Auctionhouse, "Multiplier: {0}", multiplier);
|
Log.outDebug(LogFilter.Auctionhouse, $"Multiplier: {multiplier}");
|
||||||
Log.outDebug(LogFilter.Auctionhouse, "Deposit: {0}", deposit);
|
Log.outDebug(LogFilter.Auctionhouse, $"Deposit: {deposit}");
|
||||||
|
|
||||||
if (deposit < AH_MINIMUM_DEPOSIT * WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit))
|
if (deposit < AH_MINIMUM_DEPOSIT * WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit))
|
||||||
return AH_MINIMUM_DEPOSIT * (uint)WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit);
|
return AH_MINIMUM_DEPOSIT * (uint)WorldConfig.GetFloatValue(WorldCfg.RateAuctionDeposit);
|
||||||
@@ -110,8 +110,7 @@ namespace Game
|
|||||||
|
|
||||||
uint ownerAccId = ObjectManager.GetPlayerAccountIdByGUID(ownerGuid);
|
uint ownerAccId = ObjectManager.GetPlayerAccountIdByGUID(ownerGuid);
|
||||||
|
|
||||||
Log.outCommand(bidderAccId, "GM {0} (Account: {1}) won item in auction: {2} (Entry: {3} Count: {4}) and pay money: {5}. Original owner {6} (Account: {7})",
|
Log.outCommand(bidderAccId, $"GM {bidderName} (Account: {bidderAccId}) won item in auction: {item.GetTemplate().GetName()} (Entry: {item.GetEntry()} Count: {item.GetCount()}) and pay money: {auction.bid}. Original owner {ownerName} (Account: {ownerAccId})");
|
||||||
bidderName, bidderAccId, item.GetTemplate().GetName(), item.GetEntry(), item.GetCount(), auction.bid, ownerName, ownerAccId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// receiver exist
|
// receiver exist
|
||||||
@@ -164,7 +163,7 @@ namespace Game
|
|||||||
// owner exist
|
// owner exist
|
||||||
if (owner || owner_accId != 0)
|
if (owner || owner_accId != 0)
|
||||||
{
|
{
|
||||||
uint profit = auction.bid + auction.deposit - auction.GetAuctionCut();
|
ulong profit = auction.bid + auction.deposit - auction.GetAuctionCut();
|
||||||
|
|
||||||
//FIXME: what do if owner offline
|
//FIXME: what do if owner offline
|
||||||
if (owner && item)
|
if (owner && item)
|
||||||
@@ -662,19 +661,19 @@ namespace Game
|
|||||||
items.Add(auctionItem);
|
items.Add(auctionItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAuctionCut()
|
public ulong GetAuctionCut()
|
||||||
{
|
{
|
||||||
int cut = (int)(MathFunctions.CalculatePct(bid, auctionHouseEntry.ConsignmentRate) * WorldConfig.GetFloatValue(WorldCfg.RateAuctionCut));
|
long cut = (long)(MathFunctions.CalculatePct(bid, auctionHouseEntry.ConsignmentRate) * WorldConfig.GetFloatValue(WorldCfg.RateAuctionCut));
|
||||||
return (uint)Math.Max(cut, 0);
|
return (ulong)Math.Max(cut, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
|
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public uint GetAuctionOutBid()
|
public ulong GetAuctionOutBid()
|
||||||
{
|
{
|
||||||
uint outbid = MathFunctions.CalculatePct(bid, 5);
|
ulong outbid = MathFunctions.CalculatePct(bid, 5);
|
||||||
return outbid != 0 ? outbid : 1;
|
return outbid != 0 ? outbid : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,12 +708,12 @@ namespace Game
|
|||||||
itemEntry = fields.Read<uint>(3);
|
itemEntry = fields.Read<uint>(3);
|
||||||
itemCount = fields.Read<uint>(4);
|
itemCount = fields.Read<uint>(4);
|
||||||
owner = fields.Read<ulong>(5);
|
owner = fields.Read<ulong>(5);
|
||||||
buyout = fields.Read<uint>(6);
|
buyout = fields.Read<ulong>(6);
|
||||||
expire_time = fields.Read<uint>(7);
|
expire_time = fields.Read<uint>(7);
|
||||||
bidder = fields.Read<ulong>(8);
|
bidder = fields.Read<ulong>(8);
|
||||||
bid = fields.Read<uint>(9);
|
bid = fields.Read<ulong>(9);
|
||||||
startbid = fields.Read<uint>(10);
|
startbid = fields.Read<ulong>(10);
|
||||||
deposit = fields.Read<uint>(11);
|
deposit = fields.Read<ulong>(11);
|
||||||
|
|
||||||
CreatureData auctioneerData = Global.ObjectMgr.GetCreatureData(auctioneer);
|
CreatureData auctioneerData = Global.ObjectMgr.GetCreatureData(auctioneer);
|
||||||
if (auctioneerData == null)
|
if (auctioneerData == null)
|
||||||
@@ -798,9 +797,9 @@ namespace Game
|
|||||||
return string.Format("{0}:0:{1}:{2}:{3}", itemEntry, response, Id, itemCount);
|
return string.Format("{0}:0:{1}:{2}:{3}", itemEntry, response, Id, itemCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string BuildAuctionMailBody(ulong lowGuid, uint bid, uint buyout, uint deposit, uint cut)
|
public static string BuildAuctionMailBody(ulong lowGuid, ulong bid, ulong buyout, ulong deposit, ulong cut)
|
||||||
{
|
{
|
||||||
return string.Format("{0}:{1}:{2}:{3}:{4}", lowGuid, bid, buyout, deposit, cut);
|
return string.Format($"{lowGuid}:{bid}:{buyout}:{deposit}:{cut}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
@@ -813,12 +812,12 @@ namespace Game
|
|||||||
public uint itemEntry;
|
public uint itemEntry;
|
||||||
public uint itemCount;
|
public uint itemCount;
|
||||||
public ulong owner;
|
public ulong owner;
|
||||||
public uint startbid; //maybe useless
|
public ulong startbid; //maybe useless
|
||||||
public uint bid;
|
public ulong bid;
|
||||||
public uint buyout;
|
public ulong buyout;
|
||||||
public long expire_time;
|
public long expire_time;
|
||||||
public ulong bidder;
|
public ulong bidder;
|
||||||
public uint deposit; //deposit can be calculated only when creating auction
|
public ulong deposit; //deposit can be calculated only when creating auction
|
||||||
public uint etime;
|
public uint etime;
|
||||||
uint houseId;
|
uint houseId;
|
||||||
public AuctionHouseRecord auctionHouseEntry; // in AuctionHouse.dbc
|
public AuctionHouseRecord auctionHouseEntry; // in AuctionHouse.dbc
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
// remove objects and creatures
|
// remove objects and creatures
|
||||||
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
// (this is done automatically in mapmanager update, when the instance is reset after the reset time)
|
||||||
foreach (var type in BgCreatures.Keys)
|
for (var i = 0; i < BgCreatures.Length; ++i)
|
||||||
DelCreature(type);
|
DelCreature(i);
|
||||||
|
|
||||||
foreach (var type in BgObjects.Keys)
|
for (var i = 0; i < BgObjects.Length; ++i)
|
||||||
DelObject(type);
|
DelObject(i);
|
||||||
|
|
||||||
Global.BattlegroundMgr.RemoveBattleground(GetTypeID(), GetInstanceID());
|
Global.BattlegroundMgr.RemoveBattleground(GetTypeID(), GetInstanceID());
|
||||||
// unload map
|
// unload map
|
||||||
@@ -550,7 +550,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendChatMessage(Creature source, byte textId, WorldObject target = null)
|
public void SendChatMessage(Creature source, byte textId, WorldObject target = null)
|
||||||
{
|
{
|
||||||
Global.CreatureTextMgr.SendChat(source, textId, target);
|
Global.CreatureTextMgr.SendChat(source, textId, target);
|
||||||
}
|
}
|
||||||
@@ -628,6 +628,15 @@ namespace Game.BattleGrounds
|
|||||||
SendPacketToAll(worldstate);
|
SendPacketToAll(worldstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateWorldState(uint variable, bool value, bool hidden = false)
|
||||||
|
{
|
||||||
|
UpdateWorldState worldstate = new UpdateWorldState();
|
||||||
|
worldstate.VariableID = variable;
|
||||||
|
worldstate.Value = value ? 1 : 0;
|
||||||
|
worldstate.Hidden = hidden;
|
||||||
|
SendPacketToAll(worldstate);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void EndBattleground(Team winner)
|
public virtual void EndBattleground(Team winner)
|
||||||
{
|
{
|
||||||
RemoveFromBGFreeSlotQueue();
|
RemoveFromBGFreeSlotQueue();
|
||||||
@@ -1369,7 +1378,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public GameObject GetBGObject(int type)
|
public GameObject GetBGObject(int type)
|
||||||
{
|
{
|
||||||
if (!BgObjects.ContainsKey(type))
|
if (BgObjects[type].IsEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||||
@@ -1381,7 +1390,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public Creature GetBGCreature(int type)
|
public Creature GetBGCreature(int type)
|
||||||
{
|
{
|
||||||
if (!BgCreatures.ContainsKey(type))
|
if (BgCreatures[type].IsEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
||||||
@@ -1470,7 +1479,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public bool DelCreature(int type)
|
public bool DelCreature(int type)
|
||||||
{
|
{
|
||||||
if (!BgCreatures.ContainsKey(type) || BgCreatures[type].IsEmpty())
|
if (BgCreatures[type].IsEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
||||||
@@ -1487,7 +1496,7 @@ namespace Game.BattleGrounds
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DelObject(int type)
|
public bool DelObject(int type)
|
||||||
{
|
{
|
||||||
if (BgObjects[type].IsEmpty())
|
if (BgObjects[type].IsEmpty())
|
||||||
return true;
|
return true;
|
||||||
@@ -1500,8 +1509,7 @@ namespace Game.BattleGrounds
|
|||||||
BgObjects[type].Clear();
|
BgObjects[type].Clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.DelObject: gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!",
|
Log.outError(LogFilter.Battleground, "Battleground.DelObject: gameobject (type: {0}, {1}) not found for BG (map: {2}, instance id: {3})!", type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
||||||
type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
|
|
||||||
BgObjects[type].Clear();
|
BgObjects[type].Clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1581,7 +1589,7 @@ namespace Game.BattleGrounds
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Change buff type, when buff is used:
|
// Change buff type, when buff is used:
|
||||||
int index = BgObjects.Count - 1;
|
int index = BgObjects.Length - 1;
|
||||||
while (index >= 0 && BgObjects[index] != goGuid)
|
while (index >= 0 && BgObjects[index] != goGuid)
|
||||||
index--;
|
index--;
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
@@ -1716,7 +1724,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
int GetObjectType(ObjectGuid guid)
|
int GetObjectType(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < BgObjects.Count; ++i)
|
for (int i = 0; i < BgObjects.Length; ++i)
|
||||||
if (BgObjects[i] == guid)
|
if (BgObjects[i] == guid)
|
||||||
return i;
|
return i;
|
||||||
Log.outError(LogFilter.Battleground, "Battleground.GetObjectType: player used gameobject ({0}) which is not in internal data for BG (map: {1}, instance id: {2}), cheating?",
|
Log.outError(LogFilter.Battleground, "Battleground.GetObjectType: player used gameobject ({0}) which is not in internal data for BG (map: {1}, instance id: {2}), cheating?",
|
||||||
@@ -1980,8 +1988,8 @@ namespace Game.BattleGrounds
|
|||||||
public BGHonorMode m_HonorMode;
|
public BGHonorMode m_HonorMode;
|
||||||
public uint[] m_TeamScores = new uint[SharedConst.BGTeamsCount];
|
public uint[] m_TeamScores = new uint[SharedConst.BGTeamsCount];
|
||||||
|
|
||||||
protected Dictionary<int, ObjectGuid> BgObjects = new Dictionary<int, ObjectGuid>();
|
protected ObjectGuid[] BgObjects;// = new Dictionary<int, ObjectGuid>();
|
||||||
protected Dictionary<int, ObjectGuid> BgCreatures = new Dictionary<int, ObjectGuid>();
|
protected ObjectGuid[] BgCreatures;// = new Dictionary<int, ObjectGuid>();
|
||||||
|
|
||||||
public uint[] Buff_Entries = { BattlegroundConst.SpeedBuff, BattlegroundConst.RegenBuff, BattlegroundConst.BerserkerBuff };
|
public uint[] Buff_Entries = { BattlegroundConst.SpeedBuff, BattlegroundConst.RegenBuff, BattlegroundConst.BerserkerBuff };
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using Game.Network.Packets;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Game.BattleGrounds.Zones;
|
||||||
|
|
||||||
namespace Game.BattleGrounds
|
namespace Game.BattleGrounds
|
||||||
{
|
{
|
||||||
@@ -334,9 +335,9 @@ namespace Game.BattleGrounds
|
|||||||
case BattlegroundTypeId.RL:
|
case BattlegroundTypeId.RL:
|
||||||
bg = new RuinsofLordaeronArena();
|
bg = new RuinsofLordaeronArena();
|
||||||
break;
|
break;
|
||||||
//case BattlegroundTypeId.SA:
|
case BattlegroundTypeId.SA:
|
||||||
//bg = new BattlegroundSA();
|
bg = new BgStrandOfAncients();
|
||||||
//break;
|
break;
|
||||||
case BattlegroundTypeId.DS:
|
case BattlegroundTypeId.DS:
|
||||||
bg = new DalaranSewersArena();
|
bg = new DalaranSewersArena();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
namespace Game.BattleGrounds
|
namespace Game.BattleGrounds.Zones
|
||||||
{
|
{
|
||||||
class BgArathiBasin : Battleground
|
class BgArathiBasin : Battleground
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ namespace Game.BattleGrounds
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_BannerTimers[node].timer = 0;
|
m_BannerTimers[node].timer = 0;
|
||||||
_CreateBanner(node, (NodeStatus)m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
|
_CreateBanner(node, (ABNodeStatus)m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,9 @@ namespace Game.BattleGrounds
|
|||||||
m_prevNodes[node] = m_Nodes[node];
|
m_prevNodes[node] = m_Nodes[node];
|
||||||
m_Nodes[node] += 2;
|
m_Nodes[node] += 2;
|
||||||
// burn current contested banner
|
// burn current contested banner
|
||||||
_DelBanner(node, NodeStatus.Contested, (byte)teamIndex);
|
_DelBanner(node, ABNodeStatus.Contested, (byte)teamIndex);
|
||||||
// create new occupied banner
|
// create new occupied banner
|
||||||
_CreateBanner(node, NodeStatus.Occupied, teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Occupied, teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
_NodeOccupied(node, (teamIndex == 0) ? Team.Alliance : Team.Horde);
|
_NodeOccupied(node, (teamIndex == 0) ? Team.Alliance : Team.Horde);
|
||||||
// Message to chatlog
|
// Message to chatlog
|
||||||
@@ -115,7 +115,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int team = 0; team < SharedConst.BGTeamsCount; ++team)
|
for (int team = 0; team < SharedConst.BGTeamsCount; ++team)
|
||||||
if (m_Nodes[node] == team + NodeStatus.Occupied)
|
if (m_Nodes[node] == team + ABNodeStatus.Occupied)
|
||||||
++team_points[team];
|
++team_points[team];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,9 +165,9 @@ namespace Game.BattleGrounds
|
|||||||
m_TeamScores[team] = MaxTeamScore;
|
m_TeamScores[team] = MaxTeamScore;
|
||||||
|
|
||||||
if (team == TeamId.Alliance)
|
if (team == TeamId.Alliance)
|
||||||
UpdateWorldState(WorldStates.ResourcesAlly, m_TeamScores[team]);
|
UpdateWorldState(ABWorldStates.ResourcesAlly, m_TeamScores[team]);
|
||||||
else if (team == TeamId.Horde)
|
else if (team == TeamId.Horde)
|
||||||
UpdateWorldState(WorldStates.ResourcesHorde, m_TeamScores[team]);
|
UpdateWorldState(ABWorldStates.ResourcesHorde, m_TeamScores[team]);
|
||||||
// update achievement flags
|
// update achievement flags
|
||||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||||
int otherTeam = (team + 1) % SharedConst.BGTeamsCount;
|
int otherTeam = (team + 1) % SharedConst.BGTeamsCount;
|
||||||
@@ -187,16 +187,16 @@ namespace Game.BattleGrounds
|
|||||||
public override void StartingEventCloseDoors()
|
public override void StartingEventCloseDoors()
|
||||||
{
|
{
|
||||||
// despawn banners, auras and buffs
|
// despawn banners, auras and buffs
|
||||||
for (int obj = ObjectType.BannerNeutral; obj < BattlegroundNodes.DynamicNodesCount * 8; ++obj)
|
for (int obj = ABObjectTypes.BannerNeutral; obj < BattlegroundNodes.DynamicNodesCount * 8; ++obj)
|
||||||
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
||||||
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount * 3; ++i)
|
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount * 3; ++i)
|
||||||
SpawnBGObject(ObjectType.SpeedbuffStables + i, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(ABObjectTypes.SpeedbuffStables + i, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
// Starting doors
|
// Starting doors
|
||||||
DoorClose(ObjectType.GateA);
|
DoorClose(ABObjectTypes.GateA);
|
||||||
DoorClose(ObjectType.GateH);
|
DoorClose(ABObjectTypes.GateH);
|
||||||
SpawnBGObject(ObjectType.GateA, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(ABObjectTypes.GateA, BattlegroundConst.RespawnImmediately);
|
||||||
SpawnBGObject(ObjectType.GateH, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(ABObjectTypes.GateH, BattlegroundConst.RespawnImmediately);
|
||||||
|
|
||||||
// Starting base spirit guides
|
// Starting base spirit guides
|
||||||
_NodeOccupied(BattlegroundNodes.SpiritAliance, Team.Alliance);
|
_NodeOccupied(BattlegroundNodes.SpiritAliance, Team.Alliance);
|
||||||
@@ -206,16 +206,16 @@ namespace Game.BattleGrounds
|
|||||||
public override void StartingEventOpenDoors()
|
public override void StartingEventOpenDoors()
|
||||||
{
|
{
|
||||||
// spawn neutral banners
|
// spawn neutral banners
|
||||||
for (int banner = ObjectType.BannerNeutral, i = 0; i < 5; banner += 8, ++i)
|
for (int banner = ABObjectTypes.BannerNeutral, i = 0; i < 5; banner += 8, ++i)
|
||||||
SpawnBGObject(banner, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(banner, BattlegroundConst.RespawnImmediately);
|
||||||
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
{
|
{
|
||||||
//randomly select buff to spawn
|
//randomly select buff to spawn
|
||||||
int buff = RandomHelper.IRand(0, 2);
|
int buff = RandomHelper.IRand(0, 2);
|
||||||
SpawnBGObject(ObjectType.SpeedbuffStables + buff + i * 3, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(ABObjectTypes.SpeedbuffStables + buff + i * 3, BattlegroundConst.RespawnImmediately);
|
||||||
}
|
}
|
||||||
DoorOpen(ObjectType.GateA);
|
DoorOpen(ABObjectTypes.GateA);
|
||||||
DoorOpen(ObjectType.GateH);
|
DoorOpen(ABObjectTypes.GateH);
|
||||||
|
|
||||||
// Achievement: Let's Get This Done
|
// Achievement: Let's Get This Done
|
||||||
StartCriteriaTimer(CriteriaTimedTypes.Event, EventStartBattle);
|
StartCriteriaTimer(CriteriaTimedTypes.Event, EventStartBattle);
|
||||||
@@ -267,7 +267,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _CreateBanner(byte node, NodeStatus type, int teamIndex, bool delay)
|
void _CreateBanner(byte node, ABNodeStatus type, int teamIndex, bool delay)
|
||||||
{
|
{
|
||||||
// Just put it into the queue
|
// Just put it into the queue
|
||||||
if (delay)
|
if (delay)
|
||||||
@@ -285,11 +285,11 @@ namespace Game.BattleGrounds
|
|||||||
// handle aura with banner
|
// handle aura with banner
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
return;
|
return;
|
||||||
obj = node * 8 + ((type == NodeStatus.Occupied) ? (5 + teamIndex) : 7);
|
obj = node * 8 + ((type == ABNodeStatus.Occupied) ? (5 + teamIndex) : 7);
|
||||||
SpawnBGObject(obj, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(obj, BattlegroundConst.RespawnImmediately);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _DelBanner(byte node, NodeStatus type, byte teamIndex)
|
void _DelBanner(byte node, ABNodeStatus type, byte teamIndex)
|
||||||
{
|
{
|
||||||
int obj = node * 8 + (byte)type + teamIndex;
|
int obj = node * 8 + (byte)type + teamIndex;
|
||||||
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
||||||
@@ -297,7 +297,7 @@ namespace Game.BattleGrounds
|
|||||||
// handle aura with banner
|
// handle aura with banner
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
return;
|
return;
|
||||||
obj = node * 8 + ((type == NodeStatus.Occupied) ? (5 + teamIndex) : 7);
|
obj = node * 8 + ((type == ABNodeStatus.Occupied) ? (5 + teamIndex) : 7);
|
||||||
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,19 +338,19 @@ namespace Game.BattleGrounds
|
|||||||
// How many bases each team owns
|
// How many bases each team owns
|
||||||
byte ally = 0, horde = 0;
|
byte ally = 0, horde = 0;
|
||||||
for (byte node = 0; node < BattlegroundNodes.DynamicNodesCount; ++node)
|
for (byte node = 0; node < BattlegroundNodes.DynamicNodesCount; ++node)
|
||||||
if (m_Nodes[node] == NodeStatus.AllyOccupied)
|
if (m_Nodes[node] == ABNodeStatus.AllyOccupied)
|
||||||
++ally;
|
++ally;
|
||||||
else if (m_Nodes[node] == NodeStatus.HordeOccupied)
|
else if (m_Nodes[node] == ABNodeStatus.HordeOccupied)
|
||||||
++horde;
|
++horde;
|
||||||
|
|
||||||
packet.AddState(WorldStates.OccupiedBasesAlly, ally);
|
packet.AddState(ABWorldStates.OccupiedBasesAlly, ally);
|
||||||
packet.AddState(WorldStates.OccupiedBasesHorde, horde);
|
packet.AddState(ABWorldStates.OccupiedBasesHorde, horde);
|
||||||
|
|
||||||
// Team scores
|
// Team scores
|
||||||
packet.AddState(WorldStates.ResourcesMax, MaxTeamScore);
|
packet.AddState(ABWorldStates.ResourcesMax, MaxTeamScore);
|
||||||
packet.AddState(WorldStates.ResourcesWarning, WarningNearVictoryScore);
|
packet.AddState(ABWorldStates.ResourcesWarning, WarningNearVictoryScore);
|
||||||
packet.AddState(WorldStates.ResourcesAlly, (int)m_TeamScores[TeamId.Alliance]);
|
packet.AddState(ABWorldStates.ResourcesAlly, (int)m_TeamScores[TeamId.Alliance]);
|
||||||
packet.AddState(WorldStates.ResourcesHorde, (int)m_TeamScores[TeamId.Horde]);
|
packet.AddState(ABWorldStates.ResourcesHorde, (int)m_TeamScores[TeamId.Horde]);
|
||||||
|
|
||||||
// other unknown
|
// other unknown
|
||||||
packet.AddState(0x745, 0x2);
|
packet.AddState(0x745, 0x2);
|
||||||
@@ -371,13 +371,13 @@ namespace Game.BattleGrounds
|
|||||||
// How many bases each team owns
|
// How many bases each team owns
|
||||||
byte ally = 0, horde = 0;
|
byte ally = 0, horde = 0;
|
||||||
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
if (m_Nodes[i] == NodeStatus.AllyOccupied)
|
if (m_Nodes[i] == ABNodeStatus.AllyOccupied)
|
||||||
++ally;
|
++ally;
|
||||||
else if (m_Nodes[i] == NodeStatus.HordeOccupied)
|
else if (m_Nodes[i] == ABNodeStatus.HordeOccupied)
|
||||||
++horde;
|
++horde;
|
||||||
|
|
||||||
UpdateWorldState(WorldStates.OccupiedBasesAlly, ally);
|
UpdateWorldState(ABWorldStates.OccupiedBasesAlly, ally);
|
||||||
UpdateWorldState(WorldStates.OccupiedBasesHorde, horde);
|
UpdateWorldState(ABWorldStates.OccupiedBasesHorde, horde);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _NodeOccupied(byte node, Team team)
|
void _NodeOccupied(byte node, Team team)
|
||||||
@@ -390,7 +390,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
byte capturedNodes = 0;
|
byte capturedNodes = 0;
|
||||||
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
if (m_Nodes[i] == NodeStatus.Occupied + GetTeamIndexByTeamId(team) && m_NodeTimers[i] == 0)
|
if (m_Nodes[i] == ABNodeStatus.Occupied + GetTeamIndexByTeamId(team) && m_NodeTimers[i] == 0)
|
||||||
++capturedNodes;
|
++capturedNodes;
|
||||||
|
|
||||||
if (capturedNodes >= 5)
|
if (capturedNodes >= 5)
|
||||||
@@ -398,7 +398,7 @@ namespace Game.BattleGrounds
|
|||||||
if (capturedNodes >= 4)
|
if (capturedNodes >= 4)
|
||||||
CastSpellOnTeam(BattlegroundConst.AbQuestReward4Bases, team);
|
CastSpellOnTeam(BattlegroundConst.AbQuestReward4Bases, team);
|
||||||
|
|
||||||
Creature trigger = BgCreatures.ContainsKey(node + 7) ? GetBGCreature(node + 7) : null; // 0-6 spirit guides
|
Creature trigger = !BgCreatures[node + 7].IsEmpty() ? GetBGCreature(node + 7) : null; // 0-6 spirit guides
|
||||||
if (!trigger)
|
if (!trigger)
|
||||||
trigger = AddCreature(SharedConst.WorldTrigger, node + 7, NodePositions[node], GetTeamIndexByTeamId(team));
|
trigger = AddCreature(SharedConst.WorldTrigger, node + 7, NodePositions[node], GetTeamIndexByTeamId(team));
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ namespace Game.BattleGrounds
|
|||||||
while ((node < BattlegroundNodes.DynamicNodesCount) && ((!obj) || (!source.IsWithinDistInMap(obj, 10))))
|
while ((node < BattlegroundNodes.DynamicNodesCount) && ((!obj) || (!source.IsWithinDistInMap(obj, 10))))
|
||||||
{
|
{
|
||||||
++node;
|
++node;
|
||||||
obj = GetBgMap().GetGameObject(BgObjects[node * 8 + ObjectType.AuraContested]);
|
obj = GetBgMap().GetGameObject(BgObjects[node * 8 + ABObjectTypes.AuraContested]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node == BattlegroundNodes.DynamicNodesCount)
|
if (node == BattlegroundNodes.DynamicNodesCount)
|
||||||
@@ -457,15 +457,15 @@ namespace Game.BattleGrounds
|
|||||||
source.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat);
|
source.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat);
|
||||||
uint sound = 0;
|
uint sound = 0;
|
||||||
// If node is neutral, change to contested
|
// If node is neutral, change to contested
|
||||||
if (m_Nodes[node] == NodeStatus.Neutral)
|
if (m_Nodes[node] == ABNodeStatus.Neutral)
|
||||||
{
|
{
|
||||||
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
||||||
m_prevNodes[node] = m_Nodes[node];
|
m_prevNodes[node] = m_Nodes[node];
|
||||||
m_Nodes[node] = (NodeStatus)(teamIndex + 1);
|
m_Nodes[node] = (ABNodeStatus)(teamIndex + 1);
|
||||||
// burn current neutral banner
|
// burn current neutral banner
|
||||||
_DelBanner(node, NodeStatus.Neutral, 0);
|
_DelBanner(node, ABNodeStatus.Neutral, 0);
|
||||||
// create new contested banner
|
// create new contested banner
|
||||||
_CreateBanner(node, NodeStatus.Contested, (byte)teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Contested, (byte)teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
|
|
||||||
@@ -478,18 +478,18 @@ namespace Game.BattleGrounds
|
|||||||
sound = SoundClaimed;
|
sound = SoundClaimed;
|
||||||
}
|
}
|
||||||
// If node is contested
|
// If node is contested
|
||||||
else if ((m_Nodes[node] == NodeStatus.AllyContested) || (m_Nodes[node] == NodeStatus.HordeContested))
|
else if ((m_Nodes[node] == ABNodeStatus.AllyContested) || (m_Nodes[node] == ABNodeStatus.HordeContested))
|
||||||
{
|
{
|
||||||
// If last state is NOT occupied, change node to enemy-contested
|
// If last state is NOT occupied, change node to enemy-contested
|
||||||
if (m_prevNodes[node] < NodeStatus.Occupied)
|
if (m_prevNodes[node] < ABNodeStatus.Occupied)
|
||||||
{
|
{
|
||||||
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
||||||
m_prevNodes[node] = m_Nodes[node];
|
m_prevNodes[node] = m_Nodes[node];
|
||||||
m_Nodes[node] = (NodeStatus.Contested + (int)teamIndex);
|
m_Nodes[node] = (ABNodeStatus.Contested + (int)teamIndex);
|
||||||
// burn current contested banner
|
// burn current contested banner
|
||||||
_DelBanner(node, NodeStatus.Contested, (byte)teamIndex);
|
_DelBanner(node, ABNodeStatus.Contested, (byte)teamIndex);
|
||||||
// create new contested banner
|
// create new contested banner
|
||||||
_CreateBanner(node, NodeStatus.Contested, (byte)teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Contested, (byte)teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
|
|
||||||
@@ -504,11 +504,11 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
UpdatePlayerScore(source, ScoreType.BasesDefended, 1);
|
UpdatePlayerScore(source, ScoreType.BasesDefended, 1);
|
||||||
m_prevNodes[node] = m_Nodes[node];
|
m_prevNodes[node] = m_Nodes[node];
|
||||||
m_Nodes[node] = (NodeStatus.Occupied + (int)teamIndex);
|
m_Nodes[node] = (ABNodeStatus.Occupied + (int)teamIndex);
|
||||||
// burn current contested banner
|
// burn current contested banner
|
||||||
_DelBanner(node, NodeStatus.Contested, (byte)teamIndex);
|
_DelBanner(node, ABNodeStatus.Contested, (byte)teamIndex);
|
||||||
// create new occupied banner
|
// create new occupied banner
|
||||||
_CreateBanner(node, NodeStatus.Occupied, (byte)teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Occupied, (byte)teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
m_NodeTimers[node] = 0;
|
m_NodeTimers[node] = 0;
|
||||||
_NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
_NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||||
@@ -526,11 +526,11 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
UpdatePlayerScore(source, ScoreType.BasesAssaulted, 1);
|
||||||
m_prevNodes[node] = m_Nodes[node];
|
m_prevNodes[node] = m_Nodes[node];
|
||||||
m_Nodes[node] = (NodeStatus.Contested + (int)teamIndex);
|
m_Nodes[node] = (ABNodeStatus.Contested + (int)teamIndex);
|
||||||
// burn current occupied banner
|
// burn current occupied banner
|
||||||
_DelBanner(node, NodeStatus.Occupied, (byte)teamIndex);
|
_DelBanner(node, ABNodeStatus.Occupied, (byte)teamIndex);
|
||||||
// create new contested banner
|
// create new contested banner
|
||||||
_CreateBanner(node, NodeStatus.Contested, (byte)teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Contested, (byte)teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
_NodeDeOccupied(node);
|
_NodeDeOccupied(node);
|
||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
@@ -545,7 +545,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If node is occupied again, send "X has taken the Y" msg.
|
// If node is occupied again, send "X has taken the Y" msg.
|
||||||
if (m_Nodes[node] >= NodeStatus.Occupied)
|
if (m_Nodes[node] >= ABNodeStatus.Occupied)
|
||||||
{
|
{
|
||||||
// FIXME: team and node names not localized
|
// FIXME: team and node names not localized
|
||||||
if (teamIndex == TeamId.Alliance)
|
if (teamIndex == TeamId.Alliance)
|
||||||
@@ -561,9 +561,9 @@ namespace Game.BattleGrounds
|
|||||||
// How many bases each team owns
|
// How many bases each team owns
|
||||||
byte ally = 0, horde = 0;
|
byte ally = 0, horde = 0;
|
||||||
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
if (m_Nodes[i] == NodeStatus.AllyOccupied)
|
if (m_Nodes[i] == ABNodeStatus.AllyOccupied)
|
||||||
++ally;
|
++ally;
|
||||||
else if (m_Nodes[i] == NodeStatus.HordeOccupied)
|
else if (m_Nodes[i] == ABNodeStatus.HordeOccupied)
|
||||||
++horde;
|
++horde;
|
||||||
|
|
||||||
if (ally > horde)
|
if (ally > horde)
|
||||||
@@ -580,14 +580,14 @@ namespace Game.BattleGrounds
|
|||||||
bool result = true;
|
bool result = true;
|
||||||
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
{
|
{
|
||||||
result &= AddObject(ObjectType.BannerNeutral + 8 * i, (uint)(NodeObjectId.Banner0 + i), NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.BannerNeutral + 8 * i, (uint)(NodeObjectId.Banner0 + i), NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.BannerContA + 8 * i, ObjectIds.BannerContA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.BannerContA + 8 * i, ABObjectIds.BannerContA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.BannerContH + 8 * i, ObjectIds.BannerContH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.BannerContH + 8 * i, ABObjectIds.BannerContH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.BannerAlly + 8 * i, ObjectIds.BannerA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.BannerAlly + 8 * i, ABObjectIds.BannerA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.BannerHorde + 8 * i, ObjectIds.BannerH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.BannerHorde + 8 * i, ABObjectIds.BannerH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.AuraAlly + 8 * i, ObjectIds.AuraA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.AuraAlly + 8 * i, ABObjectIds.AuraA, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.AuraHorde + 8 * i, ObjectIds.AuraH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.AuraHorde + 8 * i, ABObjectIds.AuraH, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.AuraContested + 8 * i, ObjectIds.AuraC, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.AuraContested + 8 * i, ABObjectIds.AuraC, NodePositions[i], 0, 0, (float)Math.Sin(NodePositions[i].GetOrientation() / 2), (float)Math.Cos(NodePositions[i].GetOrientation() / 2), BattlegroundConst.RespawnOneDay);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn some object Battleground not created!");
|
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn some object Battleground not created!");
|
||||||
@@ -595,8 +595,8 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result &= AddObject(ObjectType.GateA, ObjectIds.GateA, DoorPositions[0][0], DoorPositions[0][1], DoorPositions[0][2], DoorPositions[0][3], DoorPositions[0][4], DoorPositions[0][5], DoorPositions[0][6], DoorPositions[0][7], BattlegroundConst.RespawnImmediately);
|
result &= AddObject(ABObjectTypes.GateA, ABObjectIds.GateA, DoorPositions[0][0], DoorPositions[0][1], DoorPositions[0][2], DoorPositions[0][3], DoorPositions[0][4], DoorPositions[0][5], DoorPositions[0][6], DoorPositions[0][7], BattlegroundConst.RespawnImmediately);
|
||||||
result &= AddObject(ObjectType.GateH, ObjectIds.GateH, DoorPositions[1][0], DoorPositions[1][1], DoorPositions[1][2], DoorPositions[1][3], DoorPositions[1][4], DoorPositions[1][5], DoorPositions[1][6], DoorPositions[1][7], BattlegroundConst.RespawnImmediately);
|
result &= AddObject(ABObjectTypes.GateH, ABObjectIds.GateH, DoorPositions[1][0], DoorPositions[1][1], DoorPositions[1][2], DoorPositions[1][3], DoorPositions[1][4], DoorPositions[1][5], DoorPositions[1][6], DoorPositions[1][7], BattlegroundConst.RespawnImmediately);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn door object Battleground not created!");
|
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn door object Battleground not created!");
|
||||||
@@ -606,9 +606,9 @@ namespace Game.BattleGrounds
|
|||||||
//buffs
|
//buffs
|
||||||
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
{
|
{
|
||||||
result &= AddObject(ObjectType.SpeedbuffStables + 3 * i, Buff_Entries[0], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.SpeedbuffStables + 3 * i, Buff_Entries[0], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.SpeedbuffStables + 3 * i + 1, Buff_Entries[1], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.SpeedbuffStables + 3 * i + 1, Buff_Entries[1], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
||||||
result &= AddObject(ObjectType.SpeedbuffStables + 3 * i + 2, Buff_Entries[2], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
result &= AddObject(ABObjectTypes.SpeedbuffStables + 3 * i + 2, Buff_Entries[2], BuffPositions[i][0], BuffPositions[i][1], BuffPositions[i][2], BuffPositions[i][3], 0, 0, (float)Math.Sin(BuffPositions[i][3] / 2), (float)Math.Cos(BuffPositions[i][3] / 2), BattlegroundConst.RespawnOneDay);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn buff object!");
|
Log.outError(LogFilter.Sql, "BatteGroundAB: Failed to spawn buff object!");
|
||||||
@@ -668,7 +668,7 @@ namespace Game.BattleGrounds
|
|||||||
// Is there any occupied node for this team?
|
// Is there any occupied node for this team?
|
||||||
List<byte> nodes = new List<byte>();
|
List<byte> nodes = new List<byte>();
|
||||||
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (byte i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
if (m_Nodes[i] == NodeStatus.Occupied + (int)teamIndex)
|
if (m_Nodes[i] == ABNodeStatus.Occupied + (int)teamIndex)
|
||||||
nodes.Add(i);
|
nodes.Add(i);
|
||||||
|
|
||||||
WorldSafeLocsRecord good_entry = null;
|
WorldSafeLocsRecord good_entry = null;
|
||||||
@@ -713,10 +713,10 @@ namespace Game.BattleGrounds
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ScoreType.BasesAssaulted:
|
case ScoreType.BasesAssaulted:
|
||||||
player.UpdateCriteria(CriteriaTypes.BgObjectiveCapture, (uint)Objectives.AssaultBase);
|
player.UpdateCriteria(CriteriaTypes.BgObjectiveCapture, (uint)ABObjectives.AssaultBase);
|
||||||
break;
|
break;
|
||||||
case ScoreType.BasesDefended:
|
case ScoreType.BasesDefended:
|
||||||
player.UpdateCriteria(CriteriaTypes.BgObjectiveCapture, (uint)Objectives.DefendBase);
|
player.UpdateCriteria(CriteriaTypes.BgObjectiveCapture, (uint)ABObjectives.DefendBase);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -728,8 +728,8 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
for (int i = 0; i < BattlegroundNodes.DynamicNodesCount; ++i)
|
||||||
if ((team == Team.Alliance && m_Nodes[i] == NodeStatus.AllyOccupied) ||
|
if ((team == Team.Alliance && m_Nodes[i] == ABNodeStatus.AllyOccupied) ||
|
||||||
(team == Team.Horde && m_Nodes[i] == NodeStatus.HordeOccupied))
|
(team == Team.Horde && m_Nodes[i] == ABNodeStatus.HordeOccupied))
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
return count == BattlegroundNodes.DynamicNodesCount;
|
return count == BattlegroundNodes.DynamicNodesCount;
|
||||||
@@ -754,8 +754,8 @@ namespace Game.BattleGrounds
|
|||||||
/// 3: ally occupied
|
/// 3: ally occupied
|
||||||
/// 4: horde occupied
|
/// 4: horde occupied
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NodeStatus[] m_Nodes = new NodeStatus[BattlegroundNodes.DynamicNodesCount];
|
ABNodeStatus[] m_Nodes = new ABNodeStatus[BattlegroundNodes.DynamicNodesCount];
|
||||||
NodeStatus[] m_prevNodes = new NodeStatus[BattlegroundNodes.DynamicNodesCount];
|
ABNodeStatus[] m_prevNodes = new ABNodeStatus[BattlegroundNodes.DynamicNodesCount];
|
||||||
BannerTimer[] m_BannerTimers = new BannerTimer[BattlegroundNodes.DynamicNodesCount];
|
BannerTimer[] m_BannerTimers = new BannerTimer[BattlegroundNodes.DynamicNodesCount];
|
||||||
uint[] m_NodeTimers = new uint[BattlegroundNodes.DynamicNodesCount];
|
uint[] m_NodeTimers = new uint[BattlegroundNodes.DynamicNodesCount];
|
||||||
uint[] m_lastTick = new uint[SharedConst.BGTeamsCount];
|
uint[] m_lastTick = new uint[SharedConst.BGTeamsCount];
|
||||||
@@ -886,7 +886,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Consts
|
#region Consts
|
||||||
struct WorldStates
|
struct ABWorldStates
|
||||||
{
|
{
|
||||||
public const uint OccupiedBasesHorde = 1778;
|
public const uint OccupiedBasesHorde = 1778;
|
||||||
public const uint OccupiedBasesAlly = 1779;
|
public const uint OccupiedBasesAlly = 1779;
|
||||||
@@ -934,7 +934,7 @@ namespace Game.BattleGrounds
|
|||||||
public const uint Banner4 = 180091; // Gold Mine Banner
|
public const uint Banner4 = 180091; // Gold Mine Banner
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ObjectType
|
struct ABObjectTypes
|
||||||
{
|
{
|
||||||
// for all 5 node points 8*5=40 objects
|
// for all 5 node points 8*5=40 objects
|
||||||
public const int BannerNeutral = 0;
|
public const int BannerNeutral = 0;
|
||||||
@@ -968,7 +968,7 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Object id templates from DB
|
// Object id templates from DB
|
||||||
struct ObjectIds
|
struct ABObjectIds
|
||||||
{
|
{
|
||||||
public const uint BannerA = 180058;
|
public const uint BannerA = 180058;
|
||||||
public const uint BannerContA = 180059;
|
public const uint BannerContA = 180059;
|
||||||
@@ -999,7 +999,7 @@ namespace Game.BattleGrounds
|
|||||||
public const int AllNodesCount = 7; // All Nodes (Dynamic And Static)
|
public const int AllNodesCount = 7; // All Nodes (Dynamic And Static)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum NodeStatus
|
enum ABNodeStatus
|
||||||
{
|
{
|
||||||
Neutral = 0,
|
Neutral = 0,
|
||||||
Contested = 1,
|
Contested = 1,
|
||||||
@@ -1010,7 +1010,7 @@ namespace Game.BattleGrounds
|
|||||||
HordeOccupied = 4
|
HordeOccupied = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Objectives
|
enum ABObjectives
|
||||||
{
|
{
|
||||||
AssaultBase = 122,
|
AssaultBase = 122,
|
||||||
DefendBase = 123
|
DefendBase = 123
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
|
|
||||||
namespace Game.BattleGrounds
|
namespace Game.BattleGrounds.Zones
|
||||||
{
|
{
|
||||||
class BgEyeofStorm : Battleground
|
class BgEyeofStorm : Battleground
|
||||||
{
|
{
|
||||||
@@ -763,7 +763,7 @@ namespace Game.BattleGrounds
|
|||||||
else
|
else
|
||||||
SendMessageToAll(EotSMisc.m_CapturingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player);
|
SendMessageToAll(EotSMisc.m_CapturingPointTypes[Point].MessageIdHorde, ChatMsg.BgSystemHorde, player);
|
||||||
|
|
||||||
if (BgCreatures.ContainsKey(Point) && !BgCreatures[Point].IsEmpty())
|
if (!BgCreatures[Point].IsEmpty())
|
||||||
DelCreature(Point);
|
DelCreature(Point);
|
||||||
|
|
||||||
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(EotSMisc.m_CapturingPointTypes[Point].GraveYardId);
|
WorldSafeLocsRecord sg = CliDB.WorldSafeLocsStorage.LookupByKey(EotSMisc.m_CapturingPointTypes[Point].GraveYardId);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@ using Game.Entities;
|
|||||||
using Game.Network.Packets;
|
using Game.Network.Packets;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Game.BattleGrounds
|
namespace Game.BattleGrounds.Zones
|
||||||
{
|
{
|
||||||
class BgWarsongGluch : Battleground
|
class BgWarsongGluch : Battleground
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -399,11 +399,11 @@ namespace Game.Chat.Commands
|
|||||||
string subject = result1.Read<string>(5);
|
string subject = result1.Read<string>(5);
|
||||||
long deliverTime = result1.Read<uint>(6);
|
long deliverTime = result1.Read<uint>(6);
|
||||||
long expireTime = result1.Read<uint>(7);
|
long expireTime = result1.Read<uint>(7);
|
||||||
uint money = result1.Read<uint>(8);
|
ulong money = result1.Read<ulong>(8);
|
||||||
byte hasItem = result1.Read<byte>(9);
|
byte hasItem = result1.Read<byte>(9);
|
||||||
uint gold = money / MoneyConstants.Gold;
|
uint gold = (uint)(money / MoneyConstants.Gold);
|
||||||
uint silv = (money % MoneyConstants.Gold) / MoneyConstants.Silver;
|
uint silv = (uint)(money % MoneyConstants.Gold) / MoneyConstants.Silver;
|
||||||
uint copp = (money % MoneyConstants.Gold) % MoneyConstants.Silver;
|
uint copp = (uint)(money % MoneyConstants.Gold) % MoneyConstants.Silver;
|
||||||
string receiverStr = handler.playerLink(receiver);
|
string receiverStr = handler.playerLink(receiver);
|
||||||
string senderStr = handler.playerLink(sender);
|
string senderStr = handler.playerLink(sender);
|
||||||
handler.SendSysMessage(CypherStrings.ListMailInfo1, messageId, subject, gold, silv, copp);
|
handler.SendSysMessage(CypherStrings.ListMailInfo1, messageId, subject, gold, silv, copp);
|
||||||
|
|||||||
@@ -1435,7 +1435,7 @@ namespace Game.Chat
|
|||||||
|
|
||||||
totalPlayerTime = result.Read<uint>(0);
|
totalPlayerTime = result.Read<uint>(0);
|
||||||
level = result.Read<byte>(1);
|
level = result.Read<byte>(1);
|
||||||
money = result.Read<uint>(2);
|
money = result.Read<ulong>(2);
|
||||||
accId = result.Read<uint>(3);
|
accId = result.Read<uint>(3);
|
||||||
raceid = (Race)result.Read<byte>(4);
|
raceid = (Race)result.Read<byte>(4);
|
||||||
classid = (Class)result.Read<byte>(5);
|
classid = (Class)result.Read<byte>(5);
|
||||||
|
|||||||
@@ -299,14 +299,14 @@ namespace Game.Chat
|
|||||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
long addmoney = args.NextInt64();
|
long moneyToAdd = args.NextInt64();
|
||||||
long moneyuser = (long)target.GetMoney();
|
ulong targetMoney = target.GetMoney();
|
||||||
|
|
||||||
if (addmoney < 0)
|
if (moneyToAdd < 0)
|
||||||
{
|
{
|
||||||
ulong newmoney = (ulong)(moneyuser + addmoney);
|
ulong newmoney = (targetMoney + (ulong)moneyToAdd);
|
||||||
|
|
||||||
Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.CurrentMoney), moneyuser, addmoney, newmoney);
|
Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.CurrentMoney), targetMoney, moneyToAdd, newmoney);
|
||||||
if (newmoney <= 0)
|
if (newmoney <= 0)
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target));
|
handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target));
|
||||||
@@ -317,28 +317,31 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ulong moneyToAddMsg = (ulong)(moneyToAdd * -1);
|
||||||
if (newmoney > PlayerConst.MaxMoneyAmount)
|
if (newmoney > PlayerConst.MaxMoneyAmount)
|
||||||
newmoney = PlayerConst.MaxMoneyAmount;
|
newmoney = PlayerConst.MaxMoneyAmount;
|
||||||
|
|
||||||
handler.SendSysMessage(CypherStrings.YouTakeMoney, Math.Abs(addmoney), handler.GetNameLink(target));
|
handler.SendSysMessage(CypherStrings.YouTakeMoney, Math.Abs(moneyToAdd), handler.GetNameLink(target));
|
||||||
if (handler.needReportToTarget(target))
|
if (handler.needReportToTarget(target))
|
||||||
target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), Math.Abs(addmoney));
|
target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), Math.Abs(moneyToAdd));
|
||||||
target.SetMoney(newmoney);
|
target.SetMoney(newmoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handler.SendSysMessage(CypherStrings.YouGiveMoney, addmoney, handler.GetNameLink(target));
|
handler.SendSysMessage(CypherStrings.YouGiveMoney, moneyToAdd, handler.GetNameLink(target));
|
||||||
if (handler.needReportToTarget(target))
|
if (handler.needReportToTarget(target))
|
||||||
target.SendSysMessage(CypherStrings.YoursMoneyGiven, handler.GetNameLink(), addmoney);
|
target.SendSysMessage(CypherStrings.YoursMoneyGiven, handler.GetNameLink(), moneyToAdd);
|
||||||
|
|
||||||
if (addmoney >= PlayerConst.MaxMoneyAmount)
|
if ((ulong)moneyToAdd >= PlayerConst.MaxMoneyAmount)
|
||||||
target.SetMoney(PlayerConst.MaxMoneyAmount);
|
moneyToAdd = Convert.ToInt64(PlayerConst.MaxMoneyAmount);
|
||||||
else
|
|
||||||
target.ModifyMoney(addmoney);
|
moneyToAdd = Math.Min(moneyToAdd, (long)(PlayerConst.MaxMoneyAmount - targetMoney));
|
||||||
|
|
||||||
|
target.ModifyMoney(moneyToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.NewMoney), moneyuser, addmoney, target.GetMoney());
|
Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.NewMoney), targetMoney, moneyToAdd, target.GetMoney());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -872,9 +872,11 @@ namespace Game.Chat
|
|||||||
{
|
{
|
||||||
Log.outInfo(LogFilter.Misc, "Re-Loading `trainer` Table!");
|
Log.outInfo(LogFilter.Misc, "Re-Loading `trainer` Table!");
|
||||||
Global.ObjectMgr.LoadTrainers();
|
Global.ObjectMgr.LoadTrainers();
|
||||||
|
Global.ObjectMgr.LoadCreatureDefaultTrainers();
|
||||||
handler.SendGlobalGMSysMessage("DB table `trainer` reloaded.");
|
handler.SendGlobalGMSysMessage("DB table `trainer` reloaded.");
|
||||||
handler.SendGlobalGMSysMessage("DB table `trainer_locale` reloaded.");
|
handler.SendGlobalGMSysMessage("DB table `trainer_locale` reloaded.");
|
||||||
handler.SendGlobalGMSysMessage("DB table `trainer_spell` reloaded.");
|
handler.SendGlobalGMSysMessage("DB table `trainer_spell` reloaded.");
|
||||||
|
handler.SendGlobalGMSysMessage("DB table `creature_default_trainer` reloaded.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace Game.Chat.Commands
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
string moneyStr = args.NextString("");
|
string moneyStr = args.NextString("");
|
||||||
int money = !string.IsNullOrEmpty(moneyStr) ? int.Parse(moneyStr) : 0;
|
long money = !string.IsNullOrEmpty(moneyStr) ? long.Parse(moneyStr) : 0;
|
||||||
if (money <= 0)
|
if (money <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
+1
-27
@@ -103,32 +103,6 @@ namespace Game.Combat
|
|||||||
ThreatManager iThreatManager;
|
ThreatManager iThreatManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThreatManagerEvent : ThreatRefStatusChangeEvent
|
|
||||||
{
|
|
||||||
ThreatManagerEvent(UnitEventTypes pType)
|
|
||||||
: base(pType)
|
|
||||||
{
|
|
||||||
iThreatContainer = null;
|
|
||||||
}
|
|
||||||
ThreatManagerEvent(UnitEventTypes pType, HostileReference pHostileReference)
|
|
||||||
: base(pType, pHostileReference)
|
|
||||||
{
|
|
||||||
iThreatContainer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setThreatContainer(ThreatContainer pThreatContainer)
|
|
||||||
{
|
|
||||||
iThreatContainer = pThreatContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreatContainer getThreatContainer()
|
|
||||||
{
|
|
||||||
return iThreatContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreatContainer iThreatContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum UnitEventTypes
|
public enum UnitEventTypes
|
||||||
{
|
{
|
||||||
// Player/Pet Changed On/Offline Status
|
// Player/Pet Changed On/Offline Status
|
||||||
@@ -141,7 +115,7 @@ namespace Game.Combat
|
|||||||
ThreatRefRemoveFromList = 1 << 2,
|
ThreatRefRemoveFromList = 1 << 2,
|
||||||
|
|
||||||
// Player/Pet Entered/Left Water Or Some Other Place Where It Is/Was Not Accessible For The Creature
|
// Player/Pet Entered/Left Water Or Some Other Place Where It Is/Was Not Accessible For The Creature
|
||||||
ThreatRefAsseccibleStatus = 1 << 3,
|
ThreatRefAccessibleStatus = 1 << 3,
|
||||||
|
|
||||||
// Threat List Is Going To Be Sorted (If Dirty Flag Is Set)
|
// Threat List Is Going To Be Sorted (If Dirty Flag Is Set)
|
||||||
ThreatSortList = 1 << 4,
|
ThreatSortList = 1 << 4,
|
||||||
|
|||||||
@@ -33,14 +33,15 @@ namespace Game.Combat
|
|||||||
|
|
||||||
Unit getOwner() { return Owner; }
|
Unit getOwner() { return Owner; }
|
||||||
|
|
||||||
// send threat to all my hateres for the victim
|
// send threat to all my haters for the victim
|
||||||
// The victim is hated than by them as well
|
// The victim is then hated by them as well
|
||||||
// use for buffs and healing threat functionality
|
// use for buffs and healing threat functionality
|
||||||
public void threatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null)
|
public void threatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null)
|
||||||
{
|
{
|
||||||
HostileReference refe = getFirst();
|
|
||||||
float threat = ThreatManager.calcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell);
|
float threat = ThreatManager.calcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell);
|
||||||
threat /= getSize();
|
threat /= getSize();
|
||||||
|
|
||||||
|
HostileReference refe = getFirst();
|
||||||
while (refe != null)
|
while (refe != null)
|
||||||
{
|
{
|
||||||
if (ThreatManager.isValidProcess(victim, refe.GetSource().GetOwner(), threatSpell))
|
if (ThreatManager.isValidProcess(victim, refe.GetSource().GetOwner(), threatSpell))
|
||||||
@@ -53,7 +54,6 @@ namespace Game.Combat
|
|||||||
public void addTempThreat(float threat, bool apply)
|
public void addTempThreat(float threat, bool apply)
|
||||||
{
|
{
|
||||||
HostileReference refe = getFirst();
|
HostileReference refe = getFirst();
|
||||||
|
|
||||||
while (refe != null)
|
while (refe != null)
|
||||||
{
|
{
|
||||||
if (apply)
|
if (apply)
|
||||||
@@ -209,18 +209,20 @@ namespace Game.Combat
|
|||||||
|
|
||||||
public void addThreat(float modThreat)
|
public void addThreat(float modThreat)
|
||||||
{
|
{
|
||||||
|
if (modThreat == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
iThreat += modThreat;
|
iThreat += modThreat;
|
||||||
|
|
||||||
// the threat is changed. Source and target unit have to be available
|
// the threat is changed. Source and target unit have to be available
|
||||||
// if the link was cut before relink it again
|
// if the link was cut before relink it again
|
||||||
if (!isOnline())
|
if (!isOnline())
|
||||||
updateOnlineStatus();
|
updateOnlineStatus();
|
||||||
if (modThreat != 0.0f)
|
|
||||||
{
|
|
||||||
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, modThreat);
|
|
||||||
fireStatusChanged(Event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modThreat >= 0.0f)
|
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, modThreat);
|
||||||
|
fireStatusChanged(Event);
|
||||||
|
|
||||||
|
if (isValid() && modThreat > 0.0f)
|
||||||
{
|
{
|
||||||
Unit victimOwner = getTarget().GetCharmerOrOwner();
|
Unit victimOwner = getTarget().GetCharmerOrOwner();
|
||||||
if (victimOwner != null && victimOwner.IsAlive())
|
if (victimOwner != null && victimOwner.IsAlive())
|
||||||
@@ -230,9 +232,7 @@ namespace Game.Combat
|
|||||||
|
|
||||||
public void addThreatPercent(int percent)
|
public void addThreatPercent(int percent)
|
||||||
{
|
{
|
||||||
float tmpThreat = iThreat;
|
addThreat(MathFunctions.CalculatePct(iThreat, percent));
|
||||||
MathFunctions.AddPct(ref tmpThreat, percent);
|
|
||||||
addThreat(tmpThreat - iThreat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check, if source can reach target and set the status
|
// check, if source can reach target and set the status
|
||||||
@@ -292,7 +292,7 @@ namespace Game.Combat
|
|||||||
{
|
{
|
||||||
iAccessible = isAccessible;
|
iAccessible = isAccessible;
|
||||||
|
|
||||||
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAsseccibleStatus, this);
|
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAccessibleStatus, this);
|
||||||
fireStatusChanged(Event);
|
fireStatusChanged(Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,12 +313,12 @@ namespace Game.Combat
|
|||||||
|
|
||||||
public void setThreat(float threat)
|
public void setThreat(float threat)
|
||||||
{
|
{
|
||||||
addThreat(threat - getThreat());
|
addThreat(threat - iThreat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getThreat()
|
public float getThreat()
|
||||||
{
|
{
|
||||||
return iThreat;
|
return iThreat + iTempThreatModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isOnline()
|
public bool isOnline()
|
||||||
@@ -333,27 +333,27 @@ namespace Game.Combat
|
|||||||
return iAccessible;
|
return iAccessible;
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for temporary setting a threat and reducting it later again.
|
// used for temporary setting a threat and reducing it later again.
|
||||||
// the threat modification is stored
|
// the threat modification is stored
|
||||||
public void setTempThreat(float threat)
|
public void setTempThreat(float threat)
|
||||||
{
|
{
|
||||||
addTempThreat(threat - getThreat());
|
addTempThreat(threat - iTempThreatModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTempThreat(float threat)
|
public void addTempThreat(float threat)
|
||||||
{
|
{
|
||||||
iTempThreatModifier = threat;
|
if (threat == 0.0f)
|
||||||
if (iTempThreatModifier != 0.0f)
|
return;
|
||||||
addThreat(iTempThreatModifier);
|
|
||||||
|
iTempThreatModifier += threat;
|
||||||
|
|
||||||
|
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, threat);
|
||||||
|
fireStatusChanged(Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetTempThreat()
|
public void resetTempThreat()
|
||||||
{
|
{
|
||||||
if (iTempThreatModifier != 0.0f)
|
addTempThreat(-iTempThreatModifier);
|
||||||
{
|
|
||||||
addThreat(-iTempThreatModifier);
|
|
||||||
iTempThreatModifier = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTempThreatModifier()
|
public float getTempThreatModifier()
|
||||||
@@ -369,7 +369,7 @@ namespace Game.Combat
|
|||||||
public new HostileReference next() { return (HostileReference)base.next(); }
|
public new HostileReference next() { return (HostileReference)base.next(); }
|
||||||
|
|
||||||
float iThreat;
|
float iThreat;
|
||||||
float iTempThreatModifier; // used for taunt
|
float iTempThreatModifier; // used for SPELL_AURA_MOD_TOTAL_THREAT
|
||||||
ObjectGuid iUnitGuid;
|
ObjectGuid iUnitGuid;
|
||||||
bool iOnline;
|
bool iOnline;
|
||||||
bool iAccessible;
|
bool iAccessible;
|
||||||
|
|||||||
@@ -1014,7 +1014,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ConditionSourceType.QuestAccept:
|
case ConditionSourceType.QuestAvailable:
|
||||||
if (Global.ObjectMgr.GetQuestTemplate((uint)cond.SourceEntry) == null)
|
if (Global.ObjectMgr.GetQuestTemplate((uint)cond.SourceEntry) == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "{0} SourceEntry specifies non-existing quest, skipped.", cond.ToString());
|
Log.outError(LogFilter.Sql, "{0} SourceEntry specifies non-existing quest, skipped.", cond.ToString());
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ namespace Game.DataStorage
|
|||||||
BattlePetSpeciesStateStorage = DB6Reader.Read<BattlePetSpeciesStateRecord>("BattlePetSpeciesState.db2", DB6Metas.BattlePetSpeciesStateMeta, HotfixStatements.SEL_BATTLE_PET_SPECIES_STATE);
|
BattlePetSpeciesStateStorage = DB6Reader.Read<BattlePetSpeciesStateRecord>("BattlePetSpeciesState.db2", DB6Metas.BattlePetSpeciesStateMeta, HotfixStatements.SEL_BATTLE_PET_SPECIES_STATE);
|
||||||
BattlemasterListStorage = DB6Reader.Read<BattlemasterListRecord>("BattlemasterList.db2", DB6Metas.BattlemasterListMeta, HotfixStatements.SEL_BATTLEMASTER_LIST, HotfixStatements.SEL_BATTLEMASTER_LIST_LOCALE);
|
BattlemasterListStorage = DB6Reader.Read<BattlemasterListRecord>("BattlemasterList.db2", DB6Metas.BattlemasterListMeta, HotfixStatements.SEL_BATTLEMASTER_LIST, HotfixStatements.SEL_BATTLEMASTER_LIST_LOCALE);
|
||||||
BroadcastTextStorage = DB6Reader.Read<BroadcastTextRecord>("BroadcastText.db2", DB6Metas.BroadcastTextMeta, HotfixStatements.SEL_BROADCAST_TEXT, HotfixStatements.SEL_BROADCAST_TEXT_LOCALE);
|
BroadcastTextStorage = DB6Reader.Read<BroadcastTextRecord>("BroadcastText.db2", DB6Metas.BroadcastTextMeta, HotfixStatements.SEL_BROADCAST_TEXT, HotfixStatements.SEL_BROADCAST_TEXT_LOCALE);
|
||||||
|
CharacterFacialHairStylesStorage = DB6Reader.Read<CharacterFacialHairStylesRecord>("CharacterFacialHairStyles.db2", DB6Metas.CharacterFacialHairStylesMeta, HotfixStatements.SEL_CHARACTER_FACIAL_HAIR_STYLES);
|
||||||
|
CharBaseSectionStorage = DB6Reader.Read<CharBaseSectionRecord>("CharBaseSection.db2", DB6Metas.CharBaseSectionMeta, HotfixStatements.SEL_CHAR_BASE_SECTION);
|
||||||
CharSectionsStorage = DB6Reader.Read<CharSectionsRecord>("CharSections.db2", DB6Metas.CharSectionsMeta, HotfixStatements.SEL_CHAR_SECTIONS);
|
CharSectionsStorage = DB6Reader.Read<CharSectionsRecord>("CharSections.db2", DB6Metas.CharSectionsMeta, HotfixStatements.SEL_CHAR_SECTIONS);
|
||||||
CharStartOutfitStorage = DB6Reader.Read<CharStartOutfitRecord>("CharStartOutfit.db2", DB6Metas.CharStartOutfitMeta, HotfixStatements.SEL_CHAR_START_OUTFIT);
|
CharStartOutfitStorage = DB6Reader.Read<CharStartOutfitRecord>("CharStartOutfit.db2", DB6Metas.CharStartOutfitMeta, HotfixStatements.SEL_CHAR_START_OUTFIT);
|
||||||
CharTitlesStorage = DB6Reader.Read<CharTitlesRecord>("CharTitles.db2", DB6Metas.CharTitlesMeta, HotfixStatements.SEL_CHAR_TITLES, HotfixStatements.SEL_CHAR_TITLES_LOCALE);
|
CharTitlesStorage = DB6Reader.Read<CharTitlesRecord>("CharTitles.db2", DB6Metas.CharTitlesMeta, HotfixStatements.SEL_CHAR_TITLES, HotfixStatements.SEL_CHAR_TITLES_LOCALE);
|
||||||
@@ -239,6 +241,10 @@ namespace Game.DataStorage
|
|||||||
TaxiPathNodeStorage = DB6Reader.Read<TaxiPathNodeRecord>("TaxiPathNode.db2", DB6Metas.TaxiPathNodeMeta, HotfixStatements.SEL_TAXI_PATH_NODE);
|
TaxiPathNodeStorage = DB6Reader.Read<TaxiPathNodeRecord>("TaxiPathNode.db2", DB6Metas.TaxiPathNodeMeta, HotfixStatements.SEL_TAXI_PATH_NODE);
|
||||||
TotemCategoryStorage = DB6Reader.Read<TotemCategoryRecord>("TotemCategory.db2", DB6Metas.TotemCategoryMeta, HotfixStatements.SEL_TOTEM_CATEGORY, HotfixStatements.SEL_TOTEM_CATEGORY_LOCALE);
|
TotemCategoryStorage = DB6Reader.Read<TotemCategoryRecord>("TotemCategory.db2", DB6Metas.TotemCategoryMeta, HotfixStatements.SEL_TOTEM_CATEGORY, HotfixStatements.SEL_TOTEM_CATEGORY_LOCALE);
|
||||||
ToyStorage = DB6Reader.Read<ToyRecord>("Toy.db2", DB6Metas.ToyMeta, HotfixStatements.SEL_TOY, HotfixStatements.SEL_TOY_LOCALE);
|
ToyStorage = DB6Reader.Read<ToyRecord>("Toy.db2", DB6Metas.ToyMeta, HotfixStatements.SEL_TOY, HotfixStatements.SEL_TOY_LOCALE);
|
||||||
|
TransmogHolidayStorage = DB6Reader.Read<TransmogHolidayRecord>("TransmogHoliday.db2", DB6Metas.TransmogHolidayMeta, HotfixStatements.SEL_TRANSMOG_HOLIDAY);
|
||||||
|
TransmogSetStorage = DB6Reader.Read<TransmogSetRecord>("TransmogSet.db2", DB6Metas.TransmogSetMeta, HotfixStatements.SEL_TRANSMOG_SET, HotfixStatements.SEL_TRANSMOG_SET_LOCALE);
|
||||||
|
TransmogSetGroupStorage = DB6Reader.Read<TransmogSetGroupRecord>("TransmogSetGroup.db2", DB6Metas.TransmogSetGroupMeta, HotfixStatements.SEL_TRANSMOG_SET_GROUP, HotfixStatements.SEL_TRANSMOG_SET_GROUP_LOCALE);
|
||||||
|
TransmogSetItemStorage = DB6Reader.Read<TransmogSetItemRecord>("TransmogSetItem.db2", DB6Metas.TransmogSetItemMeta, HotfixStatements.SEL_TRANSMOG_SET_ITEM);
|
||||||
TransportAnimationStorage = DB6Reader.Read<TransportAnimationRecord>("TransportAnimation.db2", DB6Metas.TransportAnimationMeta, HotfixStatements.SEL_TRANSPORT_ANIMATION);
|
TransportAnimationStorage = DB6Reader.Read<TransportAnimationRecord>("TransportAnimation.db2", DB6Metas.TransportAnimationMeta, HotfixStatements.SEL_TRANSPORT_ANIMATION);
|
||||||
TransportRotationStorage = DB6Reader.Read<TransportRotationRecord>("TransportRotation.db2", DB6Metas.TransportRotationMeta, HotfixStatements.SEL_TRANSPORT_ROTATION);
|
TransportRotationStorage = DB6Reader.Read<TransportRotationRecord>("TransportRotation.db2", DB6Metas.TransportRotationMeta, HotfixStatements.SEL_TRANSPORT_ROTATION);
|
||||||
UnitPowerBarStorage = DB6Reader.Read<UnitPowerBarRecord>("UnitPowerBar.db2", DB6Metas.UnitPowerBarMeta, HotfixStatements.SEL_UNIT_POWER_BAR, HotfixStatements.SEL_UNIT_POWER_BAR_LOCALE);
|
UnitPowerBarStorage = DB6Reader.Read<UnitPowerBarRecord>("UnitPowerBar.db2", DB6Metas.UnitPowerBarMeta, HotfixStatements.SEL_UNIT_POWER_BAR, HotfixStatements.SEL_UNIT_POWER_BAR_LOCALE);
|
||||||
@@ -378,6 +384,8 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<BattlePetSpeciesStateRecord> BattlePetSpeciesStateStorage;
|
public static DB6Storage<BattlePetSpeciesStateRecord> BattlePetSpeciesStateStorage;
|
||||||
public static DB6Storage<BattlemasterListRecord> BattlemasterListStorage;
|
public static DB6Storage<BattlemasterListRecord> BattlemasterListStorage;
|
||||||
public static DB6Storage<BroadcastTextRecord> BroadcastTextStorage;
|
public static DB6Storage<BroadcastTextRecord> BroadcastTextStorage;
|
||||||
|
public static DB6Storage<CharacterFacialHairStylesRecord> CharacterFacialHairStylesStorage;
|
||||||
|
public static DB6Storage<CharBaseSectionRecord> CharBaseSectionStorage;
|
||||||
public static DB6Storage<CharSectionsRecord> CharSectionsStorage;
|
public static DB6Storage<CharSectionsRecord> CharSectionsStorage;
|
||||||
public static DB6Storage<CharStartOutfitRecord> CharStartOutfitStorage;
|
public static DB6Storage<CharStartOutfitRecord> CharStartOutfitStorage;
|
||||||
public static DB6Storage<CharTitlesRecord> CharTitlesStorage;
|
public static DB6Storage<CharTitlesRecord> CharTitlesStorage;
|
||||||
@@ -557,6 +565,10 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<TaxiPathNodeRecord> TaxiPathNodeStorage;
|
public static DB6Storage<TaxiPathNodeRecord> TaxiPathNodeStorage;
|
||||||
public static DB6Storage<TotemCategoryRecord> TotemCategoryStorage;
|
public static DB6Storage<TotemCategoryRecord> TotemCategoryStorage;
|
||||||
public static DB6Storage<ToyRecord> ToyStorage;
|
public static DB6Storage<ToyRecord> ToyStorage;
|
||||||
|
public static DB6Storage<TransmogHolidayRecord> TransmogHolidayStorage;
|
||||||
|
public static DB6Storage<TransmogSetRecord> TransmogSetStorage;
|
||||||
|
public static DB6Storage<TransmogSetGroupRecord> TransmogSetGroupStorage;
|
||||||
|
public static DB6Storage<TransmogSetItemRecord> TransmogSetItemStorage;
|
||||||
public static DB6Storage<TransportAnimationRecord> TransportAnimationStorage;
|
public static DB6Storage<TransportAnimationRecord> TransportAnimationStorage;
|
||||||
public static DB6Storage<TransportRotationRecord> TransportRotationStorage;
|
public static DB6Storage<TransportRotationRecord> TransportRotationStorage;
|
||||||
public static DB6Storage<UnitPowerBarRecord> UnitPowerBarStorage;
|
public static DB6Storage<UnitPowerBarRecord> UnitPowerBarStorage;
|
||||||
|
|||||||
@@ -59,44 +59,25 @@ namespace Game.DataStorage
|
|||||||
foreach (ArtifactPowerRankRecord artifactPowerRank in CliDB.ArtifactPowerRankStorage.Values)
|
foreach (ArtifactPowerRankRecord artifactPowerRank in CliDB.ArtifactPowerRankStorage.Values)
|
||||||
_artifactPowerRanks[Tuple.Create((uint)artifactPowerRank.ArtifactPowerID, artifactPowerRank.Rank)] = artifactPowerRank;
|
_artifactPowerRanks[Tuple.Create((uint)artifactPowerRank.ArtifactPowerID, artifactPowerRank.Rank)] = artifactPowerRank;
|
||||||
|
|
||||||
MultiMap<uint, Tuple<byte, byte>> addedSections = new MultiMap<uint, Tuple<byte, byte>>();
|
foreach (CharacterFacialHairStylesRecord characterFacialStyle in CliDB.CharacterFacialHairStylesStorage.Values)
|
||||||
|
_characterFacialHairStyles.Add(Tuple.Create(characterFacialStyle.RaceID, characterFacialStyle.SexID, (uint)characterFacialStyle.VariationID));
|
||||||
|
|
||||||
|
CharBaseSectionVariation[] sectionToBase = new CharBaseSectionVariation[(int)CharSectionType.Max];
|
||||||
|
foreach (CharBaseSectionRecord charBaseSection in CliDB.CharBaseSectionStorage.Values)
|
||||||
|
{
|
||||||
|
Contract.Assert(charBaseSection.ResolutionVariation < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charBaseSection.ResolutionVariation + 1}");
|
||||||
|
Contract.Assert(charBaseSection.Variation < CharBaseSectionVariation.Max, $"CharBaseSectionVariation.Max {(byte)CharBaseSectionVariation.Max} must be equal to or greater than {charBaseSection.Variation + 1}");
|
||||||
|
|
||||||
|
sectionToBase[charBaseSection.ResolutionVariation] = (CharBaseSectionVariation)charBaseSection.Variation;
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, Tuple<byte, byte>> addedSections = new MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, Tuple<byte, byte>>();
|
||||||
foreach (CharSectionsRecord charSection in CliDB.CharSectionsStorage.Values)
|
foreach (CharSectionsRecord charSection in CliDB.CharSectionsStorage.Values)
|
||||||
{
|
{
|
||||||
if (charSection.Race == 0 || !Convert.ToBoolean((1 << (charSection.Race - 1)) & (int)Race.RaceMaskAllPlayable)) //ignore Nonplayable races
|
Contract.Assert(charSection.BaseSection < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charSection.BaseSection + 1}");
|
||||||
continue;
|
|
||||||
|
|
||||||
// Not all sections are used for low-res models but we need to get all sections for validation since its viewer dependent
|
Tuple<byte, byte, CharBaseSectionVariation> sectionKey = Tuple.Create(charSection.RaceID, charSection.SexID, sectionToBase[charSection.BaseSection]);
|
||||||
byte baseSection = charSection.GenType;
|
Tuple<byte, byte> sectionCombination = Tuple.Create(charSection.VariationIndex, charSection.ColorIndex);
|
||||||
switch ((CharSectionType)baseSection)
|
|
||||||
{
|
|
||||||
case CharSectionType.SkinLowRes:
|
|
||||||
case CharSectionType.FaceLowRes:
|
|
||||||
case CharSectionType.FacialHairLowRes:
|
|
||||||
case CharSectionType.HairLowRes:
|
|
||||||
case CharSectionType.UnderwearLowRes:
|
|
||||||
baseSection = (byte)(baseSection + (byte)CharSectionType.Skin);
|
|
||||||
break;
|
|
||||||
case CharSectionType.Skin:
|
|
||||||
case CharSectionType.Face:
|
|
||||||
case CharSectionType.FacialHair:
|
|
||||||
case CharSectionType.Hair:
|
|
||||||
case CharSectionType.Underwear:
|
|
||||||
break;
|
|
||||||
case CharSectionType.CustomDisplay1LowRes:
|
|
||||||
case CharSectionType.CustomDisplay2LowRes:
|
|
||||||
case CharSectionType.CustomDisplay3LowRes:
|
|
||||||
++baseSection;
|
|
||||||
break;
|
|
||||||
case CharSectionType.CustomDisplay1:
|
|
||||||
case CharSectionType.CustomDisplay2:
|
|
||||||
case CharSectionType.CustomDisplay3:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint sectionKey = (uint)(baseSection | (charSection.Gender << 8) | (charSection.Race << 16));
|
|
||||||
Tuple<byte, byte> sectionCombination = Tuple.Create(charSection.Type, charSection.Color);
|
|
||||||
if (addedSections.Contains(sectionKey, sectionCombination))
|
if (addedSections.Contains(sectionKey, sectionCombination))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -382,6 +363,16 @@ namespace Game.DataStorage
|
|||||||
foreach (ToyRecord toy in CliDB.ToyStorage.Values)
|
foreach (ToyRecord toy in CliDB.ToyStorage.Values)
|
||||||
_toys.Add(toy.ItemID);
|
_toys.Add(toy.ItemID);
|
||||||
|
|
||||||
|
foreach (TransmogSetItemRecord transmogSetItem in CliDB.TransmogSetItemStorage.Values)
|
||||||
|
{
|
||||||
|
TransmogSetRecord set = CliDB.TransmogSetStorage.LookupByKey(transmogSetItem.TransmogSetID);
|
||||||
|
if (set == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_transmogSetsByItemModifiedAppearance.Add(transmogSetItem.ItemModifiedAppearanceID, set);
|
||||||
|
_transmogSetItemsByTransmogSet.Add(transmogSetItem.TransmogSetID, transmogSetItem);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (WMOAreaTableRecord entry in CliDB.WMOAreaTableStorage.Values)
|
foreach (WMOAreaTableRecord entry in CliDB.WMOAreaTableStorage.Values)
|
||||||
_wmoAreaTableLookup[Tuple.Create(entry.WMOID, entry.NameSet, entry.WMOGroupID)] = entry;
|
_wmoAreaTableLookup[Tuple.Create(entry.WMOID, entry.NameSet, entry.WMOGroupID)] = entry;
|
||||||
|
|
||||||
@@ -523,11 +514,21 @@ namespace Game.DataStorage
|
|||||||
return broadcastText.MaleText[SharedConst.DefaultLocale];
|
return broadcastText.MaleText[SharedConst.DefaultLocale];
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSectionsRecord GetCharSectionEntry(Race race, CharSectionType genType, Gender gender, byte type, byte color)
|
public bool HasCharacterFacialHairStyle(Race race, Gender gender, uint variationId)
|
||||||
{
|
{
|
||||||
var list = _charSections.LookupByKey((byte)genType | ((byte)gender << 8) | ((byte)race << 16));
|
return _characterFacialHairStyles.Contains(Tuple.Create((byte)race, (byte)gender, variationId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasCharSections(Race race, Gender gender, CharBaseSectionVariation variation)
|
||||||
|
{
|
||||||
|
return _charSections.ContainsKey(Tuple.Create(race, gender, variation));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSectionsRecord GetCharSectionEntry(Race race, Gender gender, CharBaseSectionVariation variation, byte variationIndex, byte colorIndex)
|
||||||
|
{
|
||||||
|
var list = _charSections.LookupByKey(Tuple.Create(race, gender, variation));
|
||||||
foreach (var charSection in list)
|
foreach (var charSection in list)
|
||||||
if (charSection.Type == type && charSection.Color == color)
|
if (charSection.VariationIndex == variationIndex && charSection.ColorIndex == colorIndex)
|
||||||
return charSection;
|
return charSection;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -1200,6 +1201,16 @@ namespace Game.DataStorage
|
|||||||
return _toys.Contains(toy);
|
return _toys.Contains(toy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TransmogSetRecord> GetTransmogSetsForItemModifiedAppearance(uint itemModifiedAppearanceId)
|
||||||
|
{
|
||||||
|
return _transmogSetsByItemModifiedAppearance.LookupByKey(itemModifiedAppearanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TransmogSetItemRecord> GetTransmogSetItems(uint transmogSetId)
|
||||||
|
{
|
||||||
|
return _transmogSetItemsByTransmogSet.LookupByKey(transmogSetId);
|
||||||
|
}
|
||||||
|
|
||||||
public WMOAreaTableRecord GetWMOAreaTable(int rootId, int adtId, int groupId)
|
public WMOAreaTableRecord GetWMOAreaTable(int rootId, int adtId, int groupId)
|
||||||
{
|
{
|
||||||
var wmoAreaTable = _wmoAreaTableLookup.LookupByKey(Tuple.Create((short)rootId, (sbyte)adtId, groupId));
|
var wmoAreaTable = _wmoAreaTableLookup.LookupByKey(Tuple.Create((short)rootId, (sbyte)adtId, groupId));
|
||||||
@@ -1307,7 +1318,8 @@ namespace Game.DataStorage
|
|||||||
MultiMap<uint, ArtifactPowerRecord> _artifactPowers = new MultiMap<uint, ArtifactPowerRecord>();
|
MultiMap<uint, ArtifactPowerRecord> _artifactPowers = new MultiMap<uint, ArtifactPowerRecord>();
|
||||||
MultiMap<uint, uint> _artifactPowerLinks = new MultiMap<uint, uint>();
|
MultiMap<uint, uint> _artifactPowerLinks = new MultiMap<uint, uint>();
|
||||||
Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord> _artifactPowerRanks = new Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord>();
|
Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord> _artifactPowerRanks = new Dictionary<Tuple<uint, byte>, ArtifactPowerRankRecord>();
|
||||||
MultiMap<uint, CharSectionsRecord> _charSections = new MultiMap<uint, CharSectionsRecord>();
|
List<Tuple<byte, byte, uint>> _characterFacialHairStyles = new List<Tuple<byte, byte, uint>>();
|
||||||
|
MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, CharSectionsRecord> _charSections = new MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, CharSectionsRecord>();
|
||||||
Dictionary<uint, CharStartOutfitRecord> _charStartOutfits = new Dictionary<uint, CharStartOutfitRecord>();
|
Dictionary<uint, CharStartOutfitRecord> _charStartOutfits = new Dictionary<uint, CharStartOutfitRecord>();
|
||||||
uint[][] _powersByClass = new uint[(int)Class.Max][];
|
uint[][] _powersByClass = new uint[(int)Class.Max][];
|
||||||
ChrSpecializationRecord[][] _chrSpecializationsByIndex = new ChrSpecializationRecord[(int)Class.Max + 1][];
|
ChrSpecializationRecord[][] _chrSpecializationsByIndex = new ChrSpecializationRecord[(int)Class.Max + 1][];
|
||||||
@@ -1348,6 +1360,8 @@ namespace Game.DataStorage
|
|||||||
MultiMap<uint, SpellProcsPerMinuteModRecord> _spellProcsPerMinuteMods = new MultiMap<uint, SpellProcsPerMinuteModRecord>();
|
MultiMap<uint, SpellProcsPerMinuteModRecord> _spellProcsPerMinuteMods = new MultiMap<uint, SpellProcsPerMinuteModRecord>();
|
||||||
List<TalentRecord>[][][] _talentsByPosition = new List<TalentRecord>[(int)Class.Max][][];
|
List<TalentRecord>[][][] _talentsByPosition = new List<TalentRecord>[(int)Class.Max][][];
|
||||||
List<uint> _toys = new List<uint>();
|
List<uint> _toys = new List<uint>();
|
||||||
|
MultiMap<uint, TransmogSetRecord> _transmogSetsByItemModifiedAppearance = new MultiMap<uint, TransmogSetRecord>();
|
||||||
|
MultiMap<uint, TransmogSetItemRecord> _transmogSetItemsByTransmogSet = new MultiMap<uint, TransmogSetItemRecord>();
|
||||||
Dictionary<Tuple<short, sbyte, int>, WMOAreaTableRecord> _wmoAreaTableLookup = new Dictionary<Tuple<short, sbyte, int>, WMOAreaTableRecord>();
|
Dictionary<Tuple<short, sbyte, int>, WMOAreaTableRecord> _wmoAreaTableLookup = new Dictionary<Tuple<short, sbyte, int>, WMOAreaTableRecord>();
|
||||||
Dictionary<uint, WorldMapAreaRecord> _worldMapAreaByAreaID = new Dictionary<uint, WorldMapAreaRecord>();
|
Dictionary<uint, WorldMapAreaRecord> _worldMapAreaByAreaID = new Dictionary<uint, WorldMapAreaRecord>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,33 @@ using Framework.GameMath;
|
|||||||
|
|
||||||
namespace Game.DataStorage
|
namespace Game.DataStorage
|
||||||
{
|
{
|
||||||
|
public sealed class CharacterFacialHairStylesRecord
|
||||||
|
{
|
||||||
|
public uint ID;
|
||||||
|
public uint[] Geoset = new uint[5];
|
||||||
|
public byte RaceID;
|
||||||
|
public byte SexID;
|
||||||
|
public byte VariationID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class CharBaseSectionRecord
|
||||||
|
{
|
||||||
|
public uint ID;
|
||||||
|
public CharBaseSectionVariation Variation;
|
||||||
|
public byte ResolutionVariation;
|
||||||
|
public byte Resolution;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class CharSectionsRecord
|
public sealed class CharSectionsRecord
|
||||||
{
|
{
|
||||||
public uint Id;
|
public uint Id;
|
||||||
public uint[] TextureFileDataID = new uint[3];
|
public uint[] TextureFileDataID = new uint[3];
|
||||||
public ushort Flags;
|
public ushort Flags;
|
||||||
public byte Race;
|
public byte RaceID;
|
||||||
public byte Gender;
|
public byte SexID;
|
||||||
public byte GenType;
|
public byte BaseSection;
|
||||||
public byte Type;
|
public byte VariationIndex;
|
||||||
public byte Color;
|
public byte ColorIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CharStartOutfitRecord
|
public sealed class CharStartOutfitRecord
|
||||||
|
|||||||
@@ -91,6 +91,40 @@ namespace Game.DataStorage
|
|||||||
public uint Id;
|
public uint Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class TransmogHolidayRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public int HolidayID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class TransmogSetRecord
|
||||||
|
{
|
||||||
|
public LocalizedString Name;
|
||||||
|
public ushort BaseSetID;
|
||||||
|
public ushort UIOrder;
|
||||||
|
public byte ExpansionID;
|
||||||
|
public uint Id;
|
||||||
|
public int Flags;
|
||||||
|
public int QuestID;
|
||||||
|
public int ClassMask;
|
||||||
|
public int ItemNameDescriptionID;
|
||||||
|
public uint TransmogSetGroupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class TransmogSetGroupRecord
|
||||||
|
{
|
||||||
|
public LocalizedString Label;
|
||||||
|
public uint Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class TransmogSetItemRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public uint TransmogSetID;
|
||||||
|
public uint ItemModifiedAppearanceID;
|
||||||
|
public int Flags;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class TransportAnimationRecord
|
public sealed class TransportAnimationRecord
|
||||||
{
|
{
|
||||||
public uint Id;
|
public uint Id;
|
||||||
|
|||||||
@@ -2369,7 +2369,7 @@ namespace Game.Entities
|
|||||||
return stats.GenerateHealth(cInfo);
|
return stats.GenerateHealth(cInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetHealthMultiplierForTarget(WorldObject target)
|
public override float GetHealthMultiplierForTarget(WorldObject target)
|
||||||
{
|
{
|
||||||
if (!HasScalableLevels())
|
if (!HasScalableLevels())
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
@@ -2388,7 +2388,7 @@ namespace Game.Entities
|
|||||||
return stats.GenerateBaseDamage(cInfo);
|
return stats.GenerateBaseDamage(cInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetDamageMultiplierForTarget(WorldObject target)
|
public override float GetDamageMultiplierForTarget(WorldObject target)
|
||||||
{
|
{
|
||||||
if (!HasScalableLevels())
|
if (!HasScalableLevels())
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
@@ -2405,7 +2405,7 @@ namespace Game.Entities
|
|||||||
return stats.GenerateArmor(cInfo);
|
return stats.GenerateArmor(cInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetArmorMultiplierForTarget(WorldObject target)
|
public override float GetArmorMultiplierForTarget(WorldObject target)
|
||||||
{
|
{
|
||||||
if (!HasScalableLevels())
|
if (!HasScalableLevels())
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|||||||
+11
-18
@@ -1497,11 +1497,11 @@ namespace Game.Entities
|
|||||||
return ItemTransmogrificationWeaponCategory.Invalid;
|
return ItemTransmogrificationWeaponCategory.Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int[] ItemTransmogrificationSlots =
|
public static int[] ItemTransmogrificationSlots =
|
||||||
{
|
{
|
||||||
-1, // INVTYPE_NON_EQUIP
|
-1, // INVTYPE_NON_EQUIP
|
||||||
EquipmentSlot.Head, // INVTYPE_HEAD
|
EquipmentSlot.Head, // INVTYPE_HEAD
|
||||||
EquipmentSlot.Neck, // INVTYPE_NECK
|
-1, // INVTYPE_NECK
|
||||||
EquipmentSlot.Shoulders, // INVTYPE_SHOULDERS
|
EquipmentSlot.Shoulders, // INVTYPE_SHOULDERS
|
||||||
EquipmentSlot.Shirt, // INVTYPE_BODY
|
EquipmentSlot.Shirt, // INVTYPE_BODY
|
||||||
EquipmentSlot.Chest, // INVTYPE_CHEST
|
EquipmentSlot.Chest, // INVTYPE_CHEST
|
||||||
@@ -1516,15 +1516,15 @@ namespace Game.Entities
|
|||||||
EquipmentSlot.OffHand, // INVTYPE_SHIELD
|
EquipmentSlot.OffHand, // INVTYPE_SHIELD
|
||||||
EquipmentSlot.MainHand, // INVTYPE_RANGED
|
EquipmentSlot.MainHand, // INVTYPE_RANGED
|
||||||
EquipmentSlot.Cloak, // INVTYPE_CLOAK
|
EquipmentSlot.Cloak, // INVTYPE_CLOAK
|
||||||
-1, // INVTYPE_2HWEAPON
|
EquipmentSlot.MainHand, // INVTYPE_2HWEAPON
|
||||||
-1, // INVTYPE_BAG
|
-1, // INVTYPE_BAG
|
||||||
EquipmentSlot.Tabard, // INVTYPE_TABARD
|
EquipmentSlot.Tabard, // INVTYPE_TABARD
|
||||||
EquipmentSlot.Chest, // INVTYPE_ROBE
|
EquipmentSlot.Chest, // INVTYPE_ROBE
|
||||||
EquipmentSlot.MainHand, // INVTYPE_WEAPONMAINHAND
|
EquipmentSlot.MainHand, // INVTYPE_WEAPONMAINHAND
|
||||||
EquipmentSlot.OffHand, // INVTYPE_WEAPONOFFHAND
|
EquipmentSlot.MainHand, // INVTYPE_WEAPONOFFHAND
|
||||||
EquipmentSlot.OffHand, // INVTYPE_HOLDABLE
|
EquipmentSlot.OffHand, // INVTYPE_HOLDABLE
|
||||||
-1, // INVTYPE_AMMO
|
-1, // INVTYPE_AMMO
|
||||||
EquipmentSlot.MainHand, // INVTYPE_THROWN
|
-1, // INVTYPE_THROWN
|
||||||
EquipmentSlot.MainHand, // INVTYPE_RANGEDRIGHT
|
EquipmentSlot.MainHand, // INVTYPE_RANGEDRIGHT
|
||||||
-1, // INVTYPE_QUIVER
|
-1, // INVTYPE_QUIVER
|
||||||
-1 // INVTYPE_RELIC
|
-1 // INVTYPE_RELIC
|
||||||
@@ -1566,22 +1566,15 @@ namespace Game.Entities
|
|||||||
case ItemClass.Armor:
|
case ItemClass.Armor:
|
||||||
if ((ItemSubClassArmor)source.GetSubClass() != ItemSubClassArmor.Cosmetic)
|
if ((ItemSubClassArmor)source.GetSubClass() != ItemSubClassArmor.Cosmetic)
|
||||||
return false;
|
return false;
|
||||||
|
if (source.GetInventoryType() != target.GetInventoryType())
|
||||||
|
if (ItemTransmogrificationSlots[(int)source.GetInventoryType()] != ItemTransmogrificationSlots[(int)target.GetInventoryType()])
|
||||||
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.GetInventoryType() != target.GetInventoryType())
|
|
||||||
{
|
|
||||||
int sourceSlot = ItemTransmogrificationSlots[(int)source.GetInventoryType()];
|
|
||||||
if (sourceSlot == -1 && source.GetInventoryType() == InventoryType.Weapon && (target.GetInventoryType() == InventoryType.WeaponMainhand || target.GetInventoryType() == InventoryType.WeaponOffhand))
|
|
||||||
sourceSlot = ItemTransmogrificationSlots[(int)target.GetInventoryType()];
|
|
||||||
|
|
||||||
if (sourceSlot != ItemTransmogrificationSlots[(int)target.GetInventoryType()])
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2531,11 +2524,11 @@ namespace Game.Entities
|
|||||||
public uint GetScalingStatDistribution() { return _bonusData.ScalingStatDistribution; }
|
public uint GetScalingStatDistribution() { return _bonusData.ScalingStatDistribution; }
|
||||||
|
|
||||||
public void SetRefundRecipient(ObjectGuid guid) { m_refundRecipient = guid; }
|
public void SetRefundRecipient(ObjectGuid guid) { m_refundRecipient = guid; }
|
||||||
public void SetPaidMoney(uint money) { m_paidMoney = money; }
|
public void SetPaidMoney(ulong money) { m_paidMoney = money; }
|
||||||
public void SetPaidExtendedCost(uint iece) { m_paidExtendedCost = iece; }
|
public void SetPaidExtendedCost(uint iece) { m_paidExtendedCost = iece; }
|
||||||
|
|
||||||
public ObjectGuid GetRefundRecipient() { return m_refundRecipient; }
|
public ObjectGuid GetRefundRecipient() { return m_refundRecipient; }
|
||||||
public uint GetPaidMoney() { return m_paidMoney; }
|
public ulong GetPaidMoney() { return m_paidMoney; }
|
||||||
public uint GetPaidExtendedCost() { return m_paidExtendedCost; }
|
public uint GetPaidExtendedCost() { return m_paidExtendedCost; }
|
||||||
|
|
||||||
public uint GetScriptId() { return GetTemplate().ScriptId; }
|
public uint GetScriptId() { return GetTemplate().ScriptId; }
|
||||||
@@ -2637,7 +2630,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
ItemUpdateState uState;
|
ItemUpdateState uState;
|
||||||
uint m_paidExtendedCost;
|
uint m_paidExtendedCost;
|
||||||
uint m_paidMoney;
|
ulong m_paidMoney;
|
||||||
ObjectGuid m_refundRecipient;
|
ObjectGuid m_refundRecipient;
|
||||||
byte m_slot;
|
byte m_slot;
|
||||||
Bag m_container;
|
Bag m_container;
|
||||||
|
|||||||
@@ -2417,6 +2417,14 @@ namespace Game.Entities
|
|||||||
SendMessageToSet(sound, true);
|
SendMessageToSet(sound, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PlayDirectMusic(uint musicId, Player target = null)
|
||||||
|
{
|
||||||
|
if (target)
|
||||||
|
target.SendPacket(new PlayMusic(musicId));
|
||||||
|
else
|
||||||
|
SendMessageToSet(new PlayMusic(musicId), true);
|
||||||
|
}
|
||||||
|
|
||||||
public void DestroyForNearbyPlayers()
|
public void DestroyForNearbyPlayers()
|
||||||
{
|
{
|
||||||
if (!IsInWorld)
|
if (!IsInWorld)
|
||||||
|
|||||||
@@ -675,6 +675,19 @@ namespace Game.Entities
|
|||||||
_owner.GetPlayer().RemoveDynamicValue(PlayerDynamicFields.ConditionalTransmog, itemModifiedAppearance.Id);
|
_owner.GetPlayer().RemoveDynamicValue(PlayerDynamicFields.ConditionalTransmog, itemModifiedAppearance.Id);
|
||||||
_temporaryAppearances.Remove(itemModifiedAppearance.Id);
|
_temporaryAppearances.Remove(itemModifiedAppearance.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemRecord item = CliDB.ItemStorage.LookupByKey(itemModifiedAppearance.ItemID);
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
int transmogSlot = Item.ItemTransmogrificationSlots[(int)item.inventoryType];
|
||||||
|
if (transmogSlot >= 0)
|
||||||
|
_owner.GetPlayer().UpdateCriteria(CriteriaTypes.AppearanceUnlockedBySlot, (ulong)transmogSlot, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var sets = Global.DB2Mgr.GetTransmogSetsForItemModifiedAppearance(itemModifiedAppearance.Id);
|
||||||
|
foreach (TransmogSetRecord set in sets)
|
||||||
|
if (IsSetCompleted(set.Id))
|
||||||
|
_owner.GetPlayer().UpdateCriteria(CriteriaTypes.TransmogSetUnlocked, set.TransmogSetGroupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTemporaryAppearance(ObjectGuid itemGuid, ItemModifiedAppearanceRecord itemModifiedAppearance)
|
void AddTemporaryAppearance(ObjectGuid itemGuid, ItemModifiedAppearanceRecord itemModifiedAppearance)
|
||||||
@@ -763,6 +776,54 @@ namespace Game.Entities
|
|||||||
_owner.SendPacket(transmogCollectionUpdate);
|
_owner.SendPacket(transmogCollectionUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddTransmogSet(uint transmogSetId)
|
||||||
|
{
|
||||||
|
var items = Global.DB2Mgr.GetTransmogSetItems(transmogSetId);
|
||||||
|
if (items.Empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (TransmogSetItemRecord item in items)
|
||||||
|
{
|
||||||
|
ItemModifiedAppearanceRecord itemModifiedAppearance = CliDB.ItemModifiedAppearanceStorage.LookupByKey(item.ItemModifiedAppearanceID);
|
||||||
|
if (itemModifiedAppearance == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
AddItemAppearance(itemModifiedAppearance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsSetCompleted(uint transmogSetId)
|
||||||
|
{
|
||||||
|
var transmogSetItems = Global.DB2Mgr.GetTransmogSetItems(transmogSetId);
|
||||||
|
if (transmogSetItems.Empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int[] knownPieces = new int[EquipmentSlot.End];
|
||||||
|
for (var i = 0; i < EquipmentSlot.End; ++i)
|
||||||
|
knownPieces[i] = -1;
|
||||||
|
|
||||||
|
foreach (TransmogSetItemRecord transmogSetItem in transmogSetItems)
|
||||||
|
{
|
||||||
|
ItemModifiedAppearanceRecord itemModifiedAppearance = CliDB.ItemModifiedAppearanceStorage.LookupByKey(transmogSetItem.ItemModifiedAppearanceID);
|
||||||
|
if (itemModifiedAppearance == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ItemRecord item = CliDB.ItemStorage.LookupByKey(itemModifiedAppearance.ItemID);
|
||||||
|
if (item == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int transmogSlot = Item.ItemTransmogrificationSlots[(int)item.inventoryType];
|
||||||
|
if (transmogSlot < 0 || knownPieces[transmogSlot] == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
(var hasAppearance, var isTemporary) = HasItemAppearance(transmogSetItem.ItemModifiedAppearanceID);
|
||||||
|
|
||||||
|
knownPieces[transmogSlot] = (hasAppearance && !isTemporary) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !knownPieces.Contains(0);
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasToy(uint itemId) { return _toys.ContainsKey(itemId); }
|
public bool HasToy(uint itemId) { return _toys.ContainsKey(itemId); }
|
||||||
public Dictionary<uint, bool> GetAccountToys() { return _toys; }
|
public Dictionary<uint, bool> GetAccountToys() { return _toys; }
|
||||||
public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; }
|
public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; }
|
||||||
|
|||||||
@@ -56,11 +56,13 @@ namespace Game.Entities
|
|||||||
public void ResetCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, bool evenIfCriteriaComplete = false)
|
public void ResetCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, bool evenIfCriteriaComplete = false)
|
||||||
{
|
{
|
||||||
m_achievementSys.ResetCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
|
m_achievementSys.ResetCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
|
||||||
|
m_questObjectiveCriteriaMgr.ResetCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, Unit unit = null)
|
public void UpdateCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, Unit unit = null)
|
||||||
{
|
{
|
||||||
m_achievementSys.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
|
m_achievementSys.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
|
||||||
|
m_questObjectiveCriteriaMgr.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, unit, this);
|
||||||
|
|
||||||
// Update only individual achievement criteria here, otherwise we may get multiple updates
|
// Update only individual achievement criteria here, otherwise we may get multiple updates
|
||||||
// from a single boss kill
|
// from a single boss kill
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace Game.Entities
|
|||||||
if (!result.IsEmpty())
|
if (!result.IsEmpty())
|
||||||
{
|
{
|
||||||
item.SetRefundRecipient(GetGUID());
|
item.SetRefundRecipient(GetGUID());
|
||||||
item.SetPaidMoney(result.Read<uint>(0));
|
item.SetPaidMoney(result.Read<ulong>(0));
|
||||||
item.SetPaidExtendedCost(result.Read<ushort>(1));
|
item.SetPaidExtendedCost(result.Read<ushort>(1));
|
||||||
AddRefundReference(item.GetGUID());
|
AddRefundReference(item.GetGUID());
|
||||||
}
|
}
|
||||||
@@ -2373,6 +2373,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
// load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
|
// load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
|
||||||
m_achievementSys.LoadFromDB(holder.GetResult(PlayerLoginQueryLoad.Achievements), holder.GetResult(PlayerLoginQueryLoad.CriteriaProgress));
|
m_achievementSys.LoadFromDB(holder.GetResult(PlayerLoginQueryLoad.Achievements), holder.GetResult(PlayerLoginQueryLoad.CriteriaProgress));
|
||||||
|
m_questObjectiveCriteriaMgr.LoadFromDB(holder.GetResult(PlayerLoginQueryLoad.QuestStatusObjectivesCriteria), holder.GetResult(PlayerLoginQueryLoad.QuestStatusObjectivesCriteriaProgress));
|
||||||
|
|
||||||
ulong money = result.Read<ulong>(8);
|
ulong money = result.Read<ulong>(8);
|
||||||
if (money > PlayerConst.MaxMoneyAmount)
|
if (money > PlayerConst.MaxMoneyAmount)
|
||||||
@@ -3035,7 +3036,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_achievementSys.CheckAllAchievementCriteria(this);
|
m_achievementSys.CheckAllAchievementCriteria(this);
|
||||||
|
m_questObjectiveCriteriaMgr.CheckAllQuestObjectiveCriteria(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public void SaveToDB(bool create = false)
|
public void SaveToDB(bool create = false)
|
||||||
@@ -3383,6 +3384,7 @@ namespace Game.Entities
|
|||||||
_SaveSkills(trans);
|
_SaveSkills(trans);
|
||||||
m_achievementSys.SaveToDB(trans);
|
m_achievementSys.SaveToDB(trans);
|
||||||
reputationMgr.SaveToDB(trans);
|
reputationMgr.SaveToDB(trans);
|
||||||
|
m_questObjectiveCriteriaMgr.SaveToDB(trans);
|
||||||
_SaveEquipmentSets(trans);
|
_SaveEquipmentSets(trans);
|
||||||
GetSession().SaveTutorialsData(trans); // changed only while character in game
|
GetSession().SaveTutorialsData(trans); // changed only while character in game
|
||||||
_SaveInstanceTimeRestrictions(trans);
|
_SaveInstanceTimeRestrictions(trans);
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ namespace Game.Entities
|
|||||||
public uint m_timeSyncClient;
|
public uint m_timeSyncClient;
|
||||||
public uint m_timeSyncServer;
|
public uint m_timeSyncServer;
|
||||||
ReputationMgr reputationMgr;
|
ReputationMgr reputationMgr;
|
||||||
|
QuestObjectiveCriteriaManager m_questObjectiveCriteriaMgr;
|
||||||
public AtLoginFlags atLoginFlags;
|
public AtLoginFlags atLoginFlags;
|
||||||
public bool m_itemUpdateQueueBlocked;
|
public bool m_itemUpdateQueueBlocked;
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
SendItemRefundResult(item, iece, 0);
|
SendItemRefundResult(item, iece, 0);
|
||||||
|
|
||||||
uint moneyRefund = item.GetPaidMoney(); // item. will be invalidated in DestroyItem
|
ulong moneyRefund = item.GetPaidMoney(); // item. will be invalidated in DestroyItem
|
||||||
|
|
||||||
// Save all relevant data to DB to prevent desynchronisation exploits
|
// Save all relevant data to DB to prevent desynchronisation exploits
|
||||||
SQLTransaction trans = new SQLTransaction();
|
SQLTransaction trans = new SQLTransaction();
|
||||||
@@ -142,7 +142,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
// Grant back money
|
// Grant back money
|
||||||
if (moneyRefund != 0)
|
if (moneyRefund != 0)
|
||||||
ModifyMoney(moneyRefund); // Saved in SaveInventoryAndGoldToDB
|
ModifyMoney((long)moneyRefund); // Saved in SaveInventoryAndGoldToDB
|
||||||
|
|
||||||
SaveInventoryAndGoldToDB(trans);
|
SaveInventoryAndGoldToDB(trans);
|
||||||
|
|
||||||
@@ -2483,7 +2483,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
AutoUnequipOffhandIfNeed();
|
AutoUnequipOffhandIfNeed();
|
||||||
}
|
}
|
||||||
bool _StoreOrEquipNewItem(uint vendorslot, uint item, byte count, byte bag, byte slot, int price, ItemTemplate pProto, Creature pVendor, VendorItem crItem, bool bStore)
|
bool _StoreOrEquipNewItem(uint vendorslot, uint item, byte count, byte bag, byte slot, long price, ItemTemplate pProto, Creature pVendor, VendorItem crItem, bool bStore)
|
||||||
{
|
{
|
||||||
uint stacks = count / pProto.GetBuyCount();
|
uint stacks = count / pProto.GetBuyCount();
|
||||||
List<ItemPosCount> vDest = new List<ItemPosCount>();
|
List<ItemPosCount> vDest = new List<ItemPosCount>();
|
||||||
@@ -3632,7 +3632,7 @@ namespace Game.Entities
|
|||||||
// check current item amount if it limited
|
// check current item amount if it limited
|
||||||
if (crItem.maxcount != 0)
|
if (crItem.maxcount != 0)
|
||||||
{
|
{
|
||||||
if (creature.GetVendorItemCurrentCount(crItem) < pProto.GetBuyCount() * count)
|
if (creature.GetVendorItemCurrentCount(crItem) < count)
|
||||||
{
|
{
|
||||||
SendBuyError(BuyResult.ItemAlreadySold, creature, item);
|
SendBuyError(BuyResult.ItemAlreadySold, creature, item);
|
||||||
return false;
|
return false;
|
||||||
@@ -3722,19 +3722,20 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint price = 0;
|
ulong price = 0;
|
||||||
if (crItem.IsGoldRequired(pProto) && pProto.GetBuyPrice() > 0) //Assume price cannot be negative (do not know why it is int32)
|
if (crItem.IsGoldRequired(pProto) && pProto.GetBuyPrice() > 0) //Assume price cannot be negative (do not know why it is int32)
|
||||||
{
|
{
|
||||||
uint maxCount = (uint)(Int64.MaxValue / pProto.GetBuyPrice());
|
float buyPricePerItem = pProto.GetBuyPrice() / pProto.GetBuyCount();
|
||||||
|
ulong maxCount = (ulong)(PlayerConst.MaxMoneyAmount / buyPricePerItem);
|
||||||
if (count > maxCount)
|
if (count > maxCount)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Player, "Player {0} tried to buy {1} item id {2}, causing overflow", GetName(), count, pProto.GetId());
|
Log.outError(LogFilter.Player, "Player {0} tried to buy {1} item id {2}, causing overflow", GetName(), count, pProto.GetId());
|
||||||
count = (byte)maxCount;
|
count = (byte)maxCount;
|
||||||
}
|
}
|
||||||
price = pProto.GetBuyPrice() * count; //it should not exceed MAX_MONEY_AMOUNT
|
price = (ulong)(buyPricePerItem * count); //it should not exceed MAX_MONEY_AMOUNT
|
||||||
|
|
||||||
// reputation discount
|
// reputation discount
|
||||||
price = (uint)Math.Floor(price * GetReputationPriceDiscount(creature));
|
price = (ulong)Math.Floor(price * GetReputationPriceDiscount(creature));
|
||||||
|
|
||||||
int priceMod = GetTotalAuraModifier(AuraType.ModVendorItemsPrices);
|
int priceMod = GetTotalAuraModifier(AuraType.ModVendorItemsPrices);
|
||||||
if (priceMod != 0)
|
if (priceMod != 0)
|
||||||
|
|||||||
@@ -540,6 +540,11 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
AddQuest(quest, questGiver);
|
AddQuest(quest, questGiver);
|
||||||
|
|
||||||
|
foreach (QuestObjective obj in quest.Objectives)
|
||||||
|
if (obj.Type == QuestObjectiveType.CriteriaTree)
|
||||||
|
if (m_questObjectiveCriteriaMgr.HasCompletedObjective(obj))
|
||||||
|
KillCreditCriteriaTreeObjective(obj);
|
||||||
|
|
||||||
if (CanCompleteQuest(quest.Id))
|
if (CanCompleteQuest(quest.Id))
|
||||||
CompleteQuest(quest.Id);
|
CompleteQuest(quest.Id);
|
||||||
|
|
||||||
@@ -700,11 +705,20 @@ namespace Game.Entities
|
|||||||
|
|
||||||
foreach (QuestObjective obj in quest.Objectives)
|
foreach (QuestObjective obj in quest.Objectives)
|
||||||
{
|
{
|
||||||
if (obj.Type == QuestObjectiveType.MinReputation || obj.Type == QuestObjectiveType.MaxReputation)
|
switch (obj.Type)
|
||||||
{
|
{
|
||||||
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
case QuestObjectiveType.MinReputation:
|
||||||
if (factionEntry != null)
|
case QuestObjectiveType.MaxReputation:
|
||||||
GetReputationMgr().SetVisible(factionEntry);
|
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
||||||
|
if (factionEntry != null)
|
||||||
|
GetReputationMgr().SetVisible(factionEntry);
|
||||||
|
break;
|
||||||
|
case QuestObjectiveType.CriteriaTree:
|
||||||
|
if (quest.HasFlagEx(QuestFlagsEx.ClearProgressOfCriteriaTreeObjectivesOnAccept))
|
||||||
|
m_questObjectiveCriteriaMgr.ResetCriteriaTree((uint)obj.ObjectID);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1423,7 +1437,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool SatisfyQuestConditions(Quest qInfo, bool msg)
|
public bool SatisfyQuestConditions(Quest qInfo, bool msg)
|
||||||
{
|
{
|
||||||
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAccept, qInfo.Id, this))
|
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAvailable, qInfo.Id, this))
|
||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
@@ -1818,7 +1832,7 @@ namespace Game.Entities
|
|||||||
if (quest == null)
|
if (quest == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAccept, quest.Id, this))
|
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAvailable, quest.Id, this))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QuestStatus status = GetQuestStatus(questId);
|
QuestStatus status = GetQuestStatus(questId);
|
||||||
@@ -1844,7 +1858,7 @@ namespace Game.Entities
|
|||||||
if (quest == null)
|
if (quest == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAccept, quest.Id, this))
|
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.QuestAvailable, quest.Id, this))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QuestStatus status = GetQuestStatus(questId);
|
QuestStatus status = GetQuestStatus(questId);
|
||||||
@@ -2273,6 +2287,21 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void KillCreditCriteriaTreeObjective(QuestObjective questObjective)
|
||||||
|
{
|
||||||
|
if (questObjective.Type != QuestObjectiveType.CriteriaTree)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetQuestStatus(questObjective.QuestID) == QuestStatus.Incomplete)
|
||||||
|
{
|
||||||
|
SetQuestObjectiveData(questObjective, 1);
|
||||||
|
SendQuestUpdateAddCreditSimple(questObjective);
|
||||||
|
|
||||||
|
if (CanCompleteQuest(questObjective.QuestID))
|
||||||
|
CompleteQuest(questObjective.QuestID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TalkedToCreature(uint entry, ObjectGuid guid)
|
public void TalkedToCreature(uint entry, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
ushort addTalkCount = 1;
|
ushort addTalkCount = 1;
|
||||||
@@ -2579,6 +2608,7 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case QuestObjectiveType.AreaTrigger:
|
case QuestObjectiveType.AreaTrigger:
|
||||||
|
case QuestObjectiveType.CriteriaTree:
|
||||||
if (GetQuestObjectiveData(quest, objective.StorageIndex) == 0)
|
if (GetQuestObjectiveData(quest, objective.StorageIndex) == 0)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1844,7 +1844,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
for (CurrentSpellTypes i = 0; i < CurrentSpellTypes.Max; ++i)
|
for (CurrentSpellTypes i = 0; i < CurrentSpellTypes.Max; ++i)
|
||||||
{
|
{
|
||||||
Spell spell = m_currentSpells[i];
|
Spell spell = GetCurrentSpell(i);
|
||||||
if (spell != null)
|
if (spell != null)
|
||||||
RestoreSpellMods(spell, ownerAuraId, aura);
|
RestoreSpellMods(spell, ownerAuraId, aura);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
m_achievementSys = new PlayerAchievementMgr(this);
|
m_achievementSys = new PlayerAchievementMgr(this);
|
||||||
reputationMgr = new ReputationMgr(this);
|
reputationMgr = new ReputationMgr(this);
|
||||||
|
m_questObjectiveCriteriaMgr = new QuestObjectiveCriteriaManager(this);
|
||||||
m_sceneMgr = new SceneMgr(this);
|
m_sceneMgr = new SceneMgr(this);
|
||||||
|
|
||||||
m_bgBattlegroundQueueID[0] = new BgBattlegroundQueueID_Rec();
|
m_bgBattlegroundQueueID[0] = new BgBattlegroundQueueID_Rec();
|
||||||
@@ -283,7 +284,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
InitRunes();
|
InitRunes();
|
||||||
|
|
||||||
SetUInt32Value(PlayerFields.Coinage, WorldConfig.GetUIntValue(WorldCfg.StartPlayerMoney));
|
SetUInt64Value(PlayerFields.Coinage, WorldConfig.GetUIntValue(WorldCfg.StartPlayerMoney));
|
||||||
SetCurrency(CurrencyTypes.ApexisCrystals, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartApexisCrystals));
|
SetCurrency(CurrencyTypes.ApexisCrystals, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartApexisCrystals));
|
||||||
SetCurrency(CurrencyTypes.JusticePoints, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartJusticePoints));
|
SetCurrency(CurrencyTypes.JusticePoints, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartJusticePoints));
|
||||||
|
|
||||||
@@ -2551,7 +2552,7 @@ namespace Game.Entities
|
|||||||
GetSession().SendStablePet(guid);
|
GetSession().SendStablePet(guid);
|
||||||
break;
|
break;
|
||||||
case GossipOption.Trainer:
|
case GossipOption.Trainer:
|
||||||
GetSession().SendTrainerList(guid, menuItemData.TrainerId);
|
GetSession().SendTrainerList(source.ToCreature(), menuItemData.TrainerId);
|
||||||
break;
|
break;
|
||||||
case GossipOption.Learndualspec:
|
case GossipOption.Learndualspec:
|
||||||
break;
|
break;
|
||||||
@@ -4086,45 +4087,42 @@ namespace Game.Entities
|
|||||||
|
|
||||||
return ComponentFlagsMatch(entry, GetSelectionFromContext(2, class_));
|
return ComponentFlagsMatch(entry, GetSelectionFromContext(2, class_));
|
||||||
}
|
}
|
||||||
|
static bool IsSectionValid(Race race, Class class_, Gender gender, CharBaseSectionVariation variation, byte variationIndex, byte colorIndex, bool create)
|
||||||
|
{
|
||||||
|
CharSectionsRecord section = Global.DB2Mgr.GetCharSectionEntry(race, gender, variation, variationIndex, colorIndex);
|
||||||
|
if (section != null)
|
||||||
|
return IsSectionFlagValid(section, class_, create);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public static bool IsValidGender(Gender _gender) { return _gender <= Gender.Female; }
|
public static bool IsValidGender(Gender _gender) { return _gender <= Gender.Female; }
|
||||||
public static bool IsValidClass(Class _class) { return Convert.ToBoolean((1 << ((int)_class - 1)) & (int)Class.ClassMaskAllPlayable); }
|
public static bool IsValidClass(Class _class) { return Convert.ToBoolean((1 << ((int)_class - 1)) & (int)Class.ClassMaskAllPlayable); }
|
||||||
public static bool IsValidRace(Race _race) { return Convert.ToBoolean((1 << ((int)_race - 1)) & (int)Race.RaceMaskAllPlayable); }
|
public static bool IsValidRace(Race _race) { return Convert.ToBoolean((1 << ((int)_race - 1)) & (int)Race.RaceMaskAllPlayable); }
|
||||||
|
|
||||||
public static bool ValidateAppearance(Race race, Class class_, Gender gender, byte hairID, byte hairColor, byte faceID, byte facialHairId, byte skinColor, Array<byte> customDisplay, bool create = false)
|
public static bool ValidateAppearance(Race race, Class class_, Gender gender, byte hairID, byte hairColor, byte faceID, byte facialHairId, byte skinColor, Array<byte> customDisplay, bool create = false)
|
||||||
{
|
{
|
||||||
CharSectionsRecord skin = Global.DB2Mgr.GetCharSectionEntry(race, CharSectionType.Skin, gender, 0, skinColor);
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.Skin, 0, skinColor, create))
|
||||||
if (skin == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!IsSectionFlagValid(skin, class_, create))
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.Face, faceID, skinColor, create))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CharSectionsRecord face = Global.DB2Mgr.GetCharSectionEntry(race, CharSectionType.Face, gender, faceID, skinColor);
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.Hair, hairID, hairColor, create))
|
||||||
if (face == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!IsSectionFlagValid(face, class_, create))
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.FacialHair, facialHairId, hairColor, create))
|
||||||
|
if (Global.DB2Mgr.HasCharSections(race, gender, CharBaseSectionVariation.FacialHair) || !Global.DB2Mgr.HasCharacterFacialHairStyle(race, gender, facialHairId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.CustomDisplay1, customDisplay[0], 0, create))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CharSectionsRecord hair = Global.DB2Mgr.GetCharSectionEntry(race, CharSectionType.Hair, gender, hairID, hairColor);
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.CustomDisplay2, customDisplay[1], 0, create))
|
||||||
if (hair == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!IsSectionFlagValid(hair, class_, create))
|
if (!IsSectionValid(race, class_, gender, CharBaseSectionVariation.CustomDisplay3, customDisplay[2], 0, create))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CharSectionsRecord facialHair = Global.DB2Mgr.GetCharSectionEntry(race, CharSectionType.Hair, gender, facialHairId, hairColor);
|
|
||||||
if (facialHair == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
|
|
||||||
{
|
|
||||||
CharSectionsRecord entry = Global.DB2Mgr.GetCharSectionEntry(race, (CharSectionType.CustomDisplay1 + i * 2), gender, customDisplay[i], 0);
|
|
||||||
if (entry != null)
|
|
||||||
if (!IsSectionFlagValid(entry, class_, create))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5125,8 +5123,8 @@ namespace Game.Entities
|
|||||||
SetMoney((ulong)(GetMoney() > (ulong)-amount ? (long)GetMoney() + amount : 0));
|
SetMoney((ulong)(GetMoney() > (ulong)-amount ? (long)GetMoney() + amount : 0));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetMoney() < (ulong)(PlayerConst.MaxMoneyAmount - amount))
|
if (GetMoney() <= (PlayerConst.MaxMoneyAmount - (ulong)amount))
|
||||||
SetMoney((ulong)((long)GetMoney() + amount));
|
SetMoney((ulong)(GetMoney() + (ulong)amount));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sendError)
|
if (sendError)
|
||||||
@@ -5514,6 +5512,7 @@ namespace Game.Entities
|
|||||||
SendEquipmentSetList();
|
SendEquipmentSetList();
|
||||||
|
|
||||||
m_achievementSys.SendAllData(this);
|
m_achievementSys.SendAllData(this);
|
||||||
|
m_questObjectiveCriteriaMgr.SendAllData(this);
|
||||||
|
|
||||||
// SMSG_LOGIN_SETTIMESPEED
|
// SMSG_LOGIN_SETTIMESPEED
|
||||||
float TimeSpeed = 0.01666667f;
|
float TimeSpeed = 0.01666667f;
|
||||||
|
|||||||
+15
-18
@@ -656,38 +656,37 @@ namespace Game.Entities
|
|||||||
|
|
||||||
float GetUnitCriticalChance(WeaponAttackType attackType, Unit victim)
|
float GetUnitCriticalChance(WeaponAttackType attackType, Unit victim)
|
||||||
{
|
{
|
||||||
float crit;
|
float chance = 0.0f;
|
||||||
|
|
||||||
if (IsTypeId(TypeId.Player))
|
if (IsTypeId(TypeId.Player))
|
||||||
{
|
{
|
||||||
switch (attackType)
|
switch (attackType)
|
||||||
{
|
{
|
||||||
case WeaponAttackType.BaseAttack:
|
case WeaponAttackType.BaseAttack:
|
||||||
crit = GetFloatValue(PlayerFields.CritPercentage);
|
chance = GetFloatValue(PlayerFields.CritPercentage);
|
||||||
break;
|
break;
|
||||||
case WeaponAttackType.OffAttack:
|
case WeaponAttackType.OffAttack:
|
||||||
crit = GetFloatValue(PlayerFields.OffhandCritPercentage);
|
chance = GetFloatValue(PlayerFields.OffhandCritPercentage);
|
||||||
break;
|
break;
|
||||||
case WeaponAttackType.RangedAttack:
|
case WeaponAttackType.RangedAttack:
|
||||||
crit = GetFloatValue(PlayerFields.RangedCritPercentage);
|
chance = GetFloatValue(PlayerFields.RangedCritPercentage);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
crit = 0.0f;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
crit = 5.0f;
|
if (!ToCreature().GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoCrit))
|
||||||
crit += GetTotalAuraModifier(AuraType.ModWeaponCritPercent);
|
{
|
||||||
crit += GetTotalAuraModifier(AuraType.ModCritPct);
|
chance = 5.0f;
|
||||||
|
chance += GetTotalAuraModifier(AuraType.ModWeaponCritPercent);
|
||||||
|
chance += GetTotalAuraModifier(AuraType.ModCritPct);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flat aura mods
|
// flat aura mods
|
||||||
if (attackType == WeaponAttackType.RangedAttack)
|
if (attackType == WeaponAttackType.RangedAttack)
|
||||||
crit += victim.GetTotalAuraModifier(AuraType.ModAttackerRangedCritChance);
|
chance += victim.GetTotalAuraModifier(AuraType.ModAttackerRangedCritChance);
|
||||||
else
|
else
|
||||||
crit += victim.GetTotalAuraModifier(AuraType.ModAttackerMeleeCritChance);
|
chance += victim.GetTotalAuraModifier(AuraType.ModAttackerMeleeCritChance);
|
||||||
|
|
||||||
var critChanceForCaster = victim.GetAuraEffectsByType(AuraType.ModCritChanceForCaster);
|
var critChanceForCaster = victim.GetAuraEffectsByType(AuraType.ModCritChanceForCaster);
|
||||||
foreach (AuraEffect aurEff in critChanceForCaster)
|
foreach (AuraEffect aurEff in critChanceForCaster)
|
||||||
@@ -695,14 +694,12 @@ namespace Game.Entities
|
|||||||
if (aurEff.GetCasterGUID() != GetGUID())
|
if (aurEff.GetCasterGUID() != GetGUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
crit += aurEff.GetAmount();
|
chance += aurEff.GetAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
crit += victim.GetTotalAuraModifier(AuraType.ModAttackerSpellAndWeaponCritChance);
|
chance += victim.GetTotalAuraModifier(AuraType.ModAttackerSpellAndWeaponCritChance);
|
||||||
|
|
||||||
if (crit < 0.0f)
|
return Math.Max(chance, 0.0f);
|
||||||
crit = 0.0f;
|
|
||||||
return crit;
|
|
||||||
}
|
}
|
||||||
float GetUnitDodgeChance(WeaponAttackType attType, Unit victim)
|
float GetUnitDodgeChance(WeaponAttackType attType, Unit victim)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -688,19 +688,18 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
public Unit GetMeleeHitRedirectTarget(Unit victim, SpellInfo spellInfo = null)
|
public Unit GetMeleeHitRedirectTarget(Unit victim, SpellInfo spellInfo = null)
|
||||||
{
|
{
|
||||||
var hitTriggerAuras = victim.GetAuraEffectsByType(AuraType.AddCasterHitTrigger);
|
var interceptAuras = victim.GetAuraEffectsByType(AuraType.InterceptMeleeRangedAttacks);
|
||||||
foreach (var i in hitTriggerAuras)
|
foreach (var i in interceptAuras)
|
||||||
{
|
{
|
||||||
Unit magnet = i.GetCaster();
|
Unit magnet = i.GetCaster();
|
||||||
if (magnet != null)
|
if (magnet != null)
|
||||||
if (_IsValidAttackTarget(magnet, spellInfo) && magnet.IsWithinLOSInMap(this)
|
if (_IsValidAttackTarget(magnet, spellInfo) && magnet.IsWithinLOSInMap(this)
|
||||||
&& (spellInfo == null || (spellInfo.CheckExplicitTarget(this, magnet) == SpellCastResult.SpellCastOk
|
&& (spellInfo == null || (spellInfo.CheckExplicitTarget(this, magnet) == SpellCastResult.SpellCastOk
|
||||||
&& spellInfo.CheckTarget(this, magnet, false) == SpellCastResult.SpellCastOk)))
|
&& spellInfo.CheckTarget(this, magnet, false) == SpellCastResult.SpellCastOk)))
|
||||||
if (RandomHelper.randChance(i.GetAmount()))
|
{
|
||||||
{
|
i.GetBase().DropCharge(AuraRemoveMode.Expire);
|
||||||
i.GetBase().DropCharge(AuraRemoveMode.Expire);
|
return magnet;
|
||||||
return magnet;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return victim;
|
return victim;
|
||||||
}
|
}
|
||||||
@@ -2053,10 +2052,7 @@ namespace Game.Entities
|
|||||||
// 6.CRIT
|
// 6.CRIT
|
||||||
tmp = crit_chance;
|
tmp = crit_chance;
|
||||||
if (tmp > 0 && roll < (sum += tmp))
|
if (tmp > 0 && roll < (sum += tmp))
|
||||||
{
|
return MeleeHitOutcome.Crit;
|
||||||
if (GetTypeId() != TypeId.Unit || !(ToCreature().GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoCrit)))
|
|
||||||
return MeleeHitOutcome.Crit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7. CRUSHING
|
// 7. CRUSHING
|
||||||
// mobs can score crushing blows if they're 4 or more levels above victim
|
// mobs can score crushing blows if they're 4 or more levels above victim
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public SpellInfo GetSpellInfo()
|
public SpellInfo GetSpellInfo()
|
||||||
{
|
{
|
||||||
/// WORKAROUND: unfinished new proc system
|
|
||||||
if (_spell)
|
if (_spell)
|
||||||
return _spell.GetSpellInfo();
|
return _spell.GetSpellInfo();
|
||||||
if (_damageInfo != null)
|
if (_damageInfo != null)
|
||||||
@@ -194,7 +193,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
public SpellSchoolMask GetSchoolMask()
|
public SpellSchoolMask GetSchoolMask()
|
||||||
{
|
{
|
||||||
/// WORKAROUND: unfinished new proc system
|
|
||||||
if (_spell)
|
if (_spell)
|
||||||
return _spell.GetSpellInfo().GetSchoolMask();
|
return _spell.GetSpellInfo().GetSchoolMask();
|
||||||
if (_damageInfo != null)
|
if (_damageInfo != null)
|
||||||
|
|||||||
@@ -752,6 +752,13 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spell crit suppression
|
||||||
|
if (victim.GetTypeId() == TypeId.Unit)
|
||||||
|
{
|
||||||
|
int levelDiff = (int)(victim.GetLevelForTarget(this) - getLevel());
|
||||||
|
crit_chance -= levelDiff * 1.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -776,7 +783,7 @@ namespace Game.Entities
|
|||||||
if (aurEff.GetCasterGUID() == GetGUID() && aurEff.IsAffectingSpell(spellProto))
|
if (aurEff.GetCasterGUID() == GetGUID() && aurEff.IsAffectingSpell(spellProto))
|
||||||
crit_chance += aurEff.GetAmount();
|
crit_chance += aurEff.GetAmount();
|
||||||
|
|
||||||
return crit_chance > 0.0f ? crit_chance : 0.0f;
|
return Math.Max(crit_chance, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate spell hit result can be:
|
// Calculate spell hit result can be:
|
||||||
@@ -1813,7 +1820,7 @@ namespace Game.Entities
|
|||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
|
|
||||||
// use provided list of auras which can proc
|
// use provided list of auras which can proc
|
||||||
if (!procAuras.Empty())
|
if (procAuras != null)
|
||||||
{
|
{
|
||||||
foreach (AuraApplication aurApp in procAuras)
|
foreach (AuraApplication aurApp in procAuras)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3053,6 +3053,38 @@ namespace Game
|
|||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_trainers.Count} Trainers in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_trainers.Count} Trainers in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||||
}
|
}
|
||||||
|
public void LoadCreatureDefaultTrainers()
|
||||||
|
{
|
||||||
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
|
_creatureDefaultTrainers.Clear();
|
||||||
|
|
||||||
|
SQLResult result = DB.World.Query("SELECT CreatureId, TrainerId FROM creature_default_trainer");
|
||||||
|
if (!result.IsEmpty())
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uint creatureId = result.Read<uint>(0);
|
||||||
|
uint trainerId = result.Read<uint>(1);
|
||||||
|
|
||||||
|
if (GetCreatureTemplate(creatureId) == null)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_default_trainer` references non-existing creature template (CreatureId: {creatureId}), ignoring");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetTrainer(trainerId) == null)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_default_trainer` references non-existing trainer (TrainerId: {trainerId}) for CreatureId {creatureId}, ignoring");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
_creatureDefaultTrainers[creatureId] = trainerId;
|
||||||
|
} while (result.NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_creatureDefaultTrainers.Count} default trainers in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||||
|
}
|
||||||
public void LoadVendors()
|
public void LoadVendors()
|
||||||
{
|
{
|
||||||
var time = Time.GetMSTime();
|
var time = Time.GetMSTime();
|
||||||
@@ -3324,6 +3356,7 @@ namespace Game
|
|||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in {1} ms", count, Time.GetMSTimeDiffToNow(time));
|
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creatures in {1} ms", count, Time.GetMSTimeDiffToNow(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCreatureToGrid(ulong guid, CreatureData data)
|
public void AddCreatureToGrid(ulong guid, CreatureData data)
|
||||||
{
|
{
|
||||||
uint mask = data.spawnMask;
|
uint mask = data.spawnMask;
|
||||||
@@ -3419,7 +3452,10 @@ namespace Game
|
|||||||
{
|
{
|
||||||
return creatureTemplateAddonStorage.LookupByKey(entry);
|
return creatureTemplateAddonStorage.LookupByKey(entry);
|
||||||
}
|
}
|
||||||
|
public uint GetCreatureDefaultTrainer(uint creatureId)
|
||||||
|
{
|
||||||
|
return _creatureDefaultTrainers.LookupByKey(creatureId);
|
||||||
|
}
|
||||||
public Dictionary<uint, CreatureTemplate> GetCreatureTemplates()
|
public Dictionary<uint, CreatureTemplate> GetCreatureTemplates()
|
||||||
{
|
{
|
||||||
return creatureTemplateStorage;
|
return creatureTemplateStorage;
|
||||||
@@ -9138,6 +9174,7 @@ namespace Game
|
|||||||
Dictionary<uint, CreatureBaseStats> creatureBaseStatsStorage = new Dictionary<uint, CreatureBaseStats>();
|
Dictionary<uint, CreatureBaseStats> creatureBaseStatsStorage = new Dictionary<uint, CreatureBaseStats>();
|
||||||
Dictionary<uint, VendorItemData> cacheVendorItemStorage = new Dictionary<uint, VendorItemData>();
|
Dictionary<uint, VendorItemData> cacheVendorItemStorage = new Dictionary<uint, VendorItemData>();
|
||||||
Dictionary<uint, Trainer> _trainers = new Dictionary<uint, Trainer>();
|
Dictionary<uint, Trainer> _trainers = new Dictionary<uint, Trainer>();
|
||||||
|
Dictionary<uint, uint> _creatureDefaultTrainers = new Dictionary<uint, uint>();
|
||||||
List<uint>[] _difficultyEntries = new List<uint>[SharedConst.MaxCreatureDifficulties]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
|
List<uint>[] _difficultyEntries = new List<uint>[SharedConst.MaxCreatureDifficulties]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
|
||||||
List<uint>[] _hasDifficultyEntries = new List<uint>[SharedConst.MaxCreatureDifficulties]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
|
List<uint>[] _hasDifficultyEntries = new List<uint>[SharedConst.MaxCreatureDifficulties]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
|
||||||
Dictionary<uint, NpcText> _npcTextStorage = new Dictionary<uint, NpcText>();
|
Dictionary<uint, NpcText> _npcTextStorage = new Dictionary<uint, NpcText>();
|
||||||
|
|||||||
+54
-40
@@ -294,7 +294,7 @@ namespace Game.Guilds
|
|||||||
rankData.RankID = rankInfo.GetId();
|
rankData.RankID = rankInfo.GetId();
|
||||||
rankData.RankOrder = i;
|
rankData.RankOrder = i;
|
||||||
rankData.Flags = (uint)rankInfo.GetRights();
|
rankData.Flags = (uint)rankInfo.GetRights();
|
||||||
rankData.WithdrawGoldLimit = (uint)rankInfo.GetBankMoneyPerDay();
|
rankData.WithdrawGoldLimit = rankInfo.GetBankMoneyPerDay();
|
||||||
rankData.RankName = rankInfo.GetName();
|
rankData.RankName = rankInfo.GetName();
|
||||||
|
|
||||||
for (byte j = 0; j < GuildConst.MaxBankTabs; ++j)
|
for (byte j = 0; j < GuildConst.MaxBankTabs; ++j)
|
||||||
@@ -800,6 +800,11 @@ namespace Game.Guilds
|
|||||||
|
|
||||||
public void HandleMemberDepositMoney(WorldSession session, ulong amount, bool cashFlow = false)
|
public void HandleMemberDepositMoney(WorldSession session, ulong amount, bool cashFlow = false)
|
||||||
{
|
{
|
||||||
|
// guild bank cannot have more than MAX_MONEY_AMOUNT
|
||||||
|
amount = Math.Min(amount, PlayerConst.MaxMoneyAmount - m_bankMoney);
|
||||||
|
if (amount == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Player player = session.GetPlayer();
|
Player player = session.GetPlayer();
|
||||||
|
|
||||||
// Call script after validation and before money transfer.
|
// Call script after validation and before money transfer.
|
||||||
@@ -839,7 +844,10 @@ namespace Game.Guilds
|
|||||||
if (member == null)
|
if (member == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((ulong)_GetMemberRemainingMoney(member) < amount) // Check if we have enough slot/money today
|
if (!_HasRankRight(player, repair ? GuildRankRights.WithdrawRepair : GuildRankRights.WithdrawGold))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (_GetMemberRemainingMoney(member) < (long)amount) // Check if we have enough slot/money today
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Call script after validation and before money transfer.
|
// Call script after validation and before money transfer.
|
||||||
@@ -856,7 +864,7 @@ namespace Game.Guilds
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update remaining money amount
|
// Update remaining money amount
|
||||||
member.UpdateBankWithdrawValue(trans, GuildConst.MaxBankTabs, (uint)amount);
|
member.UpdateBankMoneyWithdrawValue(trans, amount);
|
||||||
// Remove money from bank
|
// Remove money from bank
|
||||||
_ModifyBankMoney(trans, amount, false);
|
_ModifyBankMoney(trans, amount, false);
|
||||||
|
|
||||||
@@ -1006,7 +1014,7 @@ namespace Game.Guilds
|
|||||||
|
|
||||||
GuildPermissionsQueryResults queryResult = new GuildPermissionsQueryResults();
|
GuildPermissionsQueryResults queryResult = new GuildPermissionsQueryResults();
|
||||||
queryResult.RankID = rankId;
|
queryResult.RankID = rankId;
|
||||||
queryResult.WithdrawGoldLimit = _GetMemberRemainingMoney(member);
|
queryResult.WithdrawGoldLimit = (int)_GetMemberRemainingMoney(member);
|
||||||
queryResult.Flags = (int)_GetRankRights(rankId);
|
queryResult.Flags = (int)_GetRankRights(rankId);
|
||||||
queryResult.NumTabs = _GetPurchasedTabsSize();
|
queryResult.NumTabs = _GetPurchasedTabsSize();
|
||||||
|
|
||||||
@@ -1027,7 +1035,7 @@ namespace Game.Guilds
|
|||||||
if (member == null)
|
if (member == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int amount = _GetMemberRemainingMoney(member);
|
long amount = _GetMemberRemainingMoney(member);
|
||||||
|
|
||||||
GuildBankRemainingWithdrawMoney packet = new GuildBankRemainingWithdrawMoney();
|
GuildBankRemainingWithdrawMoney packet = new GuildBankRemainingWithdrawMoney();
|
||||||
packet.RemainingWithdrawMoney = amount;
|
packet.RemainingWithdrawMoney = amount;
|
||||||
@@ -1829,7 +1837,7 @@ namespace Game.Guilds
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _GetRankBankMoneyPerDay(byte rankId)
|
uint _GetRankBankMoneyPerDay(byte rankId)
|
||||||
{
|
{
|
||||||
RankInfo rankInfo = GetRankInfo(rankId);
|
RankInfo rankInfo = GetRankInfo(rankId);
|
||||||
if (rankInfo != null)
|
if (rankInfo != null)
|
||||||
@@ -1862,10 +1870,10 @@ namespace Game.Guilds
|
|||||||
{
|
{
|
||||||
byte rankId = member.GetRankId();
|
byte rankId = member.GetRankId();
|
||||||
if (rankId == GuildDefaultRanks.Master)
|
if (rankId == GuildDefaultRanks.Master)
|
||||||
return GuildConst.WithdrawSlotUnlimited;
|
return Convert.ToInt32(GuildConst.WithdrawSlotUnlimited);
|
||||||
if ((_GetRankBankTabRights(rankId, tabId) & GuildBankRights.ViewTab) != 0)
|
if ((_GetRankBankTabRights(rankId, tabId) & GuildBankRights.ViewTab) != 0)
|
||||||
{
|
{
|
||||||
int remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member.GetBankWithdrawValue(tabId);
|
int remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - (int)member.GetBankTabWithdrawValue(tabId);
|
||||||
if (remaining > 0)
|
if (remaining > 0)
|
||||||
return remaining;
|
return remaining;
|
||||||
}
|
}
|
||||||
@@ -1873,17 +1881,17 @@ namespace Game.Guilds
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _GetMemberRemainingMoney(Member member)
|
long _GetMemberRemainingMoney(Member member)
|
||||||
{
|
{
|
||||||
if (member != null)
|
if (member != null)
|
||||||
{
|
{
|
||||||
byte rankId = member.GetRankId();
|
byte rankId = member.GetRankId();
|
||||||
if (rankId == GuildDefaultRanks.Master)
|
if (rankId == GuildDefaultRanks.Master)
|
||||||
return GuildConst.WithdrawMoneyUnlimited;
|
return long.MaxValue;
|
||||||
|
|
||||||
if ((_GetRankRights(rankId) & (GuildRankRights.WithdrawRepair | GuildRankRights.WithdrawGold)) != 0)
|
if ((_GetRankRights(rankId) & (GuildRankRights.WithdrawRepair | GuildRankRights.WithdrawGold)) != 0)
|
||||||
{
|
{
|
||||||
int remaining = _GetRankBankMoneyPerDay(rankId) - member.GetBankWithdrawValue(GuildConst.MaxBankTabs);
|
long remaining = (long)((_GetRankBankMoneyPerDay(rankId) * MoneyConstants.Gold) - member.GetBankMoneyWithdrawValue());
|
||||||
if (remaining > 0)
|
if (remaining > 0)
|
||||||
return remaining;
|
return remaining;
|
||||||
}
|
}
|
||||||
@@ -1895,12 +1903,7 @@ namespace Game.Guilds
|
|||||||
{
|
{
|
||||||
Member member = GetMember(guid);
|
Member member = GetMember(guid);
|
||||||
if (member != null)
|
if (member != null)
|
||||||
{
|
member.UpdateBankTabWithdrawValue(trans, tabId, 1);
|
||||||
byte rankId = member.GetRankId();
|
|
||||||
if (rankId != GuildDefaultRanks.Master
|
|
||||||
&& member.GetBankWithdrawValue(tabId) < _GetRankBankTabSlotsPerDay(rankId, tabId))
|
|
||||||
member.UpdateBankWithdrawValue(trans, tabId, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _MemberHasTabRights(ObjectGuid guid, byte tabId, GuildBankRights rights)
|
bool _MemberHasTabRights(ObjectGuid guid, byte tabId, GuildBankRights rights)
|
||||||
@@ -2523,8 +2526,10 @@ namespace Game.Guilds
|
|||||||
m_publicNote = field.Read<string>(3);
|
m_publicNote = field.Read<string>(3);
|
||||||
m_officerNote = field.Read<string>(4);
|
m_officerNote = field.Read<string>(4);
|
||||||
|
|
||||||
for (byte i = 0; i <= GuildConst.MaxBankTabs; ++i)
|
for (byte i = 0; i < GuildConst.MaxBankTabs; ++i)
|
||||||
m_bankWithdraw[i] = field.Read<int>(5 + i);
|
m_bankWithdraw[i] = field.Read<uint>(5 + i);
|
||||||
|
|
||||||
|
m_bankWithdrawMoney = field.Read<ulong>(13);
|
||||||
|
|
||||||
SetStats(field.Read<string>(14),
|
SetStats(field.Read<string>(14),
|
||||||
field.Read<byte>(15), // characters.level
|
field.Read<byte>(15), // characters.level
|
||||||
@@ -2566,26 +2571,40 @@ namespace Game.Guilds
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateBankWithdrawValue(SQLTransaction trans, byte tabId, uint amount)
|
// Decreases amount of slots left for today.
|
||||||
|
public void UpdateBankTabWithdrawValue(SQLTransaction trans, byte tabId, uint amount)
|
||||||
{
|
{
|
||||||
m_bankWithdraw[tabId] += (int)amount;
|
m_bankWithdraw[tabId] += amount;
|
||||||
|
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_TABS);
|
||||||
stmt.AddValue(0, m_guid.GetCounter());
|
stmt.AddValue(0, m_guid.GetCounter());
|
||||||
for (byte i = 0; i <= GuildConst.MaxBankTabs; )
|
for (byte i = 0; i < GuildConst.MaxBankTabs; )
|
||||||
{
|
{
|
||||||
int withdraw = m_bankWithdraw[i++];
|
uint withdraw = m_bankWithdraw[i++];
|
||||||
stmt.AddValue(i, withdraw);
|
stmt.AddValue(i, withdraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
DB.Characters.ExecuteOrAppend(trans, stmt);
|
DB.Characters.ExecuteOrAppend(trans, stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decreases amount of money left for today.
|
||||||
|
public void UpdateBankMoneyWithdrawValue(SQLTransaction trans, ulong amount)
|
||||||
|
{
|
||||||
|
m_bankWithdrawMoney += amount;
|
||||||
|
|
||||||
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_MONEY);
|
||||||
|
stmt.AddValue(0, m_guid.GetCounter());
|
||||||
|
stmt.AddValue(1, m_bankWithdrawMoney);
|
||||||
|
DB.Characters.ExecuteOrAppend(trans, stmt);
|
||||||
|
}
|
||||||
|
|
||||||
public void ResetValues(bool weekly = false)
|
public void ResetValues(bool weekly = false)
|
||||||
{
|
{
|
||||||
for (byte tabId = 0; tabId <= GuildConst.MaxBankTabs; ++tabId)
|
for (byte tabId = 0; tabId < GuildConst.MaxBankTabs; ++tabId)
|
||||||
m_bankWithdraw[tabId] = 0;
|
m_bankWithdraw[tabId] = 0;
|
||||||
|
|
||||||
|
m_bankWithdrawMoney = 0;
|
||||||
|
|
||||||
if (weekly)
|
if (weekly)
|
||||||
{
|
{
|
||||||
m_weekActivity = 0;
|
m_weekActivity = 0;
|
||||||
@@ -2593,15 +2612,6 @@ namespace Game.Guilds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetBankWithdrawValue(byte tabId)
|
|
||||||
{
|
|
||||||
// Guild master has unlimited amount.
|
|
||||||
if (IsRank(GuildDefaultRanks.Master))
|
|
||||||
return tabId == GuildConst.MaxBankTabs ? GuildConst.WithdrawMoneyUnlimited : GuildConst.WithdrawSlotUnlimited;
|
|
||||||
|
|
||||||
return m_bankWithdraw[tabId];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetZoneId(uint id) { m_zoneId = id; }
|
public void SetZoneId(uint id) { m_zoneId = id; }
|
||||||
|
|
||||||
public void SetAchievementPoints(uint val) { m_achievementPoints = val; }
|
public void SetAchievementPoints(uint val) { m_achievementPoints = val; }
|
||||||
@@ -2642,6 +2652,9 @@ namespace Game.Guilds
|
|||||||
public bool IsRankNotLower(uint rankId) { return m_rankId <= rankId; }
|
public bool IsRankNotLower(uint rankId) { return m_rankId <= rankId; }
|
||||||
public bool IsSamePlayer(ObjectGuid guid) { return m_guid == guid; }
|
public bool IsSamePlayer(ObjectGuid guid) { return m_guid == guid; }
|
||||||
|
|
||||||
|
public uint GetBankTabWithdrawValue(byte tabId) { return m_bankWithdraw[tabId]; }
|
||||||
|
public ulong GetBankMoneyWithdrawValue() { return m_bankWithdrawMoney; }
|
||||||
|
|
||||||
public Player FindPlayer() { return Global.ObjAccessor.FindPlayer(m_guid); }
|
public Player FindPlayer() { return Global.ObjAccessor.FindPlayer(m_guid); }
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
@@ -2661,7 +2674,8 @@ namespace Game.Guilds
|
|||||||
|
|
||||||
List<uint> m_trackedCriteriaIds = new List<uint>();
|
List<uint> m_trackedCriteriaIds = new List<uint>();
|
||||||
|
|
||||||
int[] m_bankWithdraw = new int[GuildConst.MaxBankTabs + 1];
|
uint[] m_bankWithdraw = new uint[GuildConst.MaxBankTabs];
|
||||||
|
ulong m_bankWithdrawMoney;
|
||||||
uint m_achievementPoints;
|
uint m_achievementPoints;
|
||||||
ulong m_totalActivity;
|
ulong m_totalActivity;
|
||||||
ulong m_weekActivity;
|
ulong m_weekActivity;
|
||||||
@@ -3088,9 +3102,6 @@ namespace Game.Guilds
|
|||||||
|
|
||||||
public void SetBankMoneyPerDay(uint money)
|
public void SetBankMoneyPerDay(uint money)
|
||||||
{
|
{
|
||||||
if (m_rankId == GuildDefaultRanks.Master) // Prevent loss of leader rights
|
|
||||||
money = Convert.ToUInt32(GuildConst.WithdrawMoneyUnlimited);
|
|
||||||
|
|
||||||
if (m_bankMoneyPerDay == money)
|
if (m_bankMoneyPerDay == money)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3129,7 +3140,10 @@ namespace Game.Guilds
|
|||||||
|
|
||||||
public GuildRankRights GetRights() { return m_rights; }
|
public GuildRankRights GetRights() { return m_rights; }
|
||||||
|
|
||||||
public int GetBankMoneyPerDay() { return (int)m_bankMoneyPerDay; }
|
public uint GetBankMoneyPerDay()
|
||||||
|
{
|
||||||
|
return m_rankId != GuildDefaultRanks.Master ? m_bankMoneyPerDay : GuildConst.WithdrawMoneyUnlimited;
|
||||||
|
}
|
||||||
|
|
||||||
public GuildBankRights GetBankTabRights(byte tabId)
|
public GuildBankRights GetBankTabRights(byte tabId)
|
||||||
{
|
{
|
||||||
@@ -3323,7 +3337,7 @@ namespace Game.Guilds
|
|||||||
public void SetGuildMasterValues()
|
public void SetGuildMasterValues()
|
||||||
{
|
{
|
||||||
rights = GuildBankRights.Full;
|
rights = GuildBankRights.Full;
|
||||||
slots = GuildConst.WithdrawSlotUnlimited;
|
slots = Convert.ToInt32(GuildConst.WithdrawSlotUnlimited);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTabId(byte _tabId) { tabId = _tabId; }
|
public void SetTabId(byte _tabId) { tabId = _tabId; }
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ namespace Game
|
|||||||
uint auctionTime = (uint)(packet.RunTime * WorldConfig.GetFloatValue(WorldCfg.RateAuctionTime));
|
uint auctionTime = (uint)(packet.RunTime * WorldConfig.GetFloatValue(WorldCfg.RateAuctionTime));
|
||||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||||
|
|
||||||
uint deposit = Global.AuctionMgr.GetAuctionDeposit(auctionHouseEntry, packet.RunTime, item, finalCount);
|
ulong deposit = Global.AuctionMgr.GetAuctionDeposit(auctionHouseEntry, packet.RunTime, item, finalCount);
|
||||||
if (!GetPlayer().HasEnoughMoney(deposit))
|
if (!GetPlayer().HasEnoughMoney(deposit))
|
||||||
{
|
{
|
||||||
SendAuctionCommandResult(null, AuctionAction.SellItem, AuctionError.NotEnoughtMoney);
|
SendAuctionCommandResult(null, AuctionAction.SellItem, AuctionError.NotEnoughtMoney);
|
||||||
@@ -345,7 +345,7 @@ namespace Game
|
|||||||
GetPlayer().UpdateCriteria(CriteriaTypes.CreateAuction, 1);
|
GetPlayer().UpdateCriteria(CriteriaTypes.CreateAuction, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPlayer().ModifyMoney(-deposit);
|
GetPlayer().ModifyMoney(-(long)deposit);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WorldPacketHandler(ClientOpcodes.AuctionPlaceBid)]
|
[WorldPacketHandler(ClientOpcodes.AuctionPlaceBid)]
|
||||||
@@ -445,10 +445,10 @@ namespace Game
|
|||||||
{
|
{
|
||||||
//buyout:
|
//buyout:
|
||||||
if (player.GetGUID().GetCounter() == auction.bidder)
|
if (player.GetGUID().GetCounter() == auction.bidder)
|
||||||
player.ModifyMoney(-auction.buyout - auction.bid);
|
player.ModifyMoney(-(long)(auction.buyout - auction.bid));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.ModifyMoney(-auction.buyout);
|
player.ModifyMoney(-(long)auction.buyout);
|
||||||
if (auction.bidder != 0) //buyout for bidded auction ..
|
if (auction.bidder != 0) //buyout for bidded auction ..
|
||||||
Global.AuctionMgr.SendAuctionOutbiddedMail(auction, auction.buyout, GetPlayer(), trans);
|
Global.AuctionMgr.SendAuctionOutbiddedMail(auction, auction.buyout, GetPlayer(), trans);
|
||||||
}
|
}
|
||||||
@@ -500,11 +500,11 @@ namespace Game
|
|||||||
{
|
{
|
||||||
if (auction.bidder > 0) // If we have a bidder, we have to send him the money he paid
|
if (auction.bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||||
{
|
{
|
||||||
uint auctionCut = auction.GetAuctionCut();
|
ulong auctionCut = auction.GetAuctionCut();
|
||||||
if (!player.HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
if (!player.HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||||
return;
|
return;
|
||||||
Global.AuctionMgr.SendAuctionCancelledToBidderMail(auction, trans);
|
Global.AuctionMgr.SendAuctionCancelledToBidderMail(auction, trans);
|
||||||
player.ModifyMoney(-auctionCut);
|
player.ModifyMoney(-(long)auctionCut);
|
||||||
}
|
}
|
||||||
|
|
||||||
// item will deleted or added to received mail list
|
// item will deleted or added to received mail list
|
||||||
|
|||||||
@@ -2451,6 +2451,14 @@ namespace Game
|
|||||||
stmt.AddValue(0, lowGuid);
|
stmt.AddValue(0, lowGuid);
|
||||||
SetQuery(PlayerLoginQueryLoad.QuestStatusObjectives, stmt);
|
SetQuery(PlayerLoginQueryLoad.QuestStatusObjectives, stmt);
|
||||||
|
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA);
|
||||||
|
stmt.AddValue(0, lowGuid);
|
||||||
|
SetQuery(PlayerLoginQueryLoad.QuestStatusObjectivesCriteria, stmt);
|
||||||
|
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS);
|
||||||
|
stmt.AddValue(0, lowGuid);
|
||||||
|
SetQuery(PlayerLoginQueryLoad.QuestStatusObjectivesCriteriaProgress, stmt);
|
||||||
|
|
||||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY);
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY);
|
||||||
stmt.AddValue(0, lowGuid);
|
stmt.AddValue(0, lowGuid);
|
||||||
SetQuery(PlayerLoginQueryLoad.DailyQuestStatus, stmt);
|
SetQuery(PlayerLoginQueryLoad.DailyQuestStatus, stmt);
|
||||||
@@ -2631,6 +2639,8 @@ namespace Game
|
|||||||
Spells,
|
Spells,
|
||||||
QuestStatus,
|
QuestStatus,
|
||||||
QuestStatusObjectives,
|
QuestStatusObjectives,
|
||||||
|
QuestStatusObjectivesCriteria,
|
||||||
|
QuestStatusObjectivesCriteriaProgress,
|
||||||
DailyQuestStatus,
|
DailyQuestStatus,
|
||||||
Reputation,
|
Reputation,
|
||||||
Inventory,
|
Inventory,
|
||||||
|
|||||||
@@ -437,6 +437,16 @@ namespace Game
|
|||||||
{
|
{
|
||||||
if (pProto.GetSellPrice() > 0)
|
if (pProto.GetSellPrice() > 0)
|
||||||
{
|
{
|
||||||
|
ulong money = pProto.GetSellPrice() * packet.Amount;
|
||||||
|
|
||||||
|
if (!_player.ModifyMoney((long)money)) // ensure player doesn't exceed gold limit
|
||||||
|
{
|
||||||
|
_player.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_player.UpdateCriteria(CriteriaTypes.MoneyFromVendors, money);
|
||||||
|
|
||||||
if (packet.Amount < pItem.GetCount()) // need split items
|
if (packet.Amount < pItem.GetCount()) // need split items
|
||||||
{
|
{
|
||||||
Item pNewItem = pItem.CloneItem(packet.Amount, pl);
|
Item pNewItem = pItem.CloneItem(packet.Amount, pl);
|
||||||
@@ -464,10 +474,6 @@ namespace Game
|
|||||||
Item.RemoveItemFromUpdateQueueOf(pItem, pl);
|
Item.RemoveItemFromUpdateQueueOf(pItem, pl);
|
||||||
pl.AddItemToBuyBackSlot(pItem);
|
pl.AddItemToBuyBackSlot(pItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint money = pProto.GetSellPrice() * packet.Amount;
|
|
||||||
pl.ModifyMoney(money);
|
|
||||||
pl.UpdateCriteria(CriteriaTypes.MoneyFromVendors, money);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pl.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
pl.SendSellError(SellResult.CantSellItem, creature, packet.ItemGUID);
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ namespace Game
|
|||||||
|
|
||||||
item.DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
item.DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
||||||
item.SetOwnerGUID(receiverGuid);
|
item.SetOwnerGUID(receiverGuid);
|
||||||
|
item.SetState(ItemUpdateState.Changed);
|
||||||
item.SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
item.SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
||||||
|
|
||||||
draft.AddItem(item);
|
draft.AddItem(item);
|
||||||
@@ -494,7 +495,7 @@ namespace Game
|
|||||||
.SendMailTo(trans, new MailReceiver(receiver, m.sender), new MailSender( MailMessageType.Normal, m.receiver), MailCheckMask.CodPayment);
|
.SendMailTo(trans, new MailReceiver(receiver, m.sender), new MailSender( MailMessageType.Normal, m.receiver), MailCheckMask.CodPayment);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.ModifyMoney(-(int)m.COD);
|
player.ModifyMoney(-(long)m.COD);
|
||||||
}
|
}
|
||||||
m.COD = 0;
|
m.COD = 0;
|
||||||
m.state = MailState.Changed;
|
m.state = MailState.Changed;
|
||||||
|
|||||||
+15
-11
@@ -56,18 +56,22 @@ namespace Game
|
|||||||
[WorldPacketHandler(ClientOpcodes.TrainerList)]
|
[WorldPacketHandler(ClientOpcodes.TrainerList)]
|
||||||
void HandleTrainerList(Hello packet)
|
void HandleTrainerList(Hello packet)
|
||||||
{
|
{
|
||||||
Log.outInfo(LogFilter.Network, $"{GetPlayerInfo()} sent legacy gossipless trainer hello for unit {packet.Unit.ToString()}, no trainer list available");
|
Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer);
|
||||||
}
|
if (!npc)
|
||||||
|
|
||||||
public void SendTrainerList(ObjectGuid guid, uint trainerId)
|
|
||||||
{
|
|
||||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Trainer);
|
|
||||||
if (unit == null)
|
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Network, $"WORLD: SendTrainerList - {guid.ToString()} not found or you can not interact with him.");
|
Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - {packet.Unit.ToString()} not found or you can not interact with him.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint trainerId = Global.ObjectMgr.GetCreatureDefaultTrainer(npc.GetEntry());
|
||||||
|
if (trainerId != 0)
|
||||||
|
SendTrainerList(npc, trainerId);
|
||||||
|
else
|
||||||
|
Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - Creature id {npc.GetEntry()} has no trainer data.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendTrainerList(Creature npc, uint trainerId)
|
||||||
|
{
|
||||||
// remove fake death
|
// remove fake death
|
||||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||||
@@ -75,14 +79,14 @@ namespace Game
|
|||||||
Trainer trainer = Global.ObjectMgr.GetTrainer(trainerId);
|
Trainer trainer = Global.ObjectMgr.GetTrainer(trainerId);
|
||||||
if (trainer == null)
|
if (trainer == null)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Network, $"WORLD: SendTrainerList - trainer spells not found for trainer {guid.ToString()} id {trainerId}");
|
Log.outDebug(LogFilter.Network, $"WORLD: SendTrainerList - trainer spells not found for trainer {npc.GetGUID().ToString()} id {trainerId}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_player.PlayerTalkClass.GetInteractionData().Reset();
|
_player.PlayerTalkClass.GetInteractionData().Reset();
|
||||||
_player.PlayerTalkClass.GetInteractionData().SourceGuid = guid;
|
_player.PlayerTalkClass.GetInteractionData().SourceGuid = npc.GetGUID();
|
||||||
_player.PlayerTalkClass.GetInteractionData().TrainerId = trainerId;
|
_player.PlayerTalkClass.GetInteractionData().TrainerId = trainerId;
|
||||||
trainer.SendSpells(unit, _player, GetSessionDbLocaleIndex());
|
trainer.SendSpells(npc, _player, GetSessionDbLocaleIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
[WorldPacketHandler(ClientOpcodes.TrainerBuySpell)]
|
[WorldPacketHandler(ClientOpcodes.TrainerBuySpell)]
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var guid in bossInfo.minion)
|
foreach (var guid in bossInfo.minion.ToArray())
|
||||||
{
|
{
|
||||||
Creature minion = instance.GetCreature(guid);
|
Creature minion = instance.GetCreature(guid);
|
||||||
if (minion)
|
if (minion)
|
||||||
@@ -608,7 +608,7 @@ namespace Game.Maps
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetEntranceLocation(uint worldSafeLocationId)
|
public void SetEntranceLocation(uint worldSafeLocationId)
|
||||||
{
|
{
|
||||||
_entranceId = worldSafeLocationId;
|
_entranceId = worldSafeLocationId;
|
||||||
if (_temporaryEntranceId != 0)
|
if (_temporaryEntranceId != 0)
|
||||||
|
|||||||
@@ -2701,6 +2701,22 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateAreaDependentAuras()
|
||||||
|
{
|
||||||
|
var players = GetPlayers();
|
||||||
|
foreach (var player in players)
|
||||||
|
{
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
if (player.IsInWorld)
|
||||||
|
{
|
||||||
|
player.UpdateAreaDependentAuras(player.GetAreaId());
|
||||||
|
player.UpdateZoneDependentAuras(player.GetZoneId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public MapRecord GetEntry()
|
public MapRecord GetEntry()
|
||||||
{
|
{
|
||||||
return i_mapRecord;
|
return i_mapRecord;
|
||||||
@@ -4391,6 +4407,7 @@ namespace Game.Maps
|
|||||||
{
|
{
|
||||||
var data = result.Read<string>(0);
|
var data = result.Read<string>(0);
|
||||||
i_data.SetCompletedEncountersMask(result.Read<uint>(1));
|
i_data.SetCompletedEncountersMask(result.Read<uint>(1));
|
||||||
|
i_data.SetEntranceLocation(result.Read<uint>(2));
|
||||||
if (data != "")
|
if (data != "")
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Maps, "Loading instance data for `{0}` with id {1}",
|
Log.outDebug(LogFilter.Maps, "Loading instance data for `{0}` with id {1}",
|
||||||
|
|||||||
@@ -23,83 +23,6 @@ using Game.Scripting;
|
|||||||
|
|
||||||
namespace Game.PvP
|
namespace Game.PvP
|
||||||
{
|
{
|
||||||
struct HPConst
|
|
||||||
{
|
|
||||||
public static uint[] LangCapture_A = { DefenseMessages.BrokenHillTakenAlliance, DefenseMessages.OverlookTakenAlliance, DefenseMessages.StadiumTakenAlliance };
|
|
||||||
|
|
||||||
public static uint[] LangCapture_H = { DefenseMessages.BrokenHillTakenHorde, DefenseMessages.OverlookTakenHorde, DefenseMessages.StadiumTakenHorde };
|
|
||||||
|
|
||||||
public static uint[] Map_N = { 0x9b5, 0x9b2, 0x9a8 };
|
|
||||||
|
|
||||||
public static uint[] Map_A = { 0x9b3, 0x9b0, 0x9a7 };
|
|
||||||
|
|
||||||
public static uint[] Map_H = { 0x9b4, 0x9b1, 0x9a6 };
|
|
||||||
|
|
||||||
public static uint[] TowerArtKit_A = { 65, 62, 67 };
|
|
||||||
|
|
||||||
public static uint[] TowerArtKit_H = { 64, 61, 68 };
|
|
||||||
|
|
||||||
public static uint[] TowerArtKit_N = { 66, 63, 69 };
|
|
||||||
|
|
||||||
// HP, citadel, ramparts, blood furnace, shattered halls, mag's lair
|
|
||||||
public static uint[] BuffZones = { 3483, 3563, 3562, 3713, 3714, 3836 };
|
|
||||||
|
|
||||||
public static uint[] CreditMarker = { 19032, 19028, 19029 };
|
|
||||||
|
|
||||||
public static uint[] CapturePointEventEnter = { 11404, 11396, 11388 };
|
|
||||||
|
|
||||||
public static uint[] CapturePointEventLeave = { 11403, 11395, 11387 };
|
|
||||||
|
|
||||||
public static go_type[] CapturePoints =
|
|
||||||
{
|
|
||||||
new go_type(182175, 530, -471.462f, 3451.09f, 34.6432f, 0.174533f, 0.0f, 0.0f, 0.087156f, 0.996195f), // 0 - Broken Hill
|
|
||||||
new go_type(182174, 530, -184.889f, 3476.93f, 38.205f, -0.017453f, 0.0f, 0.0f, 0.008727f, -0.999962f), // 1 - Overlook
|
|
||||||
new go_type(182173, 530, -290.016f, 3702.42f, 56.6729f, 0.034907f, 0.0f, 0.0f, 0.017452f, 0.999848f) // 2 - Stadium
|
|
||||||
};
|
|
||||||
|
|
||||||
public static go_type[] TowerFlags =
|
|
||||||
{
|
|
||||||
new go_type(183514, 530, -467.078f, 3528.17f, 64.7121f, 3.14159f, 0.0f, 0.0f, 1.0f, 0.0f), // 0 broken hill
|
|
||||||
new go_type(182525, 530, -187.887f, 3459.38f, 60.0403f, -3.12414f, 0.0f, 0.0f, 0.999962f, -0.008727f), // 1 overlook
|
|
||||||
new go_type(183515, 530, -289.610f, 3696.83f, 75.9447f, 3.12414f, 0.0f, 0.0f, 0.999962f, 0.008727f) // 2 stadium
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DefenseMessages
|
|
||||||
{
|
|
||||||
public const uint OverlookTakenAlliance = 14841; // '|cffffff00The Overlook has been taken by the Alliance!|r'
|
|
||||||
public const uint OverlookTakenHorde = 14842; // '|cffffff00The Overlook has been taken by the Horde!|r'
|
|
||||||
public const uint StadiumTakenAlliance = 14843; // '|cffffff00The Stadium has been taken by the Alliance!|r'
|
|
||||||
public const uint StadiumTakenHorde = 14844; // '|cffffff00The Stadium has been taken by the Horde!|r'
|
|
||||||
public const uint BrokenHillTakenAlliance = 14845; // '|cffffff00Broken Hill has been taken by the Alliance!|r'
|
|
||||||
public const uint BrokenHillTakenHorde = 14846; // '|cffffff00Broken Hill has been taken by the Horde!|r'
|
|
||||||
}
|
|
||||||
|
|
||||||
struct OutdoorPvPHPSpells
|
|
||||||
{
|
|
||||||
public const uint AlliancePlayerKillReward = 32155;
|
|
||||||
public const uint HordePlayerKillReward = 32158;
|
|
||||||
public const uint AllianceBuff = 32071;
|
|
||||||
public const uint HordeBuff = 32049;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum OutdoorPvPHPTowerType
|
|
||||||
{
|
|
||||||
BrokenHill = 0,
|
|
||||||
Overlook = 1,
|
|
||||||
Stadium = 2,
|
|
||||||
Num = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
struct OutdoorPvPHPWorldStates
|
|
||||||
{
|
|
||||||
public const uint Display_A = 0x9ba;
|
|
||||||
public const uint Display_H = 0x9b9;
|
|
||||||
|
|
||||||
public const uint Count_H = 0x9ae;
|
|
||||||
public const uint Count_A = 0x9ac;
|
|
||||||
}
|
|
||||||
|
|
||||||
class HellfirePeninsulaPvP : OutdoorPvP
|
class HellfirePeninsulaPvP : OutdoorPvP
|
||||||
{
|
{
|
||||||
public HellfirePeninsulaPvP()
|
public HellfirePeninsulaPvP()
|
||||||
@@ -397,4 +320,81 @@ namespace Game.PvP
|
|||||||
return new HellfirePeninsulaPvP();
|
return new HellfirePeninsulaPvP();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct HPConst
|
||||||
|
{
|
||||||
|
public static uint[] LangCapture_A = { DefenseMessages.BrokenHillTakenAlliance, DefenseMessages.OverlookTakenAlliance, DefenseMessages.StadiumTakenAlliance };
|
||||||
|
|
||||||
|
public static uint[] LangCapture_H = { DefenseMessages.BrokenHillTakenHorde, DefenseMessages.OverlookTakenHorde, DefenseMessages.StadiumTakenHorde };
|
||||||
|
|
||||||
|
public static uint[] Map_N = { 0x9b5, 0x9b2, 0x9a8 };
|
||||||
|
|
||||||
|
public static uint[] Map_A = { 0x9b3, 0x9b0, 0x9a7 };
|
||||||
|
|
||||||
|
public static uint[] Map_H = { 0x9b4, 0x9b1, 0x9a6 };
|
||||||
|
|
||||||
|
public static uint[] TowerArtKit_A = { 65, 62, 67 };
|
||||||
|
|
||||||
|
public static uint[] TowerArtKit_H = { 64, 61, 68 };
|
||||||
|
|
||||||
|
public static uint[] TowerArtKit_N = { 66, 63, 69 };
|
||||||
|
|
||||||
|
// HP, citadel, ramparts, blood furnace, shattered halls, mag's lair
|
||||||
|
public static uint[] BuffZones = { 3483, 3563, 3562, 3713, 3714, 3836 };
|
||||||
|
|
||||||
|
public static uint[] CreditMarker = { 19032, 19028, 19029 };
|
||||||
|
|
||||||
|
public static uint[] CapturePointEventEnter = { 11404, 11396, 11388 };
|
||||||
|
|
||||||
|
public static uint[] CapturePointEventLeave = { 11403, 11395, 11387 };
|
||||||
|
|
||||||
|
public static go_type[] CapturePoints =
|
||||||
|
{
|
||||||
|
new go_type(182175, 530, -471.462f, 3451.09f, 34.6432f, 0.174533f, 0.0f, 0.0f, 0.087156f, 0.996195f), // 0 - Broken Hill
|
||||||
|
new go_type(182174, 530, -184.889f, 3476.93f, 38.205f, -0.017453f, 0.0f, 0.0f, 0.008727f, -0.999962f), // 1 - Overlook
|
||||||
|
new go_type(182173, 530, -290.016f, 3702.42f, 56.6729f, 0.034907f, 0.0f, 0.0f, 0.017452f, 0.999848f) // 2 - Stadium
|
||||||
|
};
|
||||||
|
|
||||||
|
public static go_type[] TowerFlags =
|
||||||
|
{
|
||||||
|
new go_type(183514, 530, -467.078f, 3528.17f, 64.7121f, 3.14159f, 0.0f, 0.0f, 1.0f, 0.0f), // 0 broken hill
|
||||||
|
new go_type(182525, 530, -187.887f, 3459.38f, 60.0403f, -3.12414f, 0.0f, 0.0f, 0.999962f, -0.008727f), // 1 overlook
|
||||||
|
new go_type(183515, 530, -289.610f, 3696.83f, 75.9447f, 3.12414f, 0.0f, 0.0f, 0.999962f, 0.008727f) // 2 stadium
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DefenseMessages
|
||||||
|
{
|
||||||
|
public const uint OverlookTakenAlliance = 14841; // '|cffffff00The Overlook has been taken by the Alliance!|r'
|
||||||
|
public const uint OverlookTakenHorde = 14842; // '|cffffff00The Overlook has been taken by the Horde!|r'
|
||||||
|
public const uint StadiumTakenAlliance = 14843; // '|cffffff00The Stadium has been taken by the Alliance!|r'
|
||||||
|
public const uint StadiumTakenHorde = 14844; // '|cffffff00The Stadium has been taken by the Horde!|r'
|
||||||
|
public const uint BrokenHillTakenAlliance = 14845; // '|cffffff00Broken Hill has been taken by the Alliance!|r'
|
||||||
|
public const uint BrokenHillTakenHorde = 14846; // '|cffffff00Broken Hill has been taken by the Horde!|r'
|
||||||
|
}
|
||||||
|
|
||||||
|
struct OutdoorPvPHPSpells
|
||||||
|
{
|
||||||
|
public const uint AlliancePlayerKillReward = 32155;
|
||||||
|
public const uint HordePlayerKillReward = 32158;
|
||||||
|
public const uint AllianceBuff = 32071;
|
||||||
|
public const uint HordeBuff = 32049;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OutdoorPvPHPTowerType
|
||||||
|
{
|
||||||
|
BrokenHill = 0,
|
||||||
|
Overlook = 1,
|
||||||
|
Stadium = 2,
|
||||||
|
Num = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
struct OutdoorPvPHPWorldStates
|
||||||
|
{
|
||||||
|
public const uint Display_A = 0x9ba;
|
||||||
|
public const uint Display_H = 0x9b9;
|
||||||
|
|
||||||
|
public const uint Count_H = 0x9ae;
|
||||||
|
public const uint Count_A = 0x9ac;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -397,13 +397,13 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool HasFlag(QuestFlags flag) { return (Flags & flag) != 0; }
|
public bool HasFlag(QuestFlags flag) { return (Flags & flag) != 0; }
|
||||||
|
|
||||||
public void SetFlag(QuestFlags flag) { Flags |= flag; }
|
public void SetFlag(QuestFlags flag) { Flags |= flag; }
|
||||||
|
|
||||||
public bool HasSpecialFlag(QuestSpecialFlags flag) { return (SpecialFlags & flag) != 0; }
|
public bool HasSpecialFlag(QuestSpecialFlags flag) { return (SpecialFlags & flag) != 0; }
|
||||||
|
|
||||||
public void SetSpecialFlag(QuestSpecialFlags flag) { SpecialFlags |= flag; }
|
public void SetSpecialFlag(QuestSpecialFlags flag) { SpecialFlags |= flag; }
|
||||||
|
|
||||||
|
public bool HasFlagEx(QuestFlagsEx flag) { return (FlagsEx & flag) != 0; }
|
||||||
|
|
||||||
// table data accessors:
|
// table data accessors:
|
||||||
public bool IsRepeatable() { return SpecialFlags.HasAnyFlag(QuestSpecialFlags.Repeatable); }
|
public bool IsRepeatable() { return SpecialFlags.HasAnyFlag(QuestSpecialFlags.Repeatable); }
|
||||||
public bool IsDaily() { return Flags.HasAnyFlag(QuestFlags.Daily); }
|
public bool IsDaily() { return Flags.HasAnyFlag(QuestFlags.Daily); }
|
||||||
|
|||||||
@@ -0,0 +1,327 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using Framework.Constants;
|
||||||
|
using Framework.Database;
|
||||||
|
using Game.Achievements;
|
||||||
|
using Game.Entities;
|
||||||
|
using Game.Network;
|
||||||
|
using Game.Network.Packets;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Game
|
||||||
|
{
|
||||||
|
class QuestObjectiveCriteriaManager : CriteriaHandler
|
||||||
|
{
|
||||||
|
public QuestObjectiveCriteriaManager(Player owner)
|
||||||
|
{
|
||||||
|
_owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckAllQuestObjectiveCriteria(Player referencePlayer)
|
||||||
|
{
|
||||||
|
// suppress sending packets
|
||||||
|
for (CriteriaTypes i = 0; i < CriteriaTypes.TotalTypes; ++i)
|
||||||
|
UpdateCriteria(i, 0, 0, 0, null, referencePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
foreach (var pair in _criteriaProgress)
|
||||||
|
SendCriteriaProgressRemoved(pair.Key);
|
||||||
|
|
||||||
|
_criteriaProgress.Clear();
|
||||||
|
|
||||||
|
DeleteFromDB(_owner.GetGUID());
|
||||||
|
|
||||||
|
// re-fill data
|
||||||
|
CheckAllQuestObjectiveCriteria(_owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteFromDB(ObjectGuid guid)
|
||||||
|
{
|
||||||
|
SQLTransaction trans = new SQLTransaction();
|
||||||
|
|
||||||
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA);
|
||||||
|
stmt.AddValue(0, guid.GetCounter());
|
||||||
|
trans.Append(stmt);
|
||||||
|
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS);
|
||||||
|
stmt.AddValue(0, guid.GetCounter());
|
||||||
|
trans.Append(stmt);
|
||||||
|
|
||||||
|
DB.Characters.CommitTransaction(trans);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadFromDB(SQLResult objectiveResult, SQLResult criteriaResult)
|
||||||
|
{
|
||||||
|
if (!objectiveResult.IsEmpty())
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uint objectiveId = objectiveResult.Read<uint>(0);
|
||||||
|
|
||||||
|
QuestObjective objective = Global.ObjectMgr.GetQuestObjective(objectiveId);
|
||||||
|
if (objective == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_completedObjectives.Add(objectiveId);
|
||||||
|
|
||||||
|
} while (objectiveResult.NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!criteriaResult.IsEmpty())
|
||||||
|
{
|
||||||
|
long now = Time.UnixTime;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uint criteriaId = criteriaResult.Read<uint>(0);
|
||||||
|
ulong counter = criteriaResult.Read<ulong>(1);
|
||||||
|
long date = criteriaResult.Read<uint>(2);
|
||||||
|
|
||||||
|
Criteria criteria = Global.CriteriaMgr.GetCriteria(criteriaId);
|
||||||
|
if (criteria == null)
|
||||||
|
{
|
||||||
|
// Removing non-existing criteria data for all characters
|
||||||
|
Log.outError(LogFilter.Player, "Non-existing quest objective criteria {criteriaId} data has been removed from the table `character_queststatus_objectives_criteria_progress`.");
|
||||||
|
|
||||||
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_QUEST_PROGRESS_CRITERIA);
|
||||||
|
stmt.AddValue(0, criteriaId);
|
||||||
|
DB.Characters.Execute(stmt);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (criteria.Entry.StartTimer != 0 && date + criteria.Entry.StartTimer < now)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CriteriaProgress progress = new CriteriaProgress();
|
||||||
|
progress.Counter = counter;
|
||||||
|
progress.Date = date;
|
||||||
|
progress.Changed = false;
|
||||||
|
|
||||||
|
_criteriaProgress[criteriaId] = progress;
|
||||||
|
} while (criteriaResult.NextRow());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveToDB(SQLTransaction trans)
|
||||||
|
{
|
||||||
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA);
|
||||||
|
stmt.AddValue(0, _owner.GetGUID().GetCounter());
|
||||||
|
trans.Append(stmt);
|
||||||
|
|
||||||
|
if (!_completedObjectives.Empty())
|
||||||
|
{
|
||||||
|
foreach (uint completedObjectiveId in _completedObjectives)
|
||||||
|
{
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA);
|
||||||
|
stmt.AddValue(0, _owner.GetGUID().GetCounter());
|
||||||
|
stmt.AddValue(1, completedObjectiveId);
|
||||||
|
trans.Append(stmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_criteriaProgress.Empty())
|
||||||
|
{
|
||||||
|
foreach (var pair in _criteriaProgress)
|
||||||
|
{
|
||||||
|
if (!pair.Value.Changed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS_BY_CRITERIA);
|
||||||
|
stmt.AddValue(0, _owner.GetGUID().GetCounter());
|
||||||
|
stmt.AddValue(1, pair.Key);
|
||||||
|
trans.Append(stmt);
|
||||||
|
|
||||||
|
if (pair.Value.Counter != 0)
|
||||||
|
{
|
||||||
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS);
|
||||||
|
stmt.AddValue(0, _owner.GetGUID().GetCounter());
|
||||||
|
stmt.AddValue(1, pair.Key);
|
||||||
|
stmt.AddValue(2, pair.Value.Counter);
|
||||||
|
stmt.AddValue(3, (uint)pair.Value.Date);
|
||||||
|
trans.Append(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
pair.Value.Changed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetCriteria(CriteriaTypes type, ulong miscValue1, ulong miscValue2, bool evenIfCriteriaComplete)
|
||||||
|
{
|
||||||
|
Log.outDebug(LogFilter.Player, "QuestObjectiveCriteriaMgr.ResetCriteria({type}, {miscValue1}, {miscValue2})");
|
||||||
|
|
||||||
|
// disable for gamemasters with GM-mode enabled
|
||||||
|
if (_owner.IsGameMaster())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var playerCriteriaList = GetCriteriaByType(type);
|
||||||
|
foreach (Criteria playerCriteria in playerCriteriaList)
|
||||||
|
{
|
||||||
|
if (playerCriteria.Entry.FailEvent != miscValue1 || (playerCriteria.Entry.FailAsset != 0 && playerCriteria.Entry.FailAsset != miscValue2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var trees = Global.CriteriaMgr.GetCriteriaTreesByCriteria(playerCriteria.ID);
|
||||||
|
bool allComplete = true;
|
||||||
|
foreach (CriteriaTree tree in trees)
|
||||||
|
{
|
||||||
|
// don't update already completed criteria if not forced
|
||||||
|
if (!(IsCompletedCriteriaTree(tree) && !evenIfCriteriaComplete))
|
||||||
|
{
|
||||||
|
allComplete = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allComplete)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RemoveCriteriaProgress(playerCriteria);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetCriteriaTree(uint criteriaTreeId)
|
||||||
|
{
|
||||||
|
CriteriaTree tree = Global.CriteriaMgr.GetCriteriaTree(criteriaTreeId);
|
||||||
|
if (tree == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CriteriaManager.WalkCriteriaTree(tree, criteriaTree =>
|
||||||
|
{
|
||||||
|
RemoveCriteriaProgress(criteriaTree.Criteria);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SendAllData(Player receiver)
|
||||||
|
{
|
||||||
|
foreach (var pair in _criteriaProgress)
|
||||||
|
{
|
||||||
|
CriteriaUpdate criteriaUpdate = new CriteriaUpdate();
|
||||||
|
|
||||||
|
criteriaUpdate.CriteriaID = pair.Key;
|
||||||
|
criteriaUpdate.Quantity = pair.Value.Counter;
|
||||||
|
criteriaUpdate.PlayerGUID = _owner.GetGUID();
|
||||||
|
criteriaUpdate.Flags = 0;
|
||||||
|
|
||||||
|
criteriaUpdate.CurrentTime = pair.Value.Date;
|
||||||
|
criteriaUpdate.CreationTime = 0;
|
||||||
|
|
||||||
|
SendPacket(criteriaUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompletedObjective(QuestObjective questObjective, Player referencePlayer)
|
||||||
|
{
|
||||||
|
// disable for gamemasters with GM-mode enabled
|
||||||
|
if (_owner.IsGameMaster())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (HasCompletedObjective(questObjective))
|
||||||
|
return;
|
||||||
|
|
||||||
|
referencePlayer.KillCreditCriteriaTreeObjective(questObjective);
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.Player, "QuestObjectiveCriteriaMgr.CompletedObjective({questObjective.ID}). {GetOwnerInfo()}");
|
||||||
|
|
||||||
|
_completedObjectives.Add(questObjective.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasCompletedObjective(QuestObjective questObjective)
|
||||||
|
{
|
||||||
|
return _completedObjectives.Contains(questObjective.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SendCriteriaUpdate(Criteria criteria, CriteriaProgress progress, uint timeElapsed, bool timedCompleted)
|
||||||
|
{
|
||||||
|
CriteriaUpdate criteriaUpdate = new CriteriaUpdate();
|
||||||
|
|
||||||
|
criteriaUpdate.CriteriaID = criteria.ID;
|
||||||
|
criteriaUpdate.Quantity = progress.Counter;
|
||||||
|
criteriaUpdate.PlayerGUID = _owner.GetGUID();
|
||||||
|
criteriaUpdate.Flags = 0;
|
||||||
|
if (criteria.Entry.StartTimer != 0)
|
||||||
|
criteriaUpdate.Flags = timedCompleted ? 1 : 0u; // 1 is for keeping the counter at 0 in client
|
||||||
|
|
||||||
|
criteriaUpdate.CurrentTime = progress.Date;
|
||||||
|
criteriaUpdate.ElapsedTime = timeElapsed;
|
||||||
|
criteriaUpdate.CreationTime = 0;
|
||||||
|
|
||||||
|
SendPacket(criteriaUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SendCriteriaProgressRemoved(uint criteriaId)
|
||||||
|
{
|
||||||
|
CriteriaDeleted criteriaDeleted = new CriteriaDeleted();
|
||||||
|
criteriaDeleted.CriteriaID = criteriaId;
|
||||||
|
SendPacket(criteriaDeleted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanUpdateCriteriaTree(Criteria criteria, CriteriaTree tree, Player referencePlayer)
|
||||||
|
{
|
||||||
|
QuestObjective objective = tree.QuestObjective;
|
||||||
|
if (objective == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (HasCompletedObjective(objective))
|
||||||
|
{
|
||||||
|
Log.outTrace(LogFilter.Player, "QuestObjectiveCriteriaMgr.CanUpdateCriteriaTree: (Id: {criteria.ID} Type {criteria.Entry.Type} Quest Objective {objective.ID}) Objective already completed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CanUpdateCriteriaTree(criteria, tree, referencePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanCompleteCriteriaTree(CriteriaTree tree)
|
||||||
|
{
|
||||||
|
QuestObjective objective = tree.QuestObjective;
|
||||||
|
if (objective == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.CanCompleteCriteriaTree(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CompletedCriteriaTree(CriteriaTree tree, Player referencePlayer)
|
||||||
|
{
|
||||||
|
QuestObjective objective = tree.QuestObjective;
|
||||||
|
if (objective == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CompletedObjective(objective, referencePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SendPacket(ServerPacket data)
|
||||||
|
{
|
||||||
|
_owner.SendPacket(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetOwnerInfo()
|
||||||
|
{
|
||||||
|
return $"{_owner.GetGUID().ToString()} {_owner.GetName()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<Criteria> GetCriteriaByType(CriteriaTypes type)
|
||||||
|
{
|
||||||
|
return Global.CriteriaMgr.GetQuestObjectiveCriteriaByType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Player _owner;
|
||||||
|
List<uint> _completedObjectives = new List<uint>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -288,8 +288,6 @@ namespace Game
|
|||||||
|
|
||||||
Values[WorldCfg.GroupXpDistance] = GetDefaultValue("MaxGroupXPDistance", 74.0f);
|
Values[WorldCfg.GroupXpDistance] = GetDefaultValue("MaxGroupXPDistance", 74.0f);
|
||||||
Values[WorldCfg.MaxRecruitAFriendDistance] = GetDefaultValue("MaxRecruitAFriendBonusDistance", 100.0f);
|
Values[WorldCfg.MaxRecruitAFriendDistance] = GetDefaultValue("MaxRecruitAFriendBonusDistance", 100.0f);
|
||||||
|
|
||||||
/// @todo Add MonsterSight (with meaning) in worldserver.conf or put them as define
|
|
||||||
Values[WorldCfg.SightMonster] = GetDefaultValue("MonsterSight", 50.0f);
|
Values[WorldCfg.SightMonster] = GetDefaultValue("MonsterSight", 50.0f);
|
||||||
|
|
||||||
if (reload)
|
if (reload)
|
||||||
|
|||||||
@@ -705,6 +705,9 @@ namespace Game
|
|||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Trainers...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Trainers...");
|
||||||
Global.ObjectMgr.LoadTrainers(); // must be after load CreatureTemplate
|
Global.ObjectMgr.LoadTrainers(); // must be after load CreatureTemplate
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, "Loading Creature default trainers...");
|
||||||
|
Global.ObjectMgr.LoadCreatureDefaultTrainers();
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Gossip menu...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Gossip menu...");
|
||||||
Global.ObjectMgr.LoadGossipMenu();
|
Global.ObjectMgr.LoadGossipMenu();
|
||||||
|
|
||||||
|
|||||||
@@ -5575,9 +5575,7 @@ namespace Game.Spells
|
|||||||
if (!strict && m_casttime == 0)
|
if (!strict && m_casttime == 0)
|
||||||
return SpellCastResult.SpellCastOk;
|
return SpellCastResult.SpellCastOk;
|
||||||
|
|
||||||
var pair = GetMinMaxRange(strict);
|
(float minRange, float maxRange) = GetMinMaxRange(strict);
|
||||||
float minRange = pair.Item1;
|
|
||||||
float maxRange = pair.Item2;
|
|
||||||
|
|
||||||
// get square values for sqr distance checks
|
// get square values for sqr distance checks
|
||||||
minRange *= minRange;
|
minRange *= minRange;
|
||||||
|
|||||||
@@ -5846,6 +5846,18 @@ namespace Game.Spells
|
|||||||
playerTarget.AddHonorXP((uint)damage);
|
playerTarget.AddHonorXP((uint)damage);
|
||||||
playerTarget.SendPacket(packet);
|
playerTarget.SendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SpellEffectHandler(SpellEffectName.LearnTransmogSet)]
|
||||||
|
void EffectLearnTransmogSet(uint effIndex)
|
||||||
|
{
|
||||||
|
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!unitTarget || !unitTarget.IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
unitTarget.ToPlayer().GetSession().GetCollectionMgr().AddTransmogSet((uint)effectInfo.MiscValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DispelCharges
|
public class DispelCharges
|
||||||
|
|||||||
@@ -3313,7 +3313,7 @@ namespace Game.Spells
|
|||||||
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 252 SPELL_EFFECT_252
|
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 252 SPELL_EFFECT_252
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 253 SPELL_EFFECT_GIVE_HONOR
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 253 SPELL_EFFECT_GIVE_HONOR
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 254 SPELL_EFFECT_254
|
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 254 SPELL_EFFECT_254
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None) // 255 SPELL_EFFECT_255
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit) // 255 SPELL_EFFECT_LEARN_TRANSMOG_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ namespace Game.Entities
|
|||||||
if (procEntry.SpellFamilyName != 0 && eventSpellInfo != null && (procEntry.SpellFamilyName != eventSpellInfo.SpellFamilyName))
|
if (procEntry.SpellFamilyName != 0 && eventSpellInfo != null && (procEntry.SpellFamilyName != eventSpellInfo.SpellFamilyName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (procEntry.SpellFamilyMask != null && eventSpellInfo != null && !(procEntry.SpellFamilyMask & eventSpellInfo.SpellFamilyFlags))
|
if (eventSpellInfo != null && !(procEntry.SpellFamilyMask & eventSpellInfo.SpellFamilyFlags))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3158,7 +3158,7 @@ namespace Game.Entities
|
|||||||
case AuraType.SpellMagnet:
|
case AuraType.SpellMagnet:
|
||||||
case AuraType.ModAttackPower:
|
case AuraType.ModAttackPower:
|
||||||
case AuraType.ModPowerRegenPercent:
|
case AuraType.ModPowerRegenPercent:
|
||||||
case AuraType.AddCasterHitTrigger:
|
case AuraType.InterceptMeleeRangedAttacks:
|
||||||
case AuraType.OverrideClassScripts:
|
case AuraType.OverrideClassScripts:
|
||||||
case AuraType.ModMechanicResistance:
|
case AuraType.ModMechanicResistance:
|
||||||
case AuraType.MeleeAttackPowerAttackerBonus:
|
case AuraType.MeleeAttackPowerAttackerBonus:
|
||||||
@@ -3385,7 +3385,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
public SpellSchoolMask SchoolMask { get; set; } // if nonzero - bitmask for matching proc condition based on spell's school
|
public SpellSchoolMask SchoolMask { get; set; } // if nonzero - bitmask for matching proc condition based on spell's school
|
||||||
public SpellFamilyNames SpellFamilyName { get; set; } // if nonzero - for matching proc condition based on candidate spell's SpellFamilyName
|
public SpellFamilyNames SpellFamilyName { get; set; } // if nonzero - for matching proc condition based on candidate spell's SpellFamilyName
|
||||||
public FlagArray128 SpellFamilyMask { get; set; } // if nonzero - bitmask for matching proc condition based on candidate spell's SpellFamilyFlags
|
public FlagArray128 SpellFamilyMask { get; set; } = new FlagArray128(); // if nonzero - bitmask for matching proc condition based on candidate spell's SpellFamilyFlags
|
||||||
public ProcFlags ProcFlags { get; set; } // if nonzero - owerwrite procFlags field for given Spell.dbc entry, bitmask for matching proc condition, see enum ProcFlags
|
public ProcFlags ProcFlags { get; set; } // if nonzero - owerwrite procFlags field for given Spell.dbc entry, bitmask for matching proc condition, see enum ProcFlags
|
||||||
public ProcFlagsSpellType SpellTypeMask { get; set; } // if nonzero - bitmask for matching proc condition based on candidate spell's damage/heal effects, see enum ProcFlagsSpellType
|
public ProcFlagsSpellType SpellTypeMask { get; set; } // if nonzero - bitmask for matching proc condition based on candidate spell's damage/heal effects, see enum ProcFlagsSpellType
|
||||||
public ProcFlagsSpellPhase SpellPhaseMask { get; set; } // if nonzero - bitmask for matching phase of a spellcast on which proc occurs, see enum ProcFlagsSpellPhase
|
public ProcFlagsSpellPhase SpellPhaseMask { get; set; } // if nonzero - bitmask for matching phase of a spellcast on which proc occurs, see enum ProcFlagsSpellPhase
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ namespace Scripts.Northrend.DraktharonKeep.Trollgore
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnCheck(Player player, Unit target)
|
public override bool OnCheck(Player source, Unit target)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace Scripts.World
|
|||||||
public const uint AuraPerfumeForever = 70235;
|
public const uint AuraPerfumeForever = 70235;
|
||||||
public const uint AuraPerfumeEnchantress = 70234;
|
public const uint AuraPerfumeEnchantress = 70234;
|
||||||
public const uint AuraPerfumeVictory = 70233;
|
public const uint AuraPerfumeVictory = 70233;
|
||||||
|
|
||||||
|
//BgSA Artillery
|
||||||
|
public const uint AntiPersonnalCannon = 27894;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Script]
|
[Script]
|
||||||
@@ -144,7 +147,7 @@ namespace Scripts.World
|
|||||||
Creature vehicle = source.GetVehicleCreatureBase();
|
Creature vehicle = source.GetVehicleCreatureBase();
|
||||||
if (vehicle)
|
if (vehicle)
|
||||||
{
|
{
|
||||||
if (vehicle.GetEntry() == SACreatureIds.AntiPersonnalCannon)
|
if (vehicle.GetEntry() == AchievementConst.AntiPersonnalCannon)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,40 @@ namespace Scripts.World
|
|||||||
|
|
||||||
//Toy Train Set
|
//Toy Train Set
|
||||||
public const uint SpellToyTrainPulse = 61551;
|
public const uint SpellToyTrainPulse = 61551;
|
||||||
|
|
||||||
|
//BrewfestMusic
|
||||||
|
public const uint EventBrewfestdwarf01 = 11810; // 1.35 Min
|
||||||
|
public const uint EventBrewfestdwarf02 = 11812; // 1.55 Min
|
||||||
|
public const uint EventBrewfestdwarf03 = 11813; // 0.23 Min
|
||||||
|
public const uint EventBrewfestgoblin01 = 11811; // 1.08 Min
|
||||||
|
public const uint EventBrewfestgoblin02 = 11814; // 1.33 Min
|
||||||
|
public const uint EventBrewfestgoblin03 = 11815; // 0.28 Min
|
||||||
|
|
||||||
|
// These Are In Seconds
|
||||||
|
//Brewfestmusictime
|
||||||
|
public const uint EventBrewfestdwarf01Time = 95000;
|
||||||
|
public const uint EventBrewfestdwarf02Time = 155000;
|
||||||
|
public const uint EventBrewfestdwarf03Time = 23000;
|
||||||
|
public const uint EventBrewfestgoblin01Time = 68000;
|
||||||
|
public const uint EventBrewfestgoblin02Time = 93000;
|
||||||
|
public const uint EventBrewfestgoblin03Time = 28000;
|
||||||
|
|
||||||
|
//Brewfestmusicareas
|
||||||
|
public const uint Silvermoon = 3430; // Horde
|
||||||
|
public const uint Undercity = 1497;
|
||||||
|
public const uint Orgrimmar1 = 1296;
|
||||||
|
public const uint Orgrimmar2 = 14;
|
||||||
|
public const uint Thunderbluff = 1638;
|
||||||
|
public const uint Ironforge1 = 809; // Alliance
|
||||||
|
public const uint Ironforge2 = 1;
|
||||||
|
public const uint Stormwind = 12;
|
||||||
|
public const uint Exodar = 3557;
|
||||||
|
public const uint Darnassus = 1657;
|
||||||
|
public const uint Shattrath = 3703; // General
|
||||||
|
|
||||||
|
//Brewfestmusicevents
|
||||||
|
public const uint EventBmSelectMusic = 1;
|
||||||
|
public const uint EventBmStartMusic = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Script]
|
[Script]
|
||||||
@@ -971,4 +1005,89 @@ namespace Scripts.World
|
|||||||
return new go_toy_train_setAI(go);
|
return new go_toy_train_setAI(go);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Script]
|
||||||
|
class go_brewfest_music : GameObjectScript
|
||||||
|
{
|
||||||
|
public go_brewfest_music() : base("go_brewfest_music") { }
|
||||||
|
|
||||||
|
class go_brewfest_musicAI : GameObjectAI
|
||||||
|
{
|
||||||
|
public go_brewfest_musicAI(GameObject go) : base(go)
|
||||||
|
{
|
||||||
|
_events.ScheduleEvent(GameobjectConst.EventBmSelectMusic, 1000);
|
||||||
|
_events.ScheduleEvent(GameobjectConst.EventBmStartMusic, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateAI(uint diff)
|
||||||
|
{
|
||||||
|
_events.Update(diff);
|
||||||
|
|
||||||
|
_events.ExecuteEvents(eventId =>
|
||||||
|
{
|
||||||
|
switch (eventId)
|
||||||
|
{
|
||||||
|
case GameobjectConst.EventBmSelectMusic:
|
||||||
|
if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active
|
||||||
|
break;
|
||||||
|
rnd = RandomHelper.URand(0, 2); // Select random music sample
|
||||||
|
_events.ScheduleEvent(GameobjectConst.EventBmSelectMusic, musicTime); // Select new song music after play time is over
|
||||||
|
break;
|
||||||
|
case GameobjectConst.EventBmStartMusic:
|
||||||
|
if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active
|
||||||
|
break;
|
||||||
|
// Check if gob is correct area, play music, set time of music
|
||||||
|
if (go.GetAreaId() == GameobjectConst.Silvermoon || go.GetAreaId() == GameobjectConst.Undercity || go.GetAreaId() == GameobjectConst.Orgrimmar1 || go.GetAreaId() == GameobjectConst.Orgrimmar2 || go.GetAreaId() == GameobjectConst.Thunderbluff || go.GetAreaId() == GameobjectConst.Shattrath)
|
||||||
|
{
|
||||||
|
if (rnd == 0)
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin01);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestgoblin01Time;
|
||||||
|
}
|
||||||
|
else if (rnd == 1)
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin02);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestgoblin02Time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin03);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestgoblin03Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (go.GetAreaId() == GameobjectConst.Ironforge1 || go.GetAreaId() == GameobjectConst.Ironforge2 || go.GetAreaId() == GameobjectConst.Stormwind || go.GetAreaId() == GameobjectConst.Exodar || go.GetAreaId() == GameobjectConst.Darnassus || go.GetAreaId() == GameobjectConst.Shattrath)
|
||||||
|
{
|
||||||
|
if (rnd == 0)
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf01);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestdwarf01Time;
|
||||||
|
}
|
||||||
|
else if (rnd == 1)
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf02);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestdwarf02Time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf03);
|
||||||
|
musicTime = GameobjectConst.EventBrewfestdwarf03Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_events.ScheduleEvent(GameobjectConst.EventBmStartMusic, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
uint rnd = 0;
|
||||||
|
uint musicTime = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override GameObjectAI GetAI(GameObject go)
|
||||||
|
{
|
||||||
|
return new go_brewfest_musicAI(go);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,109 +21,5 @@ using Game.Scripting;
|
|||||||
|
|
||||||
namespace Scripts.World
|
namespace Scripts.World
|
||||||
{
|
{
|
||||||
enum GossipOptionIds
|
|
||||||
{
|
|
||||||
Alchemy = 0,
|
|
||||||
Blacksmithing = 1,
|
|
||||||
Enchanting = 2,
|
|
||||||
Engineering = 3,
|
|
||||||
Herbalism = 4,
|
|
||||||
Inscription = 5,
|
|
||||||
Jewelcrafting = 6,
|
|
||||||
Leatherworking = 7,
|
|
||||||
Mining = 8,
|
|
||||||
Skinning = 9,
|
|
||||||
Tailoring = 10,
|
|
||||||
Multi = 11,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GossipMenuIds
|
|
||||||
{
|
|
||||||
Herbalism = 12188,
|
|
||||||
Mining = 12189,
|
|
||||||
Skinning = 12190,
|
|
||||||
Alchemy = 12191,
|
|
||||||
Blacksmithing = 12192,
|
|
||||||
Enchanting = 12193,
|
|
||||||
Engineering = 12195,
|
|
||||||
Inscription = 12196,
|
|
||||||
Jewelcrafting = 12197,
|
|
||||||
Leatherworking = 12198,
|
|
||||||
Tailoring = 12199,
|
|
||||||
}
|
|
||||||
|
|
||||||
[Script] //start menu multi profession trainer
|
|
||||||
class npc_multi_profession_trainer : ScriptedAI
|
|
||||||
{
|
|
||||||
public npc_multi_profession_trainer(Creature creature) : base(creature) { }
|
|
||||||
|
|
||||||
public override void sGossipSelect(Player player, uint menuId, uint gossipListId)
|
|
||||||
{
|
|
||||||
switch ((GossipOptionIds)gossipListId)
|
|
||||||
{
|
|
||||||
case GossipOptionIds.Alchemy:
|
|
||||||
case GossipOptionIds.Blacksmithing:
|
|
||||||
case GossipOptionIds.Enchanting:
|
|
||||||
case GossipOptionIds.Engineering:
|
|
||||||
case GossipOptionIds.Herbalism:
|
|
||||||
case GossipOptionIds.Inscription:
|
|
||||||
case GossipOptionIds.Jewelcrafting:
|
|
||||||
case GossipOptionIds.Leatherworking:
|
|
||||||
case GossipOptionIds.Mining:
|
|
||||||
case GossipOptionIds.Skinning:
|
|
||||||
case GossipOptionIds.Tailoring:
|
|
||||||
SendTrainerList(player, (GossipOptionIds)gossipListId);
|
|
||||||
break;
|
|
||||||
case GossipOptionIds.Multi:
|
|
||||||
{
|
|
||||||
switch ((GossipMenuIds)menuId)
|
|
||||||
{
|
|
||||||
case GossipMenuIds.Herbalism:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Herbalism);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Mining:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Mining);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Skinning:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Skinning);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Alchemy:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Alchemy);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Blacksmithing:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Blacksmithing);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Enchanting:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Enchanting);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Engineering:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Engineering);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Inscription:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Inscription);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Jewelcrafting:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Jewelcrafting);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Leatherworking:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Leatherworking);
|
|
||||||
break;
|
|
||||||
case GossipMenuIds.Tailoring:
|
|
||||||
SendTrainerList(player, GossipOptionIds.Tailoring);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendTrainerList(Player player, GossipOptionIds Index)
|
|
||||||
{
|
|
||||||
player.GetSession().SendTrainerList(me.GetGUID(), (uint)Index + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1635,6 +1635,14 @@ ListenRange.Yell = 300
|
|||||||
|
|
||||||
Creature.MovingStopTimeForPlayer = 180000
|
Creature.MovingStopTimeForPlayer = 180000
|
||||||
|
|
||||||
|
# MonsterSight
|
||||||
|
# Description: The maximum distance in yards that a "monster" creature can see
|
||||||
|
# regardless of level difference (through CreatureAI::IsVisible).
|
||||||
|
# Increases CONFIG_SIGHT_MONSTER to 50 yards. Used to be 20 yards.
|
||||||
|
# Default: 50.000000
|
||||||
|
|
||||||
|
MonsterSight = 50.000000
|
||||||
|
|
||||||
#
|
#
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user