Skip to content

Commit 38d10d4

Browse files
committed
Updates to methods from core changes
1 parent b3b6afc commit 38d10d4

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

ElunaUtility.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "GameObject.h"
1313
#if ELUNA_EXPANSION == EXP_RETAIL
1414
#include "DB2Stores.h"
15+
#include "IpAddress.h"
1516
#else
1617
#include "DBCStores.h"
1718
#endif
@@ -216,3 +217,12 @@ unsigned char* ElunaUtil::DecodeData(const char *data, size_t *output_length)
216217

217218
return decoded_data;
218219
}
220+
221+
#if ELUNA_EXPANSION == EXP_RETAIL
222+
bool ElunaUtil::IsIPAddress(std::string const& text)
223+
{
224+
boost::system::error_code error;
225+
Trinity::Net::make_address(text, error);
226+
return !error;
227+
}
228+
#endif

ElunaUtility.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ namespace ElunaUtil
188188
* The returned result buffer must be `delete[]`ed by the caller.
189189
*/
190190
unsigned char* DecodeData(const char* data, size_t *output_length);
191+
192+
#if ELUNA_EXPANSION == EXP_RETAIL
193+
bool IsIPAddress(std::string const& text);
194+
#endif
191195
};
192196

193197
#endif

methods/TrinityCore/GlobalMethods.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,11 @@ namespace LuaGlobalFunctions
19591959
mode = BanMode::BAN_CHARACTER;
19601960
break;
19611961
case BAN_IP:
1962+
#if ELUNA_EXPANSION < EXP_RETAIL
19621963
if (!IsIPAddress(nameOrIP.c_str()))
1964+
#else
1965+
if (!ElunaUtil::IsIPAddress(nameOrIP))
1966+
#endif
19631967
return luaL_argerror(E->L, 2, "invalid ip");
19641968
mode = BanMode::BAN_IP;
19651969
break;

methods/TrinityCore/MapMethods.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ namespace LuaMap
133133
#if ELUNA_EXPANSION < EXP_RETAIL
134134
E->Push(map->GetDifficulty());
135135
#else
136-
E->Push(map->GetMapDifficulty());
136+
E->Push(map->GetDifficultyID());
137137
#endif
138138
return 1;
139139
}

0 commit comments

Comments
 (0)