chore(Core/EventMgr): Align code to Code standard & improve LoadFromDB function (#21151)
Co-authored-by: Jelle Meeus <sogladev@gmail.com> Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
This commit is contained in:
parent
2e91c83433
commit
ff4d1ef053
@ -267,6 +267,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_ALL_GAME_EVENT_CONDITION_SAVE, "DELETE FROM game_event_condition_save WHERE eventEntry = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_GAME_EVENT_CONDITION_SAVE, "DELETE FROM game_event_condition_save WHERE eventEntry = ? AND condition_id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_GAME_EVENT_CONDITION_SAVE, "INSERT INTO game_event_condition_save (eventEntry, condition_id, done) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_GAME_EVENT_CONDITION_SAVE_DATA, "SELECT eventEntry, condition_id, done FROM game_event_condition_save", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_GAME_EVENT_SAVE_DATA, "SELECT eventEntry, state, next_start FROM game_event_save", CONNECTION_SYNCH);
|
||||
|
||||
// Petitions
|
||||
PrepareStatement(CHAR_DEL_ALL_PETITION_SIGNATURES, "DELETE FROM petition_sign WHERE playerguid = ?", CONNECTION_ASYNC);
|
||||
|
||||
@ -218,6 +218,8 @@ enum CharacterDatabaseStatements : uint32
|
||||
CHAR_DEL_ALL_GAME_EVENT_CONDITION_SAVE,
|
||||
CHAR_DEL_GAME_EVENT_CONDITION_SAVE,
|
||||
CHAR_INS_GAME_EVENT_CONDITION_SAVE,
|
||||
CHAR_SEL_GAME_EVENT_CONDITION_SAVE_DATA,
|
||||
CHAR_SEL_GAME_EVENT_SAVE_DATA,
|
||||
|
||||
CHAR_INS_ARENA_TEAM,
|
||||
CHAR_INS_ARENA_TEAM_MEMBER,
|
||||
|
||||
@ -84,6 +84,21 @@ void WorldDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? AND (phaseMask & ?) <> 0 ORDER BY order_", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id1, id2, id3, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? AND (phaseMask & ?) <> 0 ORDER BY order_", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id1, id2, id3, map, spawnMask, phaseMask, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, wander_distance, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENTS, "SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event, announce FROM game_event", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_PREREQUISITE_DATA, "SELECT eventEntry, prerequisite_event FROM game_event_prerequisite", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_CREATURE_DATA, "SELECT guid, eventEntry FROM game_event_creature", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_GAMEOBJECT_DATA, "SELECT guid, eventEntry FROM game_event_gameobject", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_MODEL_EQUIPMENT_DATA, "SELECT creature.guid, creature.id1, creature.id2, creature.id3, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_DATA, "SELECT id, quest, eventEntry FROM game_event_creature_quest", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_GAMEOBJECT_QUEST_DATA, "SELECT id, quest, eventEntry FROM game_event_gameobject_quest", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_CONDITION_DATA, "SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_CONDITION_DATA, "SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_NPC_FLAGS, "SELECT guid, eventEntry, npcflag FROM game_event_npcflag", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_SEASONAL_RELATIONS, "SELECT questId, eventEntry FROM game_event_seasonal_questrelation", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_BATTLEGROUND_DATA, "SELECT eventEntry, bgflag FROM game_event_battleground_holiday", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_POOL_DATA, "SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_ARENA_SEASON, "SELECT eventEntry FROM game_event_arena_seasons WHERE season = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_HOLIDAY_DATES, "SELECT id, date_id, date_value, holiday_duration FROM holiday_dates", CONNECTION_SYNCH);
|
||||
PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(WORLD_SEL_GAME_EVENT_NPC_VENDOR, "SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC", CONNECTION_SYNCH);
|
||||
|
||||
@ -90,6 +90,21 @@ enum WorldDatabaseStatements : uint32
|
||||
WORLD_SEL_CREATURE_NEAREST,
|
||||
WORLD_SEL_GAMEOBJECT_TARGET,
|
||||
WORLD_INS_CREATURE,
|
||||
WORLD_SEL_GAME_EVENTS,
|
||||
WORLD_SEL_GAME_EVENT_PREREQUISITE_DATA,
|
||||
WORLD_SEL_GAME_EVENT_CREATURE_DATA,
|
||||
WORLD_SEL_GAME_EVENT_GAMEOBJECT_DATA,
|
||||
WORLD_SEL_GAME_EVENT_MODEL_EQUIPMENT_DATA,
|
||||
WORLD_SEL_GAME_EVENT_QUEST_DATA,
|
||||
WORLD_SEL_GAME_EVENT_GAMEOBJECT_QUEST_DATA,
|
||||
WORLD_SEL_GAME_EVENT_QUEST_CONDITION_DATA,
|
||||
WORLD_SEL_GAME_EVENT_CONDITION_DATA,
|
||||
WORLD_SEL_GAME_EVENT_NPC_FLAGS,
|
||||
WORLD_SEL_GAME_EVENT_QUEST_SEASONAL_RELATIONS,
|
||||
WORLD_SEL_GAME_EVENT_BATTLEGROUND_DATA,
|
||||
WORLD_SEL_GAME_EVENT_POOL_DATA,
|
||||
WORLD_SEL_GAME_EVENT_ARENA_SEASON,
|
||||
WORLD_SEL_GAME_EVENT_HOLIDAY_DATES,
|
||||
WORLD_DEL_GAME_EVENT_CREATURE,
|
||||
WORLD_DEL_GAME_EVENT_MODEL_EQUIP,
|
||||
WORLD_SEL_GAME_EVENT_NPC_VENDOR,
|
||||
|
||||
@ -6066,7 +6066,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3
|
||||
GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
|
||||
for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
|
||||
{
|
||||
if (uint32(events[*itr].holiday_id) == proto->HolidayId)
|
||||
if (uint32(events[*itr].HolidayId) == proto->HolidayId)
|
||||
{
|
||||
remove = false;
|
||||
break;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -38,17 +38,17 @@ enum GameEventState
|
||||
|
||||
struct GameEventFinishCondition
|
||||
{
|
||||
float reqNum; // required number // use float, since some events use percent
|
||||
float done; // done number
|
||||
uint32 max_world_state; // max resource count world state update id
|
||||
uint32 done_world_state; // done resource count world state update id
|
||||
float ReqNum; // required number // use float, since some events use percent
|
||||
float Done; // done number
|
||||
uint32 MaxWorldState; // max resource count world state update id
|
||||
uint32 DoneWorldState; // done resource count world state update id
|
||||
};
|
||||
|
||||
struct GameEventQuestToEventConditionNum
|
||||
{
|
||||
uint16 event_id;
|
||||
uint32 condition;
|
||||
float num;
|
||||
uint16 EventId;
|
||||
uint32 Condition;
|
||||
float Num;
|
||||
};
|
||||
|
||||
typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventConditionMap;
|
||||
@ -56,37 +56,37 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon
|
||||
struct GameEventData
|
||||
{
|
||||
GameEventData() = default;
|
||||
uint32 eventId;
|
||||
time_t start{1}; // occurs after this time
|
||||
time_t end{0}; // occurs before this time
|
||||
time_t nextstart{0}; // after this time the follow-up events count this phase completed
|
||||
uint32 occurence{0}; // time between end and start
|
||||
uint32 length{0}; // length of the event (minutes) after finishing all conditions
|
||||
HolidayIds holiday_id{HOLIDAY_NONE};
|
||||
uint8 holidayStage;
|
||||
GameEventState state{GAMEEVENT_NORMAL}; // state of the game event, these are saved into the game_event table on change!
|
||||
GameEventConditionMap conditions; // conditions to finish
|
||||
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
|
||||
std::string description;
|
||||
uint8 announce; // if 0 dont announce, if 1 announce, if 2 take config value
|
||||
uint32 EventId;
|
||||
time_t Start{1}; // occurs after this time
|
||||
time_t End{0}; // occurs before this time
|
||||
time_t NextStart{0}; // after this time the follow-up events count this phase completed
|
||||
uint32 Occurence{0}; // time between end and start
|
||||
uint32 Length{0}; // length of the event (minutes) after finishing all conditions
|
||||
HolidayIds HolidayId{HOLIDAY_NONE};
|
||||
uint8 HolidayStage;
|
||||
GameEventState State{GAMEEVENT_NORMAL}; // state of the game event, these are saved into the game_event table on change!
|
||||
GameEventConditionMap Conditions; // conditions to finish
|
||||
std::set<uint16 /*gameevent id*/> PrerequisiteEvents; // events that must be completed before starting this event
|
||||
std::string Description;
|
||||
uint8 Announce; // if 0 dont announce, if 1 announce, if 2 take config value
|
||||
|
||||
[[nodiscard]] bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
|
||||
[[nodiscard]] bool isValid() const { return Length > 0 || State > GAMEEVENT_NORMAL; }
|
||||
};
|
||||
|
||||
struct ModelEquip
|
||||
{
|
||||
uint32 modelid;
|
||||
uint32 modelid_prev;
|
||||
uint8 equipment_id;
|
||||
uint8 equipement_id_prev;
|
||||
uint32 ModelId;
|
||||
uint32 ModelIdPrev;
|
||||
uint8 EquipmentId;
|
||||
uint8 EquipementIdPrev;
|
||||
};
|
||||
|
||||
struct NPCVendorEntry
|
||||
{
|
||||
uint32 entry; // creature entry
|
||||
uint32 item; // item id
|
||||
int32 maxcount; // 0 for infinite
|
||||
uint32 incrtime; // time for restore items amount if maxcount != 0
|
||||
uint32 Entry; // creature entry
|
||||
uint32 Item; // item id
|
||||
int32 MaxCount; // 0 for infinite
|
||||
uint32 Incrtime; // time for restore items amount if maxcount != 0
|
||||
uint32 ExtendedCost;
|
||||
};
|
||||
|
||||
@ -105,46 +105,62 @@ public:
|
||||
|
||||
typedef std::set<uint16> ActiveEvents;
|
||||
typedef std::vector<GameEventData> GameEventDataMap;
|
||||
[[nodiscard]] ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
|
||||
[[nodiscard]] GameEventDataMap const& GetEventMap() const { return mGameEvent; }
|
||||
[[nodiscard]] ActiveEvents const& GetActiveEventList() const { return _activeEvents; }
|
||||
[[nodiscard]] GameEventDataMap const& GetEventMap() const { return _gameEvent; }
|
||||
[[nodiscard]] bool CheckOneGameEvent(uint16 entry) const;
|
||||
[[nodiscard]] uint32 NextCheck(uint16 entry) const;
|
||||
void LoadFromDB();
|
||||
void LoadHolidayDates();
|
||||
uint32 Update();
|
||||
bool IsActiveEvent(uint16 event_id) { return (m_ActiveEvents.find(event_id) != m_ActiveEvents.end()); }
|
||||
bool IsActiveEvent(uint16 eventId) { return (_activeEvents.find(eventId) != _activeEvents.end()); }
|
||||
uint32 StartSystem();
|
||||
void Initialize();
|
||||
void StartArenaSeason();
|
||||
void StartInternalEvent(uint16 event_id);
|
||||
bool StartEvent(uint16 event_id, bool overwrite = false);
|
||||
void StopEvent(uint16 event_id, bool overwrite = false);
|
||||
void HandleQuestComplete(uint32 quest_id); // called on world event type quest completions
|
||||
void StartInternalEvent(uint16 eventId);
|
||||
bool StartEvent(uint16 eventId, bool overwrite = false);
|
||||
void StopEvent(uint16 eventId, bool overwrite = false);
|
||||
void HandleQuestComplete(uint32 questId); // called on world event type quest completions
|
||||
uint32 GetNPCFlag(Creature* cr);
|
||||
// Load the game event npc vendor table from the DB
|
||||
void LoadEventVendors();
|
||||
[[nodiscard]] uint32 GetHolidayEventId(uint32 holidayId) const;
|
||||
private:
|
||||
void SendWorldStateUpdate(Player* player, uint16 event_id);
|
||||
void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); }
|
||||
void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); }
|
||||
void ApplyNewEvent(uint16 event_id);
|
||||
void UnApplyEvent(uint16 event_id);
|
||||
void GameEventSpawn(int16 event_id);
|
||||
void GameEventUnspawn(int16 event_id);
|
||||
void ChangeEquipOrModel(int16 event_id, bool activate);
|
||||
void UpdateEventQuests(uint16 event_id, bool activate);
|
||||
void UpdateWorldStates(uint16 event_id, bool Activate);
|
||||
void UpdateEventNPCFlags(uint16 event_id);
|
||||
void UpdateEventNPCVendor(uint16 event_id, bool activate);
|
||||
void LoadEvents();
|
||||
void LoadEventSaveData();
|
||||
void LoadEventPrerequisiteData();
|
||||
void LoadEventCreatureData();
|
||||
void LoadEventGameObjectData();
|
||||
void LoadEventModelEquipmentChangeData();
|
||||
void LoadEventQuestData();
|
||||
void LoadEventGameObjectQuestData();
|
||||
void LoadEventQuestConditionData();
|
||||
void LoadEventConditionData();
|
||||
void LoadEventConditionSaveData();
|
||||
void LoadEventNPCFlags();
|
||||
void LoadEventSeasonalQuestRelations();
|
||||
void LoadEventBattlegroundData();
|
||||
void LoadEventPoolData();
|
||||
|
||||
void SendWorldStateUpdate(Player* player, uint16 eventId);
|
||||
void AddActiveEvent(uint16 eventId) { _activeEvents.insert(eventId); }
|
||||
void RemoveActiveEvent(uint16 eventId) { _activeEvents.erase(eventId); }
|
||||
void ApplyNewEvent(uint16 eventId);
|
||||
void UnApplyEvent(uint16 eventId);
|
||||
void GameEventSpawn(int16 eventId);
|
||||
void GameEventUnspawn(int16 eventId);
|
||||
void ChangeEquipOrModel(int16 eventId, bool activate);
|
||||
void UpdateEventQuests(uint16 eventId, bool activate);
|
||||
void UpdateWorldStates(uint16 eventId, bool Activate);
|
||||
void UpdateEventNPCFlags(uint16 eventId);
|
||||
void UpdateEventNPCVendor(uint16 eventId, bool activate);
|
||||
void UpdateBattlegroundSettings();
|
||||
void RunSmartAIScripts(uint16 event_id, bool activate); //! Runs SMART_EVENT_GAME_EVENT_START/_END SAI
|
||||
bool CheckOneGameEventConditions(uint16 event_id);
|
||||
void SaveWorldEventStateToDB(uint16 event_id);
|
||||
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
|
||||
bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
|
||||
bool hasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 event_id);
|
||||
bool hasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 event_id);
|
||||
void RunSmartAIScripts(uint16 eventId, bool activate); //! Runs SMART_EVENT_GAME_EVENT_START/_END SAI
|
||||
bool CheckOneGameEventConditions(uint16 eventId);
|
||||
void SaveWorldEventStateToDB(uint16 eventId);
|
||||
bool HasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 eventId);
|
||||
bool HasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 eventId);
|
||||
bool HasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 eventId);
|
||||
bool HasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 eventId);
|
||||
void SetHolidayEventTime(GameEventData& event);
|
||||
|
||||
typedef std::list<ObjectGuid::LowType> GuidLowList;
|
||||
@ -165,29 +181,27 @@ private:
|
||||
typedef std::vector<NPCFlagList> GameEventNPCFlagMap;
|
||||
typedef std::vector<uint32> GameEventBitmask;
|
||||
typedef std::unordered_map<uint32, std::vector<uint32>> GameEventSeasonalQuestsMap;
|
||||
GameEventQuestMap mGameEventCreatureQuests;
|
||||
GameEventQuestMap mGameEventGameObjectQuests;
|
||||
GameEventNPCVendorMap mGameEventVendors;
|
||||
GameEventModelEquipMap mGameEventModelEquip;
|
||||
//GameEventGuidMap mGameEventCreatureGuids;
|
||||
//GameEventGuidMap mGameEventGameobjectGuids;
|
||||
GameEventIdMap mGameEventPoolIds;
|
||||
GameEventDataMap mGameEvent;
|
||||
GameEventBitmask mGameEventBattlegroundHolidays;
|
||||
QuestIdToEventConditionMap mQuestToEventConditions;
|
||||
GameEventNPCFlagMap mGameEventNPCFlags;
|
||||
ActiveEvents m_ActiveEvents;
|
||||
bool isSystemInit;
|
||||
GameEventQuestMap _gameEventCreatureQuests;
|
||||
GameEventQuestMap _gameEventGameObjectQuests;
|
||||
GameEventNPCVendorMap _gameEventVendors;
|
||||
GameEventModelEquipMap _gameEventModelEquip;
|
||||
GameEventIdMap _gameEventPoolIds;
|
||||
GameEventDataMap _gameEvent;
|
||||
GameEventBitmask _gameEventBattlegroundHolidays;
|
||||
QuestIdToEventConditionMap _questToEventConditions;
|
||||
GameEventNPCFlagMap _gameEventNPCFlags;
|
||||
ActiveEvents _activeEvents;
|
||||
bool _isSystemInit;
|
||||
GameEventSeasonalQuestsMap _gameEventSeasonalQuestsMap;
|
||||
public:
|
||||
GameEventGuidMap mGameEventCreatureGuids;
|
||||
GameEventGuidMap mGameEventGameobjectGuids;
|
||||
std::vector<uint32> modifiedHolidays;
|
||||
GameEventGuidMap GameEventCreatureGuids;
|
||||
GameEventGuidMap GameEventGameobjectGuids;
|
||||
std::vector<uint32> ModifiedHolidays;
|
||||
};
|
||||
|
||||
#define sGameEventMgr GameEventMgr::instance()
|
||||
|
||||
bool IsHolidayActive(HolidayIds id);
|
||||
bool IsEventActive(uint16 event_id);
|
||||
bool IsEventActive(uint16 eventId);
|
||||
|
||||
#endif
|
||||
|
||||
@ -153,8 +153,8 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
data.append(dataBuffer);
|
||||
|
||||
/// @todo: Fix this, how we do know how many and what holidays to send?
|
||||
data << uint32(sGameEventMgr->modifiedHolidays.size());
|
||||
for (uint32 entry : sGameEventMgr->modifiedHolidays)
|
||||
data << uint32(sGameEventMgr->ModifiedHolidays.size());
|
||||
for (uint32 entry : sGameEventMgr->ModifiedHolidays)
|
||||
{
|
||||
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(entry);
|
||||
|
||||
|
||||
@ -68,9 +68,9 @@ public:
|
||||
GameEventData const& eventData = events[eventId];
|
||||
|
||||
if (handler->GetSession())
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.description, active);
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.Description, active);
|
||||
else
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.description, active);
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.Description, active);
|
||||
|
||||
++counter;
|
||||
}
|
||||
@ -104,17 +104,17 @@ public:
|
||||
bool active = activeEvents.find(eventId) != activeEvents.end();
|
||||
std::string activeStr = active ? handler->GetAcoreString(LANG_ACTIVE) : "";
|
||||
|
||||
std::string startTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.start));
|
||||
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.end));
|
||||
std::string startTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.Start));
|
||||
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.End));
|
||||
|
||||
uint32 delay = sGameEventMgr->NextCheck(eventId);
|
||||
time_t nextTime = GameTime::GetGameTime().count() + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Acore::Time::TimeToTimestampStr(Seconds(nextTime)) : "-";
|
||||
std::string nextStr = nextTime >= eventData.Start && nextTime < eventData.End ? Acore::Time::TimeToTimestampStr(Seconds(nextTime)) : "-";
|
||||
|
||||
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE, true);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true);
|
||||
std::string occurenceStr = secsToTimeString(eventData.Occurence * MINUTE, true);
|
||||
std::string lengthStr = secsToTimeString(eventData.Length * MINUTE, true);
|
||||
|
||||
handler->PSendSysMessage(LANG_EVENT_INFO, uint16(eventId), eventData.description, activeStr,
|
||||
handler->PSendSysMessage(LANG_EVENT_INFO, uint16(eventId), eventData.Description, activeStr,
|
||||
startTimeStr, endTimeStr, occurenceStr, lengthStr,
|
||||
nextStr);
|
||||
|
||||
@ -141,11 +141,11 @@ public:
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
|
||||
if (activeEvents.find(eventId) != activeEvents.end())
|
||||
{
|
||||
handler->SendErrorMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.description);
|
||||
handler->SendErrorMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.Description);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_EVENT_STARTED, uint16(eventId), eventData.description);
|
||||
handler->PSendSysMessage(LANG_EVENT_STARTED, uint16(eventId), eventData.Description);
|
||||
sGameEventMgr->StartEvent(eventId, true);
|
||||
return true;
|
||||
}
|
||||
@ -171,11 +171,11 @@ public:
|
||||
|
||||
if (activeEvents.find(eventId) == activeEvents.end())
|
||||
{
|
||||
handler->SendErrorMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.description);
|
||||
handler->SendErrorMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.Description);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_EVENT_STOPPED, uint16(eventId), eventData.description);
|
||||
handler->PSendSysMessage(LANG_EVENT_STOPPED, uint16(eventId), eventData.Description);
|
||||
sGameEventMgr->StopEvent(eventId, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -269,17 +269,13 @@ public:
|
||||
static bool HandleLookupEventCommand(ChatHandler* handler, Tail namePart)
|
||||
{
|
||||
if (namePart.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring wNamePart;
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
if (!Utf8toWStr(namePart, wNamePart))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wstrToLower(wNamePart);
|
||||
|
||||
@ -294,11 +290,9 @@ public:
|
||||
{
|
||||
GameEventData const& eventData = events[id];
|
||||
|
||||
std::string descr = eventData.description;
|
||||
std::string descr = eventData.Description;
|
||||
if (descr.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Utf8FitTo(descr, wNamePart))
|
||||
{
|
||||
@ -311,25 +305,17 @@ public:
|
||||
std::string active = activeEvents.find(id) != activeEvents.end() ? handler->GetAcoreString(LANG_ACTIVE) : "";
|
||||
|
||||
if (handler->GetSession())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description, active);
|
||||
}
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.Description, active);
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description, active);
|
||||
}
|
||||
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.Description, active);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NOEVENTFOUND);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user