mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Refactoring of event name generation
This commit is contained in:
parent
935f5f5eba
commit
26a80fbcc6
1 changed files with 15 additions and 19 deletions
|
@ -12,47 +12,45 @@ std::string Core::Event::getEventName( uint32_t eventId )
|
|||
{
|
||||
uint16_t eventType = eventId >> 16;
|
||||
|
||||
auto unknown = std::string{ "unknown" };
|
||||
|
||||
switch( eventType )
|
||||
{
|
||||
case EventType::Quest:
|
||||
{
|
||||
auto questInfo = g_exdData.getQuestInfo( eventId );
|
||||
if( questInfo )
|
||||
{
|
||||
std::string name = questInfo->name_intern;
|
||||
std::size_t pos = name.find_first_of( "_" );
|
||||
if( !questInfo )
|
||||
return unknown + "Quest";
|
||||
|
||||
return questInfo->name_intern.substr( 0, pos );
|
||||
}
|
||||
std::string name = questInfo->name_intern;
|
||||
std::size_t pos = name.find_first_of( "_" );
|
||||
|
||||
return questInfo->name_intern.substr( 0, pos );
|
||||
}
|
||||
break;
|
||||
case EventType::CustomTalk:
|
||||
{
|
||||
auto customTalkInfo = g_exdData.getCustomTalkInfo( eventId );
|
||||
if( customTalkInfo )
|
||||
{
|
||||
std::string name = customTalkInfo->name_intern;
|
||||
std::size_t pos = name.find_first_of( "_" );
|
||||
if( !customTalkInfo )
|
||||
return unknown + "CustomTalk";
|
||||
|
||||
return customTalkInfo->name_intern.substr( 0, pos );
|
||||
}
|
||||
std::string name = customTalkInfo->name_intern;
|
||||
std::size_t pos = name.find_first_of( "_" );
|
||||
|
||||
return customTalkInfo->name_intern.substr( 0, pos );
|
||||
}
|
||||
break;
|
||||
case EventType::Opening:
|
||||
{
|
||||
auto openingInfo = g_exdData.getOpeningInfo( eventId );
|
||||
if( openingInfo )
|
||||
return openingInfo->name;
|
||||
return unknown + "Opening";
|
||||
}
|
||||
break;
|
||||
case EventType::Aetheryte:
|
||||
{
|
||||
auto aetherInfo = g_exdData.getAetheryteInfo( eventId & 0xFFFF );
|
||||
if( aetherInfo->isAetheryte )
|
||||
return "Aetheryte";
|
||||
return "Aethernet";
|
||||
|
||||
}
|
||||
case EventType::ChocoPort:
|
||||
{
|
||||
|
@ -60,11 +58,9 @@ std::string Core::Event::getEventName( uint32_t eventId )
|
|||
}
|
||||
default:
|
||||
{
|
||||
return "";
|
||||
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
uint32_t Core::Event::mapEventActorToRealActor( uint32_t eventActorId )
|
||||
|
|
Loading…
Add table
Reference in a new issue