mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
[Doors] Have NPCs trigger double doors (#2821)
This commit is contained in:
parent
2b224d42ad
commit
0a114fae9a
@ -770,3 +770,16 @@ int Strings::ToInt(const std::string &s, int fallback)
|
|||||||
{
|
{
|
||||||
return Strings::IsNumber(s) ? std::stoi(s) : fallback;
|
return Strings::IsNumber(s) ? std::stoi(s) : fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Strings::RemoveNumbers(std::string s)
|
||||||
|
{
|
||||||
|
int current = 0;
|
||||||
|
for (int i = 0; i < s.length(); i++) {
|
||||||
|
if (!isdigit(s[i])) {
|
||||||
|
s[current] = s[i];
|
||||||
|
current++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.substr(0, current);
|
||||||
|
}
|
||||||
|
|||||||
@ -88,6 +88,7 @@ public:
|
|||||||
static bool Contains(const std::string& subject, const std::string& search);
|
static bool Contains(const std::string& subject, const std::string& search);
|
||||||
static int ToInt(const std::string &s, int fallback = 0);
|
static int ToInt(const std::string &s, int fallback = 0);
|
||||||
static bool IsNumber(const std::string &s);
|
static bool IsNumber(const std::string &s);
|
||||||
|
static std::string RemoveNumbers(std::string s);
|
||||||
static bool IsFloat(const std::string &s);
|
static bool IsFloat(const std::string &s);
|
||||||
static const std::string ToLower(std::string s);
|
static const std::string ToLower(std::string s);
|
||||||
static const std::string ToUpper(std::string s);
|
static const std::string ToUpper(std::string s);
|
||||||
|
|||||||
@ -999,8 +999,14 @@ void Mob::AI_Process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (door->GetTriggerDoorID() > 0) {
|
if (door->GetTriggerDoorID() > 0) {
|
||||||
|
auto trigger_door = entity_list.GetDoorsByDoorID(door->GetTriggerDoorID());
|
||||||
|
if (trigger_door) {
|
||||||
|
if (Strings::RemoveNumbers(door->GetDoorName()) !=
|
||||||
|
Strings::RemoveNumbers(trigger_door->GetDoorName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (door->GetDoorParam() > 0) {
|
if (door->GetDoorParam() > 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user