diff --git a/CMakeLists.txt b/CMakeLists.txt index 407b1a221..30afb1324 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -373,7 +373,7 @@ ENDIF() IF(PERL_LIBRARY_ENABLED) OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) IF(EQEMU_BUILD_PERL) - SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS}) + SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}") ADD_DEFINITIONS(-DEMBPERL) ADD_DEFINITIONS(-DEMBPERL_PLUGIN) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index f454d164a..d5b325aec 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -1,3 +1,7 @@ IF(EQEMU_BUILD_LUA) ADD_SUBDIRECTORY(luabind) ENDIF(EQEMU_BUILD_LUA) + +IF(EQEMU_BUILD_PERL) + ADD_SUBDIRECTORY(perlbind) +ENDIF(EQEMU_BUILD_PERL) diff --git a/libs/perlbind/.gitignore b/libs/perlbind/.gitignore new file mode 100644 index 000000000..af66ff704 --- /dev/null +++ b/libs/perlbind/.gitignore @@ -0,0 +1,21 @@ +* +!.gitignore +!.editorconfig +!CMakeLists.txt +!LICENSE +!README.md + +!.github/ +!.github/** + +!doc/ +!doc/** + +!include/ +!include/** + +!src/ +!src/* + +!test/ +!test/* diff --git a/libs/perlbind/CMakeLists.txt b/libs/perlbind/CMakeLists.txt new file mode 100644 index 000000000..c03dd8e3a --- /dev/null +++ b/libs/perlbind/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 3.7) + +project(perlbind LANGUAGES CXX) + +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".so" ".a") + +find_package(PerlLibs) + +set(PERLBIND_HEADERS + include/perlbind/array.h + include/perlbind/forward.h + include/perlbind/function.h + include/perlbind/hash.h + include/perlbind/interpreter.h + include/perlbind/iterator.h + include/perlbind/package.h + include/perlbind/perlbind.h + include/perlbind/scalar.h + include/perlbind/stack.h + include/perlbind/stack_push.h + include/perlbind/stack_read.h + include/perlbind/subcaller.h + include/perlbind/traits.h + include/perlbind/typemap.h + include/perlbind/types.h + include/perlbind/util.h + include/perlbind/version.h +) + +set(PERLBIND_SOURCES + src/function.cpp + src/hash.cpp + src/interpreter.cpp + src/package.cpp +) + +if(MSVC) + set(PERLBIND_SOURCES ${PERLBIND_SOURCES} src/perlbind.natvis) +endif() + +add_library(perlbind ${PERLBIND_SOURCES} ${PERLBIND_HEADERS}) + +target_include_directories(perlbind PUBLIC + ${PERL_INCLUDE_PATH} + $ + $) + +option(PERLBIND_BUILD_TESTS "Build tests" OFF) +option(PERLBIND_ENABLE_ASAN "Build with address sanitizer" OFF) + +if(PERLBIND_ENABLE_ASAN) + target_compile_options(perlbind PRIVATE -fsanitize=address -fno-omit-frame-pointer) + target_link_options(perlbind PRIVATE -fsanitize=address -fno-omit-frame-pointer) +endif() + +if(PERLBIND_BUILD_TESTS) + enable_testing() + add_subdirectory(test) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT tests) + + target_include_directories(tests PRIVATE + ${PERL_INCLUDE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/include) +endif() diff --git a/libs/perlbind/LICENSE b/libs/perlbind/LICENSE new file mode 100644 index 000000000..37bca4200 --- /dev/null +++ b/libs/perlbind/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 hg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/libs/perlbind/include/perlbind/array.h b/libs/perlbind/include/perlbind/array.h new file mode 100644 index 000000000..be9b7781a --- /dev/null +++ b/libs/perlbind/include/perlbind/array.h @@ -0,0 +1,119 @@ +#pragma once + +#include "types.h" +#include "iterator.h" +#include + +namespace perlbind { + +struct array : public type_base +{ + using iterator = detail::array_iterator; + + ~array() noexcept + { + SvREFCNT_dec(m_av); + } + + array() noexcept + : type_base(), m_av(newAV()) {} + array(PerlInterpreter* interp) noexcept + : type_base(interp), m_av(newAV()) {} + array(const array& other) noexcept + : type_base(other.my_perl), m_av(copy_array(other.m_av)) {} + array(array&& other) noexcept + : type_base(other.my_perl), m_av(other.m_av) + { + other.m_av = newAV(); + } + array(AV*& value) noexcept + : type_base(), m_av(copy_array(value)) {} + array(AV*&& value) noexcept + : type_base(), m_av(value) {} // take ownership + array(scalar ref) + : type_base(ref.my_perl) + { + if (!ref.is_array_ref()) + throw std::runtime_error("cannot construct array from non-array reference"); + + reset(reinterpret_cast(SvREFCNT_inc(*ref))); + } + array(scalar_proxy proxy) + : array(scalar(SvREFCNT_inc(proxy.sv()))) {} + + array& operator=(const array& other) noexcept + { + if (this != &other) + m_av = copy_array(other.m_av); + + return *this; + } + + array& operator=(array&& other) noexcept + { + if (this != &other) + std::swap(m_av, other.m_av); + + return *this; + } + + array& operator=(AV*& value) noexcept + { + if (m_av != value) + m_av = copy_array(value); + + return *this; + } + + array& operator=(AV*&& value) noexcept + { + reset(value); + return *this; + } + + operator AV*() const { return m_av; } + operator SV*() const { return reinterpret_cast(m_av); } + + AV* release() noexcept + { + AV* tmp = m_av; + m_av = newAV(); + return tmp; + } + + void reset(AV* value) noexcept + { + SvREFCNT_dec(m_av); + m_av = value; + } + + void clear() noexcept { av_clear(m_av); } // decreases refcnt of all SV elements + scalar pop_back() noexcept { return av_pop(m_av); } + scalar pop_front() noexcept { return av_shift(m_av); } + void push_back(const scalar& value) { av_push(m_av, newSVsv(value)); } + void push_back(scalar&& value) { av_push(m_av, value.release()); } + void reserve(size_t count) { av_extend(m_av, count > 0 ? count - 1 : 0); } + size_t size() const { return av_len(m_av) + 1; } + SV* sv() const { return reinterpret_cast(m_av); } + + // returns a proxy that takes ownership of one reference to the SV element + // extends the array and creates an undef SV if index out of range + scalar_proxy operator[](size_t index) + { + SV** sv = av_fetch(m_av, index, 1); + return scalar_proxy(my_perl, SvREFCNT_inc(*sv)); + } + + iterator begin() const noexcept { return { my_perl, m_av, 0 }; } + iterator end() const noexcept { return { my_perl, m_av, size() }; } + +private: + AV* copy_array(AV* other) + { + return av_make(av_len(other)+1, AvARRAY(other)); + } + + AV* m_av = nullptr; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/forward.h b/libs/perlbind/include/perlbind/forward.h new file mode 100644 index 000000000..9757eb19c --- /dev/null +++ b/libs/perlbind/include/perlbind/forward.h @@ -0,0 +1,22 @@ +#pragma once + +namespace perlbind { + +namespace detail { + +class xsub_stack; +struct function_base; +struct array_iterator; +struct hash_iterator; + +} // namespace detail + +class interpreter; +class package; +struct scalar; +struct scalar_proxy; +struct reference; +struct array; +struct hash; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/function.h b/libs/perlbind/include/perlbind/function.h new file mode 100644 index 000000000..2d4455a9b --- /dev/null +++ b/libs/perlbind/include/perlbind/function.h @@ -0,0 +1,144 @@ +#pragma once + +namespace perlbind { namespace detail { + +// traits for function and class method exports +template +struct base_traits +{ + using return_t = Ret; + using sig_t = util::type_name; + using stack_tuple = std::conditional_t::value, + std::tuple, + std::tuple>; + static constexpr int arity = sizeof...(Args); + static constexpr int stack_arity = sizeof...(Args) + (std::is_void::value ? 0 : 1); + static constexpr int vararg_count = count_of::value + + count_of::value; + static constexpr bool is_vararg = vararg_count > 0; + static constexpr bool is_vararg_last = is_last::value || + is_last::value; + + static_assert(!is_vararg || (vararg_count == 1 && is_vararg_last), + "A function may only accept a single array or hash and it must be " + "be the last parameter. Prefer using reference parameters instead."); +}; + +template ::value> +struct function_traits : public function_traits {}; + +template +struct function_traits : base_traits +{ + using type = Ret(*)(Args...); +}; + +template +struct function_traits : base_traits +{ + using type = Ret(Class::*)(Args...); +}; + +template +struct function_traits : base_traits +{ + using type = Ret(Class::*)(Args...) const; +}; + +template +struct function_traits : base_traits +{ + using type = Ret(*)(Args...); +}; + +// represents a bound native function +struct function_base +{ + virtual ~function_base() = default; + virtual std::string get_signature() const = 0; + virtual bool is_compatible(xsub_stack&) const = 0; + virtual void call(xsub_stack&) const = 0; + + static const MGVTBL mgvtbl; +}; + +template +struct function : public function_base, function_traits +{ + using target_t = typename function::type; + using return_t = typename function::return_t; + + function() = delete; + function(PerlInterpreter* interp, T func) + : my_perl(interp), m_func(func) {} + + std::string get_signature() const override + { + return util::type_name::str(); + }; + + bool is_compatible(xsub_stack& stack) const override + { + return function::is_vararg || stack.check_types(typename function::stack_tuple{}); + } + + void call(xsub_stack& stack) const override + { + if (!function::is_vararg && stack.size() != function::stack_arity) + { + using sig = typename function::sig_t; + int count = std::is_member_function_pointer::value ? stack.size() - 1 : stack.size(); + SV* err = newSVpvf("'%s(%s)' called with %d argument(s), expected %d\n argument(s): (%s)\n", + stack.name().c_str(), sig::str().c_str(), count, function::arity, stack.types().c_str()); + err = sv_2mortal(err); + throw std::runtime_error(SvPV_nolen(err)); + } + + call_impl(stack, std::is_void()); + } + +private: + void call_impl(xsub_stack& stack, std::false_type) const + { + return_t result = apply(m_func, stack.convert_stack(typename function::stack_tuple{})); + stack.push_return(std::move(result)); + } + + void call_impl(xsub_stack& stack, std::true_type) const + { + apply(m_func, stack.convert_stack(typename function::stack_tuple{})); + } + + // c++14 call function template with tuple arg unpacking (c++17 can use std::apply()) + template + auto call_func(F func, Tuple&& t, std::index_sequence) const + { + return func(std::get(std::forward(t))...); + } + + template + auto call_member(F method, Tuple&& t, std::index_sequence) const + { + return (std::get<0>(t)->*method)(std::get(std::forward(t))...); + } + + template ::value, bool> = true> + auto apply(F func, Tuple&& t) const + { + using make_sequence = std::make_index_sequence::value>; + return call_func(func, std::forward(t), make_sequence{}); + } + + template ::value, bool> = true> + auto apply(F func, Tuple&& t) const + { + using make_sequence = std::make_index_sequence::value - 1>; + return call_member(func, std::forward(t), make_sequence{}); + } + + PerlInterpreter* my_perl = nullptr; + T m_func; +}; + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/hash.h b/libs/perlbind/include/perlbind/hash.h new file mode 100644 index 000000000..28bf72d53 --- /dev/null +++ b/libs/perlbind/include/perlbind/hash.h @@ -0,0 +1,124 @@ +#pragma once + +#include "types.h" +#include + +namespace perlbind { + +struct hash : public type_base +{ + using iterator = detail::hash_iterator; + + ~hash() noexcept + { + SvREFCNT_dec(m_hv); + } + + hash() noexcept + : type_base(), m_hv(newHV()) {} + hash(PerlInterpreter* interp) noexcept + : type_base(interp), m_hv(newHV()) {} + hash(const hash& other) noexcept + : type_base(other.my_perl), m_hv(copy_hash(other.m_hv)) {} + hash(hash&& other) noexcept + : type_base(other.my_perl), m_hv(other.m_hv) + { + other.m_hv = newHV(); + } + hash(HV*& value) noexcept + : type_base(), m_hv(copy_hash(value)) {} + hash(HV*&& value) noexcept + : type_base(), m_hv(value) {} // take ownership + hash(scalar ref); + hash(scalar_proxy proxy); + + hash& operator=(const hash& other) noexcept + { + if (this != &other) + m_hv = copy_hash(other.m_hv); + + return *this; + } + + hash& operator=(hash&& other) noexcept + { + if (this != &other) + std::swap(m_hv, other.m_hv); + + return *this; + } + + hash& operator=(HV*& value) noexcept + { + if (m_hv != value) + m_hv = copy_hash(value); + + return *this; + } + + hash& operator=(HV*&& value) noexcept + { + reset(value); + return *this; + } + + operator HV*() const { return m_hv; } + operator SV*() const { return reinterpret_cast(m_hv); } + + HV* release() noexcept + { + HV* tmp = m_hv; + m_hv = newHV(); + return tmp; + } + + void reset(HV* value) noexcept + { + SvREFCNT_dec(m_hv); + m_hv = value; + } + + scalar at(const char* key); + scalar at(const std::string& key); + void clear() noexcept { hv_clear(m_hv); } + bool exists(const char* key) const + { + return hv_exists(m_hv, key, static_cast(strlen(key))); + } + bool exists(const std::string& key) const + { + return hv_exists(m_hv, key.c_str(), static_cast(key.size())); + } + void insert(const char* key, scalar value); + void insert(const std::string& key, scalar value); + void remove(const char* key) + { + hv_delete(m_hv, key, static_cast(strlen(key)), 0); + } + void remove(const std::string& key) + { + hv_delete(m_hv, key.c_str(), static_cast(key.size()), 0); + } + size_t size() const { return HvTOTALKEYS(m_hv); } + SV* sv() const { return reinterpret_cast(m_hv); } + + // returns a proxy that takes ownership of one reference to the SV value + // creates an undef SV entry for the key if it doesn't exist + scalar_proxy operator[](const std::string& key); + + iterator begin() const noexcept; + iterator end() const noexcept; + iterator find(const char* key); + iterator find(const std::string& key); + +private: + scalar at(const char* key, size_t size); + iterator find(const char* key, size_t size); + void insert(const char* key, size_t size, scalar value); + + HV* copy_hash(HV* other) noexcept; + + HV* m_hv = nullptr; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/interpreter.h b/libs/perlbind/include/perlbind/interpreter.h new file mode 100644 index 000000000..5d4f03caf --- /dev/null +++ b/libs/perlbind/include/perlbind/interpreter.h @@ -0,0 +1,63 @@ +#pragma once + +namespace perlbind { + +class interpreter +{ +public: + interpreter(); + interpreter(PerlInterpreter* interp) : my_perl(interp) {} + interpreter(int argc, const char** argv); + interpreter(const interpreter& other) = delete; + interpreter(interpreter&& other) = delete; + interpreter& operator=(const interpreter& other) = delete; + interpreter& operator=(interpreter&& other) = delete; + ~interpreter(); + + PerlInterpreter* get() const { return my_perl; } + + void load_script(std::string packagename, std::string filename); + void eval(const char* str); + + template + T call_sub(const char* subname, Args&&... args) const + { + detail::sub_caller caller(my_perl); + return caller.call_sub(subname, std::forward(args)...); + } + + // returns interface to add bindings to package name + package new_package(const char* name) + { + return package(my_perl, name); + } + + // registers type for blessing objects, returns interface + template + class_ new_class(const char* name) + { + static_assert(!std::is_pointer::value && !std::is_reference::value, + "new_class 'T' should not be a pointer or reference"); + + auto typemap = detail::typemap::get(my_perl); + auto type_id = detail::usertype::id(); + typemap[type_id] = name; + + return class_(my_perl, name); + } + + // helper to bind functions in default main:: package + template + void add(const char* name, T&& func) + { + new_package("main").add(name, std::forward(func)); + } + +private: + void init(int argc, const char** argv); + + bool m_is_owner = false; + PerlInterpreter* my_perl = nullptr; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/iterator.h b/libs/perlbind/include/perlbind/iterator.h new file mode 100644 index 000000000..c53174129 --- /dev/null +++ b/libs/perlbind/include/perlbind/iterator.h @@ -0,0 +1,100 @@ +#pragma once + +namespace perlbind { namespace detail { + +struct array_iterator +{ + array_iterator() = default; + array_iterator(PerlInterpreter* interp, AV* av, size_t index) + : my_perl(interp), m_av(av), m_index(index), m_scalar(interp) + { + fetch(); + } + + bool operator!=(const array_iterator& other) const + { + return m_index != other.m_index; + } + + array_iterator& operator++() + { + ++m_index; + fetch(); + return *this; + } + + scalar* operator->() + { + return &m_scalar; + } + + scalar& operator*() + { + return m_scalar; + } + +private: + void fetch() + { + SV** sv = av_fetch(m_av, m_index, 0); + if (sv) + m_scalar = SvREFCNT_inc(*sv); + } + + PerlInterpreter* my_perl; + AV* m_av; + size_t m_index; + scalar m_scalar; +}; + +struct hash_iterator +{ + hash_iterator() = default; + hash_iterator(PerlInterpreter* interp, HV* hv, HE* he) + : my_perl(interp), m_hv(hv), m_he(he) + { + fetch(); + } + + bool operator==(const hash_iterator& other) const + { + return m_he == other.m_he; + } + + bool operator!=(const hash_iterator& other) const + { + return !(*this == other); + } + + hash_iterator& operator++() + { + m_he = hv_iternext(m_hv); + fetch(); + return *this; + } + + std::pair* operator->() + { + return &m_pair; + } + + std::pair& operator*() + { + return m_pair; + } + +private: + void fetch() + { + if (m_he) + m_pair = { HePV(m_he, PL_na), scalar(my_perl, SvREFCNT_inc(HeVAL(m_he))) }; + } + + PerlInterpreter* my_perl; + HV* m_hv; + HE* m_he; + std::pair m_pair; +}; + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/package.h b/libs/perlbind/include/perlbind/package.h new file mode 100644 index 000000000..3e8238662 --- /dev/null +++ b/libs/perlbind/include/perlbind/package.h @@ -0,0 +1,59 @@ +#pragma once + +#include + +namespace perlbind { + +class package +{ +public: + virtual ~package() = default; + package() = delete; + package(PerlInterpreter* interp, const char* name) + : my_perl(interp), m_name(name), m_stash(gv_stashpv(name, GV_ADD)) + {} + + // bind a function pointer to a function name in the package + // overloads with same name must be explicit (default parameters not supported) + // overloads have a runtime lookup cost and chooses the first compatible overload + template + void add(const char* name, T func) + { + // ownership of function object is given to perl + auto function = new detail::function(my_perl, func); + add_impl(name, static_cast(function)); + } + + // specify a base class name for object inheritance (must be registered) + // calling object methods missing from the package will search parent classes + // base classes are searched in registered order and include any grandparents + void add_base_class(const char* name) + { + std::string package_isa = m_name + "::ISA"; + AV* av = get_av(package_isa.c_str(), GV_ADD); + array isa_array = reinterpret_cast(SvREFCNT_inc(av)); + isa_array.push_back(name); + } + + // add a constant value to this package namespace + template + void add_const(const char* name, T&& value) + { + newCONSTSUB(m_stash, name, scalar(value).release()); + } + +private: + void add_impl(const char* name, detail::function_base* function); + + std::string m_name; + PerlInterpreter* my_perl = nullptr; + HV* m_stash = nullptr; +}; + +template +struct class_ : public package +{ + using package::package; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/perlbind.h b/libs/perlbind/include/perlbind/perlbind.h new file mode 100644 index 000000000..7e1a7830e --- /dev/null +++ b/libs/perlbind/include/perlbind/perlbind.h @@ -0,0 +1,55 @@ +#pragma once + +// Defining PERLBIND_STRICT_NUMERIC_TYPES will enable strict type checks +// for integers and floats.This is required for overloads that depend on +// int and float type differences. +// #define PERLBIND_STRICT_NUMERIC_TYPES + +// Defining PERLBIND_NO_STRICT_SCALAR_TYPES will disable strict type checks +// for all int, float, and string function arguments. These types will only +// be checked for scalar validity and converted to the function's expected +// paramter type. This will break overloads that depend on distinct types. +// This option overrides PERLBIND_STRICT_NUMERIC_TYPES. +//#define PERLBIND_NO_STRICT_SCALAR_TYPES + +// defining PERL_NO_GET_CONTEXT gets context from local variable "my_perl" +// instead of calling Perl_get_context() in macros +#define PERL_NO_GET_CONTEXT + +#define WIN32IO_IS_STDIO +#if _MSC_VER +#define __inline__ __inline +// perl 5.30+ defines HAS_BUILTIN_EXPECT for msvc which breaks builds +#define __builtin_expect(expr,val) (expr) +// avoid INT64_C and UINT64_C redefinition warnings +#if PERL_VERSION < 28 +#include +#endif +#endif + +#include +#include +#include + +// short name perl macros that cause issues +#undef Move +#undef Copy +#undef Zero +#undef list +#undef seed +#undef do_open +#undef do_close + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/libs/perlbind/include/perlbind/scalar.h b/libs/perlbind/include/perlbind/scalar.h new file mode 100644 index 000000000..ea2d97ade --- /dev/null +++ b/libs/perlbind/include/perlbind/scalar.h @@ -0,0 +1,254 @@ +#pragma once + +#include "types.h" +#include +#include + +namespace perlbind { + +struct scalar : type_base +{ + virtual ~scalar() noexcept + { + SvREFCNT_dec(m_sv); + } + + scalar() noexcept + : type_base(), m_sv(newSV(0)) {} // nothing allocated + scalar(PerlInterpreter* interp) noexcept + : type_base(interp), m_sv(newSV(0)) {} + scalar(PerlInterpreter* interp, SV*&& sv) noexcept + : type_base(interp), m_sv(sv) {} + scalar(const scalar& other) noexcept + : type_base(other.my_perl), m_sv(newSVsv(other.m_sv)) {} + scalar(scalar&& other) noexcept + : type_base(other.my_perl), m_sv(other.m_sv) + { + other.m_sv = newSV(0); + } + scalar(SV*& value) noexcept + : type_base(), m_sv(newSVsv(value)) {} + scalar(SV*&& value) noexcept + : type_base(), m_sv(value) {} + scalar(const char* value) noexcept + : type_base(), m_sv(newSVpv(value, 0)) {} + scalar(const std::string& value) noexcept + : type_base(), m_sv(newSVpvn(value.c_str(), value.size())) {} + + template ::value, bool> = true> + scalar(T value) noexcept : type_base(), m_sv(newSViv(static_cast(value))) {} + + template ::value, bool> = true> + scalar(T value) noexcept : type_base(), m_sv(newSVuv(value)) {} + + template ::value, bool> = true> + scalar(T value) noexcept : type_base(), m_sv(newSVnv(value)) {} + + template ::value, bool> = true> + scalar(T value) noexcept : type_base(), m_sv(newSV(0)) + { + *this = std::move(value); + } + + scalar& operator=(const scalar& other) noexcept + { + if (this != &other) + sv_setsv(m_sv, other.m_sv); + + return *this; + } + + scalar& operator=(scalar&& other) noexcept + { + if (this != &other) + std::swap(m_sv, other.m_sv); + + return *this; + } + + scalar& operator=(SV*& value) noexcept + { + sv_setsv(m_sv, value); + return *this; + } + + scalar& operator=(SV*&& value) noexcept + { + reset(value); + return *this; + } + + scalar& operator=(const char* value) noexcept + { + sv_setpv(m_sv, value); + return *this; + } + + scalar& operator=(const std::string& value) noexcept + { + sv_setpvn(m_sv, value.c_str(), value.size()); + return *this; + } + + template ::value, bool> = true> + scalar& operator=(T value) noexcept + { + sv_setiv(m_sv, static_cast(value)); + return *this; + } + + template ::value, bool> = true> + scalar& operator=(T value) noexcept + { + sv_setuv(m_sv, value); + return *this; + } + + template ::value, bool> = true> + scalar& operator=(T value) noexcept + { + sv_setnv(m_sv, value); + return *this; + } + + template ::value, bool> = true> + scalar& operator=(T value) noexcept + { + // bless if it's in the typemap + const char* type_name = detail::typemap::template get_name(my_perl); + sv_setref_pv(m_sv, type_name, static_cast(value)); + return *this; + } + + operator SV*() const { return m_sv; } + operator void*() const { return m_sv; } + operator const char*() const { return SvPV_nolen(m_sv); } + operator std::string() const { return SvPV_nolen(m_sv); } + template ::value, bool> = true> + operator T() const { return static_cast(SvIV(m_sv)); } + template ::value, bool> = true> + operator T() const { return static_cast(SvUV(m_sv)); } + template ::value, bool> = true> + operator T() const { return static_cast(SvNV(m_sv)); } + template ::value, bool> = true> + operator T() const + { + const char* type_name = detail::typemap::template get_name(my_perl); + if (type_name && sv_isobject(m_sv) && sv_derived_from(m_sv, type_name)) + { + IV tmp = SvIV(SvRV(m_sv)); + return INT2PTR(T, tmp); + } + return nullptr; + } + + template + T as() const { return static_cast(*this); } + + // release ownership of SV + SV* release() noexcept + { + SV* tmp = m_sv; + m_sv = newSV(0); + return tmp; + } + // take ownership of an SV + void reset(SV* value) noexcept + { + SvREFCNT_dec(m_sv); + m_sv = value; + } + + SV* sv() const { return m_sv; } + SV* deref() const { return SvRV(m_sv); } + size_t size() const { return SvPOK(m_sv) ? sv_len(m_sv) : 0; } + svtype type() const { return SvTYPE(m_sv); } + const char* c_str() const { return SvPV_nolen(m_sv); } + + SV* operator*() { return SvRV(m_sv); } + + bool is_null() const { return type() == SVt_NULL; } //SvOK(m_sv) + bool is_integer() const { return SvIOK(m_sv); } + bool is_float() const { return SvNOK(m_sv); } + bool is_string() const { return SvPOK(m_sv); } + bool is_reference() const { return SvROK(m_sv); } + bool is_scalar_ref() const { return SvROK(m_sv) && SvTYPE(SvRV(m_sv)) < SVt_PVAV; } + bool is_array_ref() const { return SvROK(m_sv) && SvTYPE(SvRV(m_sv)) == SVt_PVAV; } + bool is_hash_ref() const { return SvROK(m_sv) && SvTYPE(SvRV(m_sv)) == SVt_PVHV; } + +protected: + SV* m_sv = nullptr; +}; + +// references are scalars that take ownership of one new reference to a value +// use reset() to take ownership of an existing RV +struct reference : public scalar +{ + reference() = default; + + template ::value, bool> = true> + reference(T& value) noexcept : scalar(value.my_perl, nullptr) { m_sv = newRV_inc(value); } + + // increments referent for rvalues of scalar objects (not raw SVs) since they dec on destruct + template ::value, bool> = true> + reference(T&& value) noexcept : scalar(value.my_perl, nullptr) { m_sv = newRV_inc(value); } + + template ::value, bool> = true> + reference(T& value) noexcept { reset(newRV_inc(reinterpret_cast(value))); } + + template ::value, bool> = true> + reference(T&& value) noexcept { reset(newRV_noinc(reinterpret_cast(value))); } + + SV* operator*() { return SvRV(m_sv); } +}; + +// scalar proxy reference is used for array and hash index operator[] overloads +struct scalar_proxy +{ + scalar_proxy() = delete; + scalar_proxy(PerlInterpreter* interp, scalar&& value) noexcept + : my_perl(interp), m_value(std::move(value)) {} + + SV* sv() const { return m_value; } + const char* c_str() const { return static_cast(m_value); } + + template + T as() const { return m_value.as(); } + + operator std::string() const { return m_value; } + + // copying value to supported conversion types (e.g. int val = arr[i]) + template ::value, bool> = true> + operator T() const + { + return static_cast(m_value); + } + + // taking a reference to the source SV (e.g. scalar val = arr[i]) + template ::value, bool> = true> + operator T() const + { + return SvREFCNT_inc(m_value); + } + + // assigning scalar to proxy, the source SV is modified (arr[i] = "new value") + scalar_proxy& operator=(scalar value) + { + m_value = value; + return *this; + } + + scalar_proxy& operator=(const scalar_proxy& other) + { + m_value = other.m_value; + return *this; + } + + // todo: nested proxy[] + +private: + PerlInterpreter* my_perl = nullptr; + scalar m_value; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/stack.h b/libs/perlbind/include/perlbind/stack.h new file mode 100644 index 000000000..64bdb2e04 --- /dev/null +++ b/libs/perlbind/include/perlbind/stack.h @@ -0,0 +1,137 @@ +#pragma once + +#include "stack_push.h" +#include "stack_read.h" +#include +#include +#include + +namespace perlbind { namespace detail { + +// handles xsub call stack from perl, inherits stack::pusher to push return values +class xsub_stack : public stack::pusher +{ +public: + xsub_stack() = delete; + xsub_stack(PerlInterpreter* my_perl, CV* cv) + : stack::pusher(my_perl) + { + GV* gv = CvGV(cv); + m_sub_name = GvNAME(gv); + m_pkg_name = HvNAME(GvSTASH(gv)); + + dXSARGS; + this->sp = sp; + this->ax = ax; + this->mark = mark; + this->items = items; + } + ~xsub_stack() { XSRETURN(m_pushed); } + + int size() const { return items; } + std::string name() const { return std::string(pkg_name()) + "::" + sub_name(); } + const char* pkg_name() const { return m_pkg_name; } + const char* sub_name() const { return m_sub_name; } + + template + void push_return(T&& value) + { + XSprePUSH; + push(std::forward(value)); + } + + // returns true if all perl stack arguments are compatible with expected native arg types + template + bool check_types(Tuple&& types) + { + static constexpr int count = std::tuple_size::value; + if (items != count) + return false; + else if (count == 0) + return true; + + using make_sequence = std::make_index_sequence; + return check_stack(std::forward(types), make_sequence()); + } + + // returns tuple of converted perl stack arguments, throws on an incompatible type + template + auto convert_stack(Tuple&& types) + { + using make_sequence = std::make_index_sequence::value>; + return get_stack(std::forward(types), make_sequence()); + } + + std::string types() + { + std::string args; + for (int i = 0; i < items; ++i) + { + args += get_type_name(ST(i)); + if (i < (items - 1)) + args += ", "; + } + return args.empty() ? "void" : args; + } + +protected: + int ax = 0; + int items = 0; + SV** mark = nullptr; + const char* m_pkg_name = nullptr; + const char* m_sub_name = nullptr; + + std::string get_type_name(SV* item) + { + switch (SvTYPE(item)) + { + case SVt_NULL: return ""; + case SVt_NV: return "double"; + case SVt_PV: return "string"; + case SVt_PVAV: return "array"; + case SVt_PVHV: return "hash"; + case SVt_IV: + if (sv_isobject(item)) + return std::string(sv_reftype(SvRV(item), true)) + "*"; + else if (SvROK(item)) + return "ref"; + else + return "int"; + default: + return sv_reftype(item, true); + } + } + +private: + template + bool check_index(T t, size_t index) + { + return stack::read_as::check(my_perl, static_cast(index), ax, items); + } + + // return true if perl stack matches all expected argument types in tuple + template + bool check_stack(Tuple&& t, std::index_sequence) + { + // lists compatibility of each expected arg type (no short-circuit) + std::initializer_list res = { + check_index(std::get(std::forward(t)), I)... }; + + return std::all_of(res.begin(), res.end(), [](bool same) { return same; }); + } + + template + T get_stack_index(T t, size_t index) + { + return stack::read_as::get(my_perl, static_cast(index), ax, items); + } + + template + auto get_stack(Tuple&& t, std::index_sequence) + { + return Tuple{ get_stack_index(std::get(std::forward(t)), I)... }; + } +}; + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/stack_push.h b/libs/perlbind/include/perlbind/stack_push.h new file mode 100644 index 000000000..61a514cce --- /dev/null +++ b/libs/perlbind/include/perlbind/stack_push.h @@ -0,0 +1,118 @@ +#pragma once + +#include + +namespace perlbind { namespace stack { + +// base class for pushing value types to perl stack +// methods use macros that push new mortalized SVs but do not extend the stack +// the stack is only extended when pushing an array, hash, or using push_args(). +// this is because for xsubs the "stack is always large enough to take one return value" +struct pusher +{ + virtual ~pusher() = default; + + pusher() = delete; + pusher(PerlInterpreter* interp) : my_perl(interp), sp(PL_stack_sp) {} + + SV* pop() { return POPs; } + + void push(bool value) { PUSHs(boolSV(value)); ++m_pushed; } + void push(const char* value) + { + if (!value) + PUSHs(&PL_sv_undef); + else + mPUSHp(value, strlen(value)); + + ++m_pushed; + } + void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; } + void push(scalar value) { mPUSHs(value.release()); ++m_pushed; }; + void push(reference value) { mPUSHs(value.release()); ++m_pushed; }; + + void push(array value) + { + int count = static_cast(value.size()); + EXTEND(sp, count); + for (int i = 0; i < count; ++i) + { + // mortalizes one reference to array element to avoid copying + PUSHs(sv_2mortal(SvREFCNT_inc(value[i].sv()))); + } + m_pushed += count; + } + + void push(hash value) + { + // hashes are pushed to the perl stack as alternating keys and values + // this is less efficient than pushing a reference to the hash + auto count = hv_iterinit(value) * 2; + EXTEND(sp, count); + while (HE* entry = hv_iternext(value)) + { + auto val = HeVAL(entry); + PUSHs(hv_iterkeysv(entry)); // mortalizes new key sv (keys are not stored as sv) + PUSHs(sv_2mortal(SvREFCNT_inc(val))); + } + m_pushed += count; + } + + template ::value, bool> = true> + void push(T value) { mPUSHi(static_cast(value)); ++m_pushed; } + + template ::value, bool> = true> + void push(T value) { mPUSHu(value); ++m_pushed; } + + template ::value, bool> = true> + void push(T value) { mPUSHn(value); ++m_pushed; } + + template ::value, bool> = true> + void push(T value) + { + const char* type_name = detail::typemap::get_name(my_perl); + if (!type_name) + { + throw std::runtime_error("cannot push unregistered pointer of type '" + util::type_name::str() + "'"); + } + + SV* sv = sv_newmortal(); + sv_setref_pv(sv, type_name, static_cast(value)); + PUSHs(sv); + ++m_pushed; + }; + + void push(void* value) + { + SV* sv = sv_newmortal(); + sv_setref_pv(sv, nullptr, value); // unblessed + PUSHs(sv); + ++m_pushed; + } + + template + void push_args(Args&&... args) + { + EXTEND(sp, sizeof...(Args)); + push_args_impl(std::forward(args)...); + }; + +protected: + PerlInterpreter* my_perl = nullptr; + SV** sp = nullptr; + int m_pushed = 0; + +private: + template + void push_args_impl(Args&&... args) {} + + template + void push_args_impl(T&& value, Args&&... args) + { + push(std::forward(value)); + push_args_impl(std::forward(args)...); + } +}; + +} // namespace stack +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/stack_read.h b/libs/perlbind/include/perlbind/stack_read.h new file mode 100644 index 000000000..fe5794124 --- /dev/null +++ b/libs/perlbind/include/perlbind/stack_read.h @@ -0,0 +1,266 @@ +#pragma once + +#include + +namespace perlbind { namespace stack { + +// perl stack reader to convert types, throws if perl stack value isn't type compatible +template +struct read_as; + +template +struct read_as::value || std::is_enum::value>> +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { +#ifdef PERLBIND_NO_STRICT_SCALAR_TYPES + return SvTYPE(ST(i)) < SVt_PVAV; +#elif !defined PERLBIND_STRICT_NUMERIC_TYPES + return SvNIOK(ST(i)); +#else + return SvIOK(ST(i)); +#endif + } + + static T get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be an integer"); + } + return static_cast(SvIV(ST(i))); // unsigned and bools casted + } +}; + +template +struct read_as::value>> +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { +#ifdef PERLBIND_NO_STRICT_SCALAR_TYPES + return SvTYPE(ST(i)) < SVt_PVAV; +#elif !defined PERLBIND_STRICT_NUMERIC_TYPES + return SvNIOK(ST(i)); +#else + return SvNOK(ST(i)); +#endif + } + + static T get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a floating point"); + } + return static_cast(SvNV(ST(i))); + } +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { +#ifdef PERLBIND_NO_STRICT_SCALAR_TYPES + return SvTYPE(ST(i)) < SVt_PVAV; +#else + return SvPOK(ST(i)); +#endif + } + + static const char* get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a string"); + } + return static_cast(SvPV_nolen(ST(i))); + } +}; + +template <> +struct read_as : read_as +{ +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return sv_isobject(ST(i)); + } + + static void* get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a reference to an object"); + } + + IV tmp = SvIV(SvRV(ST(i))); + return INT2PTR(void*, tmp); + } +}; + +template +struct read_as::value>> +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + const char* type_name = detail::typemap::get_name(my_perl); + return type_name && sv_isobject(ST(i)) && sv_derived_from(ST(i), type_name); + } + + static T get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + // would prefer to check for unregistered types at compile time (not possible?) + const char* type_name = detail::typemap::get_name(my_perl); + if (!type_name) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a reference to an unregistered type (method unusable)"); + } + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a reference to an object of type '" + type_name + "'"); + } + + IV tmp = SvIV(SvRV(ST(i))); + return INT2PTR(T, tmp); + } +}; + +template +struct read_as> +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return true; + } + + static nullable get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (sv_isobject(ST(i))) + { + const char* type_name = detail::typemap::get_name(my_perl); + if (type_name && sv_derived_from(ST(i), type_name)) + { + IV tmp = SvIV(SvRV(ST(i))); + return INT2PTR(T, tmp); + } + } + return nullptr; + } +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return i < items; + } + + static SV* get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be valid scalar value"); + } + return ST(i); + } +}; + +// scalar, array, and hash readers return reference to stack items (not copies) +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return (SvROK(ST(i)) && SvTYPE(SvRV(ST(i))) < SVt_PVAV) || SvTYPE(ST(i)) < SVt_PVAV; + } + + static scalar get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a scalar or reference to a scalar"); + } + return SvROK(ST(i)) ? SvREFCNT_inc(SvRV(ST(i))) : SvREFCNT_inc(ST(i)); + } +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return SvROK(ST(i)); + } + + static reference get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be a reference"); + } + // take ownership of a reference to the RV itself (avoid reference to a reference) + reference result; + result.reset(SvREFCNT_inc(ST(i))); + return result; + } +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + return items > i; + } + + static array get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be start of a perl array"); + } + + array result; + result.reserve(items - i); + for (int index = i; index < items; ++index) + { + result.push_back(SvREFCNT_inc(ST(index))); + } + return result; + } +}; + +template <> +struct read_as +{ + static bool check(PerlInterpreter* my_perl, int i, int ax, int items) + { + int remaining = items - i; + return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) == SVt_PV; + } + + static hash get(PerlInterpreter* my_perl, int i, int ax, int items) + { + if (!check(my_perl, i, ax, items)) + { + throw std::runtime_error("expected argument " + std::to_string(i+1) + " to be start of a perl hash"); + } + + hash result; + for (int index = i; index < items; index += 2) + { + const char* key = SvPV_nolen(ST(index)); + result[key] = SvREFCNT_inc(ST(index + 1)); + } + return result; + } +}; + +} // namespace stack +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/subcaller.h b/libs/perlbind/include/perlbind/subcaller.h new file mode 100644 index 000000000..fb8c9d5c4 --- /dev/null +++ b/libs/perlbind/include/perlbind/subcaller.h @@ -0,0 +1,78 @@ +#pragma once + +#include + +namespace perlbind { namespace detail { + +// handles calls to perl, inherits stack::pusher to push args to perl sub +class sub_caller : public stack::pusher +{ +public: + sub_caller() = delete; + sub_caller(PerlInterpreter* my_perl) : stack::pusher(my_perl) + { + ENTER; // enter scope boundary for any mortals we create + SAVETMPS; + } + ~sub_caller() + { + PUTBACK; // set global sp back to local for any popped return values + FREETMPS; + LEAVE; // leave scope, decref mortals and values returned by perl + } + + template ::value, bool> = true> + auto call_sub(const char* subname, Args&&... args) + { + call_sub_impl(subname, G_EVAL|G_VOID, std::forward(args)...); + } + + template ::value, bool> = true> + auto call_sub(const char* subname, Args&&... args) + { + T result = 0; + + try + { + int count = call_sub_impl(subname, G_EVAL|G_SCALAR, std::forward(args)...); + + if (count == 1) + { + SV* sv_result = pop(); + result = static_cast(SvIV(sv_result)); + } + } + catch (...) + { + pop(); // top of stack holds undef on error when called with these flags + throw; + } + + return result; + } + +private: + template + int call_sub_impl(const char* subname, int flags, Args&&... args) + { + PUSHMARK(SP); // notify perl of local sp (required even if not pushing args) + push_args(std::forward(args)...); + PUTBACK; // set global sp back to local so call will know pushed arg count + + int result_count = call_pv(subname, flags); + + SPAGAIN; // refresh local sp since call may reallocate stack for scalar returns + + // ERRSV doesn't work in perl 5.28+ here for unknown reasons + SV* err = get_sv("@", 0); + if (SvTRUE(err)) + { + throw std::runtime_error("Perl error: " + std::string(SvPV_nolen(err))); + } + + return result_count; + } +}; + +} //namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/traits.h b/libs/perlbind/include/perlbind/traits.h new file mode 100644 index 000000000..e4f9da21e --- /dev/null +++ b/libs/perlbind/include/perlbind/traits.h @@ -0,0 +1,33 @@ +#pragma once + +namespace perlbind { namespace detail { + +template +struct is_any : std::false_type {}; +template +struct is_any : std::is_same {}; +template +struct is_any : std::integral_constant::value || is_any::value> {}; + +template +struct is_signed_integral : std::integral_constant::value && std::is_signed::value> {}; + +template +struct is_signed_integral_or_enum : std::integral_constant::value || std::is_enum::value> {}; + +template +struct count_of : std::integral_constant {}; +template +struct count_of : std::integral_constant::value ? 1 : 0> {}; +template +struct count_of : std::integral_constant::value + count_of::value> {}; + +template +struct is_last : std::false_type {}; +template +struct is_last : std::is_same {}; +template +struct is_last : std::integral_constant::value> {}; + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/typemap.h b/libs/perlbind/include/perlbind/typemap.h new file mode 100644 index 000000000..c5a3e50d5 --- /dev/null +++ b/libs/perlbind/include/perlbind/typemap.h @@ -0,0 +1,45 @@ +#pragma once + +namespace perlbind { namespace detail { + +struct usertype_counter +{ + static std::size_t next_id() + { + static std::size_t counter = 0; + return counter++; + } +}; + +template +struct usertype +{ + static std::string id() + { + static std::size_t id = usertype_counter::next_id(); + return std::to_string(id); + } +}; + +namespace typemap +{ + // type names are stored in a hash on interpreter when registered with + // unique id keys generated by usertype counter + inline hash get(PerlInterpreter* my_perl) + { + HV* hv = get_hv("__perlbind::typemap", GV_ADD); + return reinterpret_cast(SvREFCNT_inc(hv)); + } + + template + const char* get_name(PerlInterpreter* my_perl) + { + auto typemap = detail::typemap::get(my_perl); + auto type_id = detail::template usertype::id(); + + return typemap.exists(type_id) ? typemap[type_id].c_str() : nullptr; + } +} // namespace typemap + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/types.h b/libs/perlbind/include/perlbind/types.h new file mode 100644 index 000000000..ed3916ab0 --- /dev/null +++ b/libs/perlbind/include/perlbind/types.h @@ -0,0 +1,25 @@ +#pragma once + +namespace perlbind { + +struct type_base +{ + type_base() : my_perl(PERL_GET_THX) {} + type_base(PerlInterpreter* interp) : my_perl(interp) {} + PerlInterpreter* my_perl = nullptr; +}; + +// helper type to allow null object reference arguments in bindings +template +struct nullable +{ + static_assert(std::is_pointer::value, "nullable 'T' must be pointer"); + + nullable() = default; + nullable(T ptr) : m_ptr(ptr) {} + T get() { return m_ptr; } +private: + T m_ptr = nullptr; +}; + +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/util.h b/libs/perlbind/include/perlbind/util.h new file mode 100644 index 000000000..8b1e306de --- /dev/null +++ b/libs/perlbind/include/perlbind/util.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#ifndef _MSC_VER +#include +#endif + +namespace perlbind { namespace util { + +inline std::string demangle(const char* name) +{ +#ifndef _MSC_VER + int status = 0; + char* res = abi::__cxa_demangle(name, nullptr, nullptr, &status); + if (res) + { + std::string demangled = res; + free(res); + return demangled; + } + return ""; +#else + return name; +#endif +} + +template +struct type_name; + +template <> +struct type_name<> +{ + static std::string str() { return "void"; } +}; + +template +struct type_name +{ + static std::string str() { return demangle(typeid(T).name()); } +}; + +template +struct type_name +{ + static std::string str() { return type_name::str() + "," + type_name::str(); } +}; + +} // namespace util +} // namespace perlbind diff --git a/libs/perlbind/include/perlbind/version.h b/libs/perlbind/include/perlbind/version.h new file mode 100644 index 000000000..bc6f6e3d8 --- /dev/null +++ b/libs/perlbind/include/perlbind/version.h @@ -0,0 +1,10 @@ +#pragma once + +constexpr int perlbind_version_major = 1; +constexpr int perlbind_version_minor = 0; +constexpr int perlbind_version_patch = 0; + +constexpr int perlbind_version() +{ + return perlbind_version_major * 10000 + perlbind_version_minor * 100 + perlbind_version_patch; +} diff --git a/libs/perlbind/src/function.cpp b/libs/perlbind/src/function.cpp new file mode 100644 index 000000000..3143b39b0 --- /dev/null +++ b/libs/perlbind/src/function.cpp @@ -0,0 +1,15 @@ +#include + +namespace perlbind { namespace detail { + +extern "C" int gc(pTHX_ SV* sv, MAGIC* mg) +{ + auto pfunc = INT2PTR(perlbind::detail::function_base*, SvIV(sv)); + delete pfunc; + return 1; +} + +const MGVTBL function_base::mgvtbl = { 0, 0, 0, 0, gc, 0, 0, 0 }; + +} // namespace detail +} // namespace perlbind diff --git a/libs/perlbind/src/hash.cpp b/libs/perlbind/src/hash.cpp new file mode 100644 index 000000000..96cdaa2d7 --- /dev/null +++ b/libs/perlbind/src/hash.cpp @@ -0,0 +1,107 @@ +#include +#include +#include + +namespace perlbind { + +hash::hash(scalar ref) + : type_base(ref.my_perl) +{ + if (!ref.is_hash_ref()) + throw std::runtime_error("cannot construct hash from non-hash reference"); + + reset(reinterpret_cast(SvREFCNT_inc(*ref))); +} + +hash::hash(scalar_proxy proxy) + : hash(scalar(SvREFCNT_inc(proxy.sv()))) +{} + +scalar hash::at(const char* key) +{ + return at(key, strlen(key)); +} + +scalar hash::at(const std::string& key) +{ + return at(key.c_str(), key.size()); +} + +scalar hash::at(const char* key, size_t size) +{ + SV** sv = hv_fetch(m_hv, key, static_cast(size), 1); + return SvREFCNT_inc(*sv); +} + +void hash::insert(const char* key, scalar value) +{ + insert(key, strlen(key), value); +} + +void hash::insert(const std::string& key, scalar value) +{ + insert(key.c_str(), key.size(), value); +} + +scalar_proxy hash::operator[](const std::string& key) +{ + return scalar_proxy(my_perl, at(key.c_str(), key.size())); +} + +hash::iterator hash::begin() const noexcept +{ + hv_iterinit(m_hv); + return { my_perl, m_hv, hv_iternext(m_hv) }; +} + +hash::iterator hash::end() const noexcept +{ + return { my_perl, m_hv, nullptr }; +} + +hash::iterator hash::find(const char* key) +{ + return find(key, static_cast(strlen(key))); +} + +hash::iterator hash::find(const std::string& key) +{ + return find(key.c_str(), static_cast(key.size())); +} + +hash::iterator hash::find(const char* key, size_t size) +{ + // key sv made mortal with SVs_TEMP flag + SV* keysv = newSVpvn_flags(key, static_cast(size), SVs_TEMP); + HE* he = hv_fetch_ent(m_hv, keysv, 0, 0); + return { my_perl, m_hv, he }; +} + +void hash::insert(const char* key, size_t size, scalar value) +{ + if (!hv_store(m_hv, key, static_cast(size), SvREFCNT_inc(value), 0)) + { + SvREFCNT_dec(value); + } +} + +HV* hash::copy_hash(HV* other) noexcept +{ + HV* hv = newHV(); + + hv_iterinit(other); + while (HE* entry = hv_iternext(other)) + { + size_t key_size; + auto key = HePV(entry, key_size); + auto value = newSVsv(HeVAL(entry)); + if (!hv_store(hv, key, static_cast(key_size), value, HeHASH(entry))) + { + SvREFCNT_dec(value); + } + } + + return hv; +} + +} // namespace perlbind diff --git a/libs/perlbind/src/interpreter.cpp b/libs/perlbind/src/interpreter.cpp new file mode 100644 index 000000000..2a10df4f0 --- /dev/null +++ b/libs/perlbind/src/interpreter.cpp @@ -0,0 +1,98 @@ +#include + +#include +#include +#include + +EXTERN_C +{ + void boot_DynaLoader(pTHX_ CV* cv); + static void xs_init(pTHX) + { + newXS(const_cast("DynaLoader::boot_DynaLoader"), boot_DynaLoader, const_cast(__FILE__)); + } +} + +namespace perlbind { + +interpreter::interpreter() + : m_is_owner(true) +{ + const char* argv[] = { "", "-ew", "0", nullptr }; + constexpr int argc = (sizeof(argv) / sizeof(*argv)) - 1; + init(argc, argv); +} + +interpreter::interpreter(int argc, const char** argv) + : m_is_owner(true) +{ + init(argc, argv); +} + +void interpreter::init(int argc, const char** argv) +{ + char** argvs = const_cast(argv); + char** env = { nullptr }; + + // PERL_SYS_INIT3 and PERL_SYS_TERM should only be called once per program + PERL_SYS_INIT3(&argc, &argvs, &env); + + my_perl = perl_alloc(); + PERL_SET_CONTEXT(my_perl); + PL_perl_destruct_level = 1; + perl_construct(my_perl); + perl_parse(my_perl, xs_init, argc, argvs, nullptr); + + perl_run(my_perl); +} + +interpreter::~interpreter() +{ + if (m_is_owner) + { + PL_perl_destruct_level = 1; + perl_destruct(my_perl); + perl_free(my_perl); + + PERL_SYS_TERM(); + } +} + +void interpreter::load_script(std::string packagename, std::string filename) +{ + struct stat st{}; + if (stat(filename.c_str(), &st) != 0) + { + throw std::runtime_error("Unable to read perl file '" + filename + "'"); + } + + std::ifstream ifs(filename); + std::stringstream buffer; + buffer << "package " << packagename << "; " << ifs.rdbuf(); + + try + { + eval(buffer.str().c_str()); + } + catch (std::exception& e) + { + throw std::runtime_error("Error loading script '" + filename + "':\n " + e.what()); + } +} + +void interpreter::eval(const char* str) +{ + SV* sv = eval_pv(str, 0); + if (sv == &PL_sv_undef) + { + SV* err = get_sv("@", 0); + if (err && err->sv_u.svu_pv[0]) + { + throw std::runtime_error(err->sv_u.svu_pv); + } + + throw std::runtime_error("unknown error in eval()"); + } +} + +} // namespace perlbind diff --git a/libs/perlbind/src/package.cpp b/libs/perlbind/src/package.cpp new file mode 100644 index 000000000..3531265df --- /dev/null +++ b/libs/perlbind/src/package.cpp @@ -0,0 +1,88 @@ +#include + +namespace perlbind { + +namespace detail { + extern "C" void xsub(PerlInterpreter* my_perl, CV* cv); +} // namespace detail + +void package::add_impl(const char* name, detail::function_base* function) +{ + std::string export_name = m_name + "::" + name; + + // the sv is assigned a magic metamethod table to delete the function + // object when perl frees the sv + SV* sv = newSViv(PTR2IV(function)); + sv_magicext(sv, nullptr, PERL_MAGIC_ext, &detail::function_base::mgvtbl, nullptr, 0); + + CV* cv = get_cv(export_name.c_str(), 0); + if (!cv) + { + cv = newXS(export_name.c_str(), &detail::xsub, __FILE__); + CvXSUBANY(cv).any_ptr = function; + } + else // function exists, remove target to search overloads when called + { + CvXSUBANY(cv).any_ptr = nullptr; + } + + // create an array with same name to store overloads in the CV's GV + AV* av = GvAV(CvGV(cv)); + if (!av) + { + av = get_av(export_name.c_str(), GV_ADD); + } + + array overloads = reinterpret_cast(SvREFCNT_inc(av)); + overloads.push_back(sv); // giving only ref to GV array +} + +extern "C" void detail::xsub(PerlInterpreter* my_perl, CV* cv) +{ + // croak does not unwind so inner calls throw exceptions to prevent leaks + try + { + detail::xsub_stack stack(my_perl, cv); + + auto target = static_cast(CvXSUBANY(cv).any_ptr); + if (target) + { + return target->call(stack); + } + + // find first compatible overload + AV* av = GvAV(CvGV(cv)); + + array functions = reinterpret_cast(SvREFCNT_inc(av)); + for (const auto& function : functions) + { + auto func = INT2PTR(detail::function_base*, SvIV(function.sv())); + if (func->is_compatible(stack)) + { + return func->call(stack); + } + } + + SV* err = newSVpvf("no overload of '%s' matched the %d argument(s):\n (%s)\ncandidates:\n ", + stack.name().c_str(), stack.size(), stack.types().c_str()); + + for (const auto& function : functions) + { + auto func = INT2PTR(detail::function_base*, SvIV(function.sv())); + Perl_sv_catpvf(aTHX_ err, "%s\n ", func->get_signature().c_str()); + } + + err = sv_2mortal(err); + throw std::runtime_error(SvPV_nolen(err)); + } + catch (std::exception& e) + { + Perl_croak(aTHX_ "%s", e.what()); + } + catch (...) + { + Perl_croak(aTHX_ "unhandled exception"); + } +} + +} // namespace perlbind diff --git a/libs/perlbind/src/perlbind.natvis b/libs/perlbind/src/perlbind.natvis new file mode 100644 index 000000000..11e30d724 --- /dev/null +++ b/libs/perlbind/src/perlbind.natvis @@ -0,0 +1,112 @@ + + + + + {{ m_sv={(void*)m_sv} refcnt={m_sv->sv_refcnt,d} type={(svtype)(m_sv->sv_flags & 0xff),d} }} + + m_sv + + + + {{ size={(m_av->sv_any)->xav_fill + 1,d} refcnt={m_av->sv_refcnt,d} } + + m_av + + + + {{ size={(m_hv->sv_any)->xhv_keys,d} refcnt={m_hv->sv_refcnt,d} }} + + m_hv + + + + + + {{ refcnt={sv_refcnt,d} type={(svtype)(sv_flags & 0xff),d} }} + + sv_refcnt,d + (svtype)(sv_flags & 0xff),d + sv_u.svu_rv + + (av*)this + + (hv*)this + + (gv*)this + + ((XPVMG*)(sv_any)) + + sv_u.svu_pv,na + sv_u.svu_iv,i + sv_u.svu_uv + sv_u.svu_nv,f + sv_u.svu_rv + + + + + {{ size={(sv_any)->xav_fill + 1,d} refcnt={sv_refcnt,d} type={(svtype)(sv_flags & 0xff),d} } + + sv_refcnt,d + (sv_any)->xav_fill + 1 + (sv_any)->xav_max + + (sv_any)->xav_fill + 1 + (sv_u).svu_array + + + + + + {{ size={(sv_any)->xhv_keys,d} refcnt={sv_refcnt,d} type={(svtype)(sv_flags & 0xff),d} }} + + sv_refcnt,d + (sv_any)->xhv_keys + (sv_any)->xhv_max + + + + + + + + + + index++ + bucket_inc = __findnonnull(bucket_array + index, max_index - index) + + index += bucket_inc + entry = bucket_array[index] + + (entry->he_valu).hent_val + entry = entry->hent_next + + + + + + + {{ refcnt={sv_refcnt,d} type={(svtype)(sv_flags & 0xff),d} }} + + sv_refcnt,d + (svtype)(sv_flags & 0xff),d + (sv_u.svu_gp)->gp_sv + (sv_u.svu_gp)->gp_cv + (sv_u.svu_gp)->gp_av + (sv_u.svu_gp)->gp_hv + (sv_u.svu_gp) + + + diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 85665f1c4..98341a858 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -33,6 +33,31 @@ extern Zone *zone; +#ifdef EMBPERL_XS +void perl_register_quest(); +#ifdef EMBPERL_XS_CLASSES +void perl_register_mob(); +void perl_register_npc(); +void perl_register_client(); +void perl_register_corpse(); +void perl_register_entitylist(); +void perl_register_perlpacket(); +void perl_register_group(); +void perl_register_raid(); +void perl_register_inventory(); +void perl_register_questitem(); +void perl_register_spell(); +void perl_register_hateentry(); +void perl_register_object(); +void perl_register_doors(); +void perl_register_expedition(); +void perl_register_expedition_lock_messages(); +#ifdef BOTS +void perl_register_bot(); +#endif // BOTS +#endif // EMBPERL_XS_CLASSES +#endif // EMBPERL_XS + const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_SAY", "EVENT_ITEM", @@ -804,7 +829,7 @@ int PerlembParser::SendCommands( perl->eval(cmd.c_str()); #ifdef EMBPERL_XS_CLASSES - + dTHX; { std::string cl = (std::string) "$" + (std::string) pkgprefix + (std::string) "::client"; std::string np = (std::string) "$" + (std::string) pkgprefix + (std::string) "::npc"; @@ -946,76 +971,31 @@ int PerlembParser::SendCommands( void PerlembParser::MapFunctions() { + dTHX; _empty_sv = newSV(0); - perl->eval( - "{" - "package quest;" - "&boot_quest;" //load our quest XS - #ifdef EMBPERL_XS_CLASSES - "package Mob;" - "&boot_Mob;" //load our Mob XS - - "package Client;" - "our @ISA = qw(Mob);" //client inherits mob. - "&boot_Mob;" //load our Mob XS - "&boot_Client;" //load our Client XS - - "package NPC;" - "our @ISA = qw(Mob);" //NPC inherits mob. - "&boot_Mob;" //load our Mob XS - "&boot_NPC;" //load our NPC XS - - "package Corpse;" - "our @ISA = qw(Mob);" //Corpse inherits mob. - "&boot_Mob;" //load our Mob XS - "&boot_Corpse;" //load our Mob XS - - "package EntityList;" - "&boot_EntityList;" //load our EntityList XS - - "package PerlPacket;" - "&boot_PerlPacket;" //load our PerlPacket XS - - "package Group;" - "&boot_Group;" //load our Group XS - - "package Raid;" - "&boot_Raid;" //load our Raid XS - - "package Inventory;" - "&boot_Inventory;" // load inventory XS - - "package QuestItem;" - "&boot_QuestItem;" // load quest Item XS - - "package Spell;" - "&boot_Spell;" // load quest Spell XS - - "package HateEntry;" - "&boot_HateEntry;" // load quest Hate XS - - "package Object;" - "&boot_Object;" // load quest Object XS - - "package Doors;" - "&boot_Doors;" // load quest Doors XS - - "package Expedition;" - "&boot_Expedition;" - + perl_register_quest(); +#ifdef EMBPERL_XS_CLASSES + perl_register_mob(); + perl_register_npc(); + perl_register_client(); + perl_register_corpse(); + perl_register_entitylist(); + perl_register_perlpacket(); + perl_register_group(); + perl_register_raid(); + perl_register_inventory(); + perl_register_questitem(); + perl_register_spell(); + perl_register_hateentry(); + perl_register_object(); + perl_register_doors(); + perl_register_expedition(); + perl_register_expedition_lock_messages(); #ifdef BOTS - "package Bot;" - "our @ISA = qw(NPC);" // Bot inherits NPC - "&boot_Mob;" // load our Mob XS - "&boot_NPC;" // load our NPC XS - "&boot_Bot;" // load our Bot XS -#endif - - #endif - "package main;" - "}" - ); + perl_register_bot(); +#endif // BOTS +#endif // EMBPERL_XS_CLASSES } void PerlembParser::GetQuestTypes( diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 9ad63ae53..b71e2e122 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -26,7 +26,7 @@ #include "../common/misc_functions.h" #include "../common/eqemu_logsys.h" -#include "embparser.h" +#include "embperl.h" #include "embxs.h" #include "entity.h" #include "expedition.h" @@ -40,3244 +40,1404 @@ extern Zone *zone; extern QueryServ *QServ; -/* - -Some useful perl API info: - -SvUV == string to unsigned value (char->ulong) -SvIV == string to signed value (char->long) -SvNV == string to real value (float,double) -SvPV_nolen == string with no length restriction - -*/ - #ifdef EMBPERL_XS_CLASSES //Any creation of new Client objects gets the current quest Client -XS(XS_Client_new); -XS(XS_Client_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::Client::new()"); - { - Client *RETVAL; - - RETVAL = quest_manager.GetInitiator(); - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl__Client_new() +{ + return quest_manager.GetInitiator(); } //Any creation of new NPC objects gets the current quest NPC -XS(XS_NPC_new); -XS(XS_NPC_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::NPC::new()"); - { - NPC *RETVAL; - - RETVAL = quest_manager.GetNPC(); - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); +NPC* Perl__NPC_new() +{ + return quest_manager.GetNPC(); } //Any creation of new NPC objects gets the current quest NPC -XS(XS_EntityList_new); -XS(XS_EntityList_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::EntityList::new()"); - { - EntityList *RETVAL; - - RETVAL = &entity_list; - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "EntityList", (void *) RETVAL); - } - XSRETURN(1); +EntityList* Perl__EntityList_new() +{ + return &entity_list; } //Any creation of new inventory gets the curreny inventory -XS(XS_Inventory_new); -XS(XS_Inventory_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::Inventory::new()"); - - EQ::InventoryProfile* RETVAL; - - RETVAL = quest_manager.GetInventory(); - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "Inventory", (void *) RETVAL); - - XSRETURN(1); +EQ::InventoryProfile* Perl__Inventory_new() +{ + return quest_manager.GetInventory(); } //Any creation of new quest items gets the current quest item -XS(XS_QuestItem_new); -XS(XS_QuestItem_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::QuestItem::new()"); - - EQ::ItemInstance *RETVAL; - - RETVAL = quest_manager.GetQuestItem(); - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL); - - XSRETURN(1); +EQ::ItemInstance* Perl__QuestItem_new() +{ + return quest_manager.GetQuestItem(); } //Any creation of new Spells gets the current Spell -XS(XS_Spell_new); -XS(XS_Spell_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::Spell::new()"); - - const SPDat_Spell_Struct* spell = quest_manager.GetQuestSpell(); - ST(0) = sv_newmortal(); - if (spell) - sv_setref_pv(ST(0), "Spell", (void *) spell); - - XSRETURN(1); -} - -//Any creation of new quest items gets the current quest item -XS(XS_MobList_new); -XS(XS_MobList_new) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::MobList::new()"); - - ListElement *RETVAL; - - RETVAL = nullptr; - ST(0) = sv_newmortal(); - if (RETVAL) - sv_setref_pv(ST(0), "MobList", (void *) RETVAL); - - XSRETURN(1); +SPDat_Spell_Struct* Perl__Spell_new() +{ + // should be safe, it's read only in perl (could also use proxy lika lua) + return const_cast(quest_manager.GetQuestSpell()); } #endif //EMBPERL_XS_CLASSES -XS(XS__echo); // prototype to pass -Wmissing-prototypes -XS(XS__echo) { - dXSARGS; - - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::echo(int emote_color_id, string message)"); - - quest_manager.echo(SvUV(ST(0)), SvPV_nolen(ST(1))); - - XSRETURN_EMPTY; +void Perl__echo(int emote_color_id, const char* message) +{ + quest_manager.echo(emote_color_id, message); } -XS(XS__say); // prototype to pass -Wmissing-prototypes -XS(XS__say) { - dXSARGS; - +void Perl__say(const char* message) +{ Journal::Options opts; // we currently default to these - opts.speak_mode = Journal::SpeakMode::Say; + opts.speak_mode = Journal::SpeakMode::Say; opts.journal_mode = Journal::Mode::Log2; - opts.language = 0; + opts.language = 0; opts.message_type = Chat::NPCQuestSay; - if (items == 0 || items > 5) { - Perl_croak(aTHX_ "Usage: quest::say(string message, [int language_id], [int message_type], [int speak_mode], [int journal_mode])"); - } else if (items == 2) { - opts.language = (int)SvIV(ST(1)); - } else if (items == 3) { - opts.language = (int)SvIV(ST(1)); - opts.message_type = (int)SvIV(ST(2)); - } else if (items == 4) { - opts.language = (int)SvIV(ST(1)); - opts.message_type = (int)SvIV(ST(2)); - opts.speak_mode = (Journal::SpeakMode)SvIV(ST(3)); - } else if (items == 5) { - opts.language = (int)SvIV(ST(1)); - opts.message_type = (int)SvIV(ST(2)); - opts.speak_mode = (Journal::SpeakMode)SvIV(ST(3)); - opts.journal_mode = (Journal::Mode)SvIV(ST(4)); - } - quest_manager.say(SvPV_nolen(ST(0)), opts); - - XSRETURN_EMPTY; + quest_manager.say(message, opts); } -XS(XS__me); // prototype to pass -Wmissing-prototypes -XS(XS__me) { - dXSARGS; +void Perl__say(const char* message, int language_id) +{ + Journal::Options opts; + opts.speak_mode = Journal::SpeakMode::Say; + opts.journal_mode = Journal::Mode::Log2; + opts.language = language_id; + opts.message_type = Chat::NPCQuestSay; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::me(string message)"); - - quest_manager.me(SvPV_nolen(ST(0))); - - XSRETURN_EMPTY; + quest_manager.say(message, opts); } -XS(XS__summonitem); // prototype to pass -Wmissing-prototypes -XS(XS__summonitem) { - dXSARGS; - if (items == 1) - quest_manager.summonitem(SvUV(ST(0))); - else if (items == 2) - quest_manager.summonitem(SvUV(ST(0)), SvUV(ST(1))); - else - Perl_croak(aTHX_ "Usage: quest::summonitem(int item_id, [int charges])"); - XSRETURN_EMPTY; +void Perl__say(const char* message, int language_id, int message_type) +{ + Journal::Options opts; + opts.speak_mode = Journal::SpeakMode::Say; + opts.journal_mode = Journal::Mode::Log2; + opts.language = language_id; + opts.message_type = message_type; + + quest_manager.say(message, opts); } -XS(XS__write); -XS(XS__write) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::write(string file_name, string message)"); +void Perl__say(const char* message, int language_id, int message_type, int speak_mode) +{ + Journal::Options opts; + opts.speak_mode = static_cast(speak_mode); + opts.journal_mode = Journal::Mode::Log2; + opts.language = language_id; + opts.message_type = message_type; - char *file = (char *) SvPV_nolen(ST(0)); - char *message = (char *) SvPV_nolen(ST(1)); + quest_manager.say(message, opts); +} +void Perl__say(const char* message, int language_id, int message_type, int speak_mode, int journal_mode) +{ + Journal::Options opts; + opts.speak_mode = static_cast(speak_mode); + opts.journal_mode = static_cast(journal_mode); + opts.language = language_id; + opts.message_type = message_type; + + quest_manager.say(message, opts); +} + +void Perl__me(const char* message) +{ + quest_manager.me(message); +} + +void Perl__summonitem(int item_id) +{ + quest_manager.summonitem(item_id); +} + +void Perl__summonitem(int item_id, int charges) +{ + quest_manager.summonitem(item_id, charges); +} + +void Perl__write(const char* file, const char* message) +{ quest_manager.write(file, message); - - XSRETURN_EMPTY; } -XS(XS__spawn); -XS(XS__spawn) { - dXSARGS; - if (items != 6) - Perl_croak(aTHX_ "Usage: quest::spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z)"); - - uint16 RETVAL; - dXSTARG; - - int npc_type_id = (int) SvIV(ST(0)); - int grid_id = (int) SvIV(ST(1)); - int int_unused = (int) SvIV(ST(2)); - auto position = glm::vec4((float) SvNV(ST(3)), (float) SvNV(ST(4)), (float) SvNV(ST(5)), 0.0f); - - Mob *r = quest_manager.spawn2(npc_type_id, grid_id, int_unused, position); - RETVAL = (r != nullptr) ? r->GetID() : 0; - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__spawn(int npc_type_id, int grid_id, int unused, float x, float y, float z) +{ + auto position = glm::vec4(x, y, z, 0.0f); + Mob* mob = quest_manager.spawn2(npc_type_id, grid_id, unused, position); + return mob ? mob->GetID() : 0; } -XS(XS__spawn2); -XS(XS__spawn2) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::spawn2(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, float heading)"); - - uint16 RETVAL; - dXSTARG; - - int npc_type_id = (int) SvIV(ST(0)); - int grid_id = (int) SvIV(ST(1)); - int int_unused = (int) SvIV(ST(2)); - auto position = glm::vec4((float) SvNV(ST(3)), (float) SvNV(ST(4)), (float) SvNV(ST(5)), (float) SvNV(ST(6))); - - Mob *r = quest_manager.spawn2(npc_type_id, grid_id, int_unused, position); - RETVAL = (r != nullptr) ? r->GetID() : 0; - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__spawn2(int npc_type_id, int grid_id, int unused, float x, float y, float z, float heading) +{ + auto position = glm::vec4(x, y, z, heading); + Mob* mob = quest_manager.spawn2(npc_type_id, grid_id, unused, position); + return mob ? mob->GetID() : 0; } -XS(XS__unique_spawn); -XS(XS__unique_spawn) { - dXSARGS; - if (items != 6 && items != 7) - Perl_croak(aTHX_ "Usage: quest::unique_spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, [float heading])"); - - uint16 RETVAL; - dXSTARG; - - int npc_type_id = (int) SvIV(ST(0)); - int grid_id = (int) SvIV(ST(1)); - int int_unused = (int) SvIV(ST(2)); - float x = (float) SvNV(ST(3)); - float y = (float) SvNV(ST(4)); - float z = (float) SvNV(ST(5)); - float heading = 0; - if (items == 7) - heading = (float) SvNV(ST(6)); - - Mob *r = quest_manager.unique_spawn(npc_type_id, grid_id, int_unused, glm::vec4(x, y, z, heading)); - RETVAL = (r != nullptr) ? r->GetID() : 0; - - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__unique_spawn(int npc_type_id, int grid_id, int unused, float x, float y, float z) +{ + auto position = glm::vec4(x, y, z, 0.0f); + Mob* mob = quest_manager.unique_spawn(npc_type_id, grid_id, unused, position); + return mob ? mob->GetID() : 0; } -XS(XS__spawn_from_spawn2); -XS(XS__spawn_from_spawn2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::spawn_from_spawn2(int spawn2_id)"); - - uint16 RETVAL; - dXSTARG; - - int spawn2_id = (int) SvIV(ST(0)); - - Mob *r = quest_manager.spawn_from_spawn2(spawn2_id); - RETVAL = (r != nullptr) ? r->GetID() : 0; - - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__unique_spawn(int npc_type_id, int grid_id, int unused, float x, float y, float z, float heading) +{ + auto position = glm::vec4(x, y, z, heading); + Mob* mob = quest_manager.unique_spawn(npc_type_id, grid_id, unused, position); + return mob ? mob->GetID() : 0; } -XS(XS__enable_spawn2); -XS(XS__enable_spawn2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::enable_spawn2(int spawn2_id)"); - - int spawn2_id = (int) SvIV(ST(0)); +int Perl__spawn_from_spawn2(uint32_t spawn2_id) +{ + Mob* mob = quest_manager.spawn_from_spawn2(spawn2_id); + return mob ? mob->GetID() : 0; +} +void Perl__enable_spawn2(uint32_t spawn2_id) +{ quest_manager.enable_spawn2(spawn2_id); - XSRETURN_EMPTY; } -XS(XS__disable_spawn2); -XS(XS__disable_spawn2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::disable_spawn2(int spawn2_id)"); - - int spawn2_id = (int) SvIV(ST(0)); - +void Perl__disable_spawn2(uint32_t spawn2_id) +{ quest_manager.disable_spawn2(spawn2_id); - XSRETURN_EMPTY; } -XS(XS__setstat); -XS(XS__setstat) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::setstat(stat_id, int_value)"); - - int stat_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - +void Perl__setstat(int stat_id, int int_value) +{ quest_manager.setstat(stat_id, int_value); - - XSRETURN_EMPTY; } -XS(XS__incstat); //old setstat command aza -XS(XS__incstat) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::incstat(int stat_id, int value)"); - - int stat_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - +void Perl__incstat(int stat_id, int int_value) +{ quest_manager.incstat(stat_id, int_value); - - XSRETURN_EMPTY; } -XS(XS__getinventoryslotid); -XS(XS__getinventoryslotid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getinventoryslotid(string identifier)"); +int Perl__getinventoryslotid(std::string identifier) +{ + int result = EQ::invslot::SLOT_INVALID; - int16 RETVAL = EQ::invslot::SLOT_INVALID; - dXSTARG; - - std::string identifier = (Const_char *)SvPV_nolen(ST(0)); - for (std::string::size_type i = 0; i < identifier.length(); ++i) + for (std::string::size_type i = 0; i < identifier.size(); ++i) identifier[i] = std::tolower(identifier[i]); if (identifier.find('.') == std::string::npos) { - if (identifier == "invalid") RETVAL = EQ::invslot::SLOT_INVALID; - else if (identifier == "charm") RETVAL = EQ::invslot::slotCharm; - else if (identifier == "ear1") RETVAL = EQ::invslot::slotEar1; - else if (identifier == "head") RETVAL = EQ::invslot::slotHead; - else if (identifier == "face") RETVAL = EQ::invslot::slotFace; - else if (identifier == "ear2") RETVAL = EQ::invslot::slotEar2; - else if (identifier == "neck") RETVAL = EQ::invslot::slotNeck; - else if (identifier == "shoulders") RETVAL = EQ::invslot::slotShoulders; - else if (identifier == "arms") RETVAL = EQ::invslot::slotArms; - else if (identifier == "back") RETVAL = EQ::invslot::slotBack; - else if (identifier == "wrist1") RETVAL = EQ::invslot::slotWrist1; - else if (identifier == "wrist2") RETVAL = EQ::invslot::slotWrist2; - else if (identifier == "range") RETVAL = EQ::invslot::slotRange; - else if (identifier == "hands") RETVAL = EQ::invslot::slotHands; - else if (identifier == "primary") RETVAL = EQ::invslot::slotPrimary; - else if (identifier == "secondary") RETVAL = EQ::invslot::slotSecondary; - else if (identifier == "finger1") RETVAL = EQ::invslot::slotFinger1; - else if (identifier == "finger2") RETVAL = EQ::invslot::slotFinger2; - else if (identifier == "chest") RETVAL = EQ::invslot::slotChest; - else if (identifier == "legs") RETVAL = EQ::invslot::slotLegs; - else if (identifier == "feet") RETVAL = EQ::invslot::slotFeet; - else if (identifier == "waist") RETVAL = EQ::invslot::slotWaist; - else if (identifier == "powersource") RETVAL = EQ::invslot::slotPowerSource; - else if (identifier == "ammo") RETVAL = EQ::invslot::slotAmmo; - else if (identifier == "general1") RETVAL = EQ::invslot::slotGeneral1; - else if (identifier == "general2") RETVAL = EQ::invslot::slotGeneral2; - else if (identifier == "general3") RETVAL = EQ::invslot::slotGeneral3; - else if (identifier == "general4") RETVAL = EQ::invslot::slotGeneral4; - else if (identifier == "general5") RETVAL = EQ::invslot::slotGeneral5; - else if (identifier == "general6") RETVAL = EQ::invslot::slotGeneral6; - else if (identifier == "general7") RETVAL = EQ::invslot::slotGeneral7; - else if (identifier == "general8") RETVAL = EQ::invslot::slotGeneral8; - else if (identifier == "general9") RETVAL = EQ::invslot::slotGeneral9; - else if (identifier == "general10") RETVAL = EQ::invslot::slotGeneral10; - else if (identifier == "cursor") RETVAL = EQ::invslot::slotCursor; - else if (identifier == "tradeskill") RETVAL = EQ::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; - else if (identifier == "augment") RETVAL = EQ::invslot::SLOT_AUGMENT_GENERIC_RETURN; + if (identifier == "invalid") result = EQ::invslot::SLOT_INVALID; + else if (identifier == "charm") result = EQ::invslot::slotCharm; + else if (identifier == "ear1") result = EQ::invslot::slotEar1; + else if (identifier == "head") result = EQ::invslot::slotHead; + else if (identifier == "face") result = EQ::invslot::slotFace; + else if (identifier == "ear2") result = EQ::invslot::slotEar2; + else if (identifier == "neck") result = EQ::invslot::slotNeck; + else if (identifier == "shoulders") result = EQ::invslot::slotShoulders; + else if (identifier == "arms") result = EQ::invslot::slotArms; + else if (identifier == "back") result = EQ::invslot::slotBack; + else if (identifier == "wrist1") result = EQ::invslot::slotWrist1; + else if (identifier == "wrist2") result = EQ::invslot::slotWrist2; + else if (identifier == "range") result = EQ::invslot::slotRange; + else if (identifier == "hands") result = EQ::invslot::slotHands; + else if (identifier == "primary") result = EQ::invslot::slotPrimary; + else if (identifier == "secondary") result = EQ::invslot::slotSecondary; + else if (identifier == "finger1") result = EQ::invslot::slotFinger1; + else if (identifier == "finger2") result = EQ::invslot::slotFinger2; + else if (identifier == "chest") result = EQ::invslot::slotChest; + else if (identifier == "legs") result = EQ::invslot::slotLegs; + else if (identifier == "feet") result = EQ::invslot::slotFeet; + else if (identifier == "waist") result = EQ::invslot::slotWaist; + else if (identifier == "powersource") result = EQ::invslot::slotPowerSource; + else if (identifier == "ammo") result = EQ::invslot::slotAmmo; + else if (identifier == "general1") result = EQ::invslot::slotGeneral1; + else if (identifier == "general2") result = EQ::invslot::slotGeneral2; + else if (identifier == "general3") result = EQ::invslot::slotGeneral3; + else if (identifier == "general4") result = EQ::invslot::slotGeneral4; + else if (identifier == "general5") result = EQ::invslot::slotGeneral5; + else if (identifier == "general6") result = EQ::invslot::slotGeneral6; + else if (identifier == "general7") result = EQ::invslot::slotGeneral7; + else if (identifier == "general8") result = EQ::invslot::slotGeneral8; + else if (identifier == "general9") result = EQ::invslot::slotGeneral9; + else if (identifier == "general10") result = EQ::invslot::slotGeneral10; + else if (identifier == "cursor") result = EQ::invslot::slotCursor; + else if (identifier == "tradeskill") result = EQ::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE; + else if (identifier == "augment") result = EQ::invslot::SLOT_AUGMENT_GENERIC_RETURN; } else { - if (identifier == "possessions.begin") RETVAL = EQ::invslot::POSSESSIONS_BEGIN; - else if (identifier == "possessions.end") RETVAL = EQ::invslot::POSSESSIONS_END; - else if (identifier == "equipment.begin") RETVAL = EQ::invslot::EQUIPMENT_BEGIN; - else if (identifier == "equipment.end") RETVAL = EQ::invslot::EQUIPMENT_END; - else if (identifier == "general.begin") RETVAL = EQ::invslot::GENERAL_BEGIN; - else if (identifier == "general.end") RETVAL = EQ::invslot::GENERAL_END; - else if (identifier == "possessionsbags.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN; - else if (identifier == "possessionsbags.end") RETVAL = EQ::invbag::CURSOR_BAG_END; - else if (identifier == "generalbags.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN; - else if (identifier == "generalbags.end") RETVAL = EQ::invbag::GENERAL_BAGS_END; - else if (identifier == "general1bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN; - else if (identifier == "general1bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 9; - else if (identifier == "general2bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 10; - else if (identifier == "general2bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 19; - else if (identifier == "general3bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 20; - else if (identifier == "general3bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 29; - else if (identifier == "general4bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 30; - else if (identifier == "general4bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 39; - else if (identifier == "general5bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 40; - else if (identifier == "general5bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 49; - else if (identifier == "general6bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 50; - else if (identifier == "general6bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 59; - else if (identifier == "general7bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 60; - else if (identifier == "general7bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 69; - else if (identifier == "general8bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 70; - else if (identifier == "general8bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 79; - else if (identifier == "general9bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 80; - else if (identifier == "general9bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 89; - else if (identifier == "general10bag.begin") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 90; - else if (identifier == "general10bag.end") RETVAL = EQ::invbag::GENERAL_BAGS_BEGIN + 99; - else if (identifier == "cursorbag.begin") RETVAL = EQ::invbag::CURSOR_BAG_BEGIN; - else if (identifier == "cursorbag.end") RETVAL = EQ::invbag::CURSOR_BAG_END; - else if (identifier == "bank.begin") RETVAL = EQ::invslot::BANK_BEGIN; - else if (identifier == "bank.end") RETVAL = EQ::invslot::BANK_END; - else if (identifier == "bankbags.begin") RETVAL = EQ::invbag::BANK_BAGS_BEGIN; - else if (identifier == "bankbags.end") RETVAL = EQ::invbag::BANK_BAGS_END; - else if (identifier == "sharedbank.begin") RETVAL = EQ::invslot::SHARED_BANK_BEGIN; - else if (identifier == "sharedbank.end") RETVAL = EQ::invslot::SHARED_BANK_END; - else if (identifier == "sharedbankbags.begin") RETVAL = EQ::invbag::SHARED_BANK_BAGS_BEGIN; - else if (identifier == "sharedbankbags.end") RETVAL = EQ::invbag::SHARED_BANK_BAGS_END; - else if (identifier == "bagslot.begin") RETVAL = EQ::invbag::SLOT_BEGIN; - else if (identifier == "bagslot.end") RETVAL = EQ::invbag::SLOT_END; - else if (identifier == "augsocket.begin") RETVAL = EQ::invaug::SOCKET_BEGIN; - else if (identifier == "augsocket.end") RETVAL = EQ::invaug::SOCKET_END; + if (identifier == "possessions.begin") result = EQ::invslot::POSSESSIONS_BEGIN; + else if (identifier == "possessions.end") result = EQ::invslot::POSSESSIONS_END; + else if (identifier == "equipment.begin") result = EQ::invslot::EQUIPMENT_BEGIN; + else if (identifier == "equipment.end") result = EQ::invslot::EQUIPMENT_END; + else if (identifier == "general.begin") result = EQ::invslot::GENERAL_BEGIN; + else if (identifier == "general.end") result = EQ::invslot::GENERAL_END; + else if (identifier == "possessionsbags.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN; + else if (identifier == "possessionsbags.end") result = EQ::invbag::CURSOR_BAG_END; + else if (identifier == "generalbags.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN; + else if (identifier == "generalbags.end") result = EQ::invbag::GENERAL_BAGS_END; + else if (identifier == "general1bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN; + else if (identifier == "general1bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 9; + else if (identifier == "general2bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 10; + else if (identifier == "general2bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 19; + else if (identifier == "general3bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 20; + else if (identifier == "general3bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 29; + else if (identifier == "general4bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 30; + else if (identifier == "general4bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 39; + else if (identifier == "general5bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 40; + else if (identifier == "general5bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 49; + else if (identifier == "general6bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 50; + else if (identifier == "general6bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 59; + else if (identifier == "general7bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 60; + else if (identifier == "general7bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 69; + else if (identifier == "general8bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 70; + else if (identifier == "general8bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 79; + else if (identifier == "general9bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 80; + else if (identifier == "general9bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 89; + else if (identifier == "general10bag.begin") result = EQ::invbag::GENERAL_BAGS_BEGIN + 90; + else if (identifier == "general10bag.end") result = EQ::invbag::GENERAL_BAGS_BEGIN + 99; + else if (identifier == "cursorbag.begin") result = EQ::invbag::CURSOR_BAG_BEGIN; + else if (identifier == "cursorbag.end") result = EQ::invbag::CURSOR_BAG_END; + else if (identifier == "bank.begin") result = EQ::invslot::BANK_BEGIN; + else if (identifier == "bank.end") result = EQ::invslot::BANK_END; + else if (identifier == "bankbags.begin") result = EQ::invbag::BANK_BAGS_BEGIN; + else if (identifier == "bankbags.end") result = EQ::invbag::BANK_BAGS_END; + else if (identifier == "sharedbank.begin") result = EQ::invslot::SHARED_BANK_BEGIN; + else if (identifier == "sharedbank.end") result = EQ::invslot::SHARED_BANK_END; + else if (identifier == "sharedbankbags.begin") result = EQ::invbag::SHARED_BANK_BAGS_BEGIN; + else if (identifier == "sharedbankbags.end") result = EQ::invbag::SHARED_BANK_BAGS_END; + else if (identifier == "bagslot.begin") result = EQ::invbag::SLOT_BEGIN; + else if (identifier == "bagslot.end") result = EQ::invbag::SLOT_END; + else if (identifier == "augsocket.begin") result = EQ::invaug::SOCKET_BEGIN; + else if (identifier == "augsocket.end") result = EQ::invaug::SOCKET_END; } - XSprePUSH; - PUSHi((IV) RETVAL); - XSRETURN(1); + return result; } -XS(XS__castspell); -XS(XS__castspell) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::castspell(int spell_id, int target_id)"); - - int spell_id = (int) SvIV(ST(0)); - int target_id = (int) SvIV(ST(1)); - - quest_manager.castspell(spell_id, target_id); - - XSRETURN_EMPTY; -} - -XS(XS__selfcast); -XS(XS__selfcast) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::selfcast(int spell_id)"); - - int spell_id = (int) SvIV(ST(0)); - - quest_manager.selfcast(spell_id); - - XSRETURN_EMPTY; -} - -XS(XS__addloot); -XS(XS__addloot) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::addloot(uint32 item_id, uint16 charges = 0, [bool equip_item = true])"); - - uint32 item_id = (uint32) SvUV(ST(0)); - uint16 charges = 0; - bool equipitem = true; - - if (items > 1) - charges = (uint16) SvUV(ST(1)); - if (items > 2) - equipitem = (bool) SvTRUE(ST(2)); - - quest_manager.addloot(item_id, charges, equipitem); - - XSRETURN_EMPTY; -} - -XS(XS__zone); -XS(XS__zone) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::zone(string zone_name)"); - - char *zone_name = (char *) SvPV_nolen(ST(0)); - - quest_manager.Zone(zone_name); - - XSRETURN_EMPTY; -} - -XS(XS__zonegroup); -XS(XS__zonegroup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::zonegroup(string zone_name)"); - - char *zone_name = (char *) SvPV_nolen(ST(0)); - - quest_manager.ZoneGroup(zone_name); - - XSRETURN_EMPTY; -} - -XS(XS__zoneraid); -XS(XS__zoneraid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::zoneraid(string zone_name)"); - - char *zone_name = (char *) SvPV_nolen(ST(0)); - - quest_manager.ZoneRaid(zone_name); - - XSRETURN_EMPTY; -} - -XS(XS__hastimer); -XS(XS__hastimer) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::hastimer(string timer_name)"); - - bool RETVAL; - char *timer_name = (char *)SvPV_nolen(ST(0)); - - RETVAL = quest_manager.hastimer(timer_name); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__getremainingtimeMS); -XS(XS__getremainingtimeMS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getremainingtimeMS(string timer_name)"); - - uint32 RETVAL; - dXSTARG; - char *timer_name = (char *)SvPV_nolen(ST(0)); - - RETVAL = quest_manager.getremainingtimeMS(timer_name); - - XSprePUSH; - PUSHu((UV) RETVAL); - XSRETURN(1); -} - -XS(XS__gettimerdurationMS); -XS(XS__gettimerdurationMS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::gettimerdurationMS(string timer_name)"); - - uint32 RETVAL; - dXSTARG; - char *timer_name = (char *)SvPV_nolen(ST(0)); - - RETVAL = quest_manager.gettimerdurationMS(timer_name); - - XSprePUSH; - PUSHu((UV) RETVAL); - XSRETURN(1); -} - -XS(XS__settimer); -XS(XS__settimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::settimer(string timer_name, int seconds)"); - - char *timer_name = (char *) SvPV_nolen(ST(0)); - int seconds = (int) SvIV(ST(1)); - - quest_manager.settimer(timer_name, seconds); - - XSRETURN_EMPTY; -} - -XS(XS__settimerMS); -XS(XS__settimerMS) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::settimerMS(string timer_name, int milliseconds)"); - - char *timer_name = (char *) SvPV_nolen(ST(0)); - int milliseconds = (int) SvIV(ST(1)); - - quest_manager.settimerMS(timer_name, milliseconds); - - XSRETURN_EMPTY; -} - -XS(XS__stoptimer); -XS(XS__stoptimer) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::stoptimer(string timer_name)"); - - char *timer_name = (char *) SvPV_nolen(ST(0)); - - quest_manager.stoptimer(timer_name); - - XSRETURN_EMPTY; -} - -XS(XS__stopalltimers); -XS(XS__stopalltimers) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::stopalltimers()"); - - quest_manager.stopalltimers(); - - XSRETURN_EMPTY; -} - -XS(XS__emote); -XS(XS__emote) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::emote(string message)"); - - char *message = (char *) SvPV_nolen(ST(0)); - - quest_manager.emote(message); - - XSRETURN_EMPTY; -} - -XS(XS__shout); -XS(XS__shout) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::shout(string message)"); - - char *message = (char *) SvPV_nolen(ST(0)); - - quest_manager.shout(message); - - XSRETURN_EMPTY; -} - -XS(XS__shout2); -XS(XS__shout2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::shout2(string message)"); - - char *message = (char *) SvPV_nolen(ST(0)); - - quest_manager.shout2(message); - - XSRETURN_EMPTY; -} - -XS(XS__gmsay); -XS(XS__gmsay) { - dXSARGS; - if ((items < 1) || (items > 5)) - Perl_croak(aTHX_ "Usage: quest::gmsay(string message, [int color_id], [bool send_to_world = 0])"); - - char *message = (char *) SvPV_nolen(ST(0)); - int color_id = 7; - bool send_to_world = 0; - uint32 to_guilddbid = 0; - uint16 to_minstatus = 80; - - if (items > 1) { - color_id = (int) SvIV(ST(1)); - } - - if (items > 2) { - send_to_world = ((int) SvIV(ST(2))) == 0 ? false : true; - } - - if (items > 3) - to_guilddbid = (int) SvUV(ST(3)); - - if (items > 4) - to_minstatus = (int) SvUV(ST(4)); - - quest_manager.gmsay(message, color_id, send_to_world, to_guilddbid, to_minstatus); - - XSRETURN_EMPTY; -} - -XS(XS__depop); -XS(XS__depop) { - dXSARGS; - if (items < 0 || items > 1) - Perl_croak(aTHX_ "Usage: quest::depop(int npc_type_id = 0)"); - - int npc_type_id; - - if (items < 1) - npc_type_id = 0; - else - npc_type_id = (int) SvIV(ST(0)); - - - quest_manager.depop(npc_type_id); - - XSRETURN_EMPTY; -} - -XS(XS__depop_withtimer); -XS(XS__depop_withtimer) { - dXSARGS; - if (items < 0 || items > 1) - Perl_croak(aTHX_ "Usage: quest::depop_withtimer(int npc_type_id = 0)"); - - int npc_type_id; - - if (items < 1) - npc_type_id = 0; - else - npc_type_id = (int) SvIV(ST(0)); - - - quest_manager.depop_withtimer(npc_type_id); - - XSRETURN_EMPTY; -} - -XS(XS__depopall); -XS(XS__depopall) { - dXSARGS; - if (items < 0 || items > 1) - Perl_croak(aTHX_ "Usage: quest::depopall(int npc_type_id = 0)"); - - int npc_type_id; - - if (items < 1) - npc_type_id = 0; - else - npc_type_id = (int) SvIV(ST(0)); - - - quest_manager.depopall(npc_type_id); - - XSRETURN_EMPTY; -} - -XS(XS__settarget); -XS(XS__settarget) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::settarget(string target_enum ['npc_type', 'entity'], int target_id)"); - - char *target_enum = (char *) SvPV_nolen(ST(0)); - int target_id = (int) SvIV(ST(1)); - - quest_manager.settarget(target_enum, target_id); - - XSRETURN_EMPTY; -} - -XS(XS__follow); -XS(XS__follow) { - dXSARGS; - if (items != 1 && items != 2) - Perl_croak(aTHX_ "Usage: quest::follow(int entity_id, [int distance = 10])"); - - int entity_id = (int) SvIV(ST(0)); - int distance; - - if (items == 2) - distance = (int) SvIV(ST(1)); - else - distance = 10; - - quest_manager.follow(entity_id, distance); - - XSRETURN_EMPTY; -} - -XS(XS__sfollow); -XS(XS__sfollow) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::sfollow()"); - - - quest_manager.sfollow(); - - XSRETURN_EMPTY; -} - -XS(XS__changedeity); -XS(XS__changedeity) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::changedeity(int deity_id)"); - - int deity_id = (int) SvIV(ST(0)); - - quest_manager.changedeity(deity_id); - - XSRETURN_EMPTY; -} - -XS(XS__exp); -XS(XS__exp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::exp(int amount)"); - - int amt = (int) SvIV(ST(0)); - - quest_manager.exp(amt); - - XSRETURN_EMPTY; -} - -XS(XS__level); -XS(XS__level) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::level(int new_level)"); - - int newlevel = (int) SvIV(ST(0)); - - quest_manager.level(newlevel); - - XSRETURN_EMPTY; -} - -XS(XS__traindisc); -XS(XS__traindisc) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::traindisc(int tome_item_id)"); - - int discipline_tome_item_id = (int) SvIV(ST(0)); - - quest_manager.traindisc(discipline_tome_item_id); - - XSRETURN_EMPTY; -} - -XS(XS__isdisctome); -XS(XS__isdisctome) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::isdisctome(int item_id)"); - - bool RETVAL; - int item_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.isdisctome(item_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__getracename); -XS(XS__getracename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getracename(uint16 race_id)"); - - dXSTARG; - uint16 race_id = (int) SvIV(ST(0)); - std::string race_name = quest_manager.getracename(race_id); - - sv_setpv(TARG, race_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getspellname); -XS(XS__getspellname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getspellname(uint32 spell_id)"); - - dXSTARG; - uint32 spell_id = (int) SvIV(ST(0)); - std::string spell_name = quest_manager.getspellname(spell_id); - - sv_setpv(TARG, spell_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__get_spell_level); -XS(XS__get_spell_level) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::get_spell_level(uint16 spell_id, uint8 class_id)"); - - dXSTARG; - uint16 spell_id = (int)SvIV(ST(0)); - uint8 class_id = (int)SvIV(ST(1)); - uint8 spell_level = IsValidSpell(spell_id) ? GetSpellLevel(spell_id, class_id) : 0; - uint8 server_max_level = RuleI(Character, MaxLevel); - - if (spell_level && spell_level > server_max_level) - spell_level = 0; - - XSprePUSH; - PUSHu((UV)spell_level); - - XSRETURN(1); -} - -XS(XS__getskillname); -XS(XS__getskillname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getskillname(int skill_id)"); - - dXSTARG; - int skill_id = (int) SvIV(ST(0)); - std::string skill_name = quest_manager.getskillname(skill_id); - - sv_setpv(TARG, skill_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__safemove); -XS(XS__safemove) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::safemove()"); - - - quest_manager.safemove(); - - XSRETURN_EMPTY; -} - -XS(XS__rain); -XS(XS__rain) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::rain(int weather)"); - - int weather = (int) SvIV(ST(0)); - - quest_manager.rain(weather); - - XSRETURN_EMPTY; -} - -XS(XS__snow); -XS(XS__snow) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::snow(int weather)"); - - int weather = (int) SvIV(ST(0)); - - quest_manager.snow(weather); - - XSRETURN_EMPTY; -} - -XS(XS__surname); -XS(XS__surname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::surname(string last_name)"); - - std::string last_name = (std::string) SvPV_nolen(ST(0)); - - quest_manager.surname(last_name); - - XSRETURN_EMPTY; -} - -XS(XS__permaclass); -XS(XS__permaclass) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::permaclass(int class_id)"); - - int class_id = (int) SvIV(ST(0)); - - quest_manager.permaclass(class_id); - - XSRETURN_EMPTY; -} - -XS(XS__permarace); -XS(XS__permarace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::permarace(int race_id)"); - - int race_id = (int) SvIV(ST(0)); - - quest_manager.permarace(race_id); - - XSRETURN_EMPTY; -} - -XS(XS__permagender); -XS(XS__permagender) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::permagender(int gender_id)"); - - int gender_id = (int) SvIV(ST(0)); - - quest_manager.permagender(gender_id); - - XSRETURN_EMPTY; -} - -XS(XS__scribespells); -XS(XS__scribespells) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: quest::scribespells(int max_level, [int min_level = 1])"); - - uint16 RETVAL; - dXSTARG; - - uint8 max_level = (uint8) SvIV(ST(0)); - uint8 min_level = (uint8) SvIV(ST(1)); - - if (min_level) - RETVAL = quest_manager.scribespells(max_level, min_level); - else - RETVAL = quest_manager.scribespells(max_level); - - XSprePUSH; - PUSHu((UV) RETVAL); - XSRETURN(1); -} - -XS(XS__traindiscs); -XS(XS__traindiscs) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: quest::traindiscs(int max_level, [int min_level = 1])"); - - uint16 RETVAL; - dXSTARG; - - uint8 max_level = (uint8) SvIV(ST(0)); - uint8 min_level = (uint8) SvIV(ST(1)); - - if (min_level) - RETVAL = quest_manager.traindiscs(max_level, min_level); - else - RETVAL = quest_manager.traindiscs(max_level); - - XSprePUSH; - PUSHu((UV) RETVAL); - XSRETURN(1); -} - -XS(XS__unscribespells); -XS(XS__unscribespells) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::unscribespells()"); - - - quest_manager.unscribespells(); - - XSRETURN_EMPTY; -} - -XS(XS__untraindiscs); -XS(XS__untraindiscs) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::untraindiscs()"); - - - quest_manager.untraindiscs(); - - XSRETURN_EMPTY; -} - -XS(XS__givecash); -XS(XS__givecash) { - dXSARGS; - if (items < 1 || items > 4) { - Perl_croak(aTHX_ "Usage: quest::givecash(uint32 copper, [uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0])"); - } - - uint32 copper = (uint32) SvUV(ST(0)); - uint32 silver = 0; - uint32 gold = 0; - uint32 platinum = 0; - - if (items > 1) { - silver = (uint32) SvUV(ST(1)); - } - - if (items > 2) { - gold = (uint32) SvUV(ST(2)); - } - - if (items > 3) { - platinum = (uint32) SvUV(ST(3)); - } - - quest_manager.givecash(copper, silver, gold, platinum); - - XSRETURN_EMPTY; -} - -XS(XS__pvp); -XS(XS__pvp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::pvp(string mode [on|off])"); - - char *mode = (char *) SvPV_nolen(ST(0)); - - quest_manager.pvp(mode); - - XSRETURN_EMPTY; -} - -XS(XS__movepc); -XS(XS__movepc) { - dXSARGS; - if (items != 4 && items != 5) - Perl_croak(aTHX_ "Usage: quest::movepc(int zone_id, float x, float y, float z [float heading])"); - - int zone_id = (int) SvIV(ST(0)); - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - - if (items == 4) - - quest_manager.movepc(zone_id, x, y, z, 0.0f); - - else { - float heading = (float) SvNV(ST(4)); - quest_manager.movepc(zone_id, x, y, z, heading); - } - - XSRETURN_EMPTY; -} - -XS(XS__gmmove); -XS(XS__gmmove) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::gmmove(float x, float y, float z)"); - - float x = (float) SvNV(ST(0)); - float y = (float) SvNV(ST(1)); - float z = (float) SvNV(ST(2)); - - quest_manager.gmmove(x, y, z); - - XSRETURN_EMPTY; -} - -XS(XS__movegrp); -XS(XS__movegrp) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: quest::movegrp(int zone_id, float x, float y, float z)"); - - int zone_id = (int) SvIV(ST(0)); - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - - quest_manager.movegrp(zone_id, x, y, z); - - XSRETURN_EMPTY; -} - -XS(XS__doanim); -XS(XS__doanim) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::doanim(int animation_id)"); - - int anim_id = (int) SvIV(ST(0)); - - quest_manager.doanim(anim_id); - - XSRETURN_EMPTY; -} - -XS(XS__addskill); -XS(XS__addskill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::addskill(int skill_id, int value)"); - - int skill_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - - quest_manager.addskill(skill_id, int_value); - - XSRETURN_EMPTY; -} - -XS(XS__setlanguage); -XS(XS__setlanguage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::setlanguage(int skill_id, int value)"); - - int skill_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - - quest_manager.setlanguage(skill_id, int_value); - - XSRETURN_EMPTY; -} - -XS(XS__setskill); -XS(XS__setskill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::setskill(int skill_id, int value)"); - - int skill_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - - quest_manager.setskill(skill_id, int_value); - - XSRETURN_EMPTY; -} - -XS(XS__setallskill); -XS(XS__setallskill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::setallskill(int value)"); - - int int_value = (int) SvIV(ST(0)); - - quest_manager.setallskill(int_value); - - XSRETURN_EMPTY; -} - -XS(XS__attack); -XS(XS__attack) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::attack(string client_name)"); - - char *client_name = (char *) SvPV_nolen(ST(0)); - - quest_manager.attack(client_name); - - XSRETURN_EMPTY; -} - -XS(XS__attacknpc); -XS(XS__attacknpc) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::attacknpc(int npc_entity_id)"); - - int npc_entity_id = (int) SvIV(ST(0)); - - quest_manager.attacknpc(npc_entity_id); - - XSRETURN_EMPTY; -} - -XS(XS__attacknpctype); -XS(XS__attacknpctype) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::attacknpctype(int npc_type_id)"); - - int npc_type_id = (int) SvIV(ST(0)); - - quest_manager.attacknpctype(npc_type_id); - - XSRETURN_EMPTY; -} - -XS(XS__save); -XS(XS__save) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::save()"); - - - quest_manager.save(); - - XSRETURN_EMPTY; -} - -XS(XS__faction); -XS(XS__faction) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::faction(int faction_id, int value, [int temp = 0])"); - - int faction_id = (int) SvIV(ST(0)); - int int_value = (int) SvIV(ST(1)); - int temp; - - if (items == 2) - temp = 0; - else - temp = (int) SvIV(ST(2)); - - quest_manager.faction(faction_id, int_value, temp); - - XSRETURN_EMPTY; -} - -XS(XS__setsky); -XS(XS__setsky) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::setsky(uint8 sky)"); - - unsigned char new_sky = (unsigned char) SvUV(ST(0)); - - quest_manager.setsky(new_sky); - - XSRETURN_EMPTY; -} - -XS(XS__setguild); -XS(XS__setguild) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::setguild(int guild_id, int guild_rank_id)"); - - unsigned long new_guild_id = (unsigned long) SvUV(ST(0)); - int guild_rank_id = (int) SvIV(ST(1)); - - quest_manager.setguild(new_guild_id, guild_rank_id); - - XSRETURN_EMPTY; -} - -XS(XS__createguild); -XS(XS__createguild) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::createguild(string guild_name, string leader_name)"); - - char *guild_name = (char *) SvPV_nolen(ST(0)); - char *leader_name = (char *) SvPV_nolen(ST(1)); - - quest_manager.CreateGuild(guild_name, leader_name); - - XSRETURN_EMPTY; -} - -XS(XS__settime); -XS(XS__settime) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: quest::settime(int new_hour, int new_min, [bool update_world = true])"); - - if (items == 2) { - int new_hour = (int) SvIV(ST(0)); - int new_min = (int) SvIV(ST(1)); - quest_manager.settime(new_hour, new_min, true); - } else if (items == 3) { - int new_hour = (int) SvIV(ST(0)); - int new_min = (int) SvIV(ST(1)); - - int update_world = (int) SvIV(ST(2)); - if (update_world == 1) { - quest_manager.settime(new_hour, new_min, true); - } else { - quest_manager.settime(new_hour, new_min, false); - } - } - - XSRETURN_EMPTY; -} - -XS(XS__itemlink); -XS(XS__itemlink) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::itemlink(int item_id)"); - - int item_id = (int) SvIV(ST(0)); - - quest_manager.itemlink(item_id); - - XSRETURN_EMPTY; -} - -XS(XS__signalwith); -XS(XS__signalwith) { - dXSARGS; - - if (items == 2) { - int npc_id = (int) SvIV(ST(0)); - int signal_id = (int) SvIV(ST(1)); - quest_manager.signalwith(npc_id, signal_id); - } else if (items == 3) { - int npc_id = (int) SvIV(ST(0)); - int signal_id = (int) SvIV(ST(1)); - int wait = (int) SvIV(ST(2)); - quest_manager.signalwith(npc_id, signal_id, wait); - } else { - Perl_croak(aTHX_ "Usage: quest::signalwith(int npc_id, int signal_id, [int wait_ms])"); - } - - XSRETURN_EMPTY; -} - -XS(XS__signal); -XS(XS__signal) { - dXSARGS; - - if (items == 1) { - int npc_id = (int) SvIV(ST(0)); - quest_manager.signal(npc_id); - } else if (items == 2) { - int npc_id = (int) SvIV(ST(0)); - int wait = (int) SvIV(ST(1)); - quest_manager.signal(npc_id, wait); - } else { - Perl_croak(aTHX_ "Usage: quest::signal(int npc_id, [int wait_ms])"); - } - - XSRETURN_EMPTY; -} - -XS(XS__setglobal); -XS(XS__setglobal) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: quest::setglobal(stirng key, string value, int options, string duration)"); - - char *key = (char *) SvPV_nolen(ST(0)); - char *str_value = (char *) SvPV_nolen(ST(1)); - int options = (int) SvIV(ST(2)); - char *duration = (char *) SvPV_nolen(ST(3)); - - quest_manager.setglobal(key, str_value, options, duration); - - XSRETURN_EMPTY; -} - -XS(XS__targlobal); -XS(XS__targlobal) { - dXSARGS; - if (items != 6) - Perl_croak(aTHX_ "Usage: quest::targlobal(stirng key, string value, string duration, int npc_id, int chararacter_id, int zone_id)"); - - char *key = (char *) SvPV_nolen(ST(0)); - char *str_value = (char *) SvPV_nolen(ST(1)); - char *duration = (char *) SvPV_nolen(ST(2)); - int npc_id = (int) SvIV(ST(3)); - int char_id = (int) SvIV(ST(4)); - int zone_id = (int) SvIV(ST(5)); - - quest_manager.targlobal(key, str_value, duration, npc_id, char_id, zone_id); - - XSRETURN_EMPTY; -} - -XS(XS__delglobal); -XS(XS__delglobal) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::delglobal(string key)"); - - char *key = (char *) SvPV_nolen(ST(0)); - - quest_manager.delglobal(key); - - XSRETURN_EMPTY; -} - -XS(XS__ding); -XS(XS__ding) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::ding()"); - - - quest_manager.ding(); - - XSRETURN_EMPTY; -} - -XS(XS__rebind); -XS(XS__rebind) { - dXSARGS; - if (items < 4 || items > 5) - Perl_croak(aTHX_ "Usage: quest::rebind(int zone_id, float x, float y, float z, [float heading])"); - - int zone_id = (int) SvIV(ST(0)); - float target_x = (float) SvNV(ST(1)); - float target_y = (float) SvNV(ST(2)); - float target_z = (float) SvNV(ST(3)); - if (items > 4) { - float target_heading = (float) SvNV(ST(4)); - quest_manager.rebind(zone_id, glm::vec4(target_x, target_y, target_z, target_heading)); - } else { - quest_manager.rebind(zone_id, glm::vec3(target_x, target_y, target_z)); - } - XSRETURN_EMPTY; -} - -XS(XS__start); -XS(XS__start) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::start(int waypoint)"); - - int wp = (int) SvIV(ST(0)); - - quest_manager.start(wp); - - XSRETURN_EMPTY; -} - -XS(XS__stop); -XS(XS__stop) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::stop()"); - - - quest_manager.stop(); - - XSRETURN_EMPTY; -} - -XS(XS__pause); -XS(XS__pause) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::pause(int duration-ms)"); - - int duration = (int) SvIV(ST(0)); - - quest_manager.pause(duration); - - XSRETURN_EMPTY; -} - -XS(XS__moveto); -XS(XS__moveto) { - dXSARGS; - if (items != 3 && items != 4 && items != 5) - Perl_croak(aTHX_ "Usage: quest::moveto(float x, float y, float z, [float heading], [bool save_guard_location])"); - - float x = (float) SvNV(ST(0)); - float y = (float) SvNV(ST(1)); - float z = (float) SvNV(ST(2)); - float h; - bool saveguard; - - if (items > 3) - h = (float) SvNV(ST(3)); - else - h = 0; - - if (items > 4) - saveguard = (bool) SvTRUE(ST(4)); - else - saveguard = false; - - quest_manager.moveto(glm::vec4(x, y, z, h), saveguard); - - XSRETURN_EMPTY; -} - -XS(XS__resume); -XS(XS__resume) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::resume()"); - - - quest_manager.resume(); - - XSRETURN_EMPTY; -} - -XS(XS__addldonpoints); -XS(XS__addldonpoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::addldonpoints(uint32 theme_id, int points)"); - - uint32 theme_id = (uint32) SvUV(ST(0)); - int points = (int) SvIV(ST(1)); - quest_manager.addldonpoints(theme_id, points); - XSRETURN_EMPTY; -} - -XS(XS__addldonwin); -XS(XS__addldonwin) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::addldonwin(uint32 theme_id)"); - - uint32 theme_id = (uint32) SvUV(ST(0)); - quest_manager.addldonwin(theme_id); - XSRETURN_EMPTY; -} - -XS(XS__addldonloss); -XS(XS__addldonloss) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::addldonloss(uint32 theme_id)"); - - uint32 theme_id = (uint32) SvUV(ST(0)); - quest_manager.addldonloss(theme_id); - XSRETURN_EMPTY; -} - -XS(XS__setnexthpevent); -XS(XS__setnexthpevent) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::setnexthpevent(int at_mob_percentage)"); - - int at = (int)SvIV(ST(0)); - - quest_manager.setnexthpevent(at); - - XSRETURN_EMPTY; -} - -XS(XS__setnextinchpevent); -XS(XS__setnextinchpevent) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::setnextinchpevent(int at_mob_percentage)"); - - int at = (int)SvIV(ST(0)); - - quest_manager.setnextinchpevent(at); - - XSRETURN_EMPTY; -} - -XS(XS__sethp); -XS(XS__sethp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::sethp(int mob_health_percentage [0-100])"); - - int hpperc = (int)SvIV(ST(0)); - - quest_manager.sethp(hpperc); - - XSRETURN_EMPTY; -} - -XS(XS__respawn); -XS(XS__respawn) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::respawn(int npc_type_id, int grid_id)"); - - int npc_type_id = (int)SvIV(ST(0)); - int grid_id = (int)SvIV(ST(1)); - - quest_manager.respawn(npc_type_id, grid_id); - - XSRETURN_EMPTY; -} - -//64 bit windows seems to optimize something poorly here causing access violations. -//If you don't do anything with index before passing it to perl it gets optimized out -//Disabling optimization right now for msvc on this function is the best solution. -#ifdef _MSC_VER -#pragma optimize( "", off ) -#endif - -XS(XS__ChooseRandom); -XS(XS__ChooseRandom) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: quest::ChooseRandom(option1, option2, option3, option4, option5...[no limit])"); - - dXSTARG; - int index = zone->random.Int(0, items - 1); - SV* RETVAL = ST(index); - - XSprePUSH; - PUSHs(RETVAL); - - XSRETURN(1); //return 1 element from the stack (ST(0)) -} - -#ifdef _MSC_VER -#pragma optimize( "", on ) -#endif - -XS(XS__set_proximity); -XS(XS__set_proximity) { - dXSARGS; - if (items != 4 && items != 6 && items != 7) - Perl_croak(aTHX_ "Usage: quest::set_proximity(float min_x, float max_x, float min_y, float max_y, [float min_z], [float max_z], [say])"); - - float min_x = (float) SvNV(ST(0)); - float max_x = (float) SvNV(ST(1)); - float min_y = (float) SvNV(ST(2)); - float max_y = (float) SvNV(ST(3)); - - if (items == 4) - quest_manager.set_proximity(min_x, max_x, min_y, max_y); - else { - float min_z = (float) SvNV(ST(4)); - float max_z = (float) SvNV(ST(5)); - bool bSay = false; - if (items == 7) - bSay = (bool) SvTRUE(ST(6)); - quest_manager.set_proximity(min_x, max_x, min_y, max_y, min_z, max_z, bSay); - } - - XSRETURN_EMPTY; -} - -XS(XS__clear_proximity); -XS(XS__clear_proximity) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::clear_proximity()"); - - quest_manager.clear_proximity(); - - XSRETURN_EMPTY; -} - -XS(XS__enable_proximity_say); -XS(XS__enable_proximity_say) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::enable_proximity_say()"); - - quest_manager.enable_proximity_say(); - - XSRETURN_EMPTY; -} - -XS(XS__disable_proximity_say); -XS(XS__disable_proximity_say) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::disable_proximity_say()"); - - quest_manager.disable_proximity_say(); - - XSRETURN_EMPTY; -} - -XS(XS__setanim); -XS(XS__setanim) //Cisyouc: mob->setappearance() addition +void Perl__castspell(int spell_id, int target_id) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::setanim(int npc_type_id, int appearance_number[0-4]);"); - - quest_manager.setanim(SvUV(ST(0)), SvUV(ST(1))); - - XSRETURN_EMPTY; + quest_manager.castspell(spell_id, target_id); } -XS(XS__showgrid); -XS(XS__showgrid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::showgrid(int grid_id);"); - - quest_manager.showgrid(SvUV(ST(0))); - - XSRETURN_EMPTY; +void Perl__selfcast(int spell_id) +{ + quest_manager.selfcast(spell_id); } -XS(XS__spawn_condition); -XS(XS__spawn_condition) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::spawn_condition(string zone_short, [int instance_id], uint16 condition_id, int16 value)"); - - if (items == 3) { - char *zone_short = (char *) SvPV_nolen(ST(0)); - uint16 condition_id = (int) SvUV(ST(1)); - int16 int_value = (int) SvIV(ST(2)); - - quest_manager.spawn_condition(zone_short, zone->GetInstanceID(), condition_id, int_value); - } else { - char *zone_short = (char *) SvPV_nolen(ST(0)); - uint32 instance_id = (int) SvUV(ST(1)); - uint16 condition_id = (int) SvUV(ST(2)); - int16 int_value = (int) SvIV(ST(3)); - - quest_manager.spawn_condition(zone_short, instance_id, condition_id, int_value); - } - XSRETURN_EMPTY; +void Perl__addloot(int item_id) +{ + quest_manager.addloot(item_id); } -XS(XS__get_spawn_condition); -XS(XS__get_spawn_condition) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::get_spawn_condition(string zone_short, [int instance_id], int condition_id)"); - - if (items == 2) { - int16 RETVAL; - dXSTARG; - - char *zone_short = (char *) SvPV_nolen(ST(0)); - uint16 cond_id = (int) SvIV(ST(1)); - - RETVAL = quest_manager.get_spawn_condition(zone_short, zone->GetInstanceID(), cond_id); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); - } else { - int16 RETVAL; - dXSTARG; - - char *zone_short = (char *) SvPV_nolen(ST(0)); - uint16 instance_id = (int) SvIV(ST(1)); - uint16 cond_id = (int) SvIV(ST(2)); - - RETVAL = quest_manager.get_spawn_condition(zone_short, instance_id, cond_id); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); - } +void Perl__addloot(int item_id, int charges) +{ + quest_manager.addloot(item_id, charges); } -XS(XS__toggle_spawn_event); -XS(XS__toggle_spawn_event) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: quest::toggle_spawn_event(uint32 event_id, [bool is_enabled = false], [bool is_strict = false], [bool reset_base = false])"); +void Perl__addloot(int item_id, int charges, bool equip_item) +{ + quest_manager.addloot(item_id, charges, equip_item); +} - uint32 event_id = (int) SvIV(ST(0)); - bool is_enabled = ((int) SvIV(ST(1))) == 0 ? false : true; - bool is_strict = ((int) SvIV(ST(2))) == 0 ? false : true; - bool reset_base = ((int) SvIV(ST(3))) == 0 ? false : true; +void Perl__zone(const char* zone_name) +{ + quest_manager.Zone(zone_name); +} +void Perl__zonegroup(const char* zone_name) +{ + quest_manager.ZoneGroup(zone_name); +} + +void Perl__zoneraid(const char* zone_name) +{ + quest_manager.ZoneRaid(zone_name); +} + +bool Perl__hastimer(const char* timer_name) +{ + return quest_manager.hastimer(timer_name); +} + +uint32_t Perl__getremainingtimeMS(const char* timer_name) +{ + return quest_manager.getremainingtimeMS(timer_name); +} + +uint32_t Perl__gettimerdurationMS(const char* timer_name) +{ + return quest_manager.gettimerdurationMS(timer_name); +} + +void Perl__settimer(const char* timer_name, int seconds) +{ + quest_manager.settimer(timer_name, seconds); +} + +void Perl__settimerMS(const char* timer_name, int milliseconds) +{ + quest_manager.settimerMS(timer_name, milliseconds); +} + +void Perl__stoptimer(const char* timer_name) +{ + quest_manager.stoptimer(timer_name); +} + +void Perl__stopalltimers() +{ + quest_manager.stopalltimers(); +} + +void Perl__emote(const char* message) +{ + quest_manager.emote(message); +} + +void Perl__shout(const char* message) +{ + quest_manager.shout(message); +} + +void Perl__shout2(const char* message) +{ + quest_manager.shout2(message); +} + +void Perl__gmsay(const char* message) +{ + quest_manager.gmsay(message, Chat::LightGray, false, 0, AccountStatus::QuestTroupe); +} + +void Perl__gmsay(const char* message, int color_id) +{ + quest_manager.gmsay(message, color_id, false, 0, AccountStatus::QuestTroupe); +} + +void Perl__gmsay(const char* message, int color_id, bool send_to_world) +{ + quest_manager.gmsay(message, color_id, send_to_world, 0, AccountStatus::QuestTroupe); +} + +void Perl__gmsay(const char* message, int color_id, bool send_to_world, int to_guilddbid) +{ + quest_manager.gmsay(message, color_id, send_to_world, to_guilddbid, AccountStatus::QuestTroupe); +} + +void Perl__gmsay(const char* message, int color_id, bool send_to_world, int to_guilddbid, int to_minstatus) +{ + quest_manager.gmsay(message, color_id, send_to_world, to_guilddbid, to_minstatus); +} + +void Perl__depop() +{ + quest_manager.depop(); +} + +void Perl__depop(int npc_type_id) +{ + quest_manager.depop(npc_type_id); +} + +void Perl__depop_withtimer() +{ + quest_manager.depop_withtimer(); +} + +void Perl__depop_withtimer(int npc_type_id) +{ + quest_manager.depop_withtimer(npc_type_id); +} + +void Perl__depopall() +{ + quest_manager.depopall(); +} + +void Perl__depopall(int npc_type_id) +{ + quest_manager.depopall(npc_type_id); +} + +void Perl__settarget(const char* target_enum, int target_id) +{ + quest_manager.settarget(target_enum, target_id); +} + +void Perl__follow(int entity_id) +{ + quest_manager.follow(entity_id, 10); +} + +void Perl__follow(int entity_id, int distance) +{ + quest_manager.follow(entity_id, distance); +} + +void Perl__sfollow() +{ + quest_manager.sfollow(); +} + +void Perl__changedeity(int deity_id) +{ + quest_manager.changedeity(deity_id); +} + +void Perl__exp(int amount) +{ + quest_manager.exp(amount); +} + +void Perl__level(int new_level) +{ + quest_manager.level(new_level); +} + +void Perl__traindisc(int tome_item_id) +{ + quest_manager.traindisc(tome_item_id); +} + +bool Perl__isdisctome(int item_id) +{ + return quest_manager.isdisctome(item_id); +} + +std::string Perl__getracename(uint16 race_id) +{ + return quest_manager.getracename(race_id); +} + +std::string Perl__getspellname(uint32 spell_id) +{ + return quest_manager.getspellname(spell_id); +} + +int Perl__get_spell_level(uint32_t spell_id, int class_id) +{ + int spell_level = IsValidSpell(spell_id) ? GetSpellLevel(spell_id, class_id) : 0; + return (spell_level > RuleI(Character, MaxLevel)) ? 0 : spell_level; +} + +std::string Perl__getskillname(int skill_id) +{ + return quest_manager.getskillname(skill_id); +} + +void Perl__safemove() +{ + quest_manager.safemove(); +} + +void Perl__rain(int weather) +{ + quest_manager.rain(weather); +} + +void Perl__snow(int weather) +{ + quest_manager.snow(weather); +} + +void Perl__surname(std::string last_name) +{ + quest_manager.surname(last_name); +} + +void Perl__permaclass(int class_id) +{ + quest_manager.permaclass(class_id); +} + +void Perl__permarace(int race_id) +{ + quest_manager.permarace(race_id); +} + +void Perl__permagender(int gender_id) +{ + quest_manager.permagender(gender_id); +} + +int Perl__scribespells(int max_level) +{ + return quest_manager.scribespells(max_level); +} + +int Perl__scribespells(int max_level, int min_level) +{ + return quest_manager.scribespells(max_level, min_level); +} + +int Perl__traindiscs(int max_level) +{ + return quest_manager.traindiscs(max_level); +} + +int Perl__traindiscs(int max_level, int min_level) +{ + return quest_manager.traindiscs(max_level, min_level); +} + +void Perl__unscribespells() +{ + quest_manager.unscribespells(); +} + +void Perl__untraindiscs() +{ + quest_manager.untraindiscs(); +} + +void Perl__givecash(uint32 copper) +{ + quest_manager.givecash(copper); +} + +void Perl__givecash(uint32 copper, uint32 silver) +{ + quest_manager.givecash(copper, silver); +} + +void Perl__givecash(uint32 copper, uint32 silver, uint32 gold) +{ + quest_manager.givecash(copper, silver, gold); +} + +void Perl__givecash(uint32 copper, uint32 silver, uint32 gold, uint32 platinum) +{ + quest_manager.givecash(copper, silver, gold, platinum); +} + +void Perl__pvp(const char* mode) +{ + quest_manager.pvp(mode); +} + +void Perl__movepc(int zone_id, float x, float y, float z) +{ + quest_manager.movepc(zone_id, x, y, z, 0.0f); +} + +void Perl__movepc(int zone_id, float x, float y, float z, float heading) +{ + quest_manager.movepc(zone_id, x, y, z, heading); +} + +void Perl__gmmove(float x, float y, float z) +{ + quest_manager.gmmove(x, y, z); +} + +void Perl__movegrp(int zone_id, float x, float y, float z) +{ + quest_manager.movegrp(zone_id, x, y, z); +} + +void Perl__doanim(int animation_id) +{ + quest_manager.doanim(animation_id); +} + +void Perl__addskill(int skill_id, int value) +{ + quest_manager.addskill(skill_id, value); +} + +void Perl__setlanguage(int skill_id, int value) +{ + quest_manager.setlanguage(skill_id, value); +} + +void Perl__setskill(int skill_id, int value) +{ + quest_manager.setskill(skill_id, value); +} + +void Perl__setallskill(int value) +{ + quest_manager.setallskill(value); +} + +void Perl__attack(const char* client_name) +{ + quest_manager.attack(client_name); +} + +void Perl__attacknpc(int npc_entity_id) +{ + quest_manager.attacknpc(npc_entity_id); +} + +void Perl__attacknpctype(int npc_type_id) +{ + quest_manager.attacknpctype(npc_type_id); +} + +void Perl__save() +{ + quest_manager.save(); +} + +void Perl__faction(int faction_id, int value) +{ + quest_manager.faction(faction_id, value, 0); +} + +void Perl__faction(int faction_id, int value, int temp) +{ + quest_manager.faction(faction_id, value, temp); +} + +void Perl__setsky(uint8 new_sky) +{ + quest_manager.setsky(new_sky); +} + +void Perl__setguild(uint32_t guild_id, uint8_t guild_rank_id) +{ + quest_manager.setguild(guild_id, guild_rank_id); +} + +void Perl__createguild(const char* guild_name, const char* leader_name) +{ + quest_manager.CreateGuild(guild_name, leader_name); +} + +void Perl__settime(int new_hour, int new_min) +{ + quest_manager.settime(new_hour, new_min); +} + +void Perl__settime(int new_hour, int new_min, bool update_world) +{ + quest_manager.settime(new_hour, new_min, update_world); +} + +void Perl__itemlink(int item_id) +{ + quest_manager.itemlink(item_id); +} + +void Perl__signalwith(int npc_id, int signal_id) +{ + quest_manager.signalwith(npc_id, signal_id); +} + +void Perl__signalwith(int npc_id, int signal_id, int wait_ms) +{ + quest_manager.signalwith(npc_id, signal_id, wait_ms); +} + +void Perl__signal(int npc_id) +{ + quest_manager.signal(npc_id); +} + +void Perl__signal(int npc_id, int wait_ms) +{ + quest_manager.signal(npc_id, wait_ms); +} + +void Perl__setglobal(const char* key, const char* value, int options, const char* duration) +{ + quest_manager.setglobal(key, value, options, duration); +} + +void Perl__targlobal(const char* key, const char* value, const char* duration, int npc_id, int char_id, int zone_id) +{ + quest_manager.targlobal(key, value, duration, npc_id, char_id, zone_id); +} + +void Perl__delglobal(const char* key) +{ + quest_manager.delglobal(key); +} + +void Perl__ding() +{ + quest_manager.ding(); +} + +void Perl__rebind(int zone_id, float x, float y, float z) +{ + quest_manager.rebind(zone_id, glm::vec3(x, y, z)); +} + +void Perl__rebind(int zone_id, float x, float y, float z, float heading) +{ + quest_manager.rebind(zone_id, glm::vec4(x, y, z, heading)); +} + +void Perl__start(int waypoint) +{ + quest_manager.start(waypoint); +} + +void Perl__stop() +{ + quest_manager.stop(); +} + +void Perl__pause(int duration_ms) +{ + quest_manager.pause(duration_ms); +} + +void Perl__moveto(float x, float y, float z) +{ + quest_manager.moveto(glm::vec4(x, y, z, 0.0f), false); +} + +void Perl__moveto(float x, float y, float z, float h) +{ + quest_manager.moveto(glm::vec4(x, y, z, h), false); +} + +void Perl__moveto(float x, float y, float z, float h, bool save_guard_location) +{ + quest_manager.moveto(glm::vec4(x, y, z, h), save_guard_location); +} + +void Perl__resume() +{ + quest_manager.resume(); +} + +void Perl__addldonpoints(uint32 theme_id, int points) +{ + quest_manager.addldonpoints(theme_id, points); +} + +void Perl__addldonwin(uint32 theme_id) +{ + quest_manager.addldonwin(theme_id); +} + +void Perl__addldonloss(uint32 theme_id) +{ + quest_manager.addldonloss(theme_id); +} + +void Perl__setnexthpevent(int at_mob_percentage) +{ + quest_manager.setnexthpevent(at_mob_percentage); +} + +void Perl__setnextinchpevent(int at_mob_percentage) +{ + quest_manager.setnextinchpevent(at_mob_percentage); +} + +void Perl__sethp(int mob_health_percentage) +{ + quest_manager.sethp(mob_health_percentage); +} + +void Perl__respawn(int npc_type_id, int grid_id) +{ + quest_manager.respawn(npc_type_id, grid_id); +} + +perl::scalar Perl__ChooseRandom(perl::array options) +{ + int index = zone->random.Int(0, static_cast(options.size()) - 1); + return options[index]; +} + +void Perl__set_proximity(float min_x, float max_x, float min_y, float max_y) +{ + quest_manager.set_proximity(min_x, max_x, min_y, max_y); +} + +void Perl__set_proximity(float min_x, float max_x, float min_y, float max_y, float min_z, float max_z) +{ + quest_manager.set_proximity(min_x, max_x, min_y, max_y, min_z, max_z); +} + +void Perl__set_proximity(float min_x, float max_x, float min_y, float max_y, float min_z, float max_z, bool say) +{ + quest_manager.set_proximity(min_x, max_x, min_y, max_y, max_z, say); +} + +void Perl__clear_proximity() +{ + quest_manager.clear_proximity(); +} + +void Perl__enable_proximity_say() +{ + quest_manager.enable_proximity_say(); +} + +void Perl__disable_proximity_say() +{ + quest_manager.disable_proximity_say(); +} + +void Perl__setanim(int npc_type_id, int appearance_number) +{ + quest_manager.setanim(npc_type_id, appearance_number); +} + +void Perl__showgrid(int grid_id) +{ + quest_manager.showgrid(grid_id); +} + +void Perl__spawn_condition(const char* zone_short, uint16 condition_id, int16 value) +{ + quest_manager.spawn_condition(zone_short, zone->GetInstanceID(), condition_id, value); +} + +void Perl__spawn_condition(const char* zone_short, uint32_t instance_id, uint16 condition_id, int16 value) +{ + quest_manager.spawn_condition(zone_short, instance_id, condition_id, value); +} + +int Perl__get_spawn_condition(const char* zone_short, uint16 condition_id) +{ + return quest_manager.get_spawn_condition(zone_short, zone->GetInstanceID(), condition_id); +} + +int Perl__get_spawn_condition(const char* zone_short, uint32 instance_id, uint16 condition_id) +{ + return quest_manager.get_spawn_condition(zone_short, instance_id, condition_id); +} + +void Perl__toggle_spawn_event(int event_id, bool is_enabled, bool is_strict, bool reset_base) +{ quest_manager.toggle_spawn_event(event_id, is_enabled, is_strict, reset_base); - - XSRETURN_EMPTY; } -XS(XS__has_zone_flag); -XS(XS__has_zone_flag) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::has_zone_flag(uint32 zone_id)"); - - int16 RETVAL; - dXSTARG; - - uint32 zone_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.has_zone_flag(zone_id); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); - +bool Perl__has_zone_flag(int zone_id) +{ + return quest_manager.has_zone_flag(zone_id); } -XS(XS__set_zone_flag); -XS(XS__set_zone_flag) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::set_zone_flag(uint32 zone_id)"); - - uint32 zone_id = (int) SvIV(ST(0)); - +void Perl__set_zone_flag(int zone_id) +{ quest_manager.set_zone_flag(zone_id); - - XSRETURN_EMPTY; } -XS(XS__clear_zone_flag); -XS(XS__clear_zone_flag) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::clear_zone_flag(uint32 zone_id)"); - - uint32 zone_id = (int) SvIV(ST(0)); - +void Perl__clear_zone_flag(int zone_id) +{ quest_manager.clear_zone_flag(zone_id); - - XSRETURN_EMPTY; } -XS(XS__summonburiedplayercorpse); -XS(XS__summonburiedplayercorpse) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: quest::summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading)"); - - bool RETVAL; - uint32 char_id = (int) SvIV(ST(0)); - auto position = glm::vec4((float) SvIV(ST(1)), (float) SvIV(ST(2)), (float) SvIV(ST(3)), (float) SvIV(ST(4))); - - RETVAL = quest_manager.summonburiedplayercorpse(char_id, position); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading) +{ + auto position = glm::vec4(dest_x, dest_y, dest_z, dest_heading); + return quest_manager.summonburiedplayercorpse(char_id, position); } -XS(XS__summonallplayercorpses); -XS(XS__summonallplayercorpses) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: quest::summonallplayercorpses(int char_id, float dest_x, float dest_y, float dest_z, float dest_heading)"); - - bool RETVAL; - uint32 char_id = (int) SvIV(ST(0)); - auto position = glm::vec4((float) SvIV(ST(1)), (float) SvIV(ST(2)), (float) SvIV(ST(3)), (float) SvIV(ST(4))); - - RETVAL = quest_manager.summonallplayercorpses(char_id, position); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__summonallplayercorpses(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading) +{ + auto position = glm::vec4(dest_x, dest_y, dest_z, dest_heading); + return quest_manager.summonallplayercorpses(char_id, position); } -XS(XS__getplayercorpsecount); -XS(XS__getplayercorpsecount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getplayercorpsecount(uint32 char_id)"); - - uint32 RETVAL; - dXSTARG; - - uint32 char_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.getplayercorpsecount(char_id); - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__getplayercorpsecount(uint32 char_id) +{ + return quest_manager.getplayercorpsecount(char_id); } -XS(XS__getplayercorpsecountbyzoneid); -XS(XS__getplayercorpsecountbyzoneid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id)"); - - uint32 RETVAL; - dXSTARG; - - uint32 char_id = (int) SvIV(ST(0)); - uint32 zone_id = (int)SvIV(ST(1)); - - RETVAL = quest_manager.getplayercorpsecountbyzoneid(char_id, zone_id); - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id) +{ + return quest_manager.getplayercorpsecountbyzoneid(char_id, zone_id); } -XS(XS__getplayerburiedcorpsecount); -XS(XS__getplayerburiedcorpsecount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getplayerburiedcorpsecount(int character_id)"); - - uint32 RETVAL; - dXSTARG; - - uint32 char_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.getplayerburiedcorpsecount(char_id); - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +int Perl__getplayerburiedcorpsecount(uint32 char_id) +{ + return quest_manager.getplayerburiedcorpsecount(char_id); } -XS(XS__buryplayercorpse); -XS(XS__buryplayercorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::buryplayercorpse(int character_id)"); - - uint32 RETVAL; - dXSTARG; - - uint32 char_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.buryplayercorpse(char_id); - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); +bool Perl__buryplayercorpse(uint32 char_id) +{ + return quest_manager.buryplayercorpse(char_id); } -XS(XS__forcedooropen); -XS(XS__forcedooropen) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: quest::forcedooropen(int door_id, [int alt_mode=0])"); - - if (items == 1) { - uint32 door_id = (int) SvIV(ST(0)); - - quest_manager.forcedooropen(door_id, false); - - XSRETURN_EMPTY; - } else { - uint32 door_id = (int) SvIV(ST(0)); - bool alt_mode = (int) SvIV(ST(1)) == 0 ? false : true; - - quest_manager.forcedooropen(door_id, alt_mode); - - XSRETURN_EMPTY; - } +void Perl__forcedooropen(uint32 door_id) +{ + quest_manager.forcedooropen(door_id, false); } -XS(XS__forcedoorclose); -XS(XS__forcedoorclose) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: quest::forcedoorclose(int door_id, [bool alt_mode = 0])"); - - if (items == 1) { - uint32 door_id = (int) SvIV(ST(0)); - - quest_manager.forcedoorclose(door_id, false); - - XSRETURN_EMPTY; - } else { - uint32 door_id = (int) SvIV(ST(0)); - bool alt_mode = (int) SvIV(ST(1)) == 0 ? false : true; - - quest_manager.forcedoorclose(door_id, alt_mode); - - XSRETURN_EMPTY; - } +void Perl__forcedooropen(uint32 door_id, bool alt_mode) +{ + quest_manager.forcedooropen(door_id, alt_mode); } -XS(XS__toggledoorstate); -XS(XS__toggledoorstate) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::toggledoorstate(int door_id)"); +void Perl__forcedoorclose(uint32 door_id) +{ + quest_manager.forcedoorclose(door_id, false); +} - uint32 door_id = (int) SvIV(ST(0)); +void Perl__forcedoorclose(uint32 door_id, bool alt_mode) +{ + quest_manager.forcedoorclose(door_id, alt_mode); +} +void Perl__toggledoorstate(uint32 door_id) +{ quest_manager.toggledoorstate(door_id); - - XSRETURN_EMPTY; } -XS(XS__isdooropen); -XS(XS__isdooropen) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::isdooropen(int door_id)"); - - bool RETVAL; - dXSTARG; - - uint32 door_id = (int) SvIV(ST(0)); - - RETVAL = quest_manager.isdooropen(door_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__isdooropen(uint32 door_id) +{ + return quest_manager.isdooropen(door_id); } -XS(XS__depopzone); -XS(XS__depopzone) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::depopzone([bool start_spawn_status = false])"); - - bool StartSpawnStatus = ((int) SvIV(ST(0))) == 0 ? false : true; - - quest_manager.depopzone(StartSpawnStatus); - - XSRETURN_EMPTY; +void Perl__depopzone(bool start_spawn_status) +{ + quest_manager.depopzone(start_spawn_status); } -XS(XS__repopzone); -XS(XS__repopzone) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::repopzone()"); - +void Perl__repopzone() +{ quest_manager.repopzone(); - - XSRETURN_EMPTY; } -XS(XS__processmobswhilezoneempty); -XS(XS__processmobswhilezoneempty) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::processmobswhilezoneempty(bool on)"); - - bool ProcessingOn = ((int) SvIV(ST(0))) == 0 ? false : true; - - quest_manager.processmobswhilezoneempty(ProcessingOn); - - XSRETURN_EMPTY; +void Perl__processmobswhilezoneempty(bool on) +{ + quest_manager.processmobswhilezoneempty(on); } -XS(XS__npcrace); -XS(XS__npcrace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::npcrace(int race_id)"); - - int race_id = (int) SvIV(ST(0)); - +void Perl__npcrace(int race_id) +{ quest_manager.npcrace(race_id); - - XSRETURN_EMPTY; } -XS(XS__npcgender); -XS(XS__npcgender) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::npcgender(int gender_id)"); - - int gender_id = (int) SvIV(ST(0)); - +void Perl__npcgender(int gender_id) +{ quest_manager.npcgender(gender_id); - - XSRETURN_EMPTY; } -XS(XS__npcsize); -XS(XS__npcsize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::npcsize(int size)"); - - int size = (int) SvIV(ST(0)); - +void Perl__npcsize(int size) +{ quest_manager.npcsize(size); - - XSRETURN_EMPTY; } -XS(XS__npctexture); -XS(XS__npctexture) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::npctexture(int texture_id)"); - - int texture_id = (int) SvIV(ST(0)); - +void Perl__npctexture(int texture_id) +{ quest_manager.npctexture(texture_id); - - XSRETURN_EMPTY; } -XS(XS__playerrace); -XS(XS__playerrace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::playerrace(int race_id)"); - - int race_id = (int) SvIV(ST(0)); - +void Perl__playerrace(int race_id) +{ quest_manager.playerrace(race_id); - - XSRETURN_EMPTY; } -XS(XS__playergender); -XS(XS__playergender) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::playergender(int gender_id)"); - - int gender_id = (int) SvIV(ST(0)); - +void Perl__playergender(int gender_id) +{ quest_manager.playergender(gender_id); - - XSRETURN_EMPTY; } -XS(XS__playersize); -XS(XS__playersize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::playersize(int newsize)"); - - int newsize = (int) SvIV(ST(0)); - +void Perl__playersize(int newsize) +{ quest_manager.playersize(newsize); - - XSRETURN_EMPTY; } -XS(XS__playertexture); -XS(XS__playertexture) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::playertexture(int texture_id)"); - - int texture_id = (int) SvIV(ST(0)); - +void Perl__playertexture(int texture_id) +{ quest_manager.playertexture(texture_id); - - XSRETURN_EMPTY; } -XS(XS__playerfeature); -XS(XS__playerfeature) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::playerfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int setting)"); - - char *str_value = (char *) SvPV_nolen(ST(0)); - int int_value = (int) SvIV(ST(1)); - - quest_manager.playerfeature(str_value, int_value); - - XSRETURN_EMPTY; +void Perl__playerfeature(char* feature, int value) +{ + quest_manager.playerfeature(feature, value); } -XS(XS__npcfeature); -XS(XS__npcfeature) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::npcfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int value)"); - - char *str_value = (char *) SvPV_nolen(ST(0)); - int int_value = (int) SvIV(ST(1)); - - quest_manager.npcfeature(str_value, int_value); - - XSRETURN_EMPTY; +void Perl__npcfeature(char* feature, int value) +{ + quest_manager.npcfeature(feature, value); } #ifdef BOTS -XS(XS__createbotcount); -XS(XS__createbotcount) +int Perl__createbotcount() { - dXSARGS; - int RETVAL; - dXSTARG; - - RETVAL = quest_manager.createbotcount(); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); + return quest_manager.createbotcount(); } -XS(XS__spawnbotcount); -XS(XS__spawnbotcount) +int Perl__spawnbotcount() { - dXSARGS; - int RETVAL; - dXSTARG; - - RETVAL = quest_manager.spawnbotcount(); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); + return quest_manager.spawnbotcount(); } -XS(XS__botquest); -XS(XS__botquest) +bool Perl__botquest() { - dXSARGS; - bool RETVAL; - dXSTARG; - - RETVAL = quest_manager.botquest(); - XSprePUSH; - PUSHi((IV) RETVAL); - XSRETURN(1); + return quest_manager.botquest(); } -XS(XS__createBot); -XS(XS__createBot) +bool Perl__createBot(const char* firstname, const char* lastname, int level, int race_id, int class_id, int gender_id) { - dXSARGS; - bool RETVAL; - dXSTARG; - - if(items != 6) - { - Perl_croak(aTHX_ "Usage: quest::createBot(string first_name, string last_name, int level, int race_id, int class_id, int gender_id)"); - } - - char *firstname = (char *)SvPV_nolen(ST(0)); - char *lastname = (char *)SvPV_nolen(ST(1)); - int level = (int) SvIV(ST(2)); - int race_id = (int) SvIV(ST(3)); - int class_id = (int) SvIV(ST(4)); - int gender_id = (int) SvIV(ST(5)); - - RETVAL = quest_manager.createBot(firstname, lastname, level, race_id, class_id, gender_id); - XSprePUSH; - PUSHi((IV) RETVAL); - XSRETURN(1); + return quest_manager.createBot(firstname, lastname, level, race_id, class_id, gender_id); } #endif //BOTS -XS(XS__taskselector); -XS(XS__taskselector) { - dXSARGS; - if ((items >= 1) && (items <= MAXCHOOSERENTRIES)) { - int tasks[MAXCHOOSERENTRIES]; - for (int i = 0; i < items; i++) { - tasks[i] = (int) SvIV(ST(i)); - } - quest_manager.taskselector(items, tasks); - } else { - Perl_croak(aTHX_ "Usage: quest::taskselector(int task_id, 2, 3, 4, 5 [up to 40])"); +void Perl__taskselector(perl::array task_ids) +{ + if (task_ids.size() > MAXCHOOSERENTRIES) + { + throw std::runtime_error(fmt::format("Exceeded max number of task offers [{}]", MAXCHOOSERENTRIES)); } - XSRETURN_EMPTY; + int tasks[MAXCHOOSERENTRIES]; + for (int i = 0; i < task_ids.size(); ++i) + { + tasks[i] = task_ids[i]; + } + quest_manager.taskselector(static_cast(task_ids.size()), tasks); } -XS(XS__task_setselector); -XS(XS__task_setselector) { - dXSARGS; - if (items == 1) { - int task_setid = (int) SvIV(ST(0)); - quest_manager.tasksetselector(task_setid); - } else { - Perl_croak(aTHX_ "Usage: quest::task_setselector(int task_set_id)"); + +void Perl__task_setselector(int task_set_id) +{ + quest_manager.tasksetselector(task_set_id); +} + +void Perl__enabletask(perl::array task_ids) +{ + int count = 0; + int tasks[MAXCHOOSERENTRIES]; + for (int i = 0; i < task_ids.size() && i < MAXCHOOSERENTRIES; ++i) + { + tasks[i] = task_ids[i]; + ++count; } - XSRETURN_EMPTY; + quest_manager.enabletask(count, tasks); } -XS(XS__enabletask); -XS(XS__enabletask) { - dXSARGS; - if ((items >= 1) && (items <= 10)) { - int tasks[10]; - for (int i = 0; i < items; i++) { - tasks[i] = (int) SvIV(ST(i)); - } - quest_manager.enabletask(items, tasks); - } else { - Perl_croak(aTHX_ "Usage: quest::enabletask(int task_id, 2, 3, [up to 10])"); + +void Perl__disabletask(perl::array task_ids) +{ + int count = 0; + int tasks[MAXCHOOSERENTRIES]; + for (int i = 0; i < task_ids.size() && i < MAXCHOOSERENTRIES; ++i) + { + tasks[i] = task_ids[i]; + ++count; } - XSRETURN_EMPTY; -} -XS(XS__disabletask); -XS(XS__disabletask) { - dXSARGS; - if ((items >= 1) && (items <= 10)) { - int tasks[10]; - for (int i = 0; i < items; i++) { - tasks[i] = (int) SvIV(ST(i)); - } - quest_manager.disabletask(items, tasks); - } else { - Perl_croak(aTHX_ "Usage: quest::disabletask(int task_id, 2, 3, [up to 10])"); - } - - XSRETURN_EMPTY; + quest_manager.disabletask(count, tasks); } -XS(XS__istaskenabled); -XS(XS__istaskenabled) { - dXSARGS; - bool RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_id = (int) SvIV(ST(0)); - RETVAL = quest_manager.istaskenabled(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::istaskenabled(int task_id)"); - } - - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__istaskenabled(int task_id) +{ + return quest_manager.istaskenabled(task_id); } -XS(XS__istaskactive); -XS(XS__istaskactive) { - dXSARGS; - bool RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_id = (int) SvIV(ST(0)); - RETVAL = quest_manager.istaskactive(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::istaskactive(int task_id)"); - } - - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__istaskactive(int task_id) +{ + return quest_manager.istaskactive(task_id); } -XS(XS__istaskactivityactive); -XS(XS__istaskactivityactive) { - dXSARGS; - bool RETVAL; - dXSTARG; - - if (items == 2) { - unsigned int task_id = (int) SvIV(ST(0)); - unsigned int activity_id = (int) SvIV(ST(1)); - RETVAL = quest_manager.istaskactivityactive(task_id, activity_id); - } else { - Perl_croak(aTHX_ "Usage: quest::istaskactivityactive(int task_id, int activity_id)"); - } - - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +bool Perl__istaskactivityactive(int task_id, int activity_id) +{ + return quest_manager.istaskactivityactive(task_id, activity_id); } -XS(XS__gettaskactivitydonecount); -XS(XS__gettaskactivitydonecount) { - dXSARGS; - uint32 RETVAL; - dXSTARG; - - if (items == 2) { - unsigned int task_id = (int) SvIV(ST(0)); - unsigned int activity_id = (int) SvIV(ST(1)); - RETVAL = quest_manager.gettaskactivitydonecount(task_id, activity_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } else { - Perl_croak(aTHX_ "Usage: quest::gettaskactivitydonecount(int task_id, int activity_id)"); - } - - XSRETURN(1); +int Perl__gettaskactivitydonecount(int task_id, int activity_id) +{ + return quest_manager.gettaskactivitydonecount(task_id, activity_id); } -XS(XS__updatetaskactivity); -XS(XS__updatetaskactivity) { - dXSARGS; - unsigned int task_id, activity_id; - int count = 1; - bool ignore_quest_update = false; - if (items == 2) { - task_id = (int) SvIV(ST(0)); - activity_id = (int) SvIV(ST(1)); - quest_manager.updatetaskactivity(task_id, activity_id, count, false); - } else if (items == 3 || items == 4) { - task_id = (int) SvIV(ST(0)); - activity_id = (int) SvIV(ST(1)); - count = (int) SvIV(ST(2)); - if (items == 4) { - bool ignore_quest_update = (bool) SvTRUE(ST(3)); - } - quest_manager.updatetaskactivity(task_id, activity_id, count, ignore_quest_update); - } else { - Perl_croak(aTHX_ "Usage: quest::updatetaskactivity(int task_id, int activity_id, [int count], [bool ignore_quest_update = false])"); - } - - XSRETURN_EMPTY; +void Perl__updatetaskactivity(int task_id, int activity_id) +{ + quest_manager.updatetaskactivity(task_id, activity_id, 1); } -XS(XS__resettaskactivity); -XS(XS__resettaskactivity) { - dXSARGS; - if (items == 2) { - int task_id = (int) SvIV(ST(0)); - int activity_id = (int) SvIV(ST(1)); - - quest_manager.resettaskactivity(task_id, activity_id); - - } else { - Perl_croak(aTHX_ "Usage: quest::resettaskactivity(int task_id, int activity_id)"); - } - - XSRETURN_EMPTY; +void Perl__updatetaskactivity(int task_id, int activity_id, int count) +{ + quest_manager.updatetaskactivity(task_id, activity_id, count); } -XS(XS__taskexploredarea); -XS(XS__taskexploredarea) { - dXSARGS; - unsigned int explore_id; - if (items == 1) { - explore_id = (int) SvIV(ST(0)); - quest_manager.taskexploredarea(explore_id); - } else { - Perl_croak(aTHX_ "Usage: quest::taskexplorearea(int explore_id)"); - } - - XSRETURN_EMPTY; +void Perl__updatetaskactivity(int task_id, int activity_id, int count, bool ignore_quest_update) +{ + quest_manager.updatetaskactivity(task_id, activity_id, count, ignore_quest_update); } -XS(XS__assigntask); -XS(XS__assigntask) { - dXSARGS; - unsigned int task_id; - bool enforce_level_requirement = false; - if (items == 1 || items == 2) { - task_id = (int) SvIV(ST(0)); - if (items == 2) { - if ((int) SvIV(ST(1)) == 1) { - enforce_level_requirement = true; - } - } - quest_manager.assigntask(task_id, enforce_level_requirement); - } else { - Perl_croak(aTHX_ "Usage: quest::assigntask(int task_id, [bool enforce_level_requirement = false])"); - } - - XSRETURN_EMPTY; +void Perl__resettaskactivity(int task_id, int activity_id) +{ + quest_manager.resettaskactivity(task_id, activity_id); } -XS(XS__failtask); -XS(XS__failtask) { - dXSARGS; - unsigned int task_id; - if (items == 1) { - task_id = (int) SvIV(ST(0)); - quest_manager.failtask(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::failtask(int task_id)"); - } - - XSRETURN_EMPTY; +void Perl__taskexploredarea(int explore_id) +{ + quest_manager.taskexploredarea(explore_id); } -XS(XS__tasktimeleft); -XS(XS__tasktimeleft) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_id = (int) SvIV(ST(0)); - RETVAL = quest_manager.tasktimeleft(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::tasktimeleft(int task_id)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +void Perl__assigntask(int task_id) +{ + quest_manager.assigntask(task_id); } -XS(XS__istaskcompleted); -XS(XS__istaskcompleted) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_id = (int) SvIV(ST(0)); - RETVAL = quest_manager.istaskcompleted(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::istaskcompleted(int task_id)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +void Perl__assigntask(int task_id, bool enforce_level_requirement) +{ + quest_manager.assigntask(task_id, enforce_level_requirement); } -XS(XS__enabledtaskcount); -XS(XS__enabledtaskcount) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_set = (int) SvIV(ST(0)); - RETVAL = quest_manager.enabledtaskcount(task_set); - } else { - Perl_croak(aTHX_ "Usage: quest::enabledtaskcount(int task_set)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +void Perl__failtask(int task_id) +{ + quest_manager.failtask(task_id); } -XS(XS__firsttaskinset); -XS(XS__firsttaskinset) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_set = (int) SvIV(ST(0)); - RETVAL = quest_manager.firsttaskinset(task_set); - } else { - Perl_croak(aTHX_ "Usage: quest::firsttaskinset(int task_set)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__tasktimeleft(int task_id) +{ + return quest_manager.tasktimeleft(task_id); } -XS(XS__lasttaskinset); -XS(XS__lasttaskinset) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_set = (int) SvIV(ST(0)); - RETVAL = quest_manager.lasttaskinset(task_set); - } else { - Perl_croak(aTHX_ "Usage: quest::lasttaskinset(int task_set)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__istaskcompleted(int task_id) +{ + return quest_manager.istaskcompleted(task_id); } -XS(XS__nexttaskinset); -XS(XS__nexttaskinset) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 2) { - unsigned int task_set = (int) SvIV(ST(0)); - unsigned int task_id = (int) SvIV(ST(1)); - RETVAL = quest_manager.nexttaskinset(task_set, task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::nexttaskinset(int task_set, int task_id)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); -} -XS(XS__activespeaktask); -XS(XS__activespeaktask) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 0) { - RETVAL = quest_manager.activespeaktask(); - } else { - Perl_croak(aTHX_ "Usage: quest::activespeaktask()"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__enabledtaskcount(int task_set) +{ + return quest_manager.enabledtaskcount(task_set); } -XS(XS__activespeakactivity); -XS(XS__activespeakactivity) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_id = (int) SvIV(ST(0)); - RETVAL = quest_manager.activespeakactivity(task_id); - } else { - Perl_croak(aTHX_ "Usage: quest::activespeakactivity(int task_id)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__firsttaskinset(int task_set) +{ + return quest_manager.firsttaskinset(task_set); } -XS(XS__activetasksinset); -XS(XS__activetasksinset) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_set = (int) SvIV(ST(0)); - RETVAL = quest_manager.activetasksinset(task_set); - } else { - Perl_croak(aTHX_ "Usage: quest::activetasksinset(int task_set)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__lasttaskinset(int task_set) +{ + return quest_manager.lasttaskinset(task_set); } -XS(XS__completedtasksinset); -XS(XS__completedtasksinset) { - dXSARGS; - int RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task_set = (int) SvIV(ST(0)); - RETVAL = quest_manager.completedtasksinset(task_set); - } else { - Perl_croak(aTHX_ "Usage: quest::completedtasksinset(int task_set)"); - } - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__nexttaskinset(int task_set, int task_id) +{ + return quest_manager.nexttaskinset(task_set, task_id); } - -XS(XS__istaskappropriate); -XS(XS__istaskappropriate) { - dXSARGS; - bool RETVAL; - dXSTARG; - - if (items == 1) { - unsigned int task = (int) SvIV(ST(0)); - RETVAL = quest_manager.istaskappropriate(task); - } else { - Perl_croak(aTHX_ "Usage: quest::istaskaappropriate(int task_id)"); - } - - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); +int Perl__activespeaktask() +{ + return quest_manager.activespeaktask(); } -XS(XS__gettaskname); -XS(XS__gettaskname) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::gettaskname(uint32 task_id)"); - } - - dXSTARG; - uint32 task_id = (int) SvIV(ST(0)); - std::string task_name = quest_manager.gettaskname(task_id); - - sv_setpv(TARG, task_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); +int Perl__activespeakactivity(int task_id) +{ + return quest_manager.activespeakactivity(task_id); } -XS(XS__popup); // prototype to pass -Wmissing-prototypes -XS(XS__popup) { - dXSARGS; - int popup_id = 0; - int buttons = 0; - int duration = 0; - - if ((items < 2) || (items > 5)) - Perl_croak(aTHX_ "Usage: quest::popup(string window_title, string message, int popup_id, int buttons, int duration)"); - - if (items >= 3) - popup_id = (int) SvIV(ST(2)); - - if (items >= 4) - buttons = (int) SvIV(ST(3)); - - if (items == 5) - duration = (int) SvIV(ST(4)); - - quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popup_id, buttons, duration); - - XSRETURN_EMPTY; +int Perl__activetasksinset(int task_set) +{ + return quest_manager.activetasksinset(task_set); } -XS(XS__clearspawntimers); -XS(XS__clearspawntimers) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::clearspawntimers()"); +int Perl__completedtasksinset(int task_set) +{ + return quest_manager.completedtasksinset(task_set); +} +bool Perl__istaskappropriate(int task_id) +{ + return quest_manager.istaskappropriate(task_id); +} + +std::string Perl__gettaskname(uint32 task_id) +{ + return quest_manager.gettaskname(task_id); +} + +void Perl__popup(const char* window_title, const char* message) +{ + quest_manager.popup(window_title, message, 0, 0, 0); +} + +void Perl__popup(const char* window_title, const char* message, int popup_id) +{ + quest_manager.popup(window_title, message, popup_id, 0, 0); +} + +void Perl__popup(const char* window_title, const char* message, int popup_id, int buttons) +{ + quest_manager.popup(window_title, message, popup_id, buttons, 0); +} + +void Perl__popup(const char* window_title, const char* message, int popup_id, int buttons, int duration) +{ + quest_manager.popup(window_title, message, popup_id, buttons, duration); +} + +void Perl__clearspawntimers() +{ quest_manager.clearspawntimers(); - - XSRETURN_EMPTY; } -XS(XS__ze); -XS(XS__ze) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::ze(int emote_color_id, string message)"); - - int channel_id = (int) SvIV(ST(0)); - char *message = (char *) SvPV_nolen(ST(1)); - - quest_manager.ze(channel_id, message); - - XSRETURN_EMPTY; +void Perl__ze(int emote_color_id, const char* message) +{ + return quest_manager.ze(emote_color_id, message); } -XS(XS__we); -XS(XS__we) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::we(int emote_color_id, string message)"); - - int channel_id = (int) SvIV(ST(0)); - char *message = (char *) SvPV_nolen(ST(1)); - - quest_manager.we(channel_id, message); - - XSRETURN_EMPTY; +void Perl__we(int emote_color_id, const char* message) +{ + quest_manager.we(emote_color_id, message); } -XS(XS__message); -XS(XS__message) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::message(int color, string message)"); - - int color = (int) SvIV(ST(0)); - char *message = (char *) SvPV_nolen(ST(1)); +void Perl__message(int color, const char* message) +{ quest_manager.message(color, message); - XSRETURN_EMPTY; } -XS(XS__whisper); -XS(XS__whisper) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::whisper(string message)"); - - char *message = (char *) SvPV_nolen(ST(0)); +void Perl__whisper(const char* message) +{ quest_manager.whisper(message); - XSRETURN_EMPTY; } -XS(XS__getlevel); -XS(XS__getlevel) { - dXSARGS; - if (items > 1) - Perl_croak(aTHX_ "Usage: quest::getlevel(int type)"); - - int RETVAL; - dXSTARG; - - int type; - if (items == 1) - type = (int) SvIV(ST(0)); - else - type = 0; - - RETVAL = quest_manager.getlevel(type); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); +int Perl__getlevel(uint8 type) +{ + return quest_manager.getlevel(type); } -XS(XS__CreateGroundObject); -XS(XS__CreateGroundObject) { - dXSARGS; - if (items != 5 && items != 6) - Perl_croak(aTHX_ "Usage: quest::creategroundobject(int item_id, float x, float y, float z, float heading, [uint32 decay_time-ms = 300000])"); - - int item_id = (int) SvIV(ST(0)); - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float heading = (float) SvNV(ST(4)); - uint16 id = 0; - - if (items == 5) - id = quest_manager.CreateGroundObject(item_id, glm::vec4(x, y, z, heading)); - else { - uint32 decay_time = (uint32) SvIV(ST(5)); - id = quest_manager.CreateGroundObject(item_id, glm::vec4(x, y, z, heading), decay_time); - } - - XSRETURN_IV(id); +int Perl__CreateGroundObject(uint32_t item_id, float x, float y, float z, float heading) +{ + return quest_manager.CreateGroundObject(item_id, glm::vec4(x, y, z, heading)); } -XS(XS__CreateGroundObjectFromModel); -XS(XS__CreateGroundObjectFromModel) { - dXSARGS; - if (items < 5 || items > 7) - Perl_croak(aTHX_ "Usage: quest::creategroundobjectfrommodel(string model_name, float x, float y, float z, float heading, [int object_type], [uint32 decay_time-ms = 300000])"); - - char *modelname = (char *) SvPV_nolen(ST(0)); - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float heading = (float) SvNV(ST(4)); - uint32 object_type = 0; - uint32 decay_time = 0; - uint16 id = 0; - - if (items > 5) - object_type = (uint32) SvIV(ST(5)); - - if (items > 6) - decay_time = (uint32) SvIV(ST(6)); - - id = quest_manager.CreateGroundObjectFromModel(modelname, glm::vec4(x, y, z, heading), object_type, decay_time); - XSRETURN_IV(id); +int Perl__CreateGroundObject(uint32_t item_id, float x, float y, float z, float heading, uint32_t decay_time_ms) +{ + return quest_manager.CreateGroundObject(item_id, glm::vec4(x, y, z, heading), decay_time_ms); } -XS(XS__CreateDoor); -XS(XS__CreateDoor) { - dXSARGS; - if (items < 5 || items > 7) - Perl_croak(aTHX_ "Usage: quest::createdoor(string model_name, float x, float y, float z, float heading, [int object_type = 58], [int size = 100])"); - - char *modelname = (char *) SvPV_nolen(ST(0)); - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float heading = (float) SvNV(ST(4)); - uint32 object_type = 58; - uint32 size = 100; - uint16 id = 0; - - if (items > 5) - object_type = (uint32) SvIV(ST(5)); - - if (items > 6) - size = (uint32) SvIV(ST(6)); - - id = quest_manager.CreateDoor(modelname, x, y, z, heading, object_type, size); - XSRETURN_IV(id); +int Perl__CreateGroundObjectFromModel(const char* modelname, float x, float y, float z, float heading) +{ + return quest_manager.CreateGroundObjectFromModel(modelname, glm::vec4(x, y, z, heading)); } -XS(XS__ModifyNPCStat); -XS(XS__ModifyNPCStat) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::modifynpcstat(string key, string value)"); - - quest_manager.ModifyNPCStat(SvPV_nolen(ST(0)), SvPV_nolen(ST(1))); - - XSRETURN_EMPTY; +int Perl__CreateGroundObjectFromModel(const char* modelname, float x, float y, float z, float heading, uint8_t object_type) +{ + return quest_manager.CreateGroundObjectFromModel(modelname, glm::vec4(x, y, z, heading), object_type); } -XS(XS__collectitems); -XS(XS__collectitems) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::collectitems(int item_id, [bool remove_item = true])"); - - uint32 item_id = (int) SvIV(ST(0)); - bool remove_item = ((int) SvIV(ST(1))) == 0 ? false : true; - - int quantity = - quest_manager.collectitems(item_id, remove_item); - - XSRETURN_IV(quantity); +int Perl__CreateGroundObjectFromModel(const char* modelname, float x, float y, float z, float heading, uint8_t object_type, uint32_t decay_time_ms) +{ + return quest_manager.CreateGroundObjectFromModel(modelname, glm::vec4(x, y, z, heading), object_type, decay_time_ms); } -XS(XS__countitem); -XS(XS__countitem) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::countitem(int item_id)"); - - uint32 item_id = (int) SvIV(ST(0)); - - int quantity = quest_manager.countitem(item_id); - - XSRETURN_IV(quantity); +int Perl__CreateDoor(const char* modelname, float x, float y, float z, float heading) +{ + return quest_manager.CreateDoor(modelname, x, y, z, heading, 58, 100); } -XS(XS__removeitem); -XS(XS__removeitem) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: quest::removeitem(int item_id, [int quantity = 1])"); +int Perl__CreateDoor(const char* modelname, float x, float y, float z, float heading, uint8_t object_type) +{ + return quest_manager.CreateDoor(modelname, x, y, z, heading, object_type, 100); +} - uint32 item_id = (int) SvIV(ST(0)); - uint32 quantity = 1; - if (items > 1) - quantity = (int) SvIV(ST(1)); +int Perl__CreateDoor(const char* modelname, float x, float y, float z, float heading, uint8_t object_type, uint16_t size) +{ + return quest_manager.CreateDoor(modelname, x, y, z, heading, object_type, size); +} +void Perl__ModifyNPCStat(const char* key, const char* value) +{ + quest_manager.ModifyNPCStat(key, value); +} + +int Perl__collectitems(uint32_t item_id, bool remove_item) +{ + return quest_manager.collectitems(item_id, remove_item); +} + +int Perl__countitem(uint32_t item_id) +{ + return quest_manager.countitem(item_id); +} + +void Perl__removeitem(uint32_t item_id) +{ + quest_manager.removeitem(item_id); +} + +void Perl__removeitem(uint32_t item_id, int quantity) +{ quest_manager.removeitem(item_id, quantity); - - XSRETURN_EMPTY; } -XS(XS__getitemname); -XS(XS__getitemname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getitemname(uint32 item_id)"); - - dXSTARG; - uint32 item_id = (int) SvIV(ST(0)); - std::string item_name = quest_manager.getitemname(item_id); - - sv_setpv(TARG, item_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); +std::string Perl__getitemname(uint32 item_id) +{ + return quest_manager.getitemname(item_id); } -XS(XS__getnpcnamebyid); -XS(XS__getnpcnamebyid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getnpcnamebyid(uint32 npc_id)"); - - dXSTARG; - uint32 npc_id = (int) SvIV(ST(0)); - auto npc_name = quest_manager.getnpcnamebyid(npc_id); - sv_setpv(TARG, npc_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); +std::string Perl__getnpcnamebyid(uint32 npc_id) +{ + return quest_manager.getnpcnamebyid(npc_id); } -XS(XS__UpdateSpawnTimer); -XS(XS__UpdateSpawnTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::updatespawntimer(uint32 spawn2_id, uint32 updated_time_till_repop)"); - - uint32 spawn2_id = (int) SvIV(ST(0)); - uint32 updated_time_till_repop = (int) SvIV(ST(1)); - - quest_manager.UpdateSpawnTimer(spawn2_id, updated_time_till_repop); - - XSRETURN_EMPTY; +void Perl__UpdateSpawnTimer(uint32 id, uint32 new_time) +{ + quest_manager.UpdateSpawnTimer(id, new_time); } -XS(XS__MerchantSetItem); -XS(XS__MerchantSetItem) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: quest::MerchantSetItem(uint32 npc_id, uint32 item_id, [uint32 quantity])"); - - uint32 npc_id = (int) SvUV(ST(0)); - uint32 item_id = (int) SvUV(ST(1)); - uint32 quantity = 0; - if (items == 3) - quantity = (int) SvUV(ST(2)); +void Perl__MerchantSetItem(uint32 npc_id, uint32 item_id) +{ + quest_manager.MerchantSetItem(npc_id, item_id); +} +void Perl__MerchantSetItem(uint32 npc_id, uint32 item_id, uint32 quantity) +{ quest_manager.MerchantSetItem(npc_id, item_id, quantity); - - XSRETURN_EMPTY; } -XS(XS__MerchantCountItem); -XS(XS__MerchantCountItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::MerchantCountItem(uint32 npc_id, uint32 item_id)"); - - uint32 npc_id = (int) SvUV(ST(0)); - uint32 item_id = (int) SvUV(ST(1)); - uint32 quantity = quest_manager.MerchantCountItem(npc_id, item_id); - - XSRETURN_UV(quantity); +uint32_t Perl__MerchantCountItem(uint32 npc_id, uint32 item_id) +{ + return quest_manager.MerchantCountItem(npc_id, item_id); } -XS(XS__varlink); -XS(XS__varlink) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::varlink(uint32 item_id)"); - dXSTARG; - - Const_char *RETVAL; - char text[250]; - uint32 item_id; - item_id = (int) SvUV(ST(0)); - - RETVAL = quest_manager.varlink(text, item_id); - - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - XSRETURN(1); +std::string Perl__varlink(int item_id) +{ + char text[250] = { 0 }; + return quest_manager.varlink(text, item_id); } -XS(XS__CreateInstance); -XS(XS__CreateInstance) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::CreateInstance(string zone_name, uint16 version, uint32 duration)"); - - char *zone = (char *) SvPV_nolen(ST(0)); - uint16 version = (int) SvUV(ST(1)); - uint32 duration = (int) SvUV(ST(2)); - uint32 id = quest_manager.CreateInstance(zone, version, duration); - - XSRETURN_UV(id); +int Perl__CreateInstance(const char* zone_name, int16 version, int32 duration) +{ + return quest_manager.CreateInstance(zone_name, version, duration); } -XS(XS__DestroyInstance); -XS(XS__DestroyInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::DestroyInstance(int id)"); - - uint16 id = (int) SvUV(ST(0)); +void Perl__DestroyInstance(uint16 id) +{ quest_manager.DestroyInstance(id); - - XSRETURN_EMPTY; } -XS(XS__UpdateInstanceTimer); -XS(XS__UpdateInstanceTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::UpdateInstanceTimer(int16 instance_id, uint32 duration)"); - - uint16 instance_id = (uint16) SvUV(ST(0)); - uint32 duration = (uint32) SvUV(ST(1)); +void Perl__UpdateInstanceTimer(int16 instance_id, uint32 duration) +{ quest_manager.UpdateInstanceTimer(instance_id, duration); - - XSRETURN_EMPTY; } -XS(XS__GetInstanceTimer); -XS(XS__GetInstanceTimer) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::GetInstanceTimer()"); - - uint32 timer = quest_manager.GetInstanceTimer(); - - XSRETURN_UV(timer); +uint32_t Perl__GetInstanceTimer() +{ + return quest_manager.GetInstanceTimer(); } -XS(XS__GetInstanceTimerByID); -XS(XS__GetInstanceTimerByID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetInstanceTimerByID(uint16 instance_id)"); - - uint16 instance_id = (uint16) SvUV(ST(0)); - uint32 timer = quest_manager.GetInstanceTimerByID(instance_id); - - XSRETURN_UV(timer); +uint32_t Perl__GetInstanceTimerByID(uint16 instance_id) +{ + return quest_manager.GetInstanceTimerByID(instance_id); } -XS(XS__GetInstanceID); -XS(XS__GetInstanceID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::GetInstanceID(string zone_name, uint16 version)"); - - char *zone = (char *) SvPV_nolen(ST(0)); - uint16 version = (int) SvUV(ST(1)); - uint16 id = quest_manager.GetInstanceID(zone, version); - - XSRETURN_UV(id); +int Perl__GetInstanceID(const char* zone_name, uint16 version) +{ + return quest_manager.GetInstanceID(zone_name, version); } -XS(XS__GetInstanceIDByCharID); -XS(XS__GetInstanceIDByCharID) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::GetInstanceIDByCharID(string zone_name, uint16 version, uint32 char_id)"); - - char *zone = (char *) SvPV_nolen(ST(0)); - uint16 version = (int) SvUV(ST(1)); - uint32 char_id = (int) SvUV(ST(2)); - uint16 id = quest_manager.GetInstanceIDByCharID(zone, version, char_id); - - XSRETURN_UV(id); +int Perl__GetInstanceIDByCharID(const char* zone_name, int16 version, uint32 char_id) +{ + return quest_manager.GetInstanceIDByCharID(zone_name, version, char_id); } -XS(XS__GetCharactersInInstance); -XS(XS__GetCharactersInInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetCharactersInInstance(uint16 instance_id)"); - dXSTARG; - - Const_char *RETVAL; - uint16 instance_id = (int) SvUV(ST(0)); +std::string Perl__GetCharactersInInstance(uint16 instance_id) +{ std::list char_id_list; - std::string char_id_string; + std::string char_id_string = "No players in that instance."; database.GetCharactersInInstance(instance_id, char_id_list); - if (char_id_list.size() > 0) { - char_id_string = itoa(char_id_list.size()); - char_id_string += " player(s) in instance: "; + if (char_id_list.size() > 0) + { + char_id_string = fmt::format("{} player(s) in instance: ", char_id_list.size()); auto iter = char_id_list.begin(); while (iter != char_id_list.end()) { char char_name[64]; @@ -3290,5706 +1450,2848 @@ XS(XS__GetCharactersInInstance) { if (iter != char_id_list.end()) char_id_string += ", "; } - RETVAL = char_id_string.c_str(); - } else - RETVAL = "No players in that instance."; - - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__AssignToInstance); -XS(XS__AssignToInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::AssignToInstance(uint16 instance_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - quest_manager.AssignToInstance(instance_id); - - XSRETURN_EMPTY; -} - -XS(XS__AssignToInstanceByCharID); -XS(XS__AssignToInstanceByCharID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::AssignToInstanceByCharID(uint16 instance_id, uint32 char_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - uint32 char_id = (int) SvUV(ST(1)); - quest_manager.AssignToInstanceByCharID(instance_id, char_id); - - XSRETURN_EMPTY; -} - -XS(XS__AssignGroupToInstance); -XS(XS__AssignGroupToInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::AssignGroupToInstance(uint16 instance_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - quest_manager.AssignGroupToInstance(instance_id); - - XSRETURN_EMPTY; -} - -XS(XS__AssignRaidToInstance); -XS(XS__AssignRaidToInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::AssignRaidToInstance(uint16 instance_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - quest_manager.AssignRaidToInstance(instance_id); - - XSRETURN_EMPTY; -} - -XS(XS__RemoveFromInstance); -XS(XS__RemoveFromInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::RemoveFromInstance(uint16 instance_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - quest_manager.RemoveFromInstance(instance_id); - - XSRETURN_EMPTY; -} - -XS(XS__RemoveFromInstanceByCharID); -XS(XS__RemoveFromInstanceByCharID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - uint32 char_id = (int) SvUV(ST(1)); - quest_manager.RemoveFromInstanceByCharID(instance_id, char_id); - - XSRETURN_EMPTY; -} - -XS(XS__CheckInstanceByCharID); -XS(XS__CheckInstanceByCharID) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: quest::CheckInstanceByCharID(uint16 instance_id, uint32 char_id)"); - } - - bool RETVAL; - dXSTARG; - - uint16 instance_id = (int) SvUV(ST(0)); - uint32 char_id = (int) SvUV(ST(1)); - RETVAL = quest_manager.CheckInstanceByCharID(instance_id, char_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__RemoveAllFromInstance); -XS(XS__RemoveAllFromInstance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::RemoveAllFromInstance(uint16 instance_id)"); - - uint16 instance_id = (int) SvUV(ST(0)); - quest_manager.RemoveAllFromInstance(instance_id); - - XSRETURN_EMPTY; -} - -XS(XS__MovePCInstance); -XS(XS__MovePCInstance) { - dXSARGS; - if (items != 5 && items != 6) - Perl_croak(aTHX_ "Usage: quest::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, [float heading])"); - - int zone_id = (int) SvIV(ST(0)); - int instance_id = (int) SvIV(ST(1)); - float x = (float) SvNV(ST(2)); - float y = (float) SvNV(ST(3)); - float z = (float) SvNV(ST(4)); - float heading = 0.0f; - - if (items == 6) { - heading = (float) SvNV(ST(5)); - } - - quest_manager.MovePCInstance(zone_id, instance_id, glm::vec4(x, y, z, heading)); - - XSRETURN_EMPTY; -} - -XS(XS__FlagInstanceByGroupLeader); -XS(XS__FlagInstanceByGroupLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::FlagInstanceByGroupLeader(uint32 zone, uint16 version)"); - - uint32 zone = (int) SvUV(ST(0)); - uint16 version = (int) SvUV(ST(1)); - quest_manager.FlagInstanceByGroupLeader(zone, version); - - XSRETURN_EMPTY; -} - -XS(XS__FlagInstanceByRaidLeader); -XS(XS__FlagInstanceByRaidLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::FlagInstanceByRaidLeader(uint32 zone, uint16 version)"); - - uint32 zone = (int) SvUV(ST(0)); - uint16 version = (int) SvUV(ST(1)); - quest_manager.FlagInstanceByRaidLeader(zone, version); - - XSRETURN_EMPTY; -} - -XS(XS__saylink); -XS(XS__saylink) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::saylink(string message, [bool silent = false], [link_name = message])"); - dXSTARG; - - std::string RETVAL; - char message[250]; - char link_name[250]; - bool silent = false; - strcpy(message, (char *) SvPV_nolen(ST(0))); - if (items >= 2) { - silent = ((int) SvIV(ST(1))) == 0 ? false : true; - } - if (items == 3) - strcpy(link_name, (char *) SvPV_nolen(ST(2))); - else - strcpy(link_name, message); - - RETVAL = quest_manager.saylink(message, silent, link_name); - - sv_setpv(TARG, RETVAL.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getcharnamebyid); -XS(XS__getcharnamebyid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getcharnamebyid(uint32 char_id)"); - dXSTARG; - - Const_char *RETVAL; - uint32 char_id = (int) SvUV(ST(0)); - auto name = quest_manager.getcharnamebyid(char_id); - - RETVAL = name.c_str(); - - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; -} - -XS(XS__getcharidbyname); -XS(XS__getcharidbyname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getcharidbyname(string name)"); - dXSTARG; - - uint32 RETVAL; - const char *name = (const char *) SvPV_nolen(ST(0)); - - RETVAL = quest_manager.getcharidbyname(name); - XSprePUSH; - PUSHu((UV) RETVAL); - - XSRETURN(1); -} - -XS(XS__getclassname); -XS(XS__getclassname) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: quest::getclassname(uint8 class_id, [uint8 level = 0])"); - dXSTARG; - - std::string RETVAL; - uint8 class_id = (int) SvUV(ST(0)); - uint8 level = 0; - if (items > 1) - level = (int) SvUV(ST(1)); - - RETVAL = quest_manager.getclassname(class_id, level); - sv_setpv(TARG, RETVAL.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getcurrencyitemid); -XS(XS__getcurrencyitemid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getcurrencyitemid(int currency_id)"); - dXSTARG; - - int RETVAL; - uint32 currency_id = (uint32) SvUV(ST(0)); - - RETVAL = quest_manager.getcurrencyitemid(currency_id); - - XSprePUSH; - PUSHi((IV) RETVAL); - XSRETURN(1); -} - -XS(XS__getcurrencyid); -XS(XS__getcurrencyid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getcurrencyid(uint32 item_id)"); - dXSTARG; - - uint32 RETVAL; - uint32 item_id = (uint32) SvUV(ST(0)); - - RETVAL = quest_manager.getcurrencyid(item_id); - XSprePUSH; - PUSHi((IV) RETVAL); - XSRETURN(1); -} - -XS(XS__getguildnamebyid); -XS(XS__getguildnamebyid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getguildnamebyid(uint32 guild_id)"); - dXSTARG; - - Const_char *RETVAL; - uint32 guild_id = (int) SvUV(ST(0)); - - RETVAL = quest_manager.getguildnamebyid(guild_id); - - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getguildidbycharid); -XS(XS__getguildidbycharid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getguildidbycharid(uint32 char_id)"); - dXSTARG; - - int RETVAL; - uint32 char_id = (int) SvUV(ST(0)); - - RETVAL = quest_manager.getguildidbycharid(char_id); - - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); -} - -XS(XS__getgroupidbycharid); -XS(XS__getgroupidbycharid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getgroupidbycharid(uint32 char_id)"); - dXSTARG; - - int RETVAL; - uint32 char_id = (int) SvUV(ST(0)); - - RETVAL = quest_manager.getgroupidbycharid(char_id); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); -} - -XS(XS__getraididbycharid); -XS(XS__getraididbycharid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getraididbycharid(uint32 char_id)"); - dXSTARG; - - int RETVAL; - uint32 char_id = (int) SvUV(ST(0)); - - RETVAL = quest_manager.getraididbycharid(char_id); - XSprePUSH; - PUSHi((IV) RETVAL); - - XSRETURN(1); -} - -XS(XS__SetRunning); -XS(XS__SetRunning) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::SetRunning(bool is_running)"); - - bool val = ((int) SvIV(ST(0))) == 0 ? false : true; - - quest_manager.SetRunning(val); - - XSRETURN_EMPTY; -} - -XS(XS__IsRunning); -XS(XS__IsRunning) { - dXSARGS; - if (items >= 1) - Perl_croak(aTHX_ "Usage: quest::IsRunning()"); - - bool RETVAL; - dXSTARG; - - RETVAL = quest_manager.IsRunning(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsEffectInSpell); -XS(XS__IsEffectInSpell) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::IsEffectInSpell(uint32 spell_id, uint32 effect_id)"); - - uint32 spell_id = (uint32) SvUV(ST(0)); - uint32 effect_id = (uint32) SvUV(ST(1)); - bool RETVAL; - dXSTARG; - - RETVAL = IsEffectInSpell(spell_id, effect_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsBeneficialSpell); -XS(XS__IsBeneficialSpell) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::IsBeneficialSpell(uint32 spell_id)"); - - uint32 spell_id = (uint32) SvUV(ST(0)); - bool RETVAL; - dXSTARG; - - RETVAL = BeneficialSpell(spell_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__GetSpellResistType); -XS(XS__GetSpellResistType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetSpellResistType(uint32 spell_id)"); - - uint32 spell_id = (uint32) SvUV(ST(0)); - int32 spell_val = 0; - dXSTARG; - - spell_val = GetSpellResistType(spell_id); - XSRETURN_UV(spell_val); -} - -XS(XS__GetSpellTargetType); -XS(XS__GetSpellTargetType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetSpellTargetType(uint32 spell_id)"); - - uint32 spell_id = (uint32) SvUV(ST(0)); - int32 spell_val = 0; - dXSTARG; - - spell_val = GetSpellTargetType(spell_id); - XSRETURN_UV(spell_val); -} - -XS(XS__FlyMode); -XS(XS__FlyMode) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::FlyMode(uint8 mode [0-5])"); - - GravityBehavior flymode = (GravityBehavior) SvUV(ST(0)); - quest_manager.FlyMode(flymode); - - XSRETURN_EMPTY; -} - -XS(XS_FactionValue); -XS(XS_FactionValue) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::factionvalue()"); - - uint8 fac = quest_manager.FactionValue(); - XSRETURN_UV(fac); -} - -XS(XS__enabletitle); -XS(XS__enabletitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::enabletitle(int title_set_id)"); - - int titleset = (int) SvIV(ST(0)); - - quest_manager.enabletitle(titleset); - - XSRETURN_EMPTY; -} - -XS(XS__checktitle); -XS(XS__checktitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::checktitle(int title_set_id)"); - - bool RETVAL; - int titleset = (int) SvIV(ST(0)); - - RETVAL = quest_manager.checktitle(titleset); - - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__removetitle); -XS(XS__removetitle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::removetitle(int title_set_id)"); - - int titleset = (int) SvIV(ST(0)); - - quest_manager.removetitle(titleset); - - XSRETURN_EMPTY; -} - -XS(XS__wearchange); -XS(XS__wearchange) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: quest::wearchange(uint8 slot, uint16 texture_id, [uint32 hero_forge_model_id = 0], [uint32 elite_material_id = 0])"); - - uint8 slot = (int) SvUV(ST(0)); - uint16 texture_id = (int) SvUV(ST(1)); - - uint32 hero_forge_model_id = 0; - uint32 elite_material_id = 0; - - if (items > 2) - hero_forge_model_id = (int) SvUV(ST(2)); - - if (items > 3) - elite_material_id = (int) SvUV(ST(3)); - - quest_manager.wearchange(slot, texture_id, hero_forge_model_id, elite_material_id); - - XSRETURN_EMPTY; -} - -XS(XS__voicetell); -XS(XS__voicetell) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: quest::voicetell(string client_name, int macro_id, int ace_id, int gender_id)"); - - char *client_name = (char *) SvPV_nolen(ST(0)); - int macro_id = (int) SvIV(ST(1)); - int race_id = (int) SvIV(ST(2)); - int gender_id = (int) SvIV(ST(3)); - - quest_manager.voicetell(client_name, macro_id, race_id, gender_id); - - XSRETURN_EMPTY; -} - -XS(XS__LearnRecipe); -XS(XS__LearnRecipe) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::LearnRecipe(int recipe_id)"); - - uint32 recipe_id = (uint32) SvIV(ST(0)); - - quest_manager.LearnRecipe(recipe_id); - - XSRETURN_EMPTY; -} - -XS(XS__SendMail); -XS(XS__SendMail) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: quest::SendMail(stirng to, string from, string subject, string message)"); - - char *to = (char *) SvPV_nolen(ST(0)); - char *from = (char *) SvPV_nolen(ST(1)); - char *subject = (char *) SvPV_nolen(ST(2)); - char *message = (char *) SvPV_nolen(ST(3)); - - quest_manager.SendMail(to, from, subject, message); - - XSRETURN_EMPTY; -} - -XS(XS__GetZoneID); -XS(XS__GetZoneID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetZoneID(string zone)"); - - char *zone = (char *) SvPV_nolen(ST(0)); - int32 id = quest_manager.GetZoneID(zone); - - XSRETURN_IV(id); -} - -XS(XS__GetZoneLongName); -XS(XS__GetZoneLongName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetZoneLongName(string zone)"); - dXSTARG; - - std::string zone = (std::string) SvPV_nolen(ST(0)); - std::string RETVAL = quest_manager.GetZoneLongName(zone); - - sv_setpv(TARG, RETVAL.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__GetZoneLongNameByID); -XS(XS__GetZoneLongNameByID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetZoneLongNameByID(uint32 zone_id)"); - - dXSTARG; - uint32 zone_id = (uint32) SvUV(ST(0)); - std::string zone_long_name = quest_manager.GetZoneLongNameByID(zone_id); - sv_setpv(TARG, zone_long_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__GetZoneShortName); -XS(XS__GetZoneShortName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::GetZoneShortName(uint32 zone_id)"); - - dXSTARG; - uint32 zone_id = (uint32) SvUV(ST(0)); - std::string zone_short_name = quest_manager.GetZoneShortName(zone_id); - sv_setpv(TARG, zone_short_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__GetTimeSeconds); -XS(XS__GetTimeSeconds) { - dXSARGS; - if (items != 0) - Perl_croak(aTHX_ "Usage: quest::GetTimeSeconds()"); - - uint32 seconds = 0; - dXSTARG; - - seconds = Timer::GetTimeSeconds(); - XSRETURN_UV(seconds); -} - -XS(XS__enablerecipe); -XS(XS__enablerecipe) { - dXSARGS; - bool success = false; - - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::enablerecipe(int recipe_id)"); - } else { - uint32 recipe_id = (uint32) SvIV(ST(0)); - success = quest_manager.EnableRecipe(recipe_id); - } - if (!success) { - XSRETURN_NO; - } - - XSRETURN_YES; -} - -XS(XS__disablerecipe); -XS(XS__disablerecipe) { - dXSARGS; - bool success = false; - - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::disablerecipe(int recipe_id)"); - } else { - uint32 recipe_id = (uint32) SvIV(ST(0)); - success = quest_manager.DisableRecipe(recipe_id); - } - if (!success) { - XSRETURN_NO; - } - - XSRETURN_YES; -} - -XS(XS__clear_npctype_cache); -XS(XS__clear_npctype_cache) { - dXSARGS; - - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::clear_npctype_cache(int npc_type_id)"); - } else { - int32 npc_type_id = (int32) SvIV(ST(0)); - quest_manager.ClearNPCTypeCache(npc_type_id); - } - - XSRETURN_EMPTY; -} - -XS(XS__reloadzonestaticdata); -XS(XS__reloadzonestaticdata) { - dXSARGS; - - quest_manager.ReloadZoneStaticData(); - - XSRETURN_EMPTY; -} - -XS(XS__qs_send_query); -XS(XS__qs_send_query) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::qs_send_query(string query)"); - } else { - // char *Query = (char *)SvPV_nolen(ST(0)); - std::string Query = (std::string) SvPV_nolen(ST(0)); - QServ->SendQuery(Query); - } - XSRETURN_EMPTY; -} - -XS(XS__qs_player_event); -XS(XS__qs_player_event) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: quest::qs_player_event(int character_id, string message)"); - } else { - int char_id = (int) SvIV(ST(0)); - std::string message = (std::string) SvPV_nolen(ST(1)); - QServ->PlayerLogEvent(Player_Log_Quest, char_id, message); - } - XSRETURN_EMPTY; -} - - - -XS(XS__log); -XS(XS__log) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: quest::log(uint8 log_category, string message)"); - } - else { - uint8 log_category = (uint8)SvIV(ST(0)); - std::string log_message = (std::string) SvPV_nolen(ST(1)); - - if (log_category >= Logs::MaxCategoryID) { - return; - } - - Log(Logs::General, log_category, log_message.c_str()); - } - XSRETURN_EMPTY; -} - -XS(XS__debug); -XS(XS__debug) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: quest::debug(string message, [uint8 debug_level = 1 [1-3]])"); - } else { - std::string log_message = (std::string) SvPV_nolen(ST(0)); - uint8 debug_level = 1; - - if (items == 2) - debug_level = (uint8) SvIV(ST(1)); - - if (debug_level > Logs::Detail) - return; - - if (debug_level == Logs::General) { - Log(Logs::General, Logs::QuestDebug, log_message.c_str()); - } else if (debug_level == Logs::Moderate) { - Log(Logs::Moderate, Logs::QuestDebug, log_message.c_str()); - } else if (debug_level == Logs::Detail) { - Log(Logs::Detail, Logs::QuestDebug, log_message.c_str()); - } - } - XSRETURN_EMPTY; -} - -XS(XS__log_combat); -XS(XS__log_combat) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::log_combat(string message)"); - } - else { - - std::string log_message = (std::string) SvPV_nolen(ST(0)); - Log(Logs::General, Logs::Combat, log_message.c_str()); - } - XSRETURN_EMPTY; -} - - -XS(XS__UpdateZoneHeader); -XS(XS__UpdateZoneHeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::UpdateZoneHeader(string key, string value)"); - - std::string key = (std::string) SvPV_nolen(ST(0)); - std::string str_value = (std::string) SvPV_nolen(ST(1)); - quest_manager.UpdateZoneHeader(key, str_value); - - XSRETURN_EMPTY; -} - -XS(XS__set_rule); -XS(XS__set_rule) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::set_rule(string rule_name, string rule_value)"); - - std::string rule_name = (std::string) SvPV_nolen(ST(0)); - std::string rule_value = (std::string) SvPV_nolen(ST(1)); - RuleManager::Instance()->SetRule(rule_name.c_str(), rule_value.c_str()); - - XSRETURN_EMPTY; -} - -XS(XS__get_rule); -XS(XS__get_rule) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::get_rule(string rule_name)"); - - dXSTARG; - std::string rule_name = (std::string) SvPV_nolen(ST(0)); - std::string rule_value; - RuleManager::Instance()->GetRule(rule_name.c_str(), rule_value); - - sv_setpv(TARG, rule_value.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__get_data); -XS(XS__get_data) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::get_data(string bucket_key)"); - - dXSTARG; - std::string key = (std::string) SvPV_nolen(ST(0)); - - sv_setpv(TARG, DataBucket::GetData(key).c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__get_data_expires); -XS(XS__get_data_expires) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::get_data_expires(string bucket_key)"); - - dXSTARG; - std::string key = (std::string) SvPV_nolen(ST(0)); - - sv_setpv(TARG, DataBucket::GetDataExpires(key).c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__set_data); -XS(XS__set_data) { - dXSARGS; - if (items != 2 && items != 3) { - Perl_croak(aTHX_ "Usage: quest::set_data(string key, string value, [string expires_at = 0])"); - } else { - std::string key = (std::string) SvPV_nolen(ST(0)); - std::string value = (std::string) SvPV_nolen(ST(1)); - - std::string expires_at; - if (items == 3) - expires_at = (std::string) SvPV_nolen(ST(2)); - - DataBucket::SetData(key, value, expires_at); - } - XSRETURN_EMPTY; -} - -XS(XS__delete_data); -XS(XS__delete_data) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::delete_data(string bucket_key)"); - - dXSTARG; - std::string key = (std::string) SvPV_nolen(ST(0)); - - XSprePUSH; - PUSHi((IV) DataBucket::DeleteData(key)); - - XSRETURN(1); -} - - -XS(XS__IsClassicEnabled); -XS(XS__IsClassicEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_classic_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsClassicEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheRuinsOfKunarkEnabled); -XS(XS__IsTheRuinsOfKunarkEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_ruins_of_kunark_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheRuinsOfKunarkEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheScarsOfVeliousEnabled); -XS(XS__IsTheScarsOfVeliousEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_scars_of_velious_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheScarsOfVeliousEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheShadowsOfLuclinEnabled); -XS(XS__IsTheShadowsOfLuclinEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_shadows_of_luclin_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheShadowsOfLuclinEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsThePlanesOfPowerEnabled); -XS(XS__IsThePlanesOfPowerEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_planes_of_power_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsThePlanesOfPowerEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheLegacyOfYkeshaEnabled); -XS(XS__IsTheLegacyOfYkeshaEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_legacy_of_ykesha_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheLegacyOfYkeshaEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsLostDungeonsOfNorrathEnabled); -XS(XS__IsLostDungeonsOfNorrathEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_lost_dungeons_of_norrath_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsLostDungeonsOfNorrathEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsGatesOfDiscordEnabled); -XS(XS__IsGatesOfDiscordEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_gates_of_discord_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsGatesOfDiscordEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsOmensOfWarEnabled); -XS(XS__IsOmensOfWarEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_omens_of_war_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsOmensOfWarEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsDragonsOfNorrathEnabled); -XS(XS__IsDragonsOfNorrathEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_dragons_of_norrath_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsDragonsOfNorrathEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsDepthsOfDarkhollowEnabled); -XS(XS__IsDepthsOfDarkhollowEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_depths_of_darkhollow_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsDepthsOfDarkhollowEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsProphecyOfRoEnabled); -XS(XS__IsProphecyOfRoEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_prophecy_of_ro_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsProphecyOfRoEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheSerpentsSpineEnabled); -XS(XS__IsTheSerpentsSpineEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_serpents_spine_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheSerpentsSpineEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheBuriedSeaEnabled); -XS(XS__IsTheBuriedSeaEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_buried_sea_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheBuriedSeaEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsSecretsOfFaydwerEnabled); -XS(XS__IsSecretsOfFaydwerEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_secrets_of_faydwer_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsSecretsOfFaydwerEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsSeedsOfDestructionEnabled); -XS(XS__IsSeedsOfDestructionEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_seeds_of_destruction_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsSeedsOfDestructionEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsUnderfootEnabled); -XS(XS__IsUnderfootEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_underfoot_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsUnderfootEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsHouseOfThuleEnabled); -XS(XS__IsHouseOfThuleEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_house_of_thule_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsHouseOfThuleEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsVeilOfAlarisEnabled); -XS(XS__IsVeilOfAlarisEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_veil_of_alaris_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsVeilOfAlarisEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsRainOfFearEnabled); -XS(XS__IsRainOfFearEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_rain_of_fear_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsRainOfFearEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCallOfTheForsakenEnabled); -XS(XS__IsCallOfTheForsakenEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_call_of_the_forsaken_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCallOfTheForsakenEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheDarkenedSeaEnabled); -XS(XS__IsTheDarkenedSeaEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_darkened_sea_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheDarkenedSeaEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheBrokenMirrorEnabled); -XS(XS__IsTheBrokenMirrorEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_broken_mirror_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheBrokenMirrorEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsEmpiresOfKunarkEnabled); -XS(XS__IsEmpiresOfKunarkEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_empires_of_kunark_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsEmpiresOfKunarkEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsRingOfScaleEnabled); -XS(XS__IsRingOfScaleEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_ring_of_scale_enabled()"); } - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsRingOfScaleEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTheBurningLandsEnabled); -XS(XS__IsTheBurningLandsEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_the_burning_lands_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTheBurningLandsEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsTormentOfVeliousEnabled); -XS(XS__IsTormentOfVeliousEnabled) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_torment_of_velious_enabled()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsTormentOfVeliousEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionClassic); -XS(XS__IsCurrentExpansionClassic) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_classic()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionClassic(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheRuinsOfKunark); -XS(XS__IsCurrentExpansionTheRuinsOfKunark) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_ruins_of_kunark()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheRuinsOfKunark(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheScarsOfVelious); -XS(XS__IsCurrentExpansionTheScarsOfVelious) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_scars_of_velious()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheScarsOfVelious(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheShadowsOfLuclin); -XS(XS__IsCurrentExpansionTheShadowsOfLuclin) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_shadows_of_luclin()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheShadowsOfLuclin(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionThePlanesOfPower); -XS(XS__IsCurrentExpansionThePlanesOfPower) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_planes_of_power()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionThePlanesOfPower(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheLegacyOfYkesha); -XS(XS__IsCurrentExpansionTheLegacyOfYkesha) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_legacy_of_ykesha()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheLegacyOfYkesha(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionLostDungeonsOfNorrath); -XS(XS__IsCurrentExpansionLostDungeonsOfNorrath) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_lost_dungeons_of_norrath()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionLostDungeonsOfNorrath(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionGatesOfDiscord); -XS(XS__IsCurrentExpansionGatesOfDiscord) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_gates_of_discord()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionGatesOfDiscord(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionOmensOfWar); -XS(XS__IsCurrentExpansionOmensOfWar) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_omens_of_war()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionOmensOfWar(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionDragonsOfNorrath); -XS(XS__IsCurrentExpansionDragonsOfNorrath) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_dragons_of_norrath()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionDragonsOfNorrath(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionDepthsOfDarkhollow); -XS(XS__IsCurrentExpansionDepthsOfDarkhollow) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_depths_of_darkhollow()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionDepthsOfDarkhollow(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionProphecyOfRo); -XS(XS__IsCurrentExpansionProphecyOfRo) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_prophecy_of_ro()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionProphecyOfRo(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheSerpentsSpine); -XS(XS__IsCurrentExpansionTheSerpentsSpine) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_serpents_spine()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheSerpentsSpine(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheBuriedSea); -XS(XS__IsCurrentExpansionTheBuriedSea) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_buried_sea()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheBuriedSea(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionSecretsOfFaydwer); -XS(XS__IsCurrentExpansionSecretsOfFaydwer) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_secrets_of_faydwer()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionSecretsOfFaydwer(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionSeedsOfDestruction); -XS(XS__IsCurrentExpansionSeedsOfDestruction) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_seeds_of_destruction()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionSeedsOfDestruction(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionUnderfoot); -XS(XS__IsCurrentExpansionUnderfoot) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_underfoot()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionUnderfoot(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionHouseOfThule); -XS(XS__IsCurrentExpansionHouseOfThule) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_house_of_thule()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionHouseOfThule(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionVeilOfAlaris); -XS(XS__IsCurrentExpansionVeilOfAlaris) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_veil_of_alaris()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionVeilOfAlaris(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionRainOfFear); -XS(XS__IsCurrentExpansionRainOfFear) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_rain_of_fear()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionRainOfFear(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionCallOfTheForsaken); -XS(XS__IsCurrentExpansionCallOfTheForsaken) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_call_of_the_forsaken()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionCallOfTheForsaken(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheDarkenedSea); -XS(XS__IsCurrentExpansionTheDarkenedSea) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_darkened_sea()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheDarkenedSea(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheBrokenMirror); -XS(XS__IsCurrentExpansionTheBrokenMirror) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_broken_mirror()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheBrokenMirror(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionEmpiresOfKunark); -XS(XS__IsCurrentExpansionEmpiresOfKunark) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_empires_of_kunark()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionEmpiresOfKunark(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionRingOfScale); -XS(XS__IsCurrentExpansionRingOfScale) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_ring_of_scale()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionRingOfScale(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTheBurningLands); -XS(XS__IsCurrentExpansionTheBurningLands) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_the_burning_lands()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTheBurningLands(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsCurrentExpansionTormentOfVelious); -XS(XS__IsCurrentExpansionTormentOfVelious) { - dXSARGS; - if (items >= 1) { - Perl_croak(aTHX_ "Usage: quest::is_current_expansion_torment_of_velious()"); - } - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsCurrentExpansionTormentOfVelious(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); -} - -XS(XS__IsContentFlagEnabled); -XS(XS__IsContentFlagEnabled) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::is_content_flag_enabled(string flag_name)"); - } - - std::string flag_name = (std::string) SvPV_nolen(ST(0)); - - bool RETVAL; - dXSTARG; - RETVAL = content_service.IsContentFlagEnabled(flag_name); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - XSRETURN(1); + return char_id_string; } -XS(XS__SetContentFlag); -XS(XS__SetContentFlag) +void Perl__AssignToInstance(uint16 instance_id) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: quest::set_content_flag(string flag_name, enabled)"); - } - - std::string flag_name = (std::string) SvPV_nolen(ST(0)); - bool enabled = (int) SvIV(ST(1)) != 0; - - content_service.SetContentFlag(flag_name, enabled); - XSRETURN_EMPTY; + quest_manager.AssignToInstance(instance_id); } -XS(XS__get_expedition); -XS(XS__get_expedition) { - dXSARGS; - if (items != 0) { - Perl_croak(aTHX_ "Usage: quest::get_expedition()"); - } +void Perl__AssignToInstanceByCharID(uint16 instance_id, uint32 char_id) +{ + quest_manager.AssignToInstanceByCharID(instance_id, char_id); +} - Expedition* RETVAL = nullptr; +void Perl__AssignGroupToInstance(uint16 instance_id) +{ + quest_manager.AssignGroupToInstance(instance_id); +} + +void Perl__AssignRaidToInstance(uint16 instance_id) +{ + quest_manager.AssignRaidToInstance(instance_id); +} + +void Perl__RemoveFromInstance(uint16 instance_id) +{ + quest_manager.RemoveFromInstance(instance_id); +} + +void Perl__RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id) +{ + quest_manager.RemoveFromInstanceByCharID(instance_id, char_id); +} + +bool Perl__CheckInstanceByCharID(uint16 instance_id, uint32 char_id) +{ + return quest_manager.CheckInstanceByCharID(instance_id, char_id); +} + +void Perl__RemoveAllFromInstance(uint16 instance_id) +{ + quest_manager.RemoveAllFromInstance(instance_id); +} + +void Perl__MovePCInstance(int zone_id, int instance_id, float x, float y, float z) +{ + quest_manager.MovePCInstance(zone_id, instance_id, glm::vec4(x, y, z, 0.0f)); +} + +void Perl__MovePCInstance(int zone_id, int instance_id, float x, float y, float z, float heading) +{ + quest_manager.MovePCInstance(zone_id, instance_id, glm::vec4(x, y, z, heading)); +} + +void Perl__FlagInstanceByGroupLeader(uint32 zone, uint16 version) +{ + quest_manager.FlagInstanceByGroupLeader(zone, version); +} + +void Perl__FlagInstanceByRaidLeader(uint32 zone, uint16 version) +{ + quest_manager.FlagInstanceByRaidLeader(zone, version); +} + +std::string Perl__saylink(const char* text) +{ + // const cast is safe since, target api doesn't modify it + return quest_manager.saylink(const_cast(text), false, text); +} + +std::string Perl__saylink(const char* text, bool silent) +{ + return quest_manager.saylink(const_cast(text), silent, text); +} + +std::string Perl__saylink(const char* text, bool silent, const char* link_name) +{ + return quest_manager.saylink(const_cast(text), silent, link_name); +} + +std::string Perl__getcharnamebyid(uint32 char_id) +{ + return quest_manager.getcharnamebyid(char_id); +} + +uint32_t Perl__getcharidbyname(const char* name) +{ + return quest_manager.getcharidbyname(name); +} + +std::string Perl__getclassname(uint8 class_id) +{ + return quest_manager.getclassname(class_id); +} + +std::string Perl__getclassname(uint8 class_id, uint8 level) +{ + return quest_manager.getclassname(class_id, level); +} + +uint32 Perl__getcurrencyitemid(uint32 currency_id) +{ + return quest_manager.getcurrencyitemid(currency_id); +} + +uint32 Perl__getcurrencyid(uint32 item_id) +{ + return quest_manager.getcurrencyid(item_id); +} + +std::string Perl__getguildnamebyid(int guild_id) +{ + return quest_manager.getguildnamebyid(guild_id); +} + +int Perl__getguildidbycharid(uint32 char_id) +{ + return quest_manager.getguildidbycharid(char_id); +} + +int Perl__getgroupidbycharid(uint32 char_id) +{ + return quest_manager.getgroupidbycharid(char_id); +} + +int Perl__getraididbycharid(uint32 char_id) +{ + return quest_manager.getraididbycharid(char_id); +} + +void Perl__SetRunning(bool is_running) +{ + quest_manager.SetRunning(is_running); +} + +bool Perl__IsRunning() +{ + return quest_manager.IsRunning(); +} + +bool Perl__IsEffectInSpell(uint32 spell_id, uint32 effect_id) +{ + return IsEffectInSpell(spell_id, effect_id); +} + +bool Perl__IsBeneficialSpell(uint16 spell_id) +{ + return BeneficialSpell(spell_id); +} + +int Perl__GetSpellResistType(uint16 spell_id) +{ + return GetSpellResistType(spell_id); +} + +int Perl__GetSpellTargetType(uint16 spell_id) +{ + return GetSpellTargetType(spell_id); +} + +void Perl__FlyMode(GravityBehavior flymode) +{ + quest_manager.FlyMode(flymode); +} + +int Perl__FactionValue() +{ + return quest_manager.FactionValue(); +} + +void Perl__enabletitle(int title_set) +{ + quest_manager.enabletitle(title_set); +} + +bool Perl__checktitle(int title_set) +{ + return quest_manager.checktitle(title_set); +} + +void Perl__removetitle(int title_set) +{ + quest_manager.removetitle(title_set); +} + +void Perl__wearchange(uint8 slot, uint16 texture_id) +{ + quest_manager.wearchange(slot, texture_id); +} + +void Perl__wearchange(uint8 slot, uint16 texture_id, uint32 hero_forge_model_id) +{ + quest_manager.wearchange(slot, texture_id, hero_forge_model_id); +} + +void Perl__wearchange(uint8 slot, uint16 texture_id, uint32 hero_forge_model_id, uint32 elite_material_id) +{ + quest_manager.wearchange(slot, texture_id, hero_forge_model_id, elite_material_id); +} + +void Perl__voicetell(const char* client_name, int macro_id, int race_id, int gender_id) +{ + quest_manager.voicetell(client_name, macro_id, race_id, gender_id); +} + +void Perl__LearnRecipe(int recipe_id) +{ + quest_manager.LearnRecipe(recipe_id); +} + +void Perl__SendMail(const char* to, const char* from, const char* subject, const char* message) +{ + quest_manager.SendMail(to, from, subject, message); +} + +int Perl__GetZoneID(const char* zone) +{ + return quest_manager.GetZoneID(zone); +} + +std::string Perl__GetZoneLongName(std::string zone) +{ + return quest_manager.GetZoneLongName(zone); +} + +std::string Perl__GetZoneLongNameByID(uint32 zone_id) +{ + return quest_manager.GetZoneLongNameByID(zone_id); +} + +std::string Perl__GetZoneShortName(uint32 zone_id) +{ + return quest_manager.GetZoneShortName(zone_id); +} + +uint32 Perl__GetTimeSeconds() +{ + return Timer::GetTimeSeconds(); +} + +bool Perl__enablerecipe(uint32 recipe_id) +{ + return quest_manager.EnableRecipe(recipe_id); +} + +bool Perl__disablerecipe(uint32 recipe_id) +{ + return quest_manager.DisableRecipe(recipe_id); +} + +void Perl__clear_npctype_cache(int npc_type_id) +{ + quest_manager.ClearNPCTypeCache(npc_type_id); +} + +void Perl__reloadzonestaticdata() +{ + quest_manager.ReloadZoneStaticData(); +} + +void Perl__qs_send_query(std::string query) +{ + QServ->SendQuery(std::move(query)); +} + +void Perl__qs_player_event(int char_id, std::string message) +{ + QServ->PlayerLogEvent(Player_Log_Quest, char_id, message); +} + +void Perl__log(int category, const char* message) +{ + if (category < Logs::None || category >= Logs::MaxCategoryID) + return; + + Log(Logs::General, static_cast(category), message); +} + +void Perl__debug(const char* message) +{ + Log(Logs::General, Logs::QuestDebug, message); +} + +void Perl__debug(const char* message, int level) +{ + if (level < Logs::General || level > Logs::Detail) + return; + + Log(static_cast(level), Logs::QuestDebug, message); +} + +void Perl__log_combat(const char* message) +{ + Log(Logs::General, Logs::Combat, message); +} + +void Perl__UpdateZoneHeader(std::string key, std::string value) +{ + quest_manager.UpdateZoneHeader(key, value); +} + +void Perl__set_rule(const char* rule_name, const char* rule_value) +{ + RuleManager::Instance()->SetRule(rule_name, rule_value); +} + +std::string Perl__get_rule(const char* rule_name) +{ + std::string rule_value; + RuleManager::Instance()->GetRule(rule_name, rule_value); + return rule_value; +} + +std::string Perl__get_data(std::string bucket_key) +{ + return DataBucket::GetData(bucket_key); +} + +std::string Perl__get_data_expires(std::string bucket_key) +{ + return DataBucket::GetDataExpires(bucket_key); +} + +void Perl__set_data(std::string key, std::string value) +{ + DataBucket::SetData(key, value); +} + +void Perl__set_data(std::string key, std::string value, std::string expires_at) +{ + DataBucket::SetData(key, value, expires_at); +} + +bool Perl__delete_data(std::string bucket_key) +{ + return DataBucket::DeleteData(bucket_key); +} + +bool Perl__IsClassicEnabled() +{ + return content_service.IsClassicEnabled(); +} + +bool Perl__IsTheRuinsOfKunarkEnabled() +{ + return content_service.IsTheRuinsOfKunarkEnabled(); +} + +bool Perl__IsTheScarsOfVeliousEnabled() +{ + return content_service.IsTheScarsOfVeliousEnabled(); +} + +bool Perl__IsTheShadowsOfLuclinEnabled() +{ + return content_service.IsTheShadowsOfLuclinEnabled(); +} + +bool Perl__IsThePlanesOfPowerEnabled() +{ + return content_service.IsThePlanesOfPowerEnabled(); +} + +bool Perl__IsTheLegacyOfYkeshaEnabled() +{ + return content_service.IsTheLegacyOfYkeshaEnabled(); +} + +bool Perl__IsLostDungeonsOfNorrathEnabled() +{ + return content_service.IsLostDungeonsOfNorrathEnabled(); +} + +bool Perl__IsGatesOfDiscordEnabled() +{ + return content_service.IsGatesOfDiscordEnabled(); +} + +bool Perl__IsOmensOfWarEnabled() +{ + return content_service.IsOmensOfWarEnabled(); +} + +bool Perl__IsDragonsOfNorrathEnabled() +{ + return content_service.IsDragonsOfNorrathEnabled(); +} + +bool Perl__IsDepthsOfDarkhollowEnabled() +{ + return content_service.IsDepthsOfDarkhollowEnabled(); +} + +bool Perl__IsProphecyOfRoEnabled() +{ + return content_service.IsProphecyOfRoEnabled(); +} + +bool Perl__IsTheSerpentsSpineEnabled() +{ + return content_service.IsTheSerpentsSpineEnabled(); +} + +bool Perl__IsTheBuriedSeaEnabled() +{ + return content_service.IsTheBuriedSeaEnabled(); +} + +bool Perl__IsSecretsOfFaydwerEnabled() +{ + return content_service.IsSecretsOfFaydwerEnabled(); +} + +bool Perl__IsSeedsOfDestructionEnabled() +{ + return content_service.IsSeedsOfDestructionEnabled(); +} + +bool Perl__IsUnderfootEnabled() +{ + return content_service.IsUnderfootEnabled(); +} + +bool Perl__IsHouseOfThuleEnabled() +{ + return content_service.IsHouseOfThuleEnabled(); +} + +bool Perl__IsVeilOfAlarisEnabled() +{ + return content_service.IsVeilOfAlarisEnabled(); +} + +bool Perl__IsRainOfFearEnabled() +{ + return content_service.IsRainOfFearEnabled(); +} + +bool Perl__IsCallOfTheForsakenEnabled() +{ + return content_service.IsCallOfTheForsakenEnabled(); +} + +bool Perl__IsTheDarkenedSeaEnabled() +{ + return content_service.IsTheDarkenedSeaEnabled(); +} + +bool Perl__IsTheBrokenMirrorEnabled() +{ + return content_service.IsTheBrokenMirrorEnabled(); +} + +bool Perl__IsEmpiresOfKunarkEnabled() +{ + return content_service.IsEmpiresOfKunarkEnabled(); +} + +bool Perl__IsRingOfScaleEnabled() +{ + return content_service.IsRingOfScaleEnabled(); +} + +bool Perl__IsTheBurningLandsEnabled() +{ + return content_service.IsTheBurningLandsEnabled(); +} + +bool Perl__IsTormentOfVeliousEnabled() +{ + return content_service.IsTormentOfVeliousEnabled(); +} + +bool Perl__IsCurrentExpansionClassic() +{ + return content_service.IsCurrentExpansionClassic(); +} + +bool Perl__IsCurrentExpansionTheRuinsOfKunark() +{ + return content_service.IsCurrentExpansionTheRuinsOfKunark(); +} + +bool Perl__IsCurrentExpansionTheScarsOfVelious() +{ + return content_service.IsCurrentExpansionTheScarsOfVelious(); +} + +bool Perl__IsCurrentExpansionTheShadowsOfLuclin() +{ + return content_service.IsCurrentExpansionTheShadowsOfLuclin(); +} + +bool Perl__IsCurrentExpansionThePlanesOfPower() +{ + return content_service.IsCurrentExpansionThePlanesOfPower(); +} + +bool Perl__IsCurrentExpansionTheLegacyOfYkesha() +{ + return content_service.IsCurrentExpansionTheLegacyOfYkesha(); +} + +bool Perl__IsCurrentExpansionLostDungeonsOfNorrath() +{ + return content_service.IsCurrentExpansionLostDungeonsOfNorrath(); +} + +bool Perl__IsCurrentExpansionGatesOfDiscord() +{ + return content_service.IsCurrentExpansionGatesOfDiscord(); +} + +bool Perl__IsCurrentExpansionOmensOfWar() +{ + return content_service.IsCurrentExpansionOmensOfWar(); +} + +bool Perl__IsCurrentExpansionDragonsOfNorrath() +{ + return content_service.IsCurrentExpansionDragonsOfNorrath(); +} + +bool Perl__IsCurrentExpansionDepthsOfDarkhollow() +{ + return content_service.IsCurrentExpansionDepthsOfDarkhollow(); +} + +bool Perl__IsCurrentExpansionProphecyOfRo() +{ + return content_service.IsCurrentExpansionProphecyOfRo(); +} + +bool Perl__IsCurrentExpansionTheSerpentsSpine() +{ + return content_service.IsCurrentExpansionTheSerpentsSpine(); +} + +bool Perl__IsCurrentExpansionTheBuriedSea() +{ + return content_service.IsCurrentExpansionTheBuriedSea(); +} + +bool Perl__IsCurrentExpansionSecretsOfFaydwer() +{ + return content_service.IsCurrentExpansionSecretsOfFaydwer(); +} + +bool Perl__IsCurrentExpansionSeedsOfDestruction() +{ + return content_service.IsCurrentExpansionSeedsOfDestruction(); +} + +bool Perl__IsCurrentExpansionUnderfoot() +{ + return content_service.IsCurrentExpansionUnderfoot(); +} + +bool Perl__IsCurrentExpansionHouseOfThule() +{ + return content_service.IsCurrentExpansionHouseOfThule(); +} + +bool Perl__IsCurrentExpansionVeilOfAlaris() +{ + return content_service.IsCurrentExpansionVeilOfAlaris(); +} + +bool Perl__IsCurrentExpansionRainOfFear() +{ + return content_service.IsCurrentExpansionRainOfFear(); +} + +bool Perl__IsCurrentExpansionCallOfTheForsaken() +{ + return content_service.IsCurrentExpansionCallOfTheForsaken(); +} + +bool Perl__IsCurrentExpansionTheDarkenedSea() +{ + return content_service.IsCurrentExpansionTheDarkenedSea(); +} + +bool Perl__IsCurrentExpansionTheBrokenMirror() +{ + return content_service.IsCurrentExpansionTheBrokenMirror(); +} + +bool Perl__IsCurrentExpansionEmpiresOfKunark() +{ + return content_service.IsCurrentExpansionEmpiresOfKunark(); +} + +bool Perl__IsCurrentExpansionRingOfScale() +{ + return content_service.IsCurrentExpansionRingOfScale(); +} + +bool Perl__IsCurrentExpansionTheBurningLands() +{ + return content_service.IsCurrentExpansionTheBurningLands(); +} + +bool Perl__IsCurrentExpansionTormentOfVelious() +{ + return content_service.IsCurrentExpansionTormentOfVelious(); +} + +bool Perl__IsContentFlagEnabled(std::string flag_name) +{ + return content_service.IsContentFlagEnabled(flag_name); +} + +void Perl__SetContentFlag(std::string flag_name, bool enabled) +{ + content_service.SetContentFlag(flag_name, enabled); +} + +Expedition* Perl__get_expedition() +{ if (zone && zone->GetInstanceID() != 0) { - RETVAL = Expedition::FindCachedExpeditionByZoneInstance(zone->GetZoneID(), zone->GetInstanceID()); + return Expedition::FindCachedExpeditionByZoneInstance(zone->GetZoneID(), zone->GetInstanceID()); } - EXTEND(sp, 1); // grow stack, function had 0 arguments - ST(0) = sv_newmortal(); // PUSHs(sv_newmortal()); - if (RETVAL) { - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - } - - XSRETURN(1); + return nullptr; } -XS(XS__get_expedition_by_char_id); -XS(XS__get_expedition_by_char_id) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::get_expedition_by_char_id(uint32 character_id)"); - } - - uint32 character_id = (int)SvUV(ST(0)); - - Expedition* RETVAL = Expedition::FindCachedExpeditionByCharacterID(character_id); - - ST(0) = sv_newmortal(); - if (RETVAL) { - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - } - - XSRETURN(1); +Expedition* Perl__get_expedition_by_char_id(uint32 char_id) +{ + return Expedition::FindCachedExpeditionByCharacterID(char_id); } -XS(XS__get_expedition_by_dz_id); -XS(XS__get_expedition_by_dz_id) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::get_expedition_by_dz_id(uint32 dynamic_zone_id)"); - } - - uint32 dz_id = (int)SvUV(ST(0)); - - Expedition* RETVAL = Expedition::FindCachedExpeditionByDynamicZoneID(dz_id); - - ST(0) = sv_newmortal(); - if (RETVAL) { - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - } - - XSRETURN(1); +Expedition* Perl__get_expedition_by_dz_id(uint32 dz_id) +{ + return Expedition::FindCachedExpeditionByDynamicZoneID(dz_id); } -XS(XS__get_expedition_by_zone_instance); -XS(XS__get_expedition_by_zone_instance) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: quest::GetExpeditionByZoneInstance(uint16 zone_id, uint16 instance_id)"); - } - - uint16 zone_id = (uint16)SvUV(ST(0)); - uint16 instance_id = (uint16)SvUV(ST(1)); - - Expedition* RETVAL = Expedition::FindCachedExpeditionByZoneInstance(zone_id, instance_id); - - ST(0) = sv_newmortal(); - if (RETVAL) { - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - } - - XSRETURN(1); +Expedition* Perl__get_expedition_by_zone_instance(uint32 zone_id, uint32 instance_id) +{ + return Expedition::FindCachedExpeditionByZoneInstance(zone_id, instance_id); } -XS(XS__get_expedition_lockout_by_char_id); -XS(XS__get_expedition_lockout_by_char_id) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: quest::get_expedition_lockout_by_char_id(uint32 character_id, string expedition_name, string event_name)"); - } +perl::reference Perl__get_expedition_lockout_by_char_id(uint32 char_id, std::string expedition_name, std::string event_name) +{ + perl::hash table; - uint32_t character_id = static_cast(SvUV(ST(0))); - std::string expedition_name = SvPV_nolen(ST(1)); - std::string event_name = SvPV_nolen(ST(2)); + auto lockouts = Expedition::GetExpeditionLockoutsByCharacterID(char_id); - auto lockouts = Expedition::GetExpeditionLockoutsByCharacterID(character_id); auto it = std::find_if(lockouts.begin(), lockouts.end(), [&](const ExpeditionLockoutTimer& lockout) { return lockout.IsSameLockout(expedition_name, event_name); }); - // mortalize so its refcnt is auto decremented on function exit to avoid leak - HV* hash = (HV*)sv_2mortal((SV*)newHV()); // hash refcnt +1 (mortal -1) - if (it != lockouts.end()) { - hv_store(hash, "remaining", strlen("remaining"), newSVuv(it->GetSecondsRemaining()), 0); - hv_store(hash, "uuid", strlen("uuid"), newSVpv(it->GetExpeditionUUID().c_str(), 0), 0); + table["remaining"] = it->GetSecondsRemaining(); + table["uuid"] = it->GetExpeditionUUID(); } - ST(0) = sv_2mortal(newRV((SV*)hash)); // hash refcnt: 2 (-1 mortal), reference: 1 (-1 mortal) - XSRETURN(1); + return perl::reference(table); } -XS(XS__get_expedition_lockouts_by_char_id); -XS(XS__get_expedition_lockouts_by_char_id) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: quest::get_expedition_lockouts_by_char_id(uint32 character_id, [string expedition_name])"); - } - - HV* hash = newHV(); // hash refcnt +1 (non-mortal, newRV_noinc to not inc) - SV* hash_ref = nullptr; // for expedition event hash if filtering on expedition - - uint32_t character_id = static_cast(SvUV(ST(0))); - std::string expedition_name; - if (items == 2) - { - expedition_name = SvPV_nolen(ST(1)); - } - - auto lockouts = Expedition::GetExpeditionLockoutsByCharacterID(character_id); +perl::reference Perl__get_expedition_lockouts_by_char_id(uint32 char_id) +{ + perl::hash table; + auto lockouts = Expedition::GetExpeditionLockoutsByCharacterID(char_id); for (const auto& lockout : lockouts) { - uint32_t name_len = static_cast(lockout.GetExpeditionName().size()); - uint32_t event_len = static_cast(lockout.GetEventName().size()); - - // hashes are stored through references inside other hashes/arrays. we need - // to wrap newHV in newRV references when inserting nested hash values. - // we use newRV_noinc to not increment the hash's ref count; rv will own it - - SV** entry = hv_fetch(hash, lockout.GetExpeditionName().c_str(), name_len, false); - if (!entry) + if (!table.exists(lockout.GetExpeditionName())) { - // create expedition entry in hash with its value as ref to event hash - SV* event_hash_ref = newRV_noinc((SV*)newHV()); // ref takes ownership - if (!expedition_name.empty() && lockout.GetExpeditionName() == expedition_name) - { - hash_ref = event_hash_ref; // save ref for filtered expedition return - } - entry = hv_store(hash, lockout.GetExpeditionName().c_str(), name_len, event_hash_ref, 0); + table[lockout.GetExpeditionName()] = perl::reference(perl::hash()); } - // *entry is a reference to expedition's event hash (which it owns). the - // event entry in the hash will contain ref to a lockout detail hash - if (entry && SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVHV) // is ref to hash type + perl::hash expedition_table = table[lockout.GetExpeditionName()]; + if (!expedition_table.exists(lockout.GetEventName())) { - HV* details_hash = newHV(); // refcnt +1, reference will take ownership - hv_store(details_hash, "remaining", strlen("remaining"), newSVuv(lockout.GetSecondsRemaining()), 0); - hv_store(details_hash, "uuid", strlen("uuid"), newSVpv(lockout.GetExpeditionUUID().c_str(), 0), 0); - - HV* event_hash = (HV*)SvRV(*entry); - hv_store(event_hash, lockout.GetEventName().c_str(), event_len, - (SV*)newRV_noinc((SV*)details_hash), 0); + expedition_table[lockout.GetEventName()] = perl::reference(perl::hash()); } + + perl::hash event_table = expedition_table[lockout.GetEventName()]; + event_table["remaining"] = lockout.GetSecondsRemaining(); + event_table["uuid"] = lockout.GetExpeditionUUID(); } - SV* rv = &PL_sv_undef; - - if (!expedition_name.empty()) - { - rv = hash_ref ? sv_2mortal(hash_ref) : &PL_sv_undef; // ref that owns event hash for expedition - } - else - { - rv = sv_2mortal(newRV_noinc((SV*)hash)); // takes ownership of expedition hash - } - - ST(0) = rv; - XSRETURN(1); + return perl::reference(table); } -XS(XS__add_expedition_lockout_all_clients); -XS(XS__add_expedition_lockout_all_clients) { - dXSARGS; - if (items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: quest::add_expedition_lockout_all_clients(string expedition_name, string event_name, uint32 seconds, [string uuid])"); - } +perl::reference Perl__get_expedition_lockouts_by_char_id(uint32 char_id, std::string expedition_name) +{ + perl::hash table; - std::string expedition_name = SvPV_nolen(ST(0)); - std::string event_name = SvPV_nolen(ST(1)); - uint32_t seconds = static_cast(SvUV(ST(2))); - std::string uuid; - - if (items == 4) + auto lockouts = Expedition::GetExpeditionLockoutsByCharacterID(char_id); + for (const auto& lockout : lockouts) { - uuid = SvPV_nolen(ST(3)); + if (lockout.GetExpeditionName() == expedition_name) + { + if (!table.exists(lockout.GetEventName())) + { + table[lockout.GetEventName()] = perl::reference(perl::hash()); + } + perl::hash event_table = table[lockout.GetEventName()]; + event_table["remaining"] = lockout.GetSecondsRemaining(); + event_table["uuid"] = lockout.GetExpeditionUUID(); + } } + return perl::reference(table); +} + +void Perl__add_expedition_lockout_all_clients(std::string expedition_name, std::string event_name, uint32 seconds) +{ + auto lockout = ExpeditionLockoutTimer::CreateLockout(expedition_name, event_name, seconds); + Expedition::AddLockoutClients(lockout); +} + +void Perl__add_expedition_lockout_all_clients(std::string expedition_name, std::string event_name, uint32 seconds, std::string uuid) +{ auto lockout = ExpeditionLockoutTimer::CreateLockout(expedition_name, event_name, seconds, uuid); Expedition::AddLockoutClients(lockout); - - XSRETURN_EMPTY; -} - -XS(XS__add_expedition_lockout_by_char_id); -XS(XS__add_expedition_lockout_by_char_id) { - dXSARGS; - if (items != 4 && items != 5) { - Perl_croak(aTHX_ "Usage: quest::add_expedition_lockout_by_char_id(uint32 character_id, string expedition_name, string event_name, uint32 seconds, [string uuid])"); - } - - std::string uuid; - if (items == 5) - { - uuid = SvPV_nolen(ST(4)); - } - - uint32_t character_id = static_cast(SvUV(ST(0))); - std::string expedition_name = SvPV_nolen(ST(1)); - std::string event_name = SvPV_nolen(ST(2)); - uint32_t seconds = static_cast(SvUV(ST(3))); - - Expedition::AddLockoutByCharacterID(character_id, expedition_name, event_name, seconds, uuid); - - XSRETURN_EMPTY; -} - -XS(XS__remove_expedition_lockout_by_char_id); -XS(XS__remove_expedition_lockout_by_char_id) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: quest::remove_expedition_lockout_by_char_id(uint32 character_id, string expedition_name, string event_name)"); - } - - uint32_t character_id = static_cast(SvUV(ST(0))); - std::string expedition_name = SvPV_nolen(ST(1)); - std::string event_name = SvPV_nolen(ST(2)); - - Expedition::RemoveLockoutsByCharacterID(character_id, expedition_name, event_name); - - XSRETURN_EMPTY; -} - -XS(XS__remove_all_expedition_lockouts_by_char_id); -XS(XS__remove_all_expedition_lockouts_by_char_id) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: quest::remove_expedition_lockout_by_char_id(uint32 character_id, [string expedition_name])"); - } - - std::string expedition_name; - if (items == 2) - { - expedition_name = SvPV_nolen(ST(1)); - } - - uint32_t character_id = static_cast(SvUV(ST(0))); - Expedition::RemoveLockoutsByCharacterID(character_id, expedition_name); - - XSRETURN_EMPTY; -} - -XS(XS__createitem); -XS(XS__createitem) { - dXSARGS; - if (items < 1 || items > 9) { - Perl_croak(aTHX_ "Usage: quest::createitem(uint32 item_id, [int16 charges = 0, uint32 augment_one = 0, uint32 augment_two = 0, uint32 augment_three = 0, uint32 augment_four = 0, uint32 augment_five = 0, uint32 augment_six = 0, bool attuned = false])"); - } - - EQ::ItemInstance* RETVAL = nullptr; - uint32 item_id = (uint32)SvUV(ST(0)); - int16 charges = 0; - uint32 augment_one = 0; - uint32 augment_two = 0; - uint32 augment_three = 0; - uint32 augment_four = 0; - uint32 augment_five = 0; - uint32 augment_six = 0; - bool attuned = false; - if (items > 1) - charges = (int16)SvIV(ST(1)); - if (items > 2) - augment_one = (uint32)SvUV(ST(2)); - if (items > 3) - augment_two = (uint32)SvUV(ST(3)); - if (items > 4) - augment_three = (uint32)SvUV(ST(4)); - if (items > 5) - augment_four = (uint32)SvUV(ST(5)); - if (items > 6) - augment_five = (uint32)SvUV(ST(6)); - if (items > 7) - augment_six = (uint32)SvUV(ST(7)); - if (items > 8) - attuned = (bool)SvNV(ST(8)); - - if (database.GetItem(item_id)) { - RETVAL = database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned); - } - - ST(0) = sv_newmortal(); - if (RETVAL) { - sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL); - } - XSRETURN(1); -} - -XS(XS__secondstotime); -XS(XS__secondstotime) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::secondstotime(int duration)"); - } - - dXSTARG; - std::string time_string; - int duration = (int) SvIV(ST(0)); - time_string = quest_manager.secondstotime(duration); - sv_setpv(TARG, time_string.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__gethexcolorcode); -XS(XS__gethexcolorcode) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::gethexcolorcode(string color_name)"); - } - - dXSTARG; - std::string hex_color_code; - std::string color_name = SvPV_nolen(ST(0)); - hex_color_code = quest_manager.gethexcolorcode(color_name); - sv_setpv(TARG, hex_color_code.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getaaexpmodifierbycharid); -XS(XS__getaaexpmodifierbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::getaaexpmodifierbycharid(uint32 character_id, uint32 zone_id)"); - - dXSTARG; - double aa_modifier; - uint32 character_id = (uint32) SvUV(ST(0)); - uint32 zone_id = (uint32) SvUV(ST(1)); - aa_modifier = quest_manager.GetAAEXPModifierByCharID(character_id, zone_id); - XSprePUSH; - PUSHn((double) aa_modifier); - XSRETURN(1); -} - -XS(XS__getexpmodifierbycharid); -XS(XS__getexpmodifierbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::getexpmodifierbycharid(uint32 character_id, uint32 zone_id)"); - - dXSTARG; - double exp_modifier; - uint32 character_id = (uint32) SvUV(ST(0)); - uint32 zone_id = (uint32) SvUV(ST(1)); - exp_modifier = quest_manager.GetEXPModifierByCharID(character_id, zone_id); - XSprePUSH; - PUSHn((double) exp_modifier); - XSRETURN(1); -} - -XS(XS__setaaexpmodifierbycharid); -XS(XS__setaaexpmodifierbycharid) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: quest::setaaexpmodifierbycharid(uint32 character_id, uint32 zone_id, float aa_modifier)"); - } - uint32 character_id = (uint32) SvUV(ST(0)); - uint32 zone_id = (uint32) SvUV(ST(1)); - double aa_modifier = (double) SvNV(ST(2)); - quest_manager.SetAAEXPModifierByCharID(character_id, zone_id, aa_modifier); - XSRETURN_EMPTY; -} - -XS(XS__setexpmodifierbycharid); -XS(XS__setexpmodifierbycharid) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: quest::setexpmodifierbycharid(uint32 character_id, uint32 zone_id, float exp_modifier)"); - } - uint32 character_id = (uint32) SvUV(ST(0)); - uint32 zone_id = (uint32) SvUV(ST(1)); - double exp_modifier = (double) SvNV(ST(2)); - quest_manager.SetEXPModifierByCharID(character_id, zone_id, exp_modifier); - XSRETURN_EMPTY; -} - -XS(XS__getcleannpcnamebyid); -XS(XS__getcleannpcnamebyid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getcleannpcnamebyid(uint32 npc_id)"); - - dXSTARG; - uint32 npc_id = (uint32) SvUV(ST(0)); - auto npc_name = quest_manager.getcleannpcnamebyid(npc_id); - sv_setpv(TARG, npc_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getgendername); -XS(XS__getgendername) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getgendername(uint32 gender_id)"); - - dXSTARG; - uint32 gender_id = (uint32) SvUV(ST(0)); - auto gender_name = quest_manager.getgendername(gender_id); - sv_setpv(TARG, gender_name.c_str()); -} - -XS(XS__getdeityname); -XS(XS__getdeityname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getdeityname(uint32 deity_id)"); - - dXSTARG; - uint32 deity_id = (uint32) SvUV(ST(0)); - auto deity_name = quest_manager.getdeityname(deity_id); - sv_setpv(TARG, deity_name.c_str()); -} - -XS(XS__getinventoryslotname); -XS(XS__getinventoryslotname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getinventoryslotname(int16 slot_id)"); - - dXSTARG; - int16 slot_id = (int16) SvIV(ST(0)); - auto slot_name = quest_manager.getinventoryslotname(slot_id); - sv_setpv(TARG, slot_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__rename); -XS(XS__rename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::rename(string name)"); - - std::string name = (std::string) SvPV_nolen(ST(0)); - quest_manager.rename(name); - XSRETURN_EMPTY; -} - -XS(XS__get_data_remaining); -XS(XS__get_data_remaining) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::get_data_remaining(string bucket_name)"); - - dXSTARG; - std::string bucket_name = (std::string) SvPV_nolen(ST(0)); - - sv_setpv(TARG, DataBucket::GetDataRemaining(bucket_name).c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__getitemstat); -XS(XS__getitemstat) { - dXSARGS; - int stat_value; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::getitemstat(uint32 item_id, string stat_identifier)"); - - dXSTARG; - uint32 item_id = (uint32) SvUV(ST(0)); - std::string stat_identifier = (std::string) SvPV_nolen(ST(1)); - stat_value = quest_manager.getitemstat(item_id, stat_identifier); - - XSprePUSH; - PUSHi((IV) stat_value); - - XSRETURN(1); -} - -XS(XS__getspellstat); -XS(XS__getspellstat) { - dXSARGS; - int stat_value; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: quest::getspellstat(uint32 spell_id, string stat_identifier, uint8 slot)"); - - dXSTARG; - uint32 spell_id = (uint32) SvUV(ST(0)); - std::string stat_identifier = (std::string) SvPV_nolen(ST(1)); - uint8 slot = 0; - if (items == 3) - slot = (uint8) SvUV(ST(2)); - - stat_value = quest_manager.getspellstat(spell_id, stat_identifier, slot); - - XSprePUSH; - PUSHi((IV) stat_value); - - XSRETURN(1); -} - -XS(XS__crosszoneaddldonlossbycharid); -XS(XS__crosszoneaddldonlossbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbycharid(int character_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - int character_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonlossbygroupid); -XS(XS__crosszoneaddldonlossbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbygroupid(int group_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - int group_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonlossbyraidid); -XS(XS__crosszoneaddldonlossbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyraidid(int raid_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - int raid_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonlossbyguildid); -XS(XS__crosszoneaddldonlossbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyguildid(int guild_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - int guild_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonlossbyexpeditionid); -XS(XS__crosszoneaddldonlossbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonlossbyclientname); -XS(XS__crosszoneaddldonlossbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyclientname(const char* client_name, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZLDoNUpdateSubtype_AddLoss; - int update_identifier = 0; - int points = 1; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, update_identifier, theme_id, points, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbycharid); -XS(XS__crosszoneaddldonpointsbycharid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbycharid(int character_id, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - int character_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id, points); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbygroupid); -XS(XS__crosszoneaddldonpointsbygroupid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbygroupid(int group_id, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - int group_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id, points); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbyraidid); -XS(XS__crosszoneaddldonpointsbyraidid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbyraidid(int raid_id, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - int raid_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id, points); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbyguildid); -XS(XS__crosszoneaddldonpointsbyguildid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbyguildid(int guild_id, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - int guild_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id, points); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbyexpeditionid); -XS(XS__crosszoneaddldonpointsbyexpeditionid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbyexpeditionid(uint32 expedition_id, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id, points); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonpointsbyclientname); -XS(XS__crosszoneaddldonpointsbyclientname) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonpointsbyclientname(const char* client_name, uint32 theme_id, int points)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZLDoNUpdateSubtype_AddPoints; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, update_identifier, theme_id, points, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbycharid); -XS(XS__crosszoneaddldonwinbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbycharid(int character_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - int character_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbygroupid); -XS(XS__crosszoneaddldonwinbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbygroupid(int group_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - int group_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbyraidid); -XS(XS__crosszoneaddldonwinbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyraidid(int raid_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - int raid_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbyguildid); -XS(XS__crosszoneaddldonwinbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyguildid(int guild_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - int guild_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbyexpeditionid); -XS(XS__crosszoneaddldonwinbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneaddldonwinbyclientname); -XS(XS__crosszoneaddldonwinbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyclientname(const char* client_name, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZLDoNUpdateSubtype_AddWin; - int update_identifier = 0; - int points = 1; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, update_identifier, theme_id, points, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbycharid); -XS(XS__crosszoneassigntaskbycharid) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbycharid(int character_id, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbygroupid); -XS(XS__crosszoneassigntaskbygroupid) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbygroupid(int group_id, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbyraidid); -XS(XS__crosszoneassigntaskbyraidid) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbyraidid(int raid_id, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbyguildid); -XS(XS__crosszoneassigntaskbyguildid) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbyguildid(int guild_id, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbyexpeditionid); -XS(XS__crosszoneassigntaskbyexpeditionid) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbyexpeditionid(uint32 expedition_id, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneassigntaskbyclientname); -XS(XS__crosszoneassigntaskbyclientname) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneassigntaskbyclientname(const char* client_name, uint32 task_identifier, [bool enforce_level_requirement = false])"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_AssignTask; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvIV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 3) - enforce_level_requirement = (bool) SvTRUE(ST(2)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbycharid); -XS(XS__crosszonecastspellbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbycharid(int character_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - int character_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvIV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, character_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbygroupid); -XS(XS__crosszonecastspellbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbygroupid(int group_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - int group_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvIV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, group_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbyraidid); -XS(XS__crosszonecastspellbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbyraidid(int raid_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - int raid_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvIV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, raid_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbyguildid); -XS(XS__crosszonecastspellbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbyguildid(int guild_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - int guild_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, guild_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbyexpeditionid); -XS(XS__crosszonecastspellbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbyexpeditionid(uint32 expedition_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, expedition_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonecastspellbyclientname); -XS(XS__crosszonecastspellbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonecastspellbyclientname(const char* client_name, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZSpellUpdateSubtype_Cast; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, update_identifier, spell_id, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbycharid); -XS(XS__crosszonedialoguewindowbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbycharid(int character_id, string message)"); - { - uint8 update_type = CZUpdateType_Character; - int character_id = (int) SvIV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, character_id, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbygroupid); -XS(XS__crosszonedialoguewindowbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbygroupid(int group_id, string message)"); - { - uint8 update_type = CZUpdateType_Group; - int group_id = (int) SvIV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, group_id, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbyraidid); -XS(XS__crosszonedialoguewindowbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbyraidid(int raid_id, string message)"); - { - uint8 update_type = CZUpdateType_Raid; - int raid_id = (int) SvIV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, raid_id, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbyguildid); -XS(XS__crosszonedialoguewindowbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbyguildid(int guild_id, string message)"); - { - uint8 update_type = CZUpdateType_Guild; - int guild_id = (int) SvIV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, guild_id, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbyexpeditionid); -XS(XS__crosszonedialoguewindowbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbyexpeditionid(uint32 expedition_id, string message)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint32 expedition_id = (uint32) SvUV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, expedition_id, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedialoguewindowbyclientname); -XS(XS__crosszonedialoguewindowbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedialoguewindowbyclientname(const char* client_name, string message)"); - { - uint8 update_type = CZUpdateType_ClientName; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - quest_manager.CrossZoneDialogueWindow(update_type, update_identifier, message, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbycharid); -XS(XS__crosszonedisabletaskbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbycharid(int character_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbygroupid); -XS(XS__crosszonedisabletaskbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbygroupid(int group_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbyraidid); -XS(XS__crosszonedisabletaskbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbyraidid(int raid_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbyguildid); -XS(XS__crosszonedisabletaskbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbyguildid(int guild_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbyexpeditionid); -XS(XS__crosszonedisabletaskbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbyexpeditionid(uint32 expedition_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonedisabletaskbyclientname); -XS(XS__crosszonedisabletaskbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonedisabletaskbyclientname(const char* client_name, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_DisableTask; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbycharid); -XS(XS__crosszoneenabletaskbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbycharid(int character_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbygroupid); -XS(XS__crosszoneenabletaskbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbygroupid(int group_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbyraidid); -XS(XS__crosszoneenabletaskbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbyraidid(int raid_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbyguildid); -XS(XS__crosszoneenabletaskbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbyguildid(int guild_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbyexpeditionid); -XS(XS__crosszoneenabletaskbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbyexpeditionid(uint32 expedition_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneenabletaskbyclientname); -XS(XS__crosszoneenabletaskbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneenabletaskbyclientname(const char* client_name, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_EnableTask; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbycharid); -XS(XS__crosszonefailtaskbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbycharid(int character_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbygroupid); -XS(XS__crosszonefailtaskbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbygroupid(int group_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbyraidid); -XS(XS__crosszonefailtaskbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbyraidid(int raid_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbyguildid); -XS(XS__crosszonefailtaskbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbyguildid(int guild_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbyexpeditionid); -XS(XS__crosszonefailtaskbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbyexpeditionid(uint32 expedition_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonefailtaskbyclientname); -XS(XS__crosszonefailtaskbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonefailtaskbyclientname(const char* client_name, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_FailTask; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebycharid); -XS(XS__crosszonemarqueebycharid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebycharid(int character_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_Character; - int character_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, character_id, type, priority, fade_in, fade_out, duration, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebygroupid); -XS(XS__crosszonemarqueebygroupid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebygroupid(int group_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_Group; - int group_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, group_id, type, priority, fade_in, fade_out, duration, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebyraidid); -XS(XS__crosszonemarqueebyraidid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebyraidid(int raid_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_Raid; - int raid_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, raid_id, type, priority, fade_in, fade_out, duration, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebyguildid); -XS(XS__crosszonemarqueebyguildid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebyguildid(int guild_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_Guild; - int guild_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, guild_id, type, priority, fade_in, fade_out, duration, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebyexpeditionid); -XS(XS__crosszonemarqueebyexpeditionid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebyexpeditionid(uint32 expedition_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, expedition_id, type, priority, fade_in, fade_out, duration, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemarqueebyclientname); -XS(XS__crosszonemarqueebyclientname) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: quest::crosszonemarqueebyclientname(const char* client_name, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char *message)"); - { - uint8 update_type = CZUpdateType_ClientName; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - int priority = (int) SvIV(ST(2)); - int fade_in = (int) SvIV(ST(3)); - int fade_out = (int) SvIV(ST(4)); - int duration = (int) SvIV(ST(5)); - char *message = (char *) SvPV_nolen(ST(6)); - quest_manager.CrossZoneMarquee(update_type, update_identifier, type, priority, fade_in, fade_out, duration, message, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbycharid); -XS(XS__crosszonemessageplayerbycharid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbycharid(int character_id, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_Character; - int character_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, character_id, type, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbygroupid); -XS(XS__crosszonemessageplayerbygroupid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbygroupid(int group_id, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_Group; - int group_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, group_id, type, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbyraidid); -XS(XS__crosszonemessageplayerbyraidid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbyraidid(int raid_id, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_Raid; - int raid_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, raid_id, type, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbyguildid); -XS(XS__crosszonemessageplayerbyguildid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbyguildid(int guild_id, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_Guild; - int guild_id = (int) SvIV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, guild_id, type, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbyexpeditionid); -XS(XS__crosszonemessageplayerbyexpeditionid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbyexpeditionid(uint32 expedition_id, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, expedition_id, type, message); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemessageplayerbyname); -XS(XS__crosszonemessageplayerbyname) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonemessageplayerbyname(const char* client_name, uint32 type, const char* message)"); - { - uint8 update_type = CZUpdateType_ClientName; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 type = (uint32) SvUV(ST(1)); - const char* message = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneMessage(update_type, update_identifier, type, message, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbycharid); -XS(XS__crosszonemoveplayerbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbycharid(int character_id, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - int character_id = (int) SvIV(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, character_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbygroupid); -XS(XS__crosszonemoveplayerbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbygroupid(int group_id, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - int group_id = (int) SvIV(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, group_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbyraidid); -XS(XS__crosszonemoveplayerbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbyraidid(int raid_id, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - int raid_id = (int) SvIV(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, raid_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbyguildid); -XS(XS__crosszonemoveplayerbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbyguildid(int guild_id, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - int guild_id = (int) SvIV(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, guild_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbyexpeditionid); -XS(XS__crosszonemoveplayerbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbyexpeditionid(uint32 expedition_id, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - uint32 expedition_id = (uint32) SvUV(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, expedition_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveplayerbyname); -XS(XS__crosszonemoveplayerbyname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveplayerbyname(const char* client_name, string zone_short_name)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZone; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - const char* zone_short_name = (const char*) SvPV_nolen(ST(1)); - uint16 instance_id = 0; - quest_manager.CrossZoneMove(update_type, update_subtype, update_identifier, zone_short_name, instance_id, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebycharid); -XS(XS__crosszonemoveinstancebycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebycharid(int character_id, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - int character_id = (int) SvIV(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, character_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebygroupid); -XS(XS__crosszonemoveinstancebygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebygroupid(int group_id, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - int group_id = (int) SvIV(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, group_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebyraidid); -XS(XS__crosszonemoveinstancebyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebyraidid(int raid_id, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - int raid_id = (int) SvIV(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, raid_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebyguildid); -XS(XS__crosszonemoveinstancebyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebyguildid(int guild_id, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - int guild_id = (int) SvIV(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, guild_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebyexpeditionid); -XS(XS__crosszonemoveinstancebyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebyexpeditionid(uint32 expedition_id, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, expedition_id, zone_short_name, instance_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonemoveinstancebyclientname); -XS(XS__crosszonemoveinstancebyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonemoveinstancebyclientname(const char* client_name, uint16 instance_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZMoveUpdateSubtype_MoveZoneInstance; - const char* zone_short_name = ""; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint16 instance_id = (uint16) SvUV(ST(1)); - quest_manager.CrossZoneMove(update_type, update_subtype, update_identifier, zone_short_name, instance_id, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbycharid); -XS(XS__crosszoneremoveldonlossbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbycharid(int character_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - int character_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbygroupid); -XS(XS__crosszoneremoveldonlossbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbygroupid(int group_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - int group_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbyraidid); -XS(XS__crosszoneremoveldonlossbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyraidid(int raid_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - int raid_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbyguildid); -XS(XS__crosszoneremoveldonlossbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyguildid(int guild_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - int guild_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbyexpeditionid); -XS(XS__crosszoneremoveldonlossbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonlossbyclientname); -XS(XS__crosszoneremoveldonlossbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyclientname(const char* client_name, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveLoss; - int update_identifier = 0; - int points = 1; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, update_identifier, theme_id, points, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbycharid); -XS(XS__crosszoneremoveldonwinbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbycharid(int character_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - int character_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbygroupid); -XS(XS__crosszoneremoveldonwinbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbygroupid(int group_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - int group_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbyraidid); -XS(XS__crosszoneremoveldonwinbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyraidid(int raid_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - int raid_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbyguildid); -XS(XS__crosszoneremoveldonwinbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyguildid(int guild_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - int guild_id = (int) SvIV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbyexpeditionid); -XS(XS__crosszoneremoveldonwinbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremoveldonwinbyclientname); -XS(XS__crosszoneremoveldonwinbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyclientname(const char* client_name, uint32 theme_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZLDoNUpdateSubtype_RemoveWin; - int update_identifier = 0; - int points = 1; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 theme_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, update_identifier, theme_id, points, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbycharid); -XS(XS__crosszoneremovespellbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbycharid(int character_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - int character_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, character_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbygroupid); -XS(XS__crosszoneremovespellbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbygroupid(int group_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - int group_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, group_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbyraidid); -XS(XS__crosszoneremovespellbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbyraidid(int raid_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - int raid_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, raid_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbyguildid); -XS(XS__crosszoneremovespellbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbyguildid(int guild_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - int guild_id = (int) SvIV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, guild_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbyexpeditionid); -XS(XS__crosszoneremovespellbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbyexpeditionid(uint32 expedition_id, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, expedition_id, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovespellbyclientname); -XS(XS__crosszoneremovespellbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovespellbyclientname(const char* client_name, uint32 spell_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZSpellUpdateSubtype_Remove; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 spell_id = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSpell(update_type, update_subtype, update_identifier, spell_id, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbycharid); -XS(XS__crosszoneremovetaskbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbycharid(int character_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbygroupid); -XS(XS__crosszoneremovetaskbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbygroupid(int group_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbyraidid); -XS(XS__crosszoneremovetaskbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbyraidid(int raid_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbyguildid); -XS(XS__crosszoneremovetaskbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbyguildid(int guild_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbyexpeditionid); -XS(XS__crosszoneremovetaskbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbyexpeditionid(uint32 expedition_id, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneremovetaskbyclientname); -XS(XS__crosszoneremovetaskbyclientname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszoneremovetaskbyclientname(const char* client_name, uint32 task_identifier)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_RemoveTask; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybycharid); -XS(XS__crosszoneresetactivitybycharid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybycharid(int character_id, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybygroupid); -XS(XS__crosszoneresetactivitybygroupid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybygroupid(int group_id, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybyraidid); -XS(XS__crosszoneresetactivitybyraidid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybyraidid(int raid_id, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybyguildid); -XS(XS__crosszoneresetactivitybyguildid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybyguildid(int guild_id, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybyexpeditionid); -XS(XS__crosszoneresetactivitybyexpeditionid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybyexpeditionid(uint32 expedition_id, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneresetactivitybyclientname); -XS(XS__crosszoneresetactivitybyclientname) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszoneresetactivitybyclientname(const char* client_name, uint32 task_identifier, int activity_id)"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityReset; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int activity_id = (int) SvIV(ST(2)); - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebycharid); -XS(XS__crosszonesetentityvariablebycharid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebycharid(int character_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_Character; - int character_id = (int) SvIV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, character_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebygroupid); -XS(XS__crosszonesetentityvariablebygroupid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebygroupid(int group_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_Group; - int group_id = (int) SvIV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, group_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebyraidid); -XS(XS__crosszonesetentityvariablebyraidid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyraidid(int raid_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_Raid; - int raid_id = (int) SvIV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, raid_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebyguildid); -XS(XS__crosszonesetentityvariablebyguildid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyguildid(int guild_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_Guild; - int guild_id = (int) SvIV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, guild_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebyexpeditionid); -XS(XS__crosszonesetentityvariablebyexpeditionid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyexpeditionid(uint32 expedition_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint32 expedition_id = (uint32) SvUV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, expedition_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebyclientname); -XS(XS__crosszonesetentityvariablebyclientname) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyclientname(const char* client_name, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_ClientName; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, update_identifier, variable_name, variable_value, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesetentityvariablebynpctypeid); -XS(XS__crosszonesetentityvariablebynpctypeid) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebynpctypeid(int npc_id, const char* variable_name, const char* variable_value)"); - { - uint8 update_type = CZUpdateType_NPC; - int npc_id = (int) SvIV(ST(0)); - const char* variable_name = (const char*) SvPV_nolen(ST(1)); - const char* variable_value = (const char*) SvPV_nolen(ST(2)); - quest_manager.CrossZoneSetEntityVariable(update_type, npc_id, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbycharid); -XS(XS__crosszonesignalclientbycharid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbycharid(int character_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Character; - int character_id = (int) SvIV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, character_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbygroupid); -XS(XS__crosszonesignalclientbygroupid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbygroupid(int group_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Group; - int group_id = (int) SvIV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, group_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbyraidid); -XS(XS__crosszonesignalclientbyraidid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbyraidid(int raid_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Raid; - int raid_id = (int) SvIV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, raid_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbyguildid); -XS(XS__crosszonesignalclientbyguildid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbyguildid(int guild_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Guild; - int guild_id = (int) SvIV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, guild_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbyexpeditionid); -XS(XS__crosszonesignalclientbyexpeditionid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbyexpeditionid(uint32 expedition_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Expedition; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, expedition_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalclientbyname); -XS(XS__crosszonesignalclientbyname) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalclientbyname(const char* client_name, uint32 signal)"); - { - uint8 update_type = CZUpdateType_Expedition; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, update_identifier, signal, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszonesignalnpcbynpctypeid); -XS(XS__crosszonesignalnpcbynpctypeid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::crosszonesignalnpcbynpctypeid(uint32 npc_id, uint32 signal)"); - { - uint8 update_type = CZUpdateType_NPC; - uint32 npc_id = (uint32) SvUV(ST(0)); - uint32 signal = (uint32) SvUV(ST(1)); - quest_manager.CrossZoneSignal(update_type, npc_id, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybycharid); -XS(XS__crosszoneupdateactivitybycharid) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybycharid(int character_id, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_Character; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - int character_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, character_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybygroupid); -XS(XS__crosszoneupdateactivitybygroupid) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybygroupid(int group_id, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_Group; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - int group_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, group_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybyraidid); -XS(XS__crosszoneupdateactivitybyraidid) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybyraidid(int raid_id, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_Raid; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - int raid_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, raid_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybyguildid); -XS(XS__crosszoneupdateactivitybyguildid) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybyguildid(int guild_id, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_Guild; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - int guild_id = (int) SvIV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, guild_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybyexpeditionid); -XS(XS__crosszoneupdateactivitybyexpeditionid) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybyexpeditionid(uint32 expedition_id, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_Expedition; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - uint32 expedition_id = (uint32) SvUV(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, expedition_id, task_identifier, task_subidentifier, update_count, enforce_level_requirement); - } - XSRETURN_EMPTY; -} - -XS(XS__crosszoneupdateactivitybyclientname); -XS(XS__crosszoneupdateactivitybyclientname) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: quest::crosszoneupdateactivitybyclientname(const char* client_name, uint32 task_identifier, int activity_id, [int update_count = 1])"); - { - uint8 update_type = CZUpdateType_ClientName; - uint8 update_subtype = CZTaskUpdateSubtype_ActivityUpdate; - int update_identifier = 0; - const char* client_name = (const char*) SvPV_nolen(ST(0)); - uint32 task_identifier = (uint32) SvUV(ST(1)); - int task_subidentifier = (int) SvIV(ST(2)); - int update_count = 1; - bool enforce_level_requirement = false; - if (items == 4) - update_count = (int) SvIV(ST(3)); - - quest_manager.CrossZoneTaskUpdate(update_type, update_subtype, update_identifier, task_identifier, task_subidentifier, update_count, enforce_level_requirement, client_name); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideaddldonloss); -XS(XS__worldwideaddldonloss) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideaddldonloss(uint32 theme_id, [min_status = 0, max_status = 0])"); - { - uint8 update_type = CZLDoNUpdateSubtype_AddLoss; - uint32 theme_id = (uint32) SvUV(ST(0)); - int points = 1; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideLDoNUpdate(update_type, theme_id, points, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideaddldonpoints); -XS(XS__worldwideaddldonpoints) { - dXSARGS; - if (items < 1 || items > 4) - Perl_croak(aTHX_ "Usage: quest::worldwideaddldonpoints(uint32 theme_id, [int points = 1, min_status = 0, max_status = 0])"); - { - uint8 update_type = CZLDoNUpdateSubtype_AddPoints; - uint32 theme_id = (uint32) SvUV(ST(0)); - int points = 1; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - points = (int) SvIV(ST(1)); - } - - if (items > 2) { - min_status = (uint8) SvUV(ST(2)); - } - - if (items > 3) { - max_status = (uint8) SvUV(ST(3)); - } - - quest_manager.WorldWideLDoNUpdate(update_type, theme_id, points, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideaddldonwin); -XS(XS__worldwideaddldonwin) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideaddldonwin(uint32 theme_id, [min_status = 0, max_status = 0])"); - { - uint8 update_type = CZLDoNUpdateSubtype_AddWin; - uint32 theme_id = (uint32) SvUV(ST(0)); - int points = 1; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideLDoNUpdate(update_type, theme_id, points, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideassigntask); -XS(XS__worldwideassigntask) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideassigntask(uint32 task_identifier, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_AssignTask; - uint32 task_identifier = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidecastspell); -XS(XS__worldwidecastspell) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidecastspell(uint32 spell_id, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWSpellUpdateType_Cast; - uint32 spell_id = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideSpell(update_type, spell_id, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidedialoguewindow); -XS(XS__worldwidedialoguewindow) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidedialoguewindow(string message, [uint8 min_status = 0, uint8 max_status = 0])"); - { - const char* message = (const char*) SvPV_nolen(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideDialogueWindow(message, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidedisabletask); -XS(XS__worldwidedisabletask) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidedisabletask(uint32 task_id, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_DisableTask; - uint32 task_identifier = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideenabletask); -XS(XS__worldwideenabletask) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideenabletask(uint32 task_id, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_EnableTask; - uint32 task_identifier = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidefailtask); -XS(XS__worldwidefailtask) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidefailtask(uint32 task_id, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_FailTask; - uint32 task_identifier = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidemarquee); -XS(XS__worldwidemarquee) { - dXSARGS; - if (items < 6 || items > 8) - Perl_croak(aTHX_ "Usage: quest::worldwidemarquee(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint32 type = (uint32) SvUV(ST(0)); - uint32 priority = (uint32) SvUV(ST(1)); - uint32 fade_in = (uint32) SvUV(ST(2)); - uint32 fade_out = (uint32) SvUV(ST(3)); - uint32 duration = (uint32) SvUV(ST(4)); - const char* message = (const char*) SvPV_nolen(ST(5)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 6) { - min_status = (uint8) SvUV(ST(6)); - } - - if (items > 7) { - max_status = (uint8) SvUV(ST(7)); - } - - quest_manager.WorldWideMarquee(type, priority, fade_in, fade_out, duration, message, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidemessage); -XS(XS__worldwidemessage) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: quest::worldwidemessage(uint32 type, const char* message, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint32 type = (uint32) SvUV(ST(0)); - const char* message = (const char*) SvPV_nolen(ST(1)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 2) { - min_status = (uint8) SvUV(ST(2)); - } - - if (items > 3) { - max_status = (uint8) SvUV(ST(3)); - } - - quest_manager.WorldWideMessage(type, message, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidemove); -XS(XS__worldwidemove) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidemove(const char* zone_short_name, [uint8 min_status = 0, uint8 max_status = 0])"); - { - uint8 update_type = WWMoveUpdateType_MoveZone; - const char* zone_short_name = (const char*) SvPV_nolen(ST(0)); - uint16 instance_id = 0; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideMove(update_type, zone_short_name, instance_id, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidemoveinstance); -XS(XS__worldwidemoveinstance) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidemoveinstance(uint16 instance_id, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWMoveUpdateType_MoveZoneInstance; - const char* zone_short_name = ""; - uint16 instance_id = (uint16) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideMove(update_type, zone_short_name, instance_id, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideremoveldonloss); -XS(XS__worldwideremoveldonloss) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideremoveldonloss(uint32 theme_id, [min_status = 0, max_status = 0])"); - { - uint8 update_type = CZLDoNUpdateSubtype_RemoveLoss; - uint32 theme_id = (uint32)SvUV(ST(0)); - int points = 1; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideLDoNUpdate(update_type, theme_id, points, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideremoveldonwin); -XS(XS__worldwideremoveldonwin) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideremoveldonwin(uint32 theme_id, [min_status = 0, max_status = 0])"); - { - uint8 update_type = CZLDoNUpdateSubtype_RemoveWin; - uint32 theme_id = (uint32)SvUV(ST(0)); - int points = 1; - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideLDoNUpdate(update_type, theme_id, points, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideremovespell); -XS(XS__worldwideremovespell) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideremovespell(uint32 spell_id, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWSpellUpdateType_Remove; - uint32 spell_id = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideSpell(update_type, spell_id, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideremovetask); -XS(XS__worldwideremovetask) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwideremovetask(uint32 task_identifier, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_RemoveTask; - uint32 task_identifier = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int task_subidentifier = -1; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - - XSRETURN_EMPTY; -} - -XS(XS__worldwideresetactivity); -XS(XS__worldwideresetactivity) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: quest::worldwideresetactivity(uint32 task_identifier, int activity_id, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_ActivityReset; - uint32 task_identifier = (uint32) SvUV(ST(0)); - int task_subidentifier = (int) SvIV(ST(1)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 2) { - min_status = (uint8) SvUV(ST(2)); - } - - if (items > 3) { - max_status = (uint8) SvUV(ST(3)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidesetentityvariableclient); -XS(XS__worldwidesetentityvariableclient) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: quest::worldwidesetentityvariableclient(const char* variable_name, const char* variable_value, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWSetEntityVariableUpdateType_Character; - const char* variable_name = (const char*) SvPV_nolen(ST(0)); - const char* variable_value = (const char*) SvPV_nolen(ST(1)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 2) { - min_status = (uint8) SvUV(ST(2)); - } - - if (items > 3) { - max_status = (uint8) SvUV(ST(3)); - } - - quest_manager.WorldWideSetEntityVariable(update_type, variable_name, variable_value, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidesetentityvariablenpc); -XS(XS__worldwidesetentityvariablenpc) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::worldwidesetentityvariablenpc(const char* variable_name, const char* variable_value)"); - { - uint8 update_type = WWSetEntityVariableUpdateType_NPC; - const char* variable_name = (const char*) SvPV_nolen(ST(0)); - const char* variable_value = (const char*) SvPV_nolen(ST(1)); - quest_manager.WorldWideSetEntityVariable(update_type, variable_name, variable_value); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidesignalnpc); -XS(XS__worldwidesignalnpc) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::worldwidesignalnpc(uint32 signal)"); - { - uint8 update_type = WWSignalUpdateType_NPC; - uint32 signal = (uint32) SvUV(ST(0)); - quest_manager.WorldWideSignal(update_type, signal); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwidesignalclient); -XS(XS__worldwidesignalclient) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: quest::worldwidesignalclient(uint32 signal, [uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWSignalUpdateType_Character; - uint32 signal = (uint32) SvUV(ST(0)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - - if (items > 1) { - min_status = (uint8) SvUV(ST(1)); - } - - if (items > 2) { - max_status = (uint8) SvUV(ST(2)); - } - - quest_manager.WorldWideSignal(update_type, signal, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__worldwideupdateactivity); -XS(XS__worldwideupdateactivity) { - dXSARGS; - if (items < 2 || items > 5) - Perl_croak(aTHX_ "Usage: quest::worldwideupdateactivity(uint32 task_identifier, int activity_id, [int update_count = 1, uint8 min_status = 0, uint max_status = 0])"); - { - uint8 update_type = WWTaskUpdateType_ActivityUpdate; - uint32 task_identifier = (uint32) SvUV(ST(0)); - int task_subidentifier = (int) SvIV(ST(1)); - uint8 min_status = AccountStatus::Player; - uint8 max_status = AccountStatus::Player; - int update_count = 1; - bool enforce_level_requirement = false; - - if (items > 2) { - update_count = (int) SvIV(ST(2)); - } - - if (items > 3) { - min_status = (uint8) SvUV(ST(3)); - } - - if (items > 4) { - max_status = (uint8) SvUV(ST(4)); - } - - quest_manager.WorldWideTaskUpdate(update_type, task_identifier, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); - } - XSRETURN_EMPTY; -} - -XS(XS__isnpcspawned); -XS(XS__isnpcspawned) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: quest::isnpcspawned(npc_id_one, npc_id_two, npc_idthree, npc_id_four, npc_id_five...[no limit])"); - { - std::vector npc_ids; - bool is_spawned = false; - for (int index = 0; index < items; index++) { - npc_ids.push_back((uint32)SvUV(ST(index))); - } - is_spawned = entity_list.IsNPCSpawned(npc_ids); - ST(0) = boolSV(is_spawned); - sv_2mortal(ST(0)); - XSRETURN(1); - } -} - -XS(XS__countspawnednpcs); -XS(XS__countspawnednpcs) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: quest::countspawnednpcs(npc_id_one, npc_id_two, npc_idthree, npc_id_four, npc_id_five...[no limit])"); - { - dXSTARG; - std::vector npc_ids; - uint32 npc_count = 0; - for (int index = 0; index < items; index++) { - npc_ids.push_back((uint32)SvUV(ST(index))); - } - npc_count = entity_list.CountSpawnedNPCs(npc_ids); - XSprePUSH; - PUSHu((UV) npc_count); - XSRETURN(1); - } -} - -XS(XS__getspell); -XS(XS__getspell) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getspell(uint32 spell_id)"); - { - dXSTARG; - uint32 spell_id = (uint32) SvUV(ST(0)); - const SPDat_Spell_Struct* spell = quest_manager.getspell(spell_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Spell", (void *) spell); - XSRETURN(1); - } -} - -XS(XS__getldonthemename); -XS(XS__getldonthemename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getldonthemename(uint32 theme_id)"); - { - dXSTARG; - uint32 theme_id = (uint32) SvUV(ST(0)); - std::string theme_name = quest_manager.getldonthemename(theme_id); - - sv_setpv(TARG, theme_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); - } -} - -XS(XS__getfactionname); -XS(XS__getfactionname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getfactionname(int faction_id)"); - { - dXSTARG; - int faction_id = (int) SvIV(ST(0)); - std::string faction_name = quest_manager.getfactionname(faction_id); - - sv_setpv(TARG, faction_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); - } -} - -XS(XS__getlanguagename); -XS(XS__getlanguagename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getlanguagename(int language_id)"); - { - dXSTARG; - int language_id = (int) SvIV(ST(0)); - std::string language_name = quest_manager.getlanguagename(language_id); - - sv_setpv(TARG, language_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); - } -} - -XS(XS__getbodytypename); -XS(XS__getbodytypename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getbodytypename(uint32 bodytype_id)"); - { - dXSTARG; - uint32 bodytype_id = (uint32) SvUV(ST(0)); - std::string bodytype_name = quest_manager.getbodytypename(bodytype_id); - - sv_setpv(TARG, bodytype_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); - } -} - -XS(XS__getconsiderlevelname); -XS(XS__getconsiderlevelname) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getconsiderlevelname(uint8 consider_level)"); - { - dXSTARG; - uint8 consider_level = (uint8) SvUV(ST(0)); - std::string consider_level_name = quest_manager.getconsiderlevelname(consider_level); - - sv_setpv(TARG, consider_level_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); - } -} - -XS(XS__getenvironmentaldamagename); -XS(XS__getenvironmentaldamagename) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getenvironmentaldamagename(uint8 damage_type)"); - - dXSTARG; - uint8 damage_type = (uint8) SvIV(ST(0)); - std::string environmental_damage_name = quest_manager.getenvironmentaldamagename(damage_type); - - sv_setpv(TARG, environmental_damage_name.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); -} - -XS(XS__commify); -XS(XS__commify) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::commify(string number)"); - - dXSTARG; - std::string number = (std::string) SvPV_nolen(ST(0)); - std::string commified_number = commify(number); - - sv_setpv(TARG, commified_number.c_str()); - XSprePUSH; - PUSHTARG; - XSRETURN(1); } -XS(XS__checknamefilter); -XS(XS__checknamefilter) +void Perl__add_expedition_lockout_by_char_id(uint32 char_id, std::string expedition_name, std::string event_name, uint32 seconds) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: quest::checknamefilter(string name)"); - } - - dXSTARG; - std::string name = (std::string) SvPV_nolen(ST(0)); - bool passes = database.CheckNameFilter(name); - ST(0) = boolSV(passes); - sv_2mortal(ST(0)); - XSRETURN(1); + Expedition::AddLockoutByCharacterID(char_id, expedition_name, event_name, seconds); } -XS(XS__discordsend); -XS(XS__discordsend) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: quest::discordsend(string webhook_name, string message)"); +void Perl__add_expedition_lockout_by_char_id(uint32 char_id, std::string expedition_name, std::string event_name, uint32 seconds, std::string uuid) +{ + Expedition::AddLockoutByCharacterID(char_id, expedition_name, event_name, seconds, uuid); +} + +void Perl__remove_expedition_lockout_by_char_id(uint32 char_id, std::string expedition_name, std::string event_name) +{ + Expedition::RemoveLockoutsByCharacterID(char_id, expedition_name, event_name); +} + +void Perl__remove_all_expedition_lockouts_by_char_id(uint32 char_id) +{ + Expedition::RemoveLockoutsByCharacterID(char_id); +} + +void Perl__remove_all_expedition_lockouts_by_char_id(uint32 char_id, std::string expedition_name) +{ + Expedition::RemoveLockoutsByCharacterID(char_id, expedition_name); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id) +{ + return database.CreateItem(item_id); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges) +{ + return database.CreateItem(item_id, charges); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one) +{ + return database.CreateItem(item_id, charges, augment_one); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three, uint32 augment_four) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three, uint32 augment_four, uint32 augment_five) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three, uint32 augment_four, uint32 augment_five, uint32 augment_six) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six); +} + +EQ::ItemInstance* Perl__createitem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three, uint32 augment_four, uint32 augment_five, uint32 augment_six, bool attuned) +{ + return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned); +} + +std::string Perl__secondstotime(int duration) +{ + return quest_manager.secondstotime(duration); +} + +std::string Perl__gethexcolorcode(std::string color_name) +{ + return quest_manager.gethexcolorcode(color_name); +} + +double Perl__getaaexpmodifierbycharid(uint32 character_id, uint32 zone_id) +{ + return quest_manager.GetAAEXPModifierByCharID(character_id, zone_id); +} + +double Perl__getexpmodifierbycharid(uint32 character_id, uint32 zone_id) +{ + return quest_manager.GetEXPModifierByCharID(character_id, zone_id); +} + +void Perl__setaaexpmodifierbycharid(uint32 character_id, uint32 zone_id, double aa_modifier) +{ + quest_manager.SetAAEXPModifierByCharID(character_id, zone_id, aa_modifier); +} + +void Perl__setexpmodifierbycharid(uint32 character_id, uint32 zone_id, double exp_modifier) +{ + quest_manager.SetEXPModifierByCharID(character_id, zone_id, exp_modifier); +} + +std::string Perl__getcleannpcnamebyid(uint32 npc_id) +{ + return quest_manager.getcleannpcnamebyid(npc_id); +} + +std::string Perl__getgendername(uint32 gender_id) +{ + return quest_manager.getgendername(gender_id); +} + +std::string Perl__getdeityname(uint32 deity_id) +{ + return quest_manager.getdeityname(deity_id); +} + +std::string Perl__getinventoryslotname(int16 slot_id) +{ + return quest_manager.getinventoryslotname(slot_id); +} + +void Perl__rename(std::string name) +{ + quest_manager.rename(name); +} + +std::string Perl__get_data_remaining(std::string bucket_name) +{ + return DataBucket::GetDataRemaining(bucket_name); +} + +int Perl__getitemstat(uint32 item_id, std::string stat_identifier) +{ + return quest_manager.getitemstat(item_id, stat_identifier); +} + +int Perl__getspellstat(uint32 spell_id, std::string stat_identifier) +{ + return quest_manager.getspellstat(spell_id, stat_identifier); +} + +int Perl__getspellstat(uint32 spell_id, std::string stat_identifier, uint8 slot) +{ + return quest_manager.getspellstat(spell_id, stat_identifier, slot); +} + +void Perl__crosszoneaddldonlossbycharid(int character_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Character, CZLDoNUpdateSubtype_AddLoss, character_id, theme_id); +} + +void Perl__crosszoneaddldonlossbygroupid(int group_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Group, CZLDoNUpdateSubtype_AddLoss, group_id, theme_id); +} + +void Perl__crosszoneaddldonlossbyraidid(int raid_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Raid, CZLDoNUpdateSubtype_AddLoss, raid_id, theme_id); +} + +void Perl__crosszoneaddldonlossbyguildid(int guild_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Guild, CZLDoNUpdateSubtype_AddLoss, guild_id, theme_id); +} + +void Perl__crosszoneaddldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Expedition, CZLDoNUpdateSubtype_AddLoss, expedition_id, theme_id); +} + +void Perl__crosszoneaddldonlossbyclientname(const char* client_name, uint32 theme_id) +{ + int update_identifier = 0; + int points = 1; + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_ClientName, CZLDoNUpdateSubtype_AddLoss, update_identifier, theme_id, points, client_name); +} + +void Perl__crosszoneaddldonpointsbycharid(int character_id, uint32 theme_id, int points) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Character, CZLDoNUpdateSubtype_AddPoints, character_id, theme_id, points); +} + +void Perl__crosszoneaddldonpointsbygroupid(int group_id, uint32 theme_id, int points) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Group, CZLDoNUpdateSubtype_AddPoints, group_id, theme_id, points); +} + +void Perl__crosszoneaddldonpointsbyraidid(int raid_id, uint32 theme_id, int points) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Raid, CZLDoNUpdateSubtype_AddPoints, raid_id, theme_id, points); +} + +void Perl__crosszoneaddldonpointsbyguildid(int guild_id, uint32 theme_id, int points) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Guild, CZLDoNUpdateSubtype_AddPoints, guild_id, theme_id, points); +} + +void Perl__crosszoneaddldonpointsbyexpeditionid(uint32 expedition_id, uint32 theme_id, int points) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Expedition, CZLDoNUpdateSubtype_AddPoints, expedition_id, theme_id, points); +} + +void Perl__crosszoneaddldonpointsbyclientname(const char* client_name, uint32 theme_id, int points) +{ + int update_identifier = 0; + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_ClientName, CZLDoNUpdateSubtype_AddPoints, update_identifier, theme_id, points, client_name); +} + +void Perl__crosszoneaddldonwinbycharid(int character_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Character, CZLDoNUpdateSubtype_AddWin, character_id, theme_id); +} + +void Perl__crosszoneaddldonwinbygroupid(int group_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Group, CZLDoNUpdateSubtype_AddWin, group_id, theme_id); +} + +void Perl__crosszoneaddldonwinbyraidid(int raid_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Raid, CZLDoNUpdateSubtype_AddWin, raid_id, theme_id); +} + +void Perl__crosszoneaddldonwinbyguildid(int guild_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Guild, CZLDoNUpdateSubtype_AddWin, guild_id, theme_id); +} + +void Perl__crosszoneaddldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Expedition, CZLDoNUpdateSubtype_AddWin, expedition_id, theme_id); +} + +void Perl__crosszoneaddldonwinbyclientname(const char* client_name, uint32 theme_id) +{ + int update_identifier = 0; + int points = 1; + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_ClientName, CZLDoNUpdateSubtype_AddWin, update_identifier, theme_id, points, client_name); +} + +void Perl__crosszoneassigntaskbycharid(int character_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_AssignTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbycharid(int character_id, uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_AssignTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbygroupid(int group_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_AssignTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbygroupid(int group_id, uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_AssignTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyraidid(int raid_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_AssignTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyraidid(int raid_id, uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_AssignTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyguildid(int guild_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_AssignTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyguildid(int guild_id, uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_AssignTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyexpeditionid(uint32 expedition_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_AssignTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyexpeditionid(uint32 expedition_id, uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_AssignTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneassigntaskbyclientname(const char* client_name, uint32 task_id) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_AssignTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszoneassigntaskbyclientname(const char* client_name, uint32 task_id, bool enforce_level_requirement) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_AssignTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszonecastspellbycharid(int character_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Character, CZSpellUpdateSubtype_Cast, character_id, spell_id); +} + +void Perl__crosszonecastspellbygroupid(int group_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Group, CZSpellUpdateSubtype_Cast, group_id, spell_id); +} + +void Perl__crosszonecastspellbyraidid(int raid_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Raid, CZSpellUpdateSubtype_Cast, raid_id, spell_id); +} + +void Perl__crosszonecastspellbyguildid(int guild_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Guild, CZSpellUpdateSubtype_Cast, guild_id, spell_id); +} + +void Perl__crosszonecastspellbyexpeditionid(uint32 expedition_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Expedition, CZSpellUpdateSubtype_Cast, expedition_id, spell_id); +} + +void Perl__crosszonecastspellbyclientname(const char* client_name, uint32 spell_id) +{ + int update_identifier = 0; + quest_manager.CrossZoneSpell(CZUpdateType_ClientName, CZSpellUpdateSubtype_Cast, update_identifier, spell_id, client_name); +} + +void Perl__crosszonedialoguewindowbycharid(int character_id, const char* message) +{ + quest_manager.CrossZoneDialogueWindow(CZUpdateType_Character, character_id, message); +} + +void Perl__crosszonedialoguewindowbygroupid(int group_id, const char* message) +{ + quest_manager.CrossZoneDialogueWindow(CZUpdateType_Group, group_id, message); +} + +void Perl__crosszonedialoguewindowbyraidid(int raid_id, const char* message) +{ + quest_manager.CrossZoneDialogueWindow(CZUpdateType_Raid, raid_id, message); +} + +void Perl__crosszonedialoguewindowbyguildid(int guild_id, const char* message) +{ + quest_manager.CrossZoneDialogueWindow(CZUpdateType_Guild, guild_id, message); +} + +void Perl__crosszonedialoguewindowbyexpeditionid(uint32 expedition_id, const char* message) +{ + quest_manager.CrossZoneDialogueWindow(CZUpdateType_Expedition, expedition_id, message); +} + +void Perl__crosszonedialoguewindowbyclientname(const char* client_name, const char* message) +{ + int update_identifier = 0; + quest_manager.CrossZoneDialogueWindow(CZUpdateType_ClientName, update_identifier, message, client_name); +} + +void Perl__crosszonedisabletaskbycharid(int character_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_DisableTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonedisabletaskbygroupid(int group_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_DisableTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonedisabletaskbyraidid(int raid_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_DisableTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonedisabletaskbyguildid(int guild_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_DisableTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonedisabletaskbyexpeditionid(uint32 expedition_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_DisableTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonedisabletaskbyclientname(const char* client_name, uint32 task_id) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_DisableTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszoneenabletaskbycharid(int character_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_EnableTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneenabletaskbygroupid(int group_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_EnableTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneenabletaskbyraidid(int raid_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_EnableTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneenabletaskbyguildid(int guild_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_EnableTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneenabletaskbyexpeditionid(uint32 expedition_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_EnableTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneenabletaskbyclientname(const char* client_name, uint32 task_id) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_EnableTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszonefailtaskbycharid(int character_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_FailTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonefailtaskbygroupid(int group_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_FailTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonefailtaskbyraidid(int raid_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_FailTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonefailtaskbyguildid(int guild_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_FailTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonefailtaskbyexpeditionid(uint32 expedition_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_FailTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszonefailtaskbyclientname(const char* client_name, uint32 task_id) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_FailTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszonemarqueebycharid(int character_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.CrossZoneMarquee(CZUpdateType_Character, character_id, type, priority, fade_in, fade_out, duration, message); +} + +void Perl__crosszonemarqueebygroupid(int group_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.CrossZoneMarquee(CZUpdateType_Group, group_id, type, priority, fade_in, fade_out, duration, message); +} + +void Perl__crosszonemarqueebyraidid(int raid_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.CrossZoneMarquee(CZUpdateType_Raid, raid_id, type, priority, fade_in, fade_out, duration, message); +} + +void Perl__crosszonemarqueebyguildid(int guild_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.CrossZoneMarquee(CZUpdateType_Guild, guild_id, type, priority, fade_in, fade_out, duration, message); +} + +void Perl__crosszonemarqueebyexpeditionid(uint32 expedition_id, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.CrossZoneMarquee(CZUpdateType_Expedition, expedition_id, type, priority, fade_in, fade_out, duration, message); +} + +void Perl__crosszonemarqueebyclientname(const char* client_name, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + int update_identifier = 0; + quest_manager.CrossZoneMarquee(CZUpdateType_ClientName, update_identifier, type, priority, fade_in, fade_out, duration, message, client_name); +} + +void Perl__crosszonemessageplayerbycharid(int character_id, uint32 type, const char* message) +{ + quest_manager.CrossZoneMessage(CZUpdateType_Character, character_id, type, message); +} + +void Perl__crosszonemessageplayerbygroupid(int group_id, uint32 type, const char* message) +{ + quest_manager.CrossZoneMessage(CZUpdateType_Group, group_id, type, message); +} + +void Perl__crosszonemessageplayerbyraidid(int raid_id, uint32 type, const char* message) +{ + quest_manager.CrossZoneMessage(CZUpdateType_Raid, raid_id, type, message); +} + +void Perl__crosszonemessageplayerbyguildid(int guild_id, uint32 type, const char* message) +{ + quest_manager.CrossZoneMessage(CZUpdateType_Guild, guild_id, type, message); +} + +void Perl__crosszonemessageplayerbyexpeditionid(uint32 expedition_id, uint32 type, const char* message) +{ + quest_manager.CrossZoneMessage(CZUpdateType_Expedition, expedition_id, type, message); +} + +void Perl__crosszonemessageplayerbyname(const char* client_name, uint32 type, const char* message) +{ + int update_identifier = 0; + quest_manager.CrossZoneMessage(CZUpdateType_ClientName, update_identifier, type, message, client_name); +} + +void Perl__crosszonemoveplayerbycharid(int character_id, const char* zone_short_name) +{ + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_Character, CZMoveUpdateSubtype_MoveZone, character_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveplayerbygroupid(int group_id, const char* zone_short_name) +{ + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_Group, CZMoveUpdateSubtype_MoveZone, group_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveplayerbyraidid(int raid_id, const char* zone_short_name) +{ + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_Raid, CZMoveUpdateSubtype_MoveZone, raid_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveplayerbyguildid(int guild_id, const char* zone_short_name) +{ + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_Guild, CZMoveUpdateSubtype_MoveZone, guild_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveplayerbyexpeditionid(uint32 expedition_id, const char* zone_short_name) +{ + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_Expedition, CZMoveUpdateSubtype_MoveZone, expedition_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveplayerbyname(const char* client_name, const char* zone_short_name) +{ + int update_identifier = 0; + uint16 instance_id = 0; + quest_manager.CrossZoneMove(CZUpdateType_ClientName, CZMoveUpdateSubtype_MoveZone, update_identifier, zone_short_name, instance_id, client_name); +} + +void Perl__crosszonemoveinstancebycharid(int character_id, uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_Character, CZMoveUpdateSubtype_MoveZoneInstance, character_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveinstancebygroupid(int group_id, uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_Group, CZMoveUpdateSubtype_MoveZoneInstance, group_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveinstancebyraidid(int raid_id, uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_Raid, CZMoveUpdateSubtype_MoveZoneInstance, raid_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveinstancebyguildid(int guild_id, uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_Guild, CZMoveUpdateSubtype_MoveZoneInstance, guild_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveinstancebyexpeditionid(uint32 expedition_id, uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_Expedition, CZMoveUpdateSubtype_MoveZoneInstance, expedition_id, zone_short_name, instance_id); +} + +void Perl__crosszonemoveinstancebyclientname(const char* client_name, uint16 instance_id) +{ + int update_identifier = 0; + const char* zone_short_name = ""; + quest_manager.CrossZoneMove(CZUpdateType_ClientName, CZMoveUpdateSubtype_MoveZoneInstance, update_identifier, zone_short_name, instance_id, client_name); +} + +void Perl__crosszoneremoveldonlossbycharid(int character_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Character, CZLDoNUpdateSubtype_RemoveLoss, character_id, theme_id); +} + +void Perl__crosszoneremoveldonlossbygroupid(int group_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Group, CZLDoNUpdateSubtype_RemoveLoss, group_id, theme_id); +} + +void Perl__crosszoneremoveldonlossbyraidid(int raid_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Raid, CZLDoNUpdateSubtype_RemoveLoss, raid_id, theme_id); +} + +void Perl__crosszoneremoveldonlossbyguildid(int guild_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Guild, CZLDoNUpdateSubtype_RemoveLoss, guild_id, theme_id); +} + +void Perl__crosszoneremoveldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Expedition, CZLDoNUpdateSubtype_RemoveLoss, expedition_id, theme_id); +} + +void Perl__crosszoneremoveldonlossbyclientname(const char* client_name, uint32 theme_id) +{ + int update_identifier = 0; + int points = 1; + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_ClientName, CZLDoNUpdateSubtype_RemoveLoss, update_identifier, theme_id, points, client_name); +} + +void Perl__crosszoneremoveldonwinbycharid(int character_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Character, CZLDoNUpdateSubtype_RemoveWin, character_id, theme_id); +} + +void Perl__crosszoneremoveldonwinbygroupid(int group_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Group, CZLDoNUpdateSubtype_RemoveWin, group_id, theme_id); +} + +void Perl__crosszoneremoveldonwinbyraidid(int raid_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Raid, CZLDoNUpdateSubtype_RemoveWin, raid_id, theme_id); +} + +void Perl__crosszoneremoveldonwinbyguildid(int guild_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Guild, CZLDoNUpdateSubtype_RemoveWin, guild_id, theme_id); +} + +void Perl__crosszoneremoveldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id) +{ + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_Expedition, CZLDoNUpdateSubtype_RemoveWin, expedition_id, theme_id); +} + +void Perl__crosszoneremoveldonwinbyclientname(const char* client_name, uint32 theme_id) +{ + int update_identifier = 0; + int points = 1; + quest_manager.CrossZoneLDoNUpdate(CZUpdateType_ClientName, CZLDoNUpdateSubtype_RemoveWin, update_identifier, theme_id, points, client_name); +} + +void Perl__crosszoneremovespellbycharid(int character_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Character, CZSpellUpdateSubtype_Remove, character_id, spell_id); +} + +void Perl__crosszoneremovespellbygroupid(int group_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Group, CZSpellUpdateSubtype_Remove, group_id, spell_id); +} + +void Perl__crosszoneremovespellbyraidid(int raid_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Raid, CZSpellUpdateSubtype_Remove, raid_id, spell_id); +} + +void Perl__crosszoneremovespellbyguildid(int guild_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Guild, CZSpellUpdateSubtype_Remove, guild_id, spell_id); +} + +void Perl__crosszoneremovespellbyexpeditionid(uint32 expedition_id, uint32 spell_id) +{ + quest_manager.CrossZoneSpell(CZUpdateType_Expedition, CZSpellUpdateSubtype_Remove, expedition_id, spell_id); +} + +void Perl__crosszoneremovespellbyclientname(const char* client_name, uint32 spell_id) +{ + int update_identifier = 0; + quest_manager.CrossZoneSpell(CZUpdateType_ClientName, CZSpellUpdateSubtype_Remove, update_identifier, spell_id, client_name); +} + +void Perl__crosszoneremovetaskbycharid(int character_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_RemoveTask, character_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneremovetaskbygroupid(int group_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_RemoveTask, group_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneremovetaskbyraidid(int raid_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_RemoveTask, raid_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneremovetaskbyguildid(int guild_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_RemoveTask, guild_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneremovetaskbyexpeditionid(uint32 expedition_id, uint32 task_id) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_RemoveTask, expedition_id, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__crosszoneremovetaskbyclientname(const char* client_name, uint32 task_id) +{ + int update_identifier = 0; + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_RemoveTask, update_identifier, task_id, task_subidentifier, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszoneresetactivitybycharid(int character_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_ActivityReset, character_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneresetactivitybygroupid(int group_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_ActivityReset, group_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneresetactivitybyraidid(int raid_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_ActivityReset, raid_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneresetactivitybyguildid(int guild_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_ActivityReset, guild_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneresetactivitybyexpeditionid(uint32 expedition_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_ActivityReset, expedition_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneresetactivitybyclientname(const char* client_name, uint32 task_id, int activity_id) +{ + int update_identifier = 0; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_ActivityReset, update_identifier, task_id, activity_id, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszonesetentityvariablebycharid(int character_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_Character, character_id, variable_name, variable_value); +} + +void Perl__crosszonesetentityvariablebygroupid(int group_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_Group, group_id, variable_name, variable_value); +} + +void Perl__crosszonesetentityvariablebyraidid(int raid_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_Raid, raid_id, variable_name, variable_value); +} + +void Perl__crosszonesetentityvariablebyguildid(int guild_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_Guild, guild_id, variable_name, variable_value); +} + +void Perl__crosszonesetentityvariablebyexpeditionid(uint32 expedition_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_Expedition, expedition_id, variable_name, variable_value); +} + +void Perl__crosszonesetentityvariablebyclientname(const char* client_name, const char* variable_name, const char* variable_value) +{ + int update_identifier = 0; + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_ClientName, update_identifier, variable_name, variable_value, client_name); +} + +void Perl__crosszonesetentityvariablebynpctypeid(int npc_id, const char* variable_name, const char* variable_value) +{ + quest_manager.CrossZoneSetEntityVariable(CZUpdateType_NPC, npc_id, variable_name, variable_value); +} + +void Perl__crosszonesignalclientbycharid(int character_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_Character, character_id, signal); +} + +void Perl__crosszonesignalclientbygroupid(int group_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_Group, group_id, signal); +} + +void Perl__crosszonesignalclientbyraidid(int raid_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_Raid, raid_id, signal); +} + +void Perl__crosszonesignalclientbyguildid(int guild_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_Guild, guild_id, signal); +} + +void Perl__crosszonesignalclientbyexpeditionid(uint32 expedition_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_Expedition, expedition_id, signal); +} + +void Perl__crosszonesignalclientbyname(const char* client_name, uint32 signal) +{ + int update_identifier = 0; + quest_manager.CrossZoneSignal(CZUpdateType_Expedition, update_identifier, signal, client_name); +} + +void Perl__crosszonesignalnpcbynpctypeid(uint32 npc_id, uint32 signal) +{ + quest_manager.CrossZoneSignal(CZUpdateType_NPC, npc_id, signal); +} + +void Perl__crosszoneupdateactivitybycharid(int character_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_ActivityUpdate, character_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybycharid(int character_id, uint32 task_id, int activity_id, int update_count) +{ + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Character, CZTaskUpdateSubtype_ActivityUpdate, character_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybygroupid(int group_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_ActivityUpdate, group_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybygroupid(int group_id, uint32 task_id, int activity_id, int update_count) +{ + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Group, CZTaskUpdateSubtype_ActivityUpdate, group_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyraidid(int raid_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_ActivityUpdate, raid_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyraidid(int raid_id, uint32 task_id, int activity_id, int update_count) +{ + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Raid, CZTaskUpdateSubtype_ActivityUpdate, raid_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyguildid(int guild_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_ActivityUpdate, guild_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyguildid(int guild_id, uint32 task_id, int activity_id, int update_count) +{ + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Guild, CZTaskUpdateSubtype_ActivityUpdate, guild_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyexpeditionid(uint32 expedition_id, uint32 task_id, int activity_id) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_ActivityUpdate, expedition_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyexpeditionid(uint32 expedition_id, uint32 task_id, int activity_id, int update_count) +{ + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_Expedition, CZTaskUpdateSubtype_ActivityUpdate, expedition_id, task_id, activity_id, update_count, enforce_level_requirement); +} + +void Perl__crosszoneupdateactivitybyclientname(const char* client_name, uint32 task_id, int activity_id) +{ + int update_identifier = 0; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_ActivityUpdate, update_identifier, task_id, activity_id, update_count, enforce_level_requirement, client_name); +} + +void Perl__crosszoneupdateactivitybyclientname(const char* client_name, uint32 task_id, int activity_id, int update_count) +{ + int update_identifier = 0; + bool enforce_level_requirement = false; + quest_manager.CrossZoneTaskUpdate(CZUpdateType_ClientName, CZTaskUpdateSubtype_ActivityUpdate, update_identifier, task_id, activity_id, update_count, enforce_level_requirement, client_name); +} + +void Perl__worldwideaddldonloss(uint32 theme_id) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddLoss, theme_id); +} + +void Perl__worldwideaddldonloss(uint32 theme_id, uint8 min_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddLoss, theme_id, points, min_status); +} + +void Perl__worldwideaddldonloss(uint32 theme_id, uint8 min_status, uint8 max_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddLoss, theme_id, points, min_status, max_status); +} + +void Perl__worldwideaddldonpoints(uint32 theme_id) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddPoints, theme_id, points); +} + +void Perl__worldwideaddldonpoints(uint32 theme_id, int points) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddPoints, theme_id, points); +} + +void Perl__worldwideaddldonpoints(uint32 theme_id, int points, uint8 min_status) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddPoints, theme_id, points, min_status); +} + +void Perl__worldwideaddldonpoints(uint32 theme_id, int points, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddPoints, theme_id, points, min_status, max_status); +} + +void Perl__worldwideaddldonwin(uint32 theme_id) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddWin, theme_id, points); +} + +void Perl__worldwideaddldonwin(uint32 theme_id, uint8 min_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddWin, theme_id, points, min_status); +} + +void Perl__worldwideaddldonwin(uint32 theme_id, uint8 min_status, uint8 max_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_AddWin, theme_id, points, min_status, max_status); +} + +void Perl__worldwideassigntask(uint32 task_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_AssignTask, task_id); +} + +void Perl__worldwideassigntask(uint32 task_id, bool enforce_level_requirement) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_AssignTask, task_id, task_subidentifier, update_count, enforce_level_requirement); +} + +void Perl__worldwideassigntask(uint32 task_id, bool enforce_level_requirement, uint8 min_status) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_AssignTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwideassigntask(uint32 task_id, bool enforce_level_requirement, uint8 min_status, uint8 max_status) +{ + int task_subidentifier = -1; + int update_count = 1; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_AssignTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwidecastspell(uint32 spell_id) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Cast, spell_id); +} + +void Perl__worldwidecastspell(uint32 spell_id, uint8 min_status) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Cast, spell_id, min_status); +} + +void Perl__worldwidecastspell(uint32 spell_id, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Cast, spell_id, min_status, max_status); +} + +void Perl__worldwidedialoguewindow(const char* message) +{ + quest_manager.WorldWideDialogueWindow(message); +} + +void Perl__worldwidedialoguewindow(const char* message, uint8 min_status) +{ + quest_manager.WorldWideDialogueWindow(message, min_status); +} + +void Perl__worldwidedialoguewindow(const char* message, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideDialogueWindow(message, min_status, max_status); +} + +void Perl__worldwidedisabletask(uint32 task_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_DisableTask, task_id); +} + +void Perl__worldwidedisabletask(uint32 task_id, uint8 min_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_DisableTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwidedisabletask(uint32 task_id, uint8 min_status, uint8 max_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_DisableTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwideenabletask(uint32 task_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_EnableTask, task_id); +} + +void Perl__worldwideenabletask(uint32 task_id, uint8 min_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_EnableTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwideenabletask(uint32 task_id, uint8 min_status, uint8 max_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_EnableTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwidefailtask(uint32 task_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_FailTask, task_id); +} + +void Perl__worldwidefailtask(uint32 task_id, uint8 min_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_FailTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwidefailtask(uint32 task_id, uint8 min_status, uint8 max_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_FailTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwidemarquee(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message) +{ + quest_manager.WorldWideMarquee(type, priority, fade_in, fade_out, duration, message); +} + +void Perl__worldwidemarquee(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message, uint8 min_status) +{ + quest_manager.WorldWideMarquee(type, priority, fade_in, fade_out, duration, message, min_status); +} + +void Perl__worldwidemarquee(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, const char* message, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideMarquee(type, priority, fade_in, fade_out, duration, message, min_status, max_status); +} + +void Perl__worldwidemessage(uint32 type, const char* message) +{ + quest_manager.WorldWideMessage(type, message); +} + +void Perl__worldwidemessage(uint32 type, const char* message, uint8 min_status) +{ + quest_manager.WorldWideMessage(type, message, min_status); +} + +void Perl__worldwidemessage(uint32 type, const char* message, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideMessage(type, message, min_status, max_status); +} + +void Perl__worldwidemove(const char* zone_short_name) +{ + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZone, zone_short_name); +} + +void Perl__worldwidemove(const char* zone_short_name, uint8 min_status) +{ + uint16 instance_id = 0; + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZone, zone_short_name, instance_id, min_status); +} + +void Perl__worldwidemove(const char* zone_short_name, uint8 min_status, uint8 max_status) +{ + uint16 instance_id = 0; + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZone, zone_short_name, instance_id, min_status, max_status); +} + +void Perl__worldwidemoveinstance(uint16 instance_id) +{ + const char* zone_short_name = ""; + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZoneInstance, zone_short_name, instance_id); +} + +void Perl__worldwidemoveinstance(uint16 instance_id, uint8 min_status) +{ + const char* zone_short_name = ""; + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZoneInstance, zone_short_name, instance_id, min_status); +} + +void Perl__worldwidemoveinstance(uint16 instance_id, uint8 min_status, uint8 max_status) +{ + const char* zone_short_name = ""; + quest_manager.WorldWideMove(WWMoveUpdateType_MoveZoneInstance, zone_short_name, instance_id, min_status, max_status); +} + +void Perl__worldwideremoveldonloss(uint32 theme_id) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveLoss, theme_id); +} + +void Perl__worldwideremoveldonloss(uint32 theme_id, uint8 min_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveLoss, theme_id, points, min_status); +} + +void Perl__worldwideremoveldonloss(uint32 theme_id, uint8 min_status, uint8 max_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveLoss, theme_id, points, min_status, max_status); +} + +void Perl__worldwideremoveldonwin(uint32 theme_id) +{ + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveWin, theme_id); +} + +void Perl__worldwideremoveldonwin(uint32 theme_id, uint8 min_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveWin, theme_id, points, min_status); +} + +void Perl__worldwideremoveldonwin(uint32 theme_id, uint8 min_status, uint8 max_status) +{ + int points = 1; + quest_manager.WorldWideLDoNUpdate(CZLDoNUpdateSubtype_RemoveWin, theme_id, points, min_status, max_status); +} + +void Perl__worldwideremovespell(uint32 spell_id) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Remove, spell_id); +} + +void Perl__worldwideremovespell(uint32 spell_id, uint8 min_status) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Remove, spell_id, min_status); +} + +void Perl__worldwideremovespell(uint32 spell_id, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideSpell(WWSpellUpdateType_Remove, spell_id, min_status, max_status); +} + +void Perl__worldwideremovetask(uint32 task_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_RemoveTask, task_id); +} + +void Perl__worldwideremovetask(uint32 task_id, uint8 min_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_RemoveTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwideremovetask(uint32 task_id, uint8 min_status, uint8 max_status) +{ + int task_subidentifier = -1; + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_RemoveTask, task_id, task_subidentifier, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwideresetactivity(uint32 task_id, int activity_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityReset, task_id); +} + +void Perl__worldwideresetactivity(uint32 task_id, int activity_id, uint8 min_status) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityReset, task_id, activity_id, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwideresetactivity(uint32 task_id, int activity_id, uint8 min_status, uint8 max_status) +{ + int update_count = 1; + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityReset, task_id, activity_id, update_count, enforce_level_requirement, min_status, max_status); +} + +void Perl__worldwidesetentityvariableclient(const char* variable_name, const char* variable_value) +{ + quest_manager.WorldWideSetEntityVariable(WWSetEntityVariableUpdateType_Character, variable_name, variable_value); +} + +void Perl__worldwidesetentityvariableclient(const char* variable_name, const char* variable_value, uint8 min_status) +{ + quest_manager.WorldWideSetEntityVariable(WWSetEntityVariableUpdateType_Character, variable_name, variable_value, min_status); +} + +void Perl__worldwidesetentityvariableclient(const char* variable_name, const char* variable_value, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideSetEntityVariable(WWSetEntityVariableUpdateType_Character, variable_name, variable_value, min_status, max_status); +} + +void Perl__worldwidesetentityvariablenpc(const char* variable_name, const char* variable_value) +{ + quest_manager.WorldWideSetEntityVariable(WWSetEntityVariableUpdateType_NPC, variable_name, variable_value); +} + +void Perl__worldwidesignalnpc(uint32 signal) +{ + quest_manager.WorldWideSignal(WWSignalUpdateType_NPC, signal); +} + +void Perl__worldwidesignalclient(uint32 signal) +{ + quest_manager.WorldWideSignal(WWSignalUpdateType_Character, signal); +} + +void Perl__worldwidesignalclient(uint32 signal, uint8 min_status) +{ + quest_manager.WorldWideSignal(WWSignalUpdateType_Character, signal, min_status); +} + +void Perl__worldwidesignalclient(uint32 signal, uint8 min_status, uint8 max_status) +{ + quest_manager.WorldWideSignal(WWSignalUpdateType_Character, signal, min_status, max_status); +} + +void Perl__worldwideupdateactivity(uint32 task_id, int activity_id) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityUpdate, task_id, activity_id); +} + +void Perl__worldwideupdateactivity(uint32 task_id, int activity_id, int update_count) +{ + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityUpdate, task_id, activity_id, update_count); +} + +void Perl__worldwideupdateactivity(uint32 task_id, int activity_id, int update_count, uint8 min_status) +{ + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityUpdate, task_id, activity_id, update_count, enforce_level_requirement, min_status); +} + +void Perl__worldwideupdateactivity(uint32 task_id, int activity_id, int update_count, uint8 min_status, uint8 max_status) +{ + bool enforce_level_requirement = false; + quest_manager.WorldWideTaskUpdate(WWTaskUpdateType_ActivityUpdate, task_id, activity_id, update_count, enforce_level_requirement, min_status, max_status); +} + +bool Perl__isnpcspawned(perl::array npc_id_array) +{ + std::vector npc_ids; + for (int i = 0; i < npc_id_array.size(); ++i) { - std::string webhook_name = (std::string) SvPV_nolen(ST(0)); - std::string message = (std::string) SvPV_nolen(ST(1)); - zone->SendDiscordMessage(webhook_name, message); + npc_ids.push_back(static_cast(npc_id_array[i])); } - XSRETURN_EMPTY; + return entity_list.IsNPCSpawned(npc_ids); } -XS(XS__tracknpc); -XS(XS__tracknpc) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::tracknpc(uint32 entity_id)"); +uint32_t Perl__countspawnednpcs(perl::array npc_id_array) +{ + std::vector npc_ids; + for (int i = 0; i < npc_id_array.size(); ++i) { - uint32 entity_id = (uint32) SvUV(ST(0)); - quest_manager.TrackNPC(entity_id); + npc_ids.push_back(static_cast(npc_id_array[i])); } - XSRETURN_EMPTY; + return entity_list.CountSpawnedNPCs(npc_ids); } -/* -This is the callback perl will look for to setup the -quest package's XSUBs -*/ -EXTERN_C XS(boot_quest); // prototype to pass -Wmissing-prototypes -EXTERN_C XS(boot_quest) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = '\0'; +SPDat_Spell_Struct* Perl__getspell(uint32 spell_id) +{ + // should be safe, it's read only in perl (could also use proxy lika lua) + return const_cast(quest_manager.getspell(spell_id)); +} - if (items != 1) - LogError("boot_quest does not take any arguments"); +std::string Perl__getldonthemename(uint32 theme_id) +{ + return quest_manager.getldonthemename(theme_id); +} - char buf[128]; //shouldent have any function names longer than this. +std::string Perl__getfactionname(int faction_id) +{ + return quest_manager.getfactionname(faction_id); +} - //add the strcpy stuff to get rid of const warnings.... +std::string Perl__getlanguagename(int language_id) +{ + return quest_manager.getlanguagename(language_id); +} - XS_VERSION_BOOTCHECK; +std::string Perl__getbodytypename(uint32 bodytype_id) +{ + return quest_manager.getbodytypename(bodytype_id); +} + +std::string Perl__getconsiderlevelname(uint8 consider_level) +{ + return quest_manager.getconsiderlevelname(consider_level); +} + +std::string Perl__getenvironmentaldamagename(uint8 damage_type) +{ + return quest_manager.getenvironmentaldamagename(damage_type); +} + +std::string Perl__commify(perl::scalar number) +{ + return commify(number.c_str()); +} + +bool Perl__checknamefilter(std::string name) +{ + return database.CheckNameFilter(name); +} + +void Perl__discordsend(std::string webhook_name, std::string message) +{ + zone->SendDiscordMessage(webhook_name, message); +} + +void Perl__tracknpc(uint32 entity_id) +{ + quest_manager.TrackNPC(entity_id); +} + +void perl_register_quest() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_package("quest"); #ifdef BOTS - newXS(strcpy(buf, "botquest"), XS__botquest, file); - newXS(strcpy(buf, "spawnbotcount"), XS__spawnbotcount, file); - newXS(strcpy(buf, "createbotcount"), XS__createbotcount, file); - newXS(strcpy(buf, "createBot"), XS__createBot, file); + package.add("botquest", &Perl__botquest); + package.add("spawnbotcount", &Perl__spawnbotcount); + package.add("createbotcount", &Perl__createbotcount); + package.add("createBot", &Perl__createBot); #endif //BOTS - newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file); - newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file); - newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file); - newXS(strcpy(buf, "AssignToInstanceByCharID"), XS__AssignToInstanceByCharID, file); - newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file); - newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); - newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); - newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file); - newXS(strcpy(buf, "GetInstanceTimer"), XS__GetInstanceTimer, file); - newXS(strcpy(buf, "GetInstanceTimerByID"), XS__GetInstanceTimerByID, file); - newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file); - newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file); - newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file); - newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file); - newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file); - newXS(strcpy(buf, "GetInstanceIDByCharID"), XS__GetInstanceIDByCharID, file); - newXS(strcpy(buf, "GetSpellResistType"), XS__GetSpellResistType, file); - newXS(strcpy(buf, "GetSpellTargetType"), XS__GetSpellTargetType, file); - newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); - newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); - newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); - newXS(strcpy(buf, "GetZoneLongNameByID"), XS__GetZoneLongNameByID, file); - newXS(strcpy(buf, "GetZoneShortName"), XS__GetZoneShortName, file); - newXS(strcpy(buf, "set_rule"), XS__set_rule, file); - newXS(strcpy(buf, "get_rule"), XS__get_rule, file); - newXS(strcpy(buf, "get_data"), XS__get_data, file); - newXS(strcpy(buf, "get_data_expires"), XS__get_data_expires, file); - newXS(strcpy(buf, "get_data_remaining"), XS__get_data_remaining, file); - newXS(strcpy(buf, "set_data"), XS__set_data, file); - newXS(strcpy(buf, "delete_data"), XS__delete_data, file); - newXS(strcpy(buf, "IsBeneficialSpell"), XS__IsBeneficialSpell, file); - newXS(strcpy(buf, "IsEffectInSpell"), XS__IsEffectInSpell, file); - newXS(strcpy(buf, "IsRunning"), XS__IsRunning, file); - newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file); - newXS(strcpy(buf, "MerchantCountItem"), XS__MerchantCountItem, file); - newXS(strcpy(buf, "MerchantSetItem"), XS__MerchantSetItem, file); - newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file); - newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file); - newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file); - newXS(strcpy(buf, "RemoveFromInstanceByCharID"), XS__RemoveFromInstanceByCharID, file); - newXS(strcpy(buf, "CheckInstanceByCharID"), XS__CheckInstanceByCharID, file); - newXS(strcpy(buf, "SendMail"), XS__SendMail, file); - newXS(strcpy(buf, "SetRunning"), XS__SetRunning, file); - newXS(strcpy(buf, "activespeakactivity"), XS__activespeakactivity, file); - newXS(strcpy(buf, "activespeaktask"), XS__activespeaktask, file); - newXS(strcpy(buf, "activetasksinset"), XS__activetasksinset, file); - newXS(strcpy(buf, "add_expedition_lockout_all_clients"), XS__add_expedition_lockout_all_clients, file); - newXS(strcpy(buf, "add_expedition_lockout_by_char_id"), XS__add_expedition_lockout_by_char_id, file); - newXS(strcpy(buf, "addldonloss"), XS__addldonloss, file); - newXS(strcpy(buf, "addldonpoints"), XS__addldonpoints, file); - newXS(strcpy(buf, "addldonwin"), XS__addldonwin, file); - newXS(strcpy(buf, "addloot"), XS__addloot, file); - newXS(strcpy(buf, "addskill"), XS__addskill, file); - newXS(strcpy(buf, "assigntask"), XS__assigntask, file); - newXS(strcpy(buf, "attack"), XS__attack, file); - newXS(strcpy(buf, "attacknpc"), XS__attacknpc, file); - newXS(strcpy(buf, "attacknpctype"), XS__attacknpctype, file); - newXS(strcpy(buf, "buryplayercorpse"), XS__buryplayercorpse, file); - newXS(strcpy(buf, "castspell"), XS__castspell, file); - newXS(strcpy(buf, "changedeity"), XS__changedeity, file); - newXS(strcpy(buf, "checknamefilter"), XS__checknamefilter, file); - newXS(strcpy(buf, "checktitle"), XS__checktitle, file); - newXS(strcpy(buf, "clear_npctype_cache"), XS__clear_npctype_cache, file); - newXS(strcpy(buf, "clear_proximity"), XS__clear_proximity, file); - newXS(strcpy(buf, "clear_zone_flag"), XS__clear_zone_flag, file); - newXS(strcpy(buf, "clearspawntimers"), XS__clearspawntimers, file); - newXS(strcpy(buf, "collectitems"), XS__collectitems, file); - newXS(strcpy(buf, "commify"), XS__commify, file); - newXS(strcpy(buf, "completedtasksinset"), XS__completedtasksinset, file); - newXS(strcpy(buf, "countitem"), XS__countitem, file); - newXS(strcpy(buf, "countspawnednpcs"), XS__countspawnednpcs, file); - newXS(strcpy(buf, "createdoor"), XS__CreateDoor, file); - newXS(strcpy(buf, "creategroundobject"), XS__CreateGroundObject, file); - newXS(strcpy(buf, "creategroundobjectfrommodel"), XS__CreateGroundObjectFromModel, file); - newXS(strcpy(buf, "createguild"), XS__createguild, file); - newXS(strcpy(buf, "createitem"), XS__createitem, file); - newXS(strcpy(buf, "crosszoneaddldonlossbycharid"), XS__crosszoneaddldonlossbycharid, file); - newXS(strcpy(buf, "crosszoneaddldonlossbygroupid"), XS__crosszoneaddldonlossbygroupid, file); - newXS(strcpy(buf, "crosszoneaddldonlossbyraidid"), XS__crosszoneaddldonlossbyraidid, file); - newXS(strcpy(buf, "crosszoneaddldonlossbyguildid"), XS__crosszoneaddldonlossbyguildid, file); - newXS(strcpy(buf, "crosszoneaddldonlossbyexpeditionid"), XS__crosszoneaddldonlossbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneaddldonlossbyclientname"), XS__crosszoneaddldonlossbyclientname, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbycharid"), XS__crosszoneaddldonpointsbycharid, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbygroupid"), XS__crosszoneaddldonpointsbygroupid, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbyraidid"), XS__crosszoneaddldonpointsbyraidid, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbyguildid"), XS__crosszoneaddldonpointsbyguildid, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbyexpeditionid"), XS__crosszoneaddldonpointsbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneaddldonpointsbyclientname"), XS__crosszoneaddldonpointsbyclientname, file); - newXS(strcpy(buf, "crosszoneaddldonwinbycharid"), XS__crosszoneaddldonwinbycharid, file); - newXS(strcpy(buf, "crosszoneaddldonwinbygroupid"), XS__crosszoneaddldonwinbygroupid, file); - newXS(strcpy(buf, "crosszoneaddldonwinbyraidid"), XS__crosszoneaddldonwinbyraidid, file); - newXS(strcpy(buf, "crosszoneaddldonwinbyguildid"), XS__crosszoneaddldonwinbyguildid, file); - newXS(strcpy(buf, "crosszoneaddldonwinbyexpeditionid"), XS__crosszoneaddldonwinbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneaddldonwinbyclientname"), XS__crosszoneaddldonwinbyclientname, file); - newXS(strcpy(buf, "crosszoneassigntaskbycharid"), XS__crosszoneassigntaskbycharid, file); - newXS(strcpy(buf, "crosszoneassigntaskbygroupid"), XS__crosszoneassigntaskbygroupid, file); - newXS(strcpy(buf, "crosszoneassigntaskbyraidid"), XS__crosszoneassigntaskbyraidid, file); - newXS(strcpy(buf, "crosszoneassigntaskbyguildid"), XS__crosszoneassigntaskbyguildid, file); - newXS(strcpy(buf, "crosszoneassigntaskbyexpeditionid"), XS__crosszoneassigntaskbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneassigntaskbyclientname"), XS__crosszoneassigntaskbyclientname, file); - newXS(strcpy(buf, "crosszonecastspellbycharid"), XS__crosszonecastspellbycharid, file); - newXS(strcpy(buf, "crosszonecastspellbygroupid"), XS__crosszonecastspellbygroupid, file); - newXS(strcpy(buf, "crosszonecastspellbyraidid"), XS__crosszonecastspellbyraidid, file); - newXS(strcpy(buf, "crosszonecastspellbyguildid"), XS__crosszonecastspellbyguildid, file); - newXS(strcpy(buf, "crosszonecastspellbyexpeditionid"), XS__crosszonecastspellbyexpeditionid, file); - newXS(strcpy(buf, "crosszonecastspellbyclientname"), XS__crosszonecastspellbyclientname, file); - newXS(strcpy(buf, "crosszonedialoguewindowbycharid"), XS__crosszonedialoguewindowbycharid, file); - newXS(strcpy(buf, "crosszonedialoguewindowbygroupid"), XS__crosszonedialoguewindowbygroupid, file); - newXS(strcpy(buf, "crosszonedialoguewindowbyraidid"), XS__crosszonedialoguewindowbyraidid, file); - newXS(strcpy(buf, "crosszonedialoguewindowbyguildid"), XS__crosszonedialoguewindowbyguildid, file); - newXS(strcpy(buf, "crosszonedialoguewindowbyexpeditionid"), XS__crosszonedialoguewindowbyexpeditionid, file); - newXS(strcpy(buf, "crosszonedialoguewindowbyclientname"), XS__crosszonedialoguewindowbyclientname, file); - newXS(strcpy(buf, "crosszonedisabletaskbycharid"), XS__crosszonedisabletaskbycharid, file); - newXS(strcpy(buf, "crosszonedisabletaskbygroupid"), XS__crosszonedisabletaskbygroupid, file); - newXS(strcpy(buf, "crosszonedisabletaskbyraidid"), XS__crosszonedisabletaskbyraidid, file); - newXS(strcpy(buf, "crosszonedisabletaskbyguildid"), XS__crosszonedisabletaskbyguildid, file); - newXS(strcpy(buf, "crosszonedisabletaskbyexpeditionid"), XS__crosszonedisabletaskbyexpeditionid, file); - newXS(strcpy(buf, "crosszonedisabletaskbyclientname"), XS__crosszonedisabletaskbyclientname, file); - newXS(strcpy(buf, "crosszoneenabletaskbycharid"), XS__crosszoneenabletaskbycharid, file); - newXS(strcpy(buf, "crosszoneenabletaskbygroupid"), XS__crosszoneenabletaskbygroupid, file); - newXS(strcpy(buf, "crosszoneenabletaskbyraidid"), XS__crosszoneenabletaskbyraidid, file); - newXS(strcpy(buf, "crosszoneenabletaskbyguildid"), XS__crosszoneenabletaskbyguildid, file); - newXS(strcpy(buf, "crosszoneenabletaskbyexpeditionid"), XS__crosszoneenabletaskbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneenabletaskbyclientname"), XS__crosszoneenabletaskbyclientname, file); - newXS(strcpy(buf, "crosszonefailtaskbycharid"), XS__crosszonefailtaskbycharid, file); - newXS(strcpy(buf, "crosszonefailtaskbygroupid"), XS__crosszonefailtaskbygroupid, file); - newXS(strcpy(buf, "crosszonefailtaskbyraidid"), XS__crosszonefailtaskbyraidid, file); - newXS(strcpy(buf, "crosszonefailtaskbyguildid"), XS__crosszonefailtaskbyguildid, file); - newXS(strcpy(buf, "crosszonefailtaskbyexpeditionid"), XS__crosszonefailtaskbyexpeditionid, file); - newXS(strcpy(buf, "crosszonefailtaskbyclientname"), XS__crosszonefailtaskbyclientname, file); - newXS(strcpy(buf, "crosszonemarqueebycharid"), XS__crosszonemarqueebycharid, file); - newXS(strcpy(buf, "crosszonemarqueebygroupid"), XS__crosszonemarqueebygroupid, file); - newXS(strcpy(buf, "crosszonemarqueebyraidid"), XS__crosszonemarqueebyraidid, file); - newXS(strcpy(buf, "crosszonemarqueebyguildid"), XS__crosszonemarqueebyguildid, file); - newXS(strcpy(buf, "crosszonemarqueebyexpeditionid"), XS__crosszonemarqueebyexpeditionid, file); - newXS(strcpy(buf, "crosszonemarqueebyclientname"), XS__crosszonemarqueebyclientname, file); - newXS(strcpy(buf, "crosszonemessageplayerbycharid"), XS__crosszonemessageplayerbycharid, file); - newXS(strcpy(buf, "crosszonemessageplayerbygroupid"), XS__crosszonemessageplayerbygroupid, file); - newXS(strcpy(buf, "crosszonemessageplayerbyraidid"), XS__crosszonemessageplayerbyraidid, file); - newXS(strcpy(buf, "crosszonemessageplayerbyguildid"), XS__crosszonemessageplayerbyguildid, file); - newXS(strcpy(buf, "crosszonemessageplayerbyexpeditionid"), XS__crosszonemessageplayerbyexpeditionid, file); - newXS(strcpy(buf, "crosszonemessageplayerbyname"), XS__crosszonemessageplayerbyname, file); - newXS(strcpy(buf, "crosszonemoveplayerbycharid"), XS__crosszonemoveplayerbycharid, file); - newXS(strcpy(buf, "crosszonemoveplayerbygroupid"), XS__crosszonemoveplayerbygroupid, file); - newXS(strcpy(buf, "crosszonemoveplayerbyraidid"), XS__crosszonemoveplayerbyraidid, file); - newXS(strcpy(buf, "crosszonemoveplayerbyguildid"), XS__crosszonemoveplayerbyguildid, file); - newXS(strcpy(buf, "crosszonemoveplayerbyexpeditionid"), XS__crosszonemoveplayerbyexpeditionid, file); - newXS(strcpy(buf, "crosszonemoveplayerbyname"), XS__crosszonemoveplayerbyname, file); - newXS(strcpy(buf, "crosszonemoveinstancebycharid"), XS__crosszonemoveinstancebycharid, file); - newXS(strcpy(buf, "crosszonemoveinstancebygroupid"), XS__crosszonemoveinstancebygroupid, file); - newXS(strcpy(buf, "crosszonemoveinstancebyraidid"), XS__crosszonemoveinstancebyraidid, file); - newXS(strcpy(buf, "crosszonemoveinstancebyguildid"), XS__crosszonemoveinstancebyguildid, file); - newXS(strcpy(buf, "crosszonemoveinstancebyexpeditionid"), XS__crosszonemoveinstancebyexpeditionid, file); - newXS(strcpy(buf, "crosszonemoveinstancebyclientname"), XS__crosszonemoveinstancebyclientname, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbycharid"), XS__crosszoneremoveldonlossbycharid, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbygroupid"), XS__crosszoneremoveldonlossbygroupid, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbyraidid"), XS__crosszoneremoveldonlossbyraidid, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbyguildid"), XS__crosszoneremoveldonlossbyguildid, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbyexpeditionid"), XS__crosszoneremoveldonlossbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneremoveldonlossbyclientname"), XS__crosszoneremoveldonlossbyclientname, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbycharid"), XS__crosszoneremoveldonwinbycharid, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbygroupid"), XS__crosszoneremoveldonwinbygroupid, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbyraidid"), XS__crosszoneremoveldonwinbyraidid, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbyguildid"), XS__crosszoneremoveldonwinbyguildid, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbyexpeditionid"), XS__crosszoneremoveldonwinbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneremoveldonwinbyclientname"), XS__crosszoneremoveldonwinbyclientname, file); - newXS(strcpy(buf, "crosszoneremovespellbycharid"), XS__crosszoneremovespellbycharid, file); - newXS(strcpy(buf, "crosszoneremovespellbygroupid"), XS__crosszoneremovespellbygroupid, file); - newXS(strcpy(buf, "crosszoneremovespellbyraidid"), XS__crosszoneremovespellbyraidid, file); - newXS(strcpy(buf, "crosszoneremovespellbyguildid"), XS__crosszoneremovespellbyguildid, file); - newXS(strcpy(buf, "crosszoneremovespellbyexpeditionid"), XS__crosszoneremovespellbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneremovespellbyclientname"), XS__crosszoneremovespellbyclientname, file); - newXS(strcpy(buf, "crosszoneremovetaskbycharid"), XS__crosszoneremovetaskbycharid, file); - newXS(strcpy(buf, "crosszoneremovetaskbygroupid"), XS__crosszoneremovetaskbygroupid, file); - newXS(strcpy(buf, "crosszoneremovetaskbyraidid"), XS__crosszoneremovetaskbyraidid, file); - newXS(strcpy(buf, "crosszoneremovetaskbyguildid"), XS__crosszoneremovetaskbyguildid, file); - newXS(strcpy(buf, "crosszoneremovetaskbyexpeditionid"), XS__crosszoneremovetaskbyexpeditionid, file); - newXS(strcpy(buf, "crosszoneremovetaskbyclientname"), XS__crosszoneremovetaskbyclientname, file); - newXS(strcpy(buf, "crosszoneresetactivitybycharid"), XS__crosszoneresetactivitybycharid, file); - newXS(strcpy(buf, "crosszoneresetactivitybygroupid"), XS__crosszoneresetactivitybygroupid, file); - newXS(strcpy(buf, "crosszoneresetactivitybyraidid"), XS__crosszoneresetactivitybyraidid, file); - newXS(strcpy(buf, "crosszoneresetactivitybyguildid"), XS__crosszoneresetactivitybyguildid, file); - newXS(strcpy(buf, "crosszoneresetactivitybyexpeditionid"), XS__crosszoneresetactivitybyexpeditionid, file); - newXS(strcpy(buf, "crosszoneresetactivitybyclientname"), XS__crosszoneresetactivitybyclientname, file); - newXS(strcpy(buf, "crosszonesetentityvariablebycharid"), XS__crosszonesetentityvariablebycharid, file); - newXS(strcpy(buf, "crosszonesetentityvariablebygroupid"), XS__crosszonesetentityvariablebygroupid, file); - newXS(strcpy(buf, "crosszonesetentityvariablebyraidid"), XS__crosszonesetentityvariablebyraidid, file); - newXS(strcpy(buf, "crosszonesetentityvariablebyguildid"), XS__crosszonesetentityvariablebyguildid, file); - newXS(strcpy(buf, "crosszonesetentityvariablebyexpeditionid"), XS__crosszonesetentityvariablebyexpeditionid, file); - newXS(strcpy(buf, "crosszonesetentityvariablebyclientname"), XS__crosszonesetentityvariablebyclientname, file); - newXS(strcpy(buf, "crosszonesetentityvariablebynpctypeid"), XS__crosszonesetentityvariablebynpctypeid, file); - newXS(strcpy(buf, "crosszonesignalclientbycharid"), XS__crosszonesignalclientbycharid, file); - newXS(strcpy(buf, "crosszonesignalclientbygroupid"), XS__crosszonesignalclientbygroupid, file); - newXS(strcpy(buf, "crosszonesignalclientbyraidid"), XS__crosszonesignalclientbyraidid, file); - newXS(strcpy(buf, "crosszonesignalclientbyguildid"), XS__crosszonesignalclientbyguildid, file); - newXS(strcpy(buf, "crosszonesignalclientbyexpeditionid"), XS__crosszonesignalclientbyexpeditionid, file); - newXS(strcpy(buf, "crosszonesignalclientbyname"), XS__crosszonesignalclientbyname, file); - newXS(strcpy(buf, "crosszonesignalnpcbynpctypeid"), XS__crosszonesignalnpcbynpctypeid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybycharid"), XS__crosszoneupdateactivitybycharid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybygroupid"), XS__crosszoneupdateactivitybygroupid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybyraidid"), XS__crosszoneupdateactivitybyraidid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybyguildid"), XS__crosszoneupdateactivitybyguildid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybyexpeditionid"), XS__crosszoneupdateactivitybyexpeditionid, file); - newXS(strcpy(buf, "crosszoneupdateactivitybyclientname"), XS__crosszoneupdateactivitybyclientname, file); - newXS(strcpy(buf, "worldwideaddldonloss"), XS__worldwideaddldonloss, file); - newXS(strcpy(buf, "worldwideaddldonpoints"), XS__worldwideaddldonpoints, file); - newXS(strcpy(buf, "worldwideaddldonwin"), XS__worldwideaddldonwin, file); - newXS(strcpy(buf, "worldwidecastspell"), XS__worldwidecastspell, file); - newXS(strcpy(buf, "worldwidedialoguewindow"), XS__worldwidedialoguewindow, file); - newXS(strcpy(buf, "worldwidedisabletask"), XS__worldwidedisabletask, file); - newXS(strcpy(buf, "worldwideenabletask"), XS__worldwideenabletask, file); - newXS(strcpy(buf, "worldwidefailtask"), XS__worldwidefailtask, file); - newXS(strcpy(buf, "worldwidemarquee"), XS__worldwidemarquee, file); - newXS(strcpy(buf, "worldwidemessage"), XS__worldwidemessage, file); - newXS(strcpy(buf, "worldwidemove"), XS__worldwidemove, file); - newXS(strcpy(buf, "worldwidemoveinstance"), XS__worldwidemoveinstance, file); - newXS(strcpy(buf, "worldwideremoveldonloss"), XS__worldwideremoveldonloss, file); - newXS(strcpy(buf, "worldwideremoveldonwin"), XS__worldwideremoveldonwin, file); - newXS(strcpy(buf, "worldwideremovespell"), XS__worldwideremovespell, file); - newXS(strcpy(buf, "worldwideremovetask"), XS__worldwideremovetask, file); - newXS(strcpy(buf, "worldwideresetactivity"), XS__worldwideresetactivity, file); - newXS(strcpy(buf, "worldwidesetentityvariableclient"), XS__worldwidesetentityvariableclient, file); - newXS(strcpy(buf, "worldwidesetentityvariablenpc"), XS__worldwidesetentityvariablenpc, file); - newXS(strcpy(buf, "worldwidesignalclient"), XS__worldwidesignalclient, file); - newXS(strcpy(buf, "worldwidesignalnpc"), XS__worldwidesignalnpc, file); - newXS(strcpy(buf, "worldwideupdateactivity"), XS__worldwideupdateactivity, file); - newXS(strcpy(buf, "debug"), XS__debug, file); - newXS(strcpy(buf, "delglobal"), XS__delglobal, file); - newXS(strcpy(buf, "depop"), XS__depop, file); - newXS(strcpy(buf, "depop_withtimer"), XS__depop_withtimer, file); - newXS(strcpy(buf, "depopall"), XS__depopall, file); - newXS(strcpy(buf, "depopzone"), XS__depopzone, file); - newXS(strcpy(buf, "ding"), XS__ding, file); - newXS(strcpy(buf, "disable_proximity_say"), XS__disable_proximity_say, file); - newXS(strcpy(buf, "disable_spawn2"), XS__disable_spawn2, file); - newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file); - newXS(strcpy(buf, "disabletask"), XS__disabletask, file); - newXS(strcpy(buf, "discordsend"), XS__discordsend, file); - newXS(strcpy(buf, "doanim"), XS__doanim, file); - newXS(strcpy(buf, "echo"), XS__echo, file); - newXS(strcpy(buf, "emote"), XS__emote, file); - newXS(strcpy(buf, "enable_proximity_say"), XS__enable_proximity_say, file); - newXS(strcpy(buf, "enable_spawn2"), XS__enable_spawn2, file); - newXS(strcpy(buf, "enabledtaskcount"), XS__enabledtaskcount, file); - newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file); - newXS(strcpy(buf, "enabletask"), XS__enabletask, file); - newXS(strcpy(buf, "enabletitle"), XS__enabletitle, file); - newXS(strcpy(buf, "exp"), XS__exp, file); - newXS(strcpy(buf, "faction"), XS__faction, file); - newXS(strcpy(buf, "factionvalue"), XS_FactionValue, file); - newXS(strcpy(buf, "failtask"), XS__failtask, file); - newXS(strcpy(buf, "firsttaskinset"), XS__firsttaskinset, file); - newXS(strcpy(buf, "follow"), XS__follow, file); - newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file); - newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file); - newXS(strcpy(buf, "getaaexpmodifierbycharid"), XS__getaaexpmodifierbycharid, file); - newXS(strcpy(buf, "getbodytypename"), XS__getbodytypename, file); - newXS(strcpy(buf, "getcharidbyname"), XS__getcharidbyname, file); - newXS(strcpy(buf, "getclassname"), XS__getclassname, file); - newXS(strcpy(buf, "getcleannpcnamebyid"), XS__getcleannpcnamebyid, file); - newXS(strcpy(buf, "getconsiderlevelname"), XS__getconsiderlevelname, file); - newXS(strcpy(buf, "gethexcolorcode"), XS__gethexcolorcode, file); - newXS(strcpy(buf, "getcurrencyid"), XS__getcurrencyid, file); - newXS(strcpy(buf, "getexpmodifierbycharid"), XS__getexpmodifierbycharid, file); - newXS(strcpy(buf, "get_expedition"), XS__get_expedition, file); - newXS(strcpy(buf, "get_expedition_by_char_id"), XS__get_expedition_by_char_id, file); - newXS(strcpy(buf, "get_expedition_by_dz_id"), XS__get_expedition_by_dz_id, file); - newXS(strcpy(buf, "get_expedition_by_zone_instance"), XS__get_expedition_by_zone_instance, file); - newXS(strcpy(buf, "get_expedition_lockout_by_char_id"), XS__get_expedition_lockout_by_char_id, file); - newXS(strcpy(buf, "get_expedition_lockouts_by_char_id"), XS__get_expedition_lockouts_by_char_id, file); - newXS(strcpy(buf, "getfactionname"), XS__getfactionname, file); - newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file); - newXS(strcpy(buf, "getitemname"), XS__getitemname, file); - newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file); - newXS(strcpy(buf, "getitemstat"), XS__getitemstat, file); - newXS(strcpy(buf, "getlanguagename"), XS__getlanguagename, file); - newXS(strcpy(buf, "getldonthemename"), XS__getldonthemename, file); - newXS(strcpy(buf, "getnpcnamebyid"), XS__getnpcnamebyid, file); - newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file); - newXS(strcpy(buf, "getcharnamebyid"), XS__getcharnamebyid, file); - newXS(strcpy(buf, "getcurrencyitemid"), XS__getcurrencyitemid, file); - newXS(strcpy(buf, "getgendername"), XS__getgendername, file); - newXS(strcpy(buf, "getdeityname"), XS__getdeityname, file); - newXS(strcpy(buf, "getenvironmentaldamagename"), XS__getenvironmentaldamagename, file); - newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file); - newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file); - newXS(strcpy(buf, "getgroupidbycharid"), XS__getgroupidbycharid, file); - newXS(strcpy(buf, "getinventoryslotname"), XS__getinventoryslotname, file); - newXS(strcpy(buf, "getraididbycharid"), XS__getraididbycharid, file); - newXS(strcpy(buf, "getracename"), XS__getracename, file); - newXS(strcpy(buf, "getremainingtimeMS"), XS__getremainingtimeMS, file); - newXS(strcpy(buf, "getspell"), XS__getspell, file); - newXS(strcpy(buf, "getspellname"), XS__getspellname, file); - newXS(strcpy(buf, "get_spell_level"), XS__get_spell_level, file); - newXS(strcpy(buf, "getspellstat"), XS__getspellstat, file); - newXS(strcpy(buf, "getskillname"), XS__getskillname, file); - newXS(strcpy(buf, "getlevel"), XS__getlevel, file); - newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file); - newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file); - newXS(strcpy(buf, "getplayercorpsecountbyzoneid"), XS__getplayercorpsecountbyzoneid, file); - newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file); - newXS(strcpy(buf, "gettaskname"), XS__gettaskname, file); - newXS(strcpy(buf, "gettimerdurationMS"), XS__gettimerdurationMS, file); - newXS(strcpy(buf, "givecash"), XS__givecash, file); - newXS(strcpy(buf, "gmmove"), XS__gmmove, file); - newXS(strcpy(buf, "gmsay"), XS__gmsay, file); - newXS(strcpy(buf, "has_zone_flag"), XS__has_zone_flag, file); - newXS(strcpy(buf, "hastimer"), XS__hastimer, file); - newXS(strcpy(buf, "incstat"), XS__incstat, file); - newXS(strcpy(buf, "isdisctome"), XS__isdisctome, file); - newXS(strcpy(buf, "isdooropen"), XS__isdooropen, file); - newXS(strcpy(buf, "isnpcspawned"), XS__isnpcspawned, file); - newXS(strcpy(buf, "istaskactive"), XS__istaskactive, file); - newXS(strcpy(buf, "istaskactivityactive"), XS__istaskactivityactive, file); - newXS(strcpy(buf, "istaskappropriate"), XS__istaskappropriate, file); - newXS(strcpy(buf, "istaskcompleted"), XS__istaskcompleted, file); - newXS(strcpy(buf, "istaskenabled"), XS__istaskenabled, file); - newXS(strcpy(buf, "itemlink"), XS__itemlink, file); - newXS(strcpy(buf, "lasttaskinset"), XS__lasttaskinset, file); - newXS(strcpy(buf, "level"), XS__level, file); - newXS(strcpy(buf, "log"), XS__log, file); - newXS(strcpy(buf, "log_combat"), XS__log_combat, file); - newXS(strcpy(buf, "me"), XS__me, file); - newXS(strcpy(buf, "message"), XS__message, file); - newXS(strcpy(buf, "modifynpcstat"), XS__ModifyNPCStat, file); - newXS(strcpy(buf, "movegrp"), XS__movegrp, file); - newXS(strcpy(buf, "movepc"), XS__movepc, file); - newXS(strcpy(buf, "moveto"), XS__moveto, file); - newXS(strcpy(buf, "nexttaskinset"), XS__nexttaskinset, file); - newXS(strcpy(buf, "npcfeature"), XS__npcfeature, file); - newXS(strcpy(buf, "npcgender"), XS__npcgender, file); - newXS(strcpy(buf, "npcrace"), XS__npcrace, file); - newXS(strcpy(buf, "npcsize"), XS__npcsize, file); - newXS(strcpy(buf, "npctexture"), XS__npctexture, file); - newXS(strcpy(buf, "pause"), XS__pause, file); - newXS(strcpy(buf, "permaclass"), XS__permaclass, file); - newXS(strcpy(buf, "permagender"), XS__permagender, file); - newXS(strcpy(buf, "permarace"), XS__permarace, file); - newXS(strcpy(buf, "playerfeature"), XS__playerfeature, file); - newXS(strcpy(buf, "playergender"), XS__playergender, file); - newXS(strcpy(buf, "playerrace"), XS__playerrace, file); - newXS(strcpy(buf, "playersize"), XS__playersize, file); - newXS(strcpy(buf, "playertexture"), XS__playertexture, file); - newXS(strcpy(buf, "popup"), XS__popup, file); - newXS(strcpy(buf, "processmobswhilezoneempty"), XS__processmobswhilezoneempty, file); - newXS(strcpy(buf, "pvp"), XS__pvp, file); - newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file); - newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file); - newXS(strcpy(buf, "rain"), XS__rain, file); - newXS(strcpy(buf, "rebind"), XS__rebind, file); - newXS(strcpy(buf, "reloadzonestaticdata"), XS__reloadzonestaticdata, file); - newXS(strcpy(buf, "remove_all_expedition_lockouts_by_char_id"), XS__remove_all_expedition_lockouts_by_char_id, file); - newXS(strcpy(buf, "remove_expedition_lockout_by_char_id"), XS__remove_expedition_lockout_by_char_id, file); - newXS(strcpy(buf, "removeitem"), XS__removeitem, file); - newXS(strcpy(buf, "removetitle"), XS__removetitle, file); - newXS(strcpy(buf, "rename"), XS__rename, file); - newXS(strcpy(buf, "repopzone"), XS__repopzone, file); - newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file); - newXS(strcpy(buf, "respawn"), XS__respawn, file); - newXS(strcpy(buf, "resume"), XS__resume, file); - newXS(strcpy(buf, "safemove"), XS__safemove, file); - newXS(strcpy(buf, "save"), XS__save, file); - newXS(strcpy(buf, "say"), XS__say, file); - newXS(strcpy(buf, "saylink"), XS__saylink, file); - newXS(strcpy(buf, "scribespells"), XS__scribespells, file); - newXS(strcpy(buf, "secondstotime"), XS__secondstotime, file); - newXS(strcpy(buf, "selfcast"), XS__selfcast, file); - newXS(strcpy(buf, "setaaexpmodifierbycharid"), XS__setaaexpmodifierbycharid, file); - newXS(strcpy(buf, "set_proximity"), XS__set_proximity, file); - newXS(strcpy(buf, "set_zone_flag"), XS__set_zone_flag, file); - newXS(strcpy(buf, "setallskill"), XS__setallskill, file); - newXS(strcpy(buf, "setanim"), XS__setanim, file); - newXS(strcpy(buf, "setexpmodifierbycharid"), XS__setexpmodifierbycharid, file); - newXS(strcpy(buf, "setglobal"), XS__setglobal, file); - newXS(strcpy(buf, "setguild"), XS__setguild, file); - newXS(strcpy(buf, "sethp"), XS__sethp, file); - newXS(strcpy(buf, "setlanguage"), XS__setlanguage, file); - newXS(strcpy(buf, "setnexthpevent"), XS__setnexthpevent, file); - newXS(strcpy(buf, "setnextinchpevent"), XS__setnextinchpevent, file); - newXS(strcpy(buf, "setskill"), XS__setskill, file); - newXS(strcpy(buf, "setsky"), XS__setsky, file); - newXS(strcpy(buf, "setstat"), XS__setstat, file); - newXS(strcpy(buf, "settarget"), XS__settarget, file); - newXS(strcpy(buf, "settime"), XS__settime, file); - newXS(strcpy(buf, "settimer"), XS__settimer, file); - newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file); - newXS(strcpy(buf, "sfollow"), XS__sfollow, file); - newXS(strcpy(buf, "shout"), XS__shout, file); - newXS(strcpy(buf, "shout2"), XS__shout2, file); - newXS(strcpy(buf, "showgrid"), XS__showgrid, file); - newXS(strcpy(buf, "signal"), XS__signal, file); - newXS(strcpy(buf, "signalwith"), XS__signalwith, file); - newXS(strcpy(buf, "snow"), XS__snow, file); - newXS(strcpy(buf, "spawn"), XS__spawn, file); - newXS(strcpy(buf, "spawn2"), XS__spawn2, file); - newXS(strcpy(buf, "spawn_condition"), XS__spawn_condition, file); - newXS(strcpy(buf, "spawn_from_spawn2"), XS__spawn_from_spawn2, file); - newXS(strcpy(buf, "start"), XS__start, file); - newXS(strcpy(buf, "stop"), XS__stop, file); - newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file); - newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file); - newXS(strcpy(buf, "summonallplayercorpses"), XS__summonallplayercorpses, file); - newXS(strcpy(buf, "summonburiedplayercorpse"), XS__summonburiedplayercorpse, file); - newXS(strcpy(buf, "summonitem"), XS__summonitem, file); - newXS(strcpy(buf, "surname"), XS__surname, file); - newXS(strcpy(buf, "targlobal"), XS__targlobal, file); - newXS(strcpy(buf, "taskexploredarea"), XS__taskexploredarea, file); - newXS(strcpy(buf, "taskselector"), XS__taskselector, file); - newXS(strcpy(buf, "task_setselector"), XS__task_setselector, file); - newXS(strcpy(buf, "tasktimeleft"), XS__tasktimeleft, file); - newXS(strcpy(buf, "toggle_spawn_event"), XS__toggle_spawn_event, file); - newXS(strcpy(buf, "toggledoorstate"), XS__toggledoorstate, file); - newXS(strcpy(buf, "tracknpc"), XS__tracknpc, file); - newXS(strcpy(buf, "traindisc"), XS__traindisc, file); - newXS(strcpy(buf, "traindiscs"), XS__traindiscs, file); - newXS(strcpy(buf, "unique_spawn"), XS__unique_spawn, file); - newXS(strcpy(buf, "unscribespells"), XS__unscribespells, file); - newXS(strcpy(buf, "untraindiscs"), XS__untraindiscs, file); - newXS(strcpy(buf, "updatespawntimer"), XS__UpdateSpawnTimer, file); - newXS(strcpy(buf, "updatetaskactivity"), XS__updatetaskactivity, file); - newXS(strcpy(buf, "UpdateZoneHeader"), XS__UpdateZoneHeader, file); - newXS(strcpy(buf, "varlink"), XS__varlink, file); - newXS(strcpy(buf, "voicetell"), XS__voicetell, file); - newXS(strcpy(buf, "we"), XS__we, file); - newXS(strcpy(buf, "wearchange"), XS__wearchange, file); - newXS(strcpy(buf, "whisper"), XS__whisper, file); - newXS(strcpy(buf, "write"), XS__write, file); - newXS(strcpy(buf, "ze"), XS__ze, file); - newXS(strcpy(buf, "zone"), XS__zone, file); - newXS(strcpy(buf, "zonegroup"), XS__zonegroup, file); - newXS(strcpy(buf, "zoneraid"), XS__zoneraid, file); + package.add("AssignGroupToInstance", &Perl__AssignGroupToInstance); + package.add("AssignRaidToInstance", &Perl__AssignRaidToInstance); + package.add("AssignToInstance", &Perl__AssignToInstance); + package.add("AssignToInstanceByCharID", &Perl__AssignToInstanceByCharID); + package.add("ChooseRandom", &Perl__ChooseRandom); + package.add("CreateInstance", &Perl__CreateInstance); + package.add("DestroyInstance", &Perl__DestroyInstance); + package.add("UpdateInstanceTimer", &Perl__UpdateInstanceTimer); + package.add("GetInstanceTimer", &Perl__GetInstanceTimer); + package.add("GetInstanceTimerByID", &Perl__GetInstanceTimerByID); + package.add("FlagInstanceByGroupLeader", &Perl__FlagInstanceByGroupLeader); + package.add("FlagInstanceByRaidLeader", &Perl__FlagInstanceByRaidLeader); + package.add("FlyMode", &Perl__FlyMode); + package.add("GetCharactersInInstance", &Perl__GetCharactersInInstance); + package.add("GetInstanceID", &Perl__GetInstanceID); + package.add("GetInstanceIDByCharID", &Perl__GetInstanceIDByCharID); + package.add("GetSpellResistType", &Perl__GetSpellResistType); + package.add("GetSpellTargetType", &Perl__GetSpellTargetType); + package.add("GetTimeSeconds", &Perl__GetTimeSeconds); + package.add("GetZoneID", &Perl__GetZoneID); + package.add("GetZoneLongName", &Perl__GetZoneLongName); + package.add("GetZoneLongNameByID", &Perl__GetZoneLongNameByID); + package.add("GetZoneShortName", &Perl__GetZoneShortName); + package.add("set_rule", &Perl__set_rule); + package.add("get_rule", &Perl__get_rule); + package.add("get_data", &Perl__get_data); + package.add("get_data_expires", &Perl__get_data_expires); + package.add("get_data_remaining", &Perl__get_data_remaining); + package.add("set_data", (void(*)(std::string, std::string))&Perl__set_data); + package.add("set_data", (void(*)(std::string, std::string, std::string))&Perl__set_data); + package.add("delete_data", &Perl__delete_data); + package.add("IsBeneficialSpell", &Perl__IsBeneficialSpell); + package.add("IsEffectInSpell", &Perl__IsEffectInSpell); + package.add("IsRunning", &Perl__IsRunning); + package.add("LearnRecipe", &Perl__LearnRecipe); + package.add("MerchantCountItem", &Perl__MerchantCountItem); + package.add("MerchantSetItem", (void(*)(uint32, uint32))&Perl__MerchantSetItem); + package.add("MerchantSetItem", (void(*)(uint32, uint32, uint32))&Perl__MerchantSetItem); + package.add("MovePCInstance", (void(*)(int, int, float, float, float))&Perl__MovePCInstance); + package.add("MovePCInstance", (void(*)(int, int, float, float, float, float))&Perl__MovePCInstance); + package.add("RemoveAllFromInstance", &Perl__RemoveAllFromInstance); + package.add("RemoveFromInstance", &Perl__RemoveFromInstance); + package.add("RemoveFromInstanceByCharID", &Perl__RemoveFromInstanceByCharID); + package.add("CheckInstanceByCharID", &Perl__CheckInstanceByCharID); + package.add("SendMail", &Perl__SendMail); + package.add("SetRunning", &Perl__SetRunning); + package.add("activespeakactivity", &Perl__activespeakactivity); + package.add("activespeaktask", &Perl__activespeaktask); + package.add("activetasksinset", &Perl__activetasksinset); + package.add("add_expedition_lockout_all_clients", (void(*)(std::string, std::string, uint32))&Perl__add_expedition_lockout_all_clients); + package.add("add_expedition_lockout_all_clients", (void(*)(std::string, std::string, uint32, std::string))&Perl__add_expedition_lockout_all_clients); + package.add("add_expedition_lockout_by_char_id", (void(*)(uint32, std::string, std::string, uint32))&Perl__add_expedition_lockout_by_char_id); + package.add("add_expedition_lockout_by_char_id", (void(*)(uint32, std::string, std::string, uint32, std::string))&Perl__add_expedition_lockout_by_char_id); + package.add("addldonloss", &Perl__addldonloss); + package.add("addldonpoints", &Perl__addldonpoints); + package.add("addldonwin", &Perl__addldonwin); + package.add("addloot", (void(*)(int))&Perl__addloot); + package.add("addloot", (void(*)(int, int))&Perl__addloot); + package.add("addloot", (void(*)(int, int, bool))&Perl__addloot); + package.add("addskill", &Perl__addskill); + package.add("assigntask", (void(*)(int))&Perl__assigntask); + package.add("assigntask", (void(*)(int, bool))&Perl__assigntask); + package.add("attack", &Perl__attack); + package.add("attacknpc", &Perl__attacknpc); + package.add("attacknpctype", &Perl__attacknpctype); + package.add("buryplayercorpse", &Perl__buryplayercorpse); + package.add("castspell", &Perl__castspell); + package.add("changedeity", &Perl__changedeity); + package.add("checknamefilter", &Perl__checknamefilter), + package.add("checktitle", &Perl__checktitle); + package.add("clear_npctype_cache", &Perl__clear_npctype_cache); + package.add("clear_proximity", &Perl__clear_proximity); + package.add("clear_zone_flag", &Perl__clear_zone_flag); + package.add("clearspawntimers", &Perl__clearspawntimers); + package.add("collectitems", &Perl__collectitems); + package.add("commify", &Perl__commify); + package.add("completedtasksinset", &Perl__completedtasksinset); + package.add("countitem", &Perl__countitem); + package.add("countspawnednpcs", &Perl__countspawnednpcs); + package.add("createdoor", (int(*)(const char*, float, float, float, float))&Perl__CreateDoor); + package.add("createdoor", (int(*)(const char*, float, float, float, float, uint8_t))&Perl__CreateDoor); + package.add("createdoor", (int(*)(const char*, float, float, float, float, uint8_t, uint16_t))&Perl__CreateDoor); + package.add("creategroundobject", (int(*)(uint32_t, float, float, float, float))&Perl__CreateGroundObject); + package.add("creategroundobject", (int(*)(uint32_t, float, float, float, float, uint32_t))&Perl__CreateGroundObject); + package.add("creategroundobjectfrommodel", (int(*)(const char*, float, float, float, float))&Perl__CreateGroundObjectFromModel); + package.add("creategroundobjectfrommodel", (int(*)(const char*, float, float, float, float, uint8_t))&Perl__CreateGroundObjectFromModel); + package.add("creategroundobjectfrommodel", (int(*)(const char*, float, float, float, float, uint8_t, uint32_t))&Perl__CreateGroundObjectFromModel); + package.add("createguild", &Perl__createguild); + package.add("createitem", (EQ::ItemInstance*(*)(uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32, uint32, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32, uint32, uint32, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32, uint32, uint32, uint32, uint32))&Perl__createitem); + package.add("createitem", (EQ::ItemInstance*(*)(uint32, int16, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Perl__createitem); + package.add("crosszoneaddldonlossbycharid", &Perl__crosszoneaddldonlossbycharid); + package.add("crosszoneaddldonlossbygroupid", &Perl__crosszoneaddldonlossbygroupid); + package.add("crosszoneaddldonlossbyraidid", &Perl__crosszoneaddldonlossbyraidid); + package.add("crosszoneaddldonlossbyguildid", &Perl__crosszoneaddldonlossbyguildid); + package.add("crosszoneaddldonlossbyexpeditionid", &Perl__crosszoneaddldonlossbyexpeditionid); + package.add("crosszoneaddldonlossbyclientname", &Perl__crosszoneaddldonlossbyclientname); + package.add("crosszoneaddldonpointsbycharid", &Perl__crosszoneaddldonpointsbycharid); + package.add("crosszoneaddldonpointsbygroupid", &Perl__crosszoneaddldonpointsbygroupid); + package.add("crosszoneaddldonpointsbyraidid", &Perl__crosszoneaddldonpointsbyraidid); + package.add("crosszoneaddldonpointsbyguildid", &Perl__crosszoneaddldonpointsbyguildid); + package.add("crosszoneaddldonpointsbyexpeditionid", &Perl__crosszoneaddldonpointsbyexpeditionid); + package.add("crosszoneaddldonpointsbyclientname", &Perl__crosszoneaddldonpointsbyclientname); + package.add("crosszoneaddldonwinbycharid", &Perl__crosszoneaddldonwinbycharid); + package.add("crosszoneaddldonwinbygroupid", &Perl__crosszoneaddldonwinbygroupid); + package.add("crosszoneaddldonwinbyraidid", &Perl__crosszoneaddldonwinbyraidid); + package.add("crosszoneaddldonwinbyguildid", &Perl__crosszoneaddldonwinbyguildid); + package.add("crosszoneaddldonwinbyexpeditionid", &Perl__crosszoneaddldonwinbyexpeditionid); + package.add("crosszoneaddldonwinbyclientname", &Perl__crosszoneaddldonwinbyclientname); + package.add("crosszoneassigntaskbycharid", (void(*)(int, uint32))&Perl__crosszoneassigntaskbycharid); + package.add("crosszoneassigntaskbycharid", (void(*)(int, uint32, bool))&Perl__crosszoneassigntaskbycharid); + package.add("crosszoneassigntaskbygroupid", (void(*)(int, uint32))&Perl__crosszoneassigntaskbygroupid); + package.add("crosszoneassigntaskbygroupid", (void(*)(int, uint32, bool))&Perl__crosszoneassigntaskbygroupid); + package.add("crosszoneassigntaskbyraidid", (void(*)(int, uint32))&Perl__crosszoneassigntaskbyraidid); + package.add("crosszoneassigntaskbyraidid", (void(*)(int, uint32, bool))&Perl__crosszoneassigntaskbyraidid); + package.add("crosszoneassigntaskbyguildid", (void(*)(int, uint32))&Perl__crosszoneassigntaskbyguildid); + package.add("crosszoneassigntaskbyguildid", (void(*)(int, uint32, bool))&Perl__crosszoneassigntaskbyguildid); + package.add("crosszoneassigntaskbyexpeditionid", (void(*)(uint32, uint32))&Perl__crosszoneassigntaskbyexpeditionid); + package.add("crosszoneassigntaskbyexpeditionid", (void(*)(uint32, uint32, bool))&Perl__crosszoneassigntaskbyexpeditionid); + package.add("crosszoneassigntaskbyclientname", (void(*)(const char*, uint32))&Perl__crosszoneassigntaskbyclientname); + package.add("crosszoneassigntaskbyclientname", (void(*)(const char*, uint32, bool))&Perl__crosszoneassigntaskbyclientname); + package.add("crosszonecastspellbycharid", &Perl__crosszonecastspellbycharid); + package.add("crosszonecastspellbygroupid", &Perl__crosszonecastspellbygroupid); + package.add("crosszonecastspellbyraidid", &Perl__crosszonecastspellbyraidid); + package.add("crosszonecastspellbyguildid", &Perl__crosszonecastspellbyguildid); + package.add("crosszonecastspellbyexpeditionid", &Perl__crosszonecastspellbyexpeditionid); + package.add("crosszonecastspellbyclientname", &Perl__crosszonecastspellbyclientname); + package.add("crosszonedialoguewindowbycharid", &Perl__crosszonedialoguewindowbycharid); + package.add("crosszonedialoguewindowbygroupid", &Perl__crosszonedialoguewindowbygroupid); + package.add("crosszonedialoguewindowbyraidid", &Perl__crosszonedialoguewindowbyraidid); + package.add("crosszonedialoguewindowbyguildid", &Perl__crosszonedialoguewindowbyguildid); + package.add("crosszonedialoguewindowbyexpeditionid", &Perl__crosszonedialoguewindowbyexpeditionid); + package.add("crosszonedialoguewindowbyclientname", &Perl__crosszonedialoguewindowbyclientname); + package.add("crosszonedisabletaskbycharid", &Perl__crosszonedisabletaskbycharid); + package.add("crosszonedisabletaskbygroupid", &Perl__crosszonedisabletaskbygroupid); + package.add("crosszonedisabletaskbyraidid", &Perl__crosszonedisabletaskbyraidid); + package.add("crosszonedisabletaskbyguildid", &Perl__crosszonedisabletaskbyguildid); + package.add("crosszonedisabletaskbyexpeditionid", &Perl__crosszonedisabletaskbyexpeditionid); + package.add("crosszonedisabletaskbyclientname", &Perl__crosszonedisabletaskbyclientname); + package.add("crosszoneenabletaskbycharid", &Perl__crosszoneenabletaskbycharid); + package.add("crosszoneenabletaskbygroupid", &Perl__crosszoneenabletaskbygroupid); + package.add("crosszoneenabletaskbyraidid", &Perl__crosszoneenabletaskbyraidid); + package.add("crosszoneenabletaskbyguildid", &Perl__crosszoneenabletaskbyguildid); + package.add("crosszoneenabletaskbyexpeditionid", &Perl__crosszoneenabletaskbyexpeditionid); + package.add("crosszoneenabletaskbyclientname", &Perl__crosszoneenabletaskbyclientname); + package.add("crosszonefailtaskbycharid", &Perl__crosszonefailtaskbycharid); + package.add("crosszonefailtaskbygroupid", &Perl__crosszonefailtaskbygroupid); + package.add("crosszonefailtaskbyraidid", &Perl__crosszonefailtaskbyraidid); + package.add("crosszonefailtaskbyguildid", &Perl__crosszonefailtaskbyguildid); + package.add("crosszonefailtaskbyexpeditionid", &Perl__crosszonefailtaskbyexpeditionid); + package.add("crosszonefailtaskbyclientname", &Perl__crosszonefailtaskbyclientname); + package.add("crosszonemarqueebycharid", &Perl__crosszonemarqueebycharid); + package.add("crosszonemarqueebygroupid", &Perl__crosszonemarqueebygroupid); + package.add("crosszonemarqueebyraidid", &Perl__crosszonemarqueebyraidid); + package.add("crosszonemarqueebyguildid", &Perl__crosszonemarqueebyguildid); + package.add("crosszonemarqueebyexpeditionid", &Perl__crosszonemarqueebyexpeditionid); + package.add("crosszonemarqueebyclientname", &Perl__crosszonemarqueebyclientname); + package.add("crosszonemessageplayerbycharid", &Perl__crosszonemessageplayerbycharid); + package.add("crosszonemessageplayerbygroupid", &Perl__crosszonemessageplayerbygroupid); + package.add("crosszonemessageplayerbyraidid", &Perl__crosszonemessageplayerbyraidid); + package.add("crosszonemessageplayerbyguildid", &Perl__crosszonemessageplayerbyguildid); + package.add("crosszonemessageplayerbyexpeditionid", &Perl__crosszonemessageplayerbyexpeditionid); + package.add("crosszonemessageplayerbyname", &Perl__crosszonemessageplayerbyname); + package.add("crosszonemoveplayerbycharid", &Perl__crosszonemoveplayerbycharid); + package.add("crosszonemoveplayerbygroupid", &Perl__crosszonemoveplayerbygroupid); + package.add("crosszonemoveplayerbyraidid", &Perl__crosszonemoveplayerbyraidid); + package.add("crosszonemoveplayerbyguildid", &Perl__crosszonemoveplayerbyguildid); + package.add("crosszonemoveplayerbyexpeditionid", &Perl__crosszonemoveplayerbyexpeditionid); + package.add("crosszonemoveplayerbyname", &Perl__crosszonemoveplayerbyname); + package.add("crosszonemoveinstancebycharid", &Perl__crosszonemoveinstancebycharid); + package.add("crosszonemoveinstancebygroupid", &Perl__crosszonemoveinstancebygroupid); + package.add("crosszonemoveinstancebyraidid", &Perl__crosszonemoveinstancebyraidid); + package.add("crosszonemoveinstancebyguildid", &Perl__crosszonemoveinstancebyguildid); + package.add("crosszonemoveinstancebyexpeditionid", &Perl__crosszonemoveinstancebyexpeditionid); + package.add("crosszonemoveinstancebyclientname", &Perl__crosszonemoveinstancebyclientname); + package.add("crosszoneremoveldonlossbycharid", &Perl__crosszoneremoveldonlossbycharid); + package.add("crosszoneremoveldonlossbygroupid", &Perl__crosszoneremoveldonlossbygroupid); + package.add("crosszoneremoveldonlossbyraidid", &Perl__crosszoneremoveldonlossbyraidid); + package.add("crosszoneremoveldonlossbyguildid", &Perl__crosszoneremoveldonlossbyguildid); + package.add("crosszoneremoveldonlossbyexpeditionid", &Perl__crosszoneremoveldonlossbyexpeditionid); + package.add("crosszoneremoveldonlossbyclientname", &Perl__crosszoneremoveldonlossbyclientname); + package.add("crosszoneremoveldonwinbycharid", &Perl__crosszoneremoveldonwinbycharid); + package.add("crosszoneremoveldonwinbygroupid", &Perl__crosszoneremoveldonwinbygroupid); + package.add("crosszoneremoveldonwinbyraidid", &Perl__crosszoneremoveldonwinbyraidid); + package.add("crosszoneremoveldonwinbyguildid", &Perl__crosszoneremoveldonwinbyguildid); + package.add("crosszoneremoveldonwinbyexpeditionid", &Perl__crosszoneremoveldonwinbyexpeditionid); + package.add("crosszoneremoveldonwinbyclientname", &Perl__crosszoneremoveldonwinbyclientname); + package.add("crosszoneremovespellbycharid", &Perl__crosszoneremovespellbycharid); + package.add("crosszoneremovespellbygroupid", &Perl__crosszoneremovespellbygroupid); + package.add("crosszoneremovespellbyraidid", &Perl__crosszoneremovespellbyraidid); + package.add("crosszoneremovespellbyguildid", &Perl__crosszoneremovespellbyguildid); + package.add("crosszoneremovespellbyexpeditionid", &Perl__crosszoneremovespellbyexpeditionid); + package.add("crosszoneremovespellbyclientname", &Perl__crosszoneremovespellbyclientname); + package.add("crosszoneremovetaskbycharid", &Perl__crosszoneremovetaskbycharid); + package.add("crosszoneremovetaskbygroupid", &Perl__crosszoneremovetaskbygroupid); + package.add("crosszoneremovetaskbyraidid", &Perl__crosszoneremovetaskbyraidid); + package.add("crosszoneremovetaskbyguildid", &Perl__crosszoneremovetaskbyguildid); + package.add("crosszoneremovetaskbyexpeditionid", &Perl__crosszoneremovetaskbyexpeditionid); + package.add("crosszoneremovetaskbyclientname", &Perl__crosszoneremovetaskbyclientname); + package.add("crosszoneresetactivitybycharid", &Perl__crosszoneresetactivitybycharid); + package.add("crosszoneresetactivitybygroupid", &Perl__crosszoneresetactivitybygroupid); + package.add("crosszoneresetactivitybyraidid", &Perl__crosszoneresetactivitybyraidid); + package.add("crosszoneresetactivitybyguildid", &Perl__crosszoneresetactivitybyguildid); + package.add("crosszoneresetactivitybyexpeditionid", &Perl__crosszoneresetactivitybyexpeditionid); + package.add("crosszoneresetactivitybyclientname", &Perl__crosszoneresetactivitybyclientname); + package.add("crosszonesetentityvariablebycharid", &Perl__crosszonesetentityvariablebycharid); + package.add("crosszonesetentityvariablebygroupid", &Perl__crosszonesetentityvariablebygroupid); + package.add("crosszonesetentityvariablebyraidid", &Perl__crosszonesetentityvariablebyraidid); + package.add("crosszonesetentityvariablebyguildid", &Perl__crosszonesetentityvariablebyguildid); + package.add("crosszonesetentityvariablebyexpeditionid", &Perl__crosszonesetentityvariablebyexpeditionid); + package.add("crosszonesetentityvariablebyclientname", &Perl__crosszonesetentityvariablebyclientname); + package.add("crosszonesetentityvariablebynpctypeid", &Perl__crosszonesetentityvariablebynpctypeid); + package.add("crosszonesignalclientbycharid", &Perl__crosszonesignalclientbycharid); + package.add("crosszonesignalclientbygroupid", &Perl__crosszonesignalclientbygroupid); + package.add("crosszonesignalclientbyraidid", &Perl__crosszonesignalclientbyraidid); + package.add("crosszonesignalclientbyguildid", &Perl__crosszonesignalclientbyguildid); + package.add("crosszonesignalclientbyexpeditionid", &Perl__crosszonesignalclientbyexpeditionid); + package.add("crosszonesignalclientbyname", &Perl__crosszonesignalclientbyname); + package.add("crosszonesignalnpcbynpctypeid", &Perl__crosszonesignalnpcbynpctypeid); + package.add("crosszoneupdateactivitybycharid", (void(*)(int, uint32, int))&Perl__crosszoneupdateactivitybycharid); + package.add("crosszoneupdateactivitybycharid", (void(*)(int, uint32, int, int))&Perl__crosszoneupdateactivitybycharid); + package.add("crosszoneupdateactivitybygroupid", (void(*)(int, uint32, int))&Perl__crosszoneupdateactivitybygroupid); + package.add("crosszoneupdateactivitybygroupid", (void(*)(int, uint32, int, int))&Perl__crosszoneupdateactivitybygroupid); + package.add("crosszoneupdateactivitybyraidid", (void(*)(int, uint32, int))&Perl__crosszoneupdateactivitybyraidid); + package.add("crosszoneupdateactivitybyraidid", (void(*)(int, uint32, int, int))&Perl__crosszoneupdateactivitybyraidid); + package.add("crosszoneupdateactivitybyguildid", (void(*)(int, uint32, int))&Perl__crosszoneupdateactivitybyguildid); + package.add("crosszoneupdateactivitybyguildid", (void(*)(int, uint32, int, int))&Perl__crosszoneupdateactivitybyguildid); + package.add("crosszoneupdateactivitybyexpeditionid", (void(*)(uint32, uint32, int))&Perl__crosszoneupdateactivitybyexpeditionid); + package.add("crosszoneupdateactivitybyexpeditionid", (void(*)(uint32, uint32, int, int))&Perl__crosszoneupdateactivitybyexpeditionid); + package.add("crosszoneupdateactivitybyclientname", (void(*)(const char*, uint32, int))&Perl__crosszoneupdateactivitybyclientname); + package.add("crosszoneupdateactivitybyclientname", (void(*)(const char*, uint32, int, int))&Perl__crosszoneupdateactivitybyclientname); + package.add("worldwideaddldonloss", (void(*)(uint32))&Perl__worldwideaddldonloss); + package.add("worldwideaddldonloss", (void(*)(uint32, uint8))&Perl__worldwideaddldonloss); + package.add("worldwideaddldonloss", (void(*)(uint32, uint8, uint8))&Perl__worldwideaddldonloss); + package.add("worldwideaddldonpoints", (void(*)(uint32))&Perl__worldwideaddldonpoints); + package.add("worldwideaddldonpoints", (void(*)(uint32, int))&Perl__worldwideaddldonpoints); + package.add("worldwideaddldonpoints", (void(*)(uint32, int, uint8))&Perl__worldwideaddldonpoints); + package.add("worldwideaddldonpoints", (void(*)(uint32, int, uint8, uint8))&Perl__worldwideaddldonpoints); + package.add("worldwideaddldonwin", (void(*)(uint32))&Perl__worldwideaddldonwin); + package.add("worldwideaddldonwin", (void(*)(uint32, uint8))&Perl__worldwideaddldonwin); + package.add("worldwideaddldonwin", (void(*)(uint32, uint8, uint8))&Perl__worldwideaddldonwin); + package.add("worldwideassigntask", (void(*)(uint32))&Perl__worldwideassigntask); + package.add("worldwideassigntask", (void(*)(uint32, bool))&Perl__worldwideassigntask); + package.add("worldwideassigntask", (void(*)(uint32, bool, uint8))&Perl__worldwideassigntask); + package.add("worldwideassigntask", (void(*)(uint32, bool, uint8, uint8))&Perl__worldwideassigntask); + package.add("worldwidecastspell", (void(*)(uint32))&Perl__worldwidecastspell); + package.add("worldwidecastspell", (void(*)(uint32, uint8))&Perl__worldwidecastspell); + package.add("worldwidecastspell", (void(*)(uint32, uint8, uint8 max_status))&Perl__worldwidecastspell); + package.add("worldwidedialoguewindow", (void(*)(const char*))&Perl__worldwidedialoguewindow); + package.add("worldwidedialoguewindow", (void(*)(const char*, uint8))&Perl__worldwidedialoguewindow); + package.add("worldwidedialoguewindow", (void(*)(const char*, uint8, uint8))&Perl__worldwidedialoguewindow); + package.add("worldwidedisabletask", (void(*)(uint32))&Perl__worldwidedisabletask); + package.add("worldwidedisabletask", (void(*)(uint32, uint8))&Perl__worldwidedisabletask); + package.add("worldwidedisabletask", (void(*)(uint32, uint8, uint8))&Perl__worldwidedisabletask); + package.add("worldwideenabletask", (void(*)(uint32))&Perl__worldwideenabletask); + package.add("worldwideenabletask", (void(*)(uint32, uint8))&Perl__worldwideenabletask); + package.add("worldwideenabletask", (void(*)(uint32, uint8, uint8))&Perl__worldwideenabletask); + package.add("worldwidefailtask", (void(*)(uint32))&Perl__worldwidefailtask); + package.add("worldwidefailtask", (void(*)(uint32, uint8))&Perl__worldwidefailtask); + package.add("worldwidefailtask", (void(*)(uint32, uint8, uint8))&Perl__worldwidefailtask); + package.add("worldwidemarquee", (void(*)(uint32, uint32, uint32, uint32, uint32, const char*))&Perl__worldwidemarquee); + package.add("worldwidemarquee", (void(*)(uint32, uint32, uint32, uint32, uint32, const char*, uint8))&Perl__worldwidemarquee); + package.add("worldwidemarquee", (void(*)(uint32, uint32, uint32, uint32, uint32, const char*, uint8, uint8))&Perl__worldwidemarquee); + package.add("worldwidemessage", (void(*)(uint32, const char*))&Perl__worldwidemessage); + package.add("worldwidemessage", (void(*)(uint32, const char*, uint8))&Perl__worldwidemessage); + package.add("worldwidemessage", (void(*)(uint32, const char*, uint8, uint8))&Perl__worldwidemessage); + package.add("worldwidemove", (void(*)(const char*))&Perl__worldwidemove); + package.add("worldwidemove", (void(*)(const char*, uint8))&Perl__worldwidemove); + package.add("worldwidemove", (void(*)(const char*, uint8, uint8))&Perl__worldwidemove); + package.add("worldwidemoveinstance", (void(*)(uint16))&Perl__worldwidemoveinstance); + package.add("worldwidemoveinstance", (void(*)(uint16, uint8))&Perl__worldwidemoveinstance); + package.add("worldwidemoveinstance", (void(*)(uint16, uint8, uint8))&Perl__worldwidemoveinstance); + package.add("worldwideremoveldonloss", (void(*)(uint32))&Perl__worldwideremoveldonloss); + package.add("worldwideremoveldonloss", (void(*)(uint32, uint8))&Perl__worldwideremoveldonloss); + package.add("worldwideremoveldonloss", (void(*)(uint32, uint8, uint8))&Perl__worldwideremoveldonloss); + package.add("worldwideremoveldonwin", (void(*)(uint32))&Perl__worldwideremoveldonwin); + package.add("worldwideremoveldonwin", (void(*)(uint32, uint8))&Perl__worldwideremoveldonwin); + package.add("worldwideremoveldonwin", (void(*)(uint32, uint8, uint8))&Perl__worldwideremoveldonwin); + package.add("worldwideremovespell", (void(*)(uint32))&Perl__worldwideremovespell); + package.add("worldwideremovespell", (void(*)(uint32, uint8))&Perl__worldwideremovespell); + package.add("worldwideremovespell", (void(*)(uint32, uint8, uint8))&Perl__worldwideremovespell); + package.add("worldwideremovetask", (void(*)(uint32))&Perl__worldwideremovetask); + package.add("worldwideremovetask", (void(*)(uint32, uint8, uint8))&Perl__worldwideremovetask); + package.add("worldwideremovetask", (void(*)(uint32, uint8, uint8))&Perl__worldwideremovetask); + package.add("worldwideresetactivity", (void(*)(uint32, int))&Perl__worldwideresetactivity); + package.add("worldwideresetactivity", (void(*)(uint32, int, uint8))&Perl__worldwideresetactivity); + package.add("worldwideresetactivity", (void(*)(uint32, int, uint8, uint8))&Perl__worldwideresetactivity); + package.add("worldwidesetentityvariableclient", (void(*)(const char*, const char*))&Perl__worldwidesetentityvariableclient); + package.add("worldwidesetentityvariableclient", (void(*)(const char*, const char*, uint8))&Perl__worldwidesetentityvariableclient); + package.add("worldwidesetentityvariableclient", (void(*)(const char*, const char*, uint8, uint8))&Perl__worldwidesetentityvariableclient); + package.add("worldwidesetentityvariablenpc", &Perl__worldwidesetentityvariablenpc); + package.add("worldwidesignalclient", (void(*)(uint32))&Perl__worldwidesignalclient); + package.add("worldwidesignalclient", (void(*)(uint32, uint8))&Perl__worldwidesignalclient); + package.add("worldwidesignalclient", (void(*)(uint32, uint8, uint8))&Perl__worldwidesignalclient); + package.add("worldwidesignalnpc", &Perl__worldwidesignalnpc); + package.add("worldwideupdateactivity", (void(*)(uint32, int))&Perl__worldwideupdateactivity); + package.add("worldwideupdateactivity", (void(*)(uint32, int, int))&Perl__worldwideupdateactivity); + package.add("worldwideupdateactivity", (void(*)(uint32, int, int, uint8))&Perl__worldwideupdateactivity); + package.add("worldwideupdateactivity", (void(*)(uint32, int, int, uint8, uint8))&Perl__worldwideupdateactivity); + package.add("debug", (void(*)(const char*))&Perl__debug); + package.add("debug", (void(*)(const char*, int))&Perl__debug); + package.add("delglobal", &Perl__delglobal); + package.add("depop", (void(*)())&Perl__depop); + package.add("depop", (void(*)(int))&Perl__depop); + package.add("depop_withtimer", (void(*)())&Perl__depop_withtimer); + package.add("depop_withtimer", (void(*)(int))&Perl__depop_withtimer); + package.add("depopall", (void(*)())&Perl__depopall); + package.add("depopall", (void(*)(int))&Perl__depopall); + package.add("depopzone", &Perl__depopzone); + package.add("ding", &Perl__ding); + package.add("disable_proximity_say", &Perl__disable_proximity_say); + package.add("disable_spawn2", &Perl__disable_spawn2); + package.add("disablerecipe", &Perl__disablerecipe); + package.add("disabletask", &Perl__disabletask); + package.add("discordsend", &Perl__discordsend); + package.add("doanim", &Perl__doanim); + package.add("echo", &Perl__echo); + package.add("emote", &Perl__emote); + package.add("enable_proximity_say", &Perl__enable_proximity_say); + package.add("enable_spawn2", &Perl__enable_spawn2); + package.add("enabledtaskcount", &Perl__enabledtaskcount); + package.add("enablerecipe", &Perl__enablerecipe); + package.add("enabletask", &Perl__enabletask); + package.add("enabletitle", &Perl__enabletitle); + package.add("exp", &Perl__exp); + package.add("faction", (void(*)(int, int))&Perl__faction); + package.add("faction", (void(*)(int, int, int))&Perl__faction); + package.add("factionvalue", &Perl__FactionValue); + package.add("failtask", &Perl__failtask); + package.add("firsttaskinset", &Perl__firsttaskinset); + package.add("follow", (void(*)(int))&Perl__follow); + package.add("follow", (void(*)(int, int))&Perl__follow); + package.add("forcedoorclose", (void(*)(uint32))&Perl__forcedoorclose); + package.add("forcedoorclose", (void(*)(uint32, bool))&Perl__forcedoorclose); + package.add("forcedooropen", (void(*)(uint32))&Perl__forcedooropen); + package.add("forcedooropen", (void(*)(uint32, bool))&Perl__forcedooropen); + package.add("getaaexpmodifierbycharid", &Perl__getaaexpmodifierbycharid); + package.add("getbodytypename", &Perl__getbodytypename); + package.add("getcharidbyname", &Perl__getcharidbyname); + package.add("getclassname", (std::string(*)(uint8))&Perl__getclassname); + package.add("getclassname", (std::string(*)(uint8, uint8))&Perl__getclassname); + package.add("getcleannpcnamebyid", &Perl__getcleannpcnamebyid); + package.add("getconsiderlevelname", &Perl__getconsiderlevelname); + package.add("gethexcolorcode", &Perl__gethexcolorcode); + package.add("getcurrencyid", &Perl__getcurrencyid); + package.add("getexpmodifierbycharid", &Perl__getexpmodifierbycharid); + package.add("get_expedition", &Perl__get_expedition); + package.add("get_expedition_by_char_id", &Perl__get_expedition_by_char_id); + package.add("get_expedition_by_dz_id", &Perl__get_expedition_by_dz_id); + package.add("get_expedition_by_zone_instance", &Perl__get_expedition_by_zone_instance); + package.add("get_expedition_lockout_by_char_id", &Perl__get_expedition_lockout_by_char_id); + package.add("get_expedition_lockouts_by_char_id", (perl::reference(*)(uint32))&Perl__get_expedition_lockouts_by_char_id); + package.add("get_expedition_lockouts_by_char_id", (perl::reference(*)(uint32, std::string))&Perl__get_expedition_lockouts_by_char_id); + package.add("getfactionname", &Perl__getfactionname); + package.add("getinventoryslotid", &Perl__getinventoryslotid); + package.add("getitemname", &Perl__getitemname); + package.add("getItemName", &Perl__qc_getItemName); + package.add("getitemstat", &Perl__getitemstat); + package.add("getlanguagename", &Perl__getlanguagename); + package.add("getldonthemename", &Perl__getldonthemename); + package.add("getnpcnamebyid", &Perl__getnpcnamebyid); + package.add("get_spawn_condition", (int(*)(const char*, uint16))&Perl__get_spawn_condition); + package.add("get_spawn_condition", (int(*)(const char*, uint32, uint16))&Perl__get_spawn_condition); + package.add("getcharnamebyid", &Perl__getcharnamebyid); + package.add("getcurrencyitemid", &Perl__getcurrencyitemid); + package.add("getgendername", &Perl__getgendername); + package.add("getdeityname", &Perl__getdeityname); + package.add("getenvironmentaldamagename", &Perl__getenvironmentaldamagename); + package.add("getguildnamebyid", &Perl__getguildnamebyid); + package.add("getguildidbycharid", &Perl__getguildidbycharid); + package.add("getgroupidbycharid", &Perl__getgroupidbycharid); + package.add("getinventoryslotname", &Perl__getinventoryslotname); + package.add("getraididbycharid", &Perl__getraididbycharid); + package.add("getracename", &Perl__getracename); + package.add("getremainingtimeMS", &Perl__getremainingtimeMS); + package.add("getspell", &Perl__getspell); + package.add("getspellname", &Perl__getspellname); + package.add("get_spell_level", &Perl__get_spell_level); + package.add("getspellstat", (int(*)(uint32, std::string))&Perl__getspellstat); + package.add("getspellstat", (int(*)(uint32, std::string, uint8))&Perl__getspellstat); + package.add("getskillname", &Perl__getskillname); + package.add("getlevel", &Perl__getlevel); + package.add("getplayerburiedcorpsecount", &Perl__getplayerburiedcorpsecount); + package.add("getplayercorpsecount", &Perl__getplayercorpsecount); + package.add("getplayercorpsecountbyzoneid", &Perl__getplayercorpsecountbyzoneid); + package.add("gettaskactivitydonecount", &Perl__gettaskactivitydonecount); + package.add("gettaskname", &Perl__gettaskname); + package.add("gettimerdurationMS", &Perl__gettimerdurationMS); + package.add("givecash", (void(*)(uint32))&Perl__givecash); + package.add("givecash", (void(*)(uint32, uint32))&Perl__givecash); + package.add("givecash", (void(*)(uint32, uint32, uint32))&Perl__givecash); + package.add("givecash", (void(*)(uint32, uint32, uint32, uint32))&Perl__givecash); + package.add("gmmove", &Perl__gmmove); + package.add("gmsay", (void(*)(const char*))&Perl__gmsay); + package.add("gmsay", (void(*)(const char*, int))&Perl__gmsay); + package.add("gmsay", (void(*)(const char*, int, bool))&Perl__gmsay); + package.add("gmsay", (void(*)(const char*, int, bool, int))&Perl__gmsay); + package.add("gmsay", (void(*)(const char*, int, bool, int, int))&Perl__gmsay); + package.add("has_zone_flag", &Perl__has_zone_flag); + package.add("hastimer", &Perl__hastimer); + package.add("incstat", &Perl__incstat); + package.add("isdisctome", &Perl__isdisctome); + package.add("isdooropen", &Perl__isdooropen); + package.add("isnpcspawned", &Perl__isnpcspawned); + package.add("istaskactive", &Perl__istaskactive); + package.add("istaskactivityactive", &Perl__istaskactivityactive); + package.add("istaskappropriate", &Perl__istaskappropriate); + package.add("istaskcompleted", &Perl__istaskcompleted); + package.add("istaskenabled", &Perl__istaskenabled); + package.add("itemlink", &Perl__itemlink); + package.add("lasttaskinset", &Perl__lasttaskinset); + package.add("level", &Perl__level); + package.add("log", &Perl__log); + package.add("log_combat", &Perl__log_combat); + package.add("me", &Perl__me); + package.add("message", &Perl__message); + package.add("modifynpcstat", &Perl__ModifyNPCStat); + package.add("movegrp", &Perl__movegrp); + package.add("movepc",(void(*)(int, float, float, float))&Perl__movepc); + package.add("movepc",(void(*)(int, float, float, float, float))&Perl__movepc); + package.add("moveto", (void(*)(float, float, float))&Perl__moveto); + package.add("moveto", (void(*)(float, float, float, float))&Perl__moveto); + package.add("moveto", (void(*)(float, float, float, float, bool))&Perl__moveto); + package.add("nexttaskinset", &Perl__nexttaskinset); + package.add("npcfeature", &Perl__npcfeature); + package.add("npcgender", &Perl__npcgender); + package.add("npcrace", &Perl__npcrace); + package.add("npcsize", &Perl__npcsize); + package.add("npctexture", &Perl__npctexture); + package.add("pause", &Perl__pause); + package.add("permaclass", &Perl__permaclass); + package.add("permagender", &Perl__permagender); + package.add("permarace", &Perl__permarace); + package.add("playerfeature", &Perl__playerfeature); + package.add("playergender", &Perl__playergender); + package.add("playerrace", &Perl__playerrace); + package.add("playersize", &Perl__playersize); + package.add("playertexture", &Perl__playertexture); + package.add("popup", (void(*)(const char*, const char*))&Perl__popup); + package.add("popup", (void(*)(const char*, const char*, int))&Perl__popup); + package.add("popup", (void(*)(const char*, const char*, int, int))&Perl__popup); + package.add("popup", (void(*)(const char*, const char*, int, int, int))&Perl__popup); + package.add("processmobswhilezoneempty", &Perl__processmobswhilezoneempty); + package.add("pvp", &Perl__pvp); + package.add("qs_player_event", &Perl__qs_player_event); + package.add("qs_send_query", &Perl__qs_send_query); + package.add("rain", &Perl__rain); + package.add("rebind", (void(*)(int, float, float, float))&Perl__rebind); + package.add("rebind", (void(*)(int, float, float, float, float))&Perl__rebind); + package.add("reloadzonestaticdata", &Perl__reloadzonestaticdata); + package.add("remove_all_expedition_lockouts_by_char_id", (void(*)(uint32))&Perl__remove_all_expedition_lockouts_by_char_id); + package.add("remove_all_expedition_lockouts_by_char_id", (void(*)(uint32, std::string))&Perl__remove_all_expedition_lockouts_by_char_id); + package.add("remove_expedition_lockout_by_char_id", &Perl__remove_expedition_lockout_by_char_id); + package.add("removeitem", (void(*)(uint32_t))&Perl__removeitem); + package.add("removeitem", (void(*)(uint32_t, int))&Perl__removeitem); + package.add("removetitle", &Perl__removetitle); + package.add("rename", &Perl__rename); + package.add("repopzone", &Perl__repopzone); + package.add("resettaskactivity", &Perl__resettaskactivity); + package.add("respawn", &Perl__respawn); + package.add("resume", &Perl__resume); + package.add("safemove", &Perl__safemove); + package.add("save", &Perl__save); + package.add("say", (void(*)(const char*))&Perl__say); + package.add("say", (void(*)(const char*, int))&Perl__say); + package.add("say", (void(*)(const char*, int, int))&Perl__say); + package.add("say", (void(*)(const char*, int, int, int))&Perl__say); + package.add("say", (void(*)(const char*, int, int, int, int))&Perl__say); + package.add("saylink", (std::string(*)(const char*))&Perl__saylink); + package.add("saylink", (std::string(*)(const char*, bool))&Perl__saylink); + package.add("saylink", (std::string(*)(const char*, bool, const char*))&Perl__saylink); + package.add("scribespells", (int(*)(int))&Perl__scribespells); + package.add("scribespells", (int(*)(int, int))&Perl__scribespells); + package.add("secondstotime", &Perl__secondstotime); + package.add("selfcast", &Perl__selfcast); + package.add("setaaexpmodifierbycharid", &Perl__setaaexpmodifierbycharid); + package.add("set_proximity", (void(*)(float, float, float, float))&Perl__set_proximity); + package.add("set_proximity", (void(*)(float, float, float, float, float, float))&Perl__set_proximity); + package.add("set_proximity", (void(*)(float, float, float, float, float, float, bool))&Perl__set_proximity); + package.add("set_zone_flag", &Perl__set_zone_flag); + package.add("setallskill", &Perl__setallskill); + package.add("setanim", &Perl__setanim); + package.add("setexpmodifierbycharid", &Perl__setexpmodifierbycharid); + package.add("setglobal", &Perl__setglobal); + package.add("setguild", &Perl__setguild); + package.add("sethp", &Perl__sethp); + package.add("setlanguage", &Perl__setlanguage); + package.add("setnexthpevent", &Perl__setnexthpevent); + package.add("setnextinchpevent", &Perl__setnextinchpevent); + package.add("setskill", &Perl__setskill); + package.add("setsky", &Perl__setsky); + package.add("setstat", &Perl__setstat); + package.add("settarget", &Perl__settarget); + package.add("settime", (void(*)(int, int))&Perl__settime); + package.add("settime", (void(*)(int, int, bool))&Perl__settime); + package.add("settimer", &Perl__settimer); + package.add("settimerMS", &Perl__settimerMS); + package.add("sfollow", &Perl__sfollow); + package.add("shout", &Perl__shout); + package.add("shout2", &Perl__shout2); + package.add("showgrid", &Perl__showgrid); + package.add("signal", (void(*)(int))&Perl__signal); + package.add("signal", (void(*)(int, int))&Perl__signal); + package.add("signalwith", (void(*)(int, int))&Perl__signalwith); + package.add("signalwith", (void(*)(int, int, int))&Perl__signalwith); + package.add("snow", &Perl__snow); + package.add("spawn", &Perl__spawn); + package.add("spawn2", &Perl__spawn2); + package.add("spawn_condition", (void(*)(const char*, uint16, int16))&Perl__spawn_condition); + package.add("spawn_condition", (void(*)(const char*, uint32_t, uint16, int16))&Perl__spawn_condition); + package.add("spawn_from_spawn2", &Perl__spawn_from_spawn2); + package.add("start", &Perl__start); + package.add("stop", &Perl__stop); + package.add("stopalltimers", &Perl__stopalltimers); + package.add("stoptimer", &Perl__stoptimer); + package.add("summonallplayercorpses", &Perl__summonallplayercorpses); + package.add("summonburiedplayercorpse", &Perl__summonburiedplayercorpse); + package.add("summonitem", (void(*)(int))&Perl__summonitem); + package.add("summonitem", (void(*)(int, int))&Perl__summonitem); + package.add("surname", &Perl__surname); + package.add("targlobal", &Perl__targlobal); + package.add("taskexploredarea", &Perl__taskexploredarea); + package.add("taskselector", &Perl__taskselector); + package.add("task_setselector", &Perl__task_setselector); + package.add("tasktimeleft", &Perl__tasktimeleft); + package.add("toggle_spawn_event", &Perl__toggle_spawn_event); + package.add("toggledoorstate", &Perl__toggledoorstate); + package.add("tracknpc", &Perl__tracknpc); + package.add("traindisc", &Perl__traindisc); + package.add("traindiscs", (int(*)(int))&Perl__traindiscs); + package.add("traindiscs", (int(*)(int, int))&Perl__traindiscs); + package.add("unique_spawn", (int(*)(int, int, int, float, float, float))&Perl__unique_spawn); + package.add("unique_spawn", (int(*)(int, int, int, float, float, float, float))&Perl__unique_spawn); + package.add("unscribespells", &Perl__unscribespells); + package.add("untraindiscs", &Perl__untraindiscs); + package.add("updatespawntimer", &Perl__UpdateSpawnTimer); + package.add("updatetaskactivity", (void(*)(int, int))&Perl__updatetaskactivity); + package.add("updatetaskactivity", (void(*)(int, int, int))&Perl__updatetaskactivity); + package.add("updatetaskactivity", (void(*)(int, int, int, bool))&Perl__updatetaskactivity); + package.add("UpdateZoneHeader", &Perl__UpdateZoneHeader); + package.add("varlink", &Perl__varlink); + package.add("voicetell", &Perl__voicetell); + package.add("we", &Perl__we); + package.add("wearchange", (void(*)(uint8, uint16))&Perl__wearchange); + package.add("wearchange", (void(*)(uint8, uint16, uint32))&Perl__wearchange); + package.add("wearchange", (void(*)(uint8, uint16, uint32, uint32))&Perl__wearchange); + package.add("whisper", &Perl__whisper); + package.add("write", &Perl__write); + package.add("ze", &Perl__ze); + package.add("zone", &Perl__zone); + package.add("zonegroup", &Perl__zonegroup); + package.add("zoneraid", &Perl__zoneraid); /** * Expansions */ - newXS(strcpy(buf, "is_classic_enabled"), XS__IsClassicEnabled, file); - newXS(strcpy(buf, "is_the_ruins_of_kunark_enabled"), XS__IsTheRuinsOfKunarkEnabled, file); - newXS(strcpy(buf, "is_the_scars_of_velious_enabled"), XS__IsTheScarsOfVeliousEnabled, file); - newXS(strcpy(buf, "is_the_shadows_of_luclin_enabled"), XS__IsTheShadowsOfLuclinEnabled, file); - newXS(strcpy(buf, "is_the_planes_of_power_enabled"), XS__IsThePlanesOfPowerEnabled, file); - newXS(strcpy(buf, "is_the_legacy_of_ykesha_enabled"), XS__IsTheLegacyOfYkeshaEnabled, file); - newXS(strcpy(buf, "is_lost_dungeons_of_norrath_enabled"), XS__IsLostDungeonsOfNorrathEnabled, file); - newXS(strcpy(buf, "is_gates_of_discord_enabled"), XS__IsGatesOfDiscordEnabled, file); - newXS(strcpy(buf, "is_omens_of_war_enabled"), XS__IsOmensOfWarEnabled, file); - newXS(strcpy(buf, "is_dragons_of_norrath_enabled"), XS__IsDragonsOfNorrathEnabled, file); - newXS(strcpy(buf, "is_depths_of_darkhollow_enabled"), XS__IsDepthsOfDarkhollowEnabled, file); - newXS(strcpy(buf, "is_prophecy_of_ro_enabled"), XS__IsProphecyOfRoEnabled, file); - newXS(strcpy(buf, "is_the_serpents_spine_enabled"), XS__IsTheSerpentsSpineEnabled, file); - newXS(strcpy(buf, "is_the_buried_sea_enabled"), XS__IsTheBuriedSeaEnabled, file); - newXS(strcpy(buf, "is_secrets_of_faydwer_enabled"), XS__IsSecretsOfFaydwerEnabled, file); - newXS(strcpy(buf, "is_seeds_of_destruction_enabled"), XS__IsSeedsOfDestructionEnabled, file); - newXS(strcpy(buf, "is_underfoot_enabled"), XS__IsUnderfootEnabled, file); - newXS(strcpy(buf, "is_house_of_thule_enabled"), XS__IsHouseOfThuleEnabled, file); - newXS(strcpy(buf, "is_veil_of_alaris_enabled"), XS__IsVeilOfAlarisEnabled, file); - newXS(strcpy(buf, "is_rain_of_fear_enabled"), XS__IsRainOfFearEnabled, file); - newXS(strcpy(buf, "is_call_of_the_forsaken_enabled"), XS__IsCallOfTheForsakenEnabled, file); - newXS(strcpy(buf, "is_the_darkened_sea_enabled"), XS__IsTheDarkenedSeaEnabled, file); - newXS(strcpy(buf, "is_the_broken_mirror_enabled"), XS__IsTheBrokenMirrorEnabled, file); - newXS(strcpy(buf, "is_empires_of_kunark_enabled"), XS__IsEmpiresOfKunarkEnabled, file); - newXS(strcpy(buf, "is_ring_of_scale_enabled"), XS__IsRingOfScaleEnabled, file); - newXS(strcpy(buf, "is_the_burning_lands_enabled"), XS__IsTheBurningLandsEnabled, file); - newXS(strcpy(buf, "is_torment_of_velious_enabled"), XS__IsTormentOfVeliousEnabled, file); - newXS(strcpy(buf, "is_current_expansion_classic"), XS__IsCurrentExpansionClassic, file); - newXS(strcpy(buf, "is_current_expansion_the_ruins_of_kunark"), XS__IsCurrentExpansionTheRuinsOfKunark, file); - newXS(strcpy(buf, "is_current_expansion_the_scars_of_velious"), XS__IsCurrentExpansionTheScarsOfVelious, file); - newXS(strcpy(buf, "is_current_expansion_the_shadows_of_luclin"), XS__IsCurrentExpansionTheShadowsOfLuclin, file); - newXS(strcpy(buf, "is_current_expansion_the_planes_of_power"), XS__IsCurrentExpansionThePlanesOfPower, file); - newXS(strcpy(buf, "is_current_expansion_the_legacy_of_ykesha"), XS__IsCurrentExpansionTheLegacyOfYkesha, file); - newXS(strcpy(buf, "is_current_expansion_lost_dungeons_of_norrath"), XS__IsCurrentExpansionLostDungeonsOfNorrath, file); - newXS(strcpy(buf, "is_current_expansion_gates_of_discord"), XS__IsCurrentExpansionGatesOfDiscord, file); - newXS(strcpy(buf, "is_current_expansion_omens_of_war"), XS__IsCurrentExpansionOmensOfWar, file); - newXS(strcpy(buf, "is_current_expansion_dragons_of_norrath"), XS__IsCurrentExpansionDragonsOfNorrath, file); - newXS(strcpy(buf, "is_current_expansion_depths_of_darkhollow"), XS__IsCurrentExpansionDepthsOfDarkhollow, file); - newXS(strcpy(buf, "is_current_expansion_prophecy_of_ro"), XS__IsCurrentExpansionProphecyOfRo, file); - newXS(strcpy(buf, "is_current_expansion_the_serpents_spine"), XS__IsCurrentExpansionTheSerpentsSpine, file); - newXS(strcpy(buf, "is_current_expansion_the_buried_sea"), XS__IsCurrentExpansionTheBuriedSea, file); - newXS(strcpy(buf, "is_current_expansion_secrets_of_faydwer"), XS__IsCurrentExpansionSecretsOfFaydwer, file); - newXS(strcpy(buf, "is_current_expansion_seeds_of_destruction"), XS__IsCurrentExpansionSeedsOfDestruction, file); - newXS(strcpy(buf, "is_current_expansion_underfoot"), XS__IsCurrentExpansionUnderfoot, file); - newXS(strcpy(buf, "is_current_expansion_house_of_thule"), XS__IsCurrentExpansionHouseOfThule, file); - newXS(strcpy(buf, "is_current_expansion_veil_of_alaris"), XS__IsCurrentExpansionVeilOfAlaris, file); - newXS(strcpy(buf, "is_current_expansion_rain_of_fear"), XS__IsCurrentExpansionRainOfFear, file); - newXS(strcpy(buf, "is_current_expansion_call_of_the_forsaken"), XS__IsCurrentExpansionCallOfTheForsaken, file); - newXS(strcpy(buf, "is_current_expansion_the_darkened_sea"), XS__IsCurrentExpansionTheDarkenedSea, file); - newXS(strcpy(buf, "is_current_expansion_the_broken_mirror"), XS__IsCurrentExpansionTheBrokenMirror, file); - newXS(strcpy(buf, "is_current_expansion_empires_of_kunark"), XS__IsCurrentExpansionEmpiresOfKunark, file); - newXS(strcpy(buf, "is_current_expansion_ring_of_scale"), XS__IsCurrentExpansionRingOfScale, file); - newXS(strcpy(buf, "is_current_expansion_the_burning_lands"), XS__IsCurrentExpansionTheBurningLands, file); - newXS(strcpy(buf, "is_current_expansion_torment_of_velious"), XS__IsCurrentExpansionTormentOfVelious, file); + package.add("is_classic_enabled", &Perl__IsClassicEnabled); + package.add("is_the_ruins_of_kunark_enabled", &Perl__IsTheRuinsOfKunarkEnabled); + package.add("is_the_scars_of_velious_enabled", &Perl__IsTheScarsOfVeliousEnabled); + package.add("is_the_shadows_of_luclin_enabled", &Perl__IsTheShadowsOfLuclinEnabled); + package.add("is_the_planes_of_power_enabled", &Perl__IsThePlanesOfPowerEnabled); + package.add("is_the_legacy_of_ykesha_enabled", &Perl__IsTheLegacyOfYkeshaEnabled); + package.add("is_lost_dungeons_of_norrath_enabled", &Perl__IsLostDungeonsOfNorrathEnabled); + package.add("is_gates_of_discord_enabled", &Perl__IsGatesOfDiscordEnabled); + package.add("is_omens_of_war_enabled", &Perl__IsOmensOfWarEnabled); + package.add("is_dragons_of_norrath_enabled", &Perl__IsDragonsOfNorrathEnabled); + package.add("is_depths_of_darkhollow_enabled", &Perl__IsDepthsOfDarkhollowEnabled); + package.add("is_prophecy_of_ro_enabled", &Perl__IsProphecyOfRoEnabled); + package.add("is_the_serpents_spine_enabled", &Perl__IsTheSerpentsSpineEnabled); + package.add("is_the_buried_sea_enabled", &Perl__IsTheBuriedSeaEnabled); + package.add("is_secrets_of_faydwer_enabled", &Perl__IsSecretsOfFaydwerEnabled); + package.add("is_seeds_of_destruction_enabled", &Perl__IsSeedsOfDestructionEnabled); + package.add("is_underfoot_enabled", &Perl__IsUnderfootEnabled); + package.add("is_house_of_thule_enabled", &Perl__IsHouseOfThuleEnabled); + package.add("is_veil_of_alaris_enabled", &Perl__IsVeilOfAlarisEnabled); + package.add("is_rain_of_fear_enabled", &Perl__IsRainOfFearEnabled); + package.add("is_call_of_the_forsaken_enabled", &Perl__IsCallOfTheForsakenEnabled); + package.add("is_the_darkend_sea_enabled", &Perl__IsTheDarkenedSeaEnabled); + package.add("is_the_broken_mirror_enabled", &Perl__IsTheBrokenMirrorEnabled); + package.add("is_empires_of_kunark_enabled", &Perl__IsEmpiresOfKunarkEnabled); + package.add("is_ring_of_scale_enabled", &Perl__IsRingOfScaleEnabled); + package.add("is_the_burning_lands_enabled", &Perl__IsTheBurningLandsEnabled); + package.add("is_torment_of_velious_enabled", &Perl__IsTormentOfVeliousEnabled); + package.add("is_current_expansion_classic", &Perl__IsCurrentExpansionClassic); + package.add("is_current_expansion_the_ruins_of_kunark", &Perl__IsCurrentExpansionTheRuinsOfKunark); + package.add("is_current_expansion_the_scars_of_velious", &Perl__IsCurrentExpansionTheScarsOfVelious); + package.add("is_current_expansion_the_shadows_of_luclin", &Perl__IsCurrentExpansionTheShadowsOfLuclin); + package.add("is_current_expansion_the_planes_of_power", &Perl__IsCurrentExpansionThePlanesOfPower); + package.add("is_current_expansion_the_legacy_of_ykesha", &Perl__IsCurrentExpansionTheLegacyOfYkesha); + package.add("is_current_expansion_lost_dungeons_of_norrath", &Perl__IsCurrentExpansionLostDungeonsOfNorrath); + package.add("is_current_expansion_gates_of_discord", &Perl__IsCurrentExpansionGatesOfDiscord); + package.add("is_current_expansion_omens_of_war", &Perl__IsCurrentExpansionOmensOfWar); + package.add("is_current_expansion_dragons_of_norrath", &Perl__IsCurrentExpansionDragonsOfNorrath); + package.add("is_current_expansion_depths_of_darkhollow", &Perl__IsCurrentExpansionDepthsOfDarkhollow); + package.add("is_current_expansion_prophecy_of_ro", &Perl__IsCurrentExpansionProphecyOfRo); + package.add("is_current_expansion_the_serpents_spine", &Perl__IsCurrentExpansionTheSerpentsSpine); + package.add("is_current_expansion_the_buried_sea", &Perl__IsCurrentExpansionTheBuriedSea); + package.add("is_current_expansion_secrets_of_faydwer", &Perl__IsCurrentExpansionSecretsOfFaydwer); + package.add("is_current_expansion_seeds_of_destruction", &Perl__IsCurrentExpansionSeedsOfDestruction); + package.add("is_current_expansion_underfoot", &Perl__IsCurrentExpansionUnderfoot); + package.add("is_current_expansion_house_of_thule", &Perl__IsCurrentExpansionHouseOfThule); + package.add("is_current_expansion_veil_of_alaris", &Perl__IsCurrentExpansionVeilOfAlaris); + package.add("is_current_expansion_rain_of_fear", &Perl__IsCurrentExpansionRainOfFear); + package.add("is_current_expansion_call_of_the_forsaken", &Perl__IsCurrentExpansionCallOfTheForsaken); + package.add("is_current_expansion_the_darkend_sea", &Perl__IsCurrentExpansionTheDarkenedSea); + package.add("is_current_expansion_the_broken_mirror", &Perl__IsCurrentExpansionTheBrokenMirror); + package.add("is_current_expansion_empires_of_kunark", &Perl__IsCurrentExpansionEmpiresOfKunark); + package.add("is_current_expansion_ring_of_scale", &Perl__IsCurrentExpansionRingOfScale); + package.add("is_current_expansion_the_burning_lands", &Perl__IsCurrentExpansionTheBurningLands); + package.add("is_current_expansion_torment_of_velious", &Perl__IsCurrentExpansionTormentOfVelious); /** * Content flags */ - newXS(strcpy(buf, "is_content_flag_enabled"), XS__IsContentFlagEnabled, file); - newXS(strcpy(buf, "set_content_flag"), XS__SetContentFlag, file); + package.add("is_content_flag_enabled", &Perl__IsContentFlagEnabled); + package.add("set_content_flag", &Perl__SetContentFlag); - XSRETURN_YES; } #endif diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 9be785566..e71854ced 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -22,30 +22,6 @@ Eglin #define GvCV_set(gv,cv) (GvCV(gv) = (cv)) #endif -#ifdef EMBPERL_XS -EXTERN_C XS(boot_quest); -#ifdef EMBPERL_XS_CLASSES -EXTERN_C XS(boot_Mob); -EXTERN_C XS(boot_NPC); -EXTERN_C XS(boot_Client); -EXTERN_C XS(boot_Corpse); -EXTERN_C XS(boot_EntityList); -EXTERN_C XS(boot_Group); -EXTERN_C XS(boot_Raid); -EXTERN_C XS(boot_Inventory); -EXTERN_C XS(boot_QuestItem); -EXTERN_C XS(boot_Spell); -EXTERN_C XS(boot_HateEntry); -EXTERN_C XS(boot_Object); -EXTERN_C XS(boot_Doors); -EXTERN_C XS(boot_PerlPacket); -EXTERN_C XS(boot_Expedition); -#ifdef BOTS -EXTERN_C XS(boot_Bot); -#endif -#endif -#endif - #ifdef EMBPERL_IO_CAPTURE XS(XS_EQEmuIO_PRINT); #endif //EMBPERL_IO_CAPTURE @@ -74,36 +50,6 @@ EXTERN_C void xs_init(pTHX) //add the strcpy stuff to get rid of const warnings.... newXS(strcpy(buf, "DynaLoader::boot_DynaLoader"), boot_DynaLoader, file); - newXS(strcpy(buf, "quest::boot_qc"), boot_qc, file); -#ifdef EMBPERL_XS - newXS(strcpy(buf, "quest::boot_quest"), boot_quest, file); -#ifdef EMBPERL_XS_CLASSES - newXS(strcpy(buf, "Mob::boot_Mob"), boot_Mob, file); - newXS(strcpy(buf, "NPC::boot_Mob"), boot_Mob, file); - newXS(strcpy(buf, "NPC::boot_NPC"), boot_NPC, file); - newXS(strcpy(buf, "Corpse::boot_Mob"), boot_Mob, file); - newXS(strcpy(buf, "Corpse::boot_Corpse"), boot_Corpse, file); - newXS(strcpy(buf, "Client::boot_Mob"), boot_Mob, file); - newXS(strcpy(buf, "Client::boot_Client"), boot_Client, file); - newXS(strcpy(buf, "EntityList::boot_EntityList"), boot_EntityList, file); - newXS(strcpy(buf, "PerlPacket::boot_PerlPacket"), boot_PerlPacket, file); - newXS(strcpy(buf, "Group::boot_Group"), boot_Group, file); - newXS(strcpy(buf, "Raid::boot_Raid"), boot_Raid, file); - newXS(strcpy(buf, "Inventory::boot_Inventory"), boot_Inventory, file); - newXS(strcpy(buf, "QuestItem::boot_QuestItem"), boot_QuestItem, file); - newXS(strcpy(buf, "Spell::boot_Spell"), boot_Spell, file); - newXS(strcpy(buf, "HateEntry::boot_HateEntry"), boot_HateEntry, file); - newXS(strcpy(buf, "Object::boot_Object"), boot_Object, file); - newXS(strcpy(buf, "Doors::boot_Doors"), boot_Doors, file); - newXS(strcpy(buf, "Expedition::boot_Expedition"), boot_Expedition, file); -#ifdef BOTS - newXS(strcpy(buf, "Bot::boot_Mob"), boot_Mob, file); - newXS(strcpy(buf, "Bot::boot_NPC"), boot_NPC, file); - newXS(strcpy(buf, "Bot::boot_Bot"), boot_Bot, file); -#endif -; -#endif -#endif #ifdef EMBPERL_IO_CAPTURE newXS(strcpy(buf, "EQEmuIO::PRINT"), XS_EQEmuIO_PRINT, file); #endif diff --git a/zone/embperl.h b/zone/embperl.h index 816e9b84a..8f2fb3e87 100644 --- a/zone/embperl.h +++ b/zone/embperl.h @@ -18,22 +18,13 @@ Eglin #include #include -//headers from the Perl distribution -#include -#define WIN32IO_IS_STDIO +// this option disables distinct int/float/string function argument types for +// backwards compatibility with current perl api usage +// e.g. quest::settimer(0, 1) using number for timer name instead of string +#define PERLBIND_NO_STRICT_SCALAR_TYPES +#include +namespace perl = perlbind; -#ifndef WIN32 -extern "C" { //the perl headers dont do this for us... -#endif -#if _MSC_VER -#define __inline__ __inline -#define __builtin_expect -#endif -#include -#include -#ifndef WIN32 -}; -#endif #ifdef WIN32 #define snprintf _snprintf #endif diff --git a/zone/embxs.cpp b/zone/embxs.cpp index d22f3ecac..a5334b7ad 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -20,17 +20,14 @@ #include "../common/global_define.h" #include "../common/eqemu_logsys.h" +#include "embxs.h" +#include "embperl.h" #include "masterentity.h" #include "command.h" #ifdef BOTS #include "bot_command.h" #endif -#include "embperl.h" -#include "embxs.h" - - - const char *getItemName(unsigned itemid) { const EQ::ItemData* item = nullptr; @@ -42,43 +39,9 @@ const char *getItemName(unsigned itemid) return nullptr; } -XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_qc_getItemName) -{ - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: quest::getItemName(itemid)"); - { - unsigned itemid = (unsigned)SvUV(ST(0)); - const char * RETVAL; - dXSTARG; - RETVAL = getItemName(itemid); - sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; - } - XSRETURN(1); -} - - -EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */ -EXTERN_C XS(boot_qc) -{ - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = '\0'; - - if(items != 1) - LogError("boot_qc does not take any arguments"); - - char buf[128]; //shouldent have any function names longer than this. - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK ; - - newXS(strcpy(buf, "quest::getItemName"), XS_qc_getItemName, file); - - XSRETURN_YES; +const char* Perl__qc_getItemName(unsigned itemid) +{ + return getItemName(itemid); // possible nullptr return } #ifdef EMBPERL_IO_CAPTURE diff --git a/zone/embxs.h b/zone/embxs.h index 97e3bb573..22f294ca6 100644 --- a/zone/embxs.h +++ b/zone/embxs.h @@ -1,24 +1,7 @@ #ifndef EMBXS_H #define EMBXS_H -//headers from the Perl distribution -#include -#define WIN32IO_IS_STDIO - -#ifndef WIN32 -extern "C" { //the perl headers dont do this for us... -#endif -#if _MSC_VER -#define __inline__ __inline -#define __builtin_expect -#endif -#include -#include -#ifndef WIN32 -}; -#endif - const char *getItemName(unsigned itemid); -XS(XS_qc_getItemName); /* prototype to pass -Wmissing-prototypes */ -EXTERN_C XS(boot_qc); /* prototype to pass -Wmissing-prototypes */ +const char* Perl__qc_getItemName(unsigned itemid); + #endif // EMBXS_H diff --git a/zone/perl_bot.cpp b/zone/perl_bot.cpp index 7edfdd82c..f278514be 100644 --- a/zone/perl_bot.cpp +++ b/zone/perl_bot.cpp @@ -3,176 +3,93 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "bot.h" -#ifdef THIS -#undef THIS -#endif - -#define VALIDATE_THIS_IS_BOT \ - do { \ - if (sv_derived_from(ST(0), "Bot")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Bot*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Bot"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Bot_GetOwner); -XS(XS_Bot_GetOwner) +Mob* Perl_Bot_GetOwner(Bot* self) // @categories Script Utility, Bot { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Bot::GetOwner(THIS)"); // @categories Script Utility, Bot - { - Bot* THIS; - Mob* bot_owner; - VALIDATE_THIS_IS_BOT; - bot_owner = THIS->GetBotOwner(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void*)bot_owner); - } - XSRETURN(1); + return self->GetBotOwner(); } -XS(XS_Bot_AddBotItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Bot_AddBotItem) { - dXSARGS; - if (items < 3 || items > 11) - Perl_croak(aTHX_ "Usage: Bot::AddBotItem(THIS, uint16 slot_id, uint32 item_id, [int16 charges = -1], [bool attuned = false], [uint32 augment_one = 0], [uint32 augment_two = 0], [uint32 augment_three = 0], [uint32 augment_four = 0], [uint32 augment_five = 0], [uint32 augment_six = 0])"); // @categories Inventory and Items, Script Utility - { - Bot* THIS; - uint16 slot_id = (uint16) SvUV(ST(1)); - uint32 item_id = (uint32) SvUV(ST(2)); - int16 charges = -1; - bool attuned = false; - uint32 augment_one = 0; - uint32 augment_two = 0; - uint32 augment_three = 0; - uint32 augment_four = 0; - uint32 augment_five = 0; - uint32 augment_six = 0; - VALIDATE_THIS_IS_BOT; - - if (items > 3) { - charges = (int16) SvIV(ST(3)); - } - - if (items > 4) { - attuned = (bool) SvTRUE(ST(4)); - } - - if (items > 5) { - augment_one = (uint32) SvUV(ST(5)); - } - - if (items > 6) { - augment_two = (uint32) SvUV(ST(6)); - } - - if (items > 7) { - augment_three = (uint32) SvUV(ST(7)); - } - - if (items > 8) { - augment_four = (uint32) SvUV(ST(8)); - } - - if (items > 9) { - augment_five = (uint32) SvUV(ST(9)); - } - - if (items > 10) { - augment_six = (uint32) SvUV(ST(10)); - } - - THIS->AddBotItem(slot_id, item_id, charges, attuned, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six); - } - XSRETURN_EMPTY; -} - -XS(XS_Bot_CountBotItem); -XS(XS_Bot_CountBotItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Bot::CountBotItem(THIS, uint32 item_id)"); - { - Bot* THIS; - int item_count = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_BOT; - item_count = THIS->CountBotItem(item_id); - XSprePUSH; - PUSHu((UV) item_count); - } - XSRETURN(1); -} - -XS(XS_Bot_HasBotItem); -XS(XS_Bot_HasBotItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Bot:HasBotItem(THIS, uint32 item_id)"); - { - Bot* THIS; - bool has_item = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_BOT; - has_item = THIS->HasBotItem(item_id); - ST(0) = boolSV(has_item); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Bot_RemoveBotItem); -XS(XS_Bot_RemoveBotItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Bot::RemoveBotItem(THIS, uint32 item_id)"); // @categories Spells and Disciplines - { - Bot* THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_BOT; - THIS->RemoveBotItem(item_id); - } - XSRETURN_EMPTY; -} - -#ifdef __cplusplus -extern "C" -#endif - -XS(boot_Bot); -XS(boot_Bot) +// todo: should just take a hash instead of all these overloads +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id) // @categories Inventory and Items { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; + self->AddBotItem(slot_id, item_id); +} - if (items != 1) - fprintf(stderr, "boot_Bot does not take any arguments."); +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges); +} - char buf[128]; +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned); +} - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AddBotItem"), XS_Bot_AddBotItem, file, "$$$;$$$$$$$$"); - newXSproto(strcpy(buf, "CountBotItem"), XS_Bot_CountBotItem, file, "$$"); - newXSproto(strcpy(buf, "GetOwner"), XS_Bot_GetOwner, file, "$"); - newXSproto(strcpy(buf, "HasBotItem"), XS_Bot_HasBotItem, file, "$$"); - newXSproto(strcpy(buf, "RemoveBotItem"), XS_Bot_RemoveBotItem, file, "$$"); - XSRETURN_YES; +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1); +} + +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1, uint32 aug2) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1, aug2); +} + +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1, uint32 aug2, uint32 aug3) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1, aug2, aug3); +} + +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1, aug2, aug3, aug4); +} + +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1, aug2, aug3, aug4, aug5); +} + +void Perl_Bot_AddBotItem(Bot* self, uint16 slot_id, uint32 item_id, uint16 charges, bool attuned, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) // @categories Inventory and Items +{ + self->AddBotItem(slot_id, item_id, charges, attuned, aug1, aug2, aug3, aug4, aug5, aug6); +} + +uint32 Perl_Bot_CountBotItem(Bot* self, uint32 item_id) +{ + return self->CountBotItem(item_id); +} + +bool Perl_Bot_HasBotItem(Bot* self, uint32 item_id) +{ + return self->HasBotItem(item_id); +} + +void Perl_Bot_RemoveBotItem(Bot* self, uint32 item_id) +{ + return self->RemoveBotItem(item_id); +} + +void perl_register_bot() +{ + perl::interpreter state(PERL_GET_THX); + + auto package = state.new_class("Bot"); + package.add_base_class("NPC"); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32, uint32, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32, uint32, uint32, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32, uint32, uint32, uint32, uint32))&Perl_Bot_AddBotItem); + package.add("AddBotItem", (void(*)(Bot*, uint16, uint32, uint16, bool, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Bot_AddBotItem); + package.add("CountBotItem", &Perl_Bot_CountBotItem); + package.add("GetOwner", &Perl_Bot_GetOwner); + package.add("HasBotItem", &Perl_Bot_HasBotItem); + package.add("RemoveBotItem", &Perl_Bot_RemoveBotItem); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 81d6b8a3d..333167b34 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -4,6748 +4,2804 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "client.h" #include "expedition.h" #include "titles.h" #include "dialogue_window.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_CLIENT \ - do { \ - if (sv_derived_from(ST(0), "Client")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Client*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Client"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Client_SendSound); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendSound) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::SendSound(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->SendSound(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_Save); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Save) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::Save(THIS, uint8 commit_now)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - uint8 iCommitNow = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->Save(iCommitNow); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SaveBackup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SaveBackup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::SaveBackup(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->SaveBackup(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_Connected); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Connected) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Connected(THIS)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->Connected(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_InZone); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_InZone) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::InZone(THIS)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->InZone(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_Kick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Kick) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Kick(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Kick("Perl Quest"); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_Disconnect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Disconnect) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Disconnect(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Disconnect(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IsLD); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsLD) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsLD(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsLD(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_WorldKick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_WorldKick) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::WorldKick(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->WorldKick(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SendToGuildHall); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendToGuildHall) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::SendToGuildHall(THIS)"); // @categories Script Utility, Guild - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->SendToGuildHall(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetAnon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAnon) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAnon(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAnon(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_SetAnon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetAnon) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetAnon(THIS, uint8 anon_flag)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 anon_flag = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAnon(anon_flag); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetAFK); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAFK) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAFK(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAFK(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_SetAFK); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetAFK) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetAFK(THIS, uint8 afk_flag)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 afk_flag = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAFK(afk_flag); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_Duck); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Duck) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Duck(THIS)"); // @categories Account and Character - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Duck(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_DyeArmorBySlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DyeArmorBySlot) { - dXSARGS; - if (items != 5 && items != 6) - Perl_croak(aTHX_ "Usage: Client::DyeArmorBySlot(THIS, uint8 slot, uint8 red, uint8 green, uint8 blue, [uint8 use_tint = 0x00])"); // @categories Account and Character, Inventory and Items - { - Client *THIS; - uint8 slot = (uint8) SvUV(ST(1)); - uint8 red = (uint8) SvUV(ST(2)); - uint8 green = (uint8) SvUV(ST(3)); - uint8 blue = (uint8) SvUV(ST(4)); - uint8 use_tint = 0x00; - if (items == 6) { - use_tint = (uint8) SvUV(ST(5)); - } - VALIDATE_THIS_IS_CLIENT; - THIS->DyeArmorBySlot(slot, red, green, blue, use_tint); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_Stand); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Stand) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Stand(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Stand(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetGM); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetGM) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetGM(THIS, bool toggle)"); // @categories Account and Character - { - Client *THIS; - bool toggle = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetGM(toggle); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetPVP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetPVP) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetPVP(THIS, bool toggle)"); // @categories Account and Character - { - Client *THIS; - bool toggle = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetPVP(toggle); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetPVP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetPVP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetPVP(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetPVP(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_GetGM); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetGM) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetGM(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetGM(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetBaseClass); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBaseClass) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetBaseClass(THIS, uint32 class_id)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 i = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetBaseClass(i); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetBaseRace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBaseRace) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetBaseRace(THIS, uint32 race_id)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 i = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetBaseRace(i); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetBaseGender); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBaseGender) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetBaseGender(THIS, uint32 gender_id)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 i = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetBaseGender(i); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetBaseFace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseFace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseFace(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseFace(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetLanguageSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLanguageSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetLanguageSkill(THIS, uint16 lanuage_id)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - uint16 n = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLanguageSkill(n); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetLDoNPointsTheme); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLDoNPointsTheme) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetLDoNPointsTheme(THIS, int32 theme)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - int32 theme_out = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLDoNPointsTheme(theme_out); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseSTR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseSTR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseSTR(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseSTR(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseSTA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseSTA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseSTA(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseSTA(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseCHA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseCHA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseCHA(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseCHA(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseDEX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseDEX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseDEX(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseDEX(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseINT); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseINT) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseINT(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseINT(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseAGI); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseAGI) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseAGI(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseAGI(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBaseWIS); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBaseWIS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBaseWIS(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBaseWIS(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetWeight); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetWeight) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetWeight(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetWeight(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetEXP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetEXP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetEXP(THIS)"); // @categories Experience and Level - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetEXP(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetAAExp); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAAExp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAAExp(THIS)"); // @categories Alternative Advancement, Experience and Level - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAAXP(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetAAPercent); -XS(XS_Client_GetAAPercent) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAAPercent(THIS)"); // @categories Alternative Advancement, Experience and Level - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAAPercent(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetTotalSecondsPlayed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetTotalSecondsPlayed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetTotalSecondsPlayed(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetTotalSecondsPlayed(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_UpdateLDoNPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UpdateLDoNPoints) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::UpdateLDoNPoints(THIS, uint32 theme_id, int points)"); // @categories Currency and Points - { - Client *THIS; - bool RETVAL; - uint32 theme_id = (uint32) SvUV(ST(1)); - int points = (int) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->UpdateLDoNPoints(theme_id, points); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetDeity); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetDeity) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetDeity(THIS, uint32 deity_id)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 i = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetDeity(i); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_AddEXP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AddEXP) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Client::AddEXP(THIS, uint32 experience_points)"); // @categories Experience and Level - { - Client *THIS; - uint32 add_exp = (uint32) SvUV(ST(1)); - uint8 conlevel; - bool resexp; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - conlevel = 0xFF; - else { - conlevel = (uint8) SvUV(ST(2)); - } - - if (items < 4) - resexp = false; - else { - resexp = (bool) SvTRUE(ST(3)); - } - - THIS->AddEXP(add_exp, conlevel, resexp); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetEXP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetEXP) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Client::SetEXP(THIS, uint32 experience_points, uint32 aa_experience_points, [bool resexp=false])"); // @categories Experience and Level - { - Client *THIS; - uint32 set_exp = (uint32) SvUV(ST(1)); - uint32 set_aaxp = (uint32) SvUV(ST(2)); - bool resexp; - VALIDATE_THIS_IS_CLIENT; - if (items < 4) - resexp = false; - else { - resexp = (bool) SvTRUE(ST(3)); - } - - THIS->SetEXP(set_exp, set_aaxp, resexp); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBindPoint) { - dXSARGS; - if (items < 1 || items > 7) - Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, [int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f, float new_heading = 0.0f])"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - int to_zone = -1; - int to_instance = 0; - float new_x = 0.0f, new_y = 0.0f, new_z = 0.0f, new_heading = 0.0f; - VALIDATE_THIS_IS_CLIENT; - if (items > 1) - to_zone = (int) SvIV(ST(1)); - if (items > 2) - to_instance = (int) SvIV(ST(2)); - if (items > 3) - new_x = (float) SvNV(ST(3)); - if (items > 4) - new_y = (float) SvNV(ST(4)); - if (items > 5) - new_z = (float) SvNV(ST(5)); - if (items > 6) - new_heading = (float) SvNV(ST(6)); - - THIS->SetBindPoint2(0, to_zone, to_instance, glm::vec4(new_x, new_y, new_z, new_heading)); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetBindX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBindX) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetBindX(int index = 0)"); // @categories Account and Character - { - Client *THIS; - int index = 0; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 1) - index = 0; - else if (items == 2) { - index = (uint32) SvUV(ST(1)); - } - - RETVAL = THIS->GetBindX(index); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBindY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBindY) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetBindY(int index = 0)"); // @categories Account and Character - { - Client *THIS; - int index = 0; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 1) - index = 0; - else if (items == 2) { - index = (uint32) SvUV(ST(1));; - } - - RETVAL = THIS->GetBindY(index); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBindZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBindZ) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetBindZ(int index = 0)"); // @categories Account and Character - { - Client *THIS; - int index = 0; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 1) - index = 0; - else if (items == 2) { - index = (uint32) SvUV(ST(1)); - } - - RETVAL = THIS->GetBindZ(index); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBindHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBindHeading) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetBindHeading(int index = 0)"); // @categories Account and Character - { - Client *THIS; - int index = 0; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 1) - index = 0; - else if (items == 2) { - index = (uint32) SvUV(ST(1)); - } - - RETVAL = THIS->GetBindHeading(index); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetBindZoneID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBindZoneID) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetBindZoneID(int index = 0)"); // @categories Account and Character - { - Client *THIS; - uint32 index = 0; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 1) - index = 0; - else if (items == 2) { - index = (uint32) SvUV(ST(1)); - } - - RETVAL = THIS->GetBindZoneID(index); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - - -XS(XS_Client_MovePC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MovePC) { - dXSARGS; - if (items != 6) - Perl_croak(aTHX_ "Usage: Client::MovePC(THIS, uint32 zone_id, float x, float y, float z, float heading)"); // @categories Script Utility - { - Client *THIS; - uint32 zoneID = (uint32) SvUV(ST(1)); - float x = (float) SvNV(ST(2)); - float y = (float) SvNV(ST(3)); - float z = (float) SvNV(ST(4)); - float heading = (float) SvNV(ST(5)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MovePC(zoneID, x, y, z, heading); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MovePCInstance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MovePCInstance) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Client::MovePCInstance(THIS, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading)"); // @categories Adventures and Expeditions, Script Utility - { - Client *THIS; - uint32 zoneID = (uint32) SvUV(ST(1)); - uint32 instanceID = (uint32) SvUV(ST(2)); - float x = (float) SvNV(ST(3)); - float y = (float) SvNV(ST(4)); - float z = (float) SvNV(ST(5)); - float heading = (float) SvNV(ST(6)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MovePC(zoneID, instanceID, x, y, z, heading); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZone); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZone) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZone(THIS, string zone_short_name)"); // @categories Script Utility - { - Client *THIS; - const char *zone_short_name = (const char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZone(zone_short_name); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZone) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZone) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZone) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZone) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZoneGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZoneGroup) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZoneGroup(THIS, string zone_short_name)"); // @categories Script Utility, Group - { - Client *THIS; - const char *zone_short_name = (const char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZoneGroup(zone_short_name); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneGroup) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneGroup) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneGroup) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneGroup) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZoneRaid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZoneRaid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZoneRaid(THIS, string zone_short_name)"); // @categories Script Utility, Raid - { - Client *THIS; - const char *zone_short_name = (const char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZoneRaid(zone_short_name); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneRaid) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneRaid) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneRaid) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneRaid) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZoneInstance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZoneInstance) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZoneInstance(THIS, uint16 instance_id)"); // @categories Adventures and Expeditions, Script Utility - { - Client *THIS; - uint16 instance_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZoneInstance(instance_id); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstance) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstance) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstance) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstance) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZoneInstanceGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZoneInstanceGroup) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZoneInstanceGroup(THIS, uint16 instance_id)"); // @categories Adventures and Expeditions, Script Utility, Group - { - Client *THIS; - uint16 instance_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZoneInstanceGroup(instance_id); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceGroup) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceGroup) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceGroup) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceGroup) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MoveZoneInstanceRaid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MoveZoneInstanceRaid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::MoveZoneInstanceRaid(THIS, uint16 instance_id)"); // @categories Adventures and Expeditions, Script Utility, Raid - { - Client *THIS; - uint16 instance_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - if (THIS->IsClient()) { - THIS->MoveZoneInstanceRaid(instance_id); - } else { - if (THIS->IsMerc()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceRaid) attempted to process a type Merc reference"); - } -#ifdef BOTS - else if (THIS->IsBot()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceRaid) attempted to process a type Bot reference"); - } -#endif - else if (THIS->IsNPC()) { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceRaid) attempted to process a type NPC reference"); - } - else { - LogDebug("[CLIENT] Perl(XS_Client_MoveZoneInstanceRaid) attempted to process an Unknown type reference"); - } - - Perl_croak(aTHX_ "THIS is not of type Client"); - } - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ChangeLastName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ChangeLastName) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ChangeLastName(THIS, string last_name)"); // @categories Account and Character - { - Client *THIS; - std::string last_name = (std::string) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ChangeLastName(last_name); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetFactionLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetFactionLevel) { - dXSARGS; - if (items != 8) - Perl_croak(aTHX_ "Usage: Client::GetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint32 player_race_id, uint32 player_class_id, uint32 player_deity_id, uint32 player_faction_id, Mob*)"); // @categories Faction - { - Client *THIS; - FACTION_VALUE RETVAL; - dXSTARG; - uint32 char_id = (uint32) SvUV(ST(1)); - uint32 npc_id = (uint32) SvUV(ST(2)); - uint32 p_race = (uint32) SvUV(ST(3)); - uint32 p_class = (uint32) SvUV(ST(4)); - uint32 p_deity = (uint32) SvUV(ST(5)); - int32 pFaction = (int32) SvIV(ST(6)); - Mob *tnpc; - VALIDATE_THIS_IS_CLIENT; - if (sv_derived_from(ST(7), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(7))); - tnpc = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "tnpc is not of type Mob"); - if (tnpc == nullptr) - Perl_croak(aTHX_ "tnpc is nullptr, avoiding crash."); - - RETVAL = THIS->GetFactionLevel(char_id, npc_id, p_race, p_class, p_deity, pFaction, tnpc); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_SetFactionLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetFactionLevel) { - dXSARGS; - if (items != 6) - Perl_croak(aTHX_ "Usage: Client::SetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint8 character_class, uint8 character_race, uint8 character_deity)"); // @categories Faction - { - Client *THIS; - uint32 char_id = (uint32) SvUV(ST(1)); - uint32 npc_id = (uint32) SvUV(ST(2)); - uint8 char_class = (uint8) SvUV(ST(3)); - uint8 char_race = (uint8) SvUV(ST(4)); - uint8 char_deity = (uint8) SvUV(ST(5)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetFactionLevel(char_id, npc_id, char_class, char_race, char_deity); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetFactionLevel2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetFactionLevel2) { - dXSARGS; - if (items < 7 || items > 8) - Perl_croak(aTHX_ "Usage: Client::SetFactionLevel2(THIS, uint32 character_id, int32 faction_id, uint8 character_class, uint8 character_race, uint8 character_deity, int32 value, uint8 temp)"); // @categories Faction - { - Client *THIS; - uint32 char_id = (uint32) SvUV(ST(1)); - int32 faction_id = (int32) SvIV(ST(2)); - uint8 char_class = (uint8) SvUV(ST(3)); - uint8 char_race = (uint8) SvUV(ST(4)); - uint8 char_deity = (uint8) SvUV(ST(5)); - int32 value = (int32) SvIV(ST(6)); - uint8 temp; - VALIDATE_THIS_IS_CLIENT; - if (items == 7) - temp = 0; - else { - temp = (uint8) SvUV(ST(7)); - } - - THIS->SetFactionLevel2(char_id, faction_id, char_class, char_race, char_deity, value, temp); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetRawItemAC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetRawItemAC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetRawItemAC(THIS)"); // @categories Inventory and Items - { - Client *THIS; - int16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetRawItemAC(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_AccountID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AccountID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::AccountID(THIS)"); // @categories Account and Character - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->AccountID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_AccountName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AccountName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::AccountName(THIS)"); // @categories Account and Character - { - Client *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->AccountName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Client_Admin); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Admin) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Admin(THIS)"); // @categories Account and Character - { - Client *THIS; - int16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->Admin(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_CharacterID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CharacterID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::CharacterID(THIS)"); // @categories Account and Character - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->CharacterID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_UpdateAdmin); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UpdateAdmin) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::UpdateAdmin(THIS, bool from_db = true)"); // @categories Account and Character - { - Client *THIS; - bool iFromDB; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - iFromDB = true; - else { - iFromDB = (bool) SvTRUE(ST(1)); - } - - THIS->UpdateAdmin(iFromDB); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UpdateWho); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UpdateWho) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::UpdateWho(THIS, uint8 remove = 0)"); // @categories Script Utility - { - Client *THIS; - uint8 remove; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - remove = 0; - else { - remove = (uint8) SvUV(ST(1)); - } - - THIS->UpdateWho(remove); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GuildRank); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GuildRank) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GuildRank(THIS)"); // @categories Account and Character, Guild - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GuildRank(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GuildID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GuildID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GuildID(THIS)"); // @categories Account and Character, Guild - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GuildID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetFace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetFace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetFace(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetFace(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_TakeMoneyFromPP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_TakeMoneyFromPP) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::TakeMoneyFromPP(THIS, uint32 copper, [bool update_client = false])"); // @categories Currency and Points - { - Client *THIS; - bool has_money; - bool update_client = false; - uint64 copper = (uint64) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - - if (items == 3) { - update_client = (bool) SvTRUE(ST(2)); - } - - has_money = THIS->TakeMoneyFromPP(copper, update_client); - ST(0) = boolSV(has_money); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_AddMoneyToPP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AddMoneyToPP) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ "Usage: Client::AddMoneyToPP(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, [bool update_client = false])"); // @categories Currency and Points - { - Client *THIS; - uint32 copper = (uint32) SvUV(ST(1)); - uint32 silver = (uint32) SvUV(ST(2)); - uint32 gold = (uint32) SvUV(ST(3)); - uint32 platinum = (uint32) SvUV(ST(4)); - bool update_client = false; - VALIDATE_THIS_IS_CLIENT; - - if (items == 6) { - update_client = (bool) SvTRUE(ST(5)); - } - - THIS->AddMoneyToPP(copper, silver, gold, platinum, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_TGB); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_TGB) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::TGB(THIS)"); // @categories Spells and Disciplines - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->TGB(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_GetSkillPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetSkillPoints) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetSkillPoints(THIS)"); // @categories Skills and Recipes - { - Client *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetSkillPoints(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_SetSkillPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetSkillPoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetSkillPoints(THIS, inp)"); // @categories Skills and Recipes - { - Client *THIS; - int inp = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetSkillPoints(inp); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IncreaseSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IncreaseSkill) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::IncreaseSkill(THIS, int skill_id, int value = 1)"); // @categories Skills and Recipes - { - Client *THIS; - int skill_id = (int) SvIV(ST(1)); - int value; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - value = 1; - else { - value = (int) SvIV(ST(2)); - } - - THIS->IncreaseSkill(skill_id, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IncreaseLanguageSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IncreaseLanguageSkill) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::IncreaseLanguageSkill(THIS, int skill_id, int value = 1)"); // @categories Skills and Recipes - { - Client *THIS; - int skill_id = (int) SvIV(ST(1)); - int value; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - value = 1; - else { - value = (int) SvIV(ST(2)); - } - - THIS->IncreaseLanguageSkill(skill_id, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetRawSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetRawSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetRawSkill(THIS, int skill_id)"); // @categories Skills and Recipes - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - EQ::skills::SkillType skill_id = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetRawSkill(skill_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_HasSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_HasSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasSkill(THIS, int skill_id)"); // @categories Skills and Recipes - { - Client *THIS; - bool RETVAL; - EQ::skills::SkillType skill_id = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->HasSkill(skill_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_CanHaveSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CanHaveSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::CanHaveSkill(THIS, int skill_id)"); // @categories Skills and Recipes - { - Client *THIS; - bool RETVAL; - EQ::skills::SkillType skill_id = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->CanHaveSkill(skill_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetSkill) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetSkill(THIS, int skill_id, uint16 value)"); // @categories Skills and Recipes - { - Client *THIS; - EQ::skills::SkillType skill_num = (EQ::skills::SkillType) SvUV(ST(1)); - uint16 value = (uint16) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetSkill(skill_num, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_AddSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AddSkill) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::AddSkill(THIS, int skill_id, uint16 value)"); // @categories Skills and Recipes - { - Client *THIS; - EQ::skills::SkillType skillid = (EQ::skills::SkillType) SvUV(ST(1)); - uint16 value = (uint16) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->AddSkill(skillid, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_CheckSpecializeIncrease); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CheckSpecializeIncrease) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::CheckSpecializeIncrease(THIS, uint16 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->CheckSpecializeIncrease(spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_CheckIncreaseSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CheckIncreaseSkill) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::CheckIncreaseSkill(THIS, int skill_id, int chance_modifier = 0)"); // @categories Skills and Recipes - { - Client *THIS; - bool RETVAL; - EQ::skills::SkillType skillid = (EQ::skills::SkillType) SvUV(ST(1)); - int chancemodi; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - chancemodi = 0; - else { - chancemodi = (int) SvIV(ST(2)); - } - - RETVAL = THIS->CheckIncreaseSkill(skillid, nullptr, chancemodi); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetLanguageSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetLanguageSkill) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetLanguageSkill(THIS, int language_id, int value)"); // @categories Account and Character, Skills and Recipes, Stats and Attributes - { - Client *THIS; - int langid = (int) SvIV(ST(1)); - int value = (int) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetLanguageSkill(langid, value); - } - XSRETURN_EMPTY; - -} - -XS(XS_Client_MaxSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MaxSkill) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Client::MaxSkill(THIS, uint16 skill_id, uint16 class_id, uint16 level)"); // @categories Skills and Recipes - { - Client *THIS; - uint16 RETVAL; - EQ::skills::SkillType skillid = (EQ::skills::SkillType) SvUV(ST(1)); - uint16 class_ = 0; - uint16 level = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items > 2) - class_ = (uint16) SvUV(ST(2)); - else - class_ = THIS->GetClass(); - - if (items > 3) - level = (uint16) SvUV(ST(3)); - else - level = THIS->GetLevel(); - - RETVAL = THIS->MaxSkill(skillid, class_, level); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GMKill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GMKill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GMKill(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->GMKill(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IsMedding); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsMedding) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsMedding(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsMedding(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_GetDuelTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetDuelTarget) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetDuelTarget(THIS)"); // @categories Account and Character, Script Utility - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetDuelTarget(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_IsDueling); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsDueling) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsDueling(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsDueling(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetDuelTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetDuelTarget) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetDuelTarget(THIS, set_id)"); // @categories Account and Character - { - Client *THIS; - uint32 set_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetDuelTarget(set_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetDueling); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetDueling) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetDueling(THIS, duel)"); // @categories Account and Character, Script Utility - { - Client *THIS; - bool duel = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetDueling(duel); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ResetAA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ResetAA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ResetAA(THIS)"); // @categories Alternative Advancement - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->ResetAA(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_MemSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MemSpell) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Client::MemSpell(THIS, uint16 spell_id, int slot, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - int slot = (int) SvIV(ST(2)); - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 4) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(3)); - } - - THIS->MemSpell(spell_id, slot, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnmemSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UnmemSpell) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::UnmemSpell(THIS, int slot, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - int slot = (int) SvIV(ST(1)); - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->UnmemSpell(slot, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnmemSpellBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UnmemSpellBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::UnmemSpellBySpellID(THIS, int32 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - int32 spell_id = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->UnmemSpellBySpellID(spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnmemSpellAll); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UnmemSpellAll) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::UnmemSpellAll(THIS, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(1)); - } - - THIS->UnmemSpellAll(update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_FindEmptyMemSlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_FindEmptyMemSlot) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::FindEmptyMemSlot(THIS)"); // @categories Account and Character, Spells and Disciplines - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->FindEmptyMemSlot(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_FindMemmedSpellBySlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_FindMemmedSpellBySlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::FindMemmedSpellBySlot(THIS, int slot)"); // @categories Account and Character, Spells and Disciplines - { - Client *THIS; - uint16 RETVAL; - dXSTARG; - int slot = SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->FindMemmedSpellBySlot(slot); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_FindMemmedSpellBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_FindMemmedSpellBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::FindMemmedSpellBySpellID(THIS, uint16 spell_id)"); // @categories Account and Character, Spells and Disciplines - { - Client *THIS; - int RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->FindMemmedSpellBySpellID(spell_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_MemmedCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_MemmedCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::MemmedCount(THIS)"); // @categories Spells and Disciplines - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->MemmedCount(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_ScribeSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ScribeSpell) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Client::ScribeSpell(THIS, uint16 spell_id, int slot, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - int slot = (int) SvIV(ST(2)); - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 4) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(3)); - } - - THIS->ScribeSpell(spell_id, slot, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnscribeSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UnscribeSpell) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::UnscribeSpell(THIS, int slot, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - int slot = (int) SvIV(ST(1)); - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->UnscribeSpell(slot, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnscribeSpellAll); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UnscribeSpellAll) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::UnscribeSpellAll(THIS, [bool update_client = true])"); - { - Client *THIS; - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(1)); - } - - THIS->UnscribeSpellAll(update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_TrainDiscBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_TrainDiscBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::TrainDiscBySpellID(THIS, int32 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - int32 spell_id = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->TrainDiscBySpellID(spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetDiscSlotBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetDiscSlotBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetDiscSlotBySpellID(THIS, int32 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - int RETVAL; - int32 spell_id = (int32) SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetDiscSlotBySpellID(spell_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_UntrainDisc); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UntrainDisc) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::UntrainDisc(THIS, int slot, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - int slot = (int) SvIV(ST(1)); - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->UntrainDisc(slot, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UntrainDiscAll); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UntrainDiscAll) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::UntrainDiscAll(THIS, [update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - bool update_client; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - update_client = true; - else { - update_client = (bool) SvTRUE(ST(1)); - } - - THIS->UntrainDiscAll(update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IsStanding); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsStanding) +void Perl_Client_SendSound(Client* self) // @categories Script Utility { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsStanding(THIS)"); // @categories Account and Character - { - Client * THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsStanding(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); + self->SendSound(); } -XS(XS_Client_Sit); -XS(XS_Client_Sit) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Sit(THIS)"); - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Sit(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_IsSitting); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsSitting) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsSitting(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsSitting(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_IsCrouching); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsCrouching) +bool Perl_Client_Save(Client* self, uint8 commit_now) // @categories Script Utility { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsCrouching(THIS)"); // @categories Account and Character - { - Client * THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsCrouching(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); + return self->Save(commit_now); } -XS(XS_Client_IsBecomeNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsBecomeNPC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsBecomeNPC(THIS)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsBecomeNPC(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_SaveBackup(Client* self) // @categories Script Utility +{ + self->SaveBackup(); } -XS(XS_Client_GetBecomeNPCLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetBecomeNPCLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetBecomeNPCLevel(THIS)"); // @categories Experience and Level - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetBecomeNPCLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +bool Perl_Client_Connected(Client* self) // @categories Script Utility +{ + return self->Connected(); } -XS(XS_Client_SetBecomeNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBecomeNPC) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetBecomeNPC(THIS, flag)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - bool flag = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetBecomeNPC(flag); - } - XSRETURN_EMPTY; +bool Perl_Client_InZone(Client* self) // @categories Script Utility +{ + return self->InZone(); } -XS(XS_Client_SetBecomeNPCLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetBecomeNPCLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetBecomeNPCLevel(THIS, level)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 level = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetBecomeNPCLevel(level); - } - XSRETURN_EMPTY; +void Perl_Client_Kick(Client* self) // @categories Script Utility +{ + self->Kick("Perl Quest"); } -XS(XS_Client_SetFeigned); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetFeigned) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetFeigned(THIS, in_feigned)"); // @categories Script Utility - { - Client *THIS; - bool in_feigned = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetFeigned(in_feigned); - } - XSRETURN_EMPTY; +void Perl_Client_Disconnect(Client* self) // @categories Script Utility +{ + self->Disconnect(); +} + +bool Perl_Client_IsLD(Client* self) // @categories Account and Character +{ + return self->IsLD(); +} + +void Perl_Client_WorldKick(Client* self) // @categories Script Utility +{ + self->WorldKick(); +} + +void Perl_Client_SendToGuildHall(Client* self) // @categories Script Utility, Guild +{ + self->SendToGuildHall(); +} + +int Perl_Client_GetAnon(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetAnon(); +} + +void Perl_Client_SetAnon(Client* self, uint8 anon_flag) // @categories Account and Character, Stats and Attributes +{ + self->SetAnon(anon_flag); +} + +int Perl_Client_GetAFK(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetAFK(); +} + +void Perl_Client_SetAFK(Client* self, uint8 afk_flag) // @categories Account and Character, Stats and Attributes +{ + self->SetAFK(afk_flag); +} + +void Perl_Client_Duck(Client* self) // @categories Account and Character +{ + self->Duck(); +} + +void Perl_Client_DyeArmorBySlot(Client* self, uint8 slot, uint8 red, uint8 green, uint8 blue) // @categories Account and Character, Inventory and Items +{ + self->DyeArmorBySlot(slot, red, green, blue); +} + +void Perl_Client_DyeArmorBySlot(Client* self, uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint) // @categories Account and Character, Inventory and Items +{ + self->DyeArmorBySlot(slot, red, green, blue, use_tint); +} + +void Perl_Client_Stand(Client* self) // @categories Script Utility +{ + self->Stand(); +} + +void Perl_Client_SetGM(Client* self, bool on) // @categories Account and Character +{ + self->SetGM(on); +} + +void Perl_Client_SetPVP(Client* self, bool on) // @categories Account and Character +{ + self->SetPVP(on); +} + +bool Perl_Client_GetPVP(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetPVP(); +} + +bool Perl_Client_GetGM(Client* self) // @categories Account and Character +{ + return self->GetGM(); +} + +void Perl_Client_SetBaseClass(Client* self, uint32 class_id) // @categories Account and Character, Stats and Attributes +{ + self->SetBaseClass(class_id); +} + +void Perl_Client_SetBaseRace(Client* self, uint32 race_id) // @categories Account and Character, Stats and Attributes +{ + self->SetBaseRace(race_id); +} + +void Perl_Client_SetBaseGender(Client* self, uint32 gender_id) // @categories Account and Character, Stats and Attributes +{ + self->SetBaseGender(gender_id); +} + +int Perl_Client_GetBaseFace(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseFace(); +} + +int Perl_Client_GetLanguageSkill(Client* self, uint16 lanuage_id) // @categories Account and Character, Stats and Attributes +{ + return self->GetLanguageSkill(lanuage_id); +} + +uint32_t Perl_Client_GetLDoNPointsTheme(Client* self, int theme) // @categories Currency and Points +{ + return self->GetLDoNPointsTheme(theme); +} + +int Perl_Client_GetBaseSTR(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseSTR(); +} + +int Perl_Client_GetBaseSTA(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseSTA(); +} + +int Perl_Client_GetBaseCHA(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseCHA(); +} + +int Perl_Client_GetBaseDEX(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseDEX(); +} + +int Perl_Client_GetBaseINT(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseINT(); +} + +int Perl_Client_GetBaseAGI(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseAGI(); +} + +int Perl_Client_GetBaseWIS(Client* self) // @categories Stats and Attributes +{ + return self->GetBaseWIS(); +} + +int Perl_Client_GetWeight(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetWeight(); +} + +uint32_t Perl_Client_GetEXP(Client* self) // @categories Experience and Level +{ + return self->GetEXP(); +} + +uint32_t Perl_Client_GetAAExp(Client* self) // @categories Alternative Advancement, Experience and Level +{ + return self->GetAAXP(); +} + +uint32_t Perl_Client_GetAAPercent(Client* self) // @categories Alternative Advancement, Experience and Level +{ + return self->GetAAPercent(); +} + +uint32_t Perl_Client_GetTotalSecondsPlayed(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetTotalSecondsPlayed(); +} + +bool Perl_Client_UpdateLDoNPoints(Client* self, uint32 theme_id, int points) // @categories Currency and Points +{ + return self->UpdateLDoNPoints(theme_id, points); +} + +void Perl_Client_SetDeity(Client* self, uint32 deity_id) // @categories Account and Character, Stats and Attributes +{ + self->SetDeity(deity_id); +} + +void Perl_Client_AddEXP(Client* self, uint32 add_exp) // @categories Experience and Level +{ + self->AddEXP(add_exp); +} + +void Perl_Client_AddEXP(Client* self, uint32 add_exp, uint8 conlevel) // @categories Experience and Level +{ + self->AddEXP(add_exp, conlevel); +} + +void Perl_Client_AddEXP(Client* self, uint32 add_exp, uint8 conlevel, bool resexp) // @categories Experience and Level +{ + self->AddEXP(add_exp, conlevel, resexp); +} + +void Perl_Client_SetEXP(Client* self, uint32 set_exp, uint32 set_aaxp) // @categories Experience and Level +{ + self->SetEXP(set_exp, set_aaxp); +} + +void Perl_Client_SetEXP(Client* self, uint32 set_exp, uint32 set_aaxp, bool resexp) // @categories Experience and Level +{ + self->SetEXP(set_exp, set_aaxp, resexp); +} + +void Perl_Client_SetBindPoint(Client* self) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone, int to_instance) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone, to_instance); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone, int to_instance, float new_x) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone, to_instance, glm::vec4(new_x, 0.0f, 0.0f, 0.0f)); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone, int to_instance, float new_x, float new_y) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone, to_instance, glm::vec4(new_x, new_y, 0.0f, 0.0f)); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone, int to_instance, float new_x, float new_y, float new_z) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone, to_instance, glm::vec4(new_x, new_y, new_z, 0.0f)); +} + +void Perl_Client_SetBindPoint(Client* self, int to_zone, int to_instance, float new_x, float new_y, float new_z, float new_heading) // @categories Account and Character, Stats and Attributes +{ + self->SetBindPoint2(0, to_zone, to_instance, glm::vec4(new_x, new_y, new_z, new_heading)); +} + +float Perl_Client_GetBindX(Client* self) // @categories Account and Character +{ + return self->GetBindX(); +} + +float Perl_Client_GetBindX(Client* self, int index) // @categories Account and Character +{ + return self->GetBindX(index); +} + +float Perl_Client_GetBindY(Client* self) // @categories Account and Character +{ + return self->GetBindY(); +} + +float Perl_Client_GetBindY(Client* self, int index) // @categories Account and Character +{ + return self->GetBindY(index); +} + +float Perl_Client_GetBindZ(Client* self) // @categories Account and Character +{ + return self->GetBindZ(); +} + +float Perl_Client_GetBindZ(Client* self, int index) // @categories Account and Character +{ + return self->GetBindZ(index); +} + +float Perl_Client_GetBindHeading(Client* self) // @categories Account and Character +{ + return self->GetBindHeading(); +} + +float Perl_Client_GetBindHeading(Client* self, int index) // @categories Account and Character +{ + return self->GetBindHeading(index); +} + +uint32_t Perl_Client_GetBindZoneID(Client* self) // @categories Account and Character +{ + return self->GetBindZoneID(); +} + +uint32_t Perl_Client_GetBindZoneID(Client* self, int index) // @categories Account and Character +{ + return self->GetBindZoneID(index); +} + +void Perl_Client_MovePC(Client* self, uint32 zone_id, float x, float y, float z, float heading) // @categories Script Utility +{ + self->MovePC(zone_id, x, y, z, heading); +} + +void Perl_Client_MovePCInstance(Client* self, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading) // @categories Adventures and Expeditions, Script Utility +{ + self->MovePC(zone_id, instance_id, x, y, z, heading); +} + +void Perl_Client_MoveZone(Client* self, const char* zone_short_name) // @categories Script Utility +{ + self->MoveZone(zone_short_name); +} + +void Perl_Client_MoveZoneGroup(Client* self, const char* zone_short_name) // @categories Script Utility, Group +{ + self->MoveZoneGroup(zone_short_name); +} + +void Perl_Client_MoveZoneRaid(Client* self, const char* zone_short_name) // @categories Script Utility, Raid +{ + self->MoveZoneRaid(zone_short_name); +} + +void Perl_Client_MoveZoneInstance(Client* self, uint16 instance_id) // @categories Adventures and Expeditions, Script Utility +{ + self->MoveZoneInstance(instance_id); +} + +void Perl_Client_MoveZoneInstanceGroup(Client* self, uint16 instance_id) // @categories Adventures and Expeditions, Script Utility, Group +{ + self->MoveZoneInstanceGroup(instance_id); +} + +void Perl_Client_MoveZoneInstanceRaid(Client* self, uint16 instance_id) // @categories Adventures and Expeditions, Script Utility, Raid +{ + self->MoveZoneInstanceRaid(instance_id); +} + +void Perl_Client_ChangeLastName(Client* self, std::string last_name) // @categories Account and Character +{ + self->ChangeLastName(last_name); +} + +int Perl_Client_GetFactionLevel(Client* self, uint32 char_id, uint32 npc_id, uint32 race_id, uint32 class_id, uint32 deity_id, uint32 faction_id, Mob* tnpc) // @categories Faction +{ + return self->GetFactionLevel(char_id, npc_id, race_id, class_id, deity_id, faction_id, tnpc); +} + +void Perl_Client_SetFactionLevel(Client* self, uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity) // @categories Faction +{ + self->SetFactionLevel(char_id, npc_id, char_class, char_race, char_deity); +} + +void Perl_Client_SetFactionLevel2(Client* self, uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value) // @categories Faction +{ + self->SetFactionLevel2(char_id, faction_id, char_class, char_race, char_deity, value, 0); +} + +void Perl_Client_SetFactionLevel2(Client* self, uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp) // @categories Faction +{ + self->SetFactionLevel2(char_id, faction_id, char_class, char_race, char_deity, value, temp); +} + +int Perl_Client_GetRawItemAC(Client* self) // @categories Inventory and Items +{ + return self->GetRawItemAC(); +} + +uint32_t Perl_Client_AccountID(Client* self) // @categories Account and Character +{ + return self->AccountID(); +} + +std::string Perl_Client_AccountName(Client* self) // @categories Account and Character +{ + return self->AccountName(); +} + +int Perl_Client_Admin(Client* self) // @categories Account and Character +{ + return self->Admin(); +} + +uint32_t Perl_Client_CharacterID(Client* self) // @categories Account and Character +{ + return self->CharacterID(); +} + +void Perl_Client_UpdateAdmin(Client* self) // @categories Account and Character +{ + self->UpdateAdmin(); +} + +void Perl_Client_UpdateAdmin(Client* self, bool from_db) // @categories Account and Character +{ + self->UpdateAdmin(from_db); +} + +void Perl_Client_UpdateWho(Client* self) // @categories Script Utility +{ + self->UpdateWho(); +} + +void Perl_Client_UpdateWho(Client* self, uint8 remove) // @categories Script Utility +{ + self->UpdateWho(remove); +} + +int Perl_Client_GuildRank(Client* self) // @categories Account and Character, Guild +{ + return self->GuildRank(); +} + +uint32_t Perl_Client_GuildID(Client* self) // @categories Account and Character, Guild +{ + return self->GuildID(); +} + +int Perl_Client_GetFace(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetFace(); +} + +bool Perl_Client_TakeMoneyFromPP(Client* self, uint64 copper) // @categories Currency and Points +{ + return self->TakeMoneyFromPP(copper); +} + +bool Perl_Client_TakeMoneyFromPP(Client* self, uint64 copper, bool update_client) // @categories Currency and Points +{ + return self->TakeMoneyFromPP(copper, update_client); +} + +void Perl_Client_AddMoneyToPP(Client* self, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) // @categories Currency and Points +{ + self->AddMoneyToPP(copper, silver, gold, platinum); +} + +void Perl_Client_AddMoneyToPP(Client* self, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client) // @categories Currency and Points +{ + self->AddMoneyToPP(copper, silver, gold, platinum, update_client); +} + +bool Perl_Client_TGB(Client* self) // @categories Spells and Disciplines +{ + return self->TGB(); +} + +int Perl_Client_GetSkillPoints(Client* self) // @categories Skills and Recipes +{ + return self->GetSkillPoints(); +} + +void Perl_Client_SetSkillPoints(Client* self, int points) // @categories Skills and Recipes +{ + self->SetSkillPoints(points); +} + +void Perl_Client_IncreaseSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + self->IncreaseSkill(skill_id); +} + +void Perl_Client_IncreaseSkill(Client* self, int skill_id, int value) // @categories Skills and Recipes +{ + self->IncreaseSkill(skill_id, value); +} + +void Perl_Client_IncreaseLanguageSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + self->IncreaseLanguageSkill(skill_id); +} + +void Perl_Client_IncreaseLanguageSkill(Client* self, int skill_id, int value) // @categories Skills and Recipes +{ + self->IncreaseLanguageSkill(skill_id, value); +} + +uint32_t Perl_Client_GetRawSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + return self->GetRawSkill(static_cast(skill_id)); +} + +bool Perl_Client_HasSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + return self->HasSkill(static_cast(skill_id)); +} + +bool Perl_Client_CanHaveSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + return self->CanHaveSkill(static_cast(skill_id)); +} + +void Perl_Client_SetSkill(Client* self, int skill_id, uint16 value) // @categories Skills and Recipes +{ + self->SetSkill(static_cast(skill_id), value); +} + +void Perl_Client_AddSkill(Client* self, int skill_id, uint16 value) // @categories Skills and Recipes +{ + self->AddSkill(static_cast(skill_id), value); +} + +void Perl_Client_CheckSpecializeIncrease(Client* self, uint16 spell_id) // @categories Spells and Disciplines +{ + self->CheckSpecializeIncrease(spell_id); +} + +bool Perl_Client_CheckIncreaseSkill(Client* self, int skill_id) // @categories Skills and Recipes +{ + return self->CheckIncreaseSkill(static_cast(skill_id), nullptr); +} + +bool Perl_Client_CheckIncreaseSkill(Client* self, int skill_id, int chance_modifier) // @categories Skills and Recipes +{ + return self->CheckIncreaseSkill(static_cast(skill_id), nullptr, chance_modifier); +} + +void Perl_Client_SetLanguageSkill(Client* self, int language_id, int value) // @categories Account and Character, Skills and Recipes, Stats and Attributes +{ + self->SetLanguageSkill(language_id, value); +} + +int Perl_Client_MaxSkill(Client* self, uint16 skill_id) // @categories Skills and Recipes +{ + return self->MaxSkill(static_cast(skill_id), self->GetClass(), self->GetLevel()); +} + +int Perl_Client_MaxSkill(Client* self, uint16 skill_id, uint16 class_id) // @categories Skills and Recipes +{ + return self->MaxSkill(static_cast(skill_id), class_id, self->GetLevel()); +} + +int Perl_Client_MaxSkill(Client* self, uint16 skill_id, uint16 class_id, uint16 level) // @categories Skills and Recipes +{ + return self->MaxSkill(static_cast(skill_id), class_id, level); +} + +void Perl_Client_GMKill(Client* self) // @categories Script Utility +{ + self->GMKill(); +} + +bool Perl_Client_IsMedding(Client* self) // @categories Account and Character +{ + return self->IsMedding(); +} + +uint32_t Perl_Client_GetDuelTarget(Client* self) // @categories Account and Character, Script Utility +{ + return self->GetDuelTarget(); +} + +bool Perl_Client_IsDueling(Client* self) // @categories Account and Character +{ + return self->IsDueling(); +} + +void Perl_Client_SetDuelTarget(Client* self, uint32_t set_id) // @categories Account and Character +{ + self->SetDuelTarget(set_id); +} + +void Perl_Client_SetDueling(Client* self, bool duel) // @categories Account and Character, Script Utility +{ + self->SetDueling(duel); +} + +void Perl_Client_ResetAA(Client* self) // @categories Alternative Advancement +{ + self->ResetAA(); +} + +void Perl_Client_MemSpell(Client* self, uint16 spell_id, int slot) // @categories Spells and Disciplines +{ + self->MemSpell(spell_id, slot); +} + +void Perl_Client_MemSpell(Client* self, uint16 spell_id, int slot, bool update_client) // @categories Spells and Disciplines +{ + self->MemSpell(spell_id, slot, update_client); +} + +void Perl_Client_UnmemSpell(Client* self, int slot) // @categories Spells and Disciplines +{ + self->UnmemSpell(slot); +} + +void Perl_Client_UnmemSpell(Client* self, int slot, bool update_client) // @categories Spells and Disciplines +{ + self->UnmemSpell(slot, update_client); +} + +void Perl_Client_UnmemSpellBySpellID(Client* self, int spell_id) // @categories Spells and Disciplines +{ + self->UnmemSpellBySpellID(spell_id); +} + +void Perl_Client_UnmemSpellAll(Client* self) // @categories Spells and Disciplines +{ + self->UnmemSpellAll(); +} + +void Perl_Client_UnmemSpellAll(Client* self, bool update_client) // @categories Spells and Disciplines +{ + self->UnmemSpellAll(update_client); +} + +int Perl_Client_FindEmptyMemSlot(Client* self) // @categories Account and Character, Spells and Disciplines +{ + return self->FindEmptyMemSlot(); +} + +int Perl_Client_FindMemmedSpellBySlot(Client* self, int slot) // @categories Account and Character, Spells and Disciplines +{ + return self->FindMemmedSpellBySlot(slot); +} + +int Perl_Client_FindMemmedSpellBySpellID(Client* self, uint16 spell_id) // @categories Account and Character, Spells and Disciplines +{ + return self->FindMemmedSpellBySpellID(spell_id); +} + +int Perl_Client_MemmedCount(Client* self) // @categories Spells and Disciplines +{ + return self->MemmedCount(); +} + +void Perl_Client_ScribeSpell(Client* self, uint16 spell_id, int slot) // @categories Spells and Disciplines +{ + self->ScribeSpell(spell_id, slot); +} + +void Perl_Client_ScribeSpell(Client* self, uint16 spell_id, int slot, bool update_client) // @categories Spells and Disciplines +{ + self->ScribeSpell(spell_id, slot, update_client); +} + +void Perl_Client_UnscribeSpell(Client* self, int slot) // @categories Spells and Disciplines +{ + self->UnscribeSpell(slot); +} + +void Perl_Client_UnscribeSpell(Client* self, int slot, bool update_client) // @categories Spells and Disciplines +{ + self->UnscribeSpell(slot, update_client); +} + +void Perl_Client_UnscribeSpellAll(Client* self) +{ + self->UnscribeSpellAll(); +} + +void Perl_Client_UnscribeSpellAll(Client* self, bool update_client) +{ + self->UnscribeSpellAll(update_client); +} + +void Perl_Client_TrainDiscBySpellID(Client* self, int spell_id) // @categories Spells and Disciplines +{ + self->TrainDiscBySpellID(spell_id); +} + +int Perl_Client_GetDiscSlotBySpellID(Client* self, int spell_id) // @categories Spells and Disciplines +{ + return self->GetDiscSlotBySpellID(spell_id); +} + +void Perl_Client_UntrainDisc(Client* self, int slot) // @categories Spells and Disciplines +{ + self->UntrainDisc(slot); +} + +void Perl_Client_UntrainDisc(Client* self, int slot, bool update_client) // @categories Spells and Disciplines +{ + self->UntrainDisc(slot, update_client); +} + +void Perl_Client_UntrainDiscAll(Client* self) // @categories Spells and Disciplines +{ + self->UntrainDiscAll(); +} + +void Perl_Client_UntrainDiscAll(Client* self, bool update_client) // @categories Spells and Disciplines +{ + self->UntrainDiscAll(update_client); +} + +bool Perl_Client_IsStanding(Client* self) // @categories Account and Character +{ + return self->IsStanding(); +} + +void Perl_Client_Sit(Client* self) +{ + self->Sit(); +} + +bool Perl_Client_IsSitting(Client* self) // @categories Account and Character +{ + return self->IsSitting(); +} + +bool Perl_Client_IsCrouching(Client* self) // @categories Account and Character +{ + return self->IsCrouching(); +} + +bool Perl_Client_IsBecomeNPC(Client* self) // @categories Account and Character +{ + return self->IsBecomeNPC(); +} + +int Perl_Client_GetBecomeNPCLevel(Client* self) // @categories Experience and Level +{ + return self->GetBecomeNPCLevel(); +} + +void Perl_Client_SetBecomeNPC(Client* self, bool flag) // @categories Account and Character, Stats and Attributes +{ + self->SetBecomeNPC(flag); +} + +void Perl_Client_SetBecomeNPCLevel(Client* self, uint8 level) // @categories Account and Character, Stats and Attributes +{ + self->SetBecomeNPCLevel(level); +} + +void Perl_Client_SetFeigned(Client* self, bool feigned) // @categories Script Utility +{ + self->SetFeigned(feigned); +} + +bool Perl_Client_GetFeigned(Client* self) // @categories Script Utility +{ + return self->GetFeigned(); +} + +bool Perl_Client_AutoSplitEnabled(Client* self) // @categories Currency and Points +{ + return self->AutoSplitEnabled(); +} + +void Perl_Client_SetHorseId(Client* self, uint16_t horseid) // @categories Script Utility +{ + self->SetHorseId(horseid); +} + +int Perl_Client_GetHorseId(Client* self) // @categories Account and Character, Script Utility +{ + return self->GetHorseId(); +} + +uint32 Perl_Client_NukeItem(Client* self, uint32 item_id) // @categories Inventory and Items +{ + return self->NukeItem(item_id, 0xFF); +} + +uint32 Perl_Client_NukeItem(Client* self, uint32 item_id, uint8 slot_to_check) // @categories Inventory and Items +{ + return self->NukeItem(item_id, slot_to_check); +} + +void Perl_Client_SetTint(Client* self, int16 slot_id, uint32 color) // @categories Inventory and Items +{ + self->SetTint(slot_id, color); +} + +void Perl_Client_SetMaterial(Client* self, int16 slot_id, uint32 item_id) // @categories Inventory and Items +{ + self->SetMaterial(slot_id, item_id); +} + +void Perl_Client_Undye(Client* self) // @categories Script Utility +{ + self->Undye(); +} + +int Perl_Client_GetItemIDAt(Client* self, int16 slot_id) // @categories Inventory and Items +{ + return self->GetItemIDAt(slot_id); +} + +int Perl_Client_GetAugmentIDAt(Client* self, int16 slot_id, uint8 aug_slot) // @categories Inventory and Items +{ + return self->GetAugmentIDAt(slot_id, aug_slot); +} + +void Perl_Client_DeleteItemInInventory(Client* self, int16 slot_id) // @categories Inventory and Items +{ + self->DeleteItemInInventory(slot_id); +} + +void Perl_Client_DeleteItemInInventory(Client* self, int16 slot_id, int16 quantity) // @categories Inventory and Items +{ + self->DeleteItemInInventory(slot_id, quantity); +} + +void Perl_Client_DeleteItemInInventory(Client* self, int16 slot_id, int16 quantity, bool client_update) // @categories Inventory and Items +{ + self->DeleteItemInInventory(slot_id, quantity, client_update); +} + +void Perl_Client_SummonItem(Client* self, uint32 item_id) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id); +} + +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges); } -XS(XS_Client_GetFeigned); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetFeigned) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetFeigned(THIS)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetFeigned(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, 0, 0, 0, 0, 0, 0, attune); } -XS(XS_Client_AutoSplitEnabled); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AutoSplitEnabled) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::AutoSplitEnabled(THIS)"); // @categories Currency and Points - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->AutoSplitEnabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, 0, 0, 0, 0, 0, attune); } -XS(XS_Client_SetHorseId); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetHorseId) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetHorseId(THIS, horseid_in)"); // @categories Script Utility - { - Client *THIS; - uint16 horseid_in = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetHorseId(horseid_in); - } - XSRETURN_EMPTY; +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1, uint32 aug2) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, aug2, 0, 0, 0, 0, attune); } -XS(XS_Client_GetHorseId); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetHorseId) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetHorseId(THIS)"); // @categories Account and Character, Script Utility - { - Client *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetHorseId(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1, uint32 aug2, uint32 aug3) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, aug2, aug3, 0, 0, 0, attune); } -XS(XS_Client_NukeItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_NukeItem) { - dXSARGS; - if (items != 3 && items != 2) - Perl_croak(aTHX_ "Usage: Client::NukeItem(THIS, uint32 item_id, [uint8 slot_to_check])"); // @categories Inventory and Items - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - uint32 itemnum = (uint32) SvUV(ST(1)); - uint8 where_to_check; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) { - where_to_check = 0xFF; - } - if (items == 3) { - where_to_check = (uint8) SvUV(ST(2)); - } - - RETVAL = THIS->NukeItem(itemnum, where_to_check); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, 0, 0, attune); } -XS(XS_Client_SetTint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetTint) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetTint(THIS, int16 slot_id, uint32 color)"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - uint32 color = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetTint(slot_id, color); - } - XSRETURN_EMPTY; +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune); } -XS(XS_Client_SetMaterial); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetMaterial) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetMaterial(THIS, int16 slot_id, uint32 item_id)"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - uint32 item_id = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetMaterial(slot_id, item_id); - } - XSRETURN_EMPTY; +void Perl_Client_SummonItem(Client* self, uint32 item_id, int16 charges, bool attune, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint16 slot_id) // @categories Inventory and Items, Script Utility +{ + self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune, slot_id); } -XS(XS_Client_Undye); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Undye) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Undye(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Undye(); - } - XSRETURN_EMPTY; +void Perl_Client_SetStats(Client* self, uint8 type, uint16 increase_val) // @categories Account and Character, Stats and Attributes +{ + self->SetStats(type, increase_val); } -XS(XS_Client_GetItemIDAt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetItemIDAt) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetItemIDAt(THIS, int16 slot_id)"); // @categories Inventory and Items - { - Client *THIS; - int32 RETVAL; - dXSTARG; - int16 slot_id = (int16) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetItemIDAt(slot_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_IncStats(Client* self, uint8 type, uint16 increase_val) // @categories Account and Character, Stats and Attributes +{ + self->IncStats(type, increase_val); } -XS(XS_Client_GetAugmentIDAt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAugmentIDAt) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::GetAugmentIDAt(THIS, int16 slot_id, int16 aug_slot)"); // @categories Inventory and Items - { - Client *THIS; - int32 RETVAL; - dXSTARG; - int16 slot_id = (int16) SvIV(ST(1)); - int16 augslot = (uint8) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAugmentIDAt(slot_id, augslot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_DropItem(Client* self, int16 slot_id) // @categories Inventory and Items +{ + self->DropItem(slot_id); } -XS(XS_Client_DeleteItemInInventory); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DeleteItemInInventory) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int16 quantity = 0], [bool client_update = false])"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - int16 quantity; - bool client_update; - VALIDATE_THIS_IS_CLIENT; - if (items < 3) - quantity = 0; - else { - quantity = (int16) SvIV(ST(2)); - } - - if (items < 4) - client_update = false; - else { - client_update = (bool) SvTRUE(ST(3)); - } - - THIS->DeleteItemInInventory(slot_id, quantity, client_update); - } - XSRETURN_EMPTY; +void Perl_Client_BreakInvis(Client* self) // @categories Spells and Disciplines, Script Utility +{ + self->BreakInvis(); } -XS(XS_Client_SummonItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SummonItem) { - dXSARGS; - if (items < 2 || items > 10) - Perl_croak(aTHX_ "Usage: Client::SummonItem(THIS, uint32 item_id, [int16 charges = -1], [bool attune = false], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint16 slot_id = cursor])"); // @categories Inventory and Items, Script Utility - { - Client *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - int16 charges = -1; - bool attune = false; - uint32 aug1 = 0; - uint32 aug2 = 0; - uint32 aug3 = 0; - uint32 aug4 = 0; - uint32 aug5 = 0; - uint16 slot_id = EQ::invslot::slotCursor; - VALIDATE_THIS_IS_CLIENT; - if (items > 2) { - charges = (int16) SvIV(ST(2)); - } - if (items > 3) { - attune = (bool) SvTRUE(ST(3)); - } - if (items > 4) { - aug1 = (uint32) SvUV(ST(4)); - } - if (items > 5) { - aug2 = (uint32) SvUV(ST(5)); - } - if (items > 6) { - aug3 = (uint32) SvUV(ST(6)); - } - if (items > 7) { - aug4 = (uint32) SvUV(ST(7)); - } - if (items > 8) { - aug5 = (uint32) SvUV(ST(8)); - } - if (items > 9) { - slot_id = (uint16) SvUV(ST(9)); - } - - THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune, slot_id); - } - XSRETURN_EMPTY; +Group* Perl_Client_GetGroup(Client* self) // @categories Account and Character, Group +{ + return self->GetGroup(); } -XS(XS_Client_SetStats); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetStats) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetStats(THIS, uint8 type, uint16 increase_val)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 type = (uint8) SvUV(ST(1)); - int16 increase_val = (int16) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetStats(type, increase_val); - } - XSRETURN_EMPTY; +void Perl_Client_LeaveGroup(Client* self) // @categories Account and Character, Group +{ + self->LeaveGroup(); } -XS(XS_Client_IncStats); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IncStats) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::IncStats(THIS, uint8 type, uint16 increase_val)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint8 type = (uint8) SvUV(ST(1)); - int16 increase_val = (int16) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->IncStats(type, increase_val); - } - XSRETURN_EMPTY; +Raid* Perl_Client_GetRaid(Client* self) // @categories Account and Character, Raid +{ + return self->GetRaid(); } -XS(XS_Client_DropItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DropItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::DropItem(THIS, int16 slot_id)"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->DropItem(slot_id); - } - XSRETURN_EMPTY; +bool Perl_Client_IsGrouped(Client* self) // @categories Account and Character, Group +{ + return self->IsGrouped(); } -XS(XS_Client_BreakInvis); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_BreakInvis) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::BreakInvis(THIS)"); // @categories Spells and Disciplines, Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->BreakInvis(); - } - XSRETURN_EMPTY; +bool Perl_Client_IsRaidGrouped(Client* self) // @categories Account and Character, Group, Raid +{ + return self->IsRaidGrouped(); } -XS(XS_Client_GetGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetGroup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetGroup(THIS)"); // @categories Account and Character, Group - { - Client *THIS; - Group *RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetGroup(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Group", (void *) RETVAL); - } - XSRETURN(1); +bool Perl_Client_Hungry(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->Hungry(); } -XS(XS_Client_LeaveGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_LeaveGroup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::LeaveGroup(THIS)"); // @categories Account and Character, Group - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->LeaveGroup(); - } - XSRETURN_EMPTY; +bool Perl_Client_Thirsty(Client* self) // @categories Script Utility +{ + return self->Thirsty(); } -XS(XS_Client_GetRaid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetRaid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetRaid(THIS)"); // @categories Account and Character, Raid - { - Client *THIS; - Raid *RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetRaid(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Raid", (void *) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetInstrumentMod(Client* self, uint16 spell_id) // @categories Spells and Disciplines +{ + return self->GetInstrumentMod(spell_id); } -XS(XS_Client_IsGrouped); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsGrouped) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsGrouped(THIS)"); // @categories Account and Character, Group - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsGrouped(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Client_DecreaseByID(Client* self, uint32 type, int16 quantity) // @categories Script Utility +{ + return self->DecreaseByID(type, quantity); } -XS(XS_Client_IsRaidGrouped); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsRaidGrouped) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::IsRaidGrouped(THIS)"); // @categories Account and Character, Group, Raid - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsRaidGrouped(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Client_SlotConvert2(Client* self, uint8 slot) // @categories Inventory and Items +{ + return self->SlotConvert2(slot); } -XS(XS_Client_Hungry); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Hungry) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Hungry(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->Hungry(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_Escape(Client* self) // @categories Account and Character, Skills and Recipes +{ + self->Escape(); } -XS(XS_Client_Thirsty); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Thirsty) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Thirsty(THIS)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->Thirsty(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_RemoveNoRent(Client* self) // @categories Inventory and Items +{ + self->RemoveNoRent(); } -XS(XS_Client_GetInstrumentMod); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetInstrumentMod) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetInstrumentMod(THIS, uint16 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - uint16 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetInstrumentMod(spell_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_GoFish(Client* self) // @categories Skills and Recipes +{ + self->GoFish(); } -XS(XS_Client_DecreaseByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DecreaseByID) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::DecreaseByID(THIS, uint32 type, int16 quantity)"); // @categories Script Utility - { - Client *THIS; - bool RETVAL; - uint32 type = (uint32) SvUV(ST(1)); - int16 quantity = (int16) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->DecreaseByID(type, quantity); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_ForageItem(Client* self) // @categories Skills and Recipes +{ + self->ForageItem(); } -XS(XS_Client_SlotConvert2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SlotConvert2) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SlotConvert2(THIS, uint8 slot)"); // @categories Inventory and Items - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - uint8 slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->SlotConvert2(slot); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +float Perl_Client_CalcPriceMod(Client* self) // @categories Currency and Points +{ + return self->CalcPriceMod(); } -XS(XS_Client_Escape); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Escape) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Escape(THIS)"); // @categories Account and Character, Skills and Recipes - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->Escape(); - } - XSRETURN_EMPTY; +float Perl_Client_CalcPriceMod(Client* self, Mob* other) // @categories Currency and Points +{ + return self->CalcPriceMod(other); } -XS(XS_Client_RemoveNoRent); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_RemoveNoRent) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::RemoveNoRent(THIS)"); // @categories Inventory and Items - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->RemoveNoRent(); - } - XSRETURN_EMPTY; +float Perl_Client_CalcPriceMod(Client* self, Mob* other, bool reverse) // @categories Currency and Points +{ + return self->CalcPriceMod(other, reverse); } -XS(XS_Client_GoFish); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GoFish) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GoFish(THIS)"); // @categories Skills and Recipes - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->GoFish(); - } - XSRETURN_EMPTY; +void Perl_Client_ResetTrade(Client* self) // @categories Script Utility +{ + self->ResetTrade(); } -XS(XS_Client_ForageItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ForageItem) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ForageItem(THIS)"); // @categories Skills and Recipes - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->ForageItem(); - } - XSRETURN_EMPTY; +bool Perl_Client_UseDiscipline(Client* self, uint32 spell_id, uint32 target) // @categories Spells and Disciplines +{ + return self->UseDiscipline(spell_id, target); } -XS(XS_Client_CalcPriceMod); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CalcPriceMod) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: Client::CalcPriceMod(THIS, Mob*, [bool reverse = false])"); // @categories Currency and Points - { - Client *THIS; - float RETVAL; - dXSTARG; - Mob *other; - bool reverse; - VALIDATE_THIS_IS_CLIENT; - if (items < 2) - other = 0; - else { - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - } - - if (items < 3) - reverse = false; - else { - reverse = (bool) SvTRUE(ST(2)); - } - - RETVAL = THIS->CalcPriceMod(other, reverse); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetDisciplineTimer(Client* self, uint32 timer_id) // @categories Spells and Disciplines +{ + return self->GetDisciplineTimer(timer_id); } -XS(XS_Client_ResetTrade); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ResetTrade) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ResetTrade(THIS)"); // @categories Script Utility - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->ResetTrade(); - } - XSRETURN_EMPTY; +void Perl_Client_ResetDisciplineTimer(Client* self, uint32_t timer_id) // @categories Spells and Disciplines +{ + self->ResetDisciplineTimer(timer_id); } -XS(XS_Client_UseDiscipline); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UseDiscipline) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::UseDiscipline(THIS, int32 spell_id, int32 target)"); // @categories Spells and Disciplines - { - Client *THIS; - bool RETVAL; - uint32 spell_id = (uint32) SvUV(ST(1)); - uint32 target = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->UseDiscipline(spell_id, target); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Client_GetCharacterFactionLevel(Client* self, int faction_id) // @categories Faction +{ + return self->GetCharacterFactionLevel(faction_id); } -XS(XS_Client_GetDisciplineTimer); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetDisciplineTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetDisciplineTimer(THIS, uint32 timer_id)"); // @categories Spells and Disciplines - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - uint32 timer_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetDisciplineTimer(timer_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetZoneFlag(Client* self, uint32 zone_id) // @categories Account and Character, Zones +{ + self->SetZoneFlag(zone_id); } -XS(XS_Client_ResetDisciplineTimer); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ResetDisciplineTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ResetDisciplineTimer(THIS, uint32 timer_id)"); // @categories Spells and Disciplines - { - Client *THIS; - uint32 timer_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ResetDisciplineTimer(timer_id); - } - XSRETURN_EMPTY; +void Perl_Client_ClearZoneFlag(Client* self, uint32 zone_id) // @categories Script Utility +{ + self->ClearZoneFlag(zone_id); } -XS(XS_Client_GetCharacterFactionLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCharacterFactionLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetCharacterFactionLevel(THIS, int32 faction_id)"); // @categories Faction - { - Client *THIS; - int32 RETVAL; - dXSTARG; - int32 faction_id = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCharacterFactionLevel(faction_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +bool Perl_Client_HasZoneFlag(Client* self, uint32 zone_id) // @categories Account and Character +{ + return self->HasZoneFlag(zone_id); } -XS(XS_Client_SetZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetZoneFlag(THIS, uint32 zone_id)"); // @categories Account and Character, Zones - { - Client *THIS; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetZoneFlag(zone_id); - } - XSRETURN_EMPTY; +void Perl_Client_SendZoneFlagInfo(Client* self, Client* to) // @categories Account and Character, Zones +{ + self->SendZoneFlagInfo(to); } -XS(XS_Client_ClearZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ClearZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ClearZoneFlag(THIS, uint32 zone_id)"); // @categories Script Utility - { - Client *THIS; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ClearZoneFlag(zone_id); - } - XSRETURN_EMPTY; +void Perl_Client_LoadZoneFlags(Client* self) // @categories Zones +{ + self->LoadZoneFlags(); } -XS(XS_Client_HasZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_HasZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasZoneFlag(THIS, uint32 zone_id)"); // @categories Account and Character +void Perl_Client_SetAATitle(Client* self, std::string title) // @categories Alternative Advancement +{ + if (title.size() > 31) { - Client *THIS; - bool RETVAL; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->HasZoneFlag(zone_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); + throw std::runtime_error("Title must be 31 characters or less."); } - XSRETURN(1); + + self->SetAATitle(title); } -XS(XS_Client_SendZoneFlagInfo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendZoneFlagInfo) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SendZoneFlagInfo(THIS, Client* to)"); // @categories Account and Character, Zones +void Perl_Client_SetAATitle(Client* self, std::string title, bool save) // @categories Alternative Advancement +{ + if (title.size() > 31) { - Client *THIS; - Client *to; - VALIDATE_THIS_IS_CLIENT; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - to = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "to is not of type Client"); - if (to == nullptr) - Perl_croak(aTHX_ "to is nullptr, avoiding crash."); - - THIS->SendZoneFlagInfo(to); + throw std::runtime_error("Title must be 31 characters or less."); } - XSRETURN_EMPTY; -} -XS(XS_Client_LoadZoneFlags); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_LoadZoneFlags) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::LoadZoneFlags(THIS)"); // @categories Zones - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->LoadZoneFlags(); + if (!save) { + self->SetAATitle(title); + } else { + title_manager.CreateNewPlayerTitle(self, title); } - XSRETURN_EMPTY; } -XS(XS_Client_SetAATitle); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetAATitle) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::SetAATitle(THIS, string text, [bool save = false])"); // @categories Alternative Advancement - { - Client *THIS; - std::string title = (std::string) SvPV_nolen(ST(1)); - bool save = false; - VALIDATE_THIS_IS_CLIENT; - - if (title.size() > 31) { - Perl_croak(aTHX_ "Title must be 31 characters or less."); - } - - if (items == 3) { - save = (bool) SvTRUE(ST(2)); - } - - if (!save) { - THIS->SetAATitle(title); - } else { - title_manager.CreateNewPlayerTitle(THIS, title); - } - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetClientVersion(Client* self) // @categories Script Utility +{ + return static_cast(self->ClientVersion()); } -XS(XS_Client_GetClientVersion); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetClientVersion) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetClientVersion(THIS)"); // @categories Script Utility - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = static_cast(THIS->ClientVersion()); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetClientVersionBit(Client* self) // @categories Script Utility +{ + return self->ClientVersionBit(); } -XS(XS_Client_GetClientVersionBit); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetClientVersionBit) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetClientVersionBit(THIS)"); // @categories Script Utility +void Perl_Client_SetTitleSuffix(Client* self, std::string suffix) // @categories Account and Character +{ + if (suffix.size() > 31) { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->ClientVersionBit(); - XSprePUSH; - PUSHu((UV) RETVAL); + throw std::runtime_error("Suffix must be 31 characters or less."); } - XSRETURN(1); + + self->SetTitleSuffix(suffix); } -XS(XS_Client_SetTitleSuffix); -XS(XS_Client_SetTitleSuffix) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::SetTitleSuffix(THIS, string suffix, [bool save = false])"); // @categories Account and Character +void Perl_Client_SetTitleSuffix(Client* self, std::string suffix, bool save) // @categories Account and Character +{ + if (suffix.size() > 31) { - Client *THIS; - std::string suffix = (std::string) SvPV_nolen(ST(1)); - bool save = false; - VALIDATE_THIS_IS_CLIENT; - - if (suffix.size() > 31) { - Perl_croak(aTHX_ "Suffix must be 31 characters or less."); - } - - if (items == 3) { - save = (bool) SvTRUE(ST(2)); - } - - if (!save) { - THIS->SetTitleSuffix(suffix); - } else { - title_manager.CreateNewPlayerSuffix(THIS, suffix); - } + throw std::runtime_error("Suffix must be 31 characters or less."); } - XSRETURN_EMPTY; -} -XS(XS_Client_SetAAPoints); -XS(XS_Client_SetAAPoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetAAPoints(THIS, uint32 points)"); // @categories Alternative Advancement - { - Client *THIS; - uint32 points = SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAAPoints(points); + if (!save) { + self->SetTitleSuffix(suffix); + } else { + title_manager.CreateNewPlayerSuffix(self, suffix); } - XSRETURN_EMPTY; } -XS(XS_Client_GetAAPoints); -XS(XS_Client_GetAAPoints) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAAPoints(THIS)"); // @categories Alternative Advancement, Experience and Level - dXSTARG; - { - Client *THIS; - uint32 RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAAPoints(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetAAPoints(Client* self, uint32 points) // @categories Alternative Advancement +{ + return self->SetAAPoints(points); } -XS(XS_Client_GetSpentAA); -XS(XS_Client_GetSpentAA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetSpentAA(THIS)"); // @categories Alternative Advancement - dXSTARG; - { - Client *THIS; - uint32 RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetSpentAA(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetAAPoints(Client* self) // @categories Alternative Advancement, Experience and Level +{ + return self->GetAAPoints(); } -XS(XS_Client_AddAAPoints); -XS(XS_Client_AddAAPoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::AddAAPoints(THIS, uint32 points)"); // @categories Alternative Advancement - { - Client *THIS; - uint32 points = SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->AddAAPoints(points); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetSpentAA(Client* self) // @categories Alternative Advancement +{ + return self->GetSpentAA(); } -XS(XS_Client_RefundAA); -XS(XS_Client_RefundAA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::RefundAA(THIS)"); // @categories Alternative Advancement - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->RefundAA(); - } - XSRETURN_EMPTY; +void Perl_Client_AddAAPoints(Client* self, uint32 points) // @categories Alternative Advancement +{ + self->AddAAPoints(points); } -XS(XS_Client_GetModCharacterFactionLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetModCharacterFactionLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetModCharacterFactionLevel(THIS, int32 faction_id)"); // @categories Faction - { - Client *THIS; - int32 RETVAL; - dXSTARG; - int32 faction_id = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetModCharacterFactionLevel(faction_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_RefundAA(Client* self) // @categories Alternative Advancement +{ + self->RefundAA(); } -XS(XS_Client_GetLDoNWins); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLDoNWins) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetLDoNWins(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLDoNWins(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetModCharacterFactionLevel(Client* self, int faction_id) // @categories Faction +{ + return self->GetModCharacterFactionLevel(faction_id); } -XS(XS_Client_GetLDoNLosses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLDoNLosses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetLDoNLosses(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLDoNLosses(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetLDoNWins(Client* self) // @categories Currency and Points +{ + return self->GetLDoNWins(); } -XS(XS_Client_GetLDoNWinsTheme); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLDoNWinsTheme) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetLDoNWinsTheme(THIS, int32 theme)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - int32 theme_out = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLDoNWinsTheme(theme_out); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetLDoNLosses(Client* self) // @categories Currency and Points +{ + return self->GetLDoNLosses(); } -XS(XS_Client_GetLDoNLossesTheme); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetLDoNLossesTheme) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetLDoNLossesTheme(THIS, int32 theme)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - int32 theme_out = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetLDoNLossesTheme(theme_out); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetLDoNWinsTheme(Client* self, uint32_t theme) // @categories Currency and Points +{ + return self->GetLDoNWinsTheme(theme); } -XS(XS_Client_GetItemAt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetItemAt) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetItemAt(THIS, uint32 slot)"); // @categories Inventory and Items - { - Client *THIS; - EQ::ItemInstance *RETVAL; - uint32 slot = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetInv().GetItem(slot); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetLDoNLossesTheme(Client* self, uint32_t theme) // @categories Currency and Points +{ + return self->GetLDoNLossesTheme(theme); } -XS(XS_Client_GetAugmentAt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAugmentAt) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::GetAugmentAt(THIS, uint32 slot, uint32 aug_slot)"); // @categories Inventory and Items - { - Client *THIS; - EQ::ItemInstance *RETVAL; - uint32 slot = (int32) SvIV(ST(1)); - uint32 aug_slot = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - EQ::ItemInstance *inst = THIS->GetInv().GetItem(slot); - if (inst) { - RETVAL = inst->GetAugment(aug_slot); - } else { - RETVAL = nullptr; - } - - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL); - } - XSRETURN(1); +EQ::ItemInstance* Perl_Client_GetItemAt(Client* self, uint32 slot) // @categories Inventory and Items +{ + return self->GetInv().GetItem(slot); } -XS(XS_Client_GetStartZone); -XS(XS_Client_GetStartZone) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetStartZone(THIS)"); // @categories Account and Character +EQ::ItemInstance* Perl_Client_GetAugmentAt(Client* self, uint32 slot, uint32 aug_slot) // @categories Inventory and Items +{ + EQ::ItemInstance* inst = self->GetInv().GetItem(slot); + if (inst) { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetStartZone(); - XSprePUSH; - PUSHu((UV) RETVAL); + return inst->GetAugment(aug_slot); } - XSRETURN(1); + return nullptr; } -XS(XS_Client_SetStartZone); -XS(XS_Client_SetStartZone) { - dXSARGS; - if (items != 2 && items != 5 && items != 6) - Perl_croak(aTHX_ "Usage: Client::SetStartZone(THIS, uint32 zone_id, [float x = 0, float y = 0, float z = 0, [float heading = 0]])"); - { - Client *THIS; - uint32 zoneid = (uint32) SvUV(ST(1)); - float x = 0.0f, y = 0.0f, z = 0.0f, heading = 0.0f; - VALIDATE_THIS_IS_CLIENT; - if (items == 5) { - x = (float) SvNV(ST(2)); - y = (float) SvNV(ST(3)); - z = (float) SvNV(ST(4)); - } - if (items == 6) - heading = (float) SvNV(ST(5)); - - THIS->SetStartZone(zoneid, x, y, z, heading); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetStartZone(Client* self) // @categories Account and Character +{ + return self->GetStartZone(); } -XS(XS_Client_KeyRingAdd); -XS(XS_Client_KeyRingAdd) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::KeyRingAdd(THIS, uint32 item_id)"); // @categories Account and Character, Inventory and Items - { - Client *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->KeyRingAdd(item_id);; - } - XSRETURN_EMPTY; +void Perl_Client_SetStartZone(Client* self, uint32 zone_id) +{ + self->SetStartZone(zone_id); } -XS(XS_Client_KeyRingCheck); -XS(XS_Client_KeyRingCheck) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::KeyRingCheck(THIS, uint32 item_id)"); // @categories Account and Character, Inventory and Items - { - Client *THIS; - bool RETVAL; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->KeyRingCheck(item_id);; - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_SetStartZone(Client* self, uint32 zone_id, float x, float y, float z) +{ + self->SetStartZone(zone_id, x, y, z); } -XS(XS_Client_AddPVPPoints); -XS(XS_Client_AddPVPPoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::AddPVPPoints(THIS, uint32 points)"); // @categories Currency and Points - { - Client *THIS; - uint32 Points = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->AddPVPPoints(Points); - } - XSRETURN_EMPTY; +void Perl_Client_SetStartZone(Client* self, uint32 zone_id, float x, float y, float z, float heading) +{ + self->SetStartZone(zone_id, x, y, z, heading); } -XS(XS_Client_AddCrystals); -XS(XS_Client_AddCrystals) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::AddCrystals(THIS, uint32 radiant_count, uint32 ebon_count)"); // @categories Currency and Points - { - Client *THIS; - uint32 Radiant = (uint32) SvUV(ST(1)); - uint32 Ebon = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->AddCrystals(Radiant, Ebon); - } - XSRETURN_EMPTY; +void Perl_Client_KeyRingAdd(Client* self, uint32 item_id) // @categories Account and Character, Inventory and Items +{ + self->KeyRingAdd(item_id);; } -XS(XS_Client_SetEbonCrystals); -XS(XS_Client_SetEbonCrystals) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetEbonCrystals(THIS, uint32 value)"); - { - Client *THIS; - uint32 value = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetEbonCrystals(value); - } - XSRETURN_EMPTY; +bool Perl_Client_KeyRingCheck(Client* self, uint32 item_id) // @categories Account and Character, Inventory and Items +{ + return self->KeyRingCheck(item_id); } -XS(XS_Client_SetRadiantCrystals); -XS(XS_Client_SetRadiantCrystals) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetRadiantCrystals(THIS, uint32 value)"); - { - Client *THIS; - uint32 value = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetRadiantCrystals(value); - } - XSRETURN_EMPTY; +void Perl_Client_AddPVPPoints(Client* self, uint32 points) // @categories Currency and Points +{ + self->AddPVPPoints(points);; } -XS(XS_Client_GetPVPPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetPVPPoints) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetPVPPoints(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetPVPPoints(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_AddCrystals(Client* self, uint32 radiant_count, uint32 ebon_count) // @categories Currency and Points +{ + self->AddCrystals(radiant_count, ebon_count); } -XS(XS_Client_GetRadiantCrystals); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetRadiantCrystals) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetRadiantCrystals(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetRadiantCrystals(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetEbonCrystals(Client* self, uint32 value) +{ + self->SetEbonCrystals(value); } -XS(XS_Client_GetEbonCrystals); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetEbonCrystals) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetEbonCrystals(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetEbonCrystals(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetRadiantCrystals(Client* self, uint32 value) +{ + self->SetRadiantCrystals(value); } -XS(XS_Client_ReadBook); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ReadBook) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::ReadBook(THIS, char* book_test, uint8 type)"); // @categories Script Utility - { - Client *THIS; - char *in_txt = (char *) SvPV_nolen(ST(1)); - uint8 type = (uint8) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->QuestReadBook(in_txt, type); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetPVPPoints(Client* self) // @categories Currency and Points +{ + return self->GetPVPPoints(); } -XS(XS_Client_SetGMStatus); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetGMStatus) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetGMStatus(THIS, int newStatus)"); // @categories Script Utility - { - Client *THIS; - int newStatus = (int)SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetGMStatus(newStatus); - THIS->UpdateAdmin(true); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetRadiantCrystals(Client* self) // @categories Currency and Points +{ + return self->GetRadiantCrystals(); } -XS(XS_Client_UpdateGroupAAs); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UpdateGroupAAs) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::UpdateGroupAAs(THIS, int32 points, uint32 type)"); // @categories Alternative Advancement, Group - { - Client *THIS; - int32 points = (int32) SvIV(ST(1)); - uint32 type = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateGroupAAs(points, type); - } - XSRETURN(1); +uint32_t Perl_Client_GetEbonCrystals(Client* self) // @categories Currency and Points +{ + return self->GetEbonCrystals(); } -XS(XS_Client_GetGroupPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetGroupPoints) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetGroupPoints(THIS)"); // @categories Account and Character, Group - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetGroupPoints(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_ReadBook(Client* self, const char* book_text, uint8 type) // @categories Script Utility +{ + self->QuestReadBook(book_text, type); } -XS(XS_Client_GetRaidPoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetRaidPoints) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetRaidPoints(THIS)"); // @categories Account and Character, Raid - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetRaidPoints(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetGMStatus(Client* self, int new_status) // @categories Script Utility +{ + self->SetGMStatus(new_status); + self->UpdateAdmin(true); } -XS(XS_Client_LearnRecipe); -XS(XS_Client_LearnRecipe) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::LearnRecipe(THIS, uint32 recipe_id)"); // @categories Skills and Recipes - { - Client *THIS; - uint32 recipe_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->LearnRecipe(recipe_id);; - } - XSRETURN_EMPTY; +void Perl_Client_UpdateGroupAAs(Client* self, int points, uint32 type) // @categories Alternative Advancement, Group +{ + self->UpdateGroupAAs(points, type); } -XS(XS_Client_GetEndurance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetEndurance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetEndurance(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetEndurance(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetGroupPoints(Client* self) // @categories Account and Character, Group +{ + return self->GetGroupPoints(); } -XS(XS_Client_GetMaxEndurance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetMaxEndurance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetMaxEndurance(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetMaxEndurance(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetRaidPoints(Client* self) // @categories Account and Character, Raid +{ + return self->GetRaidPoints(); } -XS(XS_Client_GetEnduranceRatio); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetEnduranceRatio) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetEnduranceRatio(THIS)"); // @categories Stats and Attributes - { - Client *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetEndurancePercent(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_LearnRecipe(Client* self, uint32 recipe_id) // @categories Skills and Recipes +{ + self->LearnRecipe(recipe_id); } -XS(XS_Client_SetEndurance); -XS(XS_Client_SetEndurance) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetEndurance(THIS, Endurance)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - int32 Endurance = (int32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetEndurance(Endurance); - } - XSRETURN_EMPTY; +int64_t Perl_Client_GetEndurance(Client* self) // @categories Stats and Attributes +{ + return self->GetEndurance(); } -XS(XS_Client_SendOPTranslocateConfirm); -XS(XS_Client_SendOPTranslocateConfirm) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SendOPTranslocateConfirm(THIS, Mob* caster, int32 spell_id)"); // @categories Script Utility - { - Client *THIS; - Mob *caster = nullptr; - int32 spell_id = (int32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - THIS->SendOPTranslocateConfirm(caster, spell_id); - } - XSRETURN_EMPTY; +int64_t Perl_Client_GetMaxEndurance(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetMaxEndurance(); } -XS(XS_Client_NPCSpawn); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_NPCSpawn) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Client::NPCSpawn(THIS, NPC*, string option, uint32 respawn_time=1200)"); // @categories Script Utility, Spawns - { - Client *THIS; - NPC *target_npc = nullptr; - Const_char *option = (Const_char *) SvPV_nolen(ST(2)); - uint32 respawntime = 1200; - VALIDATE_THIS_IS_CLIENT; - if (sv_derived_from(ST(1), "NPC")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target_npc = INT2PTR(NPC *, tmp); - } else - Perl_croak(aTHX_ "THIS is not of type NPC"); - if (target_npc == nullptr) - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - - if (items > 3) - respawntime = (uint32) SvUV(ST(3)); - - THIS->NPCSpawn(target_npc, option, respawntime); - } - XSRETURN_EMPTY; +int Perl_Client_GetEnduranceRatio(Client* self) // @categories Stats and Attributes +{ + return self->GetEndurancePercent(); } -XS(XS_Client_GetIP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetIP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetIP(THIS)"); // @categories Script Utility - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetIP(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetEndurance(Client* self, int endurance) // @categories Account and Character, Stats and Attributes +{ + self->SetEndurance(endurance); } -XS(XS_Client_AddLevelBasedExp); -XS(XS_Client_AddLevelBasedExp) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Client::AddLevelBasedExp(THIS, uint8 exp_percentage, uint8 max_level = 0, bool ignore_mods = false)"); // @categories Experience and Level - { - Client *THIS; - uint8 exp_percentage = (uint8) SvUV(ST(1)); - uint8 max_level = 0; - bool ignore_mods = false; - VALIDATE_THIS_IS_CLIENT; - if (items > 2) - max_level = (uint8) SvUV(ST(2)); - - if (items > 3) - ignore_mods = (bool) SvTRUE(ST(3)); - - THIS->AddLevelBasedExp(exp_percentage, max_level, ignore_mods); - } - XSRETURN_EMPTY; +void Perl_Client_SendOPTranslocateConfirm(Client* self, Mob* caster, uint16 spell_id) // @categories Script Utility +{ + self->SendOPTranslocateConfirm(caster, spell_id); } -XS(XS_Client_IncrementAA); -XS(XS_Client_IncrementAA) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::IncrementAA(THIS, uint32 aa_skill_id)"); // @categories Alternative Advancement - { - Client *THIS; - uint32 aaskillid = SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->IncrementAlternateAdvancementRank(aaskillid); - } - XSRETURN_EMPTY; +void Perl_Client_NPCSpawn(Client* self, NPC* target_npc, const char* option) // @categories Script Utility, Spawns +{ + return self->NPCSpawn(target_npc, option, 1200); } -XS(XS_Client_GrantAlternateAdvancementAbility); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GrantAlternateAdvancementAbility) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Client::GrantAlternateAdvancementAbility(THIS, int aa_id, int points, [bool ignore_cost = false])"); // @categories Alternative Advancement - { - Client *THIS; - bool RETVAL; - int aa_id = (int) SvIV(ST(1)); - int points = (int) SvIV(ST(2)); - bool ignore_cost = false; - VALIDATE_THIS_IS_CLIENT; - if (items > 3) { - ignore_cost = (bool) SvTRUE(ST(3)); - } - - RETVAL = THIS->GrantAlternateAdvancementAbility(aa_id, points, ignore_cost); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_NPCSpawn(Client* self, NPC* target_npc, const char* option, uint32 respawn_time) // @categories Script Utility, Spawns +{ + return self->NPCSpawn(target_npc, option, respawn_time); } -XS(XS_Client_GetAALevel); -XS(XS_Client_GetAALevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetAALevel(THIS, uint32 aa_skill_id)"); // @categories Alternative Advancement, Experience and Level - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - uint32 aaskillid = SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAA(aaskillid); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Client_GetIP(Client* self) // @categories Script Utility +{ + return self->GetIP(); } -XS(XS_Client_MarkCompassLoc); -XS(XS_Client_MarkCompassLoc) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Client::MarkCompassLoc(THIS, float x, float y, float z)"); // @categories Adventures and Expeditions - { - Client *THIS; - float x = SvNV(ST(1)); - float y = SvNV(ST(2)); - float z = SvNV(ST(3)); - VALIDATE_THIS_IS_CLIENT; - THIS->MarkSingleCompassLoc(x, y, z); - } - XSRETURN_EMPTY; +void Perl_Client_AddLevelBasedExp(Client* self, uint8 exp_percentage) // @categories Experience and Level +{ + self->AddLevelBasedExp(exp_percentage); } -XS(XS_Client_ClearCompassMark); -XS(XS_Client_ClearCompassMark) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ClearCompassMark(THIS)"); // @categories Adventures and Expeditions - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->MarkSingleCompassLoc(0, 0, 0, 0); - } - XSRETURN_EMPTY; +void Perl_Client_AddLevelBasedExp(Client* self, uint8 exp_percentage, uint8 max_level) // @categories Experience and Level +{ + self->AddLevelBasedExp(exp_percentage, max_level); } -XS(XS_Client_GetFreeSpellBookSlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetFreeSpellBookSlot) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::GetFreeSpellBookSlot(THIS, uint32 start_slot = 0)"); // @categories Spells and Disciplines - { - Client *THIS; - int RETVAL; - uint32 start_slot = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items > 1) - start_slot = SvUV(ST(1)); - - RETVAL = THIS->GetNextAvailableSpellBookSlot(start_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_AddLevelBasedExp(Client* self, uint8 exp_percentage, uint8 max_level, bool ignore_mods) // @categories Experience and Level +{ + self->AddLevelBasedExp(exp_percentage, max_level, ignore_mods); } -XS(XS_Client_GetSpellBookSlotBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetSpellBookSlotBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetSpellBookSlotBySpellID(THIS, uint32 spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - int RETVAL; - uint32 spell_id = SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->FindSpellBookSlotBySpellID(spell_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_IncrementAA(Client* self, uint32 aa_skill_id) // @categories Alternative Advancement +{ + self->IncrementAlternateAdvancementRank(aa_skill_id); } -XS(XS_Client_GetSpellIDByBookSlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetSpellIDByBookSlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetSpellIDByBookSlot(THIS, int slot_id)"); - { - Client* THIS; - int RETVAL; - int slot_id = SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetSpellIDByBookSlot(slot_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +bool Perl_Client_GrantAlternateAdvancementAbility(Client* self, int aa_id, int points) // @categories Alternative Advancement +{ + return self->GrantAlternateAdvancementAbility(aa_id, points); } -XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UpdateTaskActivity) { - dXSARGS; - if (items < 4) - Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, int task_id, int activity_id, int count, [bool ignore_quest_update = false])"); // @categories Tasks and Activities - { - bool ignore_quest_update = false; +bool Perl_Client_GrantAlternateAdvancementAbility(Client* self, int aa_id, int points, bool ignore_cost) // @categories Alternative Advancement +{ + return self->GrantAlternateAdvancementAbility(aa_id, points, ignore_cost); +} - Client *THIS; +uint32_t Perl_Client_GetAALevel(Client* self, uint32 aa_skill_id) // @categories Alternative Advancement, Experience and Level +{ + return self->GetAA(aa_skill_id); +} - int TaskID = (int) SvIV(ST(1)); - int ActivityID = (int) SvIV(ST(2)); - int Count = (int) SvUV(ST(3)); +void Perl_Client_MarkCompassLoc(Client* self, float x, float y, float z) // @categories Adventures and Expeditions +{ + self->MarkSingleCompassLoc(x, y, z); +} - if (items == 5) { - ignore_quest_update = (bool) SvTRUE(ST(4)); - } - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateTaskActivity(TaskID, ActivityID, Count, ignore_quest_update); - } - XSRETURN_EMPTY; +void Perl_Client_ClearCompassMark(Client* self) // @categories Adventures and Expeditions +{ + self->MarkSingleCompassLoc(0, 0, 0, 0); } -XS(XS_Client_GetTaskActivityDoneCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetTaskActivityDoneCount) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::GetTaskActivityDoneCount(THIS, int task_id, int activity_id)"); // @categories Tasks and Activities - { - Client *THIS; - int RETVAL; - int TaskID = (int) SvIV(ST(1)); - int ActivityID = (int) SvIV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - - RETVAL = THIS->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetFreeSpellBookSlot(Client* self) // @categories Spells and Disciplines +{ + return self->GetNextAvailableSpellBookSlot(); } -XS(XS_Client_AssignTask); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AssignTask) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Client::AssignTask(THIS, int task_id, [int npc_id = 0, bool enforce_level_requirement = false])"); // @categories Tasks and Activities - { - Client *THIS; - int task_id = (int) SvIV(ST(1)); - int npc_id = 0; - bool enforce_level_requirement = false; - VALIDATE_THIS_IS_CLIENT; +int Perl_Client_GetFreeSpellBookSlot(Client* self, uint32 start_slot) // @categories Spells and Disciplines +{ + return self->GetNextAvailableSpellBookSlot(start_slot); +} - if (items > 2) { - npc_id = (int) SvIV(ST(2)); - } +int Perl_Client_GetSpellBookSlotBySpellID(Client* self, uint32 spell_id) // @categories Spells and Disciplines +{ + return self->FindSpellBookSlotBySpellID(spell_id); +} - if (items > 3) { - enforce_level_requirement = SvTRUE(ST(3)); - } +uint32_t Perl_Client_GetSpellIDByBookSlot(Client* self, int slot_id) +{ + return self->GetSpellIDByBookSlot(slot_id); +} - THIS->AssignTask(task_id, npc_id, enforce_level_requirement); - } - XSRETURN_EMPTY; +void Perl_Client_UpdateTaskActivity(Client* self, int task_id, int activity_id, int count) // @categories Tasks and Activities +{ + self->UpdateTaskActivity(task_id, activity_id, count); } -XS(XS_Client_FailTask); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_FailTask) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::FailTask(THIS, int task_id)"); // @categories Tasks and Activities - { - Client *THIS; - int TaskID = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->FailTask(TaskID); - } - XSRETURN_EMPTY; +void Perl_Client_UpdateTaskActivity(Client* self, int task_id, int activity_id, int count, bool ignore_quest_update) // @categories Tasks and Activities +{ + self->UpdateTaskActivity(task_id, activity_id, count, ignore_quest_update); } -XS(XS_Client_IsTaskCompleted); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsTaskCompleted) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::IsTaskCompleted(THIS, int task_id)"); // @categories Tasks and Activities - { - Client *THIS; - int RETVAL; - int TaskID = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsTaskCompleted(TaskID); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Client_GetTaskActivityDoneCount(Client* self, int task_id, int activity_id) // @categories Tasks and Activities +{ + return self->GetTaskActivityDoneCountFromTaskID(task_id, activity_id); } -XS(XS_Client_IsTaskActive); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsTaskActive) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::IsTaskActive(THIS, int task_id)"); // @categories Tasks and Activities - { - Client *THIS; - bool RETVAL; - int TaskID = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsTaskActive(TaskID); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_AssignTask(Client* self, int task_id) // @categories Tasks and Activities +{ + self->AssignTask(task_id); } -XS(XS_Client_IsTaskActivityActive); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_IsTaskActivityActive) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::IsTaskActivityActive(THIS, int task_id, int activity_id)"); // @categories Tasks and Activities - { - Client *THIS; - bool RETVAL; - int TaskID = (int) SvIV(ST(1)); - int ActivityID = (int) SvIV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->IsTaskActivityActive(TaskID, ActivityID); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Client_AssignTask(Client* self, int task_id, int npc_id) // @categories Tasks and Activities +{ + self->AssignTask(task_id, npc_id); } -XS(XS_Client_GetCorpseCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCorpseCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetCorpseCount(THIS)"); // @categories Account and Character, Corpse - { - Client *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCorpseCount(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_AssignTask(Client* self, int task_id, int npc_id, bool enforce_level_requirement) // @categories Tasks and Activities +{ + self->AssignTask(task_id, npc_id, enforce_level_requirement); } -XS(XS_Client_GetCorpseID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCorpseID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetCorpseID(THIS, uint8 corpse)"); // @categories Account and Character, Corpse - { - Client *THIS; - uint8 corpse = (uint8) SvIV(ST(1)); - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCorpseID(corpse); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_FailTask(Client* self, int task_id) // @categories Tasks and Activities +{ + self->FailTask(task_id); } -XS(XS_Client_GetCorpseItemAt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCorpseItemAt) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::GetCorpseItemAt(THIS, uint32 corpse_id, uint16 slot_id)"); // @categories Inventory and Items, Corpse - { - Client *THIS; - uint32 corpse_id = (uint32) SvIV(ST(1)); - uint16 slotid = (uint16) SvIV(ST(2)); - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCorpseItemAt(corpse_id, slotid); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +bool Perl_Client_IsTaskCompleted(Client* self, int task_id) // @categories Tasks and Activities +{ + return self->IsTaskCompleted(task_id); } -XS(XS_Client_AssignToInstance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AssignToInstance) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::AssignToInstance(THIS, uint16 instance_id)"); // @categories Adventures and Expeditions - { - Client *THIS; - uint16 instance_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->AssignToInstance(instance_id); - } - XSRETURN_EMPTY; +bool Perl_Client_IsTaskActive(Client* self, int task_id) // @categories Tasks and Activities +{ + return self->IsTaskActive(task_id); } -XS(XS_Client_RemoveFromInstance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_RemoveFromInstance) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::RemoveFromInstance(THIS, uint16 instance_id)"); // @categories Adventures and Expeditions - { - Client *THIS; - uint16 instance_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->RemoveFromInstance(instance_id); - } - XSRETURN_EMPTY; +bool Perl_Client_IsTaskActivityActive(Client* self, int task_id, int activity_id) // @categories Tasks and Activities +{ + return self->IsTaskActivityActive(task_id, activity_id); } -XS(XS_Client_Freeze); -XS(XS_Client_Freeze) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::Freeze(THIS)"); - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->SendAppearancePacket(AT_Anim, ANIM_FREEZE); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetCorpseCount(Client* self) // @categories Account and Character, Corpse +{ + return self->GetCorpseCount(); } -XS(XS_Client_UnFreeze); -XS(XS_Client_UnFreeze) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::UnFreeze(THIS)"); - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->SendAppearancePacket(AT_Anim, ANIM_STAND); - } - XSRETURN_EMPTY; +uint32_t Perl_Client_GetCorpseID(Client* self, uint8 corpse) // @categories Account and Character, Corpse +{ + return self->GetCorpseID(corpse); } +uint32_t Perl_Client_GetCorpseItemAt(Client* self, uint32 corpse_id, uint16 slot_id) // @categories Inventory and Items, Corpse +{ + return self->GetCorpseItemAt(corpse_id, slot_id); +} -XS(XS_Client_GetAggroCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAggroCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAggroCount(THIS)"); // @categories Script Utility, Hate and Aggro - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAggroCount(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_AssignToInstance(Client* self, uint16 instance_id) // @categories Adventures and Expeditions +{ + self->AssignToInstance(instance_id); } +void Perl_Client_RemoveFromInstance(Client* self, uint16 instance_id) // @categories Adventures and Expeditions +{ + self->RemoveFromInstance(instance_id); +} -XS(XS_Client_GetCarriedMoney); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCarriedMoney) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetCarriedMoney(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCarriedMoney(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Client_Freeze(Client* self) +{ + self->SendAppearancePacket(AT_Anim, ANIM_FREEZE); } +void Perl_Client_UnFreeze(Client* self) +{ + self->SendAppearancePacket(AT_Anim, ANIM_STAND); +} -XS(XS_Client_GetAllMoney); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAllMoney) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetAllMoney(THIS)"); // @categories Currency and Points - { - Client *THIS; - uint64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAllMoney(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetAggroCount(Client* self) // @categories Script Utility, Hate and Aggro +{ + return self->GetAggroCount(); } +uint64_t Perl_Client_GetCarriedMoney(Client* self) // @categories Currency and Points +{ + return self->GetCarriedMoney(); +} -XS(XS_Client_GetItemInInventory); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetItemInInventory) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetItemInInventory(THIS, int16 slot_id)"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - EQ::ItemInstance *RETVAL = nullptr; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetInv().GetItem(slot_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL); - } - XSRETURN(1); +uint64_t Perl_Client_GetAllMoney(Client* self) // @categories Currency and Points +{ + return self->GetAllMoney(); } -XS(XS_Client_SetCustomItemData); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetCustomItemData) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Client::SetCustomItemData(THIS, int16 slot_id, string identifier, string value)"); // @categories Inventory and Items - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - Const_char *identifier = SvPV_nolen(ST(2)); - Const_char *value = SvPV_nolen(ST(3)); - VALIDATE_THIS_IS_CLIENT; - THIS->GetInv().SetCustomItemData(THIS->CharacterID(), slot_id, std::string(identifier), std::string(value)); - } - XSRETURN_EMPTY; +EQ::ItemInstance* Perl_Client_GetItemInInventory(Client* self, int16 slot_id) // @categories Inventory and Items +{ + return self->GetInv().GetItem(slot_id); } -XS(XS_Client_GetCustomItemData); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCustomItemData) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::GetCustomItemData(THIS, int16 slot_id, string identifier)"); // @categories Inventory and Items, Corpse - { - Client *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - Const_char *identifier = SvPV_nolen(ST(2)); - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - std::string ret_val = THIS->GetInv().GetCustomItemData(slot_id, std::string(identifier)); - RETVAL = ret_val.c_str(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +void Perl_Client_SetCustomItemData(Client* self, int16 slot_id, std::string identifier, std::string value) // @categories Inventory and Items +{ + self->GetInv().SetCustomItemData(self->CharacterID(), slot_id, identifier, value); } -XS(XS_Client_OpenLFGuildWindow); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_OpenLFGuildWindow) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::OpenLFGuildWindow(THIS)"); // @categories Script Utility, Guild - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->OpenLFGuildWindow(); - } - XSRETURN_EMPTY; +std::string Perl_Client_GetCustomItemData(Client* self, int16 slot_id, std::string identifier) // @categories Inventory and Items, Corpse +{ + return self->GetInv().GetCustomItemData(slot_id, identifier); } -XS(XS_Client_NotifyNewTitlesAvailable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_NotifyNewTitlesAvailable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::NotifyNewTitlesAvailable(THIS)"); // @categories Account and Character - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->NotifyNewTitlesAvailable(); - } - XSRETURN_EMPTY; +void Perl_Client_OpenLFGuildWindow(Client* self) // @categories Script Utility, Guild +{ + self->OpenLFGuildWindow(); } -XS(XS_Client_AddAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AddAlternateCurrencyValue) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::AddAlternateCurrencyValue(THIS, uint32 currency_id, int32 amount)"); // @categories Currency and Points - { - Client *THIS; - uint32 currency_id = (uint32) SvUV(ST(1)); - int32 amount = (int32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->AddAlternateCurrencyValue(currency_id, amount); - } - XSRETURN_EMPTY; +void Perl_Client_NotifyNewTitlesAvailable(Client* self) // @categories Account and Character +{ + self->NotifyNewTitlesAvailable(); } -XS(XS_Client_SetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetAlternateCurrencyValue) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetAlternateCurrencyValue(THIS, uint32 currency_id, int32 amount)"); // @categories Currency and Points - { - Client *THIS; - uint32 currency_id = (uint32) SvUV(ST(1)); - int32 amount = (int32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAlternateCurrencyValue(currency_id, amount); - } - XSRETURN_EMPTY; +void Perl_Client_AddAlternateCurrencyValue(Client* self, uint32 currency_id, int32 amount) // @categories Currency and Points +{ + self->AddAlternateCurrencyValue(currency_id, amount); } -XS(XS_Client_GetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAlternateCurrencyValue) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetAlternateCurrencyValue(THIS, uint32 currency_id)"); // @categories Currency and Points - { - Client *THIS; - uint32 currency_id = (uint32) SvUV(ST(1)); - int32 RETVAL = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAlternateCurrencyValue(currency_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_Client_SetAlternateCurrencyValue(Client* self, uint32 currency_id, int32 amount) // @categories Currency and Points +{ + self->SetAlternateCurrencyValue(currency_id, amount); } -XS(XS_Client_SendWebLink); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendWebLink) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::SendWebLink(THIS, string website_url)"); // @categories Script Utility - { - Client *THIS; - char *website = nullptr; - VALIDATE_THIS_IS_CLIENT; - if (items > 1) { website = (char *) SvPV_nolen(ST(1)); } +uint32 Perl_Client_GetAlternateCurrencyValue(Client* self, uint32_t currency_id) // @categories Currency and Points +{ + return self->GetAlternateCurrencyValue(currency_id); +} - THIS->SendWebLink(website); - } - XSRETURN_EMPTY; +void Perl_Client_SendWebLink(Client* self, const char* url) // @categories Script Utility +{ + self->SendWebLink(url); } -XS(XS_Client_GetInstanceID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetInstanceID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetInstanceID(THIS)"); // @categories Adventures and Expeditions - { - Client *THIS; - int8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetInstanceID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetInstanceID(Client* self) // @categories Adventures and Expeditions +{ + return self->GetInstanceID(); } -XS(XS_Client_HasSpellScribed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_HasSpellScribed) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasSpellScribed(THIS, int spell_id)"); // @categories Spells and Disciplines - { - Client *THIS; - bool RETVAL; - int spell_id = (int) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->HasSpellScribed(spell_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Client_HasSpellScribed(Client* self, int spell_id) // @categories Spells and Disciplines +{ + return self->HasSpellScribed(spell_id); } -XS(XS_Client_SetAccountFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetAccountFlag) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetAccountFlag(THIS, string flag, string value)"); // @categories Account and Character - { - Client *THIS; - //char* flag = (char *)SvPV_nolen(ST(1)); - //char* value = (char *)SvTRUE(ST(2)); - - std::string flag((char *) SvPV_nolen(ST(1))); - std::string value((char *) SvTRUE(ST(2))); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAccountFlag(flag, value); - } - XSRETURN_EMPTY; +void Perl_Client_SetAccountFlag(Client* self, std::string flag, std::string value) // @categories Account and Character +{ + self->SetAccountFlag(flag, value); } -XS(XS_Client_GetAccountFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetAccountFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetAccountFlag(THIS, string flag)"); // @categories Account and Character - { - Client *THIS; - //char* flag = (char *)SvPV_nolen(ST(1)); - //char* value = (char *)SvTRUE(ST(2)); - - std::string flag((char *) SvPV_nolen(ST(1))); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - std::string value = THIS->GetAccountFlag(flag); - - sv_setpv(TARG, value.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_Client_GetAccountFlag(Client* self, std::string flag) // @categories Account and Character +{ + return self->GetAccountFlag(flag); } -XS(XS_Client_GetHunger); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetHunger) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetHunger(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetHunger(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetHunger(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetHunger(); } -XS(XS_Client_GetThirst); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetThirst) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetThirst(THIS)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetThirst(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int Perl_Client_GetThirst(Client* self) // @categories Account and Character, Stats and Attributes +{ + return self->GetThirst(); } -XS(XS_Client_SetHunger); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetHunger) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetHunger(THIS, in_hunger)"); // @categories Script Utility, Stats and Attributes - { - Client *THIS; - int32 in_hunger = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetHunger(in_hunger); - } - XSRETURN_EMPTY; +void Perl_Client_SetHunger(Client* self, int in_hunger) // @categories Script Utility, Stats and Attributes +{ + self->SetHunger(in_hunger); } -XS(XS_Client_SetThirst); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetThirst) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetThirst(THIS, int32 in_thirst)"); // @categories Account and Character, Stats and Attributes - { - Client *THIS; - int32 in_thirst = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetThirst(in_thirst); - } - XSRETURN_EMPTY; +void Perl_Client_SetThirst(Client* self, int in_thirst) // @categories Account and Character, Stats and Attributes +{ + self->SetThirst(in_thirst); } -XS(XS_Client_SendTargetCommand); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendTargetCommand) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SendTargetCommand(THIS, int32 entity_id)"); // @categories Script Utility - { - Client *THIS; - int32 in_entid = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SendTargetCommand(in_entid); - } - XSRETURN_EMPTY; +void Perl_Client_SendTargetCommand(Client* self, uint32 entity_id) // @categories Script Utility +{ + self->SendTargetCommand(entity_id); } -XS(XS_Client_SetConsumption); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetConsumption) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetHunger(THIS, int32 hunger_amount, int32 thirst_amount)"); // @categories Script Utility, Stats and Attributes - { - Client *THIS; - int32 in_hunger = (uint32) SvUV(ST(1)); - int32 in_thirst = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetConsumption(in_hunger, in_thirst); - } - XSRETURN_EMPTY; +void Perl_Client_SetConsumption(Client* self, int hunger_amount, int thirst_amount) // @categories Script Utility, Stats and Attributes +{ + self->SetConsumption(hunger_amount, thirst_amount); } -XS(XS_Client_SilentMessage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SilentMessage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SilentMessage(THIS, string message)"); // @categories Script Utility - { - Client *THIS; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (THIS->GetTarget() != NULL) { - if (THIS->GetTarget()->IsNPC()) { - if (DistanceSquaredNoZ(THIS->GetPosition(), THIS->GetTarget()->GetPosition()) <= 200) { - if (THIS->GetTarget()->CastToNPC()->IsMoving() && - !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget())) - THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); - THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1))); - } +void Perl_Client_SilentMessage(Client* self, const char* message) // @categories Script Utility +{ + if (self->GetTarget() != NULL) { + if (self->GetTarget()->IsNPC()) { + if (DistanceSquaredNoZ(self->GetPosition(), self->GetTarget()->GetPosition()) <= 200) { + if (self->GetTarget()->CastToNPC()->IsMoving() && + !self->GetTarget()->CastToNPC()->IsOnHatelist(self->GetTarget())) + self->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); + self->ChannelMessageReceived(8, 0, 100, message); } } } - XSRETURN_EMPTY; } -XS(XS_Client_PlayMP3); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_PlayMP3) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Client::PlayMP3(THIS, string file)"); // @categories Script Utility - { - Client *THIS; - char *fname = nullptr; - VALIDATE_THIS_IS_CLIENT; - if (items > 1) { fname = (char *) SvPV_nolen(ST(1)); } - - THIS->PlayMP3(fname); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ExpeditionMessage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ExpeditionMessage) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::ExpeditionMessage(THIS, int expedition_id, string message)"); // @categories Adventures and Expeditions - { - Client *THIS; - int ExpdID = (int) SvUV(ST(1)); - const char *Message = (const char *) SvPV_nolen(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - THIS->ExpeditionSay(Message, ExpdID); - } - XSRETURN_EMPTY; -} - -//Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, std::string msg) - -XS(XS_Client_SendMarqueeMessage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendMarqueeMessage) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Client::SendMarqueeMessage(THIS, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string msg)"); // @categories Script Utility - { - Client *THIS; - uint32 type = (uint32) SvUV(ST(1)); - uint32 priority = (uint32) SvUV(ST(2)); - uint32 fade_in = (uint32) SvUV(ST(3)); - uint32 fade_out = (uint32) SvUV(ST(4)); - uint32 duration = (uint32) SvUV(ST(5)); - std::string msg = (std::string) SvPV_nolen(ST(6)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - THIS->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, msg); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SendColoredText); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendColoredText) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SendColoredText(uint32 color, string message)"); // @categories Script Utility - { - Client *THIS; - uint32 color = (uint32) SvUV(ST(1)); - std::string msg = (std::string) SvPV_nolen(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - THIS->SendColoredText(color, msg); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SendSpellAnim); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendSpellAnim) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: SendSpellAnim(uint16 target_id, uint32 spell_animation_id)"); - { - Client *THIS; - uint16 targetid = (uint16) SvUV(ST(1)); - uint16 spell_id = (uint16) SvUV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - THIS->SendSpellAnim(targetid, spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetTargetRingX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetTargetRingX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetTargetRingX(THIS)"); // @categories Script Utility - { - Client *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetTargetRingX(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetTargetRingY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetTargetRingY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetTargetRingY(THIS)"); // @categories Script Utility - { - Client *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetTargetRingY(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetTargetRingZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetTargetRingZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetTargetRingZ(THIS)"); // @categories Script Utility - { - Client *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetTargetRingZ(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_CalcEXP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_CalcEXP) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: CalcEXP(THIS, uint8 conlevel)"); - { - Client *THIS; - uint8 conlevel = 0xFF; - uint32 RETVAL; - if (items == 2) - conlevel = (uint16) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->CalcEXP(conlevel); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_QuestReward); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_QuestReward) { - dXSARGS; - if (items < 1 || items > 9) - Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, int32 mob, int32 copper, int32 silver, int32 gold, int32 platinum, int32 item_id, int32 exp, [bool faction = false])"); // @categories Currency and Points, Experience and Level, Inventory and Items, Faction - { - Client *THIS; - Mob *mob = nullptr; - int32 copper = 0; - int32 silver = 0; - int32 gold = 0; - int32 platinum = 0; - int32 itemid = 0; - int32 exp = 0; - bool faction = false; - - if (sv_derived_from(ST(0), "THIS")) { - IV tmp = SvIV((SV *) SvRV(ST(0))); - THIS = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "THIS is not of type client"); - if (THIS == nullptr) - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - - if (items > 1) { - if (sv_derived_from(ST(1), "mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - } - if (items > 2) { copper = (int32) SvIV(ST(2)); } - if (items > 3) { silver = (int32) SvIV(ST(3)); } - if (items > 4) { gold = (int32) SvIV(ST(4)); } - if (items > 5) { platinum = (int32) SvIV(ST(5)); } - if (items > 6) { itemid = (int32) SvIV(ST(6)); } - if (items > 7) { exp = (int32) SvIV(ST(7)); } - if (items > 8) { faction = (bool) SvIV(ST(8)); } - - THIS->QuestReward(mob, copper, silver, gold, platinum, itemid, exp, faction); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetMoney); -XS(XS_Client_GetMoney) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: GetMoney(THIS, int8 type, int8 subtype)"); - { - Client *THIS; - uint32 RETVAL; - uint8 type = (uint8) SvUV(ST(1)); - uint8 subtype = (uint8) SvUV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetMoney(type, subtype); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetAccountAge); -XS(XS_Client_GetAccountAge) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: GetAccountAge(THIS)"); - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetAccountAge(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_Popup2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Popup2) { - dXSARGS; - if (items < 3 || items > 10) - Perl_croak(aTHX_ "Usage: Client::Popup2(THIS, string title, string text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, string button_name_0, string button_name_1, uint32 sound_controls)"); // @categories Script Utility - { - Client *THIS; - char *Title = (char *) SvPV_nolen(ST(1)); - char *Text = (char *) SvPV_nolen(ST(2)); - uint32 PopupID = 0; - uint32 NegativeID = 0; - uint32 Buttons = 0; - uint32 Duration = 0; - char *ButtonName0 = 0; - char *ButtonName1 = 0; - uint32 SoundControls = 0; - VALIDATE_THIS_IS_CLIENT; - if (items > 3) { PopupID = (uint32) SvUV(ST(3)); } - if (items > 4) { NegativeID = (uint32) SvUV(ST(4)); } - if (items > 5) { Buttons = (uint32) SvUV(ST(5)); } - if (items > 6) { Duration = (uint32) SvUV(ST(6)); } - if (items > 7) { ButtonName0 = (char *) SvPV_nolen(ST(7)); } - if (items > 8) { ButtonName1 = (char *) SvPV_nolen(ST(8)); } - if (items > 9) { SoundControls = (uint32) SvUV(ST(9)); } - - - THIS->SendFullPopup(Title, Text, PopupID, NegativeID, Buttons, Duration, ButtonName0, ButtonName1, - SoundControls); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetPrimaryWeaponOrnamentation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetPrimaryWeaponOrnamentation) +void Perl_Client_PlayMP3(Client* self, const char* file) // @categories Script Utility { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Client::SetPrimaryWeaponOrnamentation(THIS, model_id)"); // @categories Account and Character, Inventory and Items - } - { - Client *THIS; - uint32 model_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetPrimaryWeaponOrnamentation(model_id); - } - XSRETURN_EMPTY; + self->PlayMP3(file); } -XS(XS_Client_SetSecondaryWeaponOrnamentation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetSecondaryWeaponOrnamentation) +// todo: this is some legacy api for 'cust_inst_players' and can possibly be removed (not related to current expeditions) +void Perl_Client_ExpeditionMessage(Client* self, int expedition_id, const char* message) // @categories Adventures and Expeditions { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Client::SetSecondaryWeaponOrnamentation(THIS, model_id)"); // @categories Account and Character, Inventory and Items - } - { - Client *THIS; - uint32 model_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetSecondaryWeaponOrnamentation(model_id); - } - XSRETURN_EMPTY; + self->ExpeditionSay(message, expedition_id); } -XS(XS_Client_SetClientMaxLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetClientMaxLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetClientMaxLevel(THIS, uint8 max_level)"); - { - Client* THIS; - uint8 max_level = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetClientMaxLevel(max_level); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetClientMaxLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetClientMaxLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetClientMaxLevel(THIS)"); - { - Client* THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetClientMaxLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -DynamicZoneLocation GetDynamicZoneLocationFromHash(HV* hash) +void Perl_Client_SendMarqueeMessage(Client* self, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, std::string msg) // @categories Script Utility { - // dynamic zone helper method (caller must validate hash) - SV** zone_ptr = hv_fetchs(hash, "zone", false); - SV** x_ptr = hv_fetchs(hash, "x", false); - SV** y_ptr = hv_fetchs(hash, "y", false); - SV** z_ptr = hv_fetchs(hash, "z", false); - SV** h_ptr = hv_fetchs(hash, "h", false); + self->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, std::move(msg)); +} - uint32_t zone_id = 0; - if (zone_ptr && SvIOK(*zone_ptr)) - { - zone_id = static_cast(SvIV(*zone_ptr)); - } - else if (zone_ptr && SvPOK(*zone_ptr)) - { - zone_id = ZoneID(SvPV_nolen(*zone_ptr)); - } +void Perl_Client_SendColoredText(Client* self, uint32 color, std::string msg) // @categories Script Utility +{ + self->SendColoredText(color, std::move(msg)); +} - // SvNIOK checks for number, integer or double - float x = (x_ptr && SvNIOK(*x_ptr)) ? static_cast(SvNV(*x_ptr)) : 0.0f; - float y = (y_ptr && SvNIOK(*y_ptr)) ? static_cast(SvNV(*y_ptr)) : 0.0f; - float z = (z_ptr && SvNIOK(*z_ptr)) ? static_cast(SvNV(*z_ptr)) : 0.0f; - float h = (h_ptr && SvNIOK(*h_ptr)) ? static_cast(SvNV(*h_ptr)) : 0.0f; +void Perl_Client_SendSpellAnim(Client* self, uint16 targetid, uint16 spell_id) +{ + self->SendSpellAnim(targetid, spell_id); +} + +float Perl_Client_GetTargetRingX(Client* self) // @categories Script Utility +{ + return self->GetTargetRingX(); +} + +float Perl_Client_GetTargetRingY(Client* self) // @categories Script Utility +{ + return self->GetTargetRingY(); +} + +float Perl_Client_GetTargetRingZ(Client* self) // @categories Script Utility +{ + return self->GetTargetRingZ(); +} + +uint32_t Perl_Client_CalcEXP(Client* self, uint8 conlevel) +{ + return self->CalcEXP(conlevel); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver, uint32 gold) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver, gold); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver, gold, platinum); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 item_id) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver, gold, platinum, item_id); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 item_id, uint32 exp) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver, gold, platinum, item_id, exp); +} + +void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 item_id, uint32 exp, bool faction) // @categories Currency and Points, Experience and Level, Inventory and Items, Faction +{ + self->QuestReward(mob, copper, silver, gold, platinum, item_id, exp, faction); +} + +uint32_t Perl_Client_GetMoney(Client* self, int8 type, int8 subtype) +{ + return self->GetMoney(type, subtype); +} + +int Perl_Client_GetAccountAge(Client* self) +{ + return self->GetAccountAge(); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text) // @categories Script Utility +{ + self->SendFullPopup(title, text); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id, uint32 buttons) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id, buttons); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id, buttons, duration); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, const char* button_name_0) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id, buttons, duration, button_name_0); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, const char* button_name_0, const char* button_name_1) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id, buttons, duration, button_name_0, button_name_1); +} + +void Perl_Client_Popup2(Client* self, const char* title, const char* text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, const char* button_name_0, const char* button_name_1, uint32 sound_controls) // @categories Script Utility +{ + self->SendFullPopup(title, text, popup_id, negative_id, buttons, duration, button_name_0, button_name_1, sound_controls); +} + +void Perl_Client_SetPrimaryWeaponOrnamentation(Client* self, int model_id) // @categories Account and Character, Inventory and Items +{ + self->SetPrimaryWeaponOrnamentation(model_id); +} + +void Perl_Client_SetSecondaryWeaponOrnamentation(Client* self, int model_id) // @categories Account and Character, Inventory and Items +{ + self->SetSecondaryWeaponOrnamentation(model_id); +} + +void Perl_Client_SetClientMaxLevel(Client* self, uint8 max_level) +{ + self->SetClientMaxLevel(max_level); +} + +int Perl_Client_GetClientMaxLevel(Client* self) +{ + return self->GetClientMaxLevel(); +} + +DynamicZoneLocation GetDynamicZoneLocationFromHash(perl::hash table) +{ + // dynamic zone helper method, defaults invalid/missing keys to 0 + perl::scalar zone = table["zone"]; + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + + float x = table.exists("x") ? table["x"] : 0.0f; + float y = table.exists("y") ? table["y"] : 0.0f; + float z = table.exists("z") ? table["z"] : 0.0f; + float h = table.exists("h") ? table["h"] : 0.0f; return { zone_id, x, y, z, h }; } -Expedition* CreateExpeditionFromHash(Client* client, SV* hash_ref) +Expedition* Perl_Client_CreateExpedition(Client* self, perl::reference table_ref) { - if (!hash_ref || !SvROK(hash_ref)) // verify valid reference type + perl::hash table = table_ref; + perl::hash expedition = table["expedition"]; + perl::hash instance = table["instance"]; + + perl::scalar zone = instance["zone"]; + uint32_t version = instance["version"]; + uint32_t duration = instance["duration"]; + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + + DynamicZone dz{ zone_id, version, duration, DynamicZoneType::Expedition }; + dz.SetName(expedition["name"]); + dz.SetMinPlayers(expedition["min_players"]); + dz.SetMaxPlayers(expedition["max_players"]); + + if (table.exists("compass")) { - Perl_croak(aTHX_ "Client::CreateExpedition argument is not a reference type"); + auto compass = GetDynamicZoneLocationFromHash(table["compass"]); + dz.SetCompass(compass); } - HV* hash = (HV*)SvRV(hash_ref); // dereference and verify type is hash - if (SvTYPE(hash) != SVt_PVHV) + if (table.exists("safereturn")) { - Perl_croak(aTHX_ "Client::CreateExpedition reference argument is not to a hash type"); + auto safereturn = GetDynamicZoneLocationFromHash(table["safereturn"]); + dz.SetSafeReturn(safereturn); } - SV** expedition_info_ptr = hv_fetchs(hash, "expedition", false); - if (!expedition_info_ptr) + if (table.exists("zonein")) { - Perl_croak(aTHX_ "Client::CreateExpedition required 'expedition' key missing from hash"); + auto zonein = GetDynamicZoneLocationFromHash(table["zonein"]); + dz.SetZoneInLocation(zonein); } - if (!SvROK(*expedition_info_ptr) || SvTYPE(SvRV(*expedition_info_ptr)) != SVt_PVHV) + if (expedition.exists("disable_messages")) { - Perl_croak(aTHX_ "Client::CreateExpedition 'expedition' entry must have a hash table value"); + return self->CreateExpedition(dz, expedition["disable_messages"].as()); } - SV** instance_info_ptr = hv_fetchs(hash, "instance", false); - if (!instance_info_ptr) - { - Perl_croak(aTHX_ "Client::CreateExpedition required 'instance' key missing from hash"); - } - - if (!SvROK(*instance_info_ptr) || SvTYPE(SvRV(*instance_info_ptr)) != SVt_PVHV) - { - Perl_croak(aTHX_ "Client::CreateExpedition 'instance' entry must have a hash table value"); - } - - // dereference the nested hash tables and validate required keys - HV* expedition_hash = (HV*)SvRV(*expedition_info_ptr); - SV** name_ptr = hv_fetchs(expedition_hash, "name", false); - SV** min_players_ptr = hv_fetchs(expedition_hash, "min_players", false); - SV** max_players_ptr = hv_fetchs(expedition_hash, "max_players", false); - SV** disable_msg_ptr = hv_fetchs(expedition_hash, "disable_messages", false); - if (!name_ptr || !min_players_ptr || !max_players_ptr) - { - Perl_croak(aTHX_ "Client::CreateExpedition 'expedition' hash table missing required keys (name, min_players, max_players)"); - } - - HV* instance_hash = (HV*)SvRV(*instance_info_ptr); - SV** instance_zone_ptr = hv_fetchs(instance_hash, "zone", false); - SV** version_ptr = hv_fetchs(instance_hash, "version", false); - SV** duration_ptr = hv_fetchs(instance_hash, "duration", false); - if (!instance_zone_ptr || !version_ptr || !duration_ptr) - { - Perl_croak(aTHX_ "Client::CreateExpedition 'instance' hash table missing required keys (zone, version, duration)"); - } - - uint32_t zone_id = 0; - if (SvIOK(*instance_zone_ptr)) - { - zone_id = static_cast(SvIV(*instance_zone_ptr)); - } - else if (SvPOK(*instance_zone_ptr)) - { - zone_id = ZoneID(SvPV_nolen(*instance_zone_ptr)); - } - else - { - Perl_croak(aTHX_ "Client::CreateExpedition zone value in 'instance' table must be int or string"); - } - - uint32_t zone_version = SvIOK(*version_ptr) ? static_cast(SvIV(*version_ptr)) : 0; - uint32_t zone_duration = SvIOK(*duration_ptr) ? static_cast(SvIV(*duration_ptr)) : 0; - - DynamicZone dz{ zone_id, zone_version, zone_duration, DynamicZoneType::Expedition }; - dz.SetName(SvPOK(*name_ptr) ? SvPV_nolen(*name_ptr) : ""); - dz.SetMinPlayers(SvIOK(*min_players_ptr) ? static_cast(SvIV(*min_players_ptr)) : 0); - dz.SetMaxPlayers(SvIOK(*max_players_ptr) ? static_cast(SvIV(*max_players_ptr)) : 0); - - SV** compass_ptr = hv_fetchs(hash, "compass", false); - if (compass_ptr && SvROK(*compass_ptr) && SvTYPE(SvRV(*compass_ptr)) == SVt_PVHV) - { - auto compass_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*compass_ptr)); - dz.SetCompass(compass_loc); - } - - SV** safereturn_ptr = hv_fetchs(hash, "safereturn", false); - if (safereturn_ptr && SvROK(*safereturn_ptr) && SvTYPE(SvRV(*safereturn_ptr)) == SVt_PVHV) - { - auto safereturn_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*safereturn_ptr)); - dz.SetSafeReturn(safereturn_loc); - } - - SV** zonein_ptr = hv_fetchs(hash, "zonein", false); - if (zonein_ptr && SvROK(*zonein_ptr) && SvTYPE(SvRV(*zonein_ptr)) == SVt_PVHV) - { - auto zonein_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*zonein_ptr)); - dz.SetZoneInLocation(zonein_loc); - } - - bool disable_messages = (disable_msg_ptr && SvIOK(*disable_msg_ptr)) ? SvTRUE(*disable_msg_ptr) : false; - - return client->CreateExpedition(dz, disable_messages); + return self->CreateExpedition(dz); } -XS(XS_Client_CreateExpedition); -XS(XS_Client_CreateExpedition) { - dXSARGS; - if (items != 2 && items != 7 && items != 8) { - Perl_croak(aTHX_ "Usage: Client::CreateExpedition(THIS, HASHREF expedition_info | string zone_name, uint32 zone_version, uint32 duration, string expedition_name, uint32 min_players, uint32 max_players, [bool disable_messages = false])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - Expedition* RETVAL = nullptr; - if (items == 2) - { - RETVAL = CreateExpeditionFromHash(THIS, ST(1)); - } - else - { - std::string zone_name(SvPV_nolen(ST(1))); - uint32 zone_version = (uint32)SvUV(ST(2)); - uint32 duration = (uint32)SvUV(ST(3)); - std::string expedition_name(SvPV_nolen(ST(4))); - uint32 min_players = (uint32)SvUV(ST(5)); - uint32 max_players = (uint32)SvUV(ST(6)); - bool disable_messages = (items > 7) ? (bool)SvTRUE(ST(7)) : false; - - RETVAL = THIS->CreateExpedition(zone_name, zone_version, duration, - expedition_name, min_players, max_players, disable_messages); - } - - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - - XSRETURN(1); +Expedition* Perl_Client_CreateExpedition(Client* self, std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players) +{ + return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players); } -XS(XS_Client_CreateTaskDynamicZone); -XS(XS_Client_CreateTaskDynamicZone) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Client::CreateTaskDynamicZone(THIS, int task_id, HASHREF dz_info)"); - } +Expedition* Perl_Client_CreateExpedition(Client* self, std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool disable_messages) +{ + return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players, disable_messages); +} - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; +void Perl_Client_CreateTaskDynamicZone(Client* self, int task_id, perl::reference table_ref) +{ + perl::hash table = table_ref; + perl::hash instance = table["instance"]; - SV* hash_ref = ST(2); - if (!hash_ref || !SvROK(hash_ref)) - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone argument is not a reference type"); - } - - HV* hash = (HV*)SvRV(hash_ref); // dereference into hash - if (SvTYPE(hash) != SVt_PVHV) - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone reference argument is not to a hash type"); - } - - SV** instance_info_ptr = hv_fetchs(hash, "instance", false); - if (!instance_info_ptr) - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone required 'instance' key missing from hash"); - } - - if (!SvROK(*instance_info_ptr) || SvTYPE(SvRV(*instance_info_ptr)) != SVt_PVHV) - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone 'instance' entry must have a hash table value"); - } - - HV* instance_hash = (HV*)SvRV(*instance_info_ptr); - SV** instance_zone_ptr = hv_fetchs(instance_hash, "zone", false); - SV** version_ptr = hv_fetchs(instance_hash, "version", false); - SV** duration_ptr = hv_fetchs(instance_hash, "duration", false); - if (!instance_zone_ptr || !version_ptr) - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone 'instance' hash table missing required keys (zone, version, duration)"); - } - - uint32_t zone_id = 0; - SV* instance_zone = *instance_zone_ptr; - if (SvIOK(instance_zone)) - { - zone_id = static_cast(SvIV(instance_zone)); - } - else if (SvPOK(instance_zone)) - { - zone_id = ZoneID(SvPV_nolen(instance_zone)); - } - else - { - Perl_croak(aTHX_ "Client::CreateTaskDynamicZone zone value in 'instance' table must be int or string"); - } - - uint32_t zone_version = SvIOK(*version_ptr) ? static_cast(SvIV(*version_ptr)) : 0; + perl::scalar zone = instance["zone"]; + uint32_t version = instance["version"]; + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); // tasks override dz duration so duration is ignored here - DynamicZone dz{ zone_id, zone_version, 0, DynamicZoneType::None }; + DynamicZone dz{ zone_id, version, 0, DynamicZoneType::None }; - SV** compass_ptr = hv_fetchs(hash, "compass", false); - if (compass_ptr && SvROK(*compass_ptr) && SvTYPE(SvRV(*compass_ptr)) == SVt_PVHV) + if (table.exists("compass")) { - auto compass_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*compass_ptr)); - dz.SetCompass(compass_loc); + auto compass = GetDynamicZoneLocationFromHash(table["compass"]); + dz.SetCompass(compass); } - SV** safereturn_ptr = hv_fetchs(hash, "safereturn", false); - if (safereturn_ptr && SvROK(*safereturn_ptr) && SvTYPE(SvRV(*safereturn_ptr)) == SVt_PVHV) + if (table.exists("safereturn")) { - auto safereturn_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*safereturn_ptr)); - dz.SetSafeReturn(safereturn_loc); + auto safereturn = GetDynamicZoneLocationFromHash(table["safereturn"]); + dz.SetSafeReturn(safereturn); } - SV** zonein_ptr = hv_fetchs(hash, "zonein", false); - if (zonein_ptr && SvROK(*zonein_ptr) && SvTYPE(SvRV(*zonein_ptr)) == SVt_PVHV) + if (table.exists("zonein")) { - auto zonein_loc = GetDynamicZoneLocationFromHash((HV*)SvRV(*zonein_ptr)); - dz.SetZoneInLocation(zonein_loc); + auto zonein = GetDynamicZoneLocationFromHash(table["zonein"]); + dz.SetZoneInLocation(zonein); } - uint32_t task_id = static_cast(SvUV(ST(1))); - - THIS->CreateTaskDynamicZone(task_id, dz); + self->CreateTaskDynamicZone(task_id, dz); } -XS(XS_Client_GetExpedition); -XS(XS_Client_GetExpedition) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Client::GetExpedition(THIS)"); - } - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - Expedition* RETVAL = THIS->GetExpedition(); - - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Expedition", (void*)RETVAL); - - XSRETURN(1); +Expedition* Perl_Client_GetExpedition(Client* self) +{ + return self->GetExpedition(); } -XS(XS_Client_GetExpeditionLockouts); -XS(XS_Client_GetExpeditionLockouts) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: Client::GetExpeditionLockouts(THIS, [string expedition_name])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - HV* hash = newHV(); - SV* hash_ref = nullptr; // for expedition event hash if filtering on expedition - - std::string expedition_name; - if (items == 2) - { - expedition_name = SvPV_nolen(ST(1)); - } - - auto lockouts = THIS->GetExpeditionLockouts(); +perl::reference Perl_Client_GetExpeditionLockouts(Client* self) +{ + perl::hash lockout_hash; + auto lockouts = self->GetExpeditionLockouts(); for (const auto& lockout : lockouts) { - uint32_t name_len = static_cast(lockout.GetExpeditionName().size()); - uint32_t event_len = static_cast(lockout.GetEventName().size()); - - SV** entry = hv_fetch(hash, lockout.GetExpeditionName().c_str(), name_len, false); - if (!entry) + if (!lockout_hash.exists(lockout.GetExpeditionName())) { - SV* event_hash_ref = newRV_noinc((SV*)newHV()); // takes ownership of hash - if (!expedition_name.empty() && lockout.GetExpeditionName() == expedition_name) - { - hash_ref = event_hash_ref; // save ref to event hash for return - } - entry = hv_store(hash, lockout.GetExpeditionName().c_str(), name_len, event_hash_ref, 0); - } - - if (entry && SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVHV) - { - HV* event_hash = (HV*)SvRV(*entry); - hv_store(event_hash, lockout.GetEventName().c_str(), event_len, - newSVuv(lockout.GetSecondsRemaining()), 0); + lockout_hash[lockout.GetExpeditionName()] = perl::reference(perl::hash()); } + perl::hash events = lockout_hash[lockout.GetExpeditionName()]; // nested + events[lockout.GetEventName()] = lockout.GetSecondsRemaining(); } - SV* rv = &PL_sv_undef; + return perl::reference(lockout_hash); +} - if (!expedition_name.empty()) +perl::reference Perl_Client_GetExpeditionLockouts(Client* self, std::string expedition_name) +{ + perl::hash event_hash; + + auto lockouts = self->GetExpeditionLockouts(expedition_name); + for (const auto& lockout : lockouts) { - rv = hash_ref ? sv_2mortal(hash_ref) : &PL_sv_undef; // ref that owns event hash for expedition + event_hash[lockout.GetEventName()] = lockout.GetSecondsRemaining(); } - else + + return perl::reference(event_hash); +} + +std::string Perl_Client_GetLockoutExpeditionUUID(Client* self, std::string expedition_name, std::string event_name) +{ + auto lockout = self->GetExpeditionLockout(expedition_name, event_name); + return lockout ? lockout->GetExpeditionUUID() : std::string{}; +} + +void Perl_Client_AddExpeditionLockout(Client* self, std::string expedition_name, std::string event_name, uint32 seconds) +{ + self->AddNewExpeditionLockout(expedition_name, event_name, seconds); +} + +void Perl_Client_AddExpeditionLockout(Client* self, std::string expedition_name, std::string event_name, uint32 seconds, std::string uuid) +{ + self->AddNewExpeditionLockout(expedition_name, event_name, seconds, uuid); +} + +void Perl_Client_AddExpeditionLockoutDuration(Client* self, std::string expedition_name, std::string event_name, int seconds) +{ + self->AddExpeditionLockoutDuration(expedition_name, event_name, seconds, {}, true); +} + +void Perl_Client_AddExpeditionLockoutDuration(Client* self, std::string expedition_name, std::string event_name, int seconds, std::string uuid) +{ + self->AddExpeditionLockoutDuration(expedition_name, event_name, seconds, uuid, true); +} + +void Perl_Client_RemoveAllExpeditionLockouts(Client* self) +{ + self->RemoveAllExpeditionLockouts({}, true); +} + +void Perl_Client_RemoveAllExpeditionLockouts(Client* self, std::string expedition_name) +{ + self->RemoveAllExpeditionLockouts(expedition_name, true); +} + +void Perl_Client_RemoveExpeditionLockout(Client* self, std::string expedition_name, std::string event_name) +{ + self->RemoveExpeditionLockout(expedition_name, event_name, true); +} + +bool Perl_Client_HasExpeditionLockout(Client* self, std::string expedition_name, std::string event_name) +{ + return self->HasExpeditionLockout(expedition_name, event_name); +} + +void Perl_Client_MovePCDynamicZone(Client* self, perl::scalar zone) +{ + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + self->MovePCDynamicZone(zone_id); +} + +void Perl_Client_MovePCDynamicZone(Client* self, perl::scalar zone, int zone_version) +{ + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + self->MovePCDynamicZone(zone_id, zone_version); +} + +void Perl_Client_MovePCDynamicZone(Client* self, perl::scalar zone, int zone_version, bool msg_if_invalid) +{ + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + self->MovePCDynamicZone(zone_id, zone_version, msg_if_invalid); +} + +void Perl_Client_Fling(Client* self, float value, float target_x, float target_y, float target_z) +{ + self->Fling(value, target_x, target_y, target_z); +} + +void Perl_Client_Fling(Client* self, float value, float target_x, float target_y, float target_z, bool ignore_los) +{ + self->Fling(value, target_x, target_y, target_z, ignore_los); +} + +void Perl_Client_Fling(Client* self, float value, float target_x, float target_y, float target_z, bool ignore_los, bool clipping) +{ + self->Fling(value, target_x, target_y, target_z, ignore_los, clipping); +} + +bool Perl_Client_HasDisciplineLearned(Client* self, uint16 spell_id) +{ + return self->HasDisciplineLearned(spell_id); +} + +uint32_t Perl_Client_GetClassBitmask(Client* self) +{ + return GetPlayerClassBit(self->GetClass()); +} + +uint32_t Perl_Client_GetRaceBitmask(Client* self) // @categories Stats and Attributes +{ + return GetPlayerRaceBit(self->GetBaseRace()); +} + +perl::array Perl_Client_GetLearnableDisciplines(Client* self) +{ + perl::array result; + auto learnable_disciplines = self->GetLearnableDisciplines(); + for (int i = 0; i < learnable_disciplines.size(); ++i) { - rv = sv_2mortal(newRV_noinc((SV*)hash)); // owns expedition hash + result.push_back(learnable_disciplines[i]); } - - ST(0) = rv; - XSRETURN(1); + return result; } -XS(XS_Client_GetLockoutExpeditionUUID); -XS(XS_Client_GetLockoutExpeditionUUID) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Client::GetLockoutExpeditionUUID(THIS, string expedition_name, string event_name)"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name = SvPV_nolen(ST(1)); - std::string event_name = SvPV_nolen(ST(2)); - - auto lockout = THIS->GetExpeditionLockout(expedition_name, event_name); - if (lockout) +perl::array Perl_Client_GetLearnableDisciplines(Client* self, uint8 min_level) +{ + perl::array result; + auto learnable_disciplines = self->GetLearnableDisciplines(min_level); + for (int i = 0; i < learnable_disciplines.size(); ++i) { - XSRETURN_PV(lockout->GetExpeditionUUID().c_str()); + result.push_back(learnable_disciplines[i]); } - - XSRETURN_UNDEF; + return result; } -XS(XS_Client_AddExpeditionLockout); -XS(XS_Client_AddExpeditionLockout) { - dXSARGS; - if (items != 4 && items != 5) { - Perl_croak(aTHX_ "Usage: Client::AddExpeditionLockout(THIS, string expedition_name, string event_name, uint32 seconds, [string uuid])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - uint32 seconds = (uint32)SvUV(ST(3)); - std::string uuid; - - if (items == 5) +perl::array Perl_Client_GetLearnableDisciplines(Client* self, uint8 min_level, uint8 max_level) +{ + perl::array result; + auto learnable_disciplines = self->GetLearnableDisciplines(min_level, max_level); + for (int i = 0; i < learnable_disciplines.size(); ++i) { - uuid = SvPV_nolen(ST(4)); + result.push_back(learnable_disciplines[i]); } - - THIS->AddNewExpeditionLockout(expedition_name, event_name, seconds, uuid); - - XSRETURN_EMPTY; + return result; } -XS(XS_Client_AddExpeditionLockoutDuration); -XS(XS_Client_AddExpeditionLockoutDuration) { - dXSARGS; - if (items != 4 && items != 5) { - Perl_croak(aTHX_ "Usage: Client::AddExpeditionLockoutDuration(THIS, string expedition_name, string event_name, int seconds, [string uuid])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - int seconds = static_cast(SvUV(ST(3))); - std::string uuid; - - if (items == 5) +perl::array Perl_Client_GetLearnedDisciplines(Client* self) +{ + perl::array result; + auto learned_disciplines = self->GetLearnedDisciplines(); + for (int i = 0; i < learned_disciplines.size(); ++i) { - uuid = SvPV_nolen(ST(4)); + result.push_back(learned_disciplines[i]); } - - THIS->AddExpeditionLockoutDuration(expedition_name, event_name, seconds, uuid, true); - - XSRETURN_EMPTY; + return result; } -XS(XS_Client_RemoveAllExpeditionLockouts); -XS(XS_Client_RemoveAllExpeditionLockouts) { - dXSARGS; - if (items != 1 && items != 2) { - Perl_croak(aTHX_ "Usage: Client::RemoveAllExpeditionLockouts(THIS, [string expedition_name])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name; - if (items == 2) +perl::array Perl_Client_GetMemmedSpells(Client* self) +{ + perl::array result; + auto memmed_spells = self->GetMemmedSpells(); + for (int i = 0; i < memmed_spells.size(); ++i) { - expedition_name = SvPV_nolen(ST(1)); + result.push_back(memmed_spells[i]); } - - THIS->RemoveAllExpeditionLockouts(expedition_name, true); - - XSRETURN_EMPTY; + return result; } -XS(XS_Client_RemoveExpeditionLockout); -XS(XS_Client_RemoveExpeditionLockout) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Client::RemoveExpeditionLockout(THIS, string expedition_name, string event_name)"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - - THIS->RemoveExpeditionLockout(expedition_name, event_name, true); - - XSRETURN_EMPTY; -} - -XS(XS_Client_HasExpeditionLockout); -XS(XS_Client_HasExpeditionLockout) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Client::HasExpeditionLockout(THIS, string expedition_name, string event_name)"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - - bool result = THIS->HasExpeditionLockout(expedition_name, event_name); - ST(0) = boolSV(result); - - XSRETURN(1); -} - -XS(XS_Client_MovePCDynamicZone); -XS(XS_Client_MovePCDynamicZone) { - dXSARGS; - if (items != 2 && items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Client::MovePCDynamicZone(THIS, uint32 zone_id | string zone_name, [int zone_version = -1], [bool message_if_invalid = true])"); - } - - Client* THIS = nullptr; - VALIDATE_THIS_IS_CLIENT; - - if (SvTYPE(ST(1)) == SVt_PV) +perl::array Perl_Client_GetScribeableSpells(Client* self) +{ + perl::array result; + auto scribeable_spells = self->GetScribeableSpells(); + for (int i = 0; i < scribeable_spells.size(); ++i) { - std::string zone_name(SvPV_nolen(ST(1))); - int zone_version = (items >= 3) ? static_cast(SvIV(ST(2))) : -1; - if (items == 4) - { - THIS->MovePCDynamicZone(zone_name, zone_version, (bool)SvTRUE(ST(3))); - } - else - { - THIS->MovePCDynamicZone(zone_name, zone_version); - } + result.push_back(scribeable_spells[i]); } - else if (SvTYPE(ST(1)) == SVt_IV) + return result; +} + +perl::array Perl_Client_GetScribeableSpells(Client* self, uint8 min_level) +{ + perl::array result; + auto scribeable_spells = self->GetScribeableSpells(min_level); + for (int i = 0; i < scribeable_spells.size(); ++i) { - uint32 zone_id = (uint32)SvUV(ST(1)); - int zone_version = (items >= 3) ? static_cast(SvIV(ST(2))) : -1; - if (items == 3) - { - THIS->MovePCDynamicZone(zone_id, zone_version, (bool)SvTRUE(ST(2))); - } - else - { - THIS->MovePCDynamicZone(zone_id, zone_version); - } + result.push_back(scribeable_spells[i]); } - else + return result; +} + +perl::array Perl_Client_GetScribeableSpells(Client* self, uint8 min_level, uint8 max_level) +{ + perl::array result; + auto scribeable_spells = self->GetScribeableSpells(min_level, max_level); + for (int i = 0; i < scribeable_spells.size(); ++i) { - Perl_croak(aTHX_ "Client::MovePCDynamicZone expected an integer or string"); + result.push_back(scribeable_spells[i]); } - - XSRETURN_EMPTY; + return result; } -XS(XS_Client_Fling); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_Fling) { - dXSARGS; - if (items < 5 || items > 7) - Perl_croak(aTHX_ "Usage: Client::Fling(THIS, value, target_x, target_y, target_z, ignore_los, clipping)"); +perl::array Perl_Client_GetScribedSpells(Client* self) +{ + perl::array result; + auto scribed_spells = self->GetScribedSpells(); + for (int i = 0; i < scribed_spells.size(); ++i) { - Client* THIS; - float value = (float) SvNV(ST(1)); - float target_x = (float) SvNV(ST(2)); - float target_y = (float) SvNV(ST(3)); - float target_z = (float) SvNV(ST(4)); - bool ignore_los = false; - bool clipping = false; - VALIDATE_THIS_IS_CLIENT; - if (items > 5) - ignore_los = (bool) SvTRUE(ST(5)); - - if (items > 6) - clipping = (bool) SvTRUE(ST(6)); - - THIS->Fling(value, target_x, target_y, target_z, ignore_los, clipping); + result.push_back(scribed_spells[i]); } - XSRETURN_EMPTY; + return result; } -XS(XS_Client_HasDisciplineLearned); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_HasDisciplineLearned) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasDisciplineLearned(THIS, uint16 spell_id)"); - { - Client *THIS; - bool has_learned; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - has_learned = THIS->HasDisciplineLearned(spell_id); - ST(0) = boolSV(has_learned); - sv_2mortal(ST(0)); - } - XSRETURN(1); +EQ::InventoryProfile* Perl_Client_GetInventory(Client* self) +{ + return &self->GetInv(); } -XS(XS_Client_GetClassBitmask); -XS(XS_Client_GetClassBitmask) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetClassBitmask(THIS)"); - { - Client* THIS; - int client_bitmask = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - client_bitmask = GetPlayerClassBit(THIS->GetClass()); - XSprePUSH; - PUSHu((UV) client_bitmask); - } - XSRETURN(1); +double Perl_Client_GetAAEXPModifier(Client* self, uint32 zone_id) +{ + return self->GetAAEXPModifier(zone_id); } -XS(XS_Client_GetRaceBitmask); -XS(XS_Client_GetRaceBitmask) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetRaceBitmask(THIS)"); // @categories Stats and Attributes - { - Client* THIS; - int client_bitmask = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - client_bitmask = GetPlayerRaceBit(THIS->GetBaseRace()); - XSprePUSH; - PUSHu((UV) client_bitmask); - } - XSRETURN(1); +double Perl_Client_GetEXPModifier(Client* self, uint32 zone_id) +{ + return self->GetEXPModifier(zone_id); } -XS(XS_Client_GetLearnableDisciplines); -XS(XS_Client_GetLearnableDisciplines) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: Client::GetLearnableDisciplines(THIS, [uint8 min_level, uint8 max_level])"); - - uint8 min_level = 1; - uint8 max_level = 0; - if (items > 1) - min_level = (uint8)SvUV(ST(1)); - if (items > 2) - max_level = (uint8)SvUV(ST(2)); - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - auto learnable_disciplines = THIS->GetLearnableDisciplines(min_level, max_level); - auto learnable_size = learnable_disciplines.size(); - if (learnable_size > 0) { - EXTEND(sp, learnable_size); - for (int index = 0; index < learnable_size; ++index) { - ST(index) = sv_2mortal(newSVuv(learnable_disciplines[index])); - } - XSRETURN(learnable_size); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); +void Perl_Client_SetAAEXPModifier(Client* self, uint32 zone_id, float aa_modifier) +{ + self->SetAAEXPModifier(zone_id, aa_modifier); } -XS(XS_Client_GetLearnedDisciplines); -XS(XS_Client_GetLearnedDisciplines) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetLearnedDisciplines(THIS)"); - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - auto learned_disciplines = THIS->GetLearnedDisciplines(); - auto learned_size = learned_disciplines.size(); - if (learned_size > 0) { - EXTEND(sp, learned_size); - for (int index = 0; index < learned_size; ++index) { - ST(index) = sv_2mortal(newSVuv(learned_disciplines[index])); - } - XSRETURN(learned_size); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); +void Perl_Client_SetEXPModifier(Client* self, uint32 zone_id, float exp_modifier) +{ + self->SetEXPModifier(zone_id, exp_modifier); } -XS(XS_Client_GetMemmedSpells); -XS(XS_Client_GetMemmedSpells) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetMemmedSpells(THIS)"); - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - auto memmed_spells = THIS->GetMemmedSpells(); - auto memmed_size = memmed_spells.size(); - if (memmed_size > 0) { - EXTEND(sp, memmed_size); - for (int index = 0; index < memmed_size; ++index) { - ST(index) = sv_2mortal(newSVuv(memmed_spells[index])); - } - XSRETURN(memmed_size); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); +void Perl_Client_AddLDoNLoss(Client* self, uint32 theme_id) +{ + self->UpdateLDoNWinLoss(theme_id); } -XS(XS_Client_GetScribeableSpells); -XS(XS_Client_GetScribeableSpells) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: Client::GetScribeableSpells(THIS, [uint8 min_level, uint8 max_level])"); - - uint8 min_level = 1; - uint8 max_level = 0; - if (items > 1) - min_level = (uint8)SvUV(ST(1)); - if (items > 2) - max_level = (uint8)SvUV(ST(2)); - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - auto scribeable_spells = THIS->GetScribeableSpells(min_level, max_level); - auto scribeable_size = scribeable_spells.size(); - if (scribeable_size > 0) { - EXTEND(sp, scribeable_size); - for (int index = 0; index < scribeable_size; ++index) { - ST(index) = sv_2mortal(newSVuv(scribeable_spells[index])); - } - XSRETURN(scribeable_size); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); +void Perl_Client_AddLDoNWin(Client* self, uint32 theme_id) +{ + self->UpdateLDoNWinLoss(theme_id, true); } -XS(XS_Client_GetScribedSpells); -XS(XS_Client_GetScribedSpells) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetScribedSpells(THIS)"); - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - auto scribed_spells = THIS->GetScribedSpells(); - auto scribed_size = scribed_spells.size(); - if (scribed_size > 0) { - EXTEND(sp, scribed_size); - for (int index = 0; index < scribed_size; ++index) { - ST(index) = sv_2mortal(newSVuv(scribed_spells[index])); - } - XSRETURN(scribed_size); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); +void Perl_Client_SetHideMe(Client* self, bool hide_me_state) +{ + self->SetHideMe(hide_me_state); } -XS(XS_Client_GetInventory); -XS(XS_Client_GetInventory) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetInventory(THIS)"); - { - Client* THIS; - EQ::InventoryProfile* RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = &THIS->GetInv(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Inventory", (void *) RETVAL); - } - XSRETURN(1); +void Perl_Client_ResetAllDisciplineTimers(Client* self) // @categories Spells and Disciplines +{ + self->ResetAllDisciplineTimers(); } -XS(XS_Client_GetAAEXPModifier); -XS(XS_Client_GetAAEXPModifier) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetAAEXPModifier(THIS, uint32 zone_id)"); - { - Client* THIS; - double aa_modifier = 1.0f; - uint32 zone_id = (uint32)SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - aa_modifier = THIS->GetAAEXPModifier(zone_id); - XSprePUSH; - PUSHn((double) aa_modifier); - } - XSRETURN(1); +void Perl_Client_SendToInstance(Client* self, std::string instance_type, std::string zone_short_name, uint32 instance_version, float x, float y, float z, float heading, std::string instance_identifier, uint32 duration) +{ + self->SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration); } -XS(XS_Client_GetEXPModifier); -XS(XS_Client_GetEXPModifier) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::GetEXPModifier(THIS, uint32 zone_id)"); - { - Client* THIS; - double exp_modifier = 1.0f; - uint32 zone_id = (uint32)SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - exp_modifier = THIS->GetEXPModifier(zone_id); - XSprePUSH; - PUSHn((double) exp_modifier); - } - XSRETURN(1); +int Perl_Client_CountItem(Client* self, uint32 item_id) +{ + return self->CountItem(item_id); } -XS(XS_Client_SetAAEXPModifier); -XS(XS_Client_SetAAEXPModifier) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetAAEXPModifier(THIS, uint32 zone_id, float aa_modifier)"); - { - Client* THIS; - uint32 zone_id = (uint32)SvUV(ST(1)); - double aa_modifier = (double) SvNV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetAAEXPModifier(zone_id, aa_modifier); - } - XSRETURN_EMPTY; +void Perl_Client_RemoveItem(Client* self, uint32 item_id) // @categories Spells and Disciplines +{ + self->RemoveItem(item_id); } -XS(XS_Client_SetEXPModifier); -XS(XS_Client_SetEXPModifier) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::SetEXPModifier(THIS, uint32 zone_id, float exp_modifier)"); - { - Client* THIS; - uint32 zone_id = (uint32)SvUV(ST(1)); - double exp_modifier = (double) SvNV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetEXPModifier(zone_id, exp_modifier); - } - XSRETURN_EMPTY; +void Perl_Client_RemoveItem(Client* self, uint32 item_id, uint32 quantity) // @categories Spells and Disciplines +{ + self->RemoveItem(item_id, quantity); } -XS(XS_Client_AddLDoNLoss); -XS(XS_Client_AddLDoNLoss) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::AddLDoNLoss(THIS, uint32 theme_id)"); - { - Client* THIS; - uint32 theme_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateLDoNWinLoss(theme_id); - } - XSRETURN_EMPTY; +void Perl_Client_DialogueWindow(Client* self, std::string window_markdown) // @categories Script Utility +{ + DialogueWindow::Render(self, std::move(window_markdown)); } -XS(XS_Client_AddLDoNWin); -XS(XS_Client_AddLDoNWin) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::AddLDoNWin(THIS, uint32 theme_id)"); - { - Client* THIS; - uint32 theme_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateLDoNWinLoss(theme_id, true); - } - XSRETURN_EMPTY; +void Perl_Client_DiaWind(Client* self, std::string window_markdown) // @categories Script Utility +{ + DialogueWindow::Render(self, std::move(window_markdown)); } -XS(XS_Client_SetHideMe); -XS(XS_Client_SetHideMe) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetHideMe(THIS, bool hide_me_state)"); - { - Client* THIS; - bool hide_me_state = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetHideMe(hide_me_state); - } - XSRETURN_EMPTY; +int Perl_Client_GetIPExemption(Client* self) // @categories Account and Character +{ + return self->GetIPExemption(); } -XS(XS_Client_ResetAllDisciplineTimers); -XS(XS_Client_ResetAllDisciplineTimers) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ResetAllDisciplineTimers(THIS)"); // @categories Spells and Disciplines - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->ResetAllDisciplineTimers(); - } - XSRETURN_EMPTY; +std::string Perl_Client_GetIPString(Client* self) // @categories Account and Character +{ + return self->GetIPString(); } -XS(XS_Client_SendToInstance); -XS(XS_Client_SendToInstance) { - dXSARGS; - if (items != 10) - Perl_croak(aTHX_ "Usage: Client::SendToInstance(THIS, string instance_type, string zone_short_name, uint32 instance_version, float x, float y, float z, float heading, string instance_identifier, uint32 duration)"); - { - Client* THIS; - std::string instance_type = (std::string) SvPV_nolen(ST(1)); - std::string zone_short_name = (std::string) SvPV_nolen(ST(2)); - uint32 instance_version = (uint32) SvUV(ST(3)); - float x = (float) SvNV(ST(4)); - float y = (float) SvNV(ST(5)); - float z = (float) SvNV(ST(6)); - float heading = (float) SvNV(ST(7)); - std::string instance_identifier = (std::string) SvPV_nolen(ST(8)); - uint32 duration = (uint32) SvUV(ST(9)); - VALIDATE_THIS_IS_CLIENT; - THIS->SendToInstance(instance_type, zone_short_name, instance_version, x, y, z, heading, instance_identifier, duration); - } - XSRETURN_EMPTY; +void Perl_Client_SetIPExemption(Client* self, int exemption_amount) // @categories Account and Character +{ + self->SetIPExemption(exemption_amount); } -XS(XS_Client_CountItem); -XS(XS_Client_CountItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::CountItem(THIS, uint32 item_id)"); - { - Client* THIS; - int item_count = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - item_count = THIS->CountItem(item_id); - XSprePUSH; - PUSHu((UV) item_count); - } - XSRETURN(1); +void Perl_Client_ReadBookByName(Client* self, std::string book_name, uint8 book_type) // @categories Script Utility +{ + self->ReadBookByName(book_name, book_type); } -XS(XS_Client_RemoveItem); -XS(XS_Client_RemoveItem) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: Client::RemoveItem(THIS, uint32 item_id, [uint32 quantity = 1])"); // @categories Spells and Disciplines - { - Client *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - uint32 quantity = 1; - VALIDATE_THIS_IS_CLIENT; - if (items == 3) { - quantity = (uint32) SvUV(ST(2)); - } - - THIS->RemoveItem(item_id, quantity); - } - XSRETURN_EMPTY; +void Perl_Client_UntrainDiscBySpellID(Client* self, uint16 spell_id) // @categories Spells and Disciplines +{ + self->UntrainDiscBySpellID(spell_id); } -XS(XS_Client_DialogueWindow); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DialogueWindow) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::DialogueWindow(THIS, string window_markdown)"); // @categories Script Utility - { - Client *THIS; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - - std::string window_markdown(SvPV_nolen(ST(1))); - DialogueWindow::Render(THIS, window_markdown); - } - XSRETURN_EMPTY; +void Perl_Client_UntrainDiscBySpellID(Client* self, uint16 spell_id, bool update_client) // @categories Spells and Disciplines +{ + self->UntrainDiscBySpellID(spell_id, update_client); } -XS(XS_Client_DiaWind); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_DiaWind) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::DiaWind(THIS, string window_markdown)"); // @categories Script Utility - { - Client *THIS; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - - std::string window_markdown(SvPV_nolen(ST(1))); - DialogueWindow::Render(THIS, window_markdown); - - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetIPExemption); -XS(XS_Client_GetIPExemption) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetIPExemption(THIS)"); // @categories Account and Character - { - Client* THIS; - int exemption_amount = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - exemption_amount = THIS->GetIPExemption(); - XSprePUSH; - PUSHi((IV) exemption_amount); - } - XSRETURN(1); -} - -XS(XS_Client_GetIPString); -XS(XS_Client_GetIPString) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetIPString(THIS)"); // @categories Account and Character - { - Client *THIS; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - std::string ip_string = THIS->GetIPString(); - sv_setpv(TARG, ip_string.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Client_SetIPExemption); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetIPExemption) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetIPExemption(THIS, int exemption_amount)"); // @categories Account and Character - { - Client *THIS; - int exemption_amount = (int) SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - THIS->SetIPExemption(exemption_amount); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ReadBookByName); -XS(XS_Client_ReadBookByName) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::ReadBookByName(THIS, string book_name, uint8 book_type)"); // @categories Script Utility - { - Client *THIS; - std::string book_name(SvPV_nolen(ST(1))); - uint8 book_type = (uint8) SvUV(ST(2)); - VALIDATE_THIS_IS_CLIENT; - THIS->ReadBookByName(book_name, book_type); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UntrainDiscBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_UntrainDiscBySpellID) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::UntrainDiscBySpellID(THIS, uint16 spell_id, [bool update_client = true])"); // @categories Spells and Disciplines - { - Client *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - bool update_client = true; - VALIDATE_THIS_IS_CLIENT; - if (items == 3) { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->UntrainDiscBySpellID(spell_id, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SummonBaggedItems); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SummonBaggedItems) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Client::SummonBaggedItems(THIS, uint32 bag_item_id, ARRAYREF bag_items_array)"); // @categories Inventory and Items, Script Utility - } - - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - - uint32 bag_item_id = (uint32) SvUV(ST(1)); - - // verify we're receiving a reference to an array type - SV* bag_items_avref = ST(2); - if (!bag_items_avref || !SvROK(bag_items_avref) || SvTYPE(SvRV(bag_items_avref)) != SVt_PVAV) { - Perl_croak(aTHX_ "Client::SummonBaggedItems second argument is not a reference to an array"); - } - - // dereference into the array - AV* bag_items_av = (AV*)SvRV(bag_items_avref); - +void Perl_Client_SummonBaggedItems(Client* self, uint32 bag_item_id, perl::reference bag_items_ref) // @categories Inventory and Items, Script Utility +{ std::vector bagged_items; - auto count = av_len(bag_items_av) + 1; - for (int i = 0; i < count; ++i) { - SV** element = av_fetch(bag_items_av, i, 0); - - // verify array element is a hash reference containing item details - if (element && SvROK(*element) && SvTYPE(SvRV(*element)) == SVt_PVHV) { - HV* hash = (HV*)SvRV(*element); // dereference - - SV** item_id_ptr = hv_fetchs(hash, "item_id", false); - SV** item_charges_ptr = hv_fetchs(hash, "charges", false); - SV** attuned_ptr = hv_fetchs(hash, "attuned", false); - SV** augment_one_ptr = hv_fetchs(hash, "augment_one", false); - SV** augment_two_ptr = hv_fetchs(hash, "augment_two", false); - SV** augment_three_ptr = hv_fetchs(hash, "augment_three", false); - SV** augment_four_ptr = hv_fetchs(hash, "augment_four", false); - SV** augment_five_ptr = hv_fetchs(hash, "augment_five", false); - SV** augment_six_ptr = hv_fetchs(hash, "augment_six", false); - if (item_id_ptr && item_charges_ptr) { - ServerLootItem_Struct item{}; - item.item_id = static_cast(SvUV(*item_id_ptr)); - item.charges = static_cast(SvIV(*item_charges_ptr)); - item.attuned = attuned_ptr ? static_cast(SvUV(*attuned_ptr)) : 0; - item.aug_1 = augment_one_ptr ? static_cast(SvUV(*augment_one_ptr)) : 0; - item.aug_2 = augment_two_ptr ? static_cast(SvUV(*augment_two_ptr)) : 0; - item.aug_3 = augment_three_ptr ? static_cast(SvUV(*augment_three_ptr)) : 0; - item.aug_4 = augment_four_ptr ? static_cast(SvUV(*augment_four_ptr)) : 0; - item.aug_5 = augment_five_ptr ? static_cast(SvUV(*augment_five_ptr)) : 0; - item.aug_6 = augment_six_ptr ? static_cast(SvUV(*augment_six_ptr)) : 0; - bagged_items.emplace_back(item); - } + perl::array bag_items = bag_items_ref; + for (perl::hash bag_item : bag_items) // only works if all elements are hashrefs + { + if (bag_item.exists("item_id") && bag_item.exists("charges")) + { + ServerLootItem_Struct item{}; + item.item_id = bag_item["item_id"]; + item.charges = bag_item["charges"]; + item.attuned = bag_item.exists("attuned") ? bag_item["attuned"] : 0; + item.aug_1 = bag_item.exists("augment_one") ? bag_item["augment_one"] : 0; + item.aug_2 = bag_item.exists("augment_two") ? bag_item["augment_two"] : 0; + item.aug_3 = bag_item.exists("augment_three") ? bag_item["augment_three"] : 0; + item.aug_4 = bag_item.exists("augment_four") ? bag_item["augment_four"] : 0; + item.aug_5 = bag_item.exists("augment_five") ? bag_item["augment_five"] : 0; + item.aug_6 = bag_item.exists("augment_six") ? bag_item["augment_six"] : 0; + bagged_items.emplace_back(item); } } - THIS->SummonBaggedItems(bag_item_id, bagged_items); - - XSRETURN_EMPTY; + self->SummonBaggedItems(bag_item_id, bagged_items); } -XS(XS_Client_RemoveLDoNLoss); -XS(XS_Client_RemoveLDoNLoss) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::RemoveLDoNLoss(THIS, uint32 theme_id)"); +void Perl_Client_RemoveLDoNLoss(Client* self, uint32 theme_id) +{ + self->UpdateLDoNWinLoss(theme_id, false, true); +} + +void Perl_Client_RemoveLDoNWin(Client* self, uint32 theme_id) +{ + self->UpdateLDoNWinLoss(theme_id, true, true); +} + +int Perl_Client_GetFreeDisciplineSlot(Client* self) // @categories Spells and Disciplines +{ + return self->GetNextAvailableDisciplineSlot(); +} + +int Perl_Client_GetFreeDisciplineSlot(Client* self, int starting_slot) // @categories Spells and Disciplines +{ + return self->GetNextAvailableDisciplineSlot(starting_slot); +} + +int Perl_Client_ScribeSpells(Client* self, uint8 min_level, uint8 max_level) // @categories Spells and Disciplines +{ + return self->ScribeSpells(min_level, max_level); +} + +int Perl_Client_LearnDisciplines(Client* self, uint8 min_level, uint8 max_level) // @categories Spells and Disciplines +{ + return self->LearnDisciplines(min_level, max_level); +} + +void Perl_Client_ResetCastbarCooldownBySlot(Client* self, int slot) +{ + self->ResetCastbarCooldownBySlot(slot); +} + +void Perl_Client_ResetAllCastbarCooldowns(Client* self) +{ + self->ResetAllCastbarCooldowns(); +} + +void Perl_Client_ResetCastbarCooldownBySpellID(Client* self, uint32 spell_id) +{ + self->ResetCastbarCooldownBySpellID(spell_id); +} + +void Perl_Client_UnscribeSpellBySpellID(Client* self, uint16 spell_id) +{ + self->UnscribeSpellBySpellID(spell_id); +} + +void Perl_Client_UnscribeSpellBySpellID(Client* self, uint16 spell_id, bool update_client) +{ + self->UnscribeSpellBySpellID(spell_id, update_client); +} + +int Perl_Client_GetEnvironmentDamageModifier(Client* self) // @categories Script Utility +{ + return self->GetEnvironmentDamageModifier(); +} + +void Perl_Client_SetEnvironmentDamageModifier(Client* self, int modifier) // @categories Script Utility +{ + self->SetEnvironmentDamageModifier(modifier); +} + +bool Perl_Client_GetInvulnerableEnvironmentDamage(Client* self) // @categories Script Utility +{ + return self->GetInvulnerableEnvironmentDamage(); +} + +void Perl_Client_SetInvulnerableEnvironmentDamage(Client* self, bool invul) // @categories Script Utility +{ + self->SetInvulnerableEnvironmentDamage(invul); +} + +void Perl_Client_AddItem(Client* self, perl::reference table_ref) +{ + perl::hash table = table_ref; + if (!table.exists("item_id") || !table.exists("charges")) { - Client* THIS; - uint32 theme_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateLDoNWinLoss(theme_id, false, true); + return; } - XSRETURN_EMPTY; + + uint32 item_id = table["item_id"]; + int16 charges = table["charges"]; + uint32 augment_one = table.exists("augment_one") ? table["augment_one"] : 0; + uint32 augment_two = table.exists("augment_two") ? table["augment_two"] : 0; + uint32 augment_three = table.exists("augment_three") ? table["augment_three"] : 0; + uint32 augment_four = table.exists("augment_four") ? table["augment_four"] : 0; + uint32 augment_five = table.exists("augment_five") ? table["augment_five"] : 0; + uint32 augment_six = table.exists("augment_six") ? table["augment_six"] : 0; + bool attuned = table.exists("attuned") ? table["attuned"] : false; + uint16 slot_id = table.exists("slot_id") ? table["slot_id"] : EQ::invslot::slotCursor; + + self->SummonItem(item_id, charges, augment_one, augment_two, augment_three, + augment_four, augment_five, augment_six, attuned, slot_id); } -XS(XS_Client_RemoveLDoNWin); -XS(XS_Client_RemoveLDoNWin) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::RemoveLDoNWin(THIS, uint32 theme_id)"); +int Perl_Client_CountAugmentEquippedByID(Client* self, uint32 item_id) +{ + return self->GetInv().CountAugmentEquippedByID(item_id); +} + +bool Perl_Client_HasAugmentEquippedByID(Client* self, uint32 item_id) +{ + return self->GetInv().HasAugmentEquippedByID(item_id); +} + +int Perl_Client_CountItemEquippedByID(Client* self, uint32 item_id) +{ + return self->GetInv().CountItemEquippedByID(item_id); +} + +bool Perl_Client_HasItemEquippedByID(Client* self, uint32 item_id) +{ + return self->GetInv().HasItemEquippedByID(item_id); +} + +void Perl_Client_AddPlatinum(Client* self, uint32 platinum) +{ + self->AddPlatinum(platinum); +} + +void Perl_Client_AddPlatinum(Client* self, uint32 platinum, bool update_client) +{ + self->AddPlatinum(platinum, update_client); +} + +uint32 Perl_Client_GetCarriedPlatinum(Client* self) +{ + return self->GetCarriedPlatinum(); +} + +bool Perl_Client_TakePlatinum(Client* self, uint32 platinum) +{ + return self->TakePlatinum(platinum); +} + +bool Perl_Client_TakePlatinum(Client* self, uint32 platinum, bool update_client) +{ + return self->TakePlatinum(platinum, update_client); +} + +void Perl_Client_ClearPEQZoneFlag(Client* self, uint32 zone_id) +{ + self->ClearPEQZoneFlag(zone_id); +} + +bool Perl_Client_HasPEQZoneFlag(Client* self, uint32 zone_id) +{ + return self->HasPEQZoneFlag(zone_id); +} + +void Perl_Client_LoadPEQZoneFlags(Client* self) +{ + self->LoadPEQZoneFlags(); +} + +void Perl_Client_SendPEQZoneFlagInfo(Client* self, Client* to) +{ + self->SendPEQZoneFlagInfo(to); +} + +void Perl_Client_SetPEQZoneFlag(Client* self, uint32 zone_id) +{ + self->SetPEQZoneFlag(zone_id); +} + +int Perl_Client_GetHealAmount(Client* self) +{ + return self->GetHealAmt(); +} + +int Perl_Client_GetSpellDamage(Client* self) +{ + return self->GetSpellDmg(); +} + +void Perl_Client_TaskSelector(Client* self, perl::array task_ids) +{ + int tasks[MAXCHOOSERENTRIES] = { 0 }; + int task_count = 0; + + for (int i = 0; i < task_ids.size() && i < MAXCHOOSERENTRIES; ++i) { - Client* THIS; - uint32 theme_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->UpdateLDoNWinLoss(theme_id, true, true); + tasks[i] = task_ids[i]; + ++task_count; } - XSRETURN_EMPTY; + + self->TaskQuestSetSelector(self, task_count, tasks); } -XS(XS_Client_GetFreeDisciplineSlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetFreeDisciplineSlot) { - dXSARGS; - if (items != 1 || items != 2) - Perl_croak(aTHX_ "Usage: Client::GetFreeDisciplineSlot(THIS, [int starting_slot = 0])"); // @categories Spells and Disciplines - { - Client *THIS; - int free_discipline_slot; - int starting_slot = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - if (items == 2) { - starting_slot = SvIV(ST(1)); - } +void perl_register_client() +{ + perl::interpreter perl(PERL_GET_THX); - free_discipline_slot = THIS->GetNextAvailableDisciplineSlot(starting_slot); - XSprePUSH; - PUSHi((IV) free_discipline_slot); - } - XSRETURN(1); -} - -XS(XS_Client_ScribeSpells); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ScribeSpells) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::ScribeSpells(THIS, uint8 min_level, uint8 max_level)"); // @categories Spells and Disciplines - { - Client *THIS; - uint8 min_level = (uint8) SvUV(ST(1)); - uint8 max_level = (uint8) SvUV(ST(2)); - uint16 scribed_spells = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - - scribed_spells = THIS->ScribeSpells(min_level, max_level); - XSprePUSH; - PUSHu((UV) scribed_spells); - } - XSRETURN(1); -} - -XS(XS_Client_LearnDisciplines); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_LearnDisciplines) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Client::LearnDisciplines(THIS, uint8 min_level, uint8 max_level)"); // @categories Spells and Disciplines - { - Client *THIS; - uint8 min_level = (uint8) SvUV(ST(1)); - uint8 max_level = (uint8) SvUV(ST(2)); - uint16 learned_disciplines = 0; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - - learned_disciplines = THIS->LearnDisciplines(min_level, max_level); - XSprePUSH; - PUSHu((UV) learned_disciplines); - } - XSRETURN(1); -} - -XS(XS_Client_ResetCastbarCooldownBySlot); -XS(XS_Client_ResetCastbarCooldownBySlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ResetCastbarCooldownBySlot(THIS, int slot)"); - { - Client* THIS; - int slot = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ResetCastbarCooldownBySlot(slot); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ResetAllCastbarCooldowns); -XS(XS_Client_ResetAllCastbarCooldowns) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::ResetAllCastbarCooldowns(THIS)"); - { - Client* THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->ResetAllCastbarCooldowns(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_ResetCastbarCooldownBySpellID); -XS(XS_Client_ResetCastbarCooldownBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ResetCastbarCooldownBySpellID(THIS, uint32 spell_id)"); - { - Client* THIS; - uint32 spell_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ResetCastbarCooldownBySpellID(spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_UnscribeSpellBySpellID); -XS(XS_Client_UnscribeSpellBySpellID) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: Client::UnscribeSpellBySpellID(THIS, uint16 spell_id, [bool update_client = true])"); - { - Client* THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - bool update_client = true; - VALIDATE_THIS_IS_CLIENT; - - if (items == 3) { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->UnscribeSpellBySpellID(spell_id, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetEnvironmentDamageModifier); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetEnvironmentDamageModifier) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetEnvironmentDamageModifier(THIS)"); // @categories Script Utility - { - Client* THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetEnvironmentDamageModifier(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_SetEnvironmentDamageModifier); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetEnvironmentDamageModifier) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetEnvironmentDamageModifier(THIS, int32 modifier)"); // @categories Script Utility - { - Client* THIS; - int32 modifier = (int32)SvIV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetEnvironmentDamageModifier(modifier); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetInvulnerableEnvironmentDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetInvulnerableEnvironmentDamage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::InvulnerableEnvironmentDamage(THIS)"); // @categories Script Utility - { - Client* THIS; - bool RETVAL; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetInvulnerableEnvironmentDamage(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_SetInvulnerableEnvironmentDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetInvulnerableEnvironmentDamage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage:Client::SetInvulnerableEnvironmentDamage(THIS, bool invulnerable)"); // @categories Script Utility - { - Client *THIS; - bool invul = (bool)SvTRUE(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetInvulnerableEnvironmentDamage(invul); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_AddItem); -XS(XS_Client_AddItem) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Client::AddItem(THIS, HASHREF item_table)"); - } - - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - - SV* item_table = ST(1); - if (!item_table || !SvROK(item_table)) { - Perl_croak(aTHX_ "Client::AddItem argument is not a reference type"); - } - - HV* item_table_hash = (HV*)SvRV(item_table); - if (SvTYPE(item_table_hash) != SVt_PVHV) { - Perl_croak(aTHX_ "Client::AddItem reference argument is not to a hash type"); - } - - SV** item_id_ptr = hv_fetchs(item_table_hash, "item_id", false); - SV** item_charges_ptr = hv_fetchs(item_table_hash, "charges", false); - SV** augment_one_ptr = hv_fetchs(item_table_hash, "augment_one", false); - SV** augment_two_ptr = hv_fetchs(item_table_hash, "augment_two", false); - SV** augment_three_ptr = hv_fetchs(item_table_hash, "augment_three", false); - SV** augment_four_ptr = hv_fetchs(item_table_hash, "augment_four", false); - SV** augment_five_ptr = hv_fetchs(item_table_hash, "augment_five", false); - SV** augment_six_ptr = hv_fetchs(item_table_hash, "augment_six", false); - SV** attuned_ptr = hv_fetchs(item_table_hash, "attuned", false); - SV** slot_id_ptr = hv_fetchs(item_table_hash, "slot_id", false); - if (item_id_ptr && item_charges_ptr) { - uint32 item_id = static_cast(SvUV(*item_id_ptr)); - int16 charges = static_cast(SvIV(*item_charges_ptr)); - uint32 augment_one = augment_one_ptr ? static_cast(SvUV(*augment_one_ptr)) : 0; - uint32 augment_two = augment_two_ptr ? static_cast(SvUV(*augment_two_ptr)) : 0; - uint32 augment_three = augment_three_ptr ? static_cast(SvUV(*augment_three_ptr)) : 0; - uint32 augment_four = augment_four_ptr ? static_cast(SvUV(*augment_four_ptr)) : 0; - uint32 augment_five = augment_five_ptr ? static_cast(SvUV(*augment_five_ptr)) : 0; - uint32 augment_six = augment_six_ptr ? static_cast(SvUV(*augment_six_ptr)) : 0; - bool attuned = attuned_ptr ? static_cast(SvTRUE(*attuned_ptr)) : false; - uint16 slot_id = slot_id_ptr ? static_cast(SvUV(*slot_id_ptr)) : EQ::invslot::slotCursor; - THIS->SummonItem( - item_id, - charges, - augment_one, - augment_two, - augment_three, - augment_four, - augment_five, - augment_six, - attuned, - slot_id - ); - } - - XSRETURN_EMPTY; -} - -XS(XS_Client_HasAugmentEquippedByID); -XS(XS_Client_HasAugmentEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasAugmentEquippedByID(THIS, uint32 item_id)"); - { - Client *THIS; - bool has_equipped = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - has_equipped = THIS->GetInv().HasAugmentEquippedByID(item_id); - ST(0) = boolSV(has_equipped); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_CountAugmentEquippedByID); -XS(XS_Client_CountAugmentEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::CountAugmentEquippedByID(THIS, uint32 item_id)"); - { - Client *THIS; - int quantity = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - quantity = THIS->GetInv().CountAugmentEquippedByID(item_id); - XSprePUSH; - PUSHi((IV) quantity); - } - XSRETURN(1); -} - -XS(XS_Client_AddPlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_AddPlatinum) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::AddPlatinum(THIS, uint32 platinum, [bool update_client = false])"); // @categories Currency and Points - { - Client *THIS; - uint32 platinum = (uint32) SvUV(ST(1)); - bool update_client = false; - VALIDATE_THIS_IS_CLIENT; - - if (items == 3) { - update_client = (bool) SvTRUE(ST(2)); - } - - THIS->AddPlatinum(platinum, update_client); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetCarriedPlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_GetCarriedPlatinum) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetCarriedPlatinum(THIS)"); // @categories Currency and Points - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetCarriedPlatinum(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_HasItemEquippedByID); -XS(XS_Client_HasItemEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasItemEquippedByID(THIS, uint32 item_id)"); - { - Client *THIS; - bool has_equipped = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - has_equipped = THIS->GetInv().HasItemEquippedByID(item_id); - ST(0) = boolSV(has_equipped); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_CountItemEquippedByID); -XS(XS_Client_CountItemEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::CountItemEquippedByID(THIS, uint32 item_id)"); - { - Client *THIS; - int quantity = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - quantity = THIS->GetInv().CountItemEquippedByID(item_id); - XSprePUSH; - PUSHi((IV) quantity); - } - XSRETURN(1); -} - -XS(XS_Client_TakePlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_TakePlatinum) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Client::TakePlatinum(THIS, uint32 platinum, [bool update_client = false])"); // @categories Currency and Points - { - Client *THIS; - uint32 platinum = (uint32) SvUV(ST(1)); - bool has_money = false; - bool update_client = false; - VALIDATE_THIS_IS_CLIENT; - - if (items == 3) { - update_client = (bool) SvTRUE(ST(2)); - } - - has_money = THIS->TakePlatinum(platinum, update_client); - ST(0) = boolSV(has_money); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_ClearPEQZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_ClearPEQZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::ClearPEQZoneFlag(THIS, uint32 zone_id)"); // @categories Script Utility - { - Client *THIS; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->ClearPEQZoneFlag(zone_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_HasPEQZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_HasPEQZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::HasPEQZoneFlag(THIS, uint32 zone_id)"); // @categories Account and Character - { - Client *THIS; - bool RETVAL; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->HasPEQZoneFlag(zone_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Client_LoadPEQZoneFlags); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_LoadPEQZoneFlags) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::LoadPEQZoneFlags(THIS)"); // @categories Zones - { - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - THIS->LoadPEQZoneFlags(); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SendPEQZoneFlagInfo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SendPEQZoneFlagInfo) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SendPEQZoneFlagInfo(THIS, Client* to)"); // @categories Account and Character, Zones - { - Client *THIS; - Client *to; - VALIDATE_THIS_IS_CLIENT; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - to = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "to is not of type Client"); - if (to == nullptr) - Perl_croak(aTHX_ "to is nullptr, avoiding crash."); - - THIS->SendPEQZoneFlagInfo(to); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_SetPEQZoneFlag); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_SetPEQZoneFlag) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Client::SetPEQZoneFlag(THIS, uint32 zone_id)"); // @categories Account and Character, PEQZones - { - Client *THIS; - uint32 zone_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CLIENT; - THIS->SetPEQZoneFlag(zone_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Client_GetHealAmount); -XS(XS_Client_GetHealAmount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetHealAmount(THIS)"); // @categories Stats and Attributes, Scriot Utility - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetHealAmt(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_GetSpellDamage); -XS(XS_Client_GetSpellDamage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Client::GetSpellDamage(THIS)"); // @categories Stats and Attributes, Scriot Utility - { - Client *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CLIENT; - RETVAL = THIS->GetSpellDmg(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Client_TaskSelector); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Client_TaskSelector) { - dXSARGS; - if (items < 2 || items > 41) { - Perl_croak(aTHX_ "Usage: Client::TaskSelector(THIS, int task_id, 2, 3, 4, 5 [up to 40])"); - } - - Client *THIS; - VALIDATE_THIS_IS_CLIENT; - - int tasks[MAXCHOOSERENTRIES]; - int task_count = (items - 1); - for (int i = 1; i <= task_count; i++) { - tasks[i] = (int) SvIV(ST(i)); - } - - THIS->TaskQuestSetSelector(THIS, task_count, tasks); - XSRETURN_EMPTY; -} - -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Client); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Client) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AccountID"), XS_Client_AccountID, file, "$"); - newXSproto(strcpy(buf, "AccountName"), XS_Client_AccountName, file, "$"); - newXSproto(strcpy(buf, "AddAAPoints"), XS_Client_AddAAPoints, file, "$$"); - newXSproto(strcpy(buf, "AddAlternateCurrencyValue"), XS_Client_AddAlternateCurrencyValue, file, "$$$"); - newXSproto(strcpy(buf, "AddCrystals"), XS_Client_AddCrystals, file, "$$"); - newXSproto(strcpy(buf, "AddEXP"), XS_Client_AddEXP, file, "$$;$$"); - newXSproto(strcpy(buf, "AddExpeditionLockout"), XS_Client_AddExpeditionLockout, file, "$$$$;$"); - newXSproto(strcpy(buf, "AddExpeditionLockoutDuration"), XS_Client_AddExpeditionLockoutDuration, file, "$$$$;$"); - newXSproto(strcpy(buf, "AddItem"), XS_Client_AddItem, file, "$$"); - newXSproto(strcpy(buf, "AddLDoNLoss"), XS_Client_AddLDoNLoss, file, "$$"); - newXSproto(strcpy(buf, "AddLDoNWin"), XS_Client_AddLDoNWin, file, "$$"); - newXSproto(strcpy(buf, "AddLevelBasedExp"), XS_Client_AddLevelBasedExp, file, "$$;$$"); - newXSproto(strcpy(buf, "AddMoneyToPP"), XS_Client_AddMoneyToPP, file, "$$$$$;$"); - newXSproto(strcpy(buf, "AddPlatinum"), XS_Client_AddPlatinum, file, "$$;$"); - newXSproto(strcpy(buf, "AddPVPPoints"), XS_Client_AddPVPPoints, file, "$$"); - newXSproto(strcpy(buf, "AddSkill"), XS_Client_AddSkill, file, "$$$"); - newXSproto(strcpy(buf, "Admin"), XS_Client_Admin, file, "$"); - newXSproto(strcpy(buf, "AssignTask"), XS_Client_AssignTask, file, "$$;$$"); - newXSproto(strcpy(buf, "AssignToInstance"), XS_Client_AssignToInstance, file, "$$"); - newXSproto(strcpy(buf, "AutoSplitEnabled"), XS_Client_AutoSplitEnabled, file, "$"); - newXSproto(strcpy(buf, "BreakInvis"), XS_Client_BreakInvis, file, "$"); - newXSproto(strcpy(buf, "CalcEXP"), XS_Client_CalcEXP, file, "$"); - newXSproto(strcpy(buf, "CalcPriceMod"), XS_Client_CalcPriceMod, file, "$;$$"); - newXSproto(strcpy(buf, "CanHaveSkill"), XS_Client_CanHaveSkill, file, "$$"); - newXSproto(strcpy(buf, "ChangeLastName"), XS_Client_ChangeLastName, file, "$$"); - newXSproto(strcpy(buf, "CharacterID"), XS_Client_CharacterID, file, "$"); - newXSproto(strcpy(buf, "CheckIncreaseSkill"), XS_Client_CheckIncreaseSkill, file, "$$;$"); - newXSproto(strcpy(buf, "CheckSpecializeIncrease"), XS_Client_CheckSpecializeIncrease, file, "$$"); - newXSproto(strcpy(buf, "ClearCompassMark"), XS_Client_ClearCompassMark, file, "$"); - newXSproto(strcpy(buf, "ClearPEQZoneFlag"), XS_Client_ClearPEQZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "ClearZoneFlag"), XS_Client_ClearZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "Connected"), XS_Client_Connected, file, "$"); - newXSproto(strcpy(buf, "CountAugmentEquippedByID"), XS_Client_CountAugmentEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "CountItem"), XS_Client_CountItem, file, "$$"); - newXSproto(strcpy(buf, "CountItemEquippedByID"), XS_Client_CountItemEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "CreateExpedition"), XS_Client_CreateExpedition, file, "$$$$$$$;$"); - newXSproto(strcpy(buf, "CreateTaskDynamicZone"), XS_Client_CreateTaskDynamicZone, file, "$$"); - newXSproto(strcpy(buf, "DecreaseByID"), XS_Client_DecreaseByID, file, "$$$"); - newXSproto(strcpy(buf, "DeleteItemInInventory"), XS_Client_DeleteItemInInventory, file, "$$;$$"); - newXSproto(strcpy(buf, "DiaWind"), XS_Client_DiaWind, file, "$$"); - newXSproto(strcpy(buf, "DialogueWindow"), XS_Client_DialogueWindow, file, "$$"); - newXSproto(strcpy(buf, "Disconnect"), XS_Client_Disconnect, file, "$"); - newXSproto(strcpy(buf, "DropItem"), XS_Client_DropItem, file, "$$"); - newXSproto(strcpy(buf, "Duck"), XS_Client_Duck, file, "$"); - newXSproto(strcpy(buf, "DyeArmorBySlot"), XS_Client_DyeArmorBySlot, file, "$$$$$;$"); - newXSproto(strcpy(buf, "Escape"), XS_Client_Escape, file, "$"); - newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$"); - newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$"); - newXSproto(strcpy(buf, "FindEmptyMemSlot"), XS_Client_FindEmptyMemSlot, file, "$"); - newXSproto(strcpy(buf, "FindMemmedSpellBySlot"), XS_Client_FindMemmedSpellBySlot, file, "$$"); - newXSproto(strcpy(buf, "FindMemmedSpellBySpellID"), XS_Client_FindMemmedSpellBySpellID, file, "$$"); - newXSproto(strcpy(buf, "Fling"), XS_Client_Fling, file, "$$$$$;$$"); - newXSproto(strcpy(buf, "ForageItem"), XS_Client_ForageItem, file, "$"); - newXSproto(strcpy(buf, "Freeze"), XS_Client_Freeze, file, "$"); - newXSproto(strcpy(buf, "GMKill"), XS_Client_GMKill, file, "$"); - newXSproto(strcpy(buf, "GetAAEXPModifier"), XS_Client_GetAAEXPModifier, file, "$$"); - newXSproto(strcpy(buf, "GetAAExp"), XS_Client_GetAAExp, file, "$"); - newXSproto(strcpy(buf, "GetAALevel"), XS_Client_GetAALevel, file, "$$"); - newXSproto(strcpy(buf, "GetAAPercent"), XS_Client_GetAAPercent, file, "$"); - newXSproto(strcpy(buf, "GetAAPoints"), XS_Client_GetAAPoints, file, "$$"); - newXSproto(strcpy(buf, "GetAFK"), XS_Client_GetAFK, file, "$"); - newXSproto(strcpy(buf, "GetAccountAge"), XS_Client_GetAccountAge, file, "$"); - newXSproto(strcpy(buf, "GetAccountFlag"), XS_Client_GetAccountFlag, file, "$$"); - newXSproto(strcpy(buf, "GetAggroCount"), XS_Client_GetAggroCount, file, "$"); - newXSproto(strcpy(buf, "GetAllMoney"), XS_Client_GetAllMoney, file, "$"); - newXSproto(strcpy(buf, "GetAlternateCurrencyValue"), XS_Client_GetAlternateCurrencyValue, file, "$$"); - newXSproto(strcpy(buf, "GetAnon"), XS_Client_GetAnon, file, "$"); - newXSproto(strcpy(buf, "GetAugmentAt"), XS_Client_GetAugmentAt, file, "$$$"); - newXSproto(strcpy(buf, "GetAugmentIDAt"), XS_Client_GetAugmentIDAt, file, "$$$"); - newXSproto(strcpy(buf, "GetBaseAGI"), XS_Client_GetBaseAGI, file, "$"); - newXSproto(strcpy(buf, "GetBaseCHA"), XS_Client_GetBaseCHA, file, "$"); - newXSproto(strcpy(buf, "GetBaseDEX"), XS_Client_GetBaseDEX, file, "$"); - newXSproto(strcpy(buf, "GetBaseFace"), XS_Client_GetBaseFace, file, "$"); - newXSproto(strcpy(buf, "GetBaseINT"), XS_Client_GetBaseINT, file, "$"); - newXSproto(strcpy(buf, "GetBaseSTA"), XS_Client_GetBaseSTA, file, "$"); - newXSproto(strcpy(buf, "GetBaseSTR"), XS_Client_GetBaseSTR, file, "$"); - newXSproto(strcpy(buf, "GetBaseWIS"), XS_Client_GetBaseWIS, file, "$"); - newXSproto(strcpy(buf, "GetBecomeNPCLevel"), XS_Client_GetBecomeNPCLevel, file, "$"); - newXSproto(strcpy(buf, "GetBindHeading"), XS_Client_GetBindHeading, file, "$$"); - newXSproto(strcpy(buf, "GetBindX"), XS_Client_GetBindX, file, "$$"); - newXSproto(strcpy(buf, "GetBindY"), XS_Client_GetBindY, file, "$$"); - newXSproto(strcpy(buf, "GetBindZ"), XS_Client_GetBindZ, file, "$$"); - newXSproto(strcpy(buf, "GetBindZoneID"), XS_Client_GetBindZoneID, file, "$$"); - newXSproto(strcpy(buf, "GetCarriedMoney"), XS_Client_GetCarriedMoney, file, "$"); - newXSproto(strcpy(buf, "GetCarriedPlatinum"), XS_Client_GetCarriedPlatinum, file, "$"); - newXSproto(strcpy(buf, "GetCharacterFactionLevel"), XS_Client_GetCharacterFactionLevel, file, "$$"); - newXSproto(strcpy(buf, "GetClassBitmask"), XS_Client_GetClassBitmask, file, "$"); - newXSproto(strcpy(buf, "GetClientMaxLevel"), XS_Client_GetClientMaxLevel, file, "$"); - newXSproto(strcpy(buf, "GetClientVersion"), XS_Client_GetClientVersion, file, "$"); - newXSproto(strcpy(buf, "GetClientVersionBit"), XS_Client_GetClientVersionBit, file, "$"); - newXSproto(strcpy(buf, "GetCorpseCount"), XS_Client_GetCorpseCount, file, "$"); - newXSproto(strcpy(buf, "GetCorpseID"), XS_Client_GetCorpseID, file, "$$"); - newXSproto(strcpy(buf, "GetCorpseItemAt"), XS_Client_GetCorpseItemAt, file, "$$$"); - newXSproto(strcpy(buf, "GetCustomItemData"), XS_Client_GetCustomItemData, file, "$$$"); - newXSproto(strcpy(buf, "GetDiscSlotBySpellID"), XS_Client_GetDiscSlotBySpellID, file, "$$"); - newXSproto(strcpy(buf, "GetDisciplineTimer"), XS_Client_GetDisciplineTimer, file, "$$"); - newXSproto(strcpy(buf, "GetDuelTarget"), XS_Client_GetDuelTarget, file, "$"); - newXSproto(strcpy(buf, "GetEnvironmentDamageModifier"), XS_Client_GetEnvironmentDamageModifier, file, "$"); - newXSproto(strcpy(buf, "GetEXP"), XS_Client_GetEXP, file, "$"); - newXSproto(strcpy(buf, "GetEXPModifier"), XS_Client_GetEXPModifier, file, "$$"); - newXSproto(strcpy(buf, "GetEbonCrystals"), XS_Client_GetEbonCrystals, file, "$"); - newXSproto(strcpy(buf, "GetEndurance"), XS_Client_GetEndurance, file, "$"); - newXSproto(strcpy(buf, "GetEnduranceRatio"), XS_Client_GetEnduranceRatio, file, "$"); - newXSproto(strcpy(buf, "GetExpedition"), XS_Client_GetExpedition, file, "$"); - newXSproto(strcpy(buf, "GetExpeditionLockouts"), XS_Client_GetExpeditionLockouts, file, "$;$"); - newXSproto(strcpy(buf, "GetFace"), XS_Client_GetFace, file, "$"); - newXSproto(strcpy(buf, "GetFactionLevel"), XS_Client_GetFactionLevel, file, "$$$$$$$$"); - newXSproto(strcpy(buf, "GetFeigned"), XS_Client_GetFeigned, file, "$"); - newXSproto(strcpy(buf, "GetFreeDisciplineSlot"), XS_Client_GetFreeDisciplineSlot, file, "$;$"); - newXSproto(strcpy(buf, "GetFreeSpellBookSlot"), XS_Client_GetFreeSpellBookSlot, file, "$;$"); - newXSproto(strcpy(buf, "GetGM"), XS_Client_GetGM, file, "$"); - newXSproto(strcpy(buf, "GetGroup"), XS_Client_GetGroup, file, "$"); - newXSproto(strcpy(buf, "GetGroupPoints"), XS_Client_GetGroupPoints, file, "$"); - newXSproto(strcpy(buf, "GetHealAmount"), XS_Client_GetHealAmount, file, "$"); - newXSproto(strcpy(buf, "GetHorseId"), XS_Client_GetHorseId, file, "$"); - newXSproto(strcpy(buf, "GetHunger"), XS_Client_GetHunger, file, "$$"); - newXSproto(strcpy(buf, "GetIP"), XS_Client_GetIP, file, "$"); - newXSproto(strcpy(buf, "GetIPExemption"), XS_Client_GetIPExemption, file, "$"); - newXSproto(strcpy(buf, "GetIPString"), XS_Client_GetIPString, file, "$"); - newXSproto(strcpy(buf, "GetInstanceID"), XS_Client_GetInstanceID, file, "$$"); - newXSproto(strcpy(buf, "GetInstrumentMod"), XS_Client_GetInstrumentMod, file, "$$"); - newXSproto(strcpy(buf, "GetInventory"), XS_Client_GetInventory, file, "$"); - newXSproto(strcpy(buf, "GetInvulnerableEnvironmentDamage"), XS_Client_GetInvulnerableEnvironmentDamage, file, "$"); - newXSproto(strcpy(buf, "GetItemAt"), XS_Client_GetItemAt, file, "$$"); - newXSproto(strcpy(buf, "GetItemIDAt"), XS_Client_GetItemIDAt, file, "$$"); - newXSproto(strcpy(buf, "GetItemInInventory"), XS_Client_GetItemInInventory, file, "$$"); - newXSproto(strcpy(buf, "GetLDoNLosses"), XS_Client_GetLDoNLosses, file, "$"); - newXSproto(strcpy(buf, "GetLDoNLossesTheme"), XS_Client_GetLDoNLossesTheme, file, "$$"); - newXSproto(strcpy(buf, "GetLDoNPointsTheme"), XS_Client_GetLDoNPointsTheme, file, "$"); - newXSproto(strcpy(buf, "GetLDoNWins"), XS_Client_GetLDoNWins, file, "$"); - newXSproto(strcpy(buf, "GetLDoNWinsTheme"), XS_Client_GetLDoNWinsTheme, file, "$$"); - newXSproto(strcpy(buf, "GetLanguageSkill"), XS_Client_GetLanguageSkill, file, "$$"); - newXSproto(strcpy(buf, "GetLearnableDisciplines"), XS_Client_GetLearnableDisciplines, file, "$;$$"); - newXSproto(strcpy(buf, "GetLearnedDisciplines"), XS_Client_GetLearnedDisciplines, file, "$"); - newXSproto(strcpy(buf, "GetLockoutExpeditionUUID"), XS_Client_GetLockoutExpeditionUUID, file, "$$$"); - newXSproto(strcpy(buf, "GetMaxEndurance"), XS_Client_GetMaxEndurance, file, "$"); - newXSproto(strcpy(buf, "GetMemmedSpells"), XS_Client_GetMemmedSpells, file, "$"); - newXSproto(strcpy(buf, "GetModCharacterFactionLevel"), XS_Client_GetModCharacterFactionLevel, file, "$$"); - newXSproto(strcpy(buf, "GetMoney"), XS_Client_GetMoney, file, "$$$"); - newXSproto(strcpy(buf, "GetPVP"), XS_Client_GetPVP, file, "$"); - newXSproto(strcpy(buf, "GetPVPPoints"), XS_Client_GetPVPPoints, file, "$"); - newXSproto(strcpy(buf, "GetRaceBitmask"), XS_Client_GetRaceBitmask, file, "$"); - newXSproto(strcpy(buf, "GetRadiantCrystals"), XS_Client_GetRadiantCrystals, file, "$"); - newXSproto(strcpy(buf, "GetRaid"), XS_Client_GetRaid, file, "$"); - newXSproto(strcpy(buf, "GetRaidPoints"), XS_Client_GetRaidPoints, file, "$"); - newXSproto(strcpy(buf, "GetRawItemAC"), XS_Client_GetRawItemAC, file, "$"); - newXSproto(strcpy(buf, "GetRawSkill"), XS_Client_GetRawSkill, file, "$$"); - newXSproto(strcpy(buf, "GetScribeableSpells"), XS_Client_GetScribeableSpells, file, "$;$$"); - newXSproto(strcpy(buf, "GetScribedSpells"), XS_Client_GetScribedSpells, file, "$"); - newXSproto(strcpy(buf, "GetSkillPoints"), XS_Client_GetSkillPoints, file, "$"); - newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$"); - newXSproto(strcpy(buf, "GetSpellDamage"), XS_Client_GetSpellDamage, file, "$"); - newXSproto(strcpy(buf, "GetSpellIDByBookSlot"), XS_Client_GetSpellIDByBookSlot, file, "$$"); - newXSproto(strcpy(buf, "GetSpentAA"), XS_Client_GetSpentAA, file, "$$"); - newXSproto(strcpy(buf, "GetStartZone"), XS_Client_GetStartZone, file, "$"); - newXSproto(strcpy(buf, "GetTargetRingX"), XS_Client_GetTargetRingX, file, "$"); - newXSproto(strcpy(buf, "GetTargetRingY"), XS_Client_GetTargetRingY, file, "$"); - newXSproto(strcpy(buf, "GetTargetRingZ"), XS_Client_GetTargetRingZ, file, "$"); - newXSproto(strcpy(buf, "GetTaskActivityDoneCount"), XS_Client_GetTaskActivityDoneCount, file, "$$$"); - newXSproto(strcpy(buf, "GetThirst"), XS_Client_GetThirst, file, "$$"); - newXSproto(strcpy(buf, "GetTotalSecondsPlayed"), XS_Client_GetTotalSecondsPlayed, file, "$"); - newXSproto(strcpy(buf, "GetWeight"), XS_Client_GetWeight, file, "$"); - newXSproto(strcpy(buf, "GoFish"), XS_Client_GoFish, file, "$"); - newXSproto(strcpy(buf, "GrantAlternateAdvancementAbility"), XS_Client_GrantAlternateAdvancementAbility, file, "$$$;$"); - newXSproto(strcpy(buf, "GuildID"), XS_Client_GuildID, file, "$"); - newXSproto(strcpy(buf, "GuildRank"), XS_Client_GuildRank, file, "$"); - newXSproto(strcpy(buf, "HasAugmentEquippedByID"), XS_Client_HasAugmentEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "HasDisciplineLearned"), XS_Client_HasDisciplineLearned, file, "$$"); - newXSproto(strcpy(buf, "HasExpeditionLockout"), XS_Client_HasExpeditionLockout, file, "$$$"); - newXSproto(strcpy(buf, "HasItemEquippedByID"), XS_Client_HasItemEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "HasPEQZoneFlag"), XS_Client_HasPEQZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "HasSkill"), XS_Client_HasSkill, file, "$$"); - newXSproto(strcpy(buf, "HasSpellScribed"), XS_Client_HasSkill, file, "$$"); - newXSproto(strcpy(buf, "HasZoneFlag"), XS_Client_HasZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "Hungry"), XS_Client_Hungry, file, "$"); - newXSproto(strcpy(buf, "InZone"), XS_Client_InZone, file, "$"); - newXSproto(strcpy(buf, "IncStats"), XS_Client_IncStats, file, "$$$"); - newXSproto(strcpy(buf, "IncreaseLanguageSkill"), XS_Client_IncreaseLanguageSkill, file, "$$;$"); - newXSproto(strcpy(buf, "IncreaseSkill"), XS_Client_IncreaseSkill, file, "$$;$"); - newXSproto(strcpy(buf, "IncrementAA"), XS_Client_IncrementAA, file, "$$"); - newXSproto(strcpy(buf, "IsBecomeNPC"), XS_Client_IsBecomeNPC, file, "$"); - newXSproto(strcpy(buf, "IsCrouching"), XS_Client_IsCrouching, file, "$"); - newXSproto(strcpy(buf, "IsDueling"), XS_Client_IsDueling, file, "$"); - newXSproto(strcpy(buf, "IsGrouped"), XS_Client_IsGrouped, file, "$"); - newXSproto(strcpy(buf, "IsLD"), XS_Client_IsLD, file, "$"); - newXSproto(strcpy(buf, "IsMedding"), XS_Client_IsMedding, file, "$"); - newXSproto(strcpy(buf, "IsRaidGrouped"), XS_Client_IsRaidGrouped, file, "$"); - newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$"); - newXSproto(strcpy(buf, "IsStanding"), XS_Client_IsStanding, file, "$"); - newXSproto(strcpy(buf, "IsTaskActive"), XS_Client_IsTaskActive, file, "$$"); - newXSproto(strcpy(buf, "IsTaskActivityActive"), XS_Client_IsTaskActivityActive, file, "$$$"); - newXSproto(strcpy(buf, "IsTaskCompleted"), XS_Client_IsTaskCompleted, file, "$$"); - newXSproto(strcpy(buf, "KeyRingAdd"), XS_Client_KeyRingAdd, file, "$$"); - newXSproto(strcpy(buf, "KeyRingCheck"), XS_Client_KeyRingCheck, file, "$$"); - newXSproto(strcpy(buf, "Kick"), XS_Client_Kick, file, "$"); - newXSproto(strcpy(buf, "LearnDisciplines"), XS_Client_LearnDisciplines, file, "$$$"); - newXSproto(strcpy(buf, "LearnRecipe"), XS_Client_LearnRecipe, file, "$$"); - newXSproto(strcpy(buf, "LeaveGroup"), XS_Client_LeaveGroup, file, "$"); - newXSproto(strcpy(buf, "LoadPEQZoneFlags"), XS_Client_LoadPEQZoneFlags, file, "$"); - newXSproto(strcpy(buf, "LoadZoneFlags"), XS_Client_LoadZoneFlags, file, "$"); - newXSproto(strcpy(buf, "MarkCompassLoc"), XS_Client_MarkCompassLoc, file, "$$$$"); - newXSproto(strcpy(buf, "MaxSkill"), XS_Client_MaxSkill, file, "$$;$$"); - newXSproto(strcpy(buf, "MemSpell"), XS_Client_MemSpell, file, "$$$;$"); - newXSproto(strcpy(buf, "MemmedCount"), XS_Client_MemmedCount, file, "$"); - newXSproto(strcpy(buf, "MovePC"), XS_Client_MovePC, file, "$$$$$$"); - newXSproto(strcpy(buf, "MovePCDynamicZone"), XS_Client_MovePCDynamicZone, file, "$$;$$"); - newXSproto(strcpy(buf, "MovePCInstance"), XS_Client_MovePCInstance, file, "$$$$$$$"); - newXSproto(strcpy(buf, "MoveZone"), XS_Client_MoveZone, file, "$$"); - newXSproto(strcpy(buf, "MoveZoneGroup"), XS_Client_MoveZoneGroup, file, "$$"); - newXSproto(strcpy(buf, "MoveZoneInstance"), XS_Client_MoveZoneInstance, file, "$$"); - newXSproto(strcpy(buf, "MoveZoneInstanceGroup"), XS_Client_MoveZoneInstanceGroup, file, "$$"); - newXSproto(strcpy(buf, "MoveZoneInstanceRaid"), XS_Client_MoveZoneInstanceRaid, file, "$$"); - newXSproto(strcpy(buf, "MoveZoneRaid"), XS_Client_MoveZoneRaid, file, "$$"); - newXSproto(strcpy(buf, "NPCSpawn"), XS_Client_NPCSpawn, file, "$$$;$"); - newXSproto(strcpy(buf, "NotifyNewTitlesAvailable"), XS_Client_NotifyNewTitlesAvailable, file, "$"); - newXSproto(strcpy(buf, "NukeItem"), XS_Client_NukeItem, file, "$$;$"); - newXSproto(strcpy(buf, "OpenLFGuildWindow"), XS_Client_OpenLFGuildWindow, file, "$"); - newXSproto(strcpy(buf, "PlayMP3"), XS_Client_PlayMP3, file, "$;$"); - newXSproto(strcpy(buf, "Popup2"), XS_Client_Popup2, file, "$$$;$$$$$$$"); - newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$"); - newXSproto(strcpy(buf, "ReadBook"), XS_Client_ReadBook, file, "$$$"); - newXSproto(strcpy(buf, "ReadBookByName"), XS_Client_ReadBookByName, file, "$$$"); - newXSproto(strcpy(buf, "RefundAA"), XS_Client_RefundAA, file, "$$"); - newXSproto(strcpy(buf, "RemoveAllExpeditionLockouts"), XS_Client_RemoveAllExpeditionLockouts, file, "$;$"); - newXSproto(strcpy(buf, "RemoveExpeditionLockout"), XS_Client_RemoveExpeditionLockout, file, "$$$"); - newXSproto(strcpy(buf, "RemoveItem"), XS_Client_RemoveItem, file, "$$;$"); - newXSproto(strcpy(buf, "RemoveLDoNLoss"), XS_Client_RemoveLDoNLoss, file, "$$"); - newXSproto(strcpy(buf, "RemoveLDoNWin"), XS_Client_RemoveLDoNWin, file, "$$"); - newXSproto(strcpy(buf, "RemoveNoRent"), XS_Client_RemoveNoRent, file, "$"); - newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$"); - newXSproto(strcpy(buf, "ResetAllDisciplineTimers"), XS_Client_ResetAllDisciplineTimers, file, "$"); - newXSproto(strcpy(buf, "ResetAllCastbarCooldowns"), XS_Client_ResetAllCastbarCooldowns, file, "$"); - newXSproto(strcpy(buf, "ResetCastbarCooldownBySlot"), XS_Client_ResetCastbarCooldownBySlot, file, "$$"); - newXSproto(strcpy(buf, "ResetCastbarCooldownBySpellID"), XS_Client_ResetCastbarCooldownBySpellID, file, "$$"); - newXSproto(strcpy(buf, "ResetDisciplineTimer"), XS_Client_ResetDisciplineTimer, file, "$$"); - newXSproto(strcpy(buf, "ResetTrade"), XS_Client_ResetTrade, file, "$"); - newXSproto(strcpy(buf, "Save"), XS_Client_Save, file, "$$"); - newXSproto(strcpy(buf, "SaveBackup"), XS_Client_SaveBackup, file, "$"); - newXSproto(strcpy(buf, "ScribeSpell"), XS_Client_ScribeSpell, file, "$$$;$"); - newXSproto(strcpy(buf, "ScribeSpells"), XS_Client_ScribeSpells, file, "$$$"); - newXSproto(strcpy(buf, "SendColoredText"), XS_Client_SendColoredText, file, "$$$"); - newXSproto(strcpy(buf, "SendMarqueeMessage"), XS_Client_SendMarqueeMessage, file, "$$$$$$$"); - newXSproto(strcpy(buf, "SendOPTranslocateConfirm"), XS_Client_SendOPTranslocateConfirm, file, "$$$"); - newXSproto(strcpy(buf, "SendPEQZoneFlagInfo"), XS_Client_SendPEQZoneFlagInfo, file, "$$"); - newXSproto(strcpy(buf, "SendSound"), XS_Client_SendSound, file, "$"); - newXSproto(strcpy(buf, "SendSpellAnim"), XS_Client_SendSpellAnim, file, "$$$"); - newXSproto(strcpy(buf, "SendTargetCommand"), XS_Client_SendTargetCommand, file, "$$"); - newXSproto(strcpy(buf, "SendToGuildHall"), XS_Client_SendToGuildHall, file, "$"); - newXSproto(strcpy(buf, "SendToInstance"), XS_Client_SendToInstance, file, "$$$$$$$$$$"); - newXSproto(strcpy(buf, "SendWebLink"), XS_Client_SendWebLink, file, "$:$"); - newXSproto(strcpy(buf, "SendZoneFlagInfo"), XS_Client_SendZoneFlagInfo, file, "$$"); - newXSproto(strcpy(buf, "SetAAEXPModifier"), XS_Client_SetAAEXPModifier, file, "$$$"); - newXSproto(strcpy(buf, "SetAAPoints"), XS_Client_SetAAPoints, file, "$$"); - newXSproto(strcpy(buf, "SetAATitle"), XS_Client_SetAATitle, file, "$$;$"); - newXSproto(strcpy(buf, "SetAFK"), XS_Client_SetAFK, file, "$$"); - newXSproto(strcpy(buf, "SetAccountFlag"), XS_Client_SetAccountFlag, file, "$$"); - newXSproto(strcpy(buf, "SetAlternateCurrencyValue"), XS_Client_SetAlternateCurrencyValue, file, "$$$"); - newXSproto(strcpy(buf, "SetAnon"), XS_Client_SetAnon, file, "$$"); - newXSproto(strcpy(buf, "SetBaseClass"), XS_Client_SetBaseClass, file, "$$"); - newXSproto(strcpy(buf, "SetBaseGender"), XS_Client_SetBaseGender, file, "$$"); - newXSproto(strcpy(buf, "SetBaseRace"), XS_Client_SetBaseRace, file, "$$"); - newXSproto(strcpy(buf, "SetBecomeNPC"), XS_Client_SetBecomeNPC, file, "$$"); - newXSproto(strcpy(buf, "SetBecomeNPCLevel"), XS_Client_SetBecomeNPCLevel, file, "$$"); - newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$$$"); - newXSproto(strcpy(buf, "SetClientMaxLevel"), XS_Client_SetClientMaxLevel, file, "$$"); - newXSproto(strcpy(buf, "SetConsumption"), XS_Client_SetConsumption, file, "$$$"); - newXSproto(strcpy(buf, "SetCustomItemData"), XS_Client_SetCustomItemData, file, "$$$$"); - newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$"); - newXSproto(strcpy(buf, "SetDuelTarget"), XS_Client_SetDuelTarget, file, "$$"); - newXSproto(strcpy(buf, "SetDueling"), XS_Client_SetDueling, file, "$$"); - newXSproto(strcpy(buf, "SetEXP"), XS_Client_SetEXP, file, "$$$;$"); - newXSproto(strcpy(buf, "SetEXPModifier"), XS_Client_SetEXPModifier, file, "$$$"); - newXSproto(strcpy(buf, "SetEbonCrystals"), XS_Client_SetEbonCrystals, file, "$$"); - newXSproto(strcpy(buf, "SetEndurance"), XS_Client_SetEndurance, file, "$$"); - newXSproto(strcpy(buf, "SetEnvironmentDamageModifier"), XS_Client_SetEnvironmentDamageModifier, file, "$$"); - newXSproto(strcpy(buf, "SetFactionLevel"), XS_Client_SetFactionLevel, file, "$$$$$$"); - newXSproto(strcpy(buf, "SetFactionLevel2"), XS_Client_SetFactionLevel2, file, "$$$$$$$"); - newXSproto(strcpy(buf, "SetFeigned"), XS_Client_SetFeigned, file, "$$"); - newXSproto(strcpy(buf, "SetGM"), XS_Client_SetGM, file, "$$"); - newXSproto(strcpy(buf, "SetGMStatus"), XS_Client_SetGMStatus, file, "$$"); - newXSproto(strcpy(buf, "SetHideMe"), XS_Client_SetHideMe, file, "$$"); - newXSproto(strcpy(buf, "SetHorseId"), XS_Client_SetHorseId, file, "$$"); - newXSproto(strcpy(buf, "SetHunger"), XS_Client_SetHunger, file, "$$"); - newXSproto(strcpy(buf, "SetIPExemption"), XS_Client_SetIPExemption, file, "$$"); - newXSproto(strcpy(buf, "SetInvulnerableEnvironmentDamage"), XS_Client_SetInvulnerableEnvironmentDamage, file, "$$"); - newXSproto(strcpy(buf, "SetLanguageSkill"), XS_Client_SetLanguageSkill, file, "$$$"); - newXSproto(strcpy(buf, "SetMaterial"), XS_Client_SetMaterial, file, "$$$"); - newXSproto(strcpy(buf, "SetPEQZoneFlag"), XS_Client_SetPEQZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "SetPVP"), XS_Client_SetPVP, file, "$$"); - newXSproto(strcpy(buf, "SetPrimaryWeaponOrnamentation"), XS_Client_SetPrimaryWeaponOrnamentation, file, "$$"); - newXSproto(strcpy(buf, "SetRadiantCrystals"), XS_Client_SetRadiantCrystals, file, "$$"); - newXSproto(strcpy(buf, "SetSecondaryWeaponOrnamentation"), XS_Client_SetSecondaryWeaponOrnamentation, file, "$$"); - newXSproto(strcpy(buf, "SetSkill"), XS_Client_SetSkill, file, "$$$"); - newXSproto(strcpy(buf, "SetSkillPoints"), XS_Client_SetSkillPoints, file, "$$"); - newXSproto(strcpy(buf, "SetStartZone"), XS_Client_SetStartZone, file, "$$;$$$$"); - newXSproto(strcpy(buf, "SetStats"), XS_Client_SetStats, file, "$$$"); - newXSproto(strcpy(buf, "SetThirst"), XS_Client_SetThirst, file, "$$"); - newXSproto(strcpy(buf, "SetTint"), XS_Client_SetTint, file, "$$$"); - newXSproto(strcpy(buf, "SetTitleSuffix"), XS_Client_SetTitleSuffix, file, "$$;$"); - newXSproto(strcpy(buf, "SetZoneFlag"), XS_Client_SetZoneFlag, file, "$$"); - newXSproto(strcpy(buf, "SilentMessage"), XS_Client_SilentMessage, file, "$$"); - newXSproto(strcpy(buf, "Sit"), XS_Client_Sit, file, "$"); - newXSproto(strcpy(buf, "SlotConvert2"), XS_Client_SlotConvert2, file, "$$"); - newXSproto(strcpy(buf, "Stand"), XS_Client_Stand, file, "$"); - newXSproto(strcpy(buf, "SummonBaggedItems"), XS_Client_SummonBaggedItems, file, "$$$"); - newXSproto(strcpy(buf, "SummonItem"), XS_Client_SummonItem, file, "$$;$$$$$$$$"); - newXSproto(strcpy(buf, "TGB"), XS_Client_TGB, file, "$"); - newXSproto(strcpy(buf, "TakeMoneyFromPP"), XS_Client_TakeMoneyFromPP, file, "$$;$"); - newXSproto(strcpy(buf, "TakePlatinum"), XS_Client_TakePlatinum, file, "$$;$"); - newXSproto(strcpy(buf, "TaskSelector"), XS_Client_TaskSelector, file, "$$;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); - newXSproto(strcpy(buf, "Thirsty"), XS_Client_Thirsty, file, "$"); - newXSproto(strcpy(buf, "TrainDiscBySpellID"), XS_Client_TrainDiscBySpellID, file, "$$"); - newXSproto(strcpy(buf, "UnFreeze"), XS_Client_UnFreeze, file, "$"); - newXSproto(strcpy(buf, "Undye"), XS_Client_Undye, file, "$"); - newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$"); - newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$"); - newXSproto(strcpy(buf, "UnmemSpellBySpellID"), XS_Client_UnmemSpellBySpellID, file, "$$"); - newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$"); - newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$"); - newXSproto(strcpy(buf, "UnscribeSpellBySpellID"), XS_Client_UnscribeSpellBySpellID, file, "$$;$"); - newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$"); - newXSproto(strcpy(buf, "UntrainDiscAll"), XS_Client_UntrainDiscAll, file, "$;$"); - newXSproto(strcpy(buf, "UntrainDiscBySpellID"), XS_Client_UntrainDiscBySpellID, file, "$$;$"); - newXSproto(strcpy(buf, "UpdateAdmin"), XS_Client_UpdateAdmin, file, "$;$"); - newXSproto(strcpy(buf, "UpdateGroupAAs"), XS_Client_UpdateGroupAAs, file, "$$$"); - newXSproto(strcpy(buf, "UpdateLDoNPoints"), XS_Client_UpdateLDoNPoints, file, "$$$"); - newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$;$"); - newXSproto(strcpy(buf, "UpdateWho"), XS_Client_UpdateWho, file, "$;$"); - newXSproto(strcpy(buf, "UseDiscipline"), XS_Client_UseDiscipline, file, "$$$"); - newXSproto(strcpy(buf, "WorldKick"), XS_Client_WorldKick, file, "$"); - XSRETURN_YES; + auto package = perl.new_class("Client"); + package.add_base_class("Mob"); + package.add("AccountID", &Perl_Client_AccountID); + package.add("AccountName", &Perl_Client_AccountName); + package.add("AddAAPoints", &Perl_Client_AddAAPoints); + package.add("AddAlternateCurrencyValue", &Perl_Client_AddAlternateCurrencyValue); + package.add("AddCrystals", &Perl_Client_AddCrystals); + package.add("AddEXP", (void(*)(Client*, uint32))&Perl_Client_AddEXP); + package.add("AddEXP", (void(*)(Client*, uint32, uint8))&Perl_Client_AddEXP); + package.add("AddEXP", (void(*)(Client*, uint32, uint8, bool))&Perl_Client_AddEXP); + package.add("AddExpeditionLockout", (void(*)(Client*, std::string, std::string, uint32))&Perl_Client_AddExpeditionLockout); + package.add("AddExpeditionLockout", (void(*)(Client*, std::string, std::string, uint32, std::string))&Perl_Client_AddExpeditionLockout); + package.add("AddExpeditionLockoutDuration", (void(*)(Client*, std::string, std::string, int))&Perl_Client_AddExpeditionLockoutDuration); + package.add("AddExpeditionLockoutDuration", (void(*)(Client*, std::string, std::string, int, std::string))&Perl_Client_AddExpeditionLockoutDuration); + package.add("AddItem", &Perl_Client_AddItem); + package.add("AddLDoNLoss", &Perl_Client_AddLDoNLoss); + package.add("AddLDoNWin", &Perl_Client_AddLDoNWin); + package.add("AddLevelBasedExp", (void(*)(Client*, uint8))&Perl_Client_AddLevelBasedExp); + package.add("AddLevelBasedExp", (void(*)(Client*, uint8, uint8))&Perl_Client_AddLevelBasedExp); + package.add("AddLevelBasedExp", (void(*)(Client*, uint8, uint8, bool))&Perl_Client_AddLevelBasedExp); + package.add("AddMoneyToPP", (void(*)(Client*, uint32, uint32, uint32, uint32))&Perl_Client_AddMoneyToPP); + package.add("AddMoneyToPP", (void(*)(Client*, uint32, uint32, uint32, uint32, bool))&Perl_Client_AddMoneyToPP); + package.add("AddPlatinum", (void(*)(Client*, uint32))&Perl_Client_AddPlatinum); + package.add("AddPlatinum", (void(*)(Client*, uint32, bool))&Perl_Client_AddPlatinum); + package.add("AddPVPPoints", &Perl_Client_AddPVPPoints); + package.add("AddSkill", &Perl_Client_AddSkill); + package.add("Admin", &Perl_Client_Admin); + package.add("AssignTask", (void(*)(Client*, int))&Perl_Client_AssignTask); + package.add("AssignTask", (void(*)(Client*, int, int))&Perl_Client_AssignTask); + package.add("AssignTask", (void(*)(Client*, int, int, bool))&Perl_Client_AssignTask); + package.add("AssignToInstance", &Perl_Client_AssignToInstance); + package.add("AutoSplitEnabled", &Perl_Client_AutoSplitEnabled); + package.add("BreakInvis", &Perl_Client_BreakInvis); + package.add("CalcEXP", &Perl_Client_CalcEXP); + package.add("CalcPriceMod", (float(*)(Client*))&Perl_Client_CalcPriceMod); + package.add("CalcPriceMod", (float(*)(Client*, Mob*))&Perl_Client_CalcPriceMod); + package.add("CalcPriceMod", (float(*)(Client*, Mob*, bool))&Perl_Client_CalcPriceMod); + package.add("CanHaveSkill", &Perl_Client_CanHaveSkill); + package.add("ChangeLastName", &Perl_Client_ChangeLastName); + package.add("CharacterID", &Perl_Client_CharacterID); + package.add("CheckIncreaseSkill", (bool(*)(Client*, int))&Perl_Client_CheckIncreaseSkill); + package.add("CheckIncreaseSkill", (bool(*)(Client*, int, int))&Perl_Client_CheckIncreaseSkill); + package.add("CheckSpecializeIncrease", &Perl_Client_CheckSpecializeIncrease); + package.add("ClearCompassMark", &Perl_Client_ClearCompassMark); + package.add("ClearPEQZoneFlag", &Perl_Client_ClearPEQZoneFlag); + package.add("ClearZoneFlag", &Perl_Client_ClearZoneFlag); + package.add("Connected", &Perl_Client_Connected); + package.add("CountAugmentEquippedByID", &Perl_Client_CountAugmentEquippedByID); + package.add("CountItem", &Perl_Client_CountItem); + package.add("CountItemEquippedByID", &Perl_Client_CountItemEquippedByID); + package.add("CreateExpedition", (Expedition*(*)(Client*, perl::reference))&Perl_Client_CreateExpedition); + package.add("CreateExpedition", (Expedition*(*)(Client*, std::string, uint32, uint32, std::string, uint32, uint32))&Perl_Client_CreateExpedition); + package.add("CreateExpedition", (Expedition*(*)(Client*, std::string, uint32, uint32, std::string, uint32, uint32, bool))&Perl_Client_CreateExpedition); + package.add("CreateTaskDynamicZone", &Perl_Client_CreateTaskDynamicZone); + package.add("DecreaseByID", &Perl_Client_DecreaseByID); + package.add("DeleteItemInInventory", (void(*)(Client*, int16))&Perl_Client_DeleteItemInInventory); + package.add("DeleteItemInInventory", (void(*)(Client*, int16, int16))&Perl_Client_DeleteItemInInventory); + package.add("DeleteItemInInventory", (void(*)(Client*, int16, int16, bool))&Perl_Client_DeleteItemInInventory); + package.add("DiaWind", &Perl_Client_DiaWind); + package.add("DialogueWindow", &Perl_Client_DialogueWindow); + package.add("Disconnect", &Perl_Client_Disconnect); + package.add("DropItem", &Perl_Client_DropItem); + package.add("Duck", &Perl_Client_Duck); + package.add("DyeArmorBySlot", (void(*)(Client*, uint8, uint8, uint8, uint8))&Perl_Client_DyeArmorBySlot); + package.add("DyeArmorBySlot", (void(*)(Client*, uint8, uint8, uint8, uint8, uint8))&Perl_Client_DyeArmorBySlot); + package.add("Escape", &Perl_Client_Escape); + package.add("ExpeditionMessage", &Perl_Client_ExpeditionMessage); + package.add("FailTask", &Perl_Client_FailTask); + package.add("FindEmptyMemSlot", &Perl_Client_FindEmptyMemSlot); + package.add("FindMemmedSpellBySlot", &Perl_Client_FindMemmedSpellBySlot); + package.add("FindMemmedSpellBySpellID", &Perl_Client_FindMemmedSpellBySpellID); + package.add("Fling", (void(*)(Client*, float, float, float, float))&Perl_Client_Fling); + package.add("Fling", (void(*)(Client*, float, float, float, float, bool))&Perl_Client_Fling); + package.add("Fling", (void(*)(Client*, float, float, float, float, bool, bool))&Perl_Client_Fling); + package.add("ForageItem", &Perl_Client_ForageItem); + package.add("Freeze", &Perl_Client_Freeze); + package.add("GMKill", &Perl_Client_GMKill); + package.add("GetAAEXPModifier", &Perl_Client_GetAAEXPModifier); + package.add("GetAAExp", &Perl_Client_GetAAExp); + package.add("GetAALevel", &Perl_Client_GetAALevel); + package.add("GetAAPercent", &Perl_Client_GetAAPercent); + package.add("GetAAPoints", &Perl_Client_GetAAPoints); + package.add("GetAFK", &Perl_Client_GetAFK); + package.add("GetAccountAge", &Perl_Client_GetAccountAge); + package.add("GetAccountFlag", &Perl_Client_GetAccountFlag); + package.add("GetAggroCount", &Perl_Client_GetAggroCount); + package.add("GetAllMoney", &Perl_Client_GetAllMoney); + package.add("GetAlternateCurrencyValue", &Perl_Client_GetAlternateCurrencyValue); + package.add("GetAnon", &Perl_Client_GetAnon); + package.add("GetAugmentAt", &Perl_Client_GetAugmentAt); + package.add("GetAugmentIDAt", &Perl_Client_GetAugmentIDAt); + package.add("GetBaseAGI", &Perl_Client_GetBaseAGI); + package.add("GetBaseCHA", &Perl_Client_GetBaseCHA); + package.add("GetBaseDEX", &Perl_Client_GetBaseDEX); + package.add("GetBaseFace", &Perl_Client_GetBaseFace); + package.add("GetBaseINT", &Perl_Client_GetBaseINT); + package.add("GetBaseSTA", &Perl_Client_GetBaseSTA); + package.add("GetBaseSTR", &Perl_Client_GetBaseSTR); + package.add("GetBaseWIS", &Perl_Client_GetBaseWIS); + package.add("GetBecomeNPCLevel", &Perl_Client_GetBecomeNPCLevel); + package.add("GetBindHeading", (float(*)(Client*))&Perl_Client_GetBindHeading); + package.add("GetBindHeading", (float(*)(Client*, int))&Perl_Client_GetBindHeading); + package.add("GetBindX", (float(*)(Client*))&Perl_Client_GetBindX); + package.add("GetBindX", (float(*)(Client*, int))&Perl_Client_GetBindX); + package.add("GetBindY", (float(*)(Client*))&Perl_Client_GetBindY); + package.add("GetBindY", (float(*)(Client*, int))&Perl_Client_GetBindY); + package.add("GetBindZ", (float(*)(Client*))&Perl_Client_GetBindZ); + package.add("GetBindZ", (float(*)(Client*, int))&Perl_Client_GetBindZ); + package.add("GetBindZoneID", (uint32_t(*)(Client*))&Perl_Client_GetBindZoneID); + package.add("GetBindZoneID", (uint32_t(*)(Client*, int))&Perl_Client_GetBindZoneID); + package.add("GetCarriedMoney", &Perl_Client_GetCarriedMoney); + package.add("GetCarriedPlatinum", &Perl_Client_GetCarriedPlatinum); + package.add("GetCharacterFactionLevel", &Perl_Client_GetCharacterFactionLevel); + package.add("GetClassBitmask", &Perl_Client_GetClassBitmask); + package.add("GetClientMaxLevel", &Perl_Client_GetClientMaxLevel); + package.add("GetClientVersion", &Perl_Client_GetClientVersion); + package.add("GetClientVersionBit", &Perl_Client_GetClientVersionBit); + package.add("GetCorpseCount", &Perl_Client_GetCorpseCount); + package.add("GetCorpseID", &Perl_Client_GetCorpseID); + package.add("GetCorpseItemAt", &Perl_Client_GetCorpseItemAt); + package.add("GetCustomItemData", &Perl_Client_GetCustomItemData); + package.add("GetDiscSlotBySpellID", &Perl_Client_GetDiscSlotBySpellID); + package.add("GetDisciplineTimer", &Perl_Client_GetDisciplineTimer); + package.add("GetDuelTarget", &Perl_Client_GetDuelTarget); + package.add("GetEnvironmentDamageModifier", &Perl_Client_GetEnvironmentDamageModifier); + package.add("GetEXP", &Perl_Client_GetEXP); + package.add("GetEXPModifier", &Perl_Client_GetEXPModifier); + package.add("GetEbonCrystals", &Perl_Client_GetEbonCrystals); + package.add("GetEndurance", &Perl_Client_GetEndurance); + package.add("GetEnduranceRatio", &Perl_Client_GetEnduranceRatio); + package.add("GetExpedition", &Perl_Client_GetExpedition); + package.add("GetExpeditionLockouts", (perl::reference(*)(Client*))&Perl_Client_GetExpeditionLockouts); + package.add("GetExpeditionLockouts", (perl::reference(*)(Client*, std::string))&Perl_Client_GetExpeditionLockouts); + package.add("GetFace", &Perl_Client_GetFace); + package.add("GetFactionLevel", &Perl_Client_GetFactionLevel); + package.add("GetFeigned", &Perl_Client_GetFeigned); + package.add("GetFreeDisciplineSlot", (int(*)(Client*))&Perl_Client_GetFreeDisciplineSlot); + package.add("GetFreeDisciplineSlot", (int(*)(Client*, int))&Perl_Client_GetFreeDisciplineSlot); + package.add("GetFreeSpellBookSlot", (int(*)(Client*))&Perl_Client_GetFreeSpellBookSlot); + package.add("GetFreeSpellBookSlot", (int(*)(Client*, uint32))&Perl_Client_GetFreeSpellBookSlot); + package.add("GetGM", &Perl_Client_GetGM); + package.add("GetGroup", &Perl_Client_GetGroup); + package.add("GetGroupPoints", &Perl_Client_GetGroupPoints); + package.add("GetHorseId", &Perl_Client_GetHorseId); + package.add("GetHealAmount", &Perl_Client_GetHealAmount); + package.add("GetHunger", &Perl_Client_GetHunger); + package.add("GetIP", &Perl_Client_GetIP); + package.add("GetIPExemption", &Perl_Client_GetIPExemption); + package.add("GetIPString", &Perl_Client_GetIPString); + package.add("GetInstanceID", &Perl_Client_GetInstanceID); + package.add("GetInstrumentMod", &Perl_Client_GetInstrumentMod); + package.add("GetInventory", &Perl_Client_GetInventory); + package.add("GetInvulnerableEnvironmentDamage", &Perl_Client_GetInvulnerableEnvironmentDamage); + package.add("GetItemAt", &Perl_Client_GetItemAt); + package.add("GetItemIDAt", &Perl_Client_GetItemIDAt); + package.add("GetItemInInventory", &Perl_Client_GetItemInInventory); + package.add("GetLDoNLosses", &Perl_Client_GetLDoNLosses); + package.add("GetLDoNLossesTheme", &Perl_Client_GetLDoNLossesTheme); + package.add("GetLDoNPointsTheme", &Perl_Client_GetLDoNPointsTheme); + package.add("GetLDoNWins", &Perl_Client_GetLDoNWins); + package.add("GetLDoNWinsTheme", &Perl_Client_GetLDoNWinsTheme); + package.add("GetLanguageSkill", &Perl_Client_GetLanguageSkill); + package.add("GetLearnableDisciplines", (perl::array(*)(Client*))&Perl_Client_GetLearnableDisciplines); + package.add("GetLearnableDisciplines", (perl::array(*)(Client*, uint8))&Perl_Client_GetLearnableDisciplines); + package.add("GetLearnableDisciplines", (perl::array(*)(Client*, uint8, uint8))&Perl_Client_GetLearnableDisciplines); + package.add("GetLearnedDisciplines", &Perl_Client_GetLearnedDisciplines); + package.add("GetLockoutExpeditionUUID", &Perl_Client_GetLockoutExpeditionUUID); + package.add("GetMaxEndurance", &Perl_Client_GetMaxEndurance); + package.add("GetMemmedSpells", &Perl_Client_GetMemmedSpells); + package.add("GetModCharacterFactionLevel", &Perl_Client_GetModCharacterFactionLevel); + package.add("GetMoney", &Perl_Client_GetMoney); + package.add("GetPVP", &Perl_Client_GetPVP); + package.add("GetPVPPoints", &Perl_Client_GetPVPPoints); + package.add("GetRaceBitmask", &Perl_Client_GetRaceBitmask); + package.add("GetRadiantCrystals", &Perl_Client_GetRadiantCrystals); + package.add("GetRaid", &Perl_Client_GetRaid); + package.add("GetRaidPoints", &Perl_Client_GetRaidPoints); + package.add("GetRawItemAC", &Perl_Client_GetRawItemAC); + package.add("GetRawSkill", &Perl_Client_GetRawSkill); + package.add("GetScribeableSpells", (perl::array(*)(Client*))&Perl_Client_GetScribeableSpells); + package.add("GetScribeableSpells", (perl::array(*)(Client*, uint8))&Perl_Client_GetScribeableSpells); + package.add("GetScribeableSpells", (perl::array(*)(Client*, uint8, uint8))&Perl_Client_GetScribeableSpells); + package.add("GetScribedSpells", &Perl_Client_GetScribedSpells); + package.add("GetSkillPoints", &Perl_Client_GetSkillPoints); + package.add("GetSpellDamage", &Perl_Client_GetSpellDamage); + package.add("GetSpellBookSlotBySpellID", &Perl_Client_GetSpellBookSlotBySpellID); + package.add("GetSpellIDByBookSlot", &Perl_Client_GetSpellIDByBookSlot); + package.add("GetSpentAA", &Perl_Client_GetSpentAA); + package.add("GetStartZone", &Perl_Client_GetStartZone); + package.add("GetTargetRingX", &Perl_Client_GetTargetRingX); + package.add("GetTargetRingY", &Perl_Client_GetTargetRingY); + package.add("GetTargetRingZ", &Perl_Client_GetTargetRingZ); + package.add("GetTaskActivityDoneCount", &Perl_Client_GetTaskActivityDoneCount); + package.add("GetThirst", &Perl_Client_GetThirst); + package.add("GetTotalSecondsPlayed", &Perl_Client_GetTotalSecondsPlayed); + package.add("GetWeight", &Perl_Client_GetWeight); + package.add("GoFish", &Perl_Client_GoFish); + package.add("GrantAlternateAdvancementAbility", (bool(*)(Client*, int, int))&Perl_Client_GrantAlternateAdvancementAbility); + package.add("GrantAlternateAdvancementAbility", (bool(*)(Client*, int, int, bool))&Perl_Client_GrantAlternateAdvancementAbility); + package.add("GuildID", &Perl_Client_GuildID); + package.add("GuildRank", &Perl_Client_GuildRank); + package.add("HasAugmentEquippedByID", &Perl_Client_HasAugmentEquippedByID); + package.add("HasDisciplineLearned", &Perl_Client_HasDisciplineLearned); + package.add("HasExpeditionLockout", &Perl_Client_HasExpeditionLockout); + package.add("HasItemEquippedByID", &Perl_Client_HasItemEquippedByID); + package.add("HasPEQZoneFlag", &Perl_Client_HasPEQZoneFlag); + package.add("HasSkill", &Perl_Client_HasSkill); + package.add("HasSpellScribed", &Perl_Client_HasSkill); + package.add("HasZoneFlag", &Perl_Client_HasZoneFlag); + package.add("Hungry", &Perl_Client_Hungry); + package.add("InZone", &Perl_Client_InZone); + package.add("IncStats", &Perl_Client_IncStats); + package.add("IncreaseLanguageSkill", (void(*)(Client*, int))&Perl_Client_IncreaseLanguageSkill); + package.add("IncreaseLanguageSkill", (void(*)(Client*, int, int))&Perl_Client_IncreaseLanguageSkill); + package.add("IncreaseSkill", (void(*)(Client*, int))&Perl_Client_IncreaseSkill); + package.add("IncreaseSkill", (void(*)(Client*, int, int))&Perl_Client_IncreaseSkill); + package.add("IncrementAA", &Perl_Client_IncrementAA); + package.add("IsBecomeNPC", &Perl_Client_IsBecomeNPC); + package.add("IsCrouching", &Perl_Client_IsCrouching); + package.add("IsDueling", &Perl_Client_IsDueling); + package.add("IsGrouped", &Perl_Client_IsGrouped); + package.add("IsLD", &Perl_Client_IsLD); + package.add("IsMedding", &Perl_Client_IsMedding); + package.add("IsRaidGrouped", &Perl_Client_IsRaidGrouped); + package.add("IsSitting", &Perl_Client_IsSitting); + package.add("IsStanding", &Perl_Client_IsStanding); + package.add("IsTaskActive", &Perl_Client_IsTaskActive); + package.add("IsTaskActivityActive", &Perl_Client_IsTaskActivityActive); + package.add("IsTaskCompleted", &Perl_Client_IsTaskCompleted); + package.add("KeyRingAdd", &Perl_Client_KeyRingAdd); + package.add("KeyRingCheck", &Perl_Client_KeyRingCheck); + package.add("Kick", &Perl_Client_Kick); + package.add("LearnDisciplines", &Perl_Client_LearnDisciplines); + package.add("LearnRecipe", &Perl_Client_LearnRecipe); + package.add("LeaveGroup", &Perl_Client_LeaveGroup); + package.add("LoadPEQZoneFlags", &Perl_Client_LoadPEQZoneFlags); + package.add("LoadZoneFlags", &Perl_Client_LoadZoneFlags); + package.add("MarkCompassLoc", &Perl_Client_MarkCompassLoc); + package.add("MaxSkill", (int(*)(Client*, uint16))&Perl_Client_MaxSkill); + package.add("MaxSkill", (int(*)(Client*, uint16, uint16))&Perl_Client_MaxSkill); + package.add("MaxSkill", (int(*)(Client*, uint16, uint16, uint16))&Perl_Client_MaxSkill); + package.add("MemSpell", (void(*)(Client*, uint16, int))&Perl_Client_MemSpell); + package.add("MemSpell", (void(*)(Client*, uint16, int, bool))&Perl_Client_MemSpell); + package.add("MemmedCount", &Perl_Client_MemmedCount); + package.add("MovePC", &Perl_Client_MovePC); + package.add("MovePCDynamicZone", (void(*)(Client*, perl::scalar))&Perl_Client_MovePCDynamicZone); + package.add("MovePCDynamicZone", (void(*)(Client*, perl::scalar, int))&Perl_Client_MovePCDynamicZone); + package.add("MovePCDynamicZone", (void(*)(Client*, perl::scalar, int, bool))&Perl_Client_MovePCDynamicZone); + package.add("MovePCInstance", &Perl_Client_MovePCInstance); + package.add("MoveZone", &Perl_Client_MoveZone); + package.add("MoveZoneGroup", &Perl_Client_MoveZoneGroup); + package.add("MoveZoneInstance", &Perl_Client_MoveZoneInstance); + package.add("MoveZoneInstanceGroup", &Perl_Client_MoveZoneInstanceGroup); + package.add("MoveZoneInstanceRaid", &Perl_Client_MoveZoneInstanceRaid); + package.add("MoveZoneRaid", &Perl_Client_MoveZoneRaid); + package.add("NPCSpawn", (void(*)(Client*, NPC*, const char*))&Perl_Client_NPCSpawn); + package.add("NPCSpawn", (void(*)(Client*, NPC*, const char*, uint32))&Perl_Client_NPCSpawn); + package.add("NotifyNewTitlesAvailable", &Perl_Client_NotifyNewTitlesAvailable); + package.add("NukeItem", (uint32_t(*)(Client*, uint32))&Perl_Client_NukeItem); + package.add("NukeItem", (uint32_t(*)(Client*, uint32, uint8))&Perl_Client_NukeItem); + package.add("OpenLFGuildWindow", &Perl_Client_OpenLFGuildWindow); + package.add("PlayMP3", &Perl_Client_PlayMP3); + package.add("Popup2", (void(*)(Client*, const char*, const char*))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32, uint32))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32, uint32, uint32))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32, uint32, uint32, const char*))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32, uint32, uint32, const char*, const char*))&Perl_Client_Popup2); + package.add("Popup2", (void(*)(Client*, const char*, const char*, uint32, uint32, uint32, uint32, const char*, const char*, uint32))&Perl_Client_Popup2); + package.add("QuestReward", (void(*)(Client*, Mob*))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32, uint32, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32, uint32, uint32, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Client_QuestReward); + package.add("QuestReward", (void(*)(Client*, Mob*, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Perl_Client_QuestReward); + package.add("ReadBook", &Perl_Client_ReadBook); + package.add("ReadBookByName", &Perl_Client_ReadBookByName); + package.add("RefundAA", &Perl_Client_RefundAA); + package.add("RemoveAllExpeditionLockouts", (void(*)(Client*))&Perl_Client_RemoveAllExpeditionLockouts); + package.add("RemoveAllExpeditionLockouts", (void(*)(Client*, std::string))&Perl_Client_RemoveAllExpeditionLockouts); + package.add("RemoveExpeditionLockout", &Perl_Client_RemoveExpeditionLockout); + package.add("RemoveItem", (void(*)(Client*, uint32))&Perl_Client_RemoveItem); + package.add("RemoveItem", (void(*)(Client*, uint32, uint32))&Perl_Client_RemoveItem); + package.add("RemoveLDoNLoss", &Perl_Client_RemoveLDoNLoss); + package.add("RemoveLDoNWin", &Perl_Client_RemoveLDoNWin); + package.add("RemoveNoRent", &Perl_Client_RemoveNoRent); + package.add("ResetAA", &Perl_Client_ResetAA); + package.add("ResetAllDisciplineTimers", &Perl_Client_ResetAllDisciplineTimers); + package.add("ResetAllCastbarCooldowns", &Perl_Client_ResetAllCastbarCooldowns); + package.add("ResetCastbarCooldownBySlot", &Perl_Client_ResetCastbarCooldownBySlot); + package.add("ResetCastbarCooldownBySpellID", &Perl_Client_ResetCastbarCooldownBySpellID); + package.add("ResetDisciplineTimer", &Perl_Client_ResetDisciplineTimer); + package.add("ResetTrade", &Perl_Client_ResetTrade); + package.add("Save", &Perl_Client_Save); + package.add("SaveBackup", &Perl_Client_SaveBackup); + package.add("ScribeSpell", (void(*)(Client*, uint16, int))&Perl_Client_ScribeSpell); + package.add("ScribeSpell", (void(*)(Client*, uint16, int, bool))&Perl_Client_ScribeSpell); + package.add("ScribeSpells", &Perl_Client_ScribeSpells); + package.add("SendColoredText", &Perl_Client_SendColoredText); + package.add("SendMarqueeMessage", &Perl_Client_SendMarqueeMessage); + package.add("SendOPTranslocateConfirm", &Perl_Client_SendOPTranslocateConfirm); + package.add("SendPEQZoneFlagInfo", &Perl_Client_SendPEQZoneFlagInfo); + package.add("SendSound", &Perl_Client_SendSound); + package.add("SendSpellAnim", &Perl_Client_SendSpellAnim); + package.add("SendTargetCommand", &Perl_Client_SendTargetCommand); + package.add("SendToGuildHall", &Perl_Client_SendToGuildHall); + package.add("SendToInstance", &Perl_Client_SendToInstance); + package.add("SendWebLink", &Perl_Client_SendWebLink); + package.add("SendZoneFlagInfo", &Perl_Client_SendZoneFlagInfo); + package.add("SetAAEXPModifier", &Perl_Client_SetAAEXPModifier); + package.add("SetAAPoints", &Perl_Client_SetAAPoints); + package.add("SetAATitle", (void(*)(Client*, std::string))&Perl_Client_SetAATitle); + package.add("SetAATitle", (void(*)(Client*, std::string, bool))&Perl_Client_SetAATitle); + package.add("SetAFK", &Perl_Client_SetAFK); + package.add("SetAccountFlag", &Perl_Client_SetAccountFlag); + package.add("SetAlternateCurrencyValue", &Perl_Client_SetAlternateCurrencyValue); + package.add("SetAnon", &Perl_Client_SetAnon); + package.add("SetBaseClass", &Perl_Client_SetBaseClass); + package.add("SetBaseGender", &Perl_Client_SetBaseGender); + package.add("SetBaseRace", &Perl_Client_SetBaseRace); + package.add("SetBecomeNPC", &Perl_Client_SetBecomeNPC); + package.add("SetBecomeNPCLevel", &Perl_Client_SetBecomeNPCLevel); + package.add("SetBindPoint", (void(*)(Client*))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int, int))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int, int, float))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int, int, float, float))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int, int, float, float, float))&Perl_Client_SetBindPoint); + package.add("SetBindPoint", (void(*)(Client*, int, int, float, float, float, float))&Perl_Client_SetBindPoint); + package.add("SetClientMaxLevel", &Perl_Client_SetClientMaxLevel); + package.add("SetConsumption", &Perl_Client_SetConsumption); + package.add("SetCustomItemData", &Perl_Client_SetCustomItemData); + package.add("SetDeity", &Perl_Client_SetDeity); + package.add("SetDuelTarget", &Perl_Client_SetDuelTarget); + package.add("SetDueling", &Perl_Client_SetDueling); + package.add("SetEXP", (void(*)(Client*, uint32, uint32))&Perl_Client_SetEXP); + package.add("SetEXP", (void(*)(Client*, uint32, uint32, bool))&Perl_Client_SetEXP); + package.add("SetEXPModifier", &Perl_Client_SetEXPModifier); + package.add("SetEbonCrystals", &Perl_Client_SetEbonCrystals); + package.add("SetEndurance", &Perl_Client_SetEndurance); + package.add("SetEnvironmentDamageModifier", &Perl_Client_SetEnvironmentDamageModifier); + package.add("SetFactionLevel", &Perl_Client_SetFactionLevel); + package.add("SetFactionLevel2", (void(*)(Client*, uint32, int32, uint8, uint8, uint8, int32))&Perl_Client_SetFactionLevel2); + package.add("SetFactionLevel2", (void(*)(Client*, uint32, int32, uint8, uint8, uint8, int32, uint8))&Perl_Client_SetFactionLevel2); + package.add("SetFeigned", &Perl_Client_SetFeigned); + package.add("SetGM", &Perl_Client_SetGM); + package.add("SetGMStatus", &Perl_Client_SetGMStatus); + package.add("SetHideMe", &Perl_Client_SetHideMe); + package.add("SetHorseId", &Perl_Client_SetHorseId); + package.add("SetHunger", &Perl_Client_SetHunger); + package.add("SetIPExemption", &Perl_Client_SetIPExemption); + package.add("SetInvulnerableEnvironmentDamage", &Perl_Client_SetInvulnerableEnvironmentDamage); + package.add("SetLanguageSkill", &Perl_Client_SetLanguageSkill); + package.add("SetMaterial", &Perl_Client_SetMaterial); + package.add("SetPEQZoneFlag", &Perl_Client_SetPEQZoneFlag); + package.add("SetPVP", &Perl_Client_SetPVP); + package.add("SetPrimaryWeaponOrnamentation", &Perl_Client_SetPrimaryWeaponOrnamentation); + package.add("SetRadiantCrystals", &Perl_Client_SetRadiantCrystals); + package.add("SetSecondaryWeaponOrnamentation", &Perl_Client_SetSecondaryWeaponOrnamentation); + package.add("SetSkill", &Perl_Client_SetSkill); + package.add("SetSkillPoints", &Perl_Client_SetSkillPoints); + package.add("SetStartZone", (void(*)(Client*, uint32))&Perl_Client_SetStartZone); + package.add("SetStartZone", (void(*)(Client*, uint32, float, float, float))&Perl_Client_SetStartZone); + package.add("SetStartZone", (void(*)(Client*, uint32, float, float, float, float))&Perl_Client_SetStartZone); + package.add("SetStats", &Perl_Client_SetStats); + package.add("SetThirst", &Perl_Client_SetThirst); + package.add("SetTint", &Perl_Client_SetTint); + package.add("SetTitleSuffix", (void(*)(Client*, std::string))&Perl_Client_SetTitleSuffix); + package.add("SetTitleSuffix", (void(*)(Client*, std::string, bool))&Perl_Client_SetTitleSuffix); + package.add("SetZoneFlag", &Perl_Client_SetZoneFlag); + package.add("SilentMessage", &Perl_Client_SilentMessage); + package.add("Sit", &Perl_Client_Sit); + package.add("SlotConvert2", &Perl_Client_SlotConvert2); + package.add("Stand", &Perl_Client_Stand); + package.add("SummonBaggedItems", &Perl_Client_SummonBaggedItems); + package.add("SummonItem", (void(*)(Client*, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32, uint32, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32, uint32, uint32, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32, uint32, uint32, uint32, uint32))&Perl_Client_SummonItem); + package.add("SummonItem", (void(*)(Client*, uint32, int16, bool, uint32, uint32, uint32, uint32, uint32, uint16))&Perl_Client_SummonItem); + package.add("TGB", &Perl_Client_TGB); + package.add("TakeMoneyFromPP", (bool(*)(Client*, uint64_t))&Perl_Client_TakeMoneyFromPP); + package.add("TakeMoneyFromPP", (bool(*)(Client*, uint64_t, bool))&Perl_Client_TakeMoneyFromPP); + package.add("TakePlatinum", (bool(*)(Client*, uint32))&Perl_Client_TakePlatinum); + package.add("TakePlatinum", (bool(*)(Client*, uint32, bool))&Perl_Client_TakePlatinum); + package.add("TaskSelector", &Perl_Client_TaskSelector); + package.add("Thirsty", &Perl_Client_Thirsty); + package.add("TrainDiscBySpellID", &Perl_Client_TrainDiscBySpellID); + package.add("UnFreeze", &Perl_Client_UnFreeze); + package.add("Undye", &Perl_Client_Undye); + package.add("UnmemSpell", (void(*)(Client*, int))&Perl_Client_UnmemSpell); + package.add("UnmemSpell", (void(*)(Client*, int, bool))&Perl_Client_UnmemSpell); + package.add("UnmemSpellAll", (void(*)(Client*))&Perl_Client_UnmemSpellAll); + package.add("UnmemSpellAll", (void(*)(Client*, bool))&Perl_Client_UnmemSpellAll); + package.add("UnmemSpellBySpellID", &Perl_Client_UnmemSpellBySpellID); + package.add("UnscribeSpell", (void(*)(Client*, int))&Perl_Client_UnscribeSpell); + package.add("UnscribeSpell", (void(*)(Client*, int, bool))&Perl_Client_UnscribeSpell); + package.add("UnscribeSpellAll", (void(*)(Client*))&Perl_Client_UnscribeSpellAll); + package.add("UnscribeSpellAll", (void(*)(Client*, bool))&Perl_Client_UnscribeSpellAll); + package.add("UnscribeSpellBySpellID", (void(*)(Client*, uint16))&Perl_Client_UnscribeSpellBySpellID); + package.add("UnscribeSpellBySpellID", (void(*)(Client*, uint16, bool))&Perl_Client_UnscribeSpellBySpellID); + package.add("UntrainDisc", (void(*)(Client*, int))&Perl_Client_UntrainDisc); + package.add("UntrainDisc", (void(*)(Client*, int, bool))&Perl_Client_UntrainDisc); + package.add("UntrainDiscAll", (void(*)(Client*))&Perl_Client_UntrainDiscAll); + package.add("UntrainDiscAll", (void(*)(Client*, bool))&Perl_Client_UntrainDiscAll); + package.add("UntrainDiscBySpellID", (void(*)(Client*, uint16))&Perl_Client_UntrainDiscBySpellID); + package.add("UntrainDiscBySpellID", (void(*)(Client*, uint16, bool))&Perl_Client_UntrainDiscBySpellID); + package.add("UpdateAdmin", (void(*)(Client*))&Perl_Client_UpdateAdmin); + package.add("UpdateAdmin", (void(*)(Client*, bool))&Perl_Client_UpdateAdmin); + package.add("UpdateGroupAAs", &Perl_Client_UpdateGroupAAs); + package.add("UpdateLDoNPoints", &Perl_Client_UpdateLDoNPoints); + package.add("UpdateTaskActivity", (void(*)(Client*, int, int, int))&Perl_Client_UpdateTaskActivity); + package.add("UpdateTaskActivity", (void(*)(Client*, int, int, int, bool))&Perl_Client_UpdateTaskActivity); + package.add("UpdateWho", (void(*)(Client*))&Perl_Client_UpdateWho); + package.add("UpdateWho", (void(*)(Client*, uint8))&Perl_Client_UpdateWho); + package.add("UseDiscipline", &Perl_Client_UseDiscipline); + package.add("WorldKick", &Perl_Client_WorldKick); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index 4325042d9..7e9ab9699 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.cpp @@ -4,504 +4,183 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "doors.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_DOOR \ - do { \ - if (sv_derived_from(ST(0), "Doors")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Doors*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Doors"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Doors_GetDoorDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetDoorDBID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetDoorDBID(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetDoorDBID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetDoorDBID(Doors* self) // @categories Doors +{ + return self->GetDoorDBID(); } -XS(XS_Doors_GetDoorID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetDoorID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetDoorID(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetDoorID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetDoorID(Doors* self) // @categories Doors +{ + return self->GetDoorID(); } -XS(XS_Doors_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetID(THIS)"); // @categories Doors - { - Doors *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetEntityID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetID(Doors* self) // @categories Doors +{ + return self->GetEntityID(); } -XS(XS_Doors_GetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetX(THIS)"); // @categories Doors - { - Doors *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetPosition().x; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Doors_GetX(Doors* self) // @categories Doors +{ + return self->GetPosition().x; } -XS(XS_Doors_GetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetY(THIS)"); // @categories Doors - { - Doors *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetPosition().y; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Doors_GetY(Doors* self) // @categories Doors +{ + return self->GetPosition().y; } -XS(XS_Doors_GetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetZ(THIS)"); // @categories Doors - { - Doors *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetPosition().z; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Doors_GetZ(Doors* self) // @categories Doors +{ + return self->GetPosition().z; } -XS(XS_Doors_GetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetHeading) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetHeading(THIS)"); // @categories Doors - { - Doors *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetPosition().w; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Doors_GetHeading(Doors* self) // @categories Doors +{ + return self->GetPosition().w; } -XS(XS_Doors_GetOpenType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetOpenType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetOpenType(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetOpenType(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetOpenType(Doors* self) // @categories Doors +{ + return self->GetOpenType(); } -XS(XS_Doors_GetLockpick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetLockpick) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetLockpick(THIS)"); // @categories Doors, Skills and Recipes - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetLockpick(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetLockpick(Doors* self) // @categories Doors, Skills and Recipes +{ + return self->GetLockpick(); } -XS(XS_Doors_GetKeyItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetKeyItem) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetKeyItem(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetKeyItem(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetKeyItem(Doors* self) // @categories Doors +{ + return self->GetKeyItem(); } -XS(XS_Doors_GetNoKeyring); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetNoKeyring) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::GetNoKeyring(THIS, uint8 type)"); // @categories Doors - { - Doors *THIS; - uint8 type = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->GetNoKeyring(); - } - XSRETURN_EMPTY; +uint8_t Perl_Doors_GetNoKeyring(Doors* self) // @categories Doors +{ + return self->GetNoKeyring(); } -XS(XS_Doors_GetIncline); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetIncline) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetIncline(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetIncline(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_Doors_GetIncline(Doors* self) // @categories Doors +{ + return self->GetIncline(); } -XS(XS_Doors_GetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetSize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetSize(THIS)"); // @categories Doors - { - Doors *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetSize(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Doors_GetSize(Doors* self) // @categories Doors +{ + return self->GetSize(); } - -XS(XS_Doors_SetOpenType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetOpenType) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetOpenType(THIS, uint32 open_type)"); // @categories Doors - { - Doors *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetOpenType(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetOpenType(Doors* self, uint32_t open_type) // @categories Doors +{ + self->SetOpenType(open_type); } -XS(XS_Doors_SetLockpick); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetLockpick) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetLockpick(THIS, uint32 lockpick_type)"); // @categories Doors - { - Doors *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetLockpick(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetLockpick(Doors* self, uint32_t lockpick_type) // @categories Doors +{ + self->SetLockpick(lockpick_type); } -XS(XS_Doors_SetKeyItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetKeyItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetKeyItem(THIS, uint32 key_item_id)"); // @categories Doors - { - Doors *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetKeyItem(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetKeyItem(Doors* self, uint32_t key_item_id) // @categories Doors +{ + self->SetKeyItem(key_item_id); } -XS(XS_Doors_SetNoKeyring); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetNoKeyring) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetNoKeyring(THIS, uint8 no_key_ring)"); // @categories Doors - { - Doors *THIS; - uint8 type = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetNoKeyring(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetNoKeyring(Doors* self, uint8_t no_key_ring) // @categories Doors +{ + self->SetNoKeyring(no_key_ring); } -XS(XS_Doors_SetIncline); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetIncline) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetIncline(THIS, uint32 incline)"); // @categories Doors - { - Doors *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetIncline(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetIncline(Doors* self, uint32_t incline) // @categories Doors +{ + self->SetIncline(incline); } -XS(XS_Doors_SetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetSize) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetSize(THIS, uint32 size)"); // @categories Doors - { - Doors *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_DOOR; - THIS->SetSize(type); - } - XSRETURN_EMPTY; +void Perl_Doors_SetSize(Doors* self, uint32_t size) // @categories Doors +{ + self->SetSize(size); } -XS(XS_Doors_SetLocation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetLocation) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Doors::SetLocation(THIS, float x, float y, float z)"); // @categories Doors - { - Doors *THIS; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_DOOR; - THIS->SetLocation(x, y, z); - } - XSRETURN_EMPTY; +void Perl_Doors_SetLocation(Doors* self, float x, float y, float z) // @categories Doors +{ + self->SetLocation(x, y, z); } -XS(XS_Doors_SetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetX) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, float x)"); // @categories Doors - { - Doors *THIS; - float x = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_DOOR; - auto position = THIS->GetPosition(); - position.x = x; - THIS->SetPosition(position); - } - XSRETURN_EMPTY; +void Perl_Doors_SetX(Doors* self, float x) // @categories Doors +{ + auto position = self->GetPosition(); + position.x = x; + self->SetPosition(position); } -XS(XS_Doors_SetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetY) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, float y)"); // @categories Doors - { - Doors *THIS; - float y = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_DOOR; - auto position = THIS->GetPosition(); - position.y = y; - THIS->SetPosition(position); - } - XSRETURN_EMPTY; +void Perl_Doors_SetY(Doors* self, float y) // @categories Doors +{ + auto position = self->GetPosition(); + position.y = y; + self->SetPosition(position); } -XS(XS_Doors_SetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetZ) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, float z)"); // @categories Doors - { - Doors *THIS; - float z = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_DOOR; - auto position = THIS->GetPosition(); - position.z = z; - THIS->SetPosition(position); - } - XSRETURN_EMPTY; +void Perl_Doors_SetZ(Doors* self, float z) // @categories Doors +{ + auto position = self->GetPosition(); + position.z = z; + self->SetPosition(position); } -XS(XS_Doors_SetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetHeading) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Doors::SetHeading(THIS, float heading)"); // @categories Doors - { - Doors *THIS; - float heading = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_DOOR; - auto position = THIS->GetPosition(); - position.w = heading; - THIS->SetPosition(position); - } - XSRETURN_EMPTY; +void Perl_Doors_SetHeading(Doors* self, float heading) // @categories Doors +{ + auto position = self->GetPosition(); + position.w = heading; + self->SetPosition(position); } -XS(XS_Doors_SetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_SetModelName) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Doors::SetModelName(THIS, string name)"); // @categories Doors - { - Doors *THIS; - char *name = nullptr; - VALIDATE_THIS_IS_DOOR; - if (items > 1) { name = (char *) SvPV_nolen(ST(1)); } - - THIS->SetDoorName(name); - } - XSRETURN_EMPTY; -} -XS(XS_Doors_GetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_GetModelName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::GetModelName(THIS)"); // @categories Doors - { - Doors *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_DOOR; - RETVAL = THIS->GetDoorName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +void Perl_Doors_SetModelName(Doors* self, const char* name) // @categories Doors +{ + self->SetDoorName(name); } -XS(XS_Doors_CreateDatabaseEntry); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Doors_CreateDatabaseEntry) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Doors::InsertDoor(THIS)"); // @categories Doors - { - Doors *THIS; - VALIDATE_THIS_IS_DOOR; - THIS->CreateDatabaseEntry(); - } - XSRETURN_EMPTY; +std::string Perl_Doors_GetModelName(Doors* self) // @categories Doors +{ + return self->GetDoorName(); } - -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Doors); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Doors) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "CreateDatabaseEntry"), XS_Doors_CreateDatabaseEntry, file, "$"); - newXSproto(strcpy(buf, "GetDoorDBID"), XS_Doors_GetDoorDBID, file, "$"); - newXSproto(strcpy(buf, "GetDoorID"), XS_Doors_GetDoorID, file, "$"); - newXSproto(strcpy(buf, "GetHeading"), XS_Doors_GetHeading, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Doors_GetID, file, "$"); - newXSproto(strcpy(buf, "GetIncline"), XS_Doors_GetIncline, file, "$"); - newXSproto(strcpy(buf, "GetKeyItem"), XS_Doors_GetKeyItem, file, "$"); - newXSproto(strcpy(buf, "GetLockPick"), XS_Doors_GetLockpick, file, "$"); - newXSproto(strcpy(buf, "GetModelName"), XS_Doors_GetModelName, file, "$"); - newXSproto(strcpy(buf, "GetNoKeyring"), XS_Doors_GetNoKeyring, file, "$"); - newXSproto(strcpy(buf, "GetOpenType"), XS_Doors_GetOpenType, file, "$"); - newXSproto(strcpy(buf, "GetSize"), XS_Doors_GetSize, file, "$"); - newXSproto(strcpy(buf, "GetX"), XS_Doors_GetX, file, "$"); - newXSproto(strcpy(buf, "GetY"), XS_Doors_GetY, file, "$"); - newXSproto(strcpy(buf, "GetZ"), XS_Doors_GetZ, file, "$"); - newXSproto(strcpy(buf, "SetHeading"), XS_Doors_SetHeading, file, "$$"); - newXSproto(strcpy(buf, "SetIncline"), XS_Doors_SetIncline, file, "$$"); - newXSproto(strcpy(buf, "SetKeyItem"), XS_Doors_SetKeyItem, file, "$$"); - newXSproto(strcpy(buf, "SetLocation"), XS_Doors_SetLocation, file, "$$$$"); - newXSproto(strcpy(buf, "SetLockPick"), XS_Doors_SetLockpick, file, "$$"); - newXSproto(strcpy(buf, "SetModelName"), XS_Doors_SetModelName, file, "$$"); - newXSproto(strcpy(buf, "SetNoKeyring"), XS_Doors_SetNoKeyring, file, "$$"); - newXSproto(strcpy(buf, "SetOpenType"), XS_Doors_SetOpenType, file, "$$"); - newXSproto(strcpy(buf, "SetSize"), XS_Doors_SetSize, file, "$$"); - newXSproto(strcpy(buf, "SetX"), XS_Doors_SetX, file, "$$"); - newXSproto(strcpy(buf, "SetY"), XS_Doors_SetY, file, "$$"); - newXSproto(strcpy(buf, "SetZ"), XS_Doors_SetZ, file, "$$"); - XSRETURN_YES; +void Perl_Doors_CreateDatabaseEntry(Doors* self) // @categories Doors +{ + self->CreateDatabaseEntry(); } + +void perl_register_doors() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("Doors"); + package.add("CreateDatabaseEntry", &Perl_Doors_CreateDatabaseEntry); + package.add("GetDoorDBID", &Perl_Doors_GetDoorDBID); + package.add("GetDoorID", &Perl_Doors_GetDoorID); + package.add("GetHeading", &Perl_Doors_GetHeading); + package.add("GetID", &Perl_Doors_GetID); + package.add("GetIncline", &Perl_Doors_GetIncline); + package.add("GetKeyItem", &Perl_Doors_GetKeyItem); + package.add("GetLockPick", &Perl_Doors_GetLockpick); + package.add("GetModelName", &Perl_Doors_GetModelName); + package.add("GetNoKeyring", &Perl_Doors_GetNoKeyring); + package.add("GetOpenType", &Perl_Doors_GetOpenType); + package.add("GetSize", &Perl_Doors_GetSize); + package.add("GetX", &Perl_Doors_GetX); + package.add("GetY", &Perl_Doors_GetY); + package.add("GetZ", &Perl_Doors_GetZ); + package.add("SetHeading", &Perl_Doors_SetHeading); + package.add("SetIncline", &Perl_Doors_SetIncline); + package.add("SetKeyItem", &Perl_Doors_SetKeyItem); + package.add("SetLocation", &Perl_Doors_SetLocation); + package.add("SetLockPick", &Perl_Doors_SetLockpick); + package.add("SetModelName", &Perl_Doors_SetModelName); + package.add("SetNoKeyring", &Perl_Doors_SetNoKeyring); + package.add("SetOpenType", &Perl_Doors_SetOpenType); + package.add("SetSize", &Perl_Doors_SetSize); + package.add("SetX", &Perl_Doors_SetX); + package.add("SetY", &Perl_Doors_SetY); + package.add("SetZ", &Perl_Doors_SetZ); +} + #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index 9a73154ab..7eb5520f2 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.cpp @@ -3,1680 +3,600 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" -#include +#include "../common/string_util.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "entity.h" +#include -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_ENTITY \ - do { \ - if (sv_derived_from(ST(0), "EntityList")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(EntityList*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type EntityList"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_EntityList_GetMobID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetMobID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetMobID(THIS, id)"); // @categories Script Utility - { - EntityList *THIS; - Mob *RETVAL; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetMobID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetMobID(EntityList* self, uint16_t mob_id) // @categories Script Utility +{ + return self->GetMobID(mob_id); } -XS(XS_EntityList_GetMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetMob) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetMob(THIS, name)"); - { - EntityList *THIS; - Mob *RETVAL; - char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetMob(name); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetMob(EntityList* self, const char* name) +{ + return self->GetMob(name); } -XS(XS_EntityList_GetMobByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetMobByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetMobByID(THIS, id)"); // @categories Script Utility - { - EntityList *THIS; - Mob *RETVAL; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetMob(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetMobByID(EntityList* self, uint16_t mob_id) // @categories Script Utility +{ + return self->GetMob(mob_id); } -XS(XS_EntityList_GetMobByNpcTypeID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetMobByNpcTypeID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetMobByNpcTypeID(THIS, get_id)"); // @categories Script Utility - { - EntityList *THIS; - Mob *RETVAL; - uint32 get_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetMobByNpcTypeID(get_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetMobByNpcTypeID(EntityList* self, uint32_t npc_type_id) // @categories Script Utility +{ + return self->GetMobByNpcTypeID(npc_type_id); } -XS(XS_EntityList_IsMobSpawnedByNpcTypeID); /* prototype pass -Wmissing-prototypes */ -XS(XS_EntityList_IsMobSpawnedByNpcTypeID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::IsMobSpawnedByNpcTypeID(THIS, get_id)"); // @categories Script Utility - { - EntityList *THIS; - bool RETVAL; - uint32 get_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->IsMobSpawnedByNpcTypeID(get_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_IsMobSpawnedByNpcTypeID(EntityList* self, uint32_t npc_type_id) // @categories Script Utility +{ + return self->IsMobSpawnedByNpcTypeID(npc_type_id); } -XS(XS_EntityList_GetNPCByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetNPCByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetNPCByID(THIS, id)"); // @categories Script Utility - { - EntityList *THIS; - NPC *RETVAL; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetNPCByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); +NPC* Perl_EntityList_GetNPCByID(EntityList* self, uint16_t id) // @categories Script Utility +{ + return self->GetNPCByID(id); } -XS(XS_EntityList_GetNPCByNPCTypeID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetNPCByNPCTypeID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetNPCByNPCTypeID(THIS, npc_id)"); // @categories Script Utility - { - EntityList *THIS; - NPC *RETVAL; - uint32 npc_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetNPCByNPCTypeID(npc_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); +NPC* Perl_EntityList_GetNPCByNPCTypeID(EntityList* self, uint32_t npc_id) // @categories Script Utility +{ + return self->GetNPCByNPCTypeID(npc_id); } -XS(XS_EntityList_GetNPCBySpawnID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetNPCBySpawnID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetNPCBySpawnID(THIS, spawn_id)"); // @categories Script Utility, Spawns - { - EntityList *THIS; - NPC *RETVAL; - uint32 spawn_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetNPCBySpawnID(spawn_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); +NPC* Perl_EntityList_GetNPCBySpawnID(EntityList* self, uint32_t spawn_id) // @categories Script Utility, Spawns +{ + return self->GetNPCBySpawnID(spawn_id); } -XS(XS_EntityList_GetClientByName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientByName) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetClientByName(THIS, name)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL; - char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetClientByName(name); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl_EntityList_GetClientByName(EntityList* self, const char* name) // @categories Account and Character, Script Utility +{ + return self->GetClientByName(name); } -XS(XS_EntityList_GetClientByAccID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientByAccID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetClientByAccID(THIS, uint32 account_id)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL; - uint32 accid = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetClientByAccID(accid); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl_EntityList_GetClientByAccID(EntityList* self, uint32_t account_id) // @categories Account and Character, Script Utility +{ + return self->GetClientByAccID(account_id); } -XS(XS_EntityList_GetClientByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetClientByID(THIS, uint16 client_id)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetClientByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl_EntityList_GetClientByID(EntityList* self, uint16_t client_id) // @categories Account and Character, Script Utility +{ + return self->GetClientByID(client_id); } -XS(XS_EntityList_GetClientByCharID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientByCharID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetClientByCharID(THIS, uint32 character_id)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL; - uint32 iCharID = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetClientByCharID(iCharID); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl_EntityList_GetClientByCharID(EntityList* self, uint32_t character_id) // @categories Account and Character, Script Utility +{ + return self->GetClientByCharID(character_id); } -XS(XS_EntityList_GetClientByWID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientByWID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetClientByWID(THIS, uint32 wid)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL; - uint32 iWID = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetClientByWID(iWID); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +Client* Perl_EntityList_GetClientByWID(EntityList* self, uint32_t wid) // @categories Account and Character, Script Utility +{ + return self->GetClientByWID(wid); } -XS(XS_EntityList_GetObjectByDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetObjectByDBID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetObjectByDBID(THIS, uint32 database_id)"); // @categories Script Utility, Objects - { - EntityList *THIS; - Object *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetObjectByDBID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Object", (void *) RETVAL); - } - XSRETURN(1); +Object* Perl_EntityList_GetObjectByDBID(EntityList* self, uint32_t database_id) // @categories Script Utility, Objects +{ + return self->GetObjectByDBID(database_id); } -XS(XS_EntityList_GetObjectByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetObjectByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetObjectByID(THIS, uint32 entity_id)"); // @categories Script Utility, Objects - { - EntityList *THIS; - Object *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetObjectByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Object", (void *) RETVAL); - } - XSRETURN(1); +Object* Perl_EntityList_GetObjectByID(EntityList* self, uint32_t entity_id) // @categories Script Utility, Objects +{ + return self->GetObjectByID(entity_id); } -XS(XS_EntityList_GetDoorsByDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetDoorsByDBID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByDBID(THIS, uint32 database_id)"); // @categories Script Utility, Doors - { - EntityList *THIS; - Doors *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetDoorsByDBID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Doors", (void *) RETVAL); - } - XSRETURN(1); +Doors* Perl_EntityList_GetDoorsByDBID(EntityList* self, uint32_t database_id) // @categories Script Utility, Doors +{ + return self->GetDoorsByDBID(database_id); } -XS(XS_EntityList_GetDoorsByDoorID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetDoorsByDoorID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByDoorID(THIS, uint32 door_id)"); // @categories Script Utility, Doors - { - EntityList *THIS; - Doors *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetDoorsByDoorID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Doors", (void *) RETVAL); - } - XSRETURN(1); +Doors* Perl_EntityList_GetDoorsByDoorID(EntityList* self, uint32_t door_id) // @categories Script Utility, Doors +{ + return self->GetDoorsByDoorID(door_id); } -XS(XS_EntityList_GetDoorsByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetDoorsByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetDoorsByID(THIS, uint32 entity_id)"); // @categories Script Utility, Doors - { - EntityList *THIS; - Doors *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetDoorsByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Doors", (void *) RETVAL); - } - XSRETURN(1); +Doors* Perl_EntityList_GetDoorsByID(EntityList* self, uint32_t entity_id) // @categories Script Utility, Doors +{ + return self->GetDoorsByID(entity_id); } -XS(XS_EntityList_FindDoor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_FindDoor) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::FindDoor(THIS, uint32 door_id)"); // @categories Script Utility, Doors - { - EntityList *THIS; - Doors *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->FindDoor(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Doors", (void *) RETVAL); - } - XSRETURN(1); +Doors* Perl_EntityList_FindDoor(EntityList* self, uint32_t door_id) // @categories Script Utility, Doors +{ + return self->FindDoor(door_id); } -XS(XS_EntityList_GetGroupByMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetGroupByMob) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetGroupByMob(THIS, Mob* mob)"); // @categories Account and Character, Script Utility, Group - { - EntityList *THIS; - Group *RETVAL; - Mob *mob; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - RETVAL = THIS->GetGroupByMob(mob); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Group", (void *) RETVAL); - } - XSRETURN(1); +Group* Perl_EntityList_GetGroupByMob(EntityList* self, Mob* mob) // @categories Account and Character, Script Utility, Group +{ + return self->GetGroupByMob(mob); } -XS(XS_EntityList_GetGroupByClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetGroupByClient) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetGroupByClient(THIS, Client* client)"); // @categories Account and Character, Script Utility, Group - { - EntityList *THIS; - Group *RETVAL; - Client *client; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - RETVAL = THIS->GetGroupByClient(client); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Group", (void *) RETVAL); - } - XSRETURN(1); +Group* Perl_EntityList_GetGroupByClient(EntityList* self, Client* client) // @categories Account and Character, Script Utility, Group +{ + return self->GetGroupByClient(client); } -XS(XS_EntityList_GetGroupByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetGroupByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetGroupByID(THIS, id)"); // @categories Account and Character, Script Utility, Group - { - EntityList *THIS; - Group *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetGroupByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Group", (void *) RETVAL); - } - XSRETURN(1); +Group* Perl_EntityList_GetGroupByID(EntityList* self, uint32_t id) // @categories Account and Character, Script Utility, Group +{ + return self->GetGroupByID(id); } -XS(XS_EntityList_GetGroupByLeaderName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetGroupByLeaderName) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetGroupByLeaderName(THIS, leader)"); // @categories Account and Character, Script Utility, Group - { - EntityList *THIS; - Group *RETVAL; - char *leader = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetGroupByLeaderName(leader); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Group", (void *) RETVAL); - } - XSRETURN(1); +Group* Perl_EntityList_GetGroupByLeaderName(EntityList* self, const char* leader_name) // @categories Account and Character, Script Utility, Group +{ + return self->GetGroupByLeaderName(leader_name); } -XS(XS_EntityList_GetRaidByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetRaidByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetRaidByID(THIS, id)"); // @categories Script Utility, Raid - { - EntityList *THIS; - Raid *RETVAL; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetRaidByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Raid", (void *) RETVAL); - } - XSRETURN(1); +Raid* Perl_EntityList_GetRaidByID(EntityList* self, uint32_t id) // @categories Script Utility, Raid +{ + return self->GetRaidByID(id); } -XS(XS_EntityList_GetRaidByClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetRaidByClient) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetRaidByClient(THIS, client)"); // @categories Account and Character, Script Utility, Raid - { - EntityList *THIS; - Raid *RETVAL; - Client *client; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - RETVAL = THIS->GetRaidByClient(client); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Raid", (void *) RETVAL); - } - XSRETURN(1); +Raid* Perl_EntityList_GetRaidByClient(EntityList* self, Client* client) // @categories Account and Character, Script Utility, Raid +{ + return self->GetRaidByClient(client); } -XS(XS_EntityList_GetCorpseByOwner); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetCorpseByOwner) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByOwner(THIS, client)"); // @categories Script Utility, Corpse - { - EntityList *THIS; - Corpse *RETVAL; - Client *client; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - RETVAL = THIS->GetCorpseByOwner(client); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Corpse", (void *) RETVAL); - } - XSRETURN(1); +Corpse* Perl_EntityList_GetCorpseByOwner(EntityList* self, Client* client) // @categories Script Utility, Corpse +{ + return self->GetCorpseByOwner(client); } -XS(XS_EntityList_GetCorpseByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetCorpseByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByID(THIS, id)"); // @categories Script Utility, Corpse - { - EntityList *THIS; - Corpse *RETVAL; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetCorpseByID(id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Corpse", (void *) RETVAL); - } - XSRETURN(1); +Corpse* Perl_EntityList_GetCorpseByID(EntityList* self, uint16_t id) // @categories Script Utility, Corpse +{ + return self->GetCorpseByID(id); } -XS(XS_EntityList_GetCorpseByName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetCorpseByName) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetCorpseByName(THIS, name)"); // @categories Script Utility, Corpse - { - EntityList *THIS; - Corpse *RETVAL; - char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetCorpseByName(name); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Corpse", (void *) RETVAL); - } - XSRETURN(1); +Corpse* Perl_EntityList_GetCorpseByName(EntityList* self, const char* name) // @categories Script Utility, Corpse +{ + return self->GetCorpseByName(name); } -XS(XS_EntityList_ClearClientPetitionQueue); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_ClearClientPetitionQueue) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::ClearClientPetitionQueue(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->ClearClientPetitionQueue(); - } - XSRETURN_EMPTY; +void Perl_EntityList_ClearClientPetitionQueue(EntityList* self) // @categories Script Utility +{ + self->ClearClientPetitionQueue(); } -XS(XS_EntityList_CanAddHateForMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_CanAddHateForMob) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::CanAddHateForMob(THIS, Mob* target)"); // @categories Script Utility, Hate and Aggro - { - EntityList *THIS; - bool RETVAL; - Mob *p; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - p = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "p is not of type Mob"); - if (p == nullptr) - Perl_croak(aTHX_ "p is nullptr, avoiding crash."); - - RETVAL = THIS->CanAddHateForMob(p); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_CanAddHateForMob(EntityList* self, Mob* target) // @categories Script Utility, Hate and Aggro +{ + return self->CanAddHateForMob(target); } -XS(XS_EntityList_Clear); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_Clear) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::Clear(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->Clear(); - } - XSRETURN_EMPTY; +void Perl_EntityList_Clear(EntityList* self) // @categories Script Utility +{ + self->Clear(); } -XS(XS_EntityList_RemoveMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveMob) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveMob(THIS, delete_id)"); // @categories Script Utility - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveMob(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveMob(EntityList* self, uint16_t delete_id) // @categories Script Utility +{ + return self->RemoveMob(delete_id); } -XS(XS_EntityList_RemoveClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveClient) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveClient(THIS, delete_id)"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveClient(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveClient(EntityList* self, uint16_t delete_id) // @categories Account and Character, Script Utility +{ + return self->RemoveClient(delete_id); } -XS(XS_EntityList_RemoveNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveNPC) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveNPC(THIS, delete_id)"); // @categories Script Utility - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveNPC(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveNPC(EntityList* self, uint16_t delete_id) // @categories Script Utility +{ + return self->RemoveNPC(delete_id); } -XS(XS_EntityList_RemoveGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveGroup) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveGroup(THIS, delete_id)"); // @categories Script Utility, Group - { - EntityList *THIS; - bool RETVAL; - uint32 delete_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveGroup(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveGroup(EntityList* self, uint32_t delete_id) // @categories Script Utility, Group +{ + return self->RemoveGroup(delete_id); } -XS(XS_EntityList_RemoveCorpse); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveCorpse) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveCorpse(THIS, delete_id)"); // @categories Corpse - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveCorpse(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveCorpse(EntityList* self, uint16_t delete_id) // @categories Corpse +{ + return self->RemoveCorpse(delete_id); } -XS(XS_EntityList_RemoveDoor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveDoor) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveDoor(THIS, delete_id)"); // @categories Doors - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveDoor(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveDoor(EntityList* self, uint16_t delete_id) // @categories Doors +{ + return self->RemoveDoor(delete_id); } -XS(XS_EntityList_RemoveTrap); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveTrap) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveTrap(THIS, delete_id)"); // @categories Script Utility - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveTrap(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveTrap(EntityList* self, uint16_t delete_id) // @categories Script Utility +{ + return self->RemoveTrap(delete_id); } -XS(XS_EntityList_RemoveObject); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveObject) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveObject(THIS, delete_id)"); // @categories Script Utility, Objects - { - EntityList *THIS; - bool RETVAL; - uint16 delete_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->RemoveObject(delete_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_RemoveObject(EntityList* self, uint16_t delete_id) // @categories Script Utility, Objects +{ + return self->RemoveObject(delete_id); } -XS(XS_EntityList_RemoveAllMobs); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllMobs) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllMobs(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllMobs(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllMobs(EntityList* self) // @categories Script Utility +{ + self->RemoveAllMobs(); } -XS(XS_EntityList_RemoveAllClients); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllClients) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllClients(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllClients(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllClients(EntityList* self) // @categories Script Utility +{ + self->RemoveAllClients(); } -XS(XS_EntityList_RemoveAllNPCs); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllNPCs) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllNPCs(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllNPCs(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllNPCs(EntityList* self) // @categories Script Utility +{ + self->RemoveAllNPCs(); } -XS(XS_EntityList_RemoveAllGroups); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllGroups) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllGroups(THIS)"); // @categories Group - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllGroups(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllGroups(EntityList* self) // @categories Group +{ + self->RemoveAllGroups(); } -XS(XS_EntityList_RemoveAllCorpses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllCorpses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllCorpses(THIS)"); // @categories Corpse - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllCorpses(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllCorpses(EntityList* self) // @categories Corpse +{ + self->RemoveAllCorpses(); } -XS(XS_EntityList_RemoveAllDoors); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllDoors) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllDoors(THIS)"); // @categories Doors - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllDoors(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllDoors(EntityList* self) // @categories Doors +{ + self->RemoveAllDoors(); } -XS(XS_EntityList_RemoveAllTraps); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllTraps) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllTraps(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllTraps(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllTraps(EntityList* self) // @categories Script Utility +{ + self->RemoveAllTraps(); } -XS(XS_EntityList_RemoveAllObjects); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveAllObjects) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::RemoveAllObjects(THIS)"); // @categories Objects - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveAllObjects(); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveAllObjects(EntityList* self) // @categories Objects +{ + self->RemoveAllObjects(); } -XS(XS_EntityList_Message); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_Message) { - dXSARGS; - if (items < 4) - Perl_croak(aTHX_ "Usage: EntityList::Message(THIS, uint32 guild_id, uint32 emote_color_type, string message)"); // @categories Script Utility - { - EntityList *THIS; - uint32 to_guilddbid = (uint32) SvUV(ST(1)); - uint32 type = (uint32) SvUV(ST(2)); - char *message = (char *) SvPV_nolen(ST(3)); - VALIDATE_THIS_IS_ENTITY; - THIS->Message(to_guilddbid, type, message); - } - XSRETURN_EMPTY; +void Perl_EntityList_Message(EntityList* self, uint32 guild_id, uint32 color_type, const char* message) // @categories Script Utility +{ + self->Message(guild_id, color_type, message); } -XS(XS_EntityList_MessageStatus); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_MessageStatus) { - dXSARGS; - if (items < 5) - Perl_croak(aTHX_ "Usage: EntityList::MessageStatus(THIS, uint32 guild_id, uint32 emote_color_type, string message)"); // @categories Script Utility - { - EntityList *THIS; - uint32 to_guilddbid = (uint32) SvUV(ST(1)); - int to_minstatus = (int) SvIV(ST(2)); - uint32 type = (uint32) SvUV(ST(3)); - char *message = (char *) SvPV_nolen(ST(4)); - VALIDATE_THIS_IS_ENTITY; - THIS->MessageStatus( - to_guilddbid, - to_minstatus, - type, - message - ); - } - XSRETURN_EMPTY; +void Perl_EntityList_MessageStatus(EntityList* self, uint32 guild_id, int to_minstatus, uint32 color_type, const char* message) // @categories Script Utility +{ + self->MessageStatus(guild_id, to_minstatus, color_type, message); } -XS(XS_EntityList_MessageClose); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_MessageClose) { - dXSARGS; - if (items < 6) - Perl_croak(aTHX_ "Usage: EntityList::MessageClose(THIS, Mob* sender, bool skip_sender, float distance, uint32 emote_color_type, string message)"); - { - EntityList *THIS; - Mob *sender; - bool skipsender = (bool) SvTRUE(ST(2)); - float dist = (float) SvNV(ST(3)); - uint32 type = (uint32) SvUV(ST(4)); - char *message = (char *) SvPV_nolen(ST(5)); - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); - - THIS->MessageClose(sender, skipsender, dist, type, message); - } - XSRETURN_EMPTY; +void Perl_EntityList_MessageClose(EntityList* self, Mob* sender, bool skip_sender, float distance, uint32 color_type, const char* message) +{ + self->MessageClose(sender, skip_sender, distance, color_type, message); } -XS(XS_EntityList_RemoveFromTargets); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveFromTargets) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveFromTargets(THIS, Mob* target)"); // @categories Script Utility - { - EntityList *THIS; - Mob *mob; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - THIS->RemoveFromTargets(mob); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveFromTargets(EntityList* self, Mob* mob) // @categories Script Utility +{ + self->RemoveFromTargets(mob); } -XS(XS_EntityList_ReplaceWithTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_ReplaceWithTarget) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: EntityList::ReplaceWithTarget(THIS, Mob* old_mob, Mob* new_target)"); // @categories Script Utility - { - EntityList *THIS; - Mob *pOldMob; - Mob *pNewTarget; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - pOldMob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "pOldMob is not of type Mob"); - if (pOldMob == nullptr) - Perl_croak(aTHX_ "pOldMob is nullptr, avoiding crash."); - - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - pNewTarget = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "pNewTarget is not of type Mob"); - if (pNewTarget == nullptr) - Perl_croak(aTHX_ "pNewTarget is nullptr, avoiding crash."); - - THIS->ReplaceWithTarget(pOldMob, pNewTarget); - } - XSRETURN_EMPTY; +void Perl_EntityList_ReplaceWithTarget(EntityList* self, Mob* old_mob, Mob* new_target) // @categories Script Utility +{ + self->ReplaceWithTarget(old_mob, new_target); } -XS(XS_EntityList_OpenDoorsNear); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_OpenDoorsNear) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::OpenDoorsNear(THIS, NPC* opener)"); // @categories Script Utility, Doors - { - EntityList *THIS; - Mob *opener; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - opener = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "opener is not of type Mob"); - if (opener == nullptr) - Perl_croak(aTHX_ "opener is nullptr, avoiding crash."); - - THIS->OpenDoorsNear(opener); - } - XSRETURN_EMPTY; +void Perl_EntityList_OpenDoorsNear(EntityList* self, Mob* opener) // @categories Script Utility, Doors +{ + self->OpenDoorsNear(opener); } -XS(XS_EntityList_MakeNameUnique); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_MakeNameUnique) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::MakeNameUnique(THIS, string name)"); // @categories Script Utility - { - EntityList *THIS; - char *RETVAL; - dXSTARG; - char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->MakeNameUnique(name); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_EntityList_MakeNameUnique(EntityList* self, char* name) // @categories Script Utility +{ + char buf[64] = {0}; + strn0cpy(buf, name, sizeof(buf)); + return self->MakeNameUnique(buf); // todo: this function is unsafe } -XS(XS_EntityList_RemoveNumbers); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveNumbers) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityListDeprecated::RemoveNumbers(CLASS, name)"); - { - char *RETVAL; - dXSTARG; - char *name = (char *) SvPV_nolen(ST(1)); - - RETVAL = EntityList::RemoveNumbers(name); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_EntityList_RemoveNumbers(EntityList* self, char* name) +{ + char buf[64] = {0}; + strn0cpy(buf, name, sizeof(buf)); + return EntityList::RemoveNumbers(buf); // todo: this function is unsafe } -XS(XS_EntityList_SignalMobsByNPCID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_SignalMobsByNPCID) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: EntityList::SignalMobsByNPCID(THIS, uint32 npc_type_id, int signal_id)"); // @categories Script Utility - { - EntityList *THIS; - uint32 npc_type = (uint32) SvUV(ST(1)); - int signal_id = (int) SvIV(ST(2)); - VALIDATE_THIS_IS_ENTITY; - THIS->SignalMobsByNPCID(npc_type, signal_id); - } - XSRETURN_EMPTY; +void Perl_EntityList_SignalMobsByNPCID(EntityList* self, uint32 npc_type_id, int signal_id) // @categories Script Utility +{ + self->SignalMobsByNPCID(npc_type_id, signal_id); } -XS(XS_EntityList_RemoveEntity); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveEntity) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::RemoveEntity(THIS, uint16 id)"); // @categories Script Utility - { - EntityList *THIS; - uint16 id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - THIS->RemoveEntity(id); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveEntity(EntityList* self, uint16_t id) // @categories Script Utility +{ + self->RemoveEntity(id); } -XS(XS_EntityList_DeleteNPCCorpses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_DeleteNPCCorpses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::DeleteNPCCorpses(THIS)"); // @categories Corpse - { - EntityList *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->DeleteNPCCorpses(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_EntityList_DeleteNPCCorpses(EntityList* self) // @categories Corpse +{ + return self->DeleteNPCCorpses(); } -XS(XS_EntityList_DeletePlayerCorpses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_DeletePlayerCorpses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::DeletePlayerCorpses(THIS)"); // @categories Account and Character, Corpse - { - EntityList *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->DeletePlayerCorpses(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_EntityList_DeletePlayerCorpses(EntityList* self) // @categories Account and Character, Corpse +{ + return self->DeletePlayerCorpses(); } -XS(XS_EntityList_HalveAggro); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_HalveAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::HalveAggro(THIS, Mob* target)"); // @categories Script Utility, Hate and Aggro - { - EntityList *THIS; - Mob *who; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - who = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "who is not of type Mob"); - if (who == nullptr) - Perl_croak(aTHX_ "who is nullptr, avoiding crash."); - - THIS->HalveAggro(who); - } - XSRETURN_EMPTY; +void Perl_EntityList_HalveAggro(EntityList* self, Mob* who) // @categories Script Utility, Hate and Aggro +{ + self->HalveAggro(who); } -XS(XS_EntityList_DoubleAggro); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_DoubleAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::DoubleAggro(THIS, *Mob target)"); // @categories Script Utility - { - EntityList *THIS; - Mob *who; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - who = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "who is not of type Mob"); - if (who == nullptr) - Perl_croak(aTHX_ "who is nullptr, avoiding crash."); - - THIS->DoubleAggro(who); - } - XSRETURN_EMPTY; +void Perl_EntityList_DoubleAggro(EntityList* self, Mob* who) // @categories Script Utility +{ + self->DoubleAggro(who); } -XS(XS_EntityList_ClearFeignAggro); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_ClearFeignAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::ClearFeignAggro(THIS, Mob* target)"); // @categories Script Utility - { - EntityList *THIS; - Mob *targ; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - targ = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "targ is not of type Mob"); - if (targ == nullptr) - Perl_croak(aTHX_ "targ is nullptr, avoiding crash."); - - THIS->ClearFeignAggro(targ); - } - XSRETURN_EMPTY; +void Perl_EntityList_ClearFeignAggro(EntityList* self, Mob* target) // @categories Script Utility +{ + self->ClearFeignAggro(target); } -XS(XS_EntityList_Fighting); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_Fighting) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::Fighting(THIS, Mob* target)"); // @categories Script Utility - { - EntityList *THIS; - bool RETVAL; - Mob *targ; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - targ = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "targ is not of type Mob"); - if (targ == nullptr) - Perl_croak(aTHX_ "targ is nullptr, avoiding crash."); - - RETVAL = THIS->Fighting(targ); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_EntityList_Fighting(EntityList* self, Mob* target) // @categories Script Utility +{ + return self->Fighting(target); } -XS(XS_EntityList_RemoveFromHateLists); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_RemoveFromHateLists) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: EntityList::RemoveFromHateLists(THIS, Mob* mob, [bool set_to_one = false])"); // @categories Script Utility, Hate and Aggro - { - EntityList *THIS; - Mob *mob; - bool settoone; - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - if (items < 3) - settoone = false; - else { - settoone = (bool) SvTRUE(ST(2)); - } - - THIS->RemoveFromHateLists(mob, settoone); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveFromHateLists(EntityList* self, Mob* mob) // @categories Script Utility, Hate and Aggro +{ + self->RemoveFromHateLists(mob); } -XS(XS_EntityList_MessageGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_MessageGroup) { - dXSARGS; - if (items < 5) - Perl_croak(aTHX_ "Usage: EntityList::MessageGroup(THIS, Mob* sender, bool skip_close, uint32 emote_color_type, string message)"); // @categories Script Utility, Group - { - EntityList *THIS; - Mob *sender; - bool skipclose = (bool) SvTRUE(ST(2)); - uint32 type = (uint32) SvUV(ST(3)); - char *message = (char *) SvPV_nolen(ST(4)); - VALIDATE_THIS_IS_ENTITY; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); - - THIS->MessageGroup(sender, skipclose, type, message); - } - XSRETURN_EMPTY; +void Perl_EntityList_RemoveFromHateLists(EntityList* self, Mob* mob, bool set_to_one) // @categories Script Utility, Hate and Aggro +{ + self->RemoveFromHateLists(mob, set_to_one); } -XS(XS_EntityList_GetRandomClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetRandomClient) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ "Usage: EntityList::GetRandomClient(THIS, float x, float y, float z, float distance, [Client* exclude_client = nullptr])"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Client *RETVAL, *exclude_client = nullptr; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float distance = (float) SvNV(ST(4)); - VALIDATE_THIS_IS_ENTITY; - - if (items == 6) { - if (sv_derived_from(ST(5), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(5))); - exclude_client = INT2PTR(Client *, tmp); - } - } - - RETVAL = entity_list.GetRandomClient(glm::vec3(x, y, z), (distance * distance), exclude_client); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); +void Perl_EntityList_MessageGroup(EntityList* self, Mob* sender, bool skip_close, uint32_t emote_color_type, const char* message) // @categories Script Utility, Group +{ + self->MessageGroup(sender, skip_close, emote_color_type, message); } -XS(XS_EntityList_GetMobList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetMobList) { - dXSARGS; - int num_mobs = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetMobList(THIS)"); // @categories Script Utility +Client* Perl_EntityList_GetRandomClient(EntityList* self, float x, float y, float z, float distance) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomClient(glm::vec3(x, y, z), (distance * distance)); +} + +Client* Perl_EntityList_GetRandomClient(EntityList* self, float x, float y, float z, float distance, Client* exclude_client) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomClient(glm::vec3(x, y, z), (distance * distance), exclude_client); +} + +perl::array Perl_EntityList_GetMobList(EntityList* self) // @categories Script Utility +{ + perl::array result; + + std::list mob_list; + entity_list.GetMobList(mob_list); + for (Mob* entry : mob_list) { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list mob_list; - entity_list.GetMobList(mob_list); - auto iter = mob_list.begin(); - - while (iter != mob_list.end()) { - Mob *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) entry); - XPUSHs(ST(0)); - num_mobs++; - iter++; - } + result.push_back(entry); } - XSRETURN(num_mobs); + + return result; } -XS(XS_EntityList_GetClientList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetClientList) { - dXSARGS; - int num_clients = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetClientList(THIS)"); // @categories Account and Character, Script Utility +perl::array Perl_EntityList_GetClientList(EntityList* self) // @categories Account and Character, Script Utility +{ + perl::array result; + + std::list client_list; + entity_list.GetClientList(client_list); + for (Client* entry : client_list) { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list client_list; - entity_list.GetClientList(client_list); - auto iter = client_list.begin(); - - while (iter != client_list.end()) { - Client *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) entry); - XPUSHs(ST(0)); - num_clients++; - iter++; - } + result.push_back(entry); } - XSRETURN(num_clients); + + return result; } #ifdef BOTS -XS(XS_EntityList_GetBotByID); -XS(XS_EntityList_GetBotByID) { - dXSARGS; - int bot_count = 0; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetBotByID(THIS, uint32 bot_id)"); // @categories Script Utility, Bot +Bot* Perl_EntityList_GetBotByID(EntityList* self, uint32_t bot_id) // @categories Script Utility, Bot +{ + return self->GetBotByBotID(bot_id); +} + +Bot* Perl_EntityList_GetBotByName(EntityList* self, std::string bot_name) // @categories Script Utility, Bot +{ + return self->GetBotByBotName(bot_name); +} + +perl::array Perl_EntityList_GetBotList(EntityList* self) // @categories Script Utility, Bot +{ + perl::array result; + auto current_bot_list = self->GetBotList(); + for (Bot* bot_iterator : current_bot_list) { - EntityList* THIS; - Bot* RETVAL; - uint32 bot_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetBotByBotID(bot_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Bot", (void *) RETVAL); + result.push_back(bot_iterator); } - XSRETURN(1); + return result; } -XS(XS_EntityList_GetBotByName); -XS(XS_EntityList_GetBotByName) { - dXSARGS; - int bot_count = 0; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::GetBotByName(THIS, string bot_name)"); // @categories Script Utility, Bot +perl::array Perl_EntityList_GetBotListByCharacterID(EntityList* self, uint32_t character_id) // @categories Script Utility, Bot +{ + perl::array result; + auto current_bot_list = self->GetBotListByCharacterID(character_id); + for (int i = 0; i < current_bot_list.size(); ++i) { - EntityList* THIS; - Bot* RETVAL; - std::string bot_name = (std::string) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - RETVAL = THIS->GetBotByBotName(bot_name); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Bot", (void *) RETVAL); + result.push_back(current_bot_list[i]); } - XSRETURN(1); + return result; } -XS(XS_EntityList_GetBotList); -XS(XS_EntityList_GetBotList) { - dXSARGS; - int bot_count = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetBotList(THIS)"); // @categories Script Utility, Bot +perl::array Perl_EntityList_GetBotListByClientName(EntityList* self, std::string client_name) // @categories Script Utility, Bot +{ + perl::array result; + auto current_bot_list = self->GetBotListByClientName(client_name); + for (int i = 0; i < current_bot_list.size(); ++i) { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - auto current_bot_list = THIS->GetBotList(); - for (auto bot_iterator : current_bot_list) { - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Bot", (void *)bot_iterator); - XPUSHs(ST(0)); - bot_count++; - } + result.push_back(current_bot_list[i]); } - XSRETURN(bot_count); -} - -XS(XS_EntityList_GetBotListByCharacterID); -XS(XS_EntityList_GetBotListByCharacterID) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: EntityList::GetBotListByCharacterID(THIS, uint32 character_id)"); // @categories Script Utility, Bot - } - - EntityList *THIS; - uint32 character_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - - auto current_bot_list = THIS->GetBotListByCharacterID(character_id); - auto bot_count = current_bot_list.size(); - - if (bot_count) { - EXTEND(sp, bot_count); - for (int index = 0; index < bot_count; ++index) { - ST(index) = sv_newmortal(); - sv_setref_pv(ST(index), "Bot", (void *) current_bot_list[index]); - XPUSHs(ST(index)); - } - XSRETURN(bot_count); - } - - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); -} - -XS(XS_EntityList_GetBotListByClientName); -XS(XS_EntityList_GetBotListByClientName) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: EntityList::GetBotListByClientName(THIS, string client_name)"); // @categories Script Utility, Bot - } - - EntityList *THIS; - std::string client_name = (std::string) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_ENTITY; - - auto current_bot_list = THIS->GetBotListByClientName(client_name); - auto bot_count = current_bot_list.size(); - - if (bot_count) { - EXTEND(sp, bot_count); - for (int index = 0; index < bot_count; ++index) { - ST(index) = sv_newmortal(); - sv_setref_pv(ST(index), "Bot", (void *) current_bot_list[index]); - XPUSHs(ST(index)); - } - XSRETURN(bot_count); - } - - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); + return result; } #endif -XS(XS_EntityList_GetNPCList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetNPCList) { - dXSARGS; - int num_npcs = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetNPCList(THIS)"); // @categories Script Utility - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list npc_list; - entity_list.GetNPCList(npc_list); - auto iter = npc_list.begin(); +perl::array Perl_EntityList_GetNPCList(EntityList* self) // @categories Script Utility +{ + perl::array result; - while (iter != npc_list.end()) { - NPC *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) entry); - XPUSHs(ST(0)); - num_npcs++; - iter++; - } + std::list npc_list; + entity_list.GetNPCList(npc_list); + for (NPC* entry : npc_list) + { + result.push_back(entry); } - XSRETURN(num_npcs); + + return result; } -XS(XS_EntityList_GetCorpseList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetCorpseList) { - dXSARGS; - int num_corpses = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetCorpseList(THIS)"); // @categories Script Utility, Corpse - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list corpse_list; - entity_list.GetCorpseList(corpse_list); - auto iter = corpse_list.begin(); +perl::array Perl_EntityList_GetCorpseList(EntityList* self) // @categories Script Utility, Corpse +{ + perl::array result; - while (iter != corpse_list.end()) { - Corpse *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Corpse", (void *) entry); - XPUSHs(ST(0)); - num_corpses++; - iter++; - } + std::list corpse_list; + entity_list.GetCorpseList(corpse_list); + for (Corpse* entry : corpse_list) + { + result.push_back(entry); } - XSRETURN(num_corpses); + + return result; } -XS(XS_EntityList_GetObjectList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetObjectList) { - dXSARGS; - int num_objects = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetObjectList(THIS)"); // @categories Script Utility, Objects - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list object_list; - entity_list.GetObjectList(object_list); - auto iter = object_list.begin(); +perl::array Perl_EntityList_GetObjectList(EntityList* self) // @categories Script Utility, Objects +{ + perl::array result; - while (iter != object_list.end()) { - Object *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Object", (void *) entry); - XPUSHs(ST(0)); - num_objects++; - iter++; - } + std::list object_list; + entity_list.GetObjectList(object_list); + for (Object* entry : object_list) + { + result.push_back(entry); } - XSRETURN(num_objects); + + return result; } -XS(XS_EntityList_GetDoorsList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetDoorsList) { - dXSARGS; - int num_objects = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: EntityList::GetDoorsList(THIS)"); // @categories Script Utility, Doors - { - EntityList *THIS; - VALIDATE_THIS_IS_ENTITY; - std::list door_list; - entity_list.GetDoorsList(door_list); - auto iter = door_list.begin(); +perl::array Perl_EntityList_GetDoorsList(EntityList* self) // @categories Script Utility, Doors +{ + perl::array result; - while (iter != door_list.end()) { - Doors *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Doors", (void *) entry); - XPUSHs(ST(0)); - num_objects++; - iter++; - } + std::list door_list; + entity_list.GetDoorsList(door_list); + for (Doors* entry : door_list) + { + result.push_back(entry); } - XSRETURN(num_objects); + + return result; } -XS(XS_EntityList_SignalAllClients); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_SignalAllClients) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: EntityList::SignalAllClients(THIS, uint32 data)"); // @categories Script Utility - { - EntityList *THIS; - uint32 data = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_ENTITY; - entity_list.SignalAllClients(data); - } - XSRETURN_EMPTY; +void Perl_EntityList_SignalAllClients(EntityList* self, uint32_t data) // @categories Script Utility +{ + entity_list.SignalAllClients(data); } -XS(XS_EntityList_GetRandomMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetRandomMob) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ "Usage: EntityList::GetRandomMob(THIS, float x, float y, float z, float distance, [Mob* exclude_mob = nullptr])"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - Mob *RETVAL, *exclude_mob = nullptr; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float distance = (float) SvNV(ST(4)); - VALIDATE_THIS_IS_ENTITY; - - if (items == 6) { - if (sv_derived_from(ST(5), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(5))); - exclude_mob = INT2PTR(Mob*, tmp); - } - } - - RETVAL = entity_list.GetRandomMob(glm::vec3(x, y, z), (distance * distance), exclude_mob); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetRandomMob(EntityList* self, float x, float y, float z, float distance) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomMob(glm::vec3(x, y, z), (distance * distance)); } -XS(XS_EntityList_GetRandomNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_EntityList_GetRandomNPC) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ "Usage: EntityList::GetRandomNPC(THIS, float x, float y, float z, float distance, [NPC* exclude_npc = nullptr])"); // @categories Account and Character, Script Utility - { - EntityList *THIS; - NPC *RETVAL, *exclude_npc = nullptr; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float distance = (float) SvNV(ST(4)); - VALIDATE_THIS_IS_ENTITY; - - if (items == 6) { - if (sv_derived_from(ST(5), "NPC")) { - IV tmp = SvIV((SV *) SvRV(ST(5))); - exclude_npc = INT2PTR(NPC*, tmp); - } - } - - RETVAL = entity_list.GetRandomNPC(glm::vec3(x, y, z), (distance * distance), exclude_npc); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_EntityList_GetRandomMob(EntityList* self, float x, float y, float z, float distance, Mob* exclude_mob) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomMob(glm::vec3(x, y, z), (distance * distance), exclude_mob); } -#ifdef __cplusplus -extern "C" -#endif -XS(boot_EntityList); /* prototype to pass -Wmissing-prototypes */ -XS(boot_EntityList) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; +NPC* Perl_EntityList_GetRandomNPC(EntityList* self, float x, float y, float z, float distance) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomNPC(glm::vec3(x, y, z), (distance * distance)); +} - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; +NPC* Perl_EntityList_GetRandomNPC(EntityList* self, float x, float y, float z, float distance, NPC* exclude_npc) // @categories Account and Character, Script Utility +{ + return entity_list.GetRandomNPC(glm::vec3(x, y, z), (distance * distance), exclude_npc); +} - //add the strcpy stuff to get rid of const warnings.... +void perl_register_entitylist() +{ + perl::interpreter perl(PERL_GET_THX); - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "CanAddHateForMob"), XS_EntityList_CanAddHateForMob, file, "$$"); - newXSproto(strcpy(buf, "Clear"), XS_EntityList_Clear, file, "$"); - newXSproto(strcpy(buf, "ClearClientPetitionQueue"), XS_EntityList_ClearClientPetitionQueue, file, "$"); - newXSproto(strcpy(buf, "ClearFeignAggro"), XS_EntityList_ClearFeignAggro, file, "$$"); - newXSproto(strcpy(buf, "DeleteNPCCorpses"), XS_EntityList_DeleteNPCCorpses, file, "$"); - newXSproto(strcpy(buf, "DeletePlayerCorpses"), XS_EntityList_DeletePlayerCorpses, file, "$"); - newXSproto(strcpy(buf, "DoubleAggro"), XS_EntityList_DoubleAggro, file, "$$"); - newXSproto(strcpy(buf, "Fighting"), XS_EntityList_Fighting, file, "$$"); - newXSproto(strcpy(buf, "FindDoor"), XS_EntityList_FindDoor, file, "$$"); + auto package = perl.new_class("EntityList"); + package.add("CanAddHateForMob", &Perl_EntityList_CanAddHateForMob); + package.add("Clear", &Perl_EntityList_Clear); + package.add("ClearClientPetitionQueue", &Perl_EntityList_ClearClientPetitionQueue); + package.add("ClearFeignAggro", &Perl_EntityList_ClearFeignAggro); + package.add("DeleteNPCCorpses", &Perl_EntityList_DeleteNPCCorpses); + package.add("DeletePlayerCorpses", &Perl_EntityList_DeletePlayerCorpses); + package.add("DoubleAggro", &Perl_EntityList_DoubleAggro); + package.add("Fighting", &Perl_EntityList_Fighting); + package.add("FindDoor", &Perl_EntityList_FindDoor); #ifdef BOTS - newXSproto(strcpy(buf, "GetBotByID"), XS_EntityList_GetBotByID, file, "$$"); - newXSproto(strcpy(buf, "GetBotByName"), XS_EntityList_GetBotByName, file, "$$"); - newXSproto(strcpy(buf, "GetBotList"), XS_EntityList_GetBotList, file, "$"); - newXSproto(strcpy(buf, "GetBotListByCharacterID"), XS_EntityList_GetBotListByCharacterID, file, "$$"); - newXSproto(strcpy(buf, "GetBotListByClientName"), XS_EntityList_GetBotListByClientName, file, "$$"); + package.add("GetBotByID", &Perl_EntityList_GetBotByID); + package.add("GetBotByName", &Perl_EntityList_GetBotByName); + package.add("GetBotList", &Perl_EntityList_GetBotList); + package.add("GetBotListByCharacterID", &Perl_EntityList_GetBotListByCharacterID); + package.add("GetBotListByClientName", &Perl_EntityList_GetBotListByClientName); #endif - newXSproto(strcpy(buf, "GetClientByAccID"), XS_EntityList_GetClientByAccID, file, "$$"); - newXSproto(strcpy(buf, "GetClientByCharID"), XS_EntityList_GetClientByCharID, file, "$$"); - newXSproto(strcpy(buf, "GetClientByID"), XS_EntityList_GetClientByID, file, "$$"); - newXSproto(strcpy(buf, "GetClientByName"), XS_EntityList_GetClientByName, file, "$$"); - newXSproto(strcpy(buf, "GetClientByWID"), XS_EntityList_GetClientByWID, file, "$$"); - newXSproto(strcpy(buf, "GetClientList"), XS_EntityList_GetClientList, file, "$"); - newXSproto(strcpy(buf, "GetCorpseByID"), XS_EntityList_GetCorpseByID, file, "$$"); - newXSproto(strcpy(buf, "GetCorpseByName"), XS_EntityList_GetCorpseByName, file, "$$"); - newXSproto(strcpy(buf, "GetCorpseByOwner"), XS_EntityList_GetCorpseByOwner, file, "$$"); - newXSproto(strcpy(buf, "GetCorpseList"), XS_EntityList_GetCorpseList, file, "$"); - newXSproto(strcpy(buf, "GetDoorsByDBID"), XS_EntityList_GetDoorsByDBID, file, "$$"); - newXSproto(strcpy(buf, "GetDoorsByDoorID"), XS_EntityList_GetDoorsByDoorID, file, "$$"); - newXSproto(strcpy(buf, "GetDoorsByID"), XS_EntityList_GetDoorsByID, file, "$$"); - newXSproto(strcpy(buf, "GetDoorsList"), XS_EntityList_GetDoorsList, file, "$"); - newXSproto(strcpy(buf, "GetGroupByClient"), XS_EntityList_GetGroupByClient, file, "$$"); - newXSproto(strcpy(buf, "GetGroupByID"), XS_EntityList_GetGroupByID, file, "$$"); - newXSproto(strcpy(buf, "GetGroupByLeaderName"), XS_EntityList_GetGroupByLeaderName, file, "$$"); - newXSproto(strcpy(buf, "GetGroupByMob"), XS_EntityList_GetGroupByMob, file, "$$"); - newXSproto(strcpy(buf, "GetMob"), XS_EntityList_GetMob, file, "$$"); - newXSproto(strcpy(buf, "GetMobByID"), XS_EntityList_GetMobByID, file, "$$"); - newXSproto(strcpy(buf, "GetMobByNpcTypeID"), XS_EntityList_GetMobByNpcTypeID, file, "$$"); - newXSproto(strcpy(buf, "GetMobID"), XS_EntityList_GetMobID, file, "$$"); - newXSproto(strcpy(buf, "GetMobList"), XS_EntityList_GetMobList, file, "$"); - newXSproto(strcpy(buf, "GetNPCByID"), XS_EntityList_GetNPCByID, file, "$$"); - newXSproto(strcpy(buf, "GetNPCByNPCTypeID"), XS_EntityList_GetNPCByNPCTypeID, file, "$$"); - newXSproto(strcpy(buf, "GetNPCBySpawnID"), XS_EntityList_GetNPCBySpawnID, file, "$$"); - newXSproto(strcpy(buf, "GetNPCList"), XS_EntityList_GetNPCList, file, "$"); - newXSproto(strcpy(buf, "GetObjectByDBID"), XS_EntityList_GetObjectByDBID, file, "$"); - newXSproto(strcpy(buf, "GetObjectByID"), XS_EntityList_GetObjectByID, file, "$"); - newXSproto(strcpy(buf, "GetObjectList"), XS_EntityList_GetObjectList, file, "$"); - newXSproto(strcpy(buf, "GetRaidByClient"), XS_EntityList_GetRaidByClient, file, "$$"); - newXSproto(strcpy(buf, "GetRaidByID"), XS_EntityList_GetRaidByID, file, "$$"); - newXSproto(strcpy(buf, "GetRandomClient"), XS_EntityList_GetRandomClient, file, "$$$$$;$"); - newXSproto(strcpy(buf, "GetRandomMob"), XS_EntityList_GetRandomMob, file, "$$$$$;$"); - newXSproto(strcpy(buf, "GetRandomNPC"), XS_EntityList_GetRandomNPC, file, "$$$$$;$"); - newXSproto(strcpy(buf, "HalveAggro"), XS_EntityList_HalveAggro, file, "$$"); - newXSproto(strcpy(buf, "IsMobSpawnedByNpcTypeID"), XS_EntityList_IsMobSpawnedByNpcTypeID, file, "$$"); - newXSproto(strcpy(buf, "MakeNameUnique"), XS_EntityList_MakeNameUnique, file, "$$"); - newXSproto(strcpy(buf, "Message"), XS_EntityList_Message, file, "$$$$;@"); - newXSproto(strcpy(buf, "MessageClose"), XS_EntityList_MessageClose, file, "$$$$$$;@"); - newXSproto(strcpy(buf, "MessageGroup"), XS_EntityList_MessageGroup, file, "$$$$$;@"); - newXSproto(strcpy(buf, "MessageStatus"), XS_EntityList_MessageStatus, file, "$$$$$;@"); - newXSproto(strcpy(buf, "OpenDoorsNear"), XS_EntityList_OpenDoorsNear, file, "$$"); - newXSproto(strcpy(buf, "RemoveAllClients"), XS_EntityList_RemoveAllClients, file, "$"); - newXSproto(strcpy(buf, "RemoveAllCorpses"), XS_EntityList_RemoveAllCorpses, file, "$"); - newXSproto(strcpy(buf, "RemoveAllDoors"), XS_EntityList_RemoveAllDoors, file, "$"); - newXSproto(strcpy(buf, "RemoveAllGroups"), XS_EntityList_RemoveAllGroups, file, "$"); - newXSproto(strcpy(buf, "RemoveAllMobs"), XS_EntityList_RemoveAllMobs, file, "$"); - newXSproto(strcpy(buf, "RemoveAllNPCs"), XS_EntityList_RemoveAllNPCs, file, "$"); - newXSproto(strcpy(buf, "RemoveAllObjects"), XS_EntityList_RemoveAllObjects, file, "$"); - newXSproto(strcpy(buf, "RemoveAllTraps"), XS_EntityList_RemoveAllTraps, file, "$"); - newXSproto(strcpy(buf, "RemoveClient"), XS_EntityList_RemoveClient, file, "$$"); - newXSproto(strcpy(buf, "RemoveCorpse"), XS_EntityList_RemoveCorpse, file, "$$"); - newXSproto(strcpy(buf, "RemoveDoor"), XS_EntityList_RemoveDoor, file, "$$"); - newXSproto(strcpy(buf, "RemoveEntity"), XS_EntityList_RemoveEntity, file, "$$"); - newXSproto(strcpy(buf, "RemoveFromHateLists"), XS_EntityList_RemoveFromHateLists, file, "$$;$"); - newXSproto(strcpy(buf, "RemoveFromTargets"), XS_EntityList_RemoveFromTargets, file, "$$"); - newXSproto(strcpy(buf, "RemoveGroup"), XS_EntityList_RemoveGroup, file, "$$"); - newXSproto(strcpy(buf, "RemoveMob"), XS_EntityList_RemoveMob, file, "$$"); - newXSproto(strcpy(buf, "RemoveNPC"), XS_EntityList_RemoveNPC, file, "$$"); - newXSproto(strcpy(buf, "RemoveNumbers"), XS_EntityList_RemoveNumbers, file, "$$"); - newXSproto(strcpy(buf, "RemoveObject"), XS_EntityList_RemoveObject, file, "$$"); - newXSproto(strcpy(buf, "RemoveTrap"), XS_EntityList_RemoveTrap, file, "$$"); - newXSproto(strcpy(buf, "ReplaceWithTarget"), XS_EntityList_ReplaceWithTarget, file, "$$$"); - newXSproto(strcpy(buf, "SignalAllClients"), XS_EntityList_SignalAllClients, file, "$$"); - newXSproto(strcpy(buf, "SignalMobsByNPCID"), XS_EntityList_SignalMobsByNPCID, file, "$$$"); - XSRETURN_YES; + package.add("GetClientByAccID", &Perl_EntityList_GetClientByAccID); + package.add("GetClientByCharID", &Perl_EntityList_GetClientByCharID); + package.add("GetClientByID", &Perl_EntityList_GetClientByID); + package.add("GetClientByName", &Perl_EntityList_GetClientByName); + package.add("GetClientByWID", &Perl_EntityList_GetClientByWID); + package.add("GetClientList", &Perl_EntityList_GetClientList); + package.add("GetCorpseByID", &Perl_EntityList_GetCorpseByID); + package.add("GetCorpseByName", &Perl_EntityList_GetCorpseByName); + package.add("GetCorpseByOwner", &Perl_EntityList_GetCorpseByOwner); + package.add("GetCorpseList", &Perl_EntityList_GetCorpseList); + package.add("GetDoorsByDBID", &Perl_EntityList_GetDoorsByDBID); + package.add("GetDoorsByDoorID", &Perl_EntityList_GetDoorsByDoorID); + package.add("GetDoorsByID", &Perl_EntityList_GetDoorsByID); + package.add("GetDoorsList", &Perl_EntityList_GetDoorsList); + package.add("GetGroupByClient", &Perl_EntityList_GetGroupByClient); + package.add("GetGroupByID", &Perl_EntityList_GetGroupByID); + package.add("GetGroupByLeaderName", &Perl_EntityList_GetGroupByLeaderName); + package.add("GetGroupByMob", &Perl_EntityList_GetGroupByMob); + package.add("GetMob", &Perl_EntityList_GetMob); + package.add("GetMobByID", &Perl_EntityList_GetMobByID); + package.add("GetMobByNpcTypeID", &Perl_EntityList_GetMobByNpcTypeID); + package.add("GetMobID", &Perl_EntityList_GetMobID); + package.add("GetMobList", &Perl_EntityList_GetMobList); + package.add("GetNPCByID", &Perl_EntityList_GetNPCByID); + package.add("GetNPCByNPCTypeID", &Perl_EntityList_GetNPCByNPCTypeID); + package.add("GetNPCBySpawnID", &Perl_EntityList_GetNPCBySpawnID); + package.add("GetNPCList", &Perl_EntityList_GetNPCList); + package.add("GetObjectByDBID", &Perl_EntityList_GetObjectByDBID); + package.add("GetObjectByID", &Perl_EntityList_GetObjectByID); + package.add("GetObjectList", &Perl_EntityList_GetObjectList); + package.add("GetRaidByClient", &Perl_EntityList_GetRaidByClient); + package.add("GetRaidByID", &Perl_EntityList_GetRaidByID); + package.add("GetRandomClient", (Client*(*)(EntityList*, float, float, float, float))&Perl_EntityList_GetRandomClient); + package.add("GetRandomClient", (Client*(*)(EntityList*, float, float, float, float, Client*))&Perl_EntityList_GetRandomClient); + package.add("GetRandomMob", (Mob*(*)(EntityList*, float, float, float, float))&Perl_EntityList_GetRandomMob); + package.add("GetRandomMob", (Mob*(*)(EntityList*, float, float, float, float, Mob*))&Perl_EntityList_GetRandomMob); + package.add("GetRandomNPC", (NPC*(*)(EntityList*, float, float, float, float))&Perl_EntityList_GetRandomNPC); + package.add("GetRandomNPC", (NPC*(*)(EntityList*, float, float, float, float, NPC*))&Perl_EntityList_GetRandomNPC); + package.add("HalveAggro", &Perl_EntityList_HalveAggro); + package.add("IsMobSpawnedByNpcTypeID", &Perl_EntityList_IsMobSpawnedByNpcTypeID); + package.add("MakeNameUnique", &Perl_EntityList_MakeNameUnique); + package.add("Message", &Perl_EntityList_Message); + package.add("MessageClose", &Perl_EntityList_MessageClose); + package.add("MessageGroup", &Perl_EntityList_MessageGroup); + package.add("MessageStatus", &Perl_EntityList_MessageStatus); + package.add("OpenDoorsNear", &Perl_EntityList_OpenDoorsNear); + package.add("RemoveAllClients", &Perl_EntityList_RemoveAllClients); + package.add("RemoveAllCorpses", &Perl_EntityList_RemoveAllCorpses); + package.add("RemoveAllDoors", &Perl_EntityList_RemoveAllDoors); + package.add("RemoveAllGroups", &Perl_EntityList_RemoveAllGroups); + package.add("RemoveAllMobs", &Perl_EntityList_RemoveAllMobs); + package.add("RemoveAllNPCs", &Perl_EntityList_RemoveAllNPCs); + package.add("RemoveAllObjects", &Perl_EntityList_RemoveAllObjects); + package.add("RemoveAllTraps", &Perl_EntityList_RemoveAllTraps); + package.add("RemoveClient", &Perl_EntityList_RemoveClient); + package.add("RemoveCorpse", &Perl_EntityList_RemoveCorpse); + package.add("RemoveDoor", &Perl_EntityList_RemoveDoor); + package.add("RemoveEntity", &Perl_EntityList_RemoveEntity); + package.add("RemoveFromHateLists", (void(*)(EntityList*, Mob*))&Perl_EntityList_RemoveFromHateLists); + package.add("RemoveFromHateLists", (void(*)(EntityList*, Mob*, bool))&Perl_EntityList_RemoveFromHateLists); + package.add("RemoveFromTargets", &Perl_EntityList_RemoveFromTargets); + package.add("RemoveGroup", &Perl_EntityList_RemoveGroup); + package.add("RemoveMob", &Perl_EntityList_RemoveMob); + package.add("RemoveNPC", &Perl_EntityList_RemoveNPC); + package.add("RemoveNumbers", &Perl_EntityList_RemoveNumbers); + package.add("RemoveObject", &Perl_EntityList_RemoveObject); + package.add("RemoveTrap", &Perl_EntityList_RemoveTrap); + package.add("ReplaceWithTarget", &Perl_EntityList_ReplaceWithTarget); + package.add("SignalAllClients", &Perl_EntityList_SignalAllClients); + package.add("SignalMobsByNPCID", &Perl_EntityList_SignalMobsByNPCID); } #endif //EMBPERL_XS_CLASSES - diff --git a/zone/perl_expedition.cpp b/zone/perl_expedition.cpp index 69cf7ac95..1a0b04487 100644 --- a/zone/perl_expedition.cpp +++ b/zone/perl_expedition.cpp @@ -2,669 +2,267 @@ #ifdef EMBPERL_XS_CLASSES +#include "embperl.h" #include "expedition.h" #include "zone_store.h" -#include "embperl.h" #include "../common/global_define.h" -#ifdef seed -#undef seed -#endif - -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_EXPEDITION \ - do { \ - if (sv_derived_from(ST(0), "Expedition")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Expedition*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Expedition"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Expedition_AddLockout); -XS(XS_Expedition_AddLockout) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Expedition::AddLockout(THIS, string event_name, uint32 seconds)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - std::string event_name(SvPV_nolen(ST(1))); - uint32_t seconds = static_cast(SvUV(ST(2))); - - THIS->AddLockout(event_name, seconds); - - XSRETURN_EMPTY; +void Perl_Expedition_AddLockout(Expedition* self, std::string event_name, uint32_t seconds) +{ + self->AddLockout(event_name, seconds); } -XS(XS_Expedition_AddLockoutDuration); -XS(XS_Expedition_AddLockoutDuration) { - dXSARGS; - if (items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Expedition::AddLockout(THIS, string event_name, int seconds, [bool members_only = true])"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - std::string event_name(SvPV_nolen(ST(1))); - int seconds = static_cast(SvUV(ST(2))); - if (items == 4) - { - bool members_only = (bool)SvTRUE(ST(3)); - THIS->AddLockoutDuration(event_name, seconds, members_only); - } - else - { - THIS->AddLockoutDuration(event_name, seconds); - } - - XSRETURN_EMPTY; +void Perl_Expedition_AddLockoutDuration(Expedition* self, std::string event_name, int seconds) +{ + self->AddLockoutDuration(event_name, seconds); } -XS(XS_Expedition_AddReplayLockout); -XS(XS_Expedition_AddReplayLockout) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::AddReplayLockout(THIS, uint32 seconds)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t seconds = static_cast(SvUV(ST(1))); - - THIS->AddReplayLockout(seconds); - - XSRETURN_EMPTY; +void Perl_Expedition_AddLockoutDuration(Expedition* self, std::string event_name, int seconds, bool members_only) +{ + self->AddLockoutDuration(event_name, seconds, members_only); } -XS(XS_Expedition_AddReplayLockoutDuration); -XS(XS_Expedition_AddReplayLockoutDuration) { - dXSARGS; - if (items != 2 && items != 3) { - Perl_croak(aTHX_ "Usage: Expedition::AddReplayLockoutDuration(THIS, int seconds, [bool members_only = true])"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - int seconds = static_cast(SvUV(ST(1))); - if (items == 3) - { - bool members_only = (bool)SvTRUE(ST(2)); - THIS->AddReplayLockoutDuration(seconds, members_only); - } - else - { - THIS->AddReplayLockoutDuration(seconds); - } - - XSRETURN_EMPTY; +void Perl_Expedition_AddReplayLockout(Expedition* self, uint32_t seconds) +{ + self->AddReplayLockout(seconds); } -XS(XS_Expedition_GetDynamicZoneID); -XS(XS_Expedition_GetDynamicZoneID) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetDynamicZoneID(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetID()); +void Perl_Expedition_AddReplayLockoutDuration(Expedition* self, int seconds) +{ + self->AddReplayLockoutDuration(seconds); } -XS(XS_Expedition_GetID); -XS(XS_Expedition_GetID) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetID(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetID()); +void Perl_Expedition_AddReplayLockoutDuration(Expedition* self, int seconds, bool members_only) +{ + self->AddReplayLockoutDuration(seconds, members_only); } -XS(XS_Expedition_GetInstanceID); -XS(XS_Expedition_GetInstanceID) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetInstanceID(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetInstanceID()); +uint32_t Perl_Expedition_GetDynamicZoneID(Expedition* self) +{ + return self->GetDynamicZone()->GetID(); } -XS(XS_Expedition_GetLeaderName); -XS(XS_Expedition_GetLeaderName) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetLeaderName(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_PV(THIS->GetLeaderName().c_str()); +uint32_t Perl_Expedition_GetID(Expedition* self) +{ + return self->GetID(); } -XS(XS_Expedition_GetLockouts); -XS(XS_Expedition_GetLockouts) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetLockouts(THIS)"); - } +uint16_t Perl_Expedition_GetInstanceID(Expedition* self) +{ + return self->GetDynamicZone()->GetInstanceID(); +} - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; +std::string Perl_Expedition_GetLeaderName(Expedition* self) +{ + return self->GetLeaderName(); +} - HV* hash = newHV(); - - auto lockouts = THIS->GetLockouts(); +perl::reference Perl_Expedition_GetLockouts(Expedition* self) +{ + perl::hash table; + auto lockouts = self->GetLockouts(); for (const auto& lockout : lockouts) { - hv_store(hash, lockout.first.c_str(), static_cast(lockout.first.size()), - newSVuv(lockout.second.GetSecondsRemaining()), 0); + table[lockout.first] = lockout.second.GetSecondsRemaining(); } - - ST(0) = sv_2mortal(newRV_noinc((SV*)hash)); // take ownership of hash (refcnt remains 1) - XSRETURN(1); + return perl::reference(table); } -XS(XS_Expedition_GetLootEventByNPCTypeID); -XS(XS_Expedition_GetLootEventByNPCTypeID) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::GetLootEventByNPCTypeID(THIS, uint32 npc_type_id)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t npc_type_id = static_cast(SvUV(ST(1))); - - XSRETURN_PV(THIS->GetLootEventByNPCTypeID(npc_type_id).c_str()); +std::string Perl_Expedition_GetLootEventByNPCTypeID(Expedition* self, uint32_t npc_type_id) +{ + return self->GetLootEventByNPCTypeID(npc_type_id); } -XS(XS_Expedition_GetLootEventBySpawnID); -XS(XS_Expedition_GetLootEventBySpawnID) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::GetLootEventBySpawnID(THIS, uint32 spawn_id)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t spawn_id = static_cast(SvUV(ST(1))); - - XSRETURN_PV(THIS->GetLootEventBySpawnID(spawn_id).c_str()); +std::string Perl_Expedition_GetLootEventBySpawnID(Expedition* self, uint32_t spawn_id) +{ + return self->GetLootEventBySpawnID(spawn_id); } -XS(XS_Expedition_GetMemberCount); -XS(XS_Expedition_GetMemberCount) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetMemberCount(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetMemberCount()); +uint32_t Perl_Expedition_GetMemberCount(Expedition* self) +{ + return self->GetDynamicZone()->GetMemberCount(); } -XS(XS_Expedition_GetMembers); -XS(XS_Expedition_GetMembers) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetMembers(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - HV* hash = newHV(); - - for (const auto& member : THIS->GetDynamicZone()->GetMembers()) +perl::reference Perl_Expedition_GetMembers(Expedition* self) +{ + perl::hash table; + for (const auto& member : self->GetDynamicZone()->GetMembers()) { - hv_store(hash, member.name.c_str(), static_cast(member.name.size()), - newSVuv(member.id), 0); + table[member.name] = member.id; } - - ST(0) = sv_2mortal(newRV_noinc((SV*)hash)); - XSRETURN(1); + return perl::reference(table); } -XS(XS_Expedition_GetName); -XS(XS_Expedition_GetName) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetName(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_PV(THIS->GetName().c_str()); +std::string Perl_Expedition_GetName(Expedition* self) +{ + return self->GetName(); } -XS(XS_Expedition_GetSecondsRemaining); -XS(XS_Expedition_GetSecondsRemaining) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetSecondsRemaining(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetSecondsRemaining()); +uint32_t Perl_Expedition_GetSecondsRemaining(Expedition* self) +{ + return self->GetDynamicZone()->GetSecondsRemaining(); } -XS(XS_Expedition_GetUUID); -XS(XS_Expedition_GetUUID) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetUUID(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_PV(THIS->GetDynamicZone()->GetUUID().c_str()); +std::string Perl_Expedition_GetUUID(Expedition* self) +{ + return self->GetDynamicZone()->GetUUID(); } -XS(XS_Expedition_GetZoneID); -XS(XS_Expedition_GetZoneID) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetZoneID(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetZoneID()); +uint16_t Perl_Expedition_GetZoneID(Expedition* self) +{ + return self->GetDynamicZone()->GetZoneID(); } -XS(XS_Expedition_GetZoneName); -XS(XS_Expedition_GetZoneName) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetZoneName(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_PV(ZoneName(THIS->GetDynamicZone()->GetZoneID())); +std::string Perl_Expedition_GetZoneName(Expedition* self) +{ + return ZoneName(self->GetDynamicZone()->GetZoneID()); } -XS(XS_Expedition_GetZoneVersion); -XS(XS_Expedition_GetZoneVersion) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::GetZoneVersion(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - XSRETURN_UV(THIS->GetDynamicZone()->GetZoneVersion()); +uint32_t Perl_Expedition_GetZoneVersion(Expedition* self) +{ + return self->GetDynamicZone()->GetZoneVersion(); } -XS(XS_Expedition_HasLockout); -XS(XS_Expedition_HasLockout) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::HasLockout(THIS, string event_name)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - std::string event_name(SvPV_nolen(ST(1))); - - bool result = THIS->HasLockout(event_name); - ST(0) = boolSV(result); - XSRETURN(1); +bool Perl_Expedition_HasLockout(Expedition* self, std::string event_name) +{ + return self->HasLockout(event_name); } -XS(XS_Expedition_HasReplayLockout); -XS(XS_Expedition_HasReplayLockout) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::HasReplayLockout(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - bool result = THIS->HasReplayLockout(); - ST(0) = boolSV(result); - XSRETURN(1); +bool Perl_Expedition_HasReplayLockout(Expedition* self) +{ + return self->HasReplayLockout(); } -XS(XS_Expedition_IsLocked); -XS(XS_Expedition_IsLocked) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::IsLocked(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - ST(0) = boolSV(THIS->IsLocked()); - XSRETURN(1); +bool Perl_Expedition_IsLocked(Expedition* self) +{ + return self->IsLocked(); } -XS(XS_Expedition_RemoveCompass); -XS(XS_Expedition_RemoveCompass) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Expedition::RemoveCompass(THIS)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - THIS->GetDynamicZone()->SetCompass(0, 0, 0, 0, true); - - XSRETURN_EMPTY; +void Perl_Expedition_RemoveCompass(Expedition* self) +{ + self->GetDynamicZone()->SetCompass(0, 0, 0, 0, true); } -XS(XS_Expedition_RemoveLockout); -XS(XS_Expedition_RemoveLockout) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::RemoveLockout(THIS, string event_name)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - std::string event_name(SvPV_nolen(ST(1))); - - THIS->RemoveLockout(event_name); - - XSRETURN_EMPTY; +void Perl_Expedition_RemoveLockout(Expedition* self, std::string event_name) +{ + self->RemoveLockout(event_name); } -XS(XS_Expedition_SetCompass); -XS(XS_Expedition_SetCompass) { - dXSARGS; - if (items != 5) { - Perl_croak(aTHX_ "Usage: Expedition::SetCompass(THIS, uint32 zone_id | string zone_name, float x, float y, float z)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - float x = static_cast(SvNV(ST(2))); - float y = static_cast(SvNV(ST(3))); - float z = static_cast(SvNV(ST(4))); - - if (SvTYPE(ST(1)) == SVt_PV) - { - std::string zone_name(SvPV_nolen(ST(1))); - THIS->GetDynamicZone()->SetCompass(ZoneID(zone_name), x, y, z, true); - } - else if (SvTYPE(ST(1)) == SVt_IV) - { - uint32_t zone_id = static_cast(SvUV(ST(1))); - THIS->GetDynamicZone()->SetCompass(zone_id, x, y, z, true); - } - else - { - Perl_croak(aTHX_ "Expedition::SetCompass expected an integer or string"); - } - - XSRETURN_EMPTY; +void Perl_Expedition_SetCompass(Expedition* self, perl::scalar zone, float x, float y, float z) +{ + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + self->GetDynamicZone()->SetCompass(zone_id, x, y, z, true); } -XS(XS_Expedition_SetLocked); -XS(XS_Expedition_SetLocked) { - dXSARGS; - if (items != 2 && items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Expedition::SetLocked(THIS, bool locked, [int lock_msg = 0], [uint32 color = 15])"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - bool locked = (bool)SvTRUE(ST(1)); - int lock_msg = (items == 3) ? static_cast(SvIV(ST(2))) : 0; - if (items == 4) - { - THIS->SetLocked(locked, static_cast(lock_msg), true, (uint32)SvUV(ST(3))); - } - else - { - THIS->SetLocked(locked, static_cast(lock_msg), true); - } - - XSRETURN_EMPTY; +void Perl_Expedition_SetLocked(Expedition* self, bool locked) +{ + self->SetLocked(locked, ExpeditionLockMessage::None); } -XS(XS_Expedition_SetLootEventByNPCTypeID); -XS(XS_Expedition_SetLootEventByNPCTypeID) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Expedition::SetLootEventByNPCTypeID(THIS, uint32 npc_type_id, string event_name)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t npc_type_id = static_cast(SvUV(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - - THIS->SetLootEventByNPCTypeID(npc_type_id, event_name); - - XSRETURN_EMPTY; +void Perl_Expedition_SetLocked(Expedition* self, bool locked, int lock_msg) +{ + self->SetLocked(locked, static_cast(lock_msg), true); } -XS(XS_Expedition_SetLootEventBySpawnID); -XS(XS_Expedition_SetLootEventBySpawnID) { - dXSARGS; - if (items != 3) { - Perl_croak(aTHX_ "Usage: Expedition::SetLootEventBySpawnID(THIS, uint32 spawn_id, string event_name)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t spawn_id = static_cast(SvUV(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - - THIS->SetLootEventBySpawnID(spawn_id, event_name); - - XSRETURN_EMPTY; +void Perl_Expedition_SetLocked(Expedition* self, bool locked, int lock_msg, uint32_t color) +{ + self->SetLocked(locked, static_cast(lock_msg), true, color); } -XS(XS_Expedition_SetReplayLockoutOnMemberJoin); -XS(XS_Expedition_SetReplayLockoutOnMemberJoin) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::SetReplayLockoutOnMemberJoin(THIS, bool enable)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - bool enable = (bool)SvTRUE(ST(1)); - - THIS->SetReplayLockoutOnMemberJoin(enable, true); - - XSRETURN_EMPTY; +void Perl_Expedition_SetLootEventByNPCTypeID(Expedition* self, uint32_t npc_type_id, std::string event_name) +{ + self->SetLootEventByNPCTypeID(npc_type_id, event_name); } -XS(XS_Expedition_SetSafeReturn); -XS(XS_Expedition_SetSafeReturn) { - dXSARGS; - if (items != 6) { - Perl_croak(aTHX_ "Usage: Expedition::SetSafeReturn(THIS, uint32 zone_id | string zone_name, float x, float y, float z, float heading)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - float x = static_cast(SvNV(ST(2))); - float y = static_cast(SvNV(ST(3))); - float z = static_cast(SvNV(ST(4))); - float heading = static_cast(SvNV(ST(5))); - - if (SvTYPE(ST(1)) == SVt_PV) - { - std::string zone_name(SvPV_nolen(ST(1))); - THIS->GetDynamicZone()->SetSafeReturn(ZoneID(zone_name), x, y, z, heading, true); - } - else if (SvTYPE(ST(1)) == SVt_IV) - { - uint32_t zone_id = static_cast(SvUV(ST(1))); - THIS->GetDynamicZone()->SetSafeReturn(zone_id, x, y, z, heading, true); - } - else - { - Perl_croak(aTHX_ "Expedition::SetSafeReturn expected an integer or string"); - } - - XSRETURN_EMPTY; +void Perl_Expedition_SetLootEventBySpawnID(Expedition* self, uint32_t entity_id, std::string event_name) +{ + self->SetLootEventBySpawnID(entity_id, event_name); } -XS(XS_Expedition_SetSecondsRemaining); -XS(XS_Expedition_SetSecondsRemaining) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Expedition::SetSecondsRemaining(THIS, uint32 seconds_remaining)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - uint32_t seconds_remaining = static_cast(SvUV(ST(1))); - THIS->GetDynamicZone()->SetSecondsRemaining(seconds_remaining); - - XSRETURN_EMPTY; +void Perl_Expedition_SetReplayLockoutOnMemberJoin(Expedition* self, bool enable) +{ + self->SetReplayLockoutOnMemberJoin(enable, true); } -XS(XS_Expedition_SetZoneInLocation); -XS(XS_Expedition_SetZoneInLocation) { - dXSARGS; - if (items != 5) { - Perl_croak(aTHX_ "Usage: Expedition::SetZoneInLocation(THIS, float x, float y, float z, float heading)"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - float x = static_cast(SvNV(ST(1))); - float y = static_cast(SvNV(ST(2))); - float z = static_cast(SvNV(ST(3))); - float heading = static_cast(SvNV(ST(4))); - - THIS->GetDynamicZone()->SetZoneInLocation(x, y, z, heading, true); - - XSRETURN_EMPTY; +void Perl_Expedition_SetSafeReturn(Expedition* self, perl::scalar zone, float x, float y, float z, float heading) +{ + uint32_t zone_id = zone.is_string() ? ZoneID(zone.c_str()) : zone.as(); + self->GetDynamicZone()->SetSafeReturn(zone_id, x, y, z, heading, true); } -XS(XS_Expedition_UpdateLockoutDuration); -XS(XS_Expedition_UpdateLockoutDuration) { - dXSARGS; - if (items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Expedition::UpdateLockoutDuration(THIS, string event_name, uint32 seconds, [bool members_only = true])"); - } - - Expedition* THIS = nullptr; - VALIDATE_THIS_IS_EXPEDITION; - - std::string event_name(SvPV_nolen(ST(1))); - uint32_t seconds = static_cast(SvUV(ST(2))); - - if (items == 4) - { - bool members_only = (bool)SvTRUE(ST(3)); - THIS->UpdateLockoutDuration(event_name, seconds, members_only); - } - else - { - THIS->UpdateLockoutDuration(event_name, seconds); - } - - XSRETURN_EMPTY; +void Perl_Expedition_SetSecondsRemaining(Expedition* self, uint32_t seconds_remaining) +{ + self->GetDynamicZone()->SetSecondsRemaining(seconds_remaining); } -XS(boot_Expedition); -XS(boot_Expedition) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; +void Perl_Expedition_SetZoneInLocation(Expedition* self, float x, float y, float z, float heading) +{ + self->GetDynamicZone()->SetZoneInLocation(x, y, z, heading, true); +} - if (items != 1) { - fprintf(stderr, "boot_Expedition does not take any arguments."); - } - char buf[128]; +void Perl_Expedition_UpdateLockoutDuration(Expedition* self, std::string event_name, uint32_t seconds) +{ + self->UpdateLockoutDuration(event_name, seconds); +} - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AddLockout"), XS_Expedition_AddLockout, file, "$$$"); - newXSproto(strcpy(buf, "AddLockoutDuration"), XS_Expedition_AddLockoutDuration, file, "$$$;$"); - newXSproto(strcpy(buf, "AddReplayLockout"), XS_Expedition_AddReplayLockout, file, "$$"); - newXSproto(strcpy(buf, "AddReplayLockoutDuration"), XS_Expedition_AddReplayLockoutDuration, file, "$$;$"); - newXSproto(strcpy(buf, "GetDynamicZoneID"), XS_Expedition_GetDynamicZoneID, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Expedition_GetID, file, "$"); - newXSproto(strcpy(buf, "GetInstanceID"), XS_Expedition_GetInstanceID, file, "$"); - newXSproto(strcpy(buf, "GetLeaderName"), XS_Expedition_GetLeaderName, file, "$"); - newXSproto(strcpy(buf, "GetLockouts"), XS_Expedition_GetLockouts, file, "$"); - newXSproto(strcpy(buf, "GetLootEventByNPCTypeID"), XS_Expedition_GetLootEventByNPCTypeID, file, "$$"); - newXSproto(strcpy(buf, "GetLootEventBySpawnID"), XS_Expedition_GetLootEventBySpawnID, file, "$$"); - newXSproto(strcpy(buf, "GetMemberCount"), XS_Expedition_GetMemberCount, file, "$"); - newXSproto(strcpy(buf, "GetMembers"), XS_Expedition_GetMembers, file, "$"); - newXSproto(strcpy(buf, "GetName"), XS_Expedition_GetName, file, "$"); - newXSproto(strcpy(buf, "GetSecondsRemaining"), XS_Expedition_GetSecondsRemaining, file, "$"); - newXSproto(strcpy(buf, "GetUUID"), XS_Expedition_GetUUID, file, "$"); - newXSproto(strcpy(buf, "GetZoneID"), XS_Expedition_GetZoneID, file, "$"); - newXSproto(strcpy(buf, "GetZoneName"), XS_Expedition_GetZoneName, file, "$"); - newXSproto(strcpy(buf, "GetZoneVersion"), XS_Expedition_GetZoneVersion, file, "$"); - newXSproto(strcpy(buf, "HasLockout"), XS_Expedition_HasLockout, file, "$$"); - newXSproto(strcpy(buf, "HasReplayLockout"), XS_Expedition_HasReplayLockout, file, "$"); - newXSproto(strcpy(buf, "IsLocked"), XS_Expedition_IsLocked, file, "$"); - newXSproto(strcpy(buf, "RemoveCompass"), XS_Expedition_RemoveCompass, file, "$"); - newXSproto(strcpy(buf, "RemoveLockout"), XS_Expedition_RemoveLockout, file, "$$"); - newXSproto(strcpy(buf, "SetCompass"), XS_Expedition_SetCompass, file, "$$$$$"); - newXSproto(strcpy(buf, "SetLocked"), XS_Expedition_SetLocked, file, "$$;$$"); - newXSproto(strcpy(buf, "SetLootEventByNPCTypeID"), XS_Expedition_SetLootEventByNPCTypeID, file, "$$$"); - newXSproto(strcpy(buf, "SetLootEventBySpawnID"), XS_Expedition_SetLootEventBySpawnID, file, "$$$"); - newXSproto(strcpy(buf, "SetReplayLockoutOnMemberJoin"), XS_Expedition_SetReplayLockoutOnMemberJoin, file, "$$"); - newXSproto(strcpy(buf, "SetSafeReturn"), XS_Expedition_SetSafeReturn, file, "$$$$$$"); - newXSproto(strcpy(buf, "SetSecondsRemaining"), XS_Expedition_SetSecondsRemaining, file, "$$"); - newXSproto(strcpy(buf, "SetZoneInLocation"), XS_Expedition_SetZoneInLocation, file, "$$$$$"); - newXSproto(strcpy(buf, "UpdateLockoutDuration"), XS_Expedition_UpdateLockoutDuration, file, "$$$;$"); +void Perl_Expedition_UpdateLockoutDuration(Expedition* self, std::string event_name, uint32_t seconds, bool members_only) +{ + self->UpdateLockoutDuration(event_name, seconds, members_only); +} - HV* stash = gv_stashpvs("ExpeditionLockMessage", GV_ADD); - newCONSTSUB(stash, "None", newSViv(static_cast(ExpeditionLockMessage::None))); - newCONSTSUB(stash, "Close", newSViv(static_cast(ExpeditionLockMessage::Close))); - newCONSTSUB(stash, "Begin", newSViv(static_cast(ExpeditionLockMessage::Begin))); +void perl_register_expedition() +{ + perl::interpreter perl(PERL_GET_THX); - XSRETURN_YES; + auto package = perl.new_class("Expedition"); + package.add("AddLockout", &Perl_Expedition_AddLockout); + package.add("AddLockoutDuration", (void(*)(Expedition*, std::string, int))&Perl_Expedition_AddLockoutDuration); + package.add("AddLockoutDuration", (void(*)(Expedition*, std::string, int, bool))&Perl_Expedition_AddLockoutDuration); + package.add("AddReplayLockout", &Perl_Expedition_AddReplayLockout); + package.add("AddReplayLockoutDuration", (void(*)(Expedition*, int))&Perl_Expedition_AddReplayLockoutDuration); + package.add("AddReplayLockoutDuration", (void(*)(Expedition*, int, bool))&Perl_Expedition_AddReplayLockoutDuration); + package.add("GetDynamicZoneID", &Perl_Expedition_GetDynamicZoneID); + package.add("GetID", &Perl_Expedition_GetID); + package.add("GetInstanceID", &Perl_Expedition_GetInstanceID); + package.add("GetLeaderName", &Perl_Expedition_GetLeaderName); + package.add("GetLockouts", &Perl_Expedition_GetLockouts); + package.add("GetLootEventByNPCTypeID", &Perl_Expedition_GetLootEventByNPCTypeID); + package.add("GetLootEventBySpawnID", &Perl_Expedition_GetLootEventBySpawnID); + package.add("GetMemberCount", &Perl_Expedition_GetMemberCount); + package.add("GetMembers", &Perl_Expedition_GetMembers); + package.add("GetName", &Perl_Expedition_GetName); + package.add("GetSecondsRemaining", &Perl_Expedition_GetSecondsRemaining); + package.add("GetUUID", &Perl_Expedition_GetUUID); + package.add("GetZoneID", &Perl_Expedition_GetZoneID); + package.add("GetZoneName", &Perl_Expedition_GetZoneName); + package.add("GetZoneVersion", &Perl_Expedition_GetZoneVersion); + package.add("HasLockout", &Perl_Expedition_HasLockout); + package.add("HasReplayLockout", &Perl_Expedition_HasReplayLockout); + package.add("IsLocked", &Perl_Expedition_IsLocked); + package.add("RemoveCompass", &Perl_Expedition_RemoveCompass); + package.add("RemoveLockout", &Perl_Expedition_RemoveLockout); + package.add("SetCompass", &Perl_Expedition_SetCompass); + package.add("SetLocked", (void(*)(Expedition*, bool))&Perl_Expedition_SetLocked); + package.add("SetLocked", (void(*)(Expedition*, bool, int))&Perl_Expedition_SetLocked); + package.add("SetLocked", (void(*)(Expedition*, bool, int, uint32_t))&Perl_Expedition_SetLocked); + package.add("SetLootEventByNPCTypeID", &Perl_Expedition_SetLootEventByNPCTypeID); + package.add("SetLootEventBySpawnID", &Perl_Expedition_SetLootEventBySpawnID); + package.add("SetReplayLockoutOnMemberJoin", &Perl_Expedition_SetReplayLockoutOnMemberJoin); + package.add("SetSafeReturn", &Perl_Expedition_SetSafeReturn); + package.add("SetSecondsRemaining", &Perl_Expedition_SetSecondsRemaining); + package.add("SetZoneInLocation", &Perl_Expedition_SetZoneInLocation); + package.add("UpdateLockoutDuration", (void(*)(Expedition*, std::string, uint32_t))&Perl_Expedition_UpdateLockoutDuration); + package.add("UpdateLockoutDuration", (void(*)(Expedition*, std::string, uint32_t, bool))&Perl_Expedition_UpdateLockoutDuration); +} + +void perl_register_expedition_lock_messages() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_package("ExpeditionLockMessage"); + package.add_const("None", static_cast(ExpeditionLockMessage::None)); + package.add_const("Close", static_cast(ExpeditionLockMessage::Close)); + package.add_const("Begin", static_cast(ExpeditionLockMessage::Begin)); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_groups.cpp b/zone/perl_groups.cpp index c4b837aa7..0c7d66d22 100644 --- a/zone/perl_groups.cpp +++ b/zone/perl_groups.cpp @@ -4,475 +4,149 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "groups.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif +void Perl_Group_DisbandGroup(Group* self) // @categories Script Utility, Group +{ + self->DisbandGroup(); +} -#define VALIDATE_THIS_IS_GROUP \ - do { \ - if (sv_derived_from(ST(0), "Group")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Group*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Group"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); +bool Perl_Group_IsGroupMember(Group* self, Mob* client) // @categories Account and Character, Script Utility, Group +{ + return self->IsGroupMember(client); +} -XS(XS_Group_DisbandGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_DisbandGroup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::DisbandGroup(THIS)"); // @categories Script Utility, Group +void Perl_Group_CastGroupSpell(Group* self, Mob* caster, uint16 spell_id) // @categories Account and Character, Script Utility, Group +{ + self->CastGroupSpell(caster, spell_id); +} + +void Perl_Group_SplitExp(Group* self, uint32_t exp, Mob* other) // @categories Account and Character, Script Utility, Group +{ + self->SplitExp(exp, other); +} + +void Perl_Group_GroupMessage(Group* self, Mob* sender, const char* message) // @categories Script Utility, Group +{ + // if no language is specificed, send it in common + self->GroupMessage(sender, 0, 100, message); +} + +void Perl_Group_GroupMessage(Group* self, Mob* sender, uint8_t language, const char* message) // @categories Script Utility, Group +{ + if ((language >= MAX_PP_LANGUAGE) || (language < 0)) { - Group *THIS; - VALIDATE_THIS_IS_GROUP; - THIS->DisbandGroup(); + language = 0; } - XSRETURN_EMPTY; + self->GroupMessage(sender, language, 100, message); } -XS(XS_Group_IsGroupMember); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_IsGroupMember) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::IsGroupMember(THIS, client)"); // @categories Account and Character, Script Utility, Group +uint32_t Perl_Group_GetTotalGroupDamage(Group* self, Mob* other) // @categories Script Utility, Group +{ + return self->GetTotalGroupDamage(other); +} + +void Perl_Group_SplitMoney(Group* self, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) // @categories Currency and Points, Script Utility, Group +{ + self->SplitMoney(copper, silver, gold, platinum); +} + +void Perl_Group_SetLeader(Group* self, Mob* new_leader) // @categories Account and Character, Script Utility, Group +{ + self->SetLeader(new_leader); +} + +Mob* Perl_Group_GetLeader(Group* self) // @categories Account and Character, Script Utility, Group +{ + return self->GetLeader(); +} + +std::string Perl_Group_GetLeaderName(Group* self) // @categories Account and Character, Script Utility, Group +{ + return self->GetLeaderName(); +} + +void Perl_Group_SendHPPacketsTo(Group* self, Mob* new_member) // @categories Script Utility, Group +{ + self->SendHPManaEndPacketsTo(new_member); +} + +void Perl_Group_SendHPPacketsFrom(Group* self, Mob* new_member) // @categories Script Utility, Group +{ + self->SendHPPacketsFrom(new_member); +} + +bool Perl_Group_IsLeader(Group* self, Mob* leadertest) // @categories Account and Character, Script Utility, Group +{ + return self->IsLeader(leadertest); +} + +int Perl_Group_GroupCount(Group* self) // @categories Script Utility, Group +{ + return self->GroupCount(); +} + +uint32_t Perl_Group_GetHighestLevel(Group* self) // @categories Script Utility, Group +{ + return self->GetHighestLevel(); +} + +void Perl_Group_TeleportGroup(Group* self, Mob* sender, uint32 zone_id, float x, float y, float z, float heading) // @categories Script Utility, Group +{ + self->TeleportGroup(sender, zone_id, 0, x, y, z, heading); +} + +uint32_t Perl_Group_GetID(Group* self) // @categories Script Utility, Group +{ + return self->GetID(); +} + +Client* Perl_Group_GetMember(Group* self, int group_index) // @categories Account and Character, Script Utility, Group +{ + Mob* member = nullptr; + if (group_index >= 0 && group_index < 6) { - Group *THIS; - bool RETVAL; - Mob *client; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Mob"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - RETVAL = THIS->IsGroupMember(client); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); + member = self->members[group_index]; } - XSRETURN(1); + return member ? member->CastToClient() : nullptr; } -XS(XS_Group_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_CastGroupSpell) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Group::CastGroupSpell(THIS, Mob* caster, uint16 spell_id)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - Mob *caster; - uint16 spellid = (uint16) SvUV(ST(2)); - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - THIS->CastGroupSpell(caster, spellid); - } - XSRETURN_EMPTY; +bool Perl_Group_DoesAnyMemberHaveExpeditionLockout(Group* self, std::string expedition_name, std::string event_name) +{ + return self->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name); } -XS(XS_Group_SplitExp); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_SplitExp) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Group::SplitExp(THIS, uint32 exp, Mob* other)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - uint32 exp = (uint32) SvUV(ST(1)); - Mob *other; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->SplitExp(exp, other); - } - XSRETURN_EMPTY; +bool Perl_Group_DoesAnyMemberHaveExpeditionLockout(Group* self, std::string expedition_name, std::string event_name, int max_check_count) +{ + return self->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name, max_check_count); } -XS(XS_Group_GroupMessage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GroupMessage) { - dXSARGS; - if ((items != 3) && (items != 4)) // the 3 item version is kept for backwards compatability - Perl_croak(aTHX_ "Usage: Group::GroupMessage(THIS, Mob* sender, uint8 language, string message)"); // @categories Script Utility, Group - { - Group *THIS; - Mob *sender; - uint8 language; - char *message; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); +void perl_register_group() +{ + perl::interpreter perl(PERL_GET_THX); - if (items == 4) { - language = (uint8) SvUV(ST(2)); - if ((language >= MAX_PP_LANGUAGE) || (language < 0)) - language = 0; - message = (char *) SvPV_nolen(ST(3)); - THIS->GroupMessage(sender, language, 100, message); - } else { // if no language is specificed, send it in common - message = (char *) SvPV_nolen(ST(2)); - THIS->GroupMessage(sender, 0, 100, message); - } - } - XSRETURN_EMPTY; -} - -XS(XS_Group_GetTotalGroupDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GetTotalGroupDamage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::GetTotalGroupDamage(THIS, Mob* other)"); // @categories Script Utility, Group - { - Group *THIS; - uint32 RETVAL; - dXSTARG; - Mob *other; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - RETVAL = THIS->GetTotalGroupDamage(other); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_SplitMoney); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_SplitMoney) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: Group::SplitMoney(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)"); // @categories Currency and Points, Script Utility, Group - { - Group *THIS; - uint32 copper = (uint32) SvUV(ST(1)); - uint32 silver = (uint32) SvUV(ST(2)); - uint32 gold = (uint32) SvUV(ST(3)); - uint32 platinum = (uint32) SvUV(ST(4)); - VALIDATE_THIS_IS_GROUP; - THIS->SplitMoney(copper, silver, gold, platinum); - } - XSRETURN_EMPTY; -} - -XS(XS_Group_SetLeader); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_SetLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::SetLeader(THIS, Mob* new_leader)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - Mob *newleader; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - newleader = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "newleader is not of type Mob"); - if (newleader == nullptr) - Perl_croak(aTHX_ "newleader is nullptr, avoiding crash."); - - THIS->SetLeader(newleader); - } - XSRETURN_EMPTY; -} - -XS(XS_Group_GetLeader); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GetLeader) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::GetLeader(THIS)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_GROUP; - RETVAL = THIS->GetLeader(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_GetLeaderName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GetLeaderName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::GetLeaderName(THIS)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - const char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_GROUP; - RETVAL = THIS->GetLeaderName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Group_SendHPPacketsTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_SendHPPacketsTo) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::SendHPPacketsTo(THIS, Mob* new_member)"); // @categories Script Utility, Group - { - Group *THIS; - Mob *newmember; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - newmember = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "newmember is not of type Mob"); - if (newmember == nullptr) - Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); - - THIS->SendHPManaEndPacketsTo(newmember); - } - XSRETURN_EMPTY; -} - -XS(XS_Group_SendHPPacketsFrom); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_SendHPPacketsFrom) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::SendHPPacketsFrom(THIS, Mob* new_member)"); // @categories Script Utility, Group - { - Group *THIS; - Mob *newmember; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - newmember = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "newmember is not of type Mob"); - if (newmember == nullptr) - Perl_croak(aTHX_ "newmember is nullptr, avoiding crash."); - - THIS->SendHPPacketsFrom(newmember); - } - XSRETURN_EMPTY; -} - -XS(XS_Group_IsLeader); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_IsLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::IsLeader(THIS, Mob* target)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - bool RETVAL; - Mob *leadertest; - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - leadertest = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "leadertest is not of type Mob"); - if (leadertest == nullptr) - Perl_croak(aTHX_ "leadertest is nullptr, avoiding crash."); - - RETVAL = THIS->IsLeader(leadertest); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Group_GroupCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GroupCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::GroupCount(THIS)"); // @categories Script Utility, Group - { - Group *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_GROUP; - RETVAL = THIS->GroupCount(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GetHighestLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::GetHighestLevel(THIS)"); // @categories Script Utility, Group - { - Group *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_GROUP; - RETVAL = THIS->GetHighestLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_TeleportGroup) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)"); // @categories Script Utility, Group - { - Group *THIS; - Mob *sender; - uint32 zoneID = (uint32) SvUV(ST(2)); - float x = (float) SvNV(ST(3)); - float y = (float) SvNV(ST(4)); - float z = (float) SvNV(ST(5)); - float heading = (float) SvNV(ST(6)); - VALIDATE_THIS_IS_GROUP; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); - - THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading); - } - XSRETURN_EMPTY; -} - -XS(XS_Group_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Group_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Group::GetID(THIS)"); // @categories Script Utility, Group - { - Group *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_GROUP; - RETVAL = THIS->GetID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_GetMember); -XS(XS_Group_GetMember) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Group::GetMember(THIS, int group_index)"); // @categories Account and Character, Script Utility, Group - { - Group *THIS; - Mob *member; - Client *RETVAL = nullptr; - dXSTARG; - VALIDATE_THIS_IS_GROUP; - int index = (int) SvUV(ST(1)); - if (index < 0 || index > 5) - RETVAL = nullptr; - else { - member = THIS->members[index]; - if (member != nullptr) - RETVAL = member->CastToClient(); - } - - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Group_DoesAnyMemberHaveExpeditionLockout); -XS(XS_Group_DoesAnyMemberHaveExpeditionLockout) { - dXSARGS; - if (items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Group::DoesAnyMemberHaveExpeditionLockout(THIS, string expedition_name, string event_name, [int max_check_count = 0])"); - } - - Group* THIS = nullptr; - VALIDATE_THIS_IS_GROUP; - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - int max_check_count = (items == 4) ? static_cast(SvIV(ST(3))) : 0; - - bool result = THIS->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name, max_check_count); - ST(0) = boolSV(result); - XSRETURN(1); -} - -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Group); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Group) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "CastGroupSpell"), XS_Group_CastGroupSpell, file, "$$$"); - newXSproto(strcpy(buf, "DisbandGroup"), XS_Group_DisbandGroup, file, "$"); - newXSproto(strcpy(buf, "DoesAnyMemberHaveExpeditionLockout"), XS_Group_DoesAnyMemberHaveExpeditionLockout, file, "$$$;$"); - newXSproto(strcpy(buf, "GetHighestLevel"), XS_Group_GetHighestLevel, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Group_GetID, file, "$"); - newXSproto(strcpy(buf, "GetLeader"), XS_Group_GetLeader, file, "$"); - newXSproto(strcpy(buf, "GetLeaderName"), XS_Group_GetLeaderName, file, "$"); - newXSproto(strcpy(buf, "GetMember"), XS_Group_GetMember, file, "$$"); - newXSproto(strcpy(buf, "GetTotalGroupDamage"), XS_Group_GetTotalGroupDamage, file, "$$"); - newXSproto(strcpy(buf, "GroupCount"), XS_Group_GroupCount, file, "$"); - newXSproto(strcpy(buf, "GroupMessage"), XS_Group_GroupMessage, file, "$$$"); - newXSproto(strcpy(buf, "IsGroupMember"), XS_Group_IsGroupMember, file, "$$"); - newXSproto(strcpy(buf, "IsLeader"), XS_Group_IsLeader, file, "$$"); - newXSproto(strcpy(buf, "SendHPPacketsFrom"), XS_Group_SendHPPacketsFrom, file, "$$"); - newXSproto(strcpy(buf, "SendHPPacketsTo"), XS_Group_SendHPPacketsTo, file, "$$"); - newXSproto(strcpy(buf, "SetLeader"), XS_Group_SetLeader, file, "$$"); - newXSproto(strcpy(buf, "SplitExp"), XS_Group_SplitExp, file, "$$$"); - newXSproto(strcpy(buf, "SplitMoney"), XS_Group_SplitMoney, file, "$$$$$"); - newXSproto(strcpy(buf, "TeleportGroup"), XS_Group_TeleportGroup, file, "$$$$$$$"); - XSRETURN_YES; + auto package = perl.new_class("Group"); + package.add("CastGroupSpell", &Perl_Group_CastGroupSpell); + package.add("DisbandGroup", &Perl_Group_DisbandGroup); + package.add("DoesAnyMemberHaveExpeditionLockout", (bool(*)(Group*, std::string, std::string))&Perl_Group_DoesAnyMemberHaveExpeditionLockout); + package.add("DoesAnyMemberHaveExpeditionLockout", (bool(*)(Group*, std::string, std::string, int))&Perl_Group_DoesAnyMemberHaveExpeditionLockout); + package.add("GetHighestLevel", &Perl_Group_GetHighestLevel); + package.add("GetID", &Perl_Group_GetID); + package.add("GetLeader", &Perl_Group_GetLeader); + package.add("GetLeaderName", &Perl_Group_GetLeaderName); + package.add("GetMember", &Perl_Group_GetMember); + package.add("GetTotalGroupDamage", &Perl_Group_GetTotalGroupDamage); + package.add("GroupCount", &Perl_Group_GroupCount); + package.add("GroupMessage", (void(*)(Group*, Mob*, const char*))&Perl_Group_GroupMessage); + package.add("GroupMessage", (void(*)(Group*, Mob*, uint8_t, const char*))&Perl_Group_GroupMessage); + package.add("IsGroupMember", &Perl_Group_IsGroupMember); + package.add("IsLeader", &Perl_Group_IsLeader); + package.add("SendHPPacketsFrom", &Perl_Group_SendHPPacketsFrom); + package.add("SendHPPacketsTo", &Perl_Group_SendHPPacketsTo); + package.add("SetLeader", &Perl_Group_SetLeader); + package.add("SplitExp", &Perl_Group_SplitExp); + package.add("SplitMoney", &Perl_Group_SplitMoney); + package.add("TeleportGroup", &Perl_Group_TeleportGroup); } #endif //EMBPERL_XS_CLASSES - diff --git a/zone/perl_hateentry.cpp b/zone/perl_hateentry.cpp index 388c9313a..8b8ec0ff8 100644 --- a/zone/perl_hateentry.cpp +++ b/zone/perl_hateentry.cpp @@ -4,104 +4,33 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" -#include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "../common/linked_list.h" +#include "embperl.h" #include "hate_list.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_HATE \ - do { \ - if (sv_derived_from(ST(0), "HateEntry")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(struct_HateList*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type HateEntry"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_HateEntry_GetEnt); /* prototype to pass -Wmissing-prototypes */ -XS(XS_HateEntry_GetEnt) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: HateEntry::GetEnt(THIS)"); // @categories Script Utility, Hate and Aggro - { - struct_HateList *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_HATE; - RETVAL = THIS->entity_on_hatelist; - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); +Mob* Perl_HateEntry_GetEnt(struct_HateList* self) // @categories Script Utility, Hate and Aggro +{ + return self->entity_on_hatelist; } -XS(XS_HateEntry_GetHate); /* prototype to pass -Wmissing-prototypes */ -XS(XS_HateEntry_GetHate) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)"); // @categories Script Utility, Hate and Aggro - { - struct_HateList *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_HATE; - RETVAL = THIS->stored_hate_amount; - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int64_t Perl_HateEntry_GetHate(struct_HateList* self) // @categories Script Utility, Hate and Aggro +{ + return self->stored_hate_amount; } -XS(XS_HateEntry_GetDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_HateEntry_GetDamage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)"); // @categories Script Utility, Hate and Aggro - { - struct_HateList *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_HATE; - RETVAL = THIS->hatelist_damage; - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int64_t Perl_HateEntry_GetDamage(struct_HateList* self) // @categories Script Utility, Hate and Aggro +{ + return self->hatelist_damage; } -#ifdef __cplusplus -extern "C" -#endif +void perl_register_hateentry() +{ + perl::interpreter perl(PERL_GET_THX); -XS(boot_HateEntry); -XS(boot_HateEntry) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "GetDamage"), XS_HateEntry_GetDamage, file, "$"); - newXSproto(strcpy(buf, "GetEnt"), XS_HateEntry_GetEnt, file, "$"); - newXSproto(strcpy(buf, "GetHate"), XS_HateEntry_GetHate, file, "$"); - XSRETURN_YES; + auto package = perl.new_class("HateEntry"); + package.add("GetDamage", &Perl_HateEntry_GetDamage); + package.add("GetEnt", &Perl_HateEntry_GetEnt); + package.add("GetHate", &Perl_HateEntry_GetHate); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_inventory.cpp b/zone/perl_inventory.cpp index 44323229b..b7127c5e3 100644 --- a/zone/perl_inventory.cpp +++ b/zone/perl_inventory.cpp @@ -4,525 +4,204 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" +#include "../common/inventory_profile.h" #include "embperl.h" -#ifdef seed -#undef seed -#endif - -#include "../common/inventory_profile.h" - -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_INVENTORY \ - do { \ - if (sv_derived_from(ST(0), "Inventory")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(EQ::InventoryProfile*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type EQ::InventoryProfile"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Inventory_CanItemFitInContainer); -XS(XS_Inventory_CanItemFitInContainer) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Inventory::CanItemFitInContainer(THIS, ItemInstance item_to_check, ItemInstance container_to_check)"); - { - EQ::InventoryProfile* THIS; - bool can_fit = false; - EQ::ItemInstance* item_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1))); - EQ::ItemInstance* container_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(2))); - const EQ::ItemData* item_data = item_to_check->GetItem(); - const EQ::ItemData* container_data = container_to_check->GetItem(); - VALIDATE_THIS_IS_INVENTORY; - can_fit = THIS->CanItemFitInContainer(item_data, container_data); - ST(0) = boolSV(can_fit); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Inventory_CanItemFitInContainer(EQ::InventoryProfile* self, EQ::ItemInstance* item_to_check, EQ::ItemInstance* container_to_check) +{ + const EQ::ItemData* item_data = item_to_check->GetItem(); + const EQ::ItemData* container_data = container_to_check->GetItem(); + return self->CanItemFitInContainer(item_data, container_data); } -XS(XS_Inventory_CheckNoDrop); -XS(XS_Inventory_CheckNoDrop) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::CheckNoDrop(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - bool no_drop = false; - int16 slot_id = (int16)SvIV(ST(1)); - VALIDATE_THIS_IS_INVENTORY; - no_drop = THIS->CheckNoDrop(slot_id); - ST(0) = boolSV(no_drop); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Inventory_CheckNoDrop(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->CheckNoDrop(slot_id); } -XS(XS_Inventory_DeleteItem); -XS(XS_Inventory_DeleteItem) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Inventory::DeleteItem(THIS, int16 slot_id, [uint8 quantity = 0])"); - { - EQ::InventoryProfile* THIS; - bool item_deleted = false; - int16 slot_id = (int16)SvIV(ST(1)); - uint8 quantity = 0; - VALIDATE_THIS_IS_INVENTORY; - if (items > 2) - quantity = (uint8)SvUV(ST(2)); - - item_deleted = THIS->DeleteItem(slot_id, quantity); - ST(0) = boolSV(item_deleted); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Inventory_DeleteItem(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->DeleteItem(slot_id); } -XS(XS_Inventory_FindFreeSlot); -XS(XS_Inventory_FindFreeSlot) { - dXSARGS; - if (items < 3 || items > 5) - Perl_croak(aTHX_ "Usage: Inventory::FindFreeSlot(THIS, bool is_for_bag, bool try_cursor, [uint8 min_size = 0, bool is_arrow = false])"); - { - EQ::InventoryProfile* THIS; - int16 free_slot; - bool is_for_bag = (bool)SvNV(ST(1)); - bool try_cursor = (bool)SvNV(ST(2)); - uint8 min_size = 0; - bool is_arrow = false; - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (items > 3) - min_size = (uint8)SvUV(ST(3)); - if (items > 4) - is_arrow = (bool)SvNV(ST(4)); - - free_slot = THIS->FindFreeSlot(is_for_bag, try_cursor, min_size, is_arrow); - XSprePUSH; - PUSHi((IV)free_slot); - } - XSRETURN(1); +bool Perl_Inventory_DeleteItem(EQ::InventoryProfile* self, int16_t slot_id, uint8_t quantity) +{ + return self->DeleteItem(slot_id, quantity); } -XS(XS_Inventory_GetBagIndex); -XS(XS_Inventory_GetBagIndex) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::GetBagIndex(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - uint8 bag_index; - int16 slot_id = (int16)SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - bag_index = THIS->CalcBagIdx(slot_id); - XSprePUSH; - PUSHu((UV) bag_index); - } - XSRETURN(1); +int Perl_Inventory_FindFreeSlot(EQ::InventoryProfile* self, bool is_for_bag, bool try_cursor) +{ + return self->FindFreeSlot(is_for_bag, try_cursor); } -XS(XS_Inventory_GetItem); -XS(XS_Inventory_GetItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::GetItem(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - EQ::ItemInstance* item; - int16 slot_id = (int16)SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - item = THIS->GetItem(slot_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void*)item); - } - XSRETURN(1); +int Perl_Inventory_FindFreeSlot(EQ::InventoryProfile* self, bool is_for_bag, bool try_cursor, uint8_t min_size) +{ + return self->FindFreeSlot(is_for_bag, try_cursor, min_size); } -XS(XS_Inventory_GetMaterialFromSlot); -XS(XS_Inventory_GetMaterialFromSlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::GetMaterialFromSlot(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - uint8 material; - int16 slot_id = (int16)SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - material = THIS->CalcMaterialFromSlot(slot_id); - XSprePUSH; - PUSHu((UV) material); - } - XSRETURN(1); +int Perl_Inventory_FindFreeSlot(EQ::InventoryProfile* self, bool is_for_bag, bool try_cursor, uint8_t min_size, bool is_arrow) +{ + return self->FindFreeSlot(is_for_bag, try_cursor, min_size, is_arrow); } -XS(XS_Inventory_GetSlotByItemInst); -XS(XS_Inventory_GetSlotByItemInst) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::GetSlotByItemInst(THIS, ItemInstance item)"); - { - EQ::InventoryProfile* THIS; - int slot_id; - EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1))); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - slot_id = THIS->GetSlotByItemInst(item); - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_GetBagIndex(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->CalcBagIdx(slot_id); } -XS(XS_Inventory_GetSlotFromMaterial); -XS(XS_Inventory_GetSlotFromMaterial) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::GetSlotFromMaterial(THIS, uint8 material)"); - { - EQ::InventoryProfile* THIS; - int16 slot_id; - uint8 material = (uint8)SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - slot_id = THIS->CalcSlotFromMaterial(material); - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +EQ::ItemInstance* Perl_Inventory_GetItem(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->GetItem(slot_id); } -XS(XS_Inventory_GetSlotID); -XS(XS_Inventory_GetSlotID) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Inventory::GetSlotID(THIS, int16 slot_id, [uint8 bag_index])"); - { - EQ::InventoryProfile* THIS; - int16 slot_id = (int16)SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (items == 2) - slot_id = THIS->CalcSlotId(slot_id); - - if (items == 3) { - uint8 bag_index = (uint8)SvUV(ST(2)); - slot_id = THIS->CalcSlotId(slot_id, bag_index); - } - - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_GetMaterialFromSlot(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->CalcMaterialFromSlot(slot_id); } -XS(XS_Inventory_HasItem); -XS(XS_Inventory_HasItem) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Inventory::HasItem(THIS, uint32 item_id, [uint8 quantity, uint8 where])"); - { - EQ::InventoryProfile* THIS; - int16 slot_id; - uint32 item_id = (uint32)SvUV(ST(1)); - uint8 quantity = 0; - uint8 where_to_look = 0xFF; - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (items > 2) - quantity = (uint8)SvUV(ST(2)); - if (items > 3) - where_to_look = (uint8)SvUV(ST(3)); - - slot_id = THIS->HasItem(item_id, quantity, where_to_look); - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_GetSlotByItemInst(EQ::InventoryProfile* self, EQ::ItemInstance* item) +{ + return self->GetSlotByItemInst(item); } -XS(XS_Inventory_HasItemByLoreGroup); -XS(XS_Inventory_HasItemByLoreGroup) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Inventory::HasItemByLoreGroup(THIS, uint32 loregroup, [uint8 where])"); - { - EQ::InventoryProfile* THIS; - int16 slot_id; - uint32 loregroup = (uint32)SvUV(ST(1)); - uint8 where_to_look = 0xFF; - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (items > 2) - where_to_look = (uint8)SvUV(ST(2)); - - slot_id = THIS->HasItemByLoreGroup(loregroup, where_to_look); - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_GetSlotFromMaterial(EQ::InventoryProfile* self, uint8_t material) +{ + return self->CalcSlotFromMaterial(material); } -XS(XS_Inventory_HasItemByUse); -XS(XS_Inventory_HasItemByUse) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Inventory::HasItemByUse(THIS, uint8 use, uint8 quantity, [uint8 where])"); - { - EQ::InventoryProfile* THIS; - int16 slot_id; - uint8 item_use = (uint8)SvUV(ST(1)); - uint8 quantity = (uint8)SvUV(ST(2)); - uint8 where_to_look = 0xFF; - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (items > 3) - where_to_look = (uint8)SvUV(ST(3)); - - slot_id = THIS->HasItemByUse(item_use, quantity, where_to_look); - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_GetSlotID(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->CalcSlotId(slot_id); } -XS(XS_Inventory_HasSpaceForItem); -XS(XS_Inventory_HasSpaceForItem) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Inventory::HasSpaceForItem(THIS, ItemInstance item_to_check, uint8 quantity)"); - { - EQ::InventoryProfile* THIS; - bool has_space = false; - EQ::ItemInstance* item_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1))); - uint8 quantity = (uint8)SvUV(ST(2)); - const EQ::ItemData* item_data = item_to_check->GetItem(); - VALIDATE_THIS_IS_INVENTORY; - has_space = THIS->HasSpaceForItem(item_data, quantity); - ST(0) = boolSV(has_space); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Inventory_GetSlotID(EQ::InventoryProfile* self, int16_t slot_id, uint8_t bag_index) +{ + return self->CalcSlotId(slot_id, bag_index); } -XS(XS_Inventory_PopItem); -XS(XS_Inventory_PopItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::PopItem(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - EQ::ItemInstance* item; - int16 slot_id = (int16)SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - item = THIS->PopItem(slot_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void*)item); - } - XSRETURN(1); +int Perl_Inventory_HasItem(EQ::InventoryProfile* self, uint32_t item_id) +{ + return self->HasItem(item_id); } -XS(XS_Inventory_SupportsContainers); -XS(XS_Inventory_SupportsContainers) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::SupportsContainers(THIS, int16 slot_id)"); - { - EQ::InventoryProfile* THIS; - bool supports_containers = false; - int16 slot_id = (int16)SvIV(ST(1)); - VALIDATE_THIS_IS_INVENTORY; - supports_containers = THIS->SupportsContainers(slot_id); - ST(0) = boolSV(supports_containers); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Inventory_HasItem(EQ::InventoryProfile* self, uint32_t item_id, uint8_t quantity) +{ + return self->HasItem(item_id, quantity); } -XS(XS_Inventory_SwapItem); -XS(XS_Inventory_SwapItem) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Inventory::SwapItem(THIS, int16 source_slot_id, int16 destination_slot_id)"); - { - EQ::InventoryProfile* THIS; - bool item_swapped = false; - int16 source_slot_id = (int16)SvIV(ST(1)); - int16 destination_slot_id = (int16)SvIV(ST(2)); - EQ::InventoryProfile::SwapItemFailState fail_state = EQ::InventoryProfile::swapInvalid; - VALIDATE_THIS_IS_INVENTORY; - item_swapped = THIS->SwapItem(source_slot_id, destination_slot_id, fail_state); - ST(0) = boolSV(item_swapped); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Inventory_HasItem(EQ::InventoryProfile* self, uint32_t item_id, uint8_t quantity, uint8_t where_to_look) +{ + return self->HasItem(item_id, quantity, where_to_look); } -XS(XS_Inventory_PushCursor); -XS(XS_Inventory_PushCursor) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::PushCursor(THIS, ItemInstance item)"); - { - EQ::InventoryProfile* THIS; - int16 slot_id; - EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1))); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (item) - slot_id = THIS->PushCursor(*item); - else - slot_id = 0; - - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_HasItemByLoreGroup(EQ::InventoryProfile* self, uint32_t loregroup) +{ + return self->HasItemByLoreGroup(loregroup); } -XS(XS_Inventory_PutItem); -XS(XS_Inventory_PutItem) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Inventory::PutItem(THIS, int16 slot_id, ItemInstance item)"); - { - EQ::InventoryProfile* THIS; - int16 slot_id = (int16)SvUV(ST(1)); - EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(2))); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - if (item) - slot_id = THIS->PutItem(slot_id, *item); - else - slot_id = 0; - - XSprePUSH; - PUSHi((IV) slot_id); - } - XSRETURN(1); +int Perl_Inventory_HasItemByLoreGroup(EQ::InventoryProfile* self, uint32_t loregroup, uint8_t where_to_look) +{ + return self->HasItemByLoreGroup(loregroup, where_to_look); } -XS(XS_Inventory_HasAugmentEquippedByID); -XS(XS_Inventory_HasAugmentEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::HasAugmentEquippedByID(THIS, uint32 item_id)"); - { - EQ::InventoryProfile* THIS; - bool has_equipped = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_INVENTORY; - has_equipped = THIS->HasAugmentEquippedByID(item_id); - ST(0) = boolSV(has_equipped); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_Inventory_HasItemByUse(EQ::InventoryProfile* self, uint8_t item_use, uint8_t quantity) +{ + return self->HasItemByUse(item_use, quantity); } -XS(XS_Inventory_CountAugmentEquippedByID); -XS(XS_Inventory_CountAugmentEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::CountAugmentEquippedByID(THIS, uint32 item_id)"); - { - EQ::InventoryProfile* THIS; - int quantity = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - quantity = THIS->CountAugmentEquippedByID(item_id); - XSprePUSH; - PUSHi((IV) quantity); - } - XSRETURN(1); +int Perl_Inventory_HasItemByUse(EQ::InventoryProfile* self, uint8_t item_use, uint8_t quantity, uint8_t where_to_look) +{ + return self->HasItemByUse(item_use, quantity, where_to_look); } -XS(XS_Inventory_HasItemEquippedByID); -XS(XS_Inventory_HasItemEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::HasItemEquippedByID(THIS, uint32 item_id)"); - { - EQ::InventoryProfile* THIS; - bool has_equipped = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_INVENTORY; - has_equipped = THIS->HasItemEquippedByID(item_id); - ST(0) = boolSV(has_equipped); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Inventory_HasSpaceForItem(EQ::InventoryProfile* self, EQ::ItemInstance* item_to_check, uint8_t quantity) +{ + const EQ::ItemData* item_data = item_to_check->GetItem(); + return self->HasSpaceForItem(item_data, quantity); } -XS(XS_Inventory_CountItemEquippedByID); -XS(XS_Inventory_CountItemEquippedByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Inventory::CountItemEquippedByID(THIS, uint32 item_id)"); - { - EQ::InventoryProfile* THIS; - int quantity = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_INVENTORY; - quantity = THIS->CountItemEquippedByID(item_id); - XSprePUSH; - PUSHi((IV) quantity); - } - XSRETURN(1); +EQ::ItemInstance* Perl_Inventory_PopItem(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->PopItem(slot_id); } -#ifdef __cplusplus -extern "C" -#endif +bool Perl_Inventory_SupportsContainers(EQ::InventoryProfile* self, int16_t slot_id) +{ + return self->SupportsContainers(slot_id); +} -XS(boot_Inventory); -XS(boot_Inventory) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); +bool Perl_Inventory_SwapItem(EQ::InventoryProfile* self, int16_t source_slot_id, int16_t destination_slot_id) +{ + EQ::InventoryProfile::SwapItemFailState fail_state = EQ::InventoryProfile::swapInvalid; + return self->SwapItem(source_slot_id, destination_slot_id, fail_state); +} - char buf[128]; - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "CanItemFitInContainer"), XS_Inventory_CanItemFitInContainer, file, "$$$"); - newXSproto(strcpy(buf, "CountAugmentEquippedByID"), XS_Inventory_CountAugmentEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "CountItemEquippedByID"), XS_Inventory_CountItemEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "CheckNoDrop"), XS_Inventory_CheckNoDrop, file, "$$"); - newXSproto(strcpy(buf, "DeleteItem"), XS_Inventory_DeleteItem, file, "$$;$"); - newXSproto(strcpy(buf, "FindFreeSlot"), XS_Inventory_FindFreeSlot, file, "$$$;$$"); - newXSproto(strcpy(buf, "GetBagIndex"), XS_Inventory_GetBagIndex, file, "$$"); - newXSproto(strcpy(buf, "GetItem"), XS_Inventory_GetItem, file, "$$;$"); - newXSproto(strcpy(buf, "GetMaterialFromSlot"), XS_Inventory_GetMaterialFromSlot, file, "$$"); - newXSproto(strcpy(buf, "GetSlotByItemInst"), XS_Inventory_GetSlotByItemInst, file, "$$"); - newXSproto(strcpy(buf, "GetSlotFromMaterial"), XS_Inventory_GetSlotFromMaterial, file, "$$"); - newXSproto(strcpy(buf, "GetSlotID"), XS_Inventory_GetSlotID, file, "$$;$"); - newXSproto(strcpy(buf, "HasAugmentEquippedByID"), XS_Inventory_HasAugmentEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "HasItem"), XS_Inventory_HasItem, file, "$$;$$"); - newXSproto(strcpy(buf, "HasItemByLoreGroup"), XS_Inventory_HasItemByLoreGroup, file, "$$;$"); - newXSproto(strcpy(buf, "HasItemByUse"), XS_Inventory_HasItemByUse, file, "$$;$$"); - newXSproto(strcpy(buf, "HasItemEquippedByID"), XS_Inventory_HasItemEquippedByID, file, "$$"); - newXSproto(strcpy(buf, "HasSpaceForItem"), XS_Inventory_HasSpaceForItem, file, "$$$"); - newXSproto(strcpy(buf, "PopItem"), XS_Inventory_PopItem, file, "$$"); - newXSproto(strcpy(buf, "PushCursor"), XS_Inventory_PushCursor, file, "$$"); - newXSproto(strcpy(buf, "PutItem"), XS_Inventory_PutItem, file, "$$$"); - newXSproto(strcpy(buf, "SupportsContainers"), XS_Inventory_SupportsContainers, file, "$$"); - newXSproto(strcpy(buf, "SwapItem"), XS_Inventory_SwapItem, file, "$$$"); - XSRETURN_YES; +int Perl_Inventory_PushCursor(EQ::InventoryProfile* self, EQ::ItemInstance* item) +{ + return self->PushCursor(*item); +} + +int Perl_Inventory_PutItem(EQ::InventoryProfile* self, int16_t slot_id, EQ::ItemInstance* item) +{ + return self->PutItem(slot_id, *item); +} + +bool Perl_Inventory_HasAugmentEquippedByID(EQ::InventoryProfile* self, uint32_t item_id) +{ + return self->HasAugmentEquippedByID(item_id); +} + +int Perl_Inventory_CountAugmentEquippedByID(EQ::InventoryProfile* self, uint32_t item_id) +{ + return self->CountAugmentEquippedByID(item_id); +} + +bool Perl_Inventory_HasItemEquippedByID(EQ::InventoryProfile* self, uint32_t item_id) +{ + return self->HasItemEquippedByID(item_id); +} + +int Perl_Inventory_CountItemEquippedByID(EQ::InventoryProfile* self, uint32_t item_id) +{ + return self->CountItemEquippedByID(item_id); +} + +void perl_register_inventory() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("Inventory"); + package.add("CanItemFitInContainer", &Perl_Inventory_CanItemFitInContainer); + package.add("CountAugmentEquippedByID", &Perl_Inventory_CountAugmentEquippedByID); + package.add("CountItemEquippedByID", &Perl_Inventory_CountItemEquippedByID); + package.add("CheckNoDrop", &Perl_Inventory_CheckNoDrop); + package.add("DeleteItem", (bool(*)(EQ::InventoryProfile*, int16_t))&Perl_Inventory_DeleteItem); + package.add("DeleteItem", (bool(*)(EQ::InventoryProfile*, int16_t, uint8_t))&Perl_Inventory_DeleteItem); + package.add("FindFreeSlot", (int(*)(EQ::InventoryProfile*, bool, bool))&Perl_Inventory_FindFreeSlot); + package.add("FindFreeSlot", (int(*)(EQ::InventoryProfile*, bool, bool, uint8_t))&Perl_Inventory_FindFreeSlot); + package.add("FindFreeSlot", (int(*)(EQ::InventoryProfile*, bool, bool, uint8_t, bool))&Perl_Inventory_FindFreeSlot); + package.add("GetBagIndex", &Perl_Inventory_GetBagIndex); + package.add("GetItem", &Perl_Inventory_GetItem); + package.add("GetMaterialFromSlot", &Perl_Inventory_GetMaterialFromSlot); + package.add("GetSlotByItemInst", &Perl_Inventory_GetSlotByItemInst); + package.add("GetSlotFromMaterial", &Perl_Inventory_GetSlotFromMaterial); + package.add("GetSlotID", (int(*)(EQ::InventoryProfile*, int16_t))&Perl_Inventory_GetSlotID); + package.add("GetSlotID", (int(*)(EQ::InventoryProfile*, int16_t, uint8_t))&Perl_Inventory_GetSlotID); + package.add("HasAugmentEquippedByID", &Perl_Inventory_HasAugmentEquippedByID); + package.add("HasItem", (int(*)(EQ::InventoryProfile*, uint32_t))&Perl_Inventory_HasItem); + package.add("HasItem", (int(*)(EQ::InventoryProfile*, uint32_t, uint8_t))&Perl_Inventory_HasItem); + package.add("HasItem", (int(*)(EQ::InventoryProfile*, uint32_t, uint8_t, uint8_t))&Perl_Inventory_HasItem); + package.add("HasItemByLoreGroup", (int(*)(EQ::InventoryProfile*, uint32_t))&Perl_Inventory_HasItemByLoreGroup); + package.add("HasItemByLoreGroup", (int(*)(EQ::InventoryProfile*, uint32_t, uint8_t))&Perl_Inventory_HasItemByLoreGroup); + package.add("HasItemByUse", (int(*)(EQ::InventoryProfile*, uint8_t, uint8_t))&Perl_Inventory_HasItemByUse); + package.add("HasItemByUse", (int(*)(EQ::InventoryProfile*, uint8_t, uint8_t, uint8_t))&Perl_Inventory_HasItemByUse); + package.add("HasItemEquippedByID", &Perl_Inventory_HasItemEquippedByID); + package.add("HasSpaceForItem", &Perl_Inventory_HasSpaceForItem); + package.add("PopItem", &Perl_Inventory_PopItem); + package.add("PushCursor", &Perl_Inventory_PushCursor); + package.add("PutItem", &Perl_Inventory_PutItem); + package.add("SupportsContainers", &Perl_Inventory_SupportsContainers); + package.add("SwapItem", &Perl_Inventory_SwapItem); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index f7557a14d..923d05d82 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -3,7057 +3,2946 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" +#include "../common/spdat.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - -typedef const char Const_char; - #include "mob.h" #include "client.h" -#include "../common/spdat.h" #include "dialogue_window.h" - #ifdef BOTS #include "bot.h" #endif -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_MOB \ - do { \ - if (sv_derived_from(ST(0), "Mob")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Mob*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Mob"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Mob_IsClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsClient) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsClient(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsClient(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsNPC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsNPC(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsNPC(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsBot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsBot) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsBot(THIS)"); // @categories Script Utility - { - Mob* THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsBot(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsMob) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsMob(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsMob(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsCorpse); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsCorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsCorpse(THIS)"); // @categories Script Utility, Corpse - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsCorpse(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsPlayerCorpse); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsPlayerCorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsPlayerCorpse(THIS)"); // @categories Corpse - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsPlayerCorpse(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsNPCCorpse); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsNPCCorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsNPCCorpse(THIS)"); // @categories Corpse - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsNPCCorpse(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsObject); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsObject) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsObject(THIS)"); // @categories Objects - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsObject(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsDoor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsDoor) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsDoor(THIS)"); // @categories Script Utility, Doors - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsDoor(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsTrap); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsTrap) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsTrap(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsTrap(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsBeacon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsBeacon) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsBeacon(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsBeacon(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CastToClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastToClient) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastToClient(THIS)"); // @categories Account and Character, Script Utility - { - Mob *THIS; - Client *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastToClient(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CastToNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastToNPC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastToNPC(THIS)"); // @categories Script Utility - { - Mob *THIS; - NPC *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastToNPC(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CastToMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastToMob) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastToMob(THIS)"); // @categories Script Utility - { - Mob *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastToMob(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CastToCorpse); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastToCorpse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastToCorpse(THIS)"); // @categories Script Utility, Corpse - { - Mob *THIS; - Corpse *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastToCorpse(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Corpse", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetID(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetName(THIS)"); // @categories Script Utility - { - Mob *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_Depop); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Depop) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Mob::Depop(THIS, StartSpawnTimer = true)"); // @categories Spawns - { - Mob *THIS; - bool StartSpawnTimer; - VALIDATE_THIS_IS_MOB; - if (items < 2) - StartSpawnTimer = true; - else { - StartSpawnTimer = (bool) SvTRUE(ST(1)); - } - - THIS->Depop(StartSpawnTimer); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RogueAssassinate); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RogueAssassinate) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::RogueAssassinate(THIS, other)"); // @categories Script Utility - { - Mob *THIS; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->RogueAssassinate(other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_BehindMob); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BehindMob) { - dXSARGS; - if (items < 1 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::BehindMob(THIS, Mob* other = 0, [float x = 0.0f], [float y= 0.0f])"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - Mob *other; - float playerx; - float playery; - VALIDATE_THIS_IS_MOB; - if (items < 2) - other = 0; - else { - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - } - - if (items < 3) - playerx = 0.0f; - else { - playerx = (float) SvNV(ST(2)); - } - - if (items < 4) - playery = 0.0f; - else { - playery = (float) SvNV(ST(3)); - } - - RETVAL = THIS->BehindMob(other, playerx, playery); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetLevel) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::SetLevel(THIS, uint8 in_level, [bool command = false])"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 in_level = (uint8) SvUV(ST(1)); - bool command; - VALIDATE_THIS_IS_MOB; - if (items < 3) - command = false; - else { - command = (bool) SvTRUE(ST(2)); - } - - THIS->SetLevel(in_level, command); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetSkill(THIS, int skill_id)"); // @categories Skills and Recipes, Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - EQ::skills::SkillType skill_num = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSkill(skill_num); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SendWearChange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendWearChange) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SendWearChange(THIS, uint8 material_slot)"); // @categories Script Utility - { - Mob *THIS; - uint8 material_slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SendWearChange(material_slot); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetEquipment); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEquipment) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetEquipment(THIS, uint8 material_slot)"); // @categories Inventory and Items - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint8 material_slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEquippedItemFromTextureSlot(material_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetEquipmentMaterial); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEquipmentMaterial) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetEquipmentMaterial(THIS, uint8 material_slot)"); // @categories Inventory and Items - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint8 material_slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEquipmentMaterial(material_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetEquipmentColor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEquipmentColor) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetEquipmentColor(THIS, uint8 material_slot)"); // @categories Inventory and Items - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint8 material_slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEquipmentColor(material_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetArmorTint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetArmorTint) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetArmorTint(THIS, uint8 material_slot)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint8 material_slot = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetArmorTint(material_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsMoving); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsMoving) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsMoving(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsMoving(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GoToBind); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GoToBind) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GoToBind(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->GoToBind(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Gate); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Gate) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Gate(THIS)"); // @categories Spells and Disciplines - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->Gate(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Attack); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Attack) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::Attack(THIS, Mob* other, [int hand = 13 [prim|sec]], [bool from_riposte = false])"); // @categories Script Utility, Hate and Aggro - { - Mob *THIS; - bool RETVAL; - Mob *other; - int Hand; - bool FromRiposte; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - if (items < 3) - Hand = 13; - else { - Hand = (int) SvIV(ST(2)); - } - - if (items < 4) - FromRiposte = false; - else { - FromRiposte = (bool) SvTRUE(ST(3)); - } - - RETVAL = THIS->Attack(other, Hand, FromRiposte); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_Damage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Damage) { - dXSARGS; - if (items < 5 || items > 8) - Perl_croak(aTHX_ "Usage: Mob::Damage(THIS, Mob* from, int64 damage, uint16 spell_id, int attack_skill, [bool avoidable = true], [int8 buffslot = -1], [bool buff_tic = false])"); // @categories Script Utility - { - Mob *THIS; - Mob *from; - int32 damage = (int32) SvIV(ST(2)); - uint16 spell_id = (uint16) SvUV(ST(3)); - EQ::skills::SkillType attack_skill = (EQ::skills::SkillType) SvUV(ST(4)); - bool avoidable; - int8 buffslot; - bool iBuffTic; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - from = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "from is not of type Mob"); - if (from == nullptr) - Perl_croak(aTHX_ "from is nullptr, avoiding crash."); - - if (items < 6) - avoidable = true; - else { - avoidable = (bool) SvTRUE(ST(5)); - } - - if (items < 7) - buffslot = -1; - else { - buffslot = (int8) SvIV(ST(6)); - } - - if (items < 8) - iBuffTic = false; - else { - iBuffTic = (bool) SvTRUE(ST(7)); - } - - THIS->Damage(from, damage, spell_id, attack_skill, avoidable, buffslot, iBuffTic); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RangedAttack); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RangedAttack) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::RangedAttack(THIS, Mob* other)"); // @categories Skills and Recipes, Script Utility - { - Mob *THIS; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->RangedAttack(other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ThrowingAttack); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ThrowingAttack) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::ThrowingAttack(THIS, Mob* other)"); // @categories Skills and Recipes, Script Utility - { - Mob *THIS; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->ThrowingAttack(other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Heal); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Heal) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Heal(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->Heal(); - } - XSRETURN_EMPTY; -} - - -XS(XS_Mob_HealDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_HealDamage) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::HealDamage(THIS, int64 amount, [Mob* caster = 0])"); // @categories Script Utility - { - Mob *THIS; - int64 heal_amt = (int64) SvIV(ST(1)); - Mob *caster = nullptr; - VALIDATE_THIS_IS_MOB; - if (items == 3) { - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - } - - THIS->HealDamage(heal_amt, caster); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetMaxHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetMaxHP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::SetMaxHP(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->SetMaxHP(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetLevelCon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetLevelCon) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetLevelCon(THIS, uint8 other_level)"); // @categories Stats and Attributes - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint8 iOtherLevel = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetLevelCon(iOtherLevel); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetHP) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetHP(THIS, int64 hp)"); // @categories Stats and Attributes - { - Mob *THIS; - int64 hp = (int64) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetHP(hp); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DoAnim); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoAnim) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::DoAnim(THIS, int animation_number, [int type = 0])"); // @categories Script Utility - { - Mob *THIS; - int animnum = (int) SvIV(ST(1)); - int type; - VALIDATE_THIS_IS_MOB; - if (items < 3) - type = 0; - else { - type = (int) SvIV(ST(2)); - } - - THIS->DoAnim(animnum, type); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ChangeSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ChangeSize) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::ChangeSize(THIS, float in_size, [bool no_restriction = false])"); // @categories Script Utility - { - Mob *THIS; - float in_size = (float) SvNV(ST(1)); - bool bNoRestriction; - VALIDATE_THIS_IS_MOB; - if (items < 3) - bNoRestriction = false; - else { - bNoRestriction = (bool) SvTRUE(ST(2)); - } - - THIS->ChangeSize(in_size, bNoRestriction); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RandomizeFeatures); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RandomizeFeatures) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::RandomizeFeatures(THIS, bool send_illusion, set_variables)"); // @categories Script Utility - { - Mob *THIS; - bool send_illusion = (bool) SvNV(ST(1)); - bool set_variables = (bool) SvNV(ST(2)); - VALIDATE_THIS_IS_MOB; - THIS->RandomizeFeatures(send_illusion, set_variables); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GMMove); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GMMove) { - dXSARGS; - if (items < 4 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::GMMove(THIS, float x, float y, float z, [float heading = 0.01])"); // @categories Script Utility - { - Mob *THIS; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - float heading; - VALIDATE_THIS_IS_MOB; - if (items < 5) - heading = 0.01; - else { - heading = (float) SvNV(ST(4)); - } - - THIS->GMMove(x, y, z, heading); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_HasProcs); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_HasProcs) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasProcs(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasProcs(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsInvisible); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsInvisible) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Mob::IsInvisible(THIS, [Mob* other = 0])"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (items < 2) - other = 0; - else { - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - } - - RETVAL = THIS->IsInvisible(other); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetInvisible); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetInvisible) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetInvisible(THIS, uint8 state)"); // @categories Script Utility - { - Mob *THIS; - uint8 state = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetInvisible(state); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetSeeInvisibleLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetSeeInvisibleLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetSeeInvisibleLevel(THIS, uint8 see_invis_level)"); // @categories Script Utility - { - Mob *THIS; - uint8 see_invis_level = (uint8)SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetInnateSeeInvisible(see_invis_level); - THIS->CalcSeeInvisibleLevel(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetSeeInvisibleUndeadLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetSeeInvisibleUndeadLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetSeeInvisibleUndeadLevel(THIS, uint8 see_invis_undead_level)"); // @categories Script Utility - { - Mob *THIS; - uint8 see_invis_undead_level = (uint8)SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetSeeInvisibleUndead(see_invis_undead_level); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_FindBuff); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_FindBuff) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::FindBuff(THIS, uint16 spell_id)"); // @categories Spells and Disciplines, Script Utility - { - Mob *THIS; - bool RETVAL; - uint16 spellid = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->FindBuff(spellid); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_FindBuffBySlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_FindBuffBySlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::FindBuffBySlot(THIS, int slot)"); // @categories Spells and Disciplines, Script Utility - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - int slot = SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->FindBuffBySlot(slot); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_BuffCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BuffCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::BuffCount(THIS)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->BuffCount(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_FindType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_FindType) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::FindType(THIS, uint8 type, [bool offensive = false], [uint16 threshold = 100])"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - uint8 type = (uint8) SvUV(ST(1)); - bool bOffensive; - uint16 threshold; - VALIDATE_THIS_IS_MOB; - if (items < 3) - bOffensive = false; - else { - bOffensive = (bool) SvTRUE(ST(2)); - } - - if (items < 4) - threshold = 100; - else { - threshold = (uint16) SvUV(ST(3)); - } - - RETVAL = THIS->FindType(type, bOffensive, threshold); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBuffSlotFromType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBuffSlotFromType) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetBuffSlotFromType(THIS, uint16 type)"); // @categories Spells and Disciplines, Script Utility - { - Mob *THIS; - int8 RETVAL; - dXSTARG; - uint16 type = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBuffSlotFromType(type); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_MakePet); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_MakePet) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::MakePet(THIS, uint16 spell_id, string pet_type, [string name = nullptr])"); // @categories Pet - { - Mob *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - char *pettype = (char *) SvPV_nolen(ST(2)); - char *name; - VALIDATE_THIS_IS_MOB; - if (items < 4) - name = nullptr; - else { - name = (char *) SvPV_nolen(ST(3)); - } - - THIS->MakePet(spell_id, pettype, name); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_MakeTempPet); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_MakeTempPet) { - dXSARGS; - if (items < 2 || items > 6) - Perl_croak(aTHX_ "Usage: Mob::MakeTempPet(THIS, uint16 spell_id, [string name = nullptr], [uint32 duration = 0], [Mob* target = nullptr], [bool sticktarg = 0])"); // @categories Pet - { - Mob *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - char *name; - uint32 duration; - Mob *target; - bool sticktarg; - VALIDATE_THIS_IS_MOB; - if (items < 3) - name = nullptr; - else - name = (char *) SvPV_nolen(ST(2)); - - if (items < 4) - duration = 0; - else - duration = (uint32) SvUV(ST(3)); - - if (items < 5) - target = nullptr; - else if (sv_derived_from(ST(4), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(4))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "owner is not of type Mob"); - - if (items < 6) - sticktarg = false; - else { - sticktarg = (bool) SvTRUE(ST(5)); - } - - THIS->TemporaryPets(spell_id, target, name, duration, true, sticktarg); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_TypesTempPet); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_TypesTempPet) { - dXSARGS; - if (items < 2 || items > 7) - Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, uint32 type_id, [string name = nullptr], [uint32 duration = 0], [bool follow = 0], [Mob* target = nullptr], [bool stick_targ = 0])"); // @categories Pet - { - Mob *THIS; - uint32 typesid = (uint32) SvUV(ST(1)); - char *name; - uint32 duration; - bool follow; - Mob *target; - bool sticktarg; - VALIDATE_THIS_IS_MOB; - if (items < 3) - name = nullptr; - else - name = (char *) SvPV_nolen(ST(2)); - - if (items < 4) - duration = 0; - else - duration = (uint32) SvUV(ST(3)); - - if (items < 5) - follow = true; - else { - follow = (bool) SvTRUE(ST(4)); - } - - if (items < 6) - target = nullptr; - else if (sv_derived_from(ST(5), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(5))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - - - if (items < 7) - sticktarg = false; - else { - sticktarg = (bool) SvTRUE(ST(6)); - } - - THIS->TypesTemporaryPets(typesid, target, name, duration, follow, sticktarg); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetBaseRace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBaseRace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBaseRace(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBaseRace(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBaseGender); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBaseGender) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBaseGender(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBaseGender(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDeity); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDeity) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDeity(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDeity(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetRace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetRace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetRace(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetRace(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetGender); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetGender) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetGender(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetGender(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetTexture); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetTexture) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetTexture(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetTexture(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHelmTexture); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHelmTexture) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHelmTexture(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHelmTexture(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHairColor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHairColor) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHairColor(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHairColor(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBeardColor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBeardColor) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBeardColor(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBeardColor(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetEyeColor1); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEyeColor1) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetEyeColor1(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEyeColor1(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetEyeColor2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEyeColor2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetEyeColor2(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEyeColor2(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHairStyle); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHairStyle) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHairStyle(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHairStyle(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetLuclinFace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetLuclinFace) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetLuclinFace(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetLuclinFace(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBeard); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBeard) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBeard(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBeard(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDrakkinHeritage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDrakkinHeritage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDrakkinHeritage(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDrakkinHeritage(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDrakkinTattoo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDrakkinTattoo) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDrakkinTattoo(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDrakkinTattoo(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDrakkinDetails); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDrakkinDetails) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDrakkinDetails(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDrakkinDetails(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetClass); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetClass) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetClass(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetClass(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetLevel(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetCleanName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetCleanName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetCleanName(THIS)"); // @categories Script Utility - { - Mob *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCleanName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_GetTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetTarget) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetTarget(THIS)"); // @categories Script Utility - { - Mob *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetTarget(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetTarget) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetTarget(THIS, mob)"); // @categories Script Utility - { - Mob *THIS; - Mob *mob; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - THIS->SetTarget(mob); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetHPRatio); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHPRatio) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHPRatio(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHPRatio(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsWarriorClass); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsWarriorClass) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsWarriorClass(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsWarriorClass(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHP(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHP(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxHP) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxHP(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxHP(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetItemHPBonuses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetItemHPBonuses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetItemHPBonuses(THIS)"); // @categories Inventory and Items, Stats and Attributes - { - Mob *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetItemHPBonuses(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpellHPBonuses); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpellHPBonuses) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetSpellHPBonuses(THIS)"); // @categories Spells and Disciplines - { - Mob *THIS; - int64 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSpellHPBonuses(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpellIDFromSlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpellIDFromSlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetSpellIDFromSlot(THIS, slot)"); // @categories Spells and Disciplines - { - Mob *THIS; - int RETVAL; - dXSTARG; - uint8 slot = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - if (slot > THIS->GetMaxBuffSlots()) - RETVAL = -1; - else - RETVAL = THIS->GetSpellIDFromSlot(slot); - - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWalkspeed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWalkspeed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWalkspeed(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetWalkspeed(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetRunspeed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetRunspeed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetRunspeed(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetRunspeed(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetCasterLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetCasterLevel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetCasterLevel(THIS, spell_id)"); // @categories Stats and Attributes - { - Mob *THIS; - int RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCasterLevel(spell_id); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxMana); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxMana) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxMana(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxMana(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMana); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMana) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMana(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMana(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetMana); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetMana) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetMana(THIS, amount)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 amount = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetMana(amount); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetManaRatio); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetManaRatio) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetManaRatio(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetManaRatio(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAC(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAC(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDisplayAC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDisplayAC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDisplayAC(THIS)"); - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDisplayAC(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetATK); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetATK) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetATK(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetATK(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSTR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSTR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetSTR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSTR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSTA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSTA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetSTA(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSTA(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDEX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDEX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDEX(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDEX(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAGI); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAGI) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAGI(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAGI(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetINT); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetINT) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetINT(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetINT(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWIS); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWIS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWIS(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetWIS(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetCHA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetCHA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetCHA(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCHA(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetFR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetFR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetFR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetFR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetDR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetDR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetPR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetPR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetPR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetPR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetCR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetCR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetCR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetCorruption); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetCorruption) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetCorruption(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCorrup(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetPhR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetPhR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetPhR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetPhR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxSTR); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxSTR) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxSTR(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxSTR(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxSTA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxSTA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxSTA(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxSTA(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxDEX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxDEX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxDEX(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxDEX(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxAGI); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxAGI) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxAGI(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxAGI(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxINT); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxINT) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxINT(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxINT(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxWIS); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxWIS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxWIS(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxWIS(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMaxCHA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetMaxCHA) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMaxCHA(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMaxCHA(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellRange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellRange) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellRange(THIS, uint16 spell_id, float range)"); // @categories Spells and Disciplines - { - Mob *THIS; - float RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - float range = (float) SvNV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellRange(spell_id, range); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellDamage) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellDamage(THIS, uint16 spell_id, int64 value)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - int64 value = (int64) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellDamage(spell_id, value); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellHealing); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellHealing) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellHealing(THIS, uint16 spell_id, int64 value)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - int64 value = (int64) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellHealing(spell_id, value); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellCost); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellCost) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellCost(THIS, uint16 spell_id, int32 cost)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - int32 cost = (int32) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellCost(spell_id, cost); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellDuration); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellDuration) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellDuration(THIS, uint16 spell_id, int32 duration)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - int32 duration = (int32) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellDuration(spell_id, duration); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetActSpellCasttime); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetActSpellCasttime) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetActSpellCasttime(THIS, uint16 spell_id, uint32 cast_time)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - int32 casttime = (int32) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetActSpellCasttime(spell_id, casttime); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_ResistSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ResistSpell) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::ResistSpell(THIS, uint8 resist_type, uint16 spell_id, [Mob* caster = nullptr])"); // @categories Spells and Disciplines, Script Utility - { - Mob *THIS; - double RETVAL; - dXSTARG; - uint8 ressit_type = (uint8) SvUV(ST(1)); - uint16 spell_id = (uint16) SvUV(ST(2)); - Mob *caster; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(3), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(3))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - RETVAL = THIS->ResistSpell(ressit_type, spell_id, caster); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpecializeSkillValue); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpecializeSkillValue) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetSpecializeSkillValue(THIS, uint16 spell_id)"); // @categories Skills and Recipes, Spells and Disciplines - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSpecializeSkillValue(spell_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetNPCTypeID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetNPCTypeID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetNPCTypeID(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetNPCTypeID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsTargeted); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsTargeted) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsTargeted(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsTargeted(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetX(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetX(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetY(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetY(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetZ(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetZ(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHeading) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHeading(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHeading(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - - -XS(XS_Mob_GetWaypointX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointX(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCurrentWayPoint().x; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWaypointY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointY(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCurrentWayPoint().y; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWaypointZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointZ(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCurrentWayPoint().z; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWaypointH); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointH) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointH(THIS)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCurrentWayPoint().w; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWaypointPause); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointPause) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointPause(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCWPP(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetWaypointID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetWaypointID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetWaypointID(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetCWP(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetCurrentWP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetCurrentWP) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetCurrentWP(THIS, waypoint)"); // @categories Script Utility - { - Mob *THIS; - uint16 waypoint = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetCurrentWP(waypoint); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetSize(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSize(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetFollowID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetFollowID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetFollowID(THIS, id)"); // @categories Script Utility - { - Mob *THIS; - uint32 id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetFollowID(id); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetFollowID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetFollowID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetFollowID(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetFollowID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_Message); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Message) { - dXSARGS; - if (items < 3) - Perl_croak(aTHX_ "Usage: Mob::Message(THIS, uint32 emote_color_type, string message)"); // @categories Script Utility - { - Mob *THIS; - uint32 type = (uint32) SvUV(ST(1)); - char *message = (char *) SvPV_nolen(ST(2)); - VALIDATE_THIS_IS_MOB; - - if (RuleB(Chat, QuestDialogueUsesDialogueWindow) && THIS->IsClient()) { - std::string window_markdown = message; - DialogueWindow::Render(THIS->CastToClient(), window_markdown); - } - else if (RuleB(Chat, AutoInjectSaylinksToClientMessage)) { - std::string new_message = EQ::SayLinkEngine::InjectSaylinksIfNotExist(message); - THIS->Message(type, new_message.c_str()); - } - else { - THIS->Message(type, message); - } - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Message_StringID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Message_StringID) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::Message_StringID(THIS, uint32 emote_color_type, uint32 string_id, [uint32 distance = 0])"); // @categories Script Utility - { - Mob *THIS; - uint32 type = (uint32) SvUV(ST(1)); - uint32 string_id = (uint32) SvUV(ST(2)); - uint32 distance; - VALIDATE_THIS_IS_MOB; - if (items < 4) - distance = 0; - else { - distance = (uint32) SvUV(ST(3)); - } - - THIS->MessageString(type, string_id, distance); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Say); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Say) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: Mob::Say(THIS, string message)"); // @categories Script Utility - { - Mob *THIS; - char *format = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->Say(format); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Shout); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Shout) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: Mob::Shout(THIS, string message)"); // @categories Script Utility - { - Mob *THIS; - char *format = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->Shout(format); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Emote); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Emote) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: Mob::Emote(THIS, string message)"); // @categories Script Utility - { - Mob *THIS; - char *format = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->Emote(format); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_InterruptSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_InterruptSpell) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Mob::InterruptSpell(THIS, [uint16 spell_id = 0xFFFF])"); // @categories Script Utility - { - Mob *THIS; - uint16 spellid; - VALIDATE_THIS_IS_MOB; - if (items < 2) - spellid = 0xFFFF; - else { - spellid = (uint16) SvUV(ST(1)); - } - - THIS->InterruptSpell(spellid); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CastSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastSpell) { - dXSARGS; - if (items < 3 || items > 7) - Perl_croak(aTHX_ "Usage: Mob::CastSpell(THIS, uint16 spell_id, uint16 target_id, [int slot = 22], [int32 cast_time = -1], [int32 mana_cost = -1], [int16 resist_adjust = 0])"); // @categories Spells and Disciplines - { - Mob *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - uint16 target_id = (uint16) SvUV(ST(2)); - EQ::spells::CastingSlot slot; - int32 casttime; - int32 mana_cost; - int16 resist_adjust; - VALIDATE_THIS_IS_MOB; - if (items < 4) - slot = EQ::spells::CastingSlot::Item; - else { - slot = static_cast(SvUV(ST(3))); - } - - if (items < 5) - casttime = -1; - else { - casttime = (int32) SvIV(ST(4)); - } - - if (items < 6) - mana_cost = -1; - else { - mana_cost = (int32) SvIV(ST(5)); - } - - if (items < 7) { - resist_adjust = 0; - } else { - resist_adjust = (int16) SvIV(ST(6)); - } - - if (resist_adjust == - 0)//If you do not pass resist adjust as nullptr it will ignore the spells default resist adjust - THIS->CastSpell(spell_id, target_id, slot, casttime, mana_cost, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0); - else - THIS->CastSpell(spell_id, target_id, slot, casttime, mana_cost, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, - &resist_adjust); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SpellFinished); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SpellFinished) { - dXSARGS; - if (items < 2 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::SpellFinished(uint16 spell_id, [Mob* spell_target = this], [uint16 mana_cost = 0], [uint16 resist_diff = 0])"); // @categories Spells and Disciplines - { - Mob *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - Mob *spell_target; - uint16 mana_cost = 0; - int16 resist_diff; - VALIDATE_THIS_IS_MOB; - spell_target = THIS; - - if (items > 2) { - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - spell_target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "spell_target is not of type Mob"); - if (spell_target == nullptr) - Perl_croak(aTHX_ "spell_target is nullptr, avoiding crash."); - - } - - if (items > 3) - mana_cost = (uint16) SvUV(ST(3)); - - if (items > 4) { - resist_diff = (int16) SvUV(ST(4)); - } else { - resist_diff = spells[spell_id].resist_difficulty; - } - - THIS->SpellFinished(spell_id, spell_target, EQ::spells::CastingSlot::Item, mana_cost, -1, resist_diff); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsImmuneToSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsImmuneToSpell) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::IsImmuneToSpell(THIS, uint16 spell_id, [Mob* caster = nullptr])"); // @categories Spells and Disciplines, Script Utility - { - Mob *THIS; - bool RETVAL; - uint16 spell_id = (uint16) SvUV(ST(1)); - Mob *caster; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - RETVAL = THIS->IsImmuneToSpell(spell_id, caster); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_BuffFadeBySpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BuffFadeBySpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::BuffFadeBySpellID(THIS, uint16 spell_id)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - uint16 spell_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->BuffFadeBySpellID(spell_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_BuffFadeByEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BuffFadeByEffect) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::BuffFadeByEffect(THIS, int effect_id, int skip_slot = -1)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int effect_id = (int) SvIV(ST(1)); - int skipslot; - VALIDATE_THIS_IS_MOB; - if (items < 3) - skipslot = -1; - else { - skipslot = (int) SvIV(ST(2)); - } - - THIS->BuffFadeByEffect(effect_id, skipslot); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_BuffFadeAll); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BuffFadeAll) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::BuffFadeAll(THIS)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->BuffFadeAll(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_BuffFadeBySlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_BuffFadeBySlot) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::BuffFadeBySlot(THIS, int slot, bool recalc_bonuses = true)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int slot = (int) SvIV(ST(1)); - bool iRecalcBonuses; - VALIDATE_THIS_IS_MOB; - if (items < 3) - iRecalcBonuses = true; - else { - iRecalcBonuses = (bool) SvTRUE(ST(2)); - } - - THIS->BuffFadeBySlot(slot, iRecalcBonuses); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CanBuffStack); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanBuffStack) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::CanBuffStack(THIS, uint16 spell_id, uint8 caster_level, [bool fail_if_overwritten = false])"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int RETVAL; - dXSTARG; - uint16 spellid = (uint16) SvUV(ST(1)); - uint8 caster_level = (uint8) SvUV(ST(2)); - bool iFailIfOverwrite; - VALIDATE_THIS_IS_MOB; - if (items < 4) - iFailIfOverwrite = false; - else { - iFailIfOverwrite = (bool) SvTRUE(ST(3)); - } - - RETVAL = THIS->CanBuffStack(spellid, caster_level, iFailIfOverwrite); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsCasting); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsCasting) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsCasting(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsCasting(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CastingSpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastingSpellID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastingSpellID(THIS)"); // @categories Spells and Disciplines - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastingSpellID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetAppearance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetAppearance) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::SetAppearance(THIS, int appearance [0|1|2|3|4], [ignore_self = true])"); // @categories Stats and Attributes - { - Mob *THIS; - EmuAppearance app = (EmuAppearance) SvUV(ST(1)); - bool iIgnoreSelf; - VALIDATE_THIS_IS_MOB; - if (items < 3) - iIgnoreSelf = true; - else { - iIgnoreSelf = (bool) SvTRUE(ST(2)); - } - - THIS->SetAppearance(app, iIgnoreSelf); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetAppearance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAppearance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAppearance(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - EmuAppearance RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAppearance(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetRunAnimSpeed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetRunAnimSpeed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetRunAnimSpeed(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetRunAnimSpeed(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetRunAnimSpeed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetRunAnimSpeed) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetRunAnimSpeed(THIS, int8 speed)"); // @categories Stats and Attributes - { - Mob *THIS; - int8 in = (int8) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetRunAnimSpeed(in); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetPetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetPetID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetPetID(THIS, uint16 new_pet_id)"); // @categories Pet - { - Mob *THIS; - uint16 NewPetID = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetPetID(NewPetID); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetPetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetPetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetPetID(THIS)"); // @categories Script Utility, Pet - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetPetID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetOwnerID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetOwnerID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetOwnerID(THIS, uint16 new_owner_id)"); // @categories Pet - { - Mob *THIS; - uint16 NewOwnerID = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetOwnerID(NewOwnerID); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetOwnerID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetOwnerID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetOwnerID(THIS)"); // @categories Script Utility, Pet - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetOwnerID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetPetType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetPetType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetPetType(THIS)"); // @categories Script Utility, Pet - { - Mob *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetPetType(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBodyType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBodyType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBodyType(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBodyType(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_Stun); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Stun) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::Stun(THIS, int duration)"); - { - Mob *THIS; - int duration = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->Stun(duration); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Spin); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Spin) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Spin(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->Spin(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_Kill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Kill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Kill(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->Kill(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetInvul); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetInvul) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetInvul(THIS, bool set_invulnerable)"); // @categories Script Utility - { - Mob *THIS; - bool invul = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetInvul(invul); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetInvul); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetInvul) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetInvul(THIS)"); // @categories Script Utility, Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetInvul(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetExtraHaste); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetExtraHaste) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetExtraHaste(THIS, int haste)"); // @categories Script Utility, Stats and Attributes - { - Mob *THIS; - int Haste = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetExtraHaste(Haste); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetHaste); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHaste) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHaste(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHaste(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHandToHandDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHandToHandDamage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHandToHandDamage(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHandToHandDamage(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CanThisClassDoubleAttack); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanThisClassDoubleAttack) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CanThisClassDoubleAttack(THIS)"); // @categories Skills and Recipes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanThisClassDoubleAttack(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CanThisClassDualWield); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanThisClassDualWield) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CanThisClassDualWield(THIS)"); // @categories Skills and Recipes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanThisClassDualWield(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CanThisClassRiposte); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanThisClassRiposte) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CanThisClassRiposte(THIS)"); // @categories Skills and Recipes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanThisClassRiposte(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CanThisClassDodge); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanThisClassDodge) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CanThisClassDodge(THIS)"); // @categories Skills and Recipes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanThisClassDodge(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CanThisClassParry); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanThisClassParry) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CanThisClassParry(THIS)"); // @categories Skills and Recipes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanThisClassParry(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHandToHandDelay); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHandToHandDelay) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHandToHandDelay(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHandToHandDelay(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetClassLevelFactor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetClassLevelFactor) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetClassLevelFactor(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetClassLevelFactor(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_Mesmerize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Mesmerize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Mesmerize(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->Mesmerize(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsMezzed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsMezzed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsMezzed(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsMezzed(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsStunned); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsStunned) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsStunned(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsStunned(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - - -XS(XS_Mob_StartEnrage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_StartEnrage) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::StartEnrage(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->StartEnrage(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsEnraged); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsEnraged) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsEnraged(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsEnraged(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetReverseFactionCon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetReverseFactionCon) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetReverseFactionCon(THIS, iOther)"); // @categories Faction - { - Mob *THIS; - FACTION_VALUE RETVAL; - dXSTARG; - Mob *iOther; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - iOther = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "iOther is not of type Mob"); - if (iOther == nullptr) - Perl_croak(aTHX_ "iOther is nullptr, avoiding crash."); - - RETVAL = THIS->GetReverseFactionCon(iOther); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsAIControlled); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsAIControlled) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsAIControlled(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsAIControlled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAggroRange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAggroRange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAggroRange(THIS)"); // @categories Stats and Attributes, Hate and Aggro - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAggroRange(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAssistRange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAssistRange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAssistRange(THIS)"); // @categories Stats and Attributes, Hate and Aggro - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAssistRange(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetPetOrder); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetPetOrder) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetPetOrder(THIS, i)"); // @categories Pet - { - Mob *THIS; - Mob::eStandingPetOrder i = (Mob::eStandingPetOrder) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetPetOrder(i); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetPetOrder); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetPetOrder) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetPetOrder(THIS)"); // @categories Script Utility, Pet - { - Mob *THIS; - Mob::eStandingPetOrder RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetPetOrder(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsRoamer); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsRoamer) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsRoamer(THIS)"); // @categories Script Utility, Spawns - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsRoamer(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsRooted); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsRooted) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsRooted(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsRooted(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_AddToHateList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_AddToHateList) { - dXSARGS; - if (items < 2 || items > 7) - Perl_croak(aTHX_ "Usage: Mob::AddToHateList(THIS, Mob* other, [int64 hate = 0], [int64 damage = 0], [bool yell_for_help = true], [bool frenzy = false], [bool buff_tic = false])"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *other; - int64 hate; - int64 damage; - bool iYellForHelp; - bool bFrenzy; - bool iBuffTic; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - if (items < 3) - hate = 0; - else { - hate = (int64) SvIV(ST(2)); - } - - if (items < 4) - damage = 0; - else { - damage = (int64) SvIV(ST(3)); - } - - if (items < 5) - iYellForHelp = true; - else { - iYellForHelp = (bool) SvTRUE(ST(4)); - } - - if (items < 6) - bFrenzy = false; - else { - bFrenzy = (bool) SvTRUE(ST(5)); - } - - if (items < 7) - iBuffTic = false; - else { - iBuffTic = (bool) SvTRUE(ST(6)); - } - - THIS->AddToHateList(other, hate, damage, iYellForHelp, bFrenzy, iBuffTic); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetHate); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetHate) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::SetHate(THIS, Mob* other, [int64 hate = 0], [int64 damage = 0])"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *other; - int64 hate; - int64 damage; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - if (items < 3) - hate = 0; - else { - hate = (int64) SvIV(ST(2)); - } - - if (items < 4) - damage = 0; - else { - damage = (int64) SvIV(ST(3)); - } - - THIS->SetHateAmountOnEnt(other, hate, damage); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_HalveAggro); -XS(XS_Mob_HalveAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::HalveAggro(THIS, Mob* other)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->HalveAggro(other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DoubleAggro); -XS(XS_Mob_DoubleAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::DoubleAggro(THIS, Mob* other)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->DoubleAggro(other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetHateAmount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateAmount) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::GetHateAmount(THIS, Mob* mob, [bool is_damage = false])"); // @categories Hate and Aggro - { - Mob *THIS; - int64 RETVAL; - dXSTARG; - Mob *tmob; - bool is_dam; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - tmob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "tmob is not of type Mob"); - if (tmob == nullptr) - Perl_croak(aTHX_ "tmob is nullptr, avoiding crash."); - - if (items < 3) - is_dam = false; - else { - is_dam = (bool) SvTRUE(ST(2)); - } - - RETVAL = THIS->GetHateAmount(tmob, is_dam); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetDamageAmount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetDamageAmount) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetDamageAmount(THIS, Mob* target_mob)"); // @categories Stats and Attributes - { - Mob *THIS; - uint64 RETVAL; - dXSTARG; - Mob *tmob; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - tmob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "tmob is not of type Mob"); - if (tmob == nullptr) - Perl_croak(aTHX_ "tmob is nullptr, avoiding crash."); - - RETVAL = THIS->GetDamageAmount(tmob); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHateTop); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateTop) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateTop(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHateTop(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHateDamageTop); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateDamageTop) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetHateDamageTop(THIS, Mob* other)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *RETVAL; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - RETVAL = THIS->GetHateDamageTop(other); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHateRandom); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateRandom) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateRandom(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHateRandom(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsEngaged); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsEngaged) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsEngaged(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsEngaged(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_HateSummon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_HateSummon) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HateSummon(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HateSummon(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_FaceTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_FaceTarget) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::FaceTarget(THIS, [Mob* target = 0])"); // @categories Script Utility - { - Mob *THIS; - Mob *MobToFace; - VALIDATE_THIS_IS_MOB; - if (items < 2) - MobToFace = 0; - else { - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - MobToFace = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "MobToFace is not of type Mob"); - if (MobToFace == nullptr) - Perl_croak(aTHX_ "MobToFace is nullptr, avoiding crash."); - } - - THIS->FaceTarget(MobToFace); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetHeading) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetHeading(THIS, float heading)"); // @categories Script Utility - { - Mob *THIS; - float iHeading = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetHeading(iHeading); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_WipeHateList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_WipeHateList) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::WipeHateList(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->WipeHateList(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CheckAggro); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CheckAggro) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CheckAggro(THIS, Mob* other)"); // @categories Hate and Aggro - { - Mob *THIS; - bool RETVAL; - Mob *other; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - RETVAL = THIS->CheckAggro(other); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CalculateHeadingToTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CalculateHeadingToTarget) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::CalculateHeadingToTarget(THIS, float x, float y)"); // @categories Script Utility - { - Mob *THIS; - int8 RETVAL; - dXSTARG; - float in_x = (float) SvNV(ST(1)); - float in_y = (float) SvNV(ST(2)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CalculateHeadingToTarget(in_x, in_y); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_RunTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RunTo) { - dXSARGS; - if (items < 4 || items > 5) - Perl_croak(aTHX_ - "Usage: Mob::RunTo(THIS, float x, float y, float z)"); - { - Mob *THIS; - float x = (float)SvNV(ST(1)); - float y = (float)SvNV(ST(2)); - float z = (float)SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->RunTo(x, y, z); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_WalkTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_WalkTo) { - dXSARGS; - if (items < 4 || items > 5) - Perl_croak(aTHX_ - "Usage: Mob::WalkTo(THIS, float x, float y, float z)"); - { - Mob *THIS; - float x = (float)SvNV(ST(1)); - float y = (float)SvNV(ST(2)); - float z = (float)SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->WalkTo(x, y, z); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_NavigateTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_NavigateTo) { - dXSARGS; - if (items < 4 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::NavigateTo(THIS, float x, float y, float z)"); // @categories Script Utility - { - Mob *THIS; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->NavigateTo(x, y, z); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_StopNavigation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_StopNavigation) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ - "Usage: Mob::StopNavigation(THIS)"); - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->StopNavigation(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CalculateDistance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CalculateDistance) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::CalculateDistance(THIS, float x, float y, float z)"); // @categories Script Utility - { - Mob *THIS; - float RETVAL; - dXSTARG; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CalculateDistance(x, y, z); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SendTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendTo) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::SendTo(THIS, float new_x, float new_y, float new_z)"); // @categories Script Utility - { - Mob *THIS; - float new_x = (float) SvNV(ST(1)); - float new_y = (float) SvNV(ST(2)); - float new_z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->SendTo(new_x, new_y, new_z); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SendToFixZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendToFixZ) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::SendToFixZ(THIS, float new_x, float new_y, float new_z)"); // @categories Script Utility - { - Mob *THIS; - float new_x = (float) SvNV(ST(1)); - float new_y = (float) SvNV(ST(2)); - float new_z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->SendToFixZ(new_x, new_y, new_z); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_NPCSpecialAttacks); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_NPCSpecialAttacks) { - dXSARGS; - if (items < 3 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::NPCSpecialAttacks(THIS, string abilities_string, int perm_tag, [bool reset = true], [bool remove = true])"); // @categories Stats and Attributes - { - Mob *THIS; - char *parse = (char *) SvPV_nolen(ST(1)); - int permtag = (int) SvIV(ST(2)); - bool reset = items == 4 ? (bool) SvTRUE(ST(3)) : true; - bool remove = items == 5 ? (bool) SvTRUE(ST(4)) : false; - VALIDATE_THIS_IS_MOB; - THIS->NPCSpecialAttacks(parse, permtag, reset, remove); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DontHealMeBefore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DontHealMeBefore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DontHealMeBefore(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DontHealMeBefore(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_DontBuffMeBefore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DontBuffMeBefore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DontBuffMeBefore(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DontBuffMeBefore(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_DontDotMeBefore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DontDotMeBefore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DontDotMeBefore(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DontDotMeBefore(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_DontRootMeBefore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DontRootMeBefore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DontRootMeBefore(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DontRootMeBefore(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_DontSnareMeBefore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DontSnareMeBefore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DontSnareMeBefore(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DontSnareMeBefore(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetResist); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetResist) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetResist(THIS, type)"); // @categories Stats and Attributes - { - Mob *THIS; - int16 RETVAL; - dXSTARG; - uint8 type = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetResist(type); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_Charmed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_Charmed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::Charmed(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->Charmed(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetLevelHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetLevelHP) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetLevelHP(THIS, uint8 level)"); // @categories Stats and Attributes - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint8 tlevel = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetLevelHP(tlevel); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetZoneID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetZoneID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetZoneID(THIS)"); // @categories Zones - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetZoneID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CheckAggroAmount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CheckAggroAmount) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CheckAggroAmount(THIS, uint16 spell_id)"); // @categories Hate and Aggro - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint16 spellid = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CheckAggroAmount(spellid, nullptr); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_CheckHealAggroAmount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CheckHealAggroAmount) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: Mob::CheckHealAggroAmount(THIS, uint16 spell_id, uint32 possible_heal_amt)"); // @categories Hate and Aggro - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint16 spellid = (uint16) SvUV(ST(1)); - uint32 possible = 0; - VALIDATE_THIS_IS_MOB; - if (items == 3) { - possible = (uint32) SvUV(ST(2)); - } - - RETVAL = THIS->CheckHealAggroAmount(spellid, nullptr, possible); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAA) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetAA(THIS, uint32 rank_id)"); // @categories Alternative Advancement - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint32 rank_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAA(rank_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetAAByAAID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAAByAAID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetAAByAAID(THIS, uint32 aa_id)"); // @categories Alternative Advancement - { - Mob *THIS; - uint32 RETVAL; - dXSTARG; - uint32 aa_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAAByAAID(aa_id); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetAA); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetAA) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::SetAA(THIS, int aa_id, int points, [int charges = 0])"); // @categories Alternative Advancement, Script Utility - { - Mob *THIS; - bool RETVAL; - int aa_id = (int) SvIV(ST(1)); - int points = (int) SvIV(ST(2)); - int charges = (items == 4) ? (int) SvIV(ST(3)) : 0; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->SetAA(aa_id, points, charges); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_DivineAura); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DivineAura) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::DivineAura(THIS)"); // @categories Spells and Disciplines - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->DivineAura(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_AddFeignMemory); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_AddFeignMemory) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::AddFeignMemory(THIS, Client* attacker)"); // @categories Script Utility - { - Mob *THIS; - Client *attacker; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - attacker = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "attacker is not of type Client"); - if (attacker == nullptr) - Perl_croak(aTHX_ "attacker is nullptr, avoiding crash."); - - THIS->AddFeignMemory(attacker); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RemoveFromFeignMemory); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RemoveFromFeignMemory) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::RemoveFromFeignMemory(THIS, Client* attacker)"); // @categories Script Utility, Hate and Aggro - { - Mob *THIS; - Client *attacker; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - attacker = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "attacker is not of type Client"); - if (attacker == nullptr) - Perl_croak(aTHX_ "attacker is nullptr, avoiding crash."); - - THIS->RemoveFromFeignMemory(attacker); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ClearFeignMemory); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ClearFeignMemory) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::ClearFeignMemory(THIS)"); // @categories Script Utility, Hate and Aggro - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->ClearFeignMemory(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetOOCRegen); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetOOCRegen) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetOOCRegen(THIS, int64 new_ooc_regen)"); // @categories Stats and Attributes - { - Mob *THIS; - int64 new_ooc_regen = (int64) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetOOCRegen(new_ooc_regen); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetEntityVariable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetEntityVariable) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetEntityVariable(THIS, string id)"); // @categories Script Utility - { - Mob *THIS; - Const_char *id = SvPV_nolen(ST(1)); - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetEntityVariable(id); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_EntityVariableExists); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_EntityVariableExists) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::EntityVariableExists(THIS, string id)"); - { - Mob *THIS; - Const_char *id = SvPV_nolen(ST(1)); - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->EntityVariableExists(id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetEntityVariable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetEntityVariable) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::SetEntityVariable(THIS, string id, string var)"); // @categories Script Utility - { - Mob *THIS; - Const_char *id = SvPV_nolen(ST(1)); - const char *var = (const char *) SvPV_nolen(ST(2)); - VALIDATE_THIS_IS_MOB; - THIS->SetEntityVariable(id, var); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetHateList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateList) { - dXSARGS; - int num_entries = 0; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateList(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - auto hate_list = THIS->GetHateList(); - auto iter = hate_list.begin(); - - while (iter != hate_list.end()) { - struct_HateList *entry = (*iter); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "HateEntry", (void *) entry); - XPUSHs(ST(0)); - num_entries++; - iter++; - } - } - XSRETURN(num_entries); -} - -XS(XS_Mob_SignalClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SignalClient) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::SignalClient(THIS, Client* client, uint32 data)"); // @categories Script Utility - { - Mob *THIS; - Client *client = nullptr; - uint32 data = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - client->Signal(data); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CombatRange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CombatRange) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CombatRange(THIS, Mob* target)"); // @categories Script Utility - { - Mob *THIS; - Mob *target = nullptr; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - RETVAL = THIS->CombatRange(target); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_DoSpecialAttackDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoSpecialAttackDamage) { - dXSARGS; - if (items < 4 || items > 6) - Perl_croak(aTHX_ "Usage: Mob::DoSpecialAttackDamage(THIS, Mob* target, int skill, int32 max_damage, [int32 min_damage = 1], [int32 hate_override = -11])"); // @categories Script Utility, Skills and Attributes - { - Mob *THIS; - Mob *target; - EQ::skills::SkillType attack_skill = (EQ::skills::SkillType) SvUV(ST(2)); - int32 max_damage = (int32) SvIV(ST(3)); - int32 min_damage = 1; - int32 hate_override = -11; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - if (items > 4) { - min_damage = (int32) SvIV(ST(4)); - } - - if (items == 6) { - hate_override = (int32) SvIV(ST(5)); - } - - THIS->DoSpecialAttackDamage(target, attack_skill, max_damage, min_damage, hate_override); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CheckLoS); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CheckLoS) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CheckLoS(THIS, Mob*)"); // @categories Script Utility - { - Mob *THIS; - Mob *mob; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - RETVAL = THIS->CheckLosFN(mob); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_CheckLoSToLoc); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CheckLoSToLoc) { - dXSARGS; - if (items != 4 && items != 5) - Perl_croak(aTHX_ "Usage: Mob::CheckLoSToLoc(THIS, float x, float y, float z, float mob_size)"); // @categories Script Utility - { - Mob *THIS; - float loc_x = (float) SvNV(ST(1)); - float loc_y = (float) SvNV(ST(2)); - float loc_z = (float) SvNV(ST(3)); - float mob_size; - bool RETVAL; - - if (items == 5) { - mob_size = (float) SvNV(ST(4)); - } else { - mob_size = 6; - } - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CheckLosFN(loc_x, loc_y, loc_z, mob_size); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_FindGroundZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_FindGroundZ) { - dXSARGS; - if (items != 3 && items != 4) - Perl_croak(aTHX_ "Usage: Mob::FindGroundZ(THIS, float x, float y, float z_offset)"); // @categories Script Utility - { - Mob *THIS; - float new_x = (float) SvNV(ST(1)); - float new_y = (float) SvNV(ST(2)); - float z_offset; - float RETVAL; - dXSTARG; - - if (items == 4) { - z_offset = (float) SvNV(ST(3)); - } else { - z_offset = 10; - } - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetGroundZ(new_x, new_y, z_offset); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_ProjectileAnim); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ProjectileAnim) { - dXSARGS; - if (items < 3 || items > 9) - Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, Mob* mob, int item_id, [bool is_arrow = false], [float speed = 0], [float angle = 0], [float tilt = 0], [float arc = 0])"); // @categories Script Utility - - { - Mob *THIS; - Mob *mob; - int item_id = SvUV(ST(2)); - bool IsArrow = false; - float speed = 0; - float angle = 0; - float tilt = 0; - float arc = 0; - char *IDFile = nullptr; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - mob = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "mob is not of type Mob"); - if (mob == nullptr) - Perl_croak(aTHX_ "mob is nullptr, avoiding crash."); - - if (items > 3) { - IsArrow = (bool) SvTRUE(ST(3)); - } - if (items > 4) { - speed = (float) SvNV(ST(4)); - } - if (items > 5) { - angle = (float) SvNV(ST(5)); - } - if (items > 6) { - tilt = (float) SvNV(ST(6)); - } - if (items > 7) { - arc = (float) SvNV(ST(7)); - } - - if (items > 8) { IDFile = (char *) SvPV_nolen(ST(8)); } - - THIS->ProjectileAnimation(mob, item_id, IsArrow, speed, angle, tilt, arc, IDFile); - - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_HasNPCSpecialAtk); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_HasNPCSpecialAtk) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::HasNPCSpecialAtk(THIS, string ability_string)"); // @categories Stats and Attributes - { - Mob *THIS; - char *parse = (char *) SvPV_nolen(ST(1)); - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasNPCSpecialAtk(parse); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SendAppearanceEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendAppearanceEffect) { - dXSARGS; - if (items < 2 || items > 17) - Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffect(THIS, int32 effect1, [int32 effect2 = 0], [int32 effect3 = 0], [int32 effect4 = 0], [int32 effect5 = 0], [Client* single_client_to_send_to = null]), [uint32 slot1 = 1], [uint32 ground1 = 1], [uint32 slot2 = 1], [uint32 ground2 = 1], [uint32 slot3 = 1], [uint32 ground2 = 1], [uint32 slot4 = 1], [uint32 ground4 = 1], [uint32 slot5 = 1], [uint32 ground5 = 1]"); // @categories Script Utility - { - Mob *THIS; - int32 parm1 = (int32) SvIV(ST(1)); - int32 parm2 = 0; - int32 parm3 = 0; - int32 parm4 = 0; - int32 parm5 = 0; - uint32 value1slot = 1; - uint32 value1ground = 1; - uint32 value2slot = 1; - uint32 value2ground = 1; - uint32 value3slot = 1; - uint32 value3ground = 1; - uint32 value4slot = 1; - uint32 value4ground = 1; - uint32 value5slot = 1; - uint32 value5ground = 1; - Client *client = nullptr; - bool nullclient = false; - VALIDATE_THIS_IS_MOB; - if (items > 2) { parm2 = (int32) SvIV(ST(2)); } - if (items > 3) { parm3 = (int32) SvIV(ST(3)); } - if (items > 4) { parm4 = (int32) SvIV(ST(4)); } - if (items > 5) { parm5 = (int32) SvIV(ST(5)); } - if (items > 6) { - if (sv_derived_from(ST(6), "Client")) { - IV tmp = SvIV((SV *)SvRV(ST(6))); - client = INT2PTR(Client *, tmp); - } - else { - nullclient = true; - } - if (client == nullptr) { - nullclient = true; - } - } - if (items > 7) { value1slot = (uint32)SvIV(ST(7)); } - if (items > 8) { value1ground = (uint32)SvIV(ST(8)); } - if (items > 9) { value2slot = (uint32)SvIV(ST(9)); } - if (items > 10) { value2ground = (uint32)SvIV(ST(10)); } - if (items > 11) { value3slot = (uint32)SvIV(ST(11)); } - if (items > 12) { value3ground = (uint32)SvIV(ST(12)); } - if (items > 13) { value4slot = (uint32)SvIV(ST(13)); } - if (items > 14) { value4ground = (uint32)SvIV(ST(14)); } - if (items > 15) { value5slot = (uint32)SvIV(ST(15)); } - if (items > 16) { value5ground = (uint32)SvIV(ST(16)); } - - if (nullclient) { - THIS->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, 0, value1slot, value1ground, value2slot, value2ground, value3slot, value3ground, - value4slot, value4ground, value5slot, value5ground); - } - else { - THIS->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client, value1slot, value1ground, value2slot, value2ground, value3slot, value3ground, - value4slot, value4ground, value5slot, value5ground); - } - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SendAppearanceEffectActor); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendAppearanceEffectActor) { - dXSARGS; - if (items < 3 || items > 12) - Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffectActor(THIS, int32 effect1, uint32 slot1 = 0, [int32 effect2 = 0], [uint32 slot2 = 0], [int32 effect3 = 0], [uint32 slot3 = 0], [int32 effect4 = 0], [uint32 slot4 = 0], [int32 effect5 = 0], [uint32 slot5 = 0], [Client* single_client_to_send_to = null])"); // @categories Script Utility - { - Mob *THIS; - int32 parm1 = (int32)SvIV(ST(1)); - uint32 value1slot = (uint32)SvIV(ST(2)); - int32 parm2 = 0; - uint32 value2slot = 0; - int32 parm3 = 0; - uint32 value3slot = 0; - int32 parm4 = 0; - uint32 value4slot = 0; - int32 parm5 = 0; - uint32 value5slot = 0; - Client *client = nullptr; - VALIDATE_THIS_IS_MOB; - if (items > 3) { parm2 = (int32)SvIV(ST(3)); } - if (items > 4) { value2slot = (uint32)SvIV(ST(4)); } - if (items > 5) { parm3 = (int32)SvIV(ST(5)); } - if (items > 6) { value3slot = (uint32)SvIV(ST(6)); } - if (items > 7) { parm4 = (int32)SvIV(ST(7)); } - if (items > 8) { value4slot = (uint32)SvIV(ST(8)); } - if (items > 9) { parm5 = (int32)SvIV(ST(9)); } - if (items > 10) { value5slot = (uint32)SvIV(ST(10)); } - if (items > 11) { - if (sv_derived_from(ST(11), "Client")) { - IV tmp = SvIV((SV *)SvRV(ST(11))); - client = INT2PTR(Client *, tmp); - } - else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - } - - THIS->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client, value1slot, 0, value2slot, 0, value3slot, 0, - value4slot, 0, value5slot, 0); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SendAppearanceEffectGround); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendAppearanceEffectGround) { - dXSARGS; - if (items < 3 || items > 8) - Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffectGround(THIS, int32 effect1, [int32 effect2 = 0], [int32 effect3 = 0], [int32 effect4 = 0], [int32 effect5 = 0], [Client* single_client_to_send_to = null])"); // @categories Script Utility - { - Mob *THIS; - int32 parm1 = (int32)SvIV(ST(1)); - int32 parm2 = 0; - int32 parm3 = 0; - int32 parm4 = 0; - int32 parm5 = 0; - Client *client = nullptr; - VALIDATE_THIS_IS_MOB; - if (items > 3) { parm2 = (int32)SvIV(ST(2)); } - if (items > 4) { parm3 = (int32)SvIV(ST(3)); } - if (items > 5) { parm4 = (int32)SvIV(ST(4)); } - if (items > 6) { parm5 = (int32)SvIV(ST(5)); } - if (items > 7) { - if (sv_derived_from(ST(6), "Client")) { - IV tmp = SvIV((SV *)SvRV(ST(11))); - client = INT2PTR(Client *, tmp); - } - else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - } - - THIS->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RemoveAllAppearanceEffects); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RemoveAllAppearanceEffects) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::RemoveAllAppearanceEffects(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->SendIllusionPacket(THIS->GetRace(), THIS->GetGender(), THIS->GetTexture(), THIS->GetHelmTexture(), - THIS->GetHairColor(), THIS->GetBeardColor(), THIS->GetEyeColor1(), THIS->GetEyeColor2(), - THIS->GetHairStyle(), THIS->GetLuclinFace(), THIS->GetBeard(), 0xFF, - THIS->GetDrakkinHeritage(), THIS->GetDrakkinTattoo(), THIS->GetDrakkinDetails(), THIS->GetSize(), false); - THIS->ClearAppearenceEffects(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetFlyMode); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetFlyMode) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetFlyMode(THIS, uint8 flymode[0|1|2|3|4|5])"); // @categories Script Utility - { - Mob *THIS; - GravityBehavior flymode = (GravityBehavior) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetFlyMode(flymode); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetTexture); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetTexture) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetTexture(THIS, int32 texture)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 texture = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SendIllusionPacket(THIS->GetRace(), 0xFF, texture); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetRace); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetRace) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetRace(THIS, int32 race)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 race = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SendIllusionPacket(race); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetGender); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetGender) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetGender(THIS, int32 gender)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 gender = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SendIllusionPacket(THIS->GetRace(), gender); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SendIllusion); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SendIllusion) { - dXSARGS; - if (items < 2 || items > 14) - Perl_croak(aTHX_ "Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture face = 0xFF], [uint8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color =FF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])"); // @categories Script Utility - { - Mob *THIS; - uint16 race = (uint16) SvIV(ST(1)); - uint8 gender = 0xFF; - uint8 texture = 0xFF; - uint8 helmtexture = 0xFF; - uint8 face = 0xFF; - uint8 hairstyle = 0xFF; - uint8 haircolor = 0xFF; - uint8 beard = 0xFF; - uint8 beardcolor = 0xFF; - uint32 drakkin_heritage = 0xFFFFFFFF; - uint32 drakkin_tattoo = 0xFFFFFFFF; - uint32 drakkin_details = 0xFFFFFFFF; - float size = -1.0f; - VALIDATE_THIS_IS_MOB; - if (items > 2) { gender = (uint8) SvIV(ST(2)); } - if (items > 3) { texture = (uint8) SvIV(ST(3)); } - if (items > 4) { helmtexture = (uint8) SvIV(ST(4)); } - if (items > 5) { face = (uint8) SvIV(ST(5)); } - if (items > 6) { hairstyle = (uint8) SvIV(ST(6)); } - if (items > 7) { haircolor = (uint8) SvIV(ST(7)); } - if (items > 8) { beard = (uint8) SvIV(ST(8)); } - if (items > 9) { beardcolor = (uint8) SvIV(ST(9)); } - if (items > 10) { drakkin_heritage = (uint32) SvIV(ST(10)); } - if (items > 11) { drakkin_tattoo = (uint32) SvIV(ST(11)); } - if (items > 12) { drakkin_details = (uint32) SvIV(ST(12)); } - if (items > 13) { size = (float) SvNV(ST(13)); } - - THIS->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, - hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details, size); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CameraEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CameraEffect) { - dXSARGS; - if (items < 2 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::CameraEffect(THIS, uint32 duration, [uint32 intensity = 0], [Client* single_client = nullptr], [bool is_world_wide = false])"); // @categories Script Utility - { - Mob *THIS; - uint32 duration = (uint32) SvUV(ST(1)); - uint32 intensity = 0; - Client *client = nullptr; - bool global = false; - bool nullcli = false; - VALIDATE_THIS_IS_MOB; - if (items > 2) { intensity = (uint32) SvUV(ST(2)); } - if (items > 3) { - if (sv_derived_from(ST(3), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(3))); - client = INT2PTR(Client *, tmp); - } else - nullcli = true; - if (client == nullptr) - nullcli = true; - //Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - } - if (items > 4) { global = (bool) SvTRUE(ST(4)); } - - if (nullcli) - THIS->CameraEffect(duration, intensity, 0, global); - else - THIS->CameraEffect(duration, intensity, client, global); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SpellEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SpellEffect) { - dXSARGS; - if (items < 2 || items > 10) - Perl_croak(aTHX_ "Usage: Mob::SpellEffect(THIS, uint32 effect, [uint32 duration = 5000], [uint32 finish_delay = 0], [bool zone_wide = false], [uint32 unk20 = 3000], [bool perm_effect = false], [Client* single_client]), [caster_id = 0], [target_id = 0]"); // @categories Spells and Disciplines - { - Mob *THIS; - uint32 effect = (uint32) SvUV(ST(1)); - uint32 duration = 5000; - uint32 finish_delay = 0; - bool zone_wide = true; - uint32 unk20 = 3000; - bool perm_effect = false; - Client *client = nullptr; - uint32 caster_id = 0; - uint32 target_id = 0; - bool nullclient = false; - VALIDATE_THIS_IS_MOB; - if (items > 2) { duration = (uint32) SvUV(ST(2)); } - if (items > 3) { finish_delay = (uint32) SvUV(ST(3)); } - if (items > 4) { zone_wide = (bool) SvTRUE(ST(4)); } - if (items > 5) { unk20 = (uint32) SvUV(ST(5)); } - if (items > 6) { perm_effect = (bool) SvTRUE(ST(6)); } - if (items > 7) { - if (sv_derived_from(ST(7), "Client")) { - IV tmp = SvIV((SV *)SvRV(ST(7))); - client = INT2PTR(Client *, tmp); - } - else { - nullclient = true; - } - if (client == nullptr) { - nullclient = true; - } - } - if (items > 8) { caster_id = (uint32)SvUV(ST(8)); } - if (items > 9) { target_id = (uint32)SvUV(ST(9)); } - - if (nullclient) { - THIS->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, 0, caster_id, target_id); - } - else { - THIS->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, client, caster_id, target_id); - } - - } - XSRETURN_EMPTY; -} - - -XS(XS_Mob_TempName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_TempName) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Mob::TempName(THIS, string name)"); // @categories Script Utility - { - Mob *THIS; - char *name = nullptr; - VALIDATE_THIS_IS_MOB; - if (items > 1) { name = (char *) SvPV_nolen(ST(1)); } - - THIS->TempName(name); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetItemStat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetItemStat) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetItemStat(THIS, uint32 item_id, string stat)"); // @categories Inventory and Items, Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - uint32 itemid = (uint32) SvUV(ST(1)); - Const_char *stat = (Const_char *) SvPV_nolen(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetItemStat(itemid, stat); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetGlobal); -XS(XS_Mob_GetGlobal) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: GetGlobal(THIS, string var_name)"); - { - Mob *THIS; - Const_char *varname = (Const_char *) SvPV_nolen(ST(1)); - std::string ret_val = "Undefined"; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - if (THIS->GetGlobal(varname) != "Undefined") - ret_val = THIS->GetGlobal(varname); - - RETVAL = ret_val.c_str(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_SetGlobal); -XS(XS_Mob_SetGlobal) { - dXSARGS; - if (items < 5 || items > 6) - Perl_croak(aTHX_ "Usage: SetGlobal(THIS, string var_name, string new_value, int options, string duration, [Mob* other = nullptr])"); - { - Mob *THIS; - char *varname = (char *) SvPV_nolen(ST(1)); - char *newvalue = (char *) SvPV_nolen(ST(2)); - int options = (int) SvIV(ST(3)); - char *duration = (char *) SvPV_nolen(ST(4)); - Mob *other = nullptr; - VALIDATE_THIS_IS_MOB; - if (items > 5) { - if (sv_derived_from(ST(5), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(5))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "THIS is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - } - - THIS->SetGlobal(varname, newvalue, options, duration, other); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_TarGlobal); -XS(XS_Mob_TarGlobal) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: TarGlobal(THIS, string var_name, string value, string duration, int npc_id, int character_id, int zone_id)"); - { - Mob *THIS; - char *varname = (char *) SvPV_nolen(ST(1)); - char *value = (char *) SvPV_nolen(ST(2)); - char *duration = (char *) SvPV_nolen(ST(3)); - int npcid = (int) SvIV(ST(4)); - int charid = (int) SvIV(ST(5)); - int zoneid = (int) SvIV(ST(6)); - VALIDATE_THIS_IS_MOB; - THIS->TarGlobal(varname, value, duration, npcid, charid, zoneid); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DelGlobal); -XS(XS_Mob_DelGlobal) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: DelGlobal(THIS, string var_name)"); - { - Mob *THIS; - char *varname = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->DelGlobal(varname); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetSlotTint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetSlotTint) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: Mob::SetSlotTint(THIS, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 material_slot = (uint8) SvIV(ST(1)); - uint8 red_tint = (uint8) SvIV(ST(2)); - uint8 green_tint = (uint8) SvIV(ST(3)); - uint8 blue_tint = (uint8) SvIV(ST(4)); - VALIDATE_THIS_IS_MOB; - THIS->SetSlotTint(material_slot, red_tint, green_tint, blue_tint); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_WearChange); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_WearChange) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::WearChange(THIS, uint8 material_slot, uint16 texture, [uint32 color = 0, uint32 hero_forge_model = 0])"); // @categories Script Utility - { - Mob *THIS; - uint8 material_slot = (uint8) SvIV(ST(1)); - uint16 texture = (uint16) SvUV(ST(2)); - uint32 color = 0; - uint32 hero_forge_model = 0; - VALIDATE_THIS_IS_MOB; - if (items > 3) { - color = (uint32) SvUV(ST(3)); - } - if (items > 4) { - hero_forge_model = (uint32) SvUV(ST(3)); - } - - THIS->WearChange(material_slot, texture, color, hero_forge_model); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DoKnockback); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoKnockback) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::DoKnockback(THIS, Mob* caster, uint32 push_back_amount, uint32 push_up_amount)"); // @categories Script Utility - { - Mob *THIS; - Mob *caster; - uint32 push_back = (uint16) SvUV(ST(2)); - uint32 push_up = (uint16) SvUV(ST(2)); - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - THIS->DoKnockback(caster, push_back, push_up); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_RemoveNimbusEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RemoveNimbusEffect) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::RemoveNimbusEffect(THIS, int32 effect_id)"); // @categories Script Utility - { - Mob *THIS; - int32 effect_id = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->RemoveNimbusEffect(effect_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetRunning); -XS(XS_Mob_SetRunning) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetRunning(THIS, bool value)"); // @categories Script Utility - { - Mob *THIS; - bool value = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetRunning(value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsRunning); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsRunning) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsRunning(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsRunning(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetBodyType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetBodyType) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::SetBodyType(THIS, int32 type, [bool overwrite_orig = false])"); // @categories Stats and Attributes - { - Mob *THIS; - int32 type = (int32) SvIV(ST(1)); - bool overwrite_orig = false; - VALIDATE_THIS_IS_MOB; - if (items == 3) { - overwrite_orig = (bool) SvTRUE(ST(2)); - } - - THIS->SetBodyType((bodyType) type, overwrite_orig); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetDeltas); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetDeltas) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: Mob::SetDeltas(THIS, float delta_x, float delta_y, float delta_z, float delta_h)"); // @categories Script Utility - { - Mob *THIS; - auto delta = glm::vec4((float) SvNV(ST(1)), (float) SvNV(ST(2)), (float) SvNV(ST(3)), (float) SvNV(ST(4))); - VALIDATE_THIS_IS_MOB; - THIS->SetDelta(delta); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetLD); -XS(XS_Mob_SetLD) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetLD(THIS, bool value)"); // @categories Script Utility - { - Mob *THIS; - bool value = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SendAppearancePacket(AT_Linkdead, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetTargetable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetTargetable) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetTargetable(THIS, bool targetable)"); // @categories Stats and Attributes - { - Mob *THIS; - bool on = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetTargetable(on); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ModSkillDmgTaken); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ModSkillDmgTaken) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::ModSkillDmgTaken(THIS, int skill, int16 value)"); // @categories Skills and Recipes, Script Utility - { - Mob *THIS; - EQ::skills::SkillType skill_num = (EQ::skills::SkillType) SvUV(ST(1)); - int16 value = (int16) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - THIS->ModSkillDmgTaken(skill_num, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetModSkillDmgTaken); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetModSkillDmgTaken) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetModSkillDmgTaken(THIS, int skill_id)"); // @categories Stats and Attributes - { - Mob *THIS; - int16 RETVAL; - dXSTARG; - EQ::skills::SkillType skill_num = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetModSkillDmgTaken(skill_num); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSkillDmgTaken); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSkillDmgTaken) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetSkillDmgTaken(THIS, int skill_id)"); // @categories Skills and Recipes, Script Utility - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - EQ::skills::SkillType skill_num = (EQ::skills::SkillType) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSkillDmgTaken(skill_num); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetAllowBeneficial); -XS(XS_Mob_SetAllowBeneficial) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetAllowBeneficial(THIS, bool value)"); // @categories Stats and Attributes - { - Mob *THIS; - bool value = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetAllowBeneficial(value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetAllowBeneficial); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetAllowBeneficial) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetAllowBeneficial(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetAllowBeneficial(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsBeneficialAllowed); -XS(XS_Mob_IsBeneficialAllowed) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::IsBeneficialAllowed(THIS, Mob* target)"); // @categories Stats and Attributes - { - dXSTARG; - Mob *THIS; - Mob *target; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - RETVAL = THIS->IsBeneficialAllowed(target); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_ModVulnerability); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ModVulnerability) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::ModVulnerability(THIS, uint8 resist, int16 value)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 resist = (uint8) SvIV(ST(1)); - int16 value = (int16) SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - THIS->ModVulnerability(resist, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetModVulnerability); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetModVulnerability) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetModVulnerability(THIS, uint8 resist)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - uint8 resist = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetModVulnerability(resist); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_DoMeleeSkillAttackDmg); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoMeleeSkillAttackDmg) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Mob::DoMeleeSkillAttackDmg(THIS, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte)"); // @categories Script Utility, Skills and Attributes - { - Mob *THIS; - Mob *target; - uint16 weapon_damage = (uint16) SvIV(ST(2)); - EQ::skills::SkillType skill = (EQ::skills::SkillType) SvUV(ST(3)); - int16 chance_mod = (int16) SvIV(ST(4)); - int16 focus = (int16) SvIV(ST(5)); - uint8 CanRiposte = (uint8) SvIV(ST(6)); - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - THIS->DoMeleeSkillAttackDmg(target, weapon_damage, skill, chance_mod, focus, CanRiposte); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DoArcheryAttackDmg); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoArcheryAttackDmg) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Mob::DoArcheryAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)"); // @categories Script Utility, Skills and Attributes - { - Mob *THIS; - Mob *target; - EQ::ItemInstance *RangeWeapon = nullptr; - EQ::ItemInstance *Ammo = nullptr; - uint16 weapon_damage = (uint16) SvIV(ST(4)); - int16 chance_mod = (int16) SvIV(ST(5)); - int16 focus = (int16) SvIV(ST(6)); - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - THIS->DoArcheryAttackDmg(target, RangeWeapon, Ammo, weapon_damage, chance_mod, focus); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_DoThrowingAttackDmg); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_DoThrowingAttackDmg) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Mob::DoThrowingAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)"); // @categories Script Utility, Skills and Attributes - { - Mob *THIS; - Mob *target; - EQ::ItemInstance *RangeWeapon = nullptr; - EQ::ItemData *item = nullptr; - uint16 weapon_damage = (uint16) SvIV(ST(4)); - int16 chance_mod = (int16) SvIV(ST(5)); - int16 focus = (int16) SvIV(ST(6)); - VALIDATE_THIS_IS_MOB; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - THIS->DoThrowingAttackDmg(target, RangeWeapon, item, weapon_damage, chance_mod, focus); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetDisableMelee); -XS(XS_Mob_SetDisableMelee) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetDisableMelee(THIS, bool value)"); // @categories Script Utility, Stats and Attributes - { - Mob *THIS; - bool value = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetDisableMelee(value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsMeleeDisabled); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_IsMeleeDisabled) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsMeleeDisabled(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsMeleeDisabled(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SetFlurryChance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetFlurryChance) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::SetFlurryChance(THIS, uint8 value)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 value = (uint8) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->SetFlurryChance(value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetFlurryChance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetFlurryChance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetFlurryChance(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetFlurryChance(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpellStat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpellStat) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::GetSpellStat(THIS, uint32 spell_id, string stat, uint8 slot)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - uint32 spellid = (uint32) SvUV(ST(1)); - Const_char *stat = (Const_char *) SvPV_nolen(ST(2)); - uint8 slot = (uint8) SvUV(ST(3)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - if (items > 4) { slot = 0; } - - - RETVAL = THIS->GetSpellStat(spellid, stat, slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBuffStatValueBySpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBuffStatValueBySpell) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetBuffStatValueBySpell(THIS, int32 spell_id, string stat)"); // @categories Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - int32 spellid = (int32)SvIV(ST(1)); - Const_char *stat = (Const_char *)SvPV_nolen(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - - RETVAL = THIS->GetBuffStatValueBySpell(spellid, stat); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBuffStatValueBySlot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetBuffStatValueBySlot) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetBuffStatValueBySlot(THIS, uint8 slot, string stat)"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int32 RETVAL; - uint8 slot = (uint8)SvUV(ST(1)); - Const_char *stat = (Const_char *)SvPV_nolen(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - - RETVAL = THIS->GetBuffStatValueBySlot(slot, stat); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpecialAbility) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbility(THIS, int special_ability)"); // @categories Stats and Attributes - { - int RETVAL; - Mob *THIS; - int ability = SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSpecialAbility(ability); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetSpecialAbilityParam) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbilityParam(THIS, int special_ability, int param)"); // @categories Stats and Attributes - { - int RETVAL; - Mob *THIS; - int ability = SvIV(ST(1)); - int param = SvIV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetSpecialAbilityParam(ability, param); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetSpecialAbility) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbility(THIS, int ability, int value)"); // @categories Stats and Attributes - { - Mob *THIS; - int ability = SvIV(ST(1)); - int value = SvIV(ST(2)); - VALIDATE_THIS_IS_MOB; - THIS->SetSpecialAbility(ability, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetSpecialAbilityParam) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbilityParam(THIS, int ability, int param, int value)"); // @categories Stats and Attributes - { - Mob *THIS; - int ability = SvIV(ST(1)); - int param = SvIV(ST(2)); - int value = SvIV(ST(3)); - VALIDATE_THIS_IS_MOB; - THIS->SetSpecialAbilityParam(ability, param, value); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ClearSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ClearSpecialAbilities) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::ClearSpecialAbilities(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->ClearSpecialAbilities(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ProcessSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ProcessSpecialAbilities) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::ProcessSpecialAbilities(THIS, string str)"); // @categories Script Utility - { - Mob *THIS; - const char *str = (const char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->ProcessSpecialAbilities(str); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_CanClassEquipItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanClassEquipItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CanClassEquipItem(THIS, uint32 item_id)"); // @categories Inventory and Items, Script Utility - { - Mob *THIS; - bool RETVAL; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanClassEquipItem(item_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsFeared); -XS(XS_Mob_IsFeared) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsFeared(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsFeared(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsBlind); -XS(XS_Mob_IsBlind) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsBlind(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsBlind(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetInvisibleLevel); -XS(XS_Mob_GetInvisibleLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetInvisibleLevel(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetInvisibleLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetInvisibleUndeadLevel); -XS(XS_Mob_GetInvisibleUndeadLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetInvisibleUndeadLevel(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetInvisibleUndeadLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - - -XS(XS_Mob_SeeInvisible); -XS(XS_Mob_SeeInvisible) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::SeeInvisible(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->SeeInvisible(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SeeInvisibleUndead); -XS(XS_Mob_SeeInvisibleUndead) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::SeeInvisibleUndead(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->SeeInvisibleUndead(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SeeHide); -XS(XS_Mob_SeeHide) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::SeeHide(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->SeeHide(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_SeeImprovedHide); -XS(XS_Mob_SeeImprovedHide) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::SeeImprovedHide(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->SeeImprovedHide(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetNimbusEffect1); -XS(XS_Mob_GetNimbusEffect1) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetNimbusEffect1(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetNimbusEffect1(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetNimbusEffect2); -XS(XS_Mob_GetNimbusEffect2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetNimbusEffect2(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetNimbusEffect2(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetNimbusEffect3); -XS(XS_Mob_GetNimbusEffect3) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetNimbusEffect3(THIS)"); // @categories Script Utility - { - Mob *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetNimbusEffect3(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsTargetable); -XS(XS_Mob_IsTargetable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsTargetable(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsTargetable(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_HasShieldEquiped); -XS(XS_Mob_HasShieldEquiped) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasShieldEquiped(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasShieldEquiped(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_HasTwoHandBluntEquiped); -XS(XS_Mob_HasTwoHandBluntEquiped) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasTwoHandBluntEquiped(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasTwoHandBluntEquiped(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_HasTwoHanderEquipped); -XS(XS_Mob_HasTwoHanderEquipped) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasTwoHanderEquipped(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasTwoHanderEquipped(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHerosForgeModel); -XS(XS_Mob_GetHerosForgeModel) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetHerosForgeModel(THIS, uint8 material_slot)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - uint8 material_slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHerosForgeModel(material_slot); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_IsEliteMaterialItem); -XS(XS_Mob_IsEliteMaterialItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::IsEliteMaterialItem(THIS, uint8 material_slot)"); // @categories Script Utility, Stats and Attributes - { - Mob *THIS; - uint32 RETVAL; - uint8 material_slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsEliteMaterialItem(material_slot); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetBaseSize); -XS(XS_Mob_GetBaseSize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBaseSize(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetBaseSize(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_HasOwner); -XS(XS_Mob_HasOwner) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasOwner(THIS)"); // @categories Pet - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasOwner(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsPet); -XS(XS_Mob_IsPet) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsPet(THIS)"); // @categories Pet - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsPet(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_HasPet); -XS(XS_Mob_HasPet) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::HasPet(THIS)"); // @categories Pet - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->HasPet(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_RemovePet); -XS(XS_Mob_RemovePet) { - dXSARGS; - if (items != 1) { - Perl_croak(aTHX_ "Usage: Mob::RemovePet(THIS)"); // @categories Pet - } - - Mob* THIS; - VALIDATE_THIS_IS_MOB; - - THIS->SetPet(nullptr); - - XSRETURN_EMPTY; -} - -XS(XS_Mob_SetPet); -XS(XS_Mob_SetPet) { - dXSARGS; - if (items != 2) { - Perl_croak(aTHX_ "Usage: Mob::SetPet(THIS, Mob* new_pet)"); // @categories Pet - } - - Mob* THIS; - VALIDATE_THIS_IS_MOB; - - Mob* new_pet = nullptr; // passing null or invalid new_pet removes pet - if (sv_derived_from(ST(1), "Mob")) - { - IV tmp = SvIV((SV*)SvRV(ST(1))); - new_pet = INT2PTR(Mob*, tmp); - } - - THIS->SetPet(new_pet); - - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsSilenced); -XS(XS_Mob_IsSilenced) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsSilenced(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsSilenced(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_IsAmnesiad); -XS(XS_Mob_IsAmnesiad) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsAmnesiad(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsAmnesiad(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetMeleeMitigation); -XS(XS_Mob_GetMeleeMitigation) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetMeleeMitigation(THIS)"); // @categories Stats and Attributes - { - Mob *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetMeleeMitigation(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_TryMoveAlong); -XS(XS_Mob_TryMoveAlong) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::TryMoveAlong(THIS, float distance, float angle, bool send)"); // @categories Script Utility - { - Mob *THIS; - float distance = (float) SvNV(ST(1)); - float angle = (float) SvNV(ST(2)); - bool send = true; - VALIDATE_THIS_IS_MOB; - if (items == 4) - send = (bool) SvTRUE(ST(3)); - - THIS->TryMoveAlong(distance, angle, send); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetClassName); -XS(XS_Mob_GetClassName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetClassName(THIS)"); - { - Mob* THIS; - Const_char *class_name; - dXSTARG; - VALIDATE_THIS_IS_MOB; - class_name = GetClassIDName(THIS->GetClass()); - sv_setpv(TARG, class_name); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_GetRaceName); -XS(XS_Mob_GetRaceName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetRaceName(THIS)"); - { - Mob* THIS; - Const_char *race_name; - dXSTARG; - VALIDATE_THIS_IS_MOB; - race_name = GetRaceIDName(THIS->GetRace()); - sv_setpv(TARG, race_name); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_DeleteBucket); -XS(XS_Mob_DeleteBucket) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::DeleteBucket(THIS, string bucket_name)"); // @categories Script Utility - { - Mob* THIS; - std::string bucket_name = (std::string) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->DeleteBucket(bucket_name); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetBucket); -XS(XS_Mob_GetBucket) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetBucket(THIS, string bucket_name)"); // @categories Script Utility - { - Mob* THIS; - dXSTARG; - std::string bucket_name = (std::string) SvPV_nolen(ST(1)); - std::string bucket_value; - VALIDATE_THIS_IS_MOB; - bucket_value = THIS->GetBucket(bucket_name); - sv_setpv(TARG, bucket_value.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_GetBucketExpires); -XS(XS_Mob_GetBucketExpires) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetBucketExpires(THIS, string bucket_name)"); // @categories Script Utility - { - Mob* THIS; - dXSTARG; - std::string bucket_name = (std::string) SvPV_nolen(ST(1)); - std::string bucket_expiration; - VALIDATE_THIS_IS_MOB; - bucket_expiration = THIS->GetBucketExpires(bucket_name); - sv_setpv(TARG, bucket_expiration.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_GetBucketKey); -XS(XS_Mob_GetBucketKey) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetBucketKey(THIS)"); // @categories Script Utility - { - Mob* THIS; - dXSTARG; - std::string bucket_key; - VALIDATE_THIS_IS_MOB; - bucket_key = THIS->GetBucketKey(); - sv_setpv(TARG, bucket_key.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_GetBucketRemaining); -XS(XS_Mob_GetBucketRemaining) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::GetBucketRemaining(THIS, string bucket_name)"); // @categories Script Utility - { - Mob* THIS; - dXSTARG; - std::string bucket_name = (std::string) SvPV_nolen(ST(1)); - std::string bucket_remaining; - VALIDATE_THIS_IS_MOB; - bucket_remaining = THIS->GetBucketRemaining(bucket_name); - sv_setpv(TARG, bucket_remaining.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_SetBucket); -XS(XS_Mob_SetBucket) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::SetBucket(THIS, string bucket_name, string bucket_value, [string expiration])"); // @categories Script Utility - { - Mob* THIS; - std::string key = (std::string) SvPV_nolen(ST(1)); - std::string value = (std::string) SvPV_nolen(ST(2)); - std::string expiration; - VALIDATE_THIS_IS_MOB; - if (items == 4) - expiration = (std::string) SvPV_nolen(ST(3)); - - THIS->SetBucket(key, value, expiration); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_IsHorse); -XS(XS_Mob_IsHorse) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::IsHorse(THIS)"); // @categories Script Utility - { - Mob *THIS; - bool RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->IsHorse(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHateListByDistance); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateListByDistance) { - dXSARGS; - int num_entries = 0; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Mob::GetHateListByDistance(THIS, int distance)"); // @categories Hate and Aggro - { - Mob *THIS; - int distance = 0; - VALIDATE_THIS_IS_MOB; - if (items == 2) - distance = (int) SvIV(ST(1)); - - auto list = THIS->GetHateListByDistance(distance); - for (auto hate_entry : list) { - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "HateEntry", (void *) hate_entry); - XPUSHs(ST(0)); - num_entries++; - } - } - XSRETURN(num_entries); -} - -XS(XS_Mob_GetHateClosest); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateClosest) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateClosest(THIS)"); // @categories Hate and Aggro - { - Mob *THIS; - Mob *closest_mob; - VALIDATE_THIS_IS_MOB; - closest_mob = THIS->GetHateClosest(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Mob", (void *) closest_mob); - } - XSRETURN(1); -} - -XS(XS_Mob_GetLastName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetLastName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetLastName(THIS)"); // @categories Script Utility - { - Mob *THIS; - Const_char *last_name; - dXSTARG; - VALIDATE_THIS_IS_MOB; - last_name = THIS->GetLastName(); - sv_setpv(TARG, last_name); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Mob_CanRaceEquipItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CanRaceEquipItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::CanRaceEquipItem(THIS, uint32 item_id)"); // @categories Inventory and Items, Script Utility - { - Mob *THIS; - bool RETVAL; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CanRaceEquipItem(item_id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Mob_RemoveAllNimbusEffects); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_RemoveAllNimbusEffects) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::RemoveAllNimbusEffects(THIS)"); // @categories Script Utility - { - Mob *THIS; - VALIDATE_THIS_IS_MOB; - THIS->RemoveAllNimbusEffects(); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_AddNimbusEffect); -XS(XS_Mob_AddNimbusEffect) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Mob::AddNimbusEffect(THIS, int effect_id)"); // @categories Script Utility - { - Mob* THIS; - int effect_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_MOB; - THIS->AddNimbusEffect(effect_id); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ShieldAbility); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ShieldAbility) { - dXSARGS; - if (items < 2 || items > 6) - Perl_croak(aTHX_ "Usage: Mob::ShieldAbility(THIS, uint32 target_id, [int32 shielder__max_distance = 15], [int32 shield_duration = 12000], [int32 shield_target_mitigation= 50], [int32 shielder_mitigation = 50], [bool use_aa = false], bool [can_shield_npc = true]"); // @categories Spells and Disciplines - { - Mob *THIS; - uint32 target_id = (uint32)SvUV(ST(1)); - int32 shielder_max_distance = (int32)SvUV(ST(2)); - int32 shield_duration = (int32)SvUV(ST(3)); - int32 shield_target_mitigation = (int32)SvUV(ST(4)); - int32 shielder_mitigation = (int32)SvUV(ST(5)); - bool use_aa = (bool)SvTRUE(ST(6)); - bool can_shield_npc = (bool)SvTRUE(ST(7)); - - VALIDATE_THIS_IS_MOB; - if (items < 3) { - shielder_max_distance = 15; - } - - if (items < 4) { - shield_duration = 12000; - } - - if (items < 5) { - shield_target_mitigation = 50; - } - - if (items < 6) { - shielder_mitigation = 50; - } - - if (items < 7) { - use_aa = false; - } - - if (items < 8) { - can_shield_npc = true; - } - THIS->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation, shielder_mitigation, use_aa, can_shield_npc); - - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_GetHateRandomClient); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateRandomClient) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateRandomClient(THIS)"); // @categories Hate and Aggro - { - Mob* THIS; - Client* RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHateRandomClient(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_GetHateRandomNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateRandomNPC) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateRandomNPC(THIS)"); // @categories Hate and Aggro - { - Mob* THIS; - NPC* RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHateRandomNPC(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "NPC", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Mob_SetBuffDuration); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_SetBuffDuration) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::SetBuffDuration(THIS, spell_id, [int duration = 0])"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int spell_id = (int)SvIV(ST(1)); - int duration = 0; - VALIDATE_THIS_IS_MOB; - - if (items == 3) { - duration = (int)SvIV(ST(2)); - } - - THIS->SetBuffDuration(spell_id, duration); - } - XSRETURN_EMPTY; -} - -XS(XS_Mob_ApplySpellBuff); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_ApplySpellBuff) { - dXSARGS; - if (items < 2 || items > 3) - Perl_croak(aTHX_ "Usage: Mob::ApplySpellBuff(THIS, spell_id, [int duration = 0])"); // @categories Script Utility, Spells and Disciplines - { - Mob *THIS; - int spell_id = (int)SvIV(ST(1)); - int duration = 0; - VALIDATE_THIS_IS_MOB; - - if (items == 3) { - duration = (int)SvIV(ST(2)); - } - - THIS->ApplySpellBuff(spell_id, duration); - } - XSRETURN_EMPTY; -} - -#ifdef BOTS -XS(XS_Mob_CastToBot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_CastToBot) +bool Perl_Mob_IsClient(Mob* self) // @categories Script Utility { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::CastToBot(THIS)"); - { - Mob* THIS; - Bot* RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->CastToBot(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Bot", (void*)RETVAL); - } - XSRETURN(1); + return self->IsClient(); } -XS(XS_Mob_GetHateRandomBot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Mob_GetHateRandomBot) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Mob::GetHateRandomBot(THIS)"); // @categories Hate and Aggro - { - Mob* THIS; - Bot* RETVAL; - VALIDATE_THIS_IS_MOB; - RETVAL = THIS->GetHateRandomBot(); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Bot", (void *) RETVAL); +bool Perl_Mob_IsNPC(Mob* self) // @categories Script Utility +{ + return self->IsNPC(); +} + +bool Perl_Mob_IsBot(Mob* self) // @categories Script Utility +{ + return self->IsBot(); +} + +bool Perl_Mob_IsMob(Mob* self) // @categories Script Utility +{ + return self->IsMob(); +} + +bool Perl_Mob_IsCorpse(Mob* self) // @categories Script Utility, Corpse +{ + return self->IsCorpse(); +} + +bool Perl_Mob_IsPlayerCorpse(Mob* self) // @categories Corpse +{ + return self->IsPlayerCorpse(); +} + +bool Perl_Mob_IsNPCCorpse(Mob* self) // @categories Corpse +{ + return self->IsNPCCorpse(); +} + +bool Perl_Mob_IsObject(Mob* self) // @categories Objects +{ + return self->IsObject(); +} + +bool Perl_Mob_IsDoor(Mob* self) // @categories Script Utility, Doors +{ + return self->IsDoor(); +} + +bool Perl_Mob_IsTrap(Mob* self) // @categories Script Utility +{ + return self->IsTrap(); +} + +bool Perl_Mob_IsBeacon(Mob* self) // @categories Script Utility +{ + return self->IsBeacon(); +} + +Client* Perl_Mob_CastToClient(Mob* self) // @categories Account and Character, Script Utility +{ + return self->CastToClient(); +} + +NPC* Perl_Mob_CastToNPC(Mob* self) // @categories Script Utility +{ + return self->CastToNPC(); +} + +Mob* Perl_Mob_CastToMob(Mob* self) // @categories Script Utility +{ + return self->CastToMob(); +} + +Corpse* Perl_Mob_CastToCorpse(Mob* self) // @categories Script Utility, Corpse +{ + return self->CastToCorpse(); +} + +int Perl_Mob_GetID(Mob* self) // @categories Script Utility +{ + return self->GetID(); +} + +std::string Perl_Mob_GetName(Mob* self)// @categories Script Utility +{ + return self->GetName(); +} + +void Perl_Mob_Depop(Mob* self) // @categories Spawns +{ + self->Depop(); +} + +void Perl_Mob_Depop(Mob* self, bool start_spawn_timer) // @categories Spawns +{ + self->Depop(start_spawn_timer); +} + +void Perl_Mob_RogueAssassinate(Mob* self, Mob* other) // @categories Script Utility +{ + return self->RogueAssassinate(other); +} + +bool Perl_Mob_BehindMob(Mob* self, Mob* other) // @categories Script Utility +{ + return self->BehindMob(other); +} + +bool Perl_Mob_BehindMob(Mob* self, Mob* other, float x) // @categories Script Utility +{ + return self->BehindMob(other, x); +} + +bool Perl_Mob_BehindMob(Mob* self, Mob* other, float x, float y) // @categories Script Utility +{ + return self->BehindMob(other, x, y); +} + +void Perl_Mob_SetLevel(Mob* self, uint8_t in_level) // @categories Stats and Attributes +{ + self->SetLevel(in_level); +} + +void Perl_Mob_SetLevel(Mob* self, uint8_t in_level, bool command) // @categories Stats and Attributes +{ + self->SetLevel(in_level, command); +} + +uint32_t Perl_Mob_GetSkill(Mob* self, int skill_id) // @categories Skills and Recipes, Script Utility +{ + return self->GetSkill(static_cast(skill_id)); +} + +void Perl_Mob_SendWearChange(Mob* self, uint8_t material_slot) // @categories Script Utility +{ + self->SendWearChange(material_slot); +} + +int32_t Perl_Mob_GetEquipment(Mob* self, uint8_t material_slot) // @categories Inventory and Items +{ + return self->GetEquippedItemFromTextureSlot(material_slot); +} + +int32_t Perl_Mob_GetEquipmentMaterial(Mob* self, uint8_t material_slot) // @categories Inventory and Items +{ + return self->GetEquipmentMaterial(material_slot); +} + +int32_t Perl_Mob_GetEquipmentColor(Mob* self, uint8_t material_slot) // @categories Inventory and Items +{ + return self->GetEquipmentColor(material_slot); +} + +int32_t Perl_Mob_GetArmorTint(Mob* self, uint8_t material_slot) // @categories Stats and Attributes +{ + return self->GetArmorTint(material_slot); +} + +bool Perl_Mob_IsMoving(Mob* self) // @categories Script Utility +{ + return self->IsMoving(); +} + +void Perl_Mob_GoToBind(Mob* self) // @categories Script Utility +{ + self->GoToBind(); +} + +void Perl_Mob_Gate(Mob* self) // @categories Spells and Disciplines +{ + self->Gate(); +} + +bool Perl_Mob_Attack(Mob* self, Mob* other) // @categories Script Utility, Hate and Aggro +{ + return self->Attack(other); +} + +bool Perl_Mob_Attack(Mob* self, Mob* other, int hand) // @categories Script Utility, Hate and Aggro +{ + return self->Attack(other, hand); +} + +bool Perl_Mob_Attack(Mob* self, Mob* other, int hand, bool from_riposte) // @categories Script Utility, Hate and Aggro +{ + return self->Attack(other, hand, from_riposte); +} + +void Perl_Mob_Damage(Mob* self, Mob* from, int64_t damage, uint16_t spell_id, int attack_skill) // @categories Script Utility +{ + self->Damage(from, damage, spell_id, static_cast(attack_skill)); +} + +void Perl_Mob_Damage(Mob* self, Mob* from, int64_t damage, uint16_t spell_id, int attack_skill, bool avoidable) // @categories Script Utility +{ + self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable); +} + +void Perl_Mob_Damage(Mob* self, Mob* from, int64_t damage, uint16_t spell_id, int attack_skill, bool avoidable, int8_t buffslot) // @categories Script Utility +{ + self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot); +} + +void Perl_Mob_Damage(Mob* self, Mob* from, int64_t damage, uint16_t spell_id, int attack_skill, bool avoidable, int8_t buffslot, bool buff_tic) // @categories Script Utility +{ + self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot, buff_tic); +} + +void Perl_Mob_RangedAttack(Mob* self, Mob* other) // @categories Skills and Recipes, Script Utility +{ + self->RangedAttack(other); +} + +void Perl_Mob_ThrowingAttack(Mob* self, Mob* other) // @categories Skills and Recipes, Script Utility +{ + self->ThrowingAttack(other); +} + +void Perl_Mob_Heal(Mob* self)// @categories Script Utility +{ + self->Heal(); +} + +void Perl_Mob_HealDamage(Mob* self, int64_t amount) // @categories Script Utility +{ + self->HealDamage(amount); +} + +void Perl_Mob_HealDamage(Mob* self, int64_t amount, Mob* caster) // @categories Script Utility +{ + self->HealDamage(amount, caster); +} + +void Perl_Mob_SetMaxHP(Mob* self) // @categories Stats and Attributes +{ + self->SetMaxHP(); +} + +uint32_t Perl_Mob_GetLevelCon(Mob* self, uint8_t other_level) // @categories Stats and Attributes +{ + return self->GetLevelCon(other_level); +} + +void Perl_Mob_SetHP(Mob* self, int64_t hp) // @categories Stats and Attributes +{ + self->SetHP(hp); +} + +void Perl_Mob_DoAnim(Mob* self, int anim_num) // @categories Script Utility +{ + self->DoAnim(anim_num); +} + +void Perl_Mob_DoAnim(Mob* self, int anim_num, int type) // @categories Script Utility +{ + self->DoAnim(anim_num, type); +} + +void Perl_Mob_ChangeSize(Mob* self, float in_size) // @categories Script Utility +{ + self->ChangeSize(in_size); +} + +void Perl_Mob_ChangeSize(Mob* self, float in_size, bool no_restriction) // @categories Script Utility +{ + self->ChangeSize(in_size, no_restriction); +} + +void Perl_Mob_RandomizeFeatures(Mob* self, bool send_illusion, bool save_variables) // @categories Script Utility +{ + self->RandomizeFeatures(send_illusion, save_variables); +} + +void Perl_Mob_GMMove(Mob* self, float x, float y, float z) // @categories Script Utility +{ + self->GMMove(x, y, z); +} + +void Perl_Mob_GMMove(Mob* self, float x, float y, float z, float heading) // @categories Script Utility +{ + self->GMMove(x, y, z, heading); +} + +bool Perl_Mob_HasProcs(Mob* self) // @categories Stats and Attributes +{ + return self->HasProcs(); +} + +bool Perl_Mob_IsInvisible(Mob* self) // @categories Script Utility +{ + return self->IsInvisible(); +} + +bool Perl_Mob_IsInvisible(Mob* self, Mob* other) // @categories Script Utility +{ + return self->IsInvisible(other); +} + +void Perl_Mob_SetInvisible(Mob* self, uint8_t state) // @categories Script Utility +{ + self->SetInvisible(state); +} + +void Perl_Mob_SetSeeInvisibleLevel(Mob* self, uint8 see_invis_level) // @categories Script Utility +{ + self->SetInnateSeeInvisible(see_invis_level); + self->CalcSeeInvisibleLevel(); +} + +void Perl_Mob_SetSeeInvisibleUndeadLevel(Mob* self, uint8 see_invis_undead_level) // @categories Script Utility +{ + self->SetSeeInvisibleUndead(see_invis_undead_level); +} + +bool Perl_Mob_FindBuff(Mob* self, uint16 spell_id) // @categories Spells and Disciplines, Script Utility +{ + return self->FindBuff(spell_id); +} + +int Perl_Mob_FindBuffBySlot(Mob* self, int slot) // @categories Spells and Disciplines, Script Utility +{ + return self->FindBuffBySlot(slot); +} + +int Perl_Mob_BuffCount(Mob* self) // @categories Script Utility, Spells and Disciplines +{ + return self->BuffCount(); +} + +bool Perl_Mob_FindType(Mob* self, uint16_t type) // @categories Script Utility +{ + return self->FindType(type); +} + +bool Perl_Mob_FindType(Mob* self, uint16_t type, bool offensive) // @categories Script Utility +{ + return self->FindType(type, offensive); +} + +bool Perl_Mob_FindType(Mob* self, uint16_t type, bool offensive, uint16_t threshold) // @categories Script Utility +{ + return self->FindType(type, offensive, threshold); +} + +int Perl_Mob_GetBuffSlotFromType(Mob* self, uint16 type) // @categories Spells and Disciplines, Script Utility +{ + return self->GetBuffSlotFromType(type); +} + +void Perl_Mob_MakePet(Mob* self, uint16 spell_id, const char* pet_type) // @categories Pet +{ + self->MakePet(spell_id, pet_type); +} + +void Perl_Mob_MakePet(Mob* self, uint16 spell_id, const char* pet_type, const char* name) // @categories Pet +{ + self->MakePet(spell_id, pet_type, name); +} + +void Perl_Mob_MakeTempPet(Mob* self, uint16 spell_id) // @categories Pet +{ + self->TemporaryPets(spell_id, nullptr); +} + +void Perl_Mob_MakeTempPet(Mob* self, uint16 spell_id, const char* name) // @categories Pet +{ + self->TemporaryPets(spell_id, nullptr, name); +} + +void Perl_Mob_MakeTempPet(Mob* self, uint16 spell_id, const char* name, uint32 duration) // @categories Pet +{ + self->TemporaryPets(spell_id, nullptr, name, duration); +} + +void Perl_Mob_MakeTempPet(Mob* self, uint16 spell_id, const char* name, uint32 duration, Mob* target) // @categories Pet +{ + self->TemporaryPets(spell_id, target, name, duration); +} + +void Perl_Mob_MakeTempPet(Mob* self, uint16 spell_id, const char* name, uint32 duration, Mob* target, bool sticktarg) // @categories Pet +{ + self->TemporaryPets(spell_id, target, name, duration, true, sticktarg); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id) // @categories Pet +{ + self->TypesTemporaryPets(type_id, nullptr); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id, const char* name) // @categories Pet +{ + self->TypesTemporaryPets(type_id, nullptr, name); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id, const char* name, uint32 duration) // @categories Pet +{ + self->TypesTemporaryPets(type_id, nullptr, name, duration); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id, const char* name, uint32 duration, bool follow) // @categories Pet +{ + self->TypesTemporaryPets(type_id, nullptr, name, duration, follow); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id, const char* name, uint32 duration, bool follow, Mob* target) // @categories Pet +{ + self->TypesTemporaryPets(type_id, target, name, duration, follow); +} + +void Perl_Mob_TypesTempPet(Mob* self, uint32 type_id, const char* name, uint32 duration, bool follow, Mob* target, bool stick_targ) // @categories Pet +{ + self->TypesTemporaryPets(type_id, target, name, duration, follow, stick_targ); +} + +int Perl_Mob_GetBaseRace(Mob* self) // @categories Stats and Attributes +{ + return self->GetBaseRace(); +} + +int Perl_Mob_GetBaseGender(Mob* self) // @categories Stats and Attributes +{ + return self->GetBaseGender(); +} + +int Perl_Mob_GetDeity(Mob* self) // @categories Stats and Attributes +{ + return self->GetDeity(); +} + +int Perl_Mob_GetRace(Mob* self) // @categories Stats and Attributes +{ + return self->GetRace(); +} + +int Perl_Mob_GetGender(Mob* self) // @categories Stats and Attributes +{ + return self->GetGender(); +} + +int Perl_Mob_GetTexture(Mob* self) // @categories Stats and Attributes +{ + return self->GetTexture(); +} + +int Perl_Mob_GetHelmTexture(Mob* self) // @categories Stats and Attributes +{ + return self->GetHelmTexture(); +} + +int Perl_Mob_GetHairColor(Mob* self) // @categories Stats and Attributes +{ + return self->GetHairColor(); +} + +int Perl_Mob_GetBeardColor(Mob* self) // @categories Stats and Attributes +{ + return self->GetBeardColor(); +} + +int Perl_Mob_GetEyeColor1(Mob* self) // @categories Stats and Attributes +{ + return self->GetEyeColor1(); +} + +int Perl_Mob_GetEyeColor2(Mob* self) // @categories Stats and Attributes +{ + return self->GetEyeColor2(); +} + +int Perl_Mob_GetHairStyle(Mob* self) // @categories Stats and Attributes +{ + return self->GetHairStyle(); +} + +int Perl_Mob_GetLuclinFace(Mob* self) // @categories Stats and Attributes +{ + return self->GetLuclinFace(); +} + +int Perl_Mob_GetBeard(Mob* self) // @categories Stats and Attributes +{ + return self->GetBeard(); +} + +int Perl_Mob_GetDrakkinHeritage(Mob* self) // @categories Stats and Attributes +{ + return self->GetDrakkinHeritage(); +} + +int Perl_Mob_GetDrakkinTattoo(Mob* self) // @categories Stats and Attributes +{ + return self->GetDrakkinTattoo(); +} + +int Perl_Mob_GetDrakkinDetails(Mob* self) // @categories Stats and Attributes +{ + return self->GetDrakkinDetails(); +} + +int Perl_Mob_GetClass(Mob* self) // @categories Stats and Attributes +{ + return self->GetClass(); +} + +int Perl_Mob_GetLevel(Mob* self) // @categories Stats and Attributes +{ + return self->GetLevel(); +} + +std::string Perl_Mob_GetCleanName(Mob* self) // @categories Script Utility +{ + return self->GetCleanName(); +} + +Mob* Perl_Mob_GetTarget(Mob* self) // @categories Script Utility +{ + return self->GetTarget(); +} + +void Perl_Mob_SetTarget(Mob* self, Mob* target) // @categories Script Utility +{ + self->SetTarget(target); +} + +float Perl_Mob_GetHPRatio(Mob* self) // @categories Stats and Attributes +{ + return self->GetHPRatio(); +} + +bool Perl_Mob_IsWarriorClass(Mob* self) // @categories Script Utility +{ + return self->IsWarriorClass(); +} + +int64_t Perl_Mob_GetHP(Mob* self) // @categories Stats and Attributes +{ + return self->GetHP(); +} + +int64_t Perl_Mob_GetMaxHP(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxHP(); +} + +int64_t Perl_Mob_GetItemHPBonuses(Mob* self) // @categories Inventory and Items, Stats and Attributes +{ + return self->GetItemHPBonuses(); +} + +int64_t Perl_Mob_GetSpellHPBonuses(Mob* self) // @categories Spells and Disciplines +{ + return self->GetSpellHPBonuses(); +} + +int Perl_Mob_GetSpellIDFromSlot(Mob* self, uint8_t slot) // @categories Spells and Disciplines +{ + return slot <= self->GetMaxBuffSlots() ? self->GetSpellIDFromSlot(slot) : -1; +} + +int Perl_Mob_GetWalkspeed(Mob* self) // @categories Stats and Attributes +{ + return self->GetWalkspeed(); +} + +int Perl_Mob_GetRunspeed(Mob* self) // @categories Stats and Attributes +{ + return self->GetRunspeed(); +} + +int Perl_Mob_GetCasterLevel(Mob* self, uint16_t spell_id) // @categories Stats and Attributes +{ + return self->GetCasterLevel(spell_id); +} + +int64_t Perl_Mob_GetMaxMana(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxMana(); +} + +int64_t Perl_Mob_GetMana(Mob* self) // @categories Stats and Attributes +{ + return self->GetMana(); +} + +int64_t Perl_Mob_SetMana(Mob* self, int64_t amount) // @categories Stats and Attributes +{ + return self->SetMana(amount); +} + +float Perl_Mob_GetManaRatio(Mob* self) // @categories Stats and Attributes +{ + return self->GetManaRatio(); +} + +int Perl_Mob_GetAC(Mob* self) // @categories Stats and Attributes +{ + return self->GetAC(); +} + +int Perl_Mob_GetDisplayAC(Mob* self) +{ + return self->GetDisplayAC(); +} + +int Perl_Mob_GetATK(Mob* self) // @categories Stats and Attributes +{ + return self->GetATK(); +} + +int Perl_Mob_GetSTR(Mob* self) // @categories Stats and Attributes +{ + return self->GetSTR(); +} + +int Perl_Mob_GetSTA(Mob* self) // @categories Stats and Attributes +{ + return self->GetSTA(); +} + +int Perl_Mob_GetDEX(Mob* self) // @categories Stats and Attributes +{ + return self->GetDEX(); +} + +int Perl_Mob_GetAGI(Mob* self) // @categories Stats and Attributes +{ + return self->GetAGI(); +} + +int Perl_Mob_GetINT(Mob* self) // @categories Stats and Attributes +{ + return self->GetINT(); +} + +int Perl_Mob_GetWIS(Mob* self) // @categories Stats and Attributes +{ + return self->GetWIS(); +} + +int Perl_Mob_GetCHA(Mob* self) // @categories Stats and Attributes +{ + return self->GetCHA(); +} + +int Perl_Mob_GetMR(Mob* self) // @categories Stats and Attributes +{ + return self->GetMR(); +} + +int Perl_Mob_GetFR(Mob* self) // @categories Stats and Attributes +{ + return self->GetFR(); +} + +int Perl_Mob_GetDR(Mob* self) // @categories Stats and Attributes +{ + return self->GetDR(); +} + +int Perl_Mob_GetPR(Mob* self) // @categories Stats and Attributes +{ + return self->GetPR(); +} + +int Perl_Mob_GetCR(Mob* self) // @categories Stats and Attributes +{ + return self->GetCR(); +} + +int Perl_Mob_GetCorruption(Mob* self) // @categories Stats and Attributes +{ + return self->GetCorrup(); +} + +int Perl_Mob_GetPhR(Mob* self) // @categories Stats and Attributes +{ + return self->GetPhR(); +} + +int Perl_Mob_GetMaxSTR(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxSTR(); +} + +int Perl_Mob_GetMaxSTA(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxSTA(); +} + +int Perl_Mob_GetMaxDEX(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxDEX(); +} + +int Perl_Mob_GetMaxAGI(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxAGI(); +} + +int Perl_Mob_GetMaxINT(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxINT(); +} + +int Perl_Mob_GetMaxWIS(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxWIS(); +} + +int Perl_Mob_GetMaxCHA(Mob* self) // @categories Stats and Attributes +{ + return self->GetMaxCHA(); +} + +float Perl_Mob_GetActSpellRange(Mob* self, uint16 spell_id, float range) // @categories Spells and Disciplines +{ + return self->GetActSpellRange(spell_id, range); +} + +int64_t Perl_Mob_GetActSpellDamage(Mob* self, uint16 spell_id, int64 value) // @categories Spells and Disciplines +{ + return self->GetActSpellDamage(spell_id, value); +} + +int64_t Perl_Mob_GetActSpellHealing(Mob* self, uint16 spell_id, int64 value) // @categories Spells and Disciplines +{ + return self->GetActSpellHealing(spell_id, value); +} + +int Perl_Mob_GetActSpellCost(Mob* self, uint16 spell_id, int32 cost) // @categories Spells and Disciplines +{ + return self->GetActSpellCost(spell_id, cost); +} + +int Perl_Mob_GetActSpellDuration(Mob* self, uint16 spell_id, int32 duration) // @categories Spells and Disciplines +{ + return self->GetActSpellDuration(spell_id, duration); +} + +int Perl_Mob_GetActSpellCasttime(Mob* self, uint16 spell_id, uint32 cast_time) // @categories Spells and Disciplines +{ + return self->GetActSpellCasttime(spell_id, cast_time); +} + +float Perl_Mob_ResistSpell(Mob* self, uint8 resist_type, uint16 spell_id, Mob* caster) // @categories Spells and Disciplines, Script Utility +{ + return self->ResistSpell(resist_type, spell_id, caster); +} + +int Perl_Mob_GetSpecializeSkillValue(Mob* self, uint16 spell_id) // @categories Skills and Recipes, Spells and Disciplines +{ + return self->GetSpecializeSkillValue(spell_id); +} + +uint32_t Perl_Mob_GetNPCTypeID(Mob* self) // @categories Script Utility +{ + return self->GetNPCTypeID(); +} + +bool Perl_Mob_IsTargeted(Mob* self) // @categories Script Utility +{ + return self->IsTargeted(); +} + +float Perl_Mob_GetX(Mob* self) // @categories Script Utility +{ + return self->GetX(); +} + +float Perl_Mob_GetY(Mob* self) // @categories Script Utility +{ + return self->GetY(); +} + +float Perl_Mob_GetZ(Mob* self) // @categories Script Utility +{ + return self->GetZ(); +} + +float Perl_Mob_GetHeading(Mob* self) // @categories Script Utility +{ + return self->GetHeading(); +} + +float Perl_Mob_GetWaypointX(Mob* self) // @categories Script Utility +{ + return self->GetCurrentWayPoint().x; +} + +float Perl_Mob_GetWaypointY(Mob* self) // @categories Script Utility +{ + return self->GetCurrentWayPoint().y; +} + +float Perl_Mob_GetWaypointZ(Mob* self) // @categories Script Utility +{ + return self->GetCurrentWayPoint().z; +} + +float Perl_Mob_GetWaypointH(Mob* self) // @categories Script Utility +{ + return self->GetCurrentWayPoint().w; +} + +float Perl_Mob_GetWaypointPause(Mob* self) // @categories Script Utility +{ + return self->GetCWPP(); +} + +int Perl_Mob_GetWaypointID(Mob* self) // @categories Script Utility +{ + return self->GetCWP(); +} + +void Perl_Mob_SetCurrentWP(Mob* self, int waypoint) // @categories Script Utility +{ + self->SetCurrentWP(waypoint); +} + +float Perl_Mob_GetSize(Mob* self) // @categories Stats and Attributes +{ + return self->GetSize(); +} + +void Perl_Mob_SetFollowID(Mob* self, uint32_t id) // @categories Script Utility +{ + self->SetFollowID(id); +} + +uint32_t Perl_Mob_GetFollowID(Mob* self) // @categories Script Utility +{ + return self->GetFollowID(); +} + +void Perl_Mob_Message(Mob* self, uint32 type, const char* message) // @categories Script Utility +{ + if (RuleB(Chat, QuestDialogueUsesDialogueWindow) && self->IsClient()) { + DialogueWindow::Render(self->CastToClient(), message); } - XSRETURN(1); + else if (RuleB(Chat, AutoInjectSaylinksToClientMessage)) { + std::string new_message = EQ::SayLinkEngine::InjectSaylinksIfNotExist(message); + self->Message(type, new_message.c_str()); + } + else { + self->Message(type, message); + } +} + +void Perl_Mob_Message_StringID(Mob* self, uint32 type, uint32 string_id) // @categories Script Utility +{ + self->MessageString(type, string_id); +} + +void Perl_Mob_Message_StringID(Mob* self, uint32 type, uint32 string_id, uint32 distance) // @categories Script Utility +{ + self->MessageString(type, string_id, distance); +} + +void Perl_Mob_Say(Mob* self, const char* message) // @categories Script Utility +{ + self->Say(message); +} + +void Perl_Mob_Shout(Mob* self, const char* message) // @categories Script Utility +{ + self->Shout(message); +} + +void Perl_Mob_Emote(Mob* self, const char* message) // @categories Script Utility +{ + self->Emote(message); +} + +void Perl_Mob_InterruptSpell(Mob* self) // @categories Script Utility +{ + self->InterruptSpell(); +} + +void Perl_Mob_InterruptSpell(Mob* self, uint16 spell_id) // @categories Script Utility +{ + self->InterruptSpell(spell_id); +} + +void Perl_Mob_CastSpell(Mob* self, uint16 spell_id, uint16 target_id) // @categories Spells and Disciplines +{ + self->CastSpell(spell_id, target_id); +} + +void Perl_Mob_CastSpell(Mob* self, uint16 spell_id, uint16 target_id, int slot) // @categories Spells and Disciplines +{ + self->CastSpell(spell_id, target_id, static_cast(slot)); +} + +void Perl_Mob_CastSpell(Mob* self, uint16 spell_id, uint16 target_id, int slot, int cast_time) // @categories Spells and Disciplines +{ + self->CastSpell(spell_id, target_id, static_cast(slot), cast_time); +} + +void Perl_Mob_CastSpell(Mob* self, uint16 spell_id, uint16 target_id, int slot, int cast_time, int mana_cost) // @categories Spells and Disciplines +{ + self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost); +} + +// args differ from lua api (item_slot, timer, timer_duration not supported) +void Perl_Mob_CastSpell(Mob* self, uint16 spell_id, uint16 target_id, int slot, int cast_time, int mana_cost, int16 resist_adjust) // @categories Spells and Disciplines +{ + int16 res = resist_adjust; + self->CastSpell(spell_id, target_id, static_cast(slot), cast_time, mana_cost, nullptr, 0xFFFFFFFF, 0xFFFFFFFF, 0, &res); +} + +// these don't match lua api for default resist difficulty +void Perl_Mob_SpellFinished(Mob* self, uint16 spell_id, Mob* target) // @categories Spells and Disciplines +{ + self->SpellFinished(spell_id, target, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty); +} + +void Perl_Mob_SpellFinished(Mob* self, uint16 spell_id, Mob* target, uint16 mana_cost) // @categories Spells and Disciplines +{ + self->SpellFinished(spell_id, target, EQ::spells::CastingSlot::Item, mana_cost, -1, spells[spell_id].resist_difficulty); +} + +void Perl_Mob_SpellFinished(Mob* self, uint16 spell_id, Mob* target, uint16 mana_cost, uint16 resist_diff) // @categories Spells and Disciplines +{ + self->SpellFinished(spell_id, target, EQ::spells::CastingSlot::Item, mana_cost, -1, resist_diff); +} + +bool Perl_Mob_IsImmuneToSpell(Mob* self, uint16 spell_id, Mob* caster) // @categories Spells and Disciplines, Script Utility +{ + return self->IsImmuneToSpell(spell_id, caster); +} + +void Perl_Mob_BuffFadeBySpellID(Mob* self, uint16 spell_id) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeBySpellID(spell_id); +} + +void Perl_Mob_BuffFadeByEffect(Mob* self, int effect_id) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeByEffect(effect_id); +} + +void Perl_Mob_BuffFadeByEffect(Mob* self, int effect_id, int skip_slot) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeByEffect(effect_id, skip_slot); +} + +void Perl_Mob_BuffFadeAll(Mob* self) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeAll(); +} + +void Perl_Mob_BuffFadeBySlot(Mob* self, int slot) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeBySlot(slot); +} + +void Perl_Mob_BuffFadeBySlot(Mob* self, int slot, bool recalc_bonuses) // @categories Script Utility, Spells and Disciplines +{ + self->BuffFadeBySlot(slot, recalc_bonuses); +} + +bool Perl_Mob_CanBuffStack(Mob* self, uint16 spell_id, uint8 caster_level) // @categories Script Utility, Spells and Disciplines +{ + return self->CanBuffStack(spell_id, caster_level); +} + +bool Perl_Mob_CanBuffStack(Mob* self, uint16 spell_id, uint8 caster_level, bool fail_if_overwritten) // @categories Script Utility, Spells and Disciplines +{ + return self->CanBuffStack(spell_id, caster_level, fail_if_overwritten); +} + +bool Perl_Mob_IsCasting(Mob* self) // @categories Script Utility +{ + return self->IsCasting(); +} + +int Perl_Mob_CastingSpellID(Mob* self) // @categories Spells and Disciplines +{ + return self->CastingSpellID(); +} + +void Perl_Mob_SetAppearance(Mob* self, int app) // @categories Stats and Attributes +{ + self->SetAppearance(static_cast(app)); +} + +void Perl_Mob_SetAppearance(Mob* self, int app, bool ignore_self) // @categories Stats and Attributes +{ + self->SetAppearance(static_cast(app), ignore_self); +} + +int Perl_Mob_GetAppearance(Mob* self) // @categories Stats and Attributes +{ + return self->GetAppearance(); +} + +int Perl_Mob_GetRunAnimSpeed(Mob* self) // @categories Stats and Attributes +{ + return self->GetRunAnimSpeed(); +} + +void Perl_Mob_SetRunAnimSpeed(Mob* self, int8 speed) // @categories Stats and Attributes +{ + self->SetRunAnimSpeed(speed); +} + +void Perl_Mob_SetPetID(Mob* self, uint16 new_pet_id) // @categories Pet +{ + self->SetPetID(new_pet_id); +} + +int Perl_Mob_GetPetID(Mob* self) // @categories Script Utility, Pet +{ + return self->GetPetID(); +} + +void Perl_Mob_SetOwnerID(Mob* self, uint16 new_owner_id) // @categories Pet +{ + self->SetOwnerID(new_owner_id); +} + +int Perl_Mob_GetOwnerID(Mob* self) // @categories Script Utility, Pet +{ + return self->GetOwnerID(); +} + +int Perl_Mob_GetPetType(Mob* self) // @categories Script Utility, Pet +{ + return self->GetPetType(); +} + +int Perl_Mob_GetBodyType(Mob* self) // @categories Stats and Attributes +{ + return self->GetBodyType(); +} + +void Perl_Mob_Stun(Mob* self, int duration) +{ + self->Stun(duration); +} + +void Perl_Mob_Spin(Mob* self) // @categories Script Utility +{ + self->Spin(); +} + +void Perl_Mob_Kill(Mob* self) // @categories Script Utility +{ + self->Kill(); +} + +void Perl_Mob_SetInvul(Mob* self, bool value) // @categories Script Utility +{ + self->SetInvul(value); +} + +bool Perl_Mob_GetInvul(Mob* self) // @categories Script Utility, Stats and Attributes +{ + return self->GetInvul(); +} + +void Perl_Mob_SetExtraHaste(Mob* self, int haste) // @categories Script Utility, Stats and Attributes +{ + self->SetExtraHaste(haste); +} + +int Perl_Mob_GetHaste(Mob* self) // @categories Stats and Attributes +{ + return self->GetHaste(); +} + +int Perl_Mob_GetHandToHandDamage(Mob* self) // @categories Stats and Attributes +{ + return self->GetHandToHandDamage(); +} + +bool Perl_Mob_CanThisClassDoubleAttack(Mob* self) // @categories Skills and Recipes +{ + return self->CanThisClassDoubleAttack(); +} + +bool Perl_Mob_CanThisClassDualWield(Mob* self) // @categories Skills and Recipes +{ + return self->CanThisClassDualWield(); +} + +bool Perl_Mob_CanThisClassRiposte(Mob* self) // @categories Skills and Recipes +{ + return self->CanThisClassRiposte(); +} + +bool Perl_Mob_CanThisClassDodge(Mob* self) // @categories Skills and Recipes +{ + return self->CanThisClassDodge(); +} + +bool Perl_Mob_CanThisClassParry(Mob* self) // @categories Skills and Recipes +{ + return self->CanThisClassParry(); +} + +int Perl_Mob_GetHandToHandDelay(Mob* self) // @categories Stats and Attributes +{ + return self->GetHandToHandDelay(); +} + +int Perl_Mob_GetClassLevelFactor(Mob* self) // @categories Stats and Attributes +{ + return self->GetClassLevelFactor(); +} + +void Perl_Mob_Mesmerize(Mob* self) // @categories Script Utility +{ + self->Mesmerize(); +} + +bool Perl_Mob_IsMezzed(Mob* self) // @categories Script Utility +{ + return self->IsMezzed(); +} + +bool Perl_Mob_IsStunned(Mob* self) // @categories Script Utility +{ + return self->IsStunned(); +} + +void Perl_Mob_StartEnrage(Mob* self) // @categories Script Utility +{ + self->StartEnrage(); +} + +bool Perl_Mob_IsEnraged(Mob* self) // @categories Script Utility +{ + return self->IsEnraged(); +} + +int Perl_Mob_GetReverseFactionCon(Mob* self, Mob* other) // @categories Faction +{ + return self->GetReverseFactionCon(other); +} + +bool Perl_Mob_IsAIControlled(Mob* self) // @categories Script Utility +{ + return self->IsAIControlled(); +} + +float Perl_Mob_GetAggroRange(Mob* self) // @categories Stats and Attributes, Hate and Aggro +{ + return self->GetAggroRange(); +} + +float Perl_Mob_GetAssistRange(Mob* self) // @categories Stats and Attributes, Hate and Aggro +{ + return self->GetAssistRange(); +} + +void Perl_Mob_SetPetOrder(Mob* self, int order) // @categories Pet +{ + self->SetPetOrder(static_cast(order)); +} + +int Perl_Mob_GetPetOrder(Mob* self) // @categories Script Utility, Pet +{ + return self->GetPetOrder(); +} + +bool Perl_Mob_IsRoamer(Mob* self) // @categories Script Utility, Spawns +{ + return self->IsRoamer(); +} + +bool Perl_Mob_IsRooted(Mob* self) // @categories Script Utility +{ + return self->IsRooted(); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other) // @categories Hate and Aggro +{ + self->AddToHateList(other); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other, int64_t hate) // @categories Hate and Aggro +{ + self->AddToHateList(other, hate); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other, int64_t hate, int64_t damage) // @categories Hate and Aggro +{ + self->AddToHateList(other, hate, damage); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other, int64_t hate, int64_t damage, bool yell_for_help) // @categories Hate and Aggro +{ + self->AddToHateList(other, hate, damage, yell_for_help); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other, int64_t hate, int64_t damage, bool yell_for_help, bool frenzy) // @categories Hate and Aggro +{ + self->AddToHateList(other, hate, damage, yell_for_help, frenzy); +} + +void Perl_Mob_AddToHateList(Mob* self, Mob* other, int64_t hate, int64_t damage, bool yell_for_help, bool frenzy, bool buff_tic) // @categories Hate and Aggro +{ + self->AddToHateList(other, hate, damage, yell_for_help, frenzy, buff_tic); +} + +void Perl_Mob_SetHate(Mob* self, Mob* other) // @categories Hate and Aggro +{ + self->SetHateAmountOnEnt(other); +} + +void Perl_Mob_SetHate(Mob* self, Mob* other, int64_t hate) // @categories Hate and Aggro +{ + self->SetHateAmountOnEnt(other, hate); +} + +void Perl_Mob_SetHate(Mob* self, Mob* other, int64_t hate, int64_t damage) // @categories Hate and Aggro +{ + self->SetHateAmountOnEnt(other, hate, damage); +} + +void Perl_Mob_HalveAggro(Mob* self, Mob* other) // @categories Hate and Aggro +{ + self->HalveAggro(other); +} + +void Perl_Mob_DoubleAggro(Mob* self, Mob* other) // @categories Hate and Aggro +{ + self->DoubleAggro(other); +} + +int64_t Perl_Mob_GetHateAmount(Mob* self, Mob* target) // @categories Hate and Aggro +{ + return self->GetHateAmount(target); +} + +int64_t Perl_Mob_GetHateAmount(Mob* self, Mob* target, bool is_damage) // @categories Hate and Aggro +{ + return self->GetHateAmount(target, is_damage); +} + +int64_t Perl_Mob_GetDamageAmount(Mob* self, Mob* target) // @categories Stats and Attributes +{ + return self->GetDamageAmount(target); +} + +Mob* Perl_Mob_GetHateTop(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateTop(); +} + +Mob* Perl_Mob_GetHateDamageTop(Mob* self, Mob* other) // @categories Hate and Aggro +{ + return self->GetHateDamageTop(other); +} + +Mob* Perl_Mob_GetHateRandom(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateRandom(); +} + +bool Perl_Mob_IsEngaged(Mob* self) // @categories Script Utility +{ + return self->IsEngaged(); +} + +bool Perl_Mob_HateSummon(Mob* self) // @categories Hate and Aggro +{ + return self->HateSummon(); +} + +void Perl_Mob_FaceTarget(Mob* self) // @categories Script Utility +{ + self->FaceTarget(); +} + +void Perl_Mob_FaceTarget(Mob* self, Mob* target) // @categories Script Utility +{ + self->FaceTarget(target); +} + +void Perl_Mob_SetHeading(Mob* self, float heading) // @categories Script Utility +{ + self->SetHeading(heading); +} + +void Perl_Mob_WipeHateList(Mob* self) // @categories Hate and Aggro +{ + self->WipeHateList(); +} + +bool Perl_Mob_CheckAggro(Mob* self, Mob* other) // @categories Hate and Aggro +{ + return self->CheckAggro(other); +} + +float Perl_Mob_CalculateHeadingToTarget(Mob* self, float x, float y) // @categories Script Utility +{ + return self->CalculateHeadingToTarget(x, y); +} + +void Perl_Mob_RunTo(Mob* self, float x, float y, float z) +{ + self->RunTo(x, y, z); +} + +void Perl_Mob_WalkTo(Mob* self, float x, float y, float z) +{ + self->WalkTo(x, y, z); +} + +void Perl_Mob_NavigateTo(Mob* self, float x, float y, float z) // @categories Script Utility +{ + self->NavigateTo(x, y, z); +} + +void Perl_Mob_StopNavigation(Mob* self) +{ + self->StopNavigation(); +} + +float Perl_Mob_CalculateDistance(Mob* self, float x, float y, float z) // @categories Script Utility +{ + return self->CalculateDistance(x, y, z); +} + +void Perl_Mob_SendTo(Mob* self, float new_x, float new_y, float new_z) // @categories Script Utility +{ + self->SendTo(new_x, new_y, new_z); +} + +void Perl_Mob_SendToFixZ(Mob* self, float new_x, float new_y, float new_z) // @categories Script Utility +{ + self->SendToFixZ(new_x, new_y, new_z); +} + +void Perl_Mob_NPCSpecialAttacks(Mob* self, const char* abilities_string, int perm_tag) // @categories Stats and Attributes +{ + self->NPCSpecialAttacks(abilities_string, perm_tag); +} + +void Perl_Mob_NPCSpecialAttacks(Mob* self, const char* abilities_string, int perm_tag, bool reset) // @categories Stats and Attributes +{ + self->NPCSpecialAttacks(abilities_string, perm_tag, reset); +} + +void Perl_Mob_NPCSpecialAttacks(Mob* self, const char* abilities_string, int perm_tag, bool reset, bool remove) // @categories Stats and Attributes +{ + self->NPCSpecialAttacks(abilities_string, perm_tag, reset, remove); +} + +uint32_t Perl_Mob_DontHealMeBefore(Mob* self) // @categories Script Utility +{ + return self->DontHealMeBefore(); +} + +uint32_t Perl_Mob_DontBuffMeBefore(Mob* self) // @categories Script Utility +{ + return self->DontBuffMeBefore(); +} + +uint32_t Perl_Mob_DontDotMeBefore(Mob* self) // @categories Script Utility +{ + return self->DontDotMeBefore(); +} + +uint32_t Perl_Mob_DontRootMeBefore(Mob* self) // @categories Script Utility +{ + return self->DontRootMeBefore(); +} + +uint32_t Perl_Mob_DontSnareMeBefore(Mob* self) // @categories Script Utility +{ + return self->DontSnareMeBefore(); +} + +int Perl_Mob_GetResist(Mob* self, uint8_t type) // @categories Stats and Attributes +{ + return self->GetResist(type); +} + +bool Perl_Mob_Charmed(Mob* self) // @categories Script Utility +{ + return self->Charmed(); +} + +uint32_t Perl_Mob_GetLevelHP(Mob* self, uint8 level) // @categories Stats and Attributes +{ + return self->GetLevelHP(level); +} + +uint32_t Perl_Mob_GetZoneID(Mob* self) // @categories Zones +{ + return self->GetZoneID(); +} + +int Perl_Mob_CheckAggroAmount(Mob* self, uint16 spell_id) // @categories Hate and Aggro +{ + return self->CheckAggroAmount(spell_id, nullptr); +} + +int Perl_Mob_CheckHealAggroAmount(Mob* self, uint16 spell_id) // @categories Hate and Aggro +{ + return self->CheckHealAggroAmount(spell_id, nullptr); +} + +int Perl_Mob_CheckHealAggroAmount(Mob* self, uint16 spell_id, uint32 possible) // @categories Hate and Aggro +{ + return self->CheckHealAggroAmount(spell_id, nullptr, possible); +} + +uint32_t Perl_Mob_GetAA(Mob* self, uint32 rank_id) // @categories Alternative Advancement +{ + return self->GetAA(rank_id); +} + +uint32_t Perl_Mob_GetAAByAAID(Mob* self, uint32 aa_id) // @categories Alternative Advancement +{ + return self->GetAAByAAID(aa_id); +} + +bool Perl_Mob_SetAA(Mob* self, int aa_id, int points) // @categories Alternative Advancement, Script Utility +{ + return self->SetAA(aa_id, points); +} + +bool Perl_Mob_SetAA(Mob* self, int aa_id, int points, int charges) // @categories Alternative Advancement, Script Utility +{ + return self->SetAA(aa_id, points, charges); +} + +bool Perl_Mob_DivineAura(Mob* self) // @categories Spells and Disciplines +{ + return self->DivineAura(); +} + +void Perl_Mob_AddFeignMemory(Mob* self, Client* attacker) // @categories Script Utility +{ + self->AddFeignMemory(attacker); +} + +void Perl_Mob_RemoveFromFeignMemory(Mob* self, Client* attacker) // @categories Script Utility, Hate and Aggro +{ + self->RemoveFromFeignMemory(attacker); +} + +void Perl_Mob_ClearFeignMemory(Mob* self) // @categories Script Utility, Hate and Aggro +{ + self->ClearFeignMemory(); +} + +void Perl_Mob_SetOOCRegen(Mob* self, int64 new_ooc_regen) // @categories Stats and Attributes +{ + self->SetOOCRegen(new_ooc_regen); +} + +const char* Perl_Mob_GetEntityVariable(Mob* self, const char* id) // @categories Script Utility +{ + // supports possible nullptr return + return self->GetEntityVariable(id); +} + +bool Perl_Mob_EntityVariableExists(Mob* self, const char* id) +{ + return self->EntityVariableExists(id); +} + +void Perl_Mob_SetEntityVariable(Mob* self, const char* id, const char* var) // @categories Script Utility +{ + self->SetEntityVariable(id, var); +} + +perl::array Perl_Mob_GetHateList(Mob* self) +{ + perl::array result; + auto hate_list = self->GetHateList(); + for (struct_HateList* entry : hate_list) + { + result.push_back(entry); + } + return result; +} + +void Perl_Mob_SignalClient(Mob* self, Client* client, uint32 data) // @categories Script Utility +{ + client->Signal(data); +} + +bool Perl_Mob_CombatRange(Mob* self, Mob* target) // @categories Script Utility +{ + return self->CombatRange(target); +} + +void Perl_Mob_DoSpecialAttackDamage(Mob* self, Mob* other, int skill, int max_damage) // @categories Script Utility, Skills and Attributes +{ + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage); +} + +void Perl_Mob_DoSpecialAttackDamage(Mob* self, Mob* other, int skill, int max_damage, int min_damage) // @categories Script Utility, Skills and Attributes +{ + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage); +} + +void Perl_Mob_DoSpecialAttackDamage(Mob* self, Mob* other, int skill, int max_damage, int min_damage, int hate_override) // @categories Script Utility, Skills and Attributes +{ + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override); +} + +void Perl_Mob_DoSpecialAttackDamage(Mob* self, Mob* other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time) // @categories Script Utility, Skills and Attributes +{ + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time); +} + +bool Perl_Mob_CheckLoS(Mob* self, Mob* other) // @categories Script Utility +{ + return self->CheckLosFN(other); +} + +bool Perl_Mob_CheckLoSToLoc(Mob* self, float x, float y, float z) +{ + return self->CheckLosFN(x, y, z, 6.0f); +} + +bool Perl_Mob_CheckLoSToLoc(Mob* self, float x, float y, float z, float mob_size) // @categories Script Utility +{ + return self->CheckLosFN(x, y, z, mob_size); +} + +float Perl_Mob_FindGroundZ(Mob* self, float x, float y) +{ + return self->GetGroundZ(x, y); +} + +float Perl_Mob_FindGroundZ(Mob* self, float x, float y, float z_offset) // @categories Script Utility +{ + return self->GetGroundZ(x, y, z_offset); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow, float speed) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow, speed); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow, float speed, float angle) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow, speed, angle); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow, float speed, float angle, float tilt) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow, speed, angle, tilt); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow, float speed, float angle, float tilt, float arc) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow, speed, angle, tilt, arc); +} + +void Perl_Mob_ProjectileAnim(Mob* self, Mob* to, int item_id, bool is_arrow, float speed, float angle, float tilt, float arc, const char* idfile) // @categories Script Utility +{ + self->ProjectileAnimation(to, item_id, is_arrow, speed, angle, tilt, arc, idfile); +} + +bool Perl_Mob_HasNPCSpecialAtk(Mob* self, const char* ability_string) // @categories Stats and Attributes +{ + return self->HasNPCSpecialAtk(ability_string); +} + +// todo: SendAppearanceEffect should be changed to use a table for arguments +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, 0, 0); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, 0); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get()); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3, uint32 ground3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3, ground3); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3, uint32 ground3, uint32 slot4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3, ground3, slot4); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3, uint32 ground3, uint32 slot4, uint32 ground4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3, ground3, slot4, ground4); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3, uint32 ground3, uint32 slot4, uint32 ground4, uint32 slot5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3, ground3, slot4, ground4, slot5); +} + +void Perl_Mob_SendAppearanceEffect(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, perl::nullable client, uint32 slot1, uint32 ground1, uint32 slot2, uint32 ground2, uint32 slot3, uint32 ground3, uint32 slot4, uint32 ground4, uint32 slot5, uint32 ground5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client.get(), slot1, ground1, slot2, ground2, slot3, ground3, slot4, ground4, slot5, ground5); +} + +// todo: SendAppearanceEffectActor should be changed to use a table for arguments +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, 0, 0, 0, 0, nullptr, slot1, 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, 0, 0, 0, nullptr, slot1, 0, 0, 0, 0, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, 0, 0, 0, nullptr, slot1, 0, slot2, 0, 0, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, 0, 0, nullptr, slot1, 0, slot2, 0, 0, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, 0, 0, nullptr, slot1, 0, slot2, 0, slot3, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3, int32 parm4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, 0, nullptr, slot1, 0, slot2, 0, slot3, 0, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3, int32 parm4, uint32 slot4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, 0, nullptr, slot1, 0, slot2, 0, slot3, 0, slot4, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3, int32 parm4, uint32 slot4, int32 parm5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, nullptr, slot1, 0, slot2, 0, slot3, 0, slot4, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3, int32 parm4, uint32 slot4, int32 parm5, uint32 slot5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, nullptr, slot1, 0, slot2, 0, slot3, 0, slot4, 0, slot5, 0); +} + +void Perl_Mob_SendAppearanceEffectActor(Mob* self, int32 parm1, uint32 slot1, int32 parm2, uint32 slot2, int32 parm3, uint32 slot3, int32 parm4, uint32 slot4, int32 parm5, uint32 slot5, Client* client) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client, slot1, 0, slot2, 0, slot3, 0, slot4, 0, slot5, 0); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, 0, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, 0, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2, int32 parm3) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, 0, 0); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, 0); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5); +} + +void Perl_Mob_SendAppearanceEffectGround(Mob* self, int32 parm1, int32 parm2, int32 parm3, int32 parm4, int32 parm5, Client* client) // @categories Script Utility +{ + self->SendAppearanceEffect(parm1, parm2, parm3, parm4, parm5, client); +} + +void Perl_Mob_RemoveAllAppearanceEffects(Mob* self) // @categories Script Utility +{ + self->SendIllusionPacket(self->GetRace(), self->GetGender(), self->GetTexture(), self->GetHelmTexture(), + self->GetHairColor(), self->GetBeardColor(), self->GetEyeColor1(), self->GetEyeColor2(), + self->GetHairStyle(), self->GetLuclinFace(), self->GetBeard(), 0xFF, + self->GetDrakkinHeritage(), self->GetDrakkinTattoo(), self->GetDrakkinDetails(), self->GetSize(), false); + self->ClearAppearenceEffects(); +} + +void Perl_Mob_SetFlyMode(Mob* self, int flymode) // @categories Script Utility +{ + self->SetFlyMode(static_cast(flymode)); +} + +void Perl_Mob_SetTexture(Mob* self, int32 texture) // @categories Stats and Attributes +{ + self->SendIllusionPacket(self->GetRace(), 0xFF, texture); +} + +void Perl_Mob_SetRace(Mob* self, int32 race) // @categories Stats and Attributes +{ + self->SendIllusionPacket(race); +} + +void Perl_Mob_SetGender(Mob* self, int32 gender) // @categories Stats and Attributes +{ + self->SendIllusionPacket(self->GetRace(), gender); +} + +// todo: SendIllusion should be sent in a hash like lua +void Perl_Mob_SendIllusion(Mob* self, uint16 race) // @categories Script Utility +{ + self->SendIllusionPacket(race); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, face); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, 0xFF, 0xFF, 0xFF, 0xFF, hairstyle, face); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, 0xFF, 0xFF, 0xFF, hairstyle, face); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, 0xFF, 0xFF, 0xFF, hairstyle, face, beard); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo, uint32 drakkin_details) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details); +} + +void Perl_Mob_SendIllusion(Mob* self, uint16 race, uint8 gender, uint8 texture, uint8 helmtexture, uint8 face, uint8 hairstyle, uint8 haircolor, uint8 beard, uint8 beardcolor, uint32 drakkin_heritage, uint32 drakkin_tattoo, uint32 drakkin_details, float size) // @categories Script Utility +{ + self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, 0xFF, 0xFF, hairstyle, face, beard, 0xFF, drakkin_heritage, drakkin_tattoo, drakkin_details, size); +} + +void Perl_Mob_CameraEffect(Mob* self, uint32 duration) // @categories Script Utility +{ + self->CameraEffect(duration, 0); +} + +void Perl_Mob_CameraEffect(Mob* self, uint32 duration, uint32 intensity) // @categories Script Utility +{ + self->CameraEffect(duration, intensity); +} + +void Perl_Mob_CameraEffect(Mob* self, uint32 duration, uint32 intensity, Client* client) // @categories Script Utility +{ + self->CameraEffect(duration, intensity, client); +} + +void Perl_Mob_CameraEffect(Mob* self, uint32 duration, uint32 intensity, perl::nullable client, bool global) // @categories Script Utility +{ + self->CameraEffect(duration, intensity, client.get(), global); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, 5000, 0, true, 3000); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, 0, true, 3000); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, true, 3000); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, 3000); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect, Client* client) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, client); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect, perl::nullable client, uint32 caster_id) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, client.get(), caster_id); +} + +void Perl_Mob_SpellEffect(Mob* self, uint32 effect, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk20, bool perm_effect, perl::nullable client, uint32 caster_id, uint32 target_id) // @categories Spells and Disciplines +{ + self->SendSpellEffect(effect, duration, finish_delay, zone_wide, unk20, perm_effect, client.get(), caster_id, target_id); +} + +void Perl_Mob_TempName(Mob* self) // @categories Script Utility +{ + self->TempName(); +} + +void Perl_Mob_TempName(Mob* self, const char* name) // @categories Script Utility +{ + self->TempName(name); +} + +int Perl_Mob_GetItemStat(Mob* self, uint32 item_id, const char* stat) // @categories Inventory and Items, Stats and Attributes +{ + return self->GetItemStat(item_id, stat); +} + +std::string Perl_Mob_GetGlobal(Mob* self, const char* varname) +{ + return self->GetGlobal(varname); +} + +void Perl_Mob_SetGlobal(Mob* self, const char* varname, const char* newvalue, int options, const char* duration) +{ + self->SetGlobal(varname, newvalue, options, duration); +} + +void Perl_Mob_SetGlobal(Mob* self, const char* varname, const char* newvalue, int options, const char* duration, Mob* other) +{ + self->SetGlobal(varname, newvalue, options, duration, other); +} + +void Perl_Mob_TarGlobal(Mob* self, const char* varname, const char* value, const char* duration, int npc_id, int char_id, int zone_id) +{ + self->TarGlobal(varname, value, duration, npc_id, char_id, zone_id); +} + +void Perl_Mob_DelGlobal(Mob* self, const char* var_name) +{ + self->DelGlobal(var_name); +} + +void Perl_Mob_SetSlotTint(Mob* self, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint) // @categories Stats and Attributes +{ + self->SetSlotTint(material_slot, red_tint, green_tint, blue_tint); +} + +void Perl_Mob_WearChange(Mob* self, uint8 material_slot, uint16 texture, uint32 color) // @categories Script Utility +{ + self->WearChange(material_slot, texture, color); +} + +void Perl_Mob_WearChange(Mob* self, uint8 material_slot, uint16 texture, uint32 color, uint32 hero_forge_model) // @categories Script Utility +{ + self->WearChange(material_slot, texture, color, hero_forge_model); +} + +void Perl_Mob_DoKnockback(Mob* self, Mob* caster, uint32 push_back, uint32 push_up) // @categories Script Utility +{ + self->DoKnockback(caster, push_back, push_up); +} + +void Perl_Mob_RemoveNimbusEffect(Mob* self, int effect_id) // @categories Script Utility +{ + self->RemoveNimbusEffect(effect_id); +} + +void Perl_Mob_SetRunning(Mob* self, bool value) // @categories Script Utility +{ + self->SetRunning(value); +} + +bool Perl_Mob_IsRunning(Mob* self) // @categories Script Utility +{ + return self->IsRunning(); +} + +void Perl_Mob_SetBodyType(Mob* self, int32 type) // @categories Stats and Attributes +{ + self->SetBodyType(static_cast(type), false); +} + +void Perl_Mob_SetBodyType(Mob* self, int32 type, bool overwrite_orig) // @categories Stats and Attributes +{ + self->SetBodyType(static_cast(type), overwrite_orig); +} + +void Perl_Mob_SetDeltas(Mob* self, float delta_x, float delta_y, float delta_z, float delta_h) // @categories Script Utility +{ + auto delta = glm::vec4(delta_x, delta_y, delta_z, delta_h); + self->SetDelta(delta); +} + +void Perl_Mob_SetLD(Mob* self, bool value) // @categories Script Utility +{ + self->SendAppearancePacket(AT_Linkdead, value); +} + +void Perl_Mob_SetTargetable(Mob* self, bool on) // @categories Stats and Attributes +{ + self->SetTargetable(on); +} + +void Perl_Mob_ModSkillDmgTaken(Mob* self, int skill, int16 value) // @categories Skills and Recipes, Script Utility +{ + self->ModSkillDmgTaken(static_cast(skill), value); +} + +int Perl_Mob_GetModSkillDmgTaken(Mob* self, int skill_id) // @categories Stats and Attributes +{ + return self->GetModSkillDmgTaken(static_cast(skill_id)); +} + +int Perl_Mob_GetSkillDmgTaken(Mob* self, int skill_id) // @categories Skills and Recipes, Script Utility +{ + return self->GetSkillDmgTaken(static_cast(skill_id)); +} + +void Perl_Mob_SetAllowBeneficial(Mob* self, bool value) // @categories Stats and Attributes +{ + self->SetAllowBeneficial(value); +} + +bool Perl_Mob_GetAllowBeneficial(Mob* self) // @categories Stats and Attributes +{ + return self->GetAllowBeneficial(); +} + +bool Perl_Mob_IsBeneficialAllowed(Mob* self, Mob* target) // @categories Stats and Attributes +{ + return self->IsBeneficialAllowed(target); +} + +void Perl_Mob_ModVulnerability(Mob* self, uint8 resist, int16 value) // @categories Stats and Attributes +{ + self->ModVulnerability(resist, value); +} + +int Perl_Mob_GetModVulnerability(Mob* self, uint8 resist) // @categories Stats and Attributes +{ + return self->GetModVulnerability(resist); +} + +void Perl_Mob_DoMeleeSkillAttackDmg(Mob* self, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte) // @categories Script Utility, Skills and Attributes +{ + self->DoMeleeSkillAttackDmg(target, weapon_damage, static_cast(skill), chance_mod, focus, can_riposte); +} + +void Perl_Mob_DoArcheryAttackDmg(Mob* self, Mob* target, uint16 weapon_damage, int16 chance_mod, int16 focus) // @categories Script Utility, Skills and Attributes +{ + self->DoArcheryAttackDmg(target, nullptr, nullptr, weapon_damage, chance_mod, focus); +} + +void Perl_Mob_DoThrowingAttackDmg(Mob* self, Mob* target, uint16 weapon_damage, int16 chance_mod, int16 focus) // @categories Script Utility, Skills and Attributes +{ + self->DoThrowingAttackDmg(target, nullptr, nullptr, weapon_damage, chance_mod, focus); +} + +void Perl_Mob_SetDisableMelee(Mob* self, bool value) // @categories Script Utility, Stats and Attributes +{ + self->SetDisableMelee(value); +} + +bool Perl_Mob_IsMeleeDisabled(Mob* self) // @categories Stats and Attributes +{ + return self->IsMeleeDisabled(); +} + +void Perl_Mob_SetFlurryChance(Mob* self, uint8 value) // @categories Stats and Attributes +{ + self->SetFlurryChance(value); +} + +int Perl_Mob_GetFlurryChance(Mob* self) // @categories Stats and Attributes +{ + return self->GetFlurryChance(); +} + +int Perl_Mob_GetSpellStat(Mob* self, uint32 spell_id, const char* stat) // @categories Spells and Disciplines +{ + return self->GetSpellStat(spell_id, stat); +} + +int Perl_Mob_GetSpellStat(Mob* self, uint32 spell_id, const char* stat, uint8 slot) // @categories Spells and Disciplines +{ + return self->GetSpellStat(spell_id, stat, slot); +} + +int Perl_Mob_GetBuffStatValueBySpell(Mob* self, int spell_id, const char* stat) // @categories Spells and Disciplines +{ + return self->GetBuffStatValueBySpell(spell_id, stat); +} + +int Perl_Mob_GetBuffStatValueBySlot(Mob* self, uint8 slot, const char* stat)// @categories Script Utility, Spells and Disciplines +{ + return self->GetBuffStatValueBySlot(slot, stat); +} + +int Perl_Mob_GetSpecialAbility(Mob* self, int ability) // @categories Stats and Attributes +{ + return self->GetSpecialAbility(ability); +} + +int Perl_Mob_GetSpecialAbilityParam(Mob* self, int ability, int param) // @categories Stats and Attributes +{ + return self->GetSpecialAbilityParam(ability, param); +} + +void Perl_Mob_SetSpecialAbility(Mob* self, int ability, int value) // @categories Stats and Attributes +{ + self->SetSpecialAbility(ability, value); +} + +void Perl_Mob_SetSpecialAbilityParam(Mob* self, int ability, int param, int value) // @categories Stats and Attributes +{ + self->SetSpecialAbilityParam(ability, param, value); +} + +void Perl_Mob_ClearSpecialAbilities(Mob* self)// @categories Script Utility +{ + self->ClearSpecialAbilities(); +} + +void Perl_Mob_ProcessSpecialAbilities(Mob* self, std::string str) // @categories Script Utility +{ + self->ProcessSpecialAbilities(str); +} + +bool Perl_Mob_CanClassEquipItem(Mob* self, uint32 item_id) // @categories Inventory and Items, Script Utility +{ + return self->CanClassEquipItem(item_id); +} + +bool Perl_Mob_IsFeared(Mob* self) // @categories Script Utility +{ + return self->IsFeared(); +} + +bool Perl_Mob_IsBlind(Mob* self) // @categories Script Utility +{ + return self->IsBlind(); +} + +int Perl_Mob_GetInvisibleLevel(Mob* self) // @categories Stats and Attributes +{ + return self->GetInvisibleLevel(); +} + +int Perl_Mob_GetInvisibleUndeadLevel(Mob* self) // @categories Stats and Attributes +{ + return self->GetInvisibleUndeadLevel(); +} + +int Perl_Mob_SeeInvisible(Mob* self) // @categories Stats and Attributes +{ + return self->SeeInvisible(); +} + +int Perl_Mob_SeeInvisibleUndead(Mob* self) // @categories Stats and Attributes +{ + return self->SeeInvisibleUndead(); +} + +bool Perl_Mob_SeeHide(Mob* self) // @categories Stats and Attributes +{ + return self->SeeHide(); +} + +bool Perl_Mob_SeeImprovedHide(Mob* self) // @categories Stats and Attributes +{ + return self->SeeImprovedHide(); +} + +int Perl_Mob_GetNimbusEffect1(Mob* self) // @categories Script Utility +{ + return self->GetNimbusEffect1(); +} + +int Perl_Mob_GetNimbusEffect2(Mob* self) // @categories Script Utility +{ + return self->GetNimbusEffect2(); +} + +int Perl_Mob_GetNimbusEffect3(Mob* self) // @categories Script Utility +{ + return self->GetNimbusEffect3(); +} + +bool Perl_Mob_IsTargetable(Mob* self) // @categories Stats and Attributes +{ + return self->IsTargetable(); +} + +bool Perl_Mob_HasShieldEquiped(Mob* self) // @categories Stats and Attributes +{ + return self->HasShieldEquiped(); +} + +bool Perl_Mob_HasTwoHandBluntEquiped(Mob* self) // @categories Stats and Attributes +{ + return self->HasTwoHandBluntEquiped(); +} + +bool Perl_Mob_HasTwoHanderEquipped(Mob* self) // @categories Stats and Attributes +{ + return self->HasTwoHanderEquipped(); +} + +int32_t Perl_Mob_GetHerosForgeModel(Mob* self, uint8_t material_slot) // @categories Stats and Attributes +{ + return self->GetHerosForgeModel(material_slot); +} + +bool Perl_Mob_IsEliteMaterialItem(Mob* self, uint8_t material_slot) // @categories Script Utility, Stats and Attributes +{ + return self->IsEliteMaterialItem(material_slot); +} + +float Perl_Mob_GetBaseSize(Mob* self) // @categories Stats and Attributes +{ + return self->GetBaseSize(); +} + +bool Perl_Mob_HasOwner(Mob* self) // @categories Pet +{ + return self->HasOwner(); +} + +bool Perl_Mob_IsPet(Mob* self) // @categories Pet +{ + return self->IsPet(); +} + +bool Perl_Mob_HasPet(Mob* self) // @categories Pet +{ + return self->HasPet(); +} + +void Perl_Mob_RemovePet(Mob* self) // @categories Pet +{ + self->SetPet(nullptr); +} + +void Perl_Mob_SetPet(Mob* self, Mob* new_pet) // @categories Pet +{ + self->SetPet(new_pet); +} + +bool Perl_Mob_IsSilenced(Mob* self) // @categories Script Utility +{ + return self->IsSilenced(); +} + +bool Perl_Mob_IsAmnesiad(Mob* self) // @categories Script Utility +{ + return self->IsAmnesiad(); +} + +int32_t Perl_Mob_GetMeleeMitigation(Mob* self) // @categories Stats and Attributes +{ + return self->GetMeleeMitigation(); +} + +void Perl_Mob_TryMoveAlong(Mob* self, float distance, float angle) // @categories Script Utility +{ + self->TryMoveAlong(distance, angle); +} + +void Perl_Mob_TryMoveAlong(Mob* self, float distance, float angle, bool send) // @categories Script Utility +{ + self->TryMoveAlong(distance, angle, send); +} + +std::string Perl_Mob_GetClassName(Mob* self) +{ + return GetClassIDName(self->GetClass()); +} + +std::string Perl_Mob_GetRaceName(Mob* self) +{ + return GetRaceIDName(self->GetRace()); +} + +void Perl_Mob_DeleteBucket(Mob* self, std::string bucket_name) // @categories Script Utility +{ + self->DeleteBucket(bucket_name); +} + +std::string Perl_Mob_GetBucket(Mob* self, std::string bucket_name) // @categories Script Utility +{ + return self->GetBucket(bucket_name); +} + +std::string Perl_Mob_GetBucketExpires(Mob* self, std::string bucket_name) // @categories Script Utility +{ + return self->GetBucketExpires(bucket_name); +} + +std::string Perl_Mob_GetBucketKey(Mob* self) // @categories Script Utility +{ + return self->GetBucketKey(); +} + +std::string Perl_Mob_GetBucketRemaining(Mob* self, std::string bucket_name) // @categories Script Utility +{ + return self->GetBucketRemaining(bucket_name); +} + +void Perl_Mob_SetBucket(Mob* self, std::string bucket_name, std::string bucket_value) // @categories Script Utility +{ + self->SetBucket(bucket_name, bucket_value); +} + +void Perl_Mob_SetBucket(Mob* self, std::string bucket_name, std::string bucket_value, std::string expiration) // @categories Script Utility +{ + self->SetBucket(bucket_name, bucket_value, expiration); +} + +bool Perl_Mob_IsHorse(Mob* self) // @categories Script Utility +{ + return self->IsHorse(); +} + +perl::array Perl_Mob_GetHateListByDistance(Mob* self) // @categories Hate and Aggro +{ + perl::array result; + auto list = self->GetHateListByDistance(); + for (auto hate_entry : list) + { + result.push_back(hate_entry); + } + return result; +} + +perl::array Perl_Mob_GetHateListByDistance(Mob* self, int distance) // @categories Hate and Aggro +{ + perl::array result; + auto list = self->GetHateListByDistance(distance); + for (auto hate_entry : list) + { + result.push_back(hate_entry); + } + return result; +} + +Mob* Perl_Mob_GetHateClosest(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateClosest(); +} + +std::string Perl_Mob_GetLastName(Mob* self) // @categories Script Utility +{ + return self->GetLastName(); +} + +bool Perl_Mob_CanRaceEquipItem(Mob* self, uint32 item_id) // @categories Inventory and Items, Script Utility +{ + return self->CanRaceEquipItem(item_id); +} + +void Perl_Mob_RemoveAllNimbusEffects(Mob* self) // @categories Script Utility +{ + self->RemoveAllNimbusEffects(); +} + +void Perl_Mob_AddNimbusEffect(Mob* self, int effect_id) // @categories Script Utility +{ + self->AddNimbusEffect(effect_id); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance, int32 shield_duration) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance, shield_duration); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance, int32 shield_duration, int32 shield_target_mitigation) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance, int32 shield_duration, int32 shield_target_mitigation, int32 shielder_mitigation) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation, shielder_mitigation); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance, int32 shield_duration, int32 shield_target_mitigation, int32 shielder_mitigation, bool use_aa) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation, shielder_mitigation, use_aa); +} + +void Perl_Mob_ShieldAbility(Mob* self, uint32 target_id, int32 shielder_max_distance, int32 shield_duration, int32 shield_target_mitigation, int32 shielder_mitigation, bool use_aa, bool can_shield_npc) // @categories Spells and Disciplines +{ + self->ShieldAbility(target_id, shielder_max_distance, shield_duration, shield_target_mitigation, shielder_mitigation, use_aa, can_shield_npc); +} + +Client* Perl_Mob_GetHateRandomClient(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateRandomClient(); +} + +NPC* Perl_Mob_GetHateRandomNPC(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateRandomNPC(); +} + +void Perl_Mob_SetBuffDuration(Mob* self, int spell_id) // @categories Script Utility, Spells and Disciplines +{ + self->SetBuffDuration(spell_id); +} + +void Perl_Mob_SetBuffDuration(Mob* self, int spell_id, int duration) // @categories Script Utility, Spells and Disciplines +{ + self->SetBuffDuration(spell_id, duration); +} + +void Perl_Mob_ApplySpellBuff(Mob* self, int spell_id) // @categories Script Utility, Spells and Disciplines +{ + self->ApplySpellBuff(spell_id); +} + +void Perl_Mob_ApplySpellBuff(Mob* self, int spell_id, int duration) // @categories Script Utility, Spells and Disciplines +{ + self->ApplySpellBuff(spell_id, duration); +} + +#ifdef BOTS +Bot* Perl_Mob_CastToBot(Mob* self) +{ + return self->CastToBot(); +} + +Bot* Perl_Mob_GetHateRandomBot(Mob* self) // @categories Hate and Aggro +{ + return self->GetHateRandomBot(); } #endif -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Mob); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Mob) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; +void perl_register_mob() +{ + perl::interpreter perl(PERL_GET_THX); - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AddFeignMemory"), XS_Mob_AddFeignMemory, file, "$$"); - newXSproto(strcpy(buf, "AddNimbusEffect"), XS_Mob_AddNimbusEffect, file, "$$"); - newXSproto(strcpy(buf, "AddToHateList"), XS_Mob_AddToHateList, file, "$$;$$$$$"); - newXSproto(strcpy(buf, "ApplySpellBuff"), XS_Mob_ApplySpellBuff, file, "$$;$"); - newXSproto(strcpy(buf, "Attack"), XS_Mob_Attack, file, "$$;$$"); - newXSproto(strcpy(buf, "BehindMob"), XS_Mob_BehindMob, file, "$;$$$"); - newXSproto(strcpy(buf, "BuffCount"), XS_Mob_BuffCount, file, "$"); - newXSproto(strcpy(buf, "BuffFadeAll"), XS_Mob_BuffFadeAll, file, "$"); - newXSproto(strcpy(buf, "BuffFadeByEffect"), XS_Mob_BuffFadeByEffect, file, "$$;$"); - newXSproto(strcpy(buf, "BuffFadeBySlot"), XS_Mob_BuffFadeBySlot, file, "$$;$"); - newXSproto(strcpy(buf, "BuffFadeBySpellID"), XS_Mob_BuffFadeBySpellID, file, "$$"); - newXSproto(strcpy(buf, "CalculateDistance"), XS_Mob_CalculateDistance, file, "$$$$"); - newXSproto(strcpy(buf, "CalculateHeadingToTarget"), XS_Mob_CalculateHeadingToTarget, file, "$$$"); - newXSproto(strcpy(buf, "CameraEffect"), XS_Mob_CameraEffect, file, "$$;$$$"); - newXSproto(strcpy(buf, "CanBuffStack"), XS_Mob_CanBuffStack, file, "$$$;$"); - newXSproto(strcpy(buf, "CanClassEquipItem"), XS_Mob_CanClassEquipItem, file, "$$"); - newXSproto(strcpy(buf, "CanRaceEquipItem"), XS_Mob_CanRaceEquipItem, file, "$$"); - newXSproto(strcpy(buf, "CanThisClassDodge"), XS_Mob_CanThisClassDodge, file, "$"); - newXSproto(strcpy(buf, "CanThisClassDoubleAttack"), XS_Mob_CanThisClassDoubleAttack, file, "$"); - newXSproto(strcpy(buf, "CanThisClassDualWield"), XS_Mob_CanThisClassDualWield, file, "$"); - newXSproto(strcpy(buf, "CanThisClassParry"), XS_Mob_CanThisClassParry, file, "$"); - newXSproto(strcpy(buf, "CanThisClassRiposte"), XS_Mob_CanThisClassRiposte, file, "$"); - newXSproto(strcpy(buf, "CastSpell"), XS_Mob_CastSpell, file, "$$$;$$$"); + auto package = perl.new_class("Mob"); + package.add("AddFeignMemory", &Perl_Mob_AddFeignMemory); + package.add("AddNimbusEffect", &Perl_Mob_AddNimbusEffect); + package.add("AddToHateList", (void(*)(Mob*, Mob*))&Perl_Mob_AddToHateList); + package.add("AddToHateList", (void(*)(Mob*, Mob*, int64_t))&Perl_Mob_AddToHateList); + package.add("AddToHateList", (void(*)(Mob*, Mob*, int64_t, int64_t))&Perl_Mob_AddToHateList); + package.add("AddToHateList", (void(*)(Mob*, Mob*, int64_t, int64_t, bool))&Perl_Mob_AddToHateList); + package.add("AddToHateList", (void(*)(Mob*, Mob*, int64_t, int64_t, bool, bool))&Perl_Mob_AddToHateList); + package.add("AddToHateList", (void(*)(Mob*, Mob*, int64_t, int64_t, bool, bool, bool))&Perl_Mob_AddToHateList); + package.add("ApplySpellBuff", (void(*)(Mob*, int))&Perl_Mob_ApplySpellBuff); + package.add("ApplySpellBuff", (void(*)(Mob*, int, int))&Perl_Mob_ApplySpellBuff); + package.add("Attack", (bool(*)(Mob*, Mob*))&Perl_Mob_Attack); + package.add("Attack", (bool(*)(Mob*, Mob*, int))&Perl_Mob_Attack); + package.add("Attack", (bool(*)(Mob*, Mob*, int, bool))&Perl_Mob_Attack); + package.add("BehindMob", (bool(*)(Mob*, Mob*))&Perl_Mob_BehindMob); + package.add("BehindMob", (bool(*)(Mob*, Mob*, float))&Perl_Mob_BehindMob); + package.add("BehindMob", (bool(*)(Mob*, Mob*, float, float))&Perl_Mob_BehindMob); + package.add("BuffCount", &Perl_Mob_BuffCount); + package.add("BuffFadeAll", &Perl_Mob_BuffFadeAll); + package.add("BuffFadeByEffect", (void(*)(Mob*, int))&Perl_Mob_BuffFadeByEffect); + package.add("BuffFadeByEffect", (void(*)(Mob*, int, int))&Perl_Mob_BuffFadeByEffect); + package.add("BuffFadeBySlot", (void(*)(Mob*, int))&Perl_Mob_BuffFadeBySlot); + package.add("BuffFadeBySlot", (void(*)(Mob*, int, bool))&Perl_Mob_BuffFadeBySlot); + package.add("BuffFadeBySpellID", &Perl_Mob_BuffFadeBySpellID); + package.add("CalculateDistance", &Perl_Mob_CalculateDistance); + package.add("CalculateHeadingToTarget", &Perl_Mob_CalculateHeadingToTarget); + package.add("CameraEffect", (void(*)(Mob*, uint32))&Perl_Mob_CameraEffect); + package.add("CameraEffect", (void(*)(Mob*, uint32, uint32))&Perl_Mob_CameraEffect); + package.add("CameraEffect", (void(*)(Mob*, uint32, uint32, Client*))&Perl_Mob_CameraEffect); + package.add("CameraEffect", (void(*)(Mob*, uint32, uint32, perl::nullable, bool))&Perl_Mob_CameraEffect); + package.add("CanBuffStack", (bool(*)(Mob*, uint16, uint8))&Perl_Mob_CanBuffStack); + package.add("CanBuffStack", (bool(*)(Mob*, uint16, uint8, bool))&Perl_Mob_CanBuffStack); + package.add("CanClassEquipItem", &Perl_Mob_CanClassEquipItem); + package.add("CanRaceEquipItem", &Perl_Mob_CanRaceEquipItem); + package.add("CanThisClassDodge", &Perl_Mob_CanThisClassDodge); + package.add("CanThisClassDoubleAttack", &Perl_Mob_CanThisClassDoubleAttack); + package.add("CanThisClassDualWield", &Perl_Mob_CanThisClassDualWield); + package.add("CanThisClassParry", &Perl_Mob_CanThisClassParry); + package.add("CanThisClassRiposte", &Perl_Mob_CanThisClassRiposte); + package.add("CastSpell", (void(*)(Mob*, uint16, uint16))&Perl_Mob_CastSpell); + package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int))&Perl_Mob_CastSpell); + package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int))&Perl_Mob_CastSpell); + package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int, int))&Perl_Mob_CastSpell); + package.add("CastSpell", (void(*)(Mob*, uint16, uint16, int, int, int, int16))&Perl_Mob_CastSpell); #ifdef BOTS - newXSproto(strcpy(buf, "CastToBot"), XS_Mob_CastToBot, file, "$"); + package.add("CastToBot", &Perl_Mob_CastToBot); #endif - newXSproto(strcpy(buf, "CastToClient"), XS_Mob_CastToClient, file, "$"); - newXSproto(strcpy(buf, "CastToCorpse"), XS_Mob_CastToCorpse, file, "$"); - newXSproto(strcpy(buf, "CastToMob"), XS_Mob_CastToMob, file, "$"); - newXSproto(strcpy(buf, "CastToNPC"), XS_Mob_CastToNPC, file, "$"); - newXSproto(strcpy(buf, "CastingSpellID"), XS_Mob_CastingSpellID, file, "$"); - newXSproto(strcpy(buf, "ChangeSize"), XS_Mob_ChangeSize, file, "$$;$"); - newXSproto(strcpy(buf, "Charmed"), XS_Mob_Charmed, file, "$"); - newXSproto(strcpy(buf, "CheckAggro"), XS_Mob_CheckAggro, file, "$$"); - newXSproto(strcpy(buf, "CheckAggroAmount"), XS_Mob_CheckAggroAmount, file, "$$"); - newXSproto(strcpy(buf, "CheckHealAggroAmount"), XS_Mob_CheckHealAggroAmount, file, "$$"); - newXSproto(strcpy(buf, "CheckLoS"), XS_Mob_CheckLoS, file, "$$"); - newXSproto(strcpy(buf, "CheckLoSToLoc"), XS_Mob_CheckLoSToLoc, file, "$$$$;$"); - newXSproto(strcpy(buf, "ClearFeignMemory"), XS_Mob_ClearFeignMemory, file, "$"); - newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$"); - newXSproto(strcpy(buf, "CombatRange"), XS_Mob_CombatRange, file, "$$"); - newXSproto(strcpy(buf, "Damage"), XS_Mob_Damage, file, "$$$$$;$$$"); - newXSproto(strcpy(buf, "DelGlobal"), XS_Mob_DelGlobal, file, "$$"); - newXSproto(strcpy(buf, "DeleteBucket"), XS_Mob_DeleteBucket, file, "$$"); - newXSproto(strcpy(buf, "Depop"), XS_Mob_Depop, file, "$;$"); - newXSproto(strcpy(buf, "DivineAura"), XS_Mob_DivineAura, file, "$"); - newXSproto(strcpy(buf, "DoAnim"), XS_Mob_DoAnim, file, "$$;$"); - newXSproto(strcpy(buf, "DoArcheryAttackDmg"), XS_Mob_DoArcheryAttackDmg, file, "$$$$$$$"); - newXSproto(strcpy(buf, "DoKnockback"), XS_Mob_DoKnockback, file, "$$$$"); - newXSproto(strcpy(buf, "DoMeleeSkillAttackDmg"), XS_Mob_DoMeleeSkillAttackDmg, file, "$$$$$$$"); - newXSproto(strcpy(buf, "DoSpecialAttackDamage"), XS_Mob_DoSpecialAttackDamage, file, "$$$$;$$"); - newXSproto(strcpy(buf, "DoThrowingAttackDmg"), XS_Mob_DoThrowingAttackDmg, file, "$$$$$$$"); - newXSproto(strcpy(buf, "DontBuffMeBefore"), XS_Mob_DontBuffMeBefore, file, "$"); - newXSproto(strcpy(buf, "DontDotMeBefore"), XS_Mob_DontDotMeBefore, file, "$"); - newXSproto(strcpy(buf, "DontHealMeBefore"), XS_Mob_DontHealMeBefore, file, "$"); - newXSproto(strcpy(buf, "DontRootMeBefore"), XS_Mob_DontRootMeBefore, file, "$"); - newXSproto(strcpy(buf, "DontSnareMeBefore"), XS_Mob_DontSnareMeBefore, file, "$"); - newXSproto(strcpy(buf, "DoubleAggro"), XS_Mob_DoubleAggro, file, "$$"); - newXSproto(strcpy(buf, "Emote"), XS_Mob_Emote, file, "$$;@"); - newXSproto(strcpy(buf, "EntityVariableExists"), XS_Mob_EntityVariableExists, file, "$$"); - newXSproto(strcpy(buf, "FaceTarget"), XS_Mob_FaceTarget, file, "$;$$"); - newXSproto(strcpy(buf, "FindBuff"), XS_Mob_FindBuff, file, "$$"); - newXSproto(strcpy(buf, "FindBuffBySlot"), XS_Mob_FindBuffBySlot, file, "$$"); - newXSproto(strcpy(buf, "FindGroundZ"), XS_Mob_FindGroundZ, file, "$$$;$"); - newXSproto(strcpy(buf, "FindType"), XS_Mob_FindType, file, "$$;$$"); - newXSproto(strcpy(buf, "GMMove"), XS_Mob_GMMove, file, "$$$$;$"); - newXSproto(strcpy(buf, "Gate"), XS_Mob_Gate, file, "$"); - newXSproto(strcpy(buf, "GetAA"), XS_Mob_GetAA, file, "$$"); - newXSproto(strcpy(buf, "GetAAByAAID"), XS_Mob_GetAAByAAID, file, "$$"); - newXSproto(strcpy(buf, "GetAC"), XS_Mob_GetAC, file, "$"); - newXSproto(strcpy(buf, "GetAGI"), XS_Mob_GetAGI, file, "$"); - newXSproto(strcpy(buf, "GetATK"), XS_Mob_GetATK, file, "$"); - newXSproto(strcpy(buf, "GetActSpellCasttime"), XS_Mob_GetActSpellCasttime, file, "$$$"); - newXSproto(strcpy(buf, "GetActSpellCost"), XS_Mob_GetActSpellCost, file, "$$$"); - newXSproto(strcpy(buf, "GetActSpellDamage"), XS_Mob_GetActSpellDamage, file, "$$$"); - newXSproto(strcpy(buf, "GetActSpellDuration"), XS_Mob_GetActSpellDuration, file, "$$$"); - newXSproto(strcpy(buf, "GetActSpellHealing"), XS_Mob_GetActSpellHealing, file, "$$$"); - newXSproto(strcpy(buf, "GetActSpellRange"), XS_Mob_GetActSpellRange, file, "$$$"); - newXSproto(strcpy(buf, "GetAggroRange"), XS_Mob_GetAggroRange, file, "$"); - newXSproto(strcpy(buf, "GetAllowBeneficial"), XS_Mob_GetAllowBeneficial, file, "$$"); - newXSproto(strcpy(buf, "GetAppearance"), XS_Mob_GetAppearance, file, "$"); - newXSproto(strcpy(buf, "GetArmorTint"), XS_Mob_GetArmorTint, file, "$$"); - newXSproto(strcpy(buf, "GetAssistRange"), XS_Mob_GetAssistRange, file, "$"); - newXSproto(strcpy(buf, "GetBaseGender"), XS_Mob_GetBaseGender, file, "$"); - newXSproto(strcpy(buf, "GetBaseRace"), XS_Mob_GetBaseRace, file, "$"); - newXSproto(strcpy(buf, "GetBaseSize"), XS_Mob_GetBaseSize, file, "$"); - newXSproto(strcpy(buf, "GetBeard"), XS_Mob_GetBeard, file, "$"); - newXSproto(strcpy(buf, "GetBeardColor"), XS_Mob_GetBeardColor, file, "$"); - newXSproto(strcpy(buf, "GetBodyType"), XS_Mob_GetBodyType, file, "$"); - newXSproto(strcpy(buf, "GetBucket"), XS_Mob_GetBucket, file, "$$"); - newXSproto(strcpy(buf, "GetBucketExpires"), XS_Mob_GetBucketExpires, file, "$$"); - newXSproto(strcpy(buf, "GetBucketKey"), XS_Mob_GetBucketKey, file, "$"); - newXSproto(strcpy(buf, "GetBucketRemaining"), XS_Mob_GetBucketRemaining, file, "$$"); - newXSproto(strcpy(buf, "GetBuffSlotFromType"), XS_Mob_GetBuffSlotFromType, file, "$$"); - newXSproto(strcpy(buf, "GetBuffStatValueBySpell"), XS_Mob_GetBuffStatValueBySpell, file, "$$$"); - newXSproto(strcpy(buf, "GetBuffStatValueBySlot"), XS_Mob_GetBuffStatValueBySlot, file, "$$$"); - newXSproto(strcpy(buf, "GetCHA"), XS_Mob_GetCHA, file, "$"); - newXSproto(strcpy(buf, "GetCR"), XS_Mob_GetCR, file, "$"); - newXSproto(strcpy(buf, "GetCasterLevel"), XS_Mob_GetCasterLevel, file, "$$"); - newXSproto(strcpy(buf, "GetClass"), XS_Mob_GetClass, file, "$"); - newXSproto(strcpy(buf, "GetClassLevelFactor"), XS_Mob_GetClassLevelFactor, file, "$"); - newXSproto(strcpy(buf, "GetClassName"), XS_Mob_GetClassName, file, "$"); - newXSproto(strcpy(buf, "GetCleanName"), XS_Mob_GetCleanName, file, "$"); - newXSproto(strcpy(buf, "GetCorruption"), XS_Mob_GetCorruption, file, "$"); - newXSproto(strcpy(buf, "GetDEX"), XS_Mob_GetDEX, file, "$"); - newXSproto(strcpy(buf, "GetDR"), XS_Mob_GetDR, file, "$"); - newXSproto(strcpy(buf, "GetDamageAmount"), XS_Mob_GetDamageAmount, file, "$$"); - newXSproto(strcpy(buf, "GetDeity"), XS_Mob_GetDeity, file, "$"); - newXSproto(strcpy(buf, "GetDisplayAC"), XS_Mob_GetDisplayAC, file, "$"); - newXSproto(strcpy(buf, "GetDrakkinDetails"), XS_Mob_GetDrakkinDetails, file, "$"); - newXSproto(strcpy(buf, "GetDrakkinHeritage"), XS_Mob_GetDrakkinHeritage, file, "$"); - newXSproto(strcpy(buf, "GetDrakkinTattoo"), XS_Mob_GetDrakkinTattoo, file, "$"); - newXSproto(strcpy(buf, "GetEntityVariable"), XS_Mob_GetEntityVariable, file, "$$"); - newXSproto(strcpy(buf, "GetEquipment"), XS_Mob_GetEquipment, file, "$$"); - newXSproto(strcpy(buf, "GetEquipmentColor"), XS_Mob_GetEquipmentColor, file, "$$"); - newXSproto(strcpy(buf, "GetEquipmentMaterial"), XS_Mob_GetEquipmentMaterial, file, "$$"); - newXSproto(strcpy(buf, "GetEyeColor1"), XS_Mob_GetEyeColor1, file, "$"); - newXSproto(strcpy(buf, "GetEyeColor2"), XS_Mob_GetEyeColor2, file, "$"); - newXSproto(strcpy(buf, "GetFR"), XS_Mob_GetFR, file, "$"); - newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$"); - newXSproto(strcpy(buf, "GetFollowID"), XS_Mob_GetFollowID, file, "$"); - newXSproto(strcpy(buf, "GetGender"), XS_Mob_GetGender, file, "$"); - newXSproto(strcpy(buf, "GetGlobal"), XS_Mob_GetGlobal, file, "$$"); - newXSproto(strcpy(buf, "GetHP"), XS_Mob_GetHP, file, "$"); - newXSproto(strcpy(buf, "GetHPRatio"), XS_Mob_GetHPRatio, file, "$"); - newXSproto(strcpy(buf, "GetHairColor"), XS_Mob_GetHairColor, file, "$"); - newXSproto(strcpy(buf, "GetHairStyle"), XS_Mob_GetHairStyle, file, "$"); - newXSproto(strcpy(buf, "GetHandToHandDamage"), XS_Mob_GetHandToHandDamage, file, "$"); - newXSproto(strcpy(buf, "GetHandToHandDelay"), XS_Mob_GetHandToHandDelay, file, "$"); - newXSproto(strcpy(buf, "GetHaste"), XS_Mob_GetHaste, file, "$"); - newXSproto(strcpy(buf, "GetHateAmount"), XS_Mob_GetHateAmount, file, "$$;$"); - newXSproto(strcpy(buf, "GetHateClosest"), XS_Mob_GetHateClosest, file, "$"); - newXSproto(strcpy(buf, "GetHateDamageTop"), XS_Mob_GetHateDamageTop, file, "$$"); - newXSproto(strcpy(buf, "GetHateList"), XS_Mob_GetHateList, file, "$"); - newXSproto(strcpy(buf, "GetHateListByDistance"), XS_Mob_GetHateListByDistance, file, "$;$"); - newXSproto(strcpy(buf, "GetHateRandom"), XS_Mob_GetHateRandom, file, "$"); + package.add("CastToClient", &Perl_Mob_CastToClient); + package.add("CastToCorpse", &Perl_Mob_CastToCorpse); + package.add("CastToMob", &Perl_Mob_CastToMob); + package.add("CastToNPC", &Perl_Mob_CastToNPC); + package.add("CastingSpellID", &Perl_Mob_CastingSpellID); + package.add("ChangeSize", (void(*)(Mob*, float))&Perl_Mob_ChangeSize); + package.add("ChangeSize", (void(*)(Mob*, float, bool))&Perl_Mob_ChangeSize); + package.add("Charmed", &Perl_Mob_Charmed); + package.add("CheckAggro", &Perl_Mob_CheckAggro); + package.add("CheckAggroAmount", &Perl_Mob_CheckAggroAmount); + package.add("CheckHealAggroAmount", (int(*)(Mob*, uint16))&Perl_Mob_CheckHealAggroAmount); + package.add("CheckHealAggroAmount", (int(*)(Mob*, uint16, uint32))&Perl_Mob_CheckHealAggroAmount); + package.add("CheckLoS", &Perl_Mob_CheckLoS); + package.add("CheckLoSToLoc", (bool(*)(Mob*, float, float, float))&Perl_Mob_CheckLoSToLoc); + package.add("CheckLoSToLoc", (bool(*)(Mob*, float, float, float, float))&Perl_Mob_CheckLoSToLoc); + package.add("ClearFeignMemory", &Perl_Mob_ClearFeignMemory); + package.add("ClearSpecialAbilities", &Perl_Mob_ClearSpecialAbilities); + package.add("CombatRange", &Perl_Mob_CombatRange); + package.add("Damage", (void(*)(Mob*, Mob*, int64, uint16_t, int))&Perl_Mob_Damage); + package.add("Damage", (void(*)(Mob*, Mob*, int64, uint16_t, int, bool))&Perl_Mob_Damage); + package.add("Damage", (void(*)(Mob*, Mob*, int64, uint16_t, int, bool, int8_t))&Perl_Mob_Damage); + package.add("Damage", (void(*)(Mob*, Mob*, int64, uint16_t, int, bool, int8_t, bool))&Perl_Mob_Damage); + package.add("DelGlobal", &Perl_Mob_DelGlobal); + package.add("DeleteBucket", &Perl_Mob_DeleteBucket); + package.add("Depop", (void(*)(Mob*))&Perl_Mob_Depop); + package.add("Depop", (void(*)(Mob*, bool))&Perl_Mob_Depop); + package.add("DivineAura", &Perl_Mob_DivineAura); + package.add("DoAnim", (void(*)(Mob*, int))&Perl_Mob_DoAnim); + package.add("DoAnim", (void(*)(Mob*, int, int))&Perl_Mob_DoAnim); + package.add("DoArcheryAttackDmg", &Perl_Mob_DoArcheryAttackDmg); + package.add("DoKnockback", &Perl_Mob_DoKnockback); + package.add("DoMeleeSkillAttackDmg", &Perl_Mob_DoMeleeSkillAttackDmg); + package.add("DoSpecialAttackDamage", (void(*)(Mob*, Mob*, int, int))&Perl_Mob_DoSpecialAttackDamage); + package.add("DoSpecialAttackDamage", (void(*)(Mob*, Mob*, int, int, int))&Perl_Mob_DoSpecialAttackDamage); + package.add("DoSpecialAttackDamage", (void(*)(Mob*, Mob*, int, int, int, int))&Perl_Mob_DoSpecialAttackDamage); + package.add("DoSpecialAttackDamage", (void(*)(Mob*, Mob*, int, int, int, int, int))&Perl_Mob_DoSpecialAttackDamage); + package.add("DoThrowingAttackDmg", &Perl_Mob_DoThrowingAttackDmg); + package.add("DontBuffMeBefore", &Perl_Mob_DontBuffMeBefore); + package.add("DontDotMeBefore", &Perl_Mob_DontDotMeBefore); + package.add("DontHealMeBefore", &Perl_Mob_DontHealMeBefore); + package.add("DontRootMeBefore", &Perl_Mob_DontRootMeBefore); + package.add("DontSnareMeBefore", &Perl_Mob_DontSnareMeBefore); + package.add("DoubleAggro", &Perl_Mob_DoubleAggro); + package.add("Emote", &Perl_Mob_Emote); + package.add("EntityVariableExists", &Perl_Mob_EntityVariableExists); + package.add("FaceTarget", (void(*)(Mob*))&Perl_Mob_FaceTarget); + package.add("FaceTarget", (void(*)(Mob*, Mob*))&Perl_Mob_FaceTarget); + package.add("FindBuff", &Perl_Mob_FindBuff); + package.add("FindBuffBySlot", &Perl_Mob_FindBuffBySlot); + package.add("FindGroundZ", (float(*)(Mob*, float, float))&Perl_Mob_FindGroundZ); + package.add("FindGroundZ", (float(*)(Mob*, float, float, float))&Perl_Mob_FindGroundZ); + package.add("FindType", (bool(*)(Mob*, uint16_t))&Perl_Mob_FindType); + package.add("FindType", (bool(*)(Mob*, uint16_t, bool))&Perl_Mob_FindType); + package.add("FindType", (bool(*)(Mob*, uint16_t, bool, uint16_t))&Perl_Mob_FindType); + package.add("GMMove", (void(*)(Mob*, float, float, float))&Perl_Mob_GMMove); + package.add("GMMove", (void(*)(Mob*, float, float, float, float))&Perl_Mob_GMMove); + package.add("Gate", &Perl_Mob_Gate); + package.add("GetAA", &Perl_Mob_GetAA); + package.add("GetAAByAAID", &Perl_Mob_GetAAByAAID); + package.add("GetAC", &Perl_Mob_GetAC); + package.add("GetAGI", &Perl_Mob_GetAGI); + package.add("GetATK", &Perl_Mob_GetATK); + package.add("GetActSpellCasttime", &Perl_Mob_GetActSpellCasttime); + package.add("GetActSpellCost", &Perl_Mob_GetActSpellCost); + package.add("GetActSpellDamage", &Perl_Mob_GetActSpellDamage); + package.add("GetActSpellDuration", &Perl_Mob_GetActSpellDuration); + package.add("GetActSpellHealing", &Perl_Mob_GetActSpellHealing); + package.add("GetActSpellRange", &Perl_Mob_GetActSpellRange); + package.add("GetAggroRange", &Perl_Mob_GetAggroRange); + package.add("GetAllowBeneficial", &Perl_Mob_GetAllowBeneficial); + package.add("GetAppearance", &Perl_Mob_GetAppearance); + package.add("GetArmorTint", &Perl_Mob_GetArmorTint); + package.add("GetAssistRange", &Perl_Mob_GetAssistRange); + package.add("GetBaseGender", &Perl_Mob_GetBaseGender); + package.add("GetBaseRace", &Perl_Mob_GetBaseRace); + package.add("GetBaseSize", &Perl_Mob_GetBaseSize); + package.add("GetBeard", &Perl_Mob_GetBeard); + package.add("GetBeardColor", &Perl_Mob_GetBeardColor); + package.add("GetBodyType", &Perl_Mob_GetBodyType); + package.add("GetBucket", &Perl_Mob_GetBucket); + package.add("GetBucketExpires", &Perl_Mob_GetBucketExpires); + package.add("GetBucketKey", &Perl_Mob_GetBucketKey); + package.add("GetBucketRemaining", &Perl_Mob_GetBucketRemaining); + package.add("GetBuffSlotFromType", &Perl_Mob_GetBuffSlotFromType); + package.add("GetBuffStatValueBySpell", &Perl_Mob_GetBuffStatValueBySpell); + package.add("GetBuffStatValueBySlot", &Perl_Mob_GetBuffStatValueBySlot); + package.add("GetCHA", &Perl_Mob_GetCHA); + package.add("GetCR", &Perl_Mob_GetCR); + package.add("GetCasterLevel", &Perl_Mob_GetCasterLevel); + package.add("GetClass", &Perl_Mob_GetClass); + package.add("GetClassLevelFactor", &Perl_Mob_GetClassLevelFactor); + package.add("GetClassName", &Perl_Mob_GetClassName); + package.add("GetCleanName", &Perl_Mob_GetCleanName); + package.add("GetCorruption", &Perl_Mob_GetCorruption); + package.add("GetDEX", &Perl_Mob_GetDEX); + package.add("GetDR", &Perl_Mob_GetDR); + package.add("GetDamageAmount", &Perl_Mob_GetDamageAmount); + package.add("GetDeity", &Perl_Mob_GetDeity); + package.add("GetDisplayAC", &Perl_Mob_GetDisplayAC); + package.add("GetDrakkinDetails", &Perl_Mob_GetDrakkinDetails); + package.add("GetDrakkinHeritage", &Perl_Mob_GetDrakkinHeritage); + package.add("GetDrakkinTattoo", &Perl_Mob_GetDrakkinTattoo); + package.add("GetEntityVariable", &Perl_Mob_GetEntityVariable); + package.add("GetEquipment", &Perl_Mob_GetEquipment); + package.add("GetEquipmentColor", &Perl_Mob_GetEquipmentColor); + package.add("GetEquipmentMaterial", &Perl_Mob_GetEquipmentMaterial); + package.add("GetEyeColor1", &Perl_Mob_GetEyeColor1); + package.add("GetEyeColor2", &Perl_Mob_GetEyeColor2); + package.add("GetFR", &Perl_Mob_GetFR); + package.add("GetFlurryChance", &Perl_Mob_GetFlurryChance); + package.add("GetFollowID", &Perl_Mob_GetFollowID); + package.add("GetGender", &Perl_Mob_GetGender); + package.add("GetGlobal", &Perl_Mob_GetGlobal); + package.add("GetHP", &Perl_Mob_GetHP); + package.add("GetHPRatio", &Perl_Mob_GetHPRatio); + package.add("GetHairColor", &Perl_Mob_GetHairColor); + package.add("GetHairStyle", &Perl_Mob_GetHairStyle); + package.add("GetHandToHandDamage", &Perl_Mob_GetHandToHandDamage); + package.add("GetHandToHandDelay", &Perl_Mob_GetHandToHandDelay); + package.add("GetHaste", &Perl_Mob_GetHaste); + package.add("GetHateAmount", (int64_t(*)(Mob*, Mob*))&Perl_Mob_GetHateAmount); + package.add("GetHateAmount", (int64_t(*)(Mob*, Mob*, bool))&Perl_Mob_GetHateAmount); + package.add("GetHateClosest", &Perl_Mob_GetHateClosest); + package.add("GetHateDamageTop", &Perl_Mob_GetHateDamageTop); + package.add("GetHateList", &Perl_Mob_GetHateList); + package.add("GetHateListByDistance", (perl::array(*)(Mob*))&Perl_Mob_GetHateListByDistance); + package.add("GetHateListByDistance", (perl::array(*)(Mob*, int))&Perl_Mob_GetHateListByDistance); + package.add("GetHateRandom", &Perl_Mob_GetHateRandom); #ifdef BOTS - newXSproto(strcpy(buf, "GetHateRandomBot"), XS_Mob_GetHateRandomBot, file, "$"); + package.add("GetHateRandomBot", &Perl_Mob_GetHateRandomBot); #endif - newXSproto(strcpy(buf, "GetHateRandomClient"), XS_Mob_GetHateRandomClient, file, "$"); - newXSproto(strcpy(buf, "GetHateRandomNPC"), XS_Mob_GetHateRandomNPC, file, "$"); - newXSproto(strcpy(buf, "GetHateTop"), XS_Mob_GetHateTop, file, "$"); - newXSproto(strcpy(buf, "GetHeading"), XS_Mob_GetHeading, file, "$"); - newXSproto(strcpy(buf, "GetHelmTexture"), XS_Mob_GetHelmTexture, file, "$"); - newXSproto(strcpy(buf, "GetHerosForgeModel"), XS_Mob_GetHerosForgeModel, file, "$$"); - newXSproto(strcpy(buf, "GetID"), XS_Mob_GetID, file, "$"); - newXSproto(strcpy(buf, "GetINT"), XS_Mob_GetINT, file, "$"); - newXSproto(strcpy(buf, "GetInvisibleLevel"), XS_Mob_GetInvisibleLevel, file, "$"); - newXSproto(strcpy(buf, "GetInvisibleUndeadLevel"), XS_Mob_GetInvisibleUndeadLevel, file, "$"); - newXSproto(strcpy(buf, "GetInvul"), XS_Mob_GetInvul, file, "$"); - newXSproto(strcpy(buf, "GetItemHPBonuses"), XS_Mob_GetItemHPBonuses, file, "$"); - newXSproto(strcpy(buf, "GetItemStat"), XS_Mob_GetItemStat, file, "$$$"); - newXSproto(strcpy(buf, "GetLastName"), XS_Mob_GetLastName, file, "$"); - newXSproto(strcpy(buf, "GetLevel"), XS_Mob_GetLevel, file, "$"); - newXSproto(strcpy(buf, "GetLevelCon"), XS_Mob_GetLevelCon, file, "$$"); - newXSproto(strcpy(buf, "GetLevelHP"), XS_Mob_GetLevelHP, file, "$$"); - newXSproto(strcpy(buf, "GetLuclinFace"), XS_Mob_GetLuclinFace, file, "$"); - newXSproto(strcpy(buf, "GetMR"), XS_Mob_GetMR, file, "$"); - newXSproto(strcpy(buf, "GetMana"), XS_Mob_GetMana, file, "$"); - newXSproto(strcpy(buf, "GetManaRatio"), XS_Mob_GetManaRatio, file, "$"); - newXSproto(strcpy(buf, "GetMaxAGI"), XS_Mob_GetMaxAGI, file, "$"); - newXSproto(strcpy(buf, "GetMaxCHA"), XS_Mob_GetMaxCHA, file, "$"); - newXSproto(strcpy(buf, "GetMaxDEX"), XS_Mob_GetMaxDEX, file, "$"); - newXSproto(strcpy(buf, "GetMaxHP"), XS_Mob_GetMaxHP, file, "$"); - newXSproto(strcpy(buf, "GetMaxINT"), XS_Mob_GetMaxINT, file, "$"); - newXSproto(strcpy(buf, "GetMaxMana"), XS_Mob_GetMaxMana, file, "$"); - newXSproto(strcpy(buf, "GetMaxSTA"), XS_Mob_GetMaxSTA, file, "$"); - newXSproto(strcpy(buf, "GetMaxSTR"), XS_Mob_GetMaxSTR, file, "$"); - newXSproto(strcpy(buf, "GetMaxWIS"), XS_Mob_GetMaxWIS, file, "$"); - newXSproto(strcpy(buf, "GetMeleeMitigation"), XS_Mob_GetMeleeMitigation, file, "$"); - newXSproto(strcpy(buf, "GetModSkillDmgTaken"), XS_Mob_GetModSkillDmgTaken, file, "$$"); - newXSproto(strcpy(buf, "GetModVulnerability"), XS_Mob_GetModVulnerability, file, "$$"); - newXSproto(strcpy(buf, "GetNPCTypeID"), XS_Mob_GetNPCTypeID, file, "$"); - newXSproto(strcpy(buf, "GetName"), XS_Mob_GetName, file, "$"); - newXSproto(strcpy(buf, "GetNimbusEffect1"), XS_Mob_GetNimbusEffect1, file, "$"); - newXSproto(strcpy(buf, "GetNimbusEffect2"), XS_Mob_GetNimbusEffect2, file, "$"); - newXSproto(strcpy(buf, "GetNimbusEffect3"), XS_Mob_GetNimbusEffect3, file, "$"); - newXSproto(strcpy(buf, "GetOwnerID"), XS_Mob_GetOwnerID, file, "$"); - newXSproto(strcpy(buf, "GetPR"), XS_Mob_GetPR, file, "$"); - newXSproto(strcpy(buf, "GetPetID"), XS_Mob_GetPetID, file, "$"); - newXSproto(strcpy(buf, "GetPetOrder"), XS_Mob_GetPetOrder, file, "$"); - newXSproto(strcpy(buf, "GetPetType"), XS_Mob_GetPetType, file, "$"); - newXSproto(strcpy(buf, "GetPhR"), XS_Mob_GetPhR, file, "$"); - newXSproto(strcpy(buf, "GetRace"), XS_Mob_GetRace, file, "$"); - newXSproto(strcpy(buf, "GetRaceName"), XS_Mob_GetRaceName, file, "$"); - newXSproto(strcpy(buf, "GetResist"), XS_Mob_GetResist, file, "$$"); - newXSproto(strcpy(buf, "GetReverseFactionCon"), XS_Mob_GetReverseFactionCon, file, "$$"); - newXSproto(strcpy(buf, "GetRunAnimSpeed"), XS_Mob_GetRunAnimSpeed, file, "$"); - newXSproto(strcpy(buf, "GetRunspeed"), XS_Mob_GetRunspeed, file, "$"); - newXSproto(strcpy(buf, "GetSTA"), XS_Mob_GetSTA, file, "$"); - newXSproto(strcpy(buf, "GetSTR"), XS_Mob_GetSTR, file, "$"); - newXSproto(strcpy(buf, "GetSize"), XS_Mob_GetSize, file, "$"); - newXSproto(strcpy(buf, "GetSkill"), XS_Mob_GetSkill, file, "$$"); - newXSproto(strcpy(buf, "GetSkillDmgTaken"), XS_Mob_GetSkillDmgTaken, file, "$$"); - newXSproto(strcpy(buf, "GetSpecialAbility"), XS_Mob_GetSpecialAbility, file, "$$"); - newXSproto(strcpy(buf, "GetSpecialAbilityParam"), XS_Mob_GetSpecialAbilityParam, file, "$$$"); - newXSproto(strcpy(buf, "GetSpecializeSkillValue"), XS_Mob_GetSpecializeSkillValue, file, "$$"); - newXSproto(strcpy(buf, "GetSpellHPBonuses"), XS_Mob_GetSpellHPBonuses, file, "$"); - newXSproto(strcpy(buf, "GetSpellIDFromSlot"), XS_Mob_GetSpellIDFromSlot, file, "$$"); - newXSproto(strcpy(buf, "GetSpellStat"), XS_Mob_GetSpellStat, file, "$$$$"); - newXSproto(strcpy(buf, "GetTarget"), XS_Mob_GetTarget, file, "$"); - newXSproto(strcpy(buf, "GetTexture"), XS_Mob_GetTexture, file, "$"); - newXSproto(strcpy(buf, "GetWIS"), XS_Mob_GetWIS, file, "$"); - newXSproto(strcpy(buf, "GetWalkspeed"), XS_Mob_GetWalkspeed, file, "$"); - newXSproto(strcpy(buf, "GetWaypointH"), XS_Mob_GetWaypointH, file, "$"); - newXSproto(strcpy(buf, "GetWaypointID"), XS_Mob_GetWaypointID, file, "$"); - newXSproto(strcpy(buf, "GetWaypointPause"), XS_Mob_GetWaypointPause, file, "$"); - newXSproto(strcpy(buf, "GetWaypointX"), XS_Mob_GetWaypointX, file, "$"); - newXSproto(strcpy(buf, "GetWaypointY"), XS_Mob_GetWaypointY, file, "$"); - newXSproto(strcpy(buf, "GetWaypointZ"), XS_Mob_GetWaypointZ, file, "$"); - newXSproto(strcpy(buf, "GetX"), XS_Mob_GetX, file, "$"); - newXSproto(strcpy(buf, "GetY"), XS_Mob_GetY, file, "$"); - newXSproto(strcpy(buf, "GetZ"), XS_Mob_GetZ, file, "$"); - newXSproto(strcpy(buf, "GetZoneID"), XS_Mob_GetZoneID, file, "$"); - newXSproto(strcpy(buf, "GoToBind"), XS_Mob_GoToBind, file, "$"); - newXSproto(strcpy(buf, "HalveAggro"), XS_Mob_HalveAggro, file, "$$"); - newXSproto(strcpy(buf, "HasNPCSpecialAtk"), XS_Mob_HasNPCSpecialAtk, file, "$$"); - newXSproto(strcpy(buf, "HasOwner"), XS_Mob_HasOwner, file, "$"); - newXSproto(strcpy(buf, "HasPet"), XS_Mob_HasPet, file, "$"); - newXSproto(strcpy(buf, "HasProcs"), XS_Mob_HasProcs, file, "$"); - newXSproto(strcpy(buf, "HasShieldEquiped"), XS_Mob_HasShieldEquiped, file, "$"); - newXSproto(strcpy(buf, "HasTwoHandBluntEquiped"), XS_Mob_HasTwoHandBluntEquiped, file, "$"); - newXSproto(strcpy(buf, "HasTwoHanderEquipped"), XS_Mob_HasTwoHanderEquipped, file, "$"); - newXSproto(strcpy(buf, "HateSummon"), XS_Mob_HateSummon, file, "$"); - newXSproto(strcpy(buf, "Heal"), XS_Mob_Heal, file, "$"); - newXSproto(strcpy(buf, "HealDamage"), XS_Mob_HealDamage, file, "$$;$"); - newXSproto(strcpy(buf, "InterruptSpell"), XS_Mob_InterruptSpell, file, "$;$"); - newXSproto(strcpy(buf, "IsAIControlled"), XS_Mob_IsAIControlled, file, "$"); - newXSproto(strcpy(buf, "IsAmnesiad"), XS_Mob_IsAmnesiad, file, "$"); - newXSproto(strcpy(buf, "IsBeacon"), XS_Mob_IsBeacon, file, "$"); - newXSproto(strcpy(buf, "IsBeneficialAllowed"), XS_Mob_IsBeneficialAllowed, file, "$$"); - newXSproto(strcpy(buf, "IsBlind"), XS_Mob_IsBlind, file, "$"); - newXSproto(strcpy(buf, "IsBot"), XS_Mob_IsBot, file, "$"); - newXSproto(strcpy(buf, "IsCasting"), XS_Mob_IsCasting, file, "$"); - newXSproto(strcpy(buf, "IsClient"), XS_Mob_IsClient, file, "$"); - newXSproto(strcpy(buf, "IsCorpse"), XS_Mob_IsCorpse, file, "$"); - newXSproto(strcpy(buf, "IsDoor"), XS_Mob_IsDoor, file, "$"); - newXSproto(strcpy(buf, "IsEliteMaterialItem"), XS_Mob_IsEliteMaterialItem, file, "$$"); - newXSproto(strcpy(buf, "IsEngaged"), XS_Mob_IsEngaged, file, "$"); - newXSproto(strcpy(buf, "IsEnraged"), XS_Mob_IsEnraged, file, "$"); - newXSproto(strcpy(buf, "IsFeared"), XS_Mob_IsFeared, file, "$"); - newXSproto(strcpy(buf, "IsHorse"), XS_Mob_IsHorse, file, "$"); - newXSproto(strcpy(buf, "IsImmuneToSpell"), XS_Mob_IsImmuneToSpell, file, "$$$"); - newXSproto(strcpy(buf, "IsInvisible"), XS_Mob_IsInvisible, file, "$;$"); - newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$"); - newXSproto(strcpy(buf, "IsMezzed"), XS_Mob_IsMezzed, file, "$"); - newXSproto(strcpy(buf, "IsMob"), XS_Mob_IsMob, file, "$"); - newXSproto(strcpy(buf, "IsMoving"), XS_Mob_IsMoving, file, "$"); - newXSproto(strcpy(buf, "IsNPC"), XS_Mob_IsNPC, file, "$"); - newXSproto(strcpy(buf, "IsNPCCorpse"), XS_Mob_IsNPCCorpse, file, "$"); - newXSproto(strcpy(buf, "IsObject"), XS_Mob_IsObject, file, "$"); - newXSproto(strcpy(buf, "IsPet"), XS_Mob_IsPet, file, "$"); - newXSproto(strcpy(buf, "IsPlayerCorpse"), XS_Mob_IsPlayerCorpse, file, "$"); - newXSproto(strcpy(buf, "IsRoamer"), XS_Mob_IsRoamer, file, "$"); - newXSproto(strcpy(buf, "IsRooted"), XS_Mob_IsRooted, file, "$"); - newXSproto(strcpy(buf, "IsRunning"), XS_Mob_IsRunning, file, "$"); - newXSproto(strcpy(buf, "IsSilenced"), XS_Mob_IsSilenced, file, "$"); - newXSproto(strcpy(buf, "IsStunned"), XS_Mob_IsStunned, file, "$"); - newXSproto(strcpy(buf, "IsTargetable"), XS_Mob_IsTargetable, file, "$"); - newXSproto(strcpy(buf, "IsTargeted"), XS_Mob_IsTargeted, file, "$"); - newXSproto(strcpy(buf, "IsTrap"), XS_Mob_IsTrap, file, "$"); - newXSproto(strcpy(buf, "IsWarriorClass"), XS_Mob_IsWarriorClass, file, "$"); - newXSproto(strcpy(buf, "Kill"), XS_Mob_Kill, file, "$"); - newXSproto(strcpy(buf, "MakePet"), XS_Mob_MakePet, file, "$$$;$"); - newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$"); - newXSproto(strcpy(buf, "Mesmerize"), XS_Mob_Mesmerize, file, "$"); - newXSproto(strcpy(buf, "Message"), XS_Mob_Message, file, "$$$;@"); - newXSproto(strcpy(buf, "Message_StringID"), XS_Mob_Message_StringID, file, "$$$;$"); - newXSproto(strcpy(buf, "ModSkillDmgTaken"), XS_Mob_ModSkillDmgTaken, file, "$$$"); - newXSproto(strcpy(buf, "ModVulnerability"), XS_Mob_ModVulnerability, file, "$$$"); - newXSproto(strcpy(buf, "NPCSpecialAttacks"), XS_Mob_NPCSpecialAttacks, file, "$$$;$$"); - newXSproto(strcpy(buf, "NavigateTo"), XS_Mob_NavigateTo, file, "$$$$"); - newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$"); - newXSproto(strcpy(buf, "ProjectileAnim"), XS_Mob_ProjectileAnim, file, "$$$;$$$$$$"); - newXSproto(strcpy(buf, "RandomizeFeatures"), XS_Mob_RandomizeFeatures, file, "$$;$"); - newXSproto(strcpy(buf, "RangedAttack"), XS_Mob_RangedAttack, file, "$$"); - newXSproto(strcpy(buf, "RemoveAllAppearanceEffects"), XS_Mob_RemoveAllAppearanceEffects, file, "$"); - newXSproto(strcpy(buf, "RemoveAllNimbusEffects"), XS_Mob_RemoveAllNimbusEffects, file, "$"); - newXSproto(strcpy(buf, "RemoveFromFeignMemory"), XS_Mob_RemoveFromFeignMemory, file, "$$"); - newXSproto(strcpy(buf, "RemoveNimbusEffect"), XS_Mob_RemoveNimbusEffect, file, "$$"); - newXSproto(strcpy(buf, "RemovePet"), XS_Mob_RemovePet, file, "$"); - newXSproto(strcpy(buf, "ResistSpell"), XS_Mob_ResistSpell, file, "$$$$"); - newXSproto(strcpy(buf, "RogueAssassinate"), XS_Mob_RogueAssassinate, file, "$$"); - newXSproto(strcpy(buf, "RunTo"), XS_Mob_RunTo, file, "$$$$"); - newXSproto(strcpy(buf, "Say"), XS_Mob_Say, file, "$$;@"); - newXSproto(strcpy(buf, "SeeHide"), XS_Mob_SeeHide, file, "$"); - newXSproto(strcpy(buf, "SeeImprovedHide"), XS_Mob_SeeImprovedHide, file, "$"); - newXSproto(strcpy(buf, "SeeInvisible"), XS_Mob_SeeInvisible, file, "$"); - newXSproto(strcpy(buf, "SeeInvisibleUndead"), XS_Mob_SeeInvisibleUndead, file, "$"); - newXSproto(strcpy(buf, "SendAppearanceEffect"), XS_Mob_SendAppearanceEffect, file, "$$;$$$$$$$$$$$$$$"); - newXSproto(strcpy(buf, "SendAppearanceEffectActor"), XS_Mob_SendAppearanceEffectActor, file, "$$$;$$$$$$$$$"); - newXSproto(strcpy(buf, "SendAppearanceEffectGround"), XS_Mob_SendAppearanceEffectGround, file, "$$$;$$$$$$$$$"); - newXSproto(strcpy(buf, "SendIllusion"), XS_Mob_SendIllusion, file, "$$;$$$$$$$$$$$$"); - newXSproto(strcpy(buf, "SendTo"), XS_Mob_SendTo, file, "$$$$"); - newXSproto(strcpy(buf, "SendToFixZ"), XS_Mob_SendToFixZ, file, "$$$$"); - newXSproto(strcpy(buf, "SendWearChange"), XS_Mob_SendWearChange, file, "$$"); - newXSproto(strcpy(buf, "SetAA"), XS_Mob_SetAA, file, "$$$;$"); - newXSproto(strcpy(buf, "SetAllowBeneficial"), XS_Mob_SetAllowBeneficial, file, "$$"); - newXSproto(strcpy(buf, "SetAppearance"), XS_Mob_SetAppearance, file, "$$;$"); - newXSproto(strcpy(buf, "SetBodyType"), XS_Mob_SetBodyType, file, "$$;$"); - newXSproto(strcpy(buf, "SetBucket"), XS_Mob_SetBucket, file, "$$$;$"); - newXSproto(strcpy(buf, "SetBuffDuration"), XS_Mob_SetBuffDuration, file, "$$;$"); - newXSproto(strcpy(buf, "SetCurrentWP"), XS_Mob_SetCurrentWP, file, "$$"); - newXSproto(strcpy(buf, "SetDeltas"), XS_Mob_SetDeltas, file, "$$$$$"); - newXSproto(strcpy(buf, "SetDisableMelee"), XS_Mob_SetDisableMelee, file, "$$"); - newXSproto(strcpy(buf, "SetEntityVariable"), XS_Mob_SetEntityVariable, file, "$$$"); - newXSproto(strcpy(buf, "SetExtraHaste"), XS_Mob_SetExtraHaste, file, "$$"); - newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$"); - newXSproto(strcpy(buf, "SetFlyMode"), XS_Mob_SetFlyMode, file, "$$"); - newXSproto(strcpy(buf, "SetFollowID"), XS_Mob_SetFollowID, file, "$$"); - newXSproto(strcpy(buf, "SetGender"), XS_Mob_SetGender, file, "$$"); - newXSproto(strcpy(buf, "SetGlobal"), XS_Mob_SetGlobal, file, "$$$$$;$"); - newXSproto(strcpy(buf, "SetHP"), XS_Mob_SetHP, file, "$$"); - newXSproto(strcpy(buf, "SetHate"), XS_Mob_SetHate, file, "$$;$$"); - newXSproto(strcpy(buf, "SetHeading"), XS_Mob_SetHeading, file, "$$"); - newXSproto(strcpy(buf, "SetInvisible"), XS_Mob_SetInvisible, file, "$$"); - newXSproto(strcpy(buf, "SetInvul"), XS_Mob_SetInvul, file, "$$"); - newXSproto(strcpy(buf, "SetLD"), XS_Mob_SetLD, file, "$$"); - newXSproto(strcpy(buf, "SetLevel"), XS_Mob_SetLevel, file, "$$;$"); - newXSproto(strcpy(buf, "SetMana"), XS_Mob_SetMana, file, "$$"); - newXSproto(strcpy(buf, "SetMaxHP"), XS_Mob_SetMaxHP, file, "$"); - newXSproto(strcpy(buf, "SetOOCRegen"), XS_Mob_SetOOCRegen, file, "$$"); - newXSproto(strcpy(buf, "SetOwnerID"), XS_Mob_SetOwnerID, file, "$$"); - newXSproto(strcpy(buf, "SetPet"), XS_Mob_SetPet, file, "$$"); - newXSproto(strcpy(buf, "SetPetID"), XS_Mob_SetPetID, file, "$$"); - newXSproto(strcpy(buf, "SetPetOrder"), XS_Mob_SetPetOrder, file, "$$"); - newXSproto(strcpy(buf, "SetRace"), XS_Mob_SetRace, file, "$$"); - newXSproto(strcpy(buf, "SetRunAnimSpeed"), XS_Mob_SetRunAnimSpeed, file, "$$"); - newXSproto(strcpy(buf, "SetRunning"), XS_Mob_SetRunning, file, "$$"); - newXSproto(strcpy(buf, "SetSeeInvisibleLevel"), XS_Mob_SetSeeInvisibleLevel, file, "$$"); - newXSproto(strcpy(buf, "SetSeeInvisibleUndeadLevel"), XS_Mob_SetSeeInvisibleUndeadLevel, file, "$$"); - newXSproto(strcpy(buf, "SetSlotTint"), XS_Mob_SetSlotTint, file, "$$$$$"); - newXSproto(strcpy(buf, "SetSpecialAbility"), XS_Mob_SetSpecialAbility, file, "$$$"); - newXSproto(strcpy(buf, "SetSpecialAbilityParam"), XS_Mob_SetSpecialAbilityParam, file, "$$$$"); - newXSproto(strcpy(buf, "SetTarget"), XS_Mob_SetTarget, file, "$$"); - newXSproto(strcpy(buf, "SetTargetable"), XS_Mob_SetTargetable, file, "$$"); - newXSproto(strcpy(buf, "SetTexture"), XS_Mob_SetTexture, file, "$$"); - newXSproto(strcpy(buf, "ShieldAbility"), XS_Mob_ShieldAbility, file, "$$$$$$$$"); - newXSproto(strcpy(buf, "Shout"), XS_Mob_Shout, file, "$$;@"); - newXSproto(strcpy(buf, "SignalClient"), XS_Mob_SignalClient, file, "$$$"); - newXSproto(strcpy(buf, "SpellEffect"), XS_Mob_SpellEffect, file, "$$;$$$$$$$$"); - newXSproto(strcpy(buf, "SpellFinished"), XS_Mob_SpellFinished, file, "$$;$$"); - newXSproto(strcpy(buf, "Spin"), XS_Mob_Spin, file, "$"); - newXSproto(strcpy(buf, "StartEnrage"), XS_Mob_StartEnrage, file, "$"); - newXSproto(strcpy(buf, "StopNavigation"), XS_Mob_StopNavigation, file, "$"); - newXSproto(strcpy(buf, "Stun"), XS_Mob_Stun, file, "$$"); - newXSproto(strcpy(buf, "TarGlobal"), XS_Mob_TarGlobal, file, "$$$$$$$"); - newXSproto(strcpy(buf, "TempName"), XS_Mob_TempName, file, "$:$"); - newXSproto(strcpy(buf, "ThrowingAttack"), XS_Mob_ThrowingAttack, file, "$$"); - newXSproto(strcpy(buf, "TryMoveAlong"), XS_Mob_TryMoveAlong, file, "$$$;$"); - newXSproto(strcpy(buf, "TypesTempPet"), XS_Mob_TypesTempPet, file, "$$;$$$$$"); - newXSproto(strcpy(buf, "WalkTo"), XS_Mob_WalkTo, file, "$$$$"); - newXSproto(strcpy(buf, "WearChange"), XS_Mob_WearChange, file, "$$$;$$"); - newXSproto(strcpy(buf, "WipeHateList"), XS_Mob_WipeHateList, file, "$"); - XSRETURN_YES; + package.add("GetHateRandomClient", &Perl_Mob_GetHateRandomClient); + package.add("GetHateRandomNPC", &Perl_Mob_GetHateRandomNPC); + package.add("GetHateTop", &Perl_Mob_GetHateTop); + package.add("GetHeading", &Perl_Mob_GetHeading); + package.add("GetHelmTexture", &Perl_Mob_GetHelmTexture); + package.add("GetHerosForgeModel", &Perl_Mob_GetHerosForgeModel); + package.add("GetID", &Perl_Mob_GetID); + package.add("GetINT", &Perl_Mob_GetINT); + package.add("GetInvisibleLevel", &Perl_Mob_GetInvisibleLevel); + package.add("GetInvisibleUndeadLevel", &Perl_Mob_GetInvisibleUndeadLevel); + package.add("GetInvul", &Perl_Mob_GetInvul); + package.add("GetItemHPBonuses", &Perl_Mob_GetItemHPBonuses); + package.add("GetItemStat", &Perl_Mob_GetItemStat); + package.add("GetLastName", &Perl_Mob_GetLastName); + package.add("GetLevel", &Perl_Mob_GetLevel); + package.add("GetLevelCon", &Perl_Mob_GetLevelCon); + package.add("GetLevelHP", &Perl_Mob_GetLevelHP); + package.add("GetLuclinFace", &Perl_Mob_GetLuclinFace); + package.add("GetMR", &Perl_Mob_GetMR); + package.add("GetMana", &Perl_Mob_GetMana); + package.add("GetManaRatio", &Perl_Mob_GetManaRatio); + package.add("GetMaxAGI", &Perl_Mob_GetMaxAGI); + package.add("GetMaxCHA", &Perl_Mob_GetMaxCHA); + package.add("GetMaxDEX", &Perl_Mob_GetMaxDEX); + package.add("GetMaxHP", &Perl_Mob_GetMaxHP); + package.add("GetMaxINT", &Perl_Mob_GetMaxINT); + package.add("GetMaxMana", &Perl_Mob_GetMaxMana); + package.add("GetMaxSTA", &Perl_Mob_GetMaxSTA); + package.add("GetMaxSTR", &Perl_Mob_GetMaxSTR); + package.add("GetMaxWIS", &Perl_Mob_GetMaxWIS); + package.add("GetMeleeMitigation", &Perl_Mob_GetMeleeMitigation); + package.add("GetModSkillDmgTaken", &Perl_Mob_GetModSkillDmgTaken); + package.add("GetModVulnerability", &Perl_Mob_GetModVulnerability); + package.add("GetNPCTypeID", &Perl_Mob_GetNPCTypeID); + package.add("GetName", &Perl_Mob_GetName); + package.add("GetNimbusEffect1", &Perl_Mob_GetNimbusEffect1); + package.add("GetNimbusEffect2", &Perl_Mob_GetNimbusEffect2); + package.add("GetNimbusEffect3", &Perl_Mob_GetNimbusEffect3); + package.add("GetOwnerID", &Perl_Mob_GetOwnerID); + package.add("GetPR", &Perl_Mob_GetPR); + package.add("GetPetID", &Perl_Mob_GetPetID); + package.add("GetPetOrder", &Perl_Mob_GetPetOrder); + package.add("GetPetType", &Perl_Mob_GetPetType); + package.add("GetPhR", &Perl_Mob_GetPhR); + package.add("GetRace", &Perl_Mob_GetRace); + package.add("GetRaceName", &Perl_Mob_GetRaceName); + package.add("GetResist", &Perl_Mob_GetResist); + package.add("GetReverseFactionCon", &Perl_Mob_GetReverseFactionCon); + package.add("GetRunAnimSpeed", &Perl_Mob_GetRunAnimSpeed); + package.add("GetRunspeed", &Perl_Mob_GetRunspeed); + package.add("GetSTA", &Perl_Mob_GetSTA); + package.add("GetSTR", &Perl_Mob_GetSTR); + package.add("GetSize", &Perl_Mob_GetSize); + package.add("GetSkill", &Perl_Mob_GetSkill); + package.add("GetSkillDmgTaken", &Perl_Mob_GetSkillDmgTaken); + package.add("GetSpecialAbility", &Perl_Mob_GetSpecialAbility); + package.add("GetSpecialAbilityParam", &Perl_Mob_GetSpecialAbilityParam); + package.add("GetSpecializeSkillValue", &Perl_Mob_GetSpecializeSkillValue); + package.add("GetSpellHPBonuses", &Perl_Mob_GetSpellHPBonuses); + package.add("GetSpellIDFromSlot", &Perl_Mob_GetSpellIDFromSlot); + package.add("GetSpellStat", (int(*)(Mob*, uint32, const char*))&Perl_Mob_GetSpellStat); + package.add("GetSpellStat", (int(*)(Mob*, uint32, const char*, uint8))&Perl_Mob_GetSpellStat); + package.add("GetTarget", &Perl_Mob_GetTarget); + package.add("GetTexture", &Perl_Mob_GetTexture); + package.add("GetWIS", &Perl_Mob_GetWIS); + package.add("GetWalkspeed", &Perl_Mob_GetWalkspeed); + package.add("GetWaypointH", &Perl_Mob_GetWaypointH); + package.add("GetWaypointID", &Perl_Mob_GetWaypointID); + package.add("GetWaypointPause", &Perl_Mob_GetWaypointPause); + package.add("GetWaypointX", &Perl_Mob_GetWaypointX); + package.add("GetWaypointY", &Perl_Mob_GetWaypointY); + package.add("GetWaypointZ", &Perl_Mob_GetWaypointZ); + package.add("GetX", &Perl_Mob_GetX); + package.add("GetY", &Perl_Mob_GetY); + package.add("GetZ", &Perl_Mob_GetZ); + package.add("GetZoneID", &Perl_Mob_GetZoneID); + package.add("GoToBind", &Perl_Mob_GoToBind); + package.add("HalveAggro", &Perl_Mob_HalveAggro); + package.add("HasNPCSpecialAtk", &Perl_Mob_HasNPCSpecialAtk); + package.add("HasOwner", &Perl_Mob_HasOwner); + package.add("HasPet", &Perl_Mob_HasPet); + package.add("HasProcs", &Perl_Mob_HasProcs); + package.add("HasShieldEquiped", &Perl_Mob_HasShieldEquiped); + package.add("HasTwoHandBluntEquiped", &Perl_Mob_HasTwoHandBluntEquiped); + package.add("HasTwoHanderEquipped", &Perl_Mob_HasTwoHanderEquipped); + package.add("HateSummon", &Perl_Mob_HateSummon); + package.add("Heal", &Perl_Mob_Heal); + package.add("HealDamage", (void(*)(Mob*, int64_t))&Perl_Mob_HealDamage); + package.add("HealDamage", (void(*)(Mob*, int64_t, Mob*))&Perl_Mob_HealDamage); + package.add("InterruptSpell", (void(*)(Mob*))&Perl_Mob_InterruptSpell); + package.add("InterruptSpell", (void(*)(Mob*, uint16))&Perl_Mob_InterruptSpell); + package.add("IsAIControlled", &Perl_Mob_IsAIControlled); + package.add("IsAmnesiad", &Perl_Mob_IsAmnesiad); + package.add("IsBeacon", &Perl_Mob_IsBeacon); + package.add("IsBeneficialAllowed", &Perl_Mob_IsBeneficialAllowed); + package.add("IsBlind", &Perl_Mob_IsBlind); + package.add("IsBot", &Perl_Mob_IsBot); + package.add("IsCasting", &Perl_Mob_IsCasting); + package.add("IsClient", &Perl_Mob_IsClient); + package.add("IsCorpse", &Perl_Mob_IsCorpse); + package.add("IsDoor", &Perl_Mob_IsDoor); + package.add("IsEliteMaterialItem", &Perl_Mob_IsEliteMaterialItem); + package.add("IsEngaged", &Perl_Mob_IsEngaged); + package.add("IsEnraged", &Perl_Mob_IsEnraged); + package.add("IsFeared", &Perl_Mob_IsFeared); + package.add("IsHorse", &Perl_Mob_IsHorse); + package.add("IsImmuneToSpell", &Perl_Mob_IsImmuneToSpell); + package.add("IsInvisible", (bool(*)(Mob*))&Perl_Mob_IsInvisible); + package.add("IsInvisible", (bool(*)(Mob*, Mob*))&Perl_Mob_IsInvisible); + package.add("IsMeleeDisabled", &Perl_Mob_IsMeleeDisabled); + package.add("IsMezzed", &Perl_Mob_IsMezzed); + package.add("IsMob", &Perl_Mob_IsMob); + package.add("IsMoving", &Perl_Mob_IsMoving); + package.add("IsNPC", &Perl_Mob_IsNPC); + package.add("IsNPCCorpse", &Perl_Mob_IsNPCCorpse); + package.add("IsObject", &Perl_Mob_IsObject); + package.add("IsPet", &Perl_Mob_IsPet); + package.add("IsPlayerCorpse", &Perl_Mob_IsPlayerCorpse); + package.add("IsRoamer", &Perl_Mob_IsRoamer); + package.add("IsRooted", &Perl_Mob_IsRooted); + package.add("IsRunning", &Perl_Mob_IsRunning); + package.add("IsSilenced", &Perl_Mob_IsSilenced); + package.add("IsStunned", &Perl_Mob_IsStunned); + package.add("IsTargetable", &Perl_Mob_IsTargetable); + package.add("IsTargeted", &Perl_Mob_IsTargeted); + package.add("IsTrap", &Perl_Mob_IsTrap); + package.add("IsWarriorClass", &Perl_Mob_IsWarriorClass); + package.add("Kill", &Perl_Mob_Kill); + package.add("MakePet", (void(*)(Mob*, uint16, const char*))&Perl_Mob_MakePet); + package.add("MakePet", (void(*)(Mob*, uint16, const char*, const char*))&Perl_Mob_MakePet); + package.add("MakeTempPet", (void(*)(Mob*, uint16))&Perl_Mob_MakeTempPet); + package.add("MakeTempPet", (void(*)(Mob*, uint16, const char*))&Perl_Mob_MakeTempPet); + package.add("MakeTempPet", (void(*)(Mob*, uint16, const char*, uint32))&Perl_Mob_MakeTempPet); + package.add("MakeTempPet", (void(*)(Mob*, uint16, const char*, uint32, Mob*))&Perl_Mob_MakeTempPet); + package.add("MakeTempPet", (void(*)(Mob*, uint16, const char*, uint32, Mob*, bool))&Perl_Mob_MakeTempPet); + package.add("Mesmerize", &Perl_Mob_Mesmerize); + package.add("Message", &Perl_Mob_Message); + package.add("Message_StringID", (void(*)(Mob*, uint32, uint32))&Perl_Mob_Message_StringID); + package.add("Message_StringID", (void(*)(Mob*, uint32, uint32, uint32))&Perl_Mob_Message_StringID); + package.add("ModSkillDmgTaken", &Perl_Mob_ModSkillDmgTaken); + package.add("ModVulnerability", &Perl_Mob_ModVulnerability); + package.add("NPCSpecialAttacks", (void(*)(Mob*, const char*, int))&Perl_Mob_NPCSpecialAttacks); + package.add("NPCSpecialAttacks", (void(*)(Mob*, const char*, int, bool))&Perl_Mob_NPCSpecialAttacks); + package.add("NPCSpecialAttacks", (void(*)(Mob*, const char*, int, bool, bool))&Perl_Mob_NPCSpecialAttacks); + package.add("NavigateTo", &Perl_Mob_NavigateTo); + package.add("ProcessSpecialAbilities", &Perl_Mob_ProcessSpecialAbilities); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool, float))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool, float, float))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool, float, float, float))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool, float, float, float, float))&Perl_Mob_ProjectileAnim); + package.add("ProjectileAnim", (void(*)(Mob*, Mob*, int, bool, float, float, float, float, const char*))&Perl_Mob_ProjectileAnim); + package.add("RandomizeFeatures", &Perl_Mob_RandomizeFeatures); + package.add("RangedAttack", &Perl_Mob_RangedAttack); + package.add("RemoveAllAppearanceEffects", &Perl_Mob_RemoveAllAppearanceEffects); + package.add("RemoveAllNimbusEffects", &Perl_Mob_RemoveAllNimbusEffects); + package.add("RemoveFromFeignMemory", &Perl_Mob_RemoveFromFeignMemory); + package.add("RemoveNimbusEffect", &Perl_Mob_RemoveNimbusEffect); + package.add("RemovePet", &Perl_Mob_RemovePet); + package.add("ResistSpell", &Perl_Mob_ResistSpell); + package.add("RogueAssassinate", &Perl_Mob_RogueAssassinate); + package.add("RunTo", &Perl_Mob_RunTo); + package.add("Say", &Perl_Mob_Say); + package.add("SeeHide", &Perl_Mob_SeeHide); + package.add("SeeImprovedHide", &Perl_Mob_SeeImprovedHide); + package.add("SeeInvisible", &Perl_Mob_SeeInvisible); + package.add("SeeInvisibleUndead", &Perl_Mob_SeeInvisibleUndead); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffect", (void(*)(Mob*, int32, int32, int32, int32, int32, perl::nullable, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_Mob_SendAppearanceEffect); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32, int32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32, int32, uint32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32, int32, uint32, int32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32, int32, uint32, int32, uint32))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectActor", (void(*)(Mob*, int32, uint32, int32, uint32, int32, uint32, int32, uint32, int32, uint32, Client*))&Perl_Mob_SendAppearanceEffectActor); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32, int32))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32, int32, int32))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32, int32, int32, int32))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32, int32, int32, int32, int32))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendAppearanceEffectGround", (void(*)(Mob*, int32, int32, int32, int32, int32, Client*))&Perl_Mob_SendAppearanceEffectGround); + package.add("SendIllusion", (void(*)(Mob*, uint16))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint32))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint32, uint32))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint32, uint32, uint32))&Perl_Mob_SendIllusion); + package.add("SendIllusion", (void(*)(Mob*, uint16, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint8, uint32, uint32, uint32, float))&Perl_Mob_SendIllusion); + package.add("SendTo", &Perl_Mob_SendTo); + package.add("SendToFixZ", &Perl_Mob_SendToFixZ); + package.add("SendWearChange", &Perl_Mob_SendWearChange); + package.add("SetAA", (bool(*)(Mob*, int, int))&Perl_Mob_SetAA); + package.add("SetAA", (bool(*)(Mob*, int, int, int))&Perl_Mob_SetAA); + package.add("SetAllowBeneficial", &Perl_Mob_SetAllowBeneficial); + package.add("SetAppearance", (void(*)(Mob*, int))&Perl_Mob_SetAppearance); + package.add("SetAppearance", (void(*)(Mob*, int, bool))&Perl_Mob_SetAppearance); + package.add("SetBodyType", (void(*)(Mob*, int32))&Perl_Mob_SetBodyType); + package.add("SetBodyType", (void(*)(Mob*, int32, bool))&Perl_Mob_SetBodyType); + package.add("SetBucket", (void(*)(Mob*, std::string, std::string))&Perl_Mob_SetBucket); + package.add("SetBucket", (void(*)(Mob*, std::string, std::string, std::string))&Perl_Mob_SetBucket); + package.add("SetBuffDuration", (void(*)(Mob*, int))&Perl_Mob_SetBuffDuration); + package.add("SetBuffDuration", (void(*)(Mob*, int, int))&Perl_Mob_SetBuffDuration); + package.add("SetCurrentWP", &Perl_Mob_SetCurrentWP); + package.add("SetDeltas", &Perl_Mob_SetDeltas); + package.add("SetDisableMelee", &Perl_Mob_SetDisableMelee); + package.add("SetEntityVariable", &Perl_Mob_SetEntityVariable); + package.add("SetExtraHaste", &Perl_Mob_SetExtraHaste); + package.add("SetFlurryChance", &Perl_Mob_SetFlurryChance); + package.add("SetFlyMode", &Perl_Mob_SetFlyMode); + package.add("SetFollowID", &Perl_Mob_SetFollowID); + package.add("SetGender", &Perl_Mob_SetGender); + package.add("SetGlobal", (void(*)(Mob*, const char*, const char*, int, const char*))&Perl_Mob_SetGlobal); + package.add("SetGlobal", (void(*)(Mob*, const char*, const char*, int, const char*, Mob*))&Perl_Mob_SetGlobal); + package.add("SetHP", &Perl_Mob_SetHP); + package.add("SetHate", (void(*)(Mob*, Mob*))&Perl_Mob_SetHate); + package.add("SetHate", (void(*)(Mob*, Mob*, int64_t))&Perl_Mob_SetHate); + package.add("SetHate", (void(*)(Mob*, Mob*, int64_t, int64_t))&Perl_Mob_SetHate); + package.add("SetHeading", &Perl_Mob_SetHeading); + package.add("SetInvisible", &Perl_Mob_SetInvisible); + package.add("SetInvul", &Perl_Mob_SetInvul); + package.add("SetLD", &Perl_Mob_SetLD); + package.add("SetLevel", (void(*)(Mob*, uint8_t))&Perl_Mob_SetLevel); + package.add("SetLevel", (void(*)(Mob*, uint8_t, bool))&Perl_Mob_SetLevel); + package.add("SetMana", &Perl_Mob_SetMana); + package.add("SetMaxHP", &Perl_Mob_SetMaxHP); + package.add("SetOOCRegen", &Perl_Mob_SetOOCRegen); + package.add("SetOwnerID", &Perl_Mob_SetOwnerID); + package.add("SetPet", &Perl_Mob_SetPet); + package.add("SetPetID", &Perl_Mob_SetPetID); + package.add("SetPetOrder", &Perl_Mob_SetPetOrder); + package.add("SetRace", &Perl_Mob_SetRace); + package.add("SetRunAnimSpeed", &Perl_Mob_SetRunAnimSpeed); + package.add("SetRunning", &Perl_Mob_SetRunning); + package.add("SetSeeInvisibleLevel", &Perl_Mob_SetSeeInvisibleLevel); + package.add("SetSeeInvisibleUndeadLevel", &Perl_Mob_SetSeeInvisibleUndeadLevel); + package.add("SetSlotTint", &Perl_Mob_SetSlotTint); + package.add("SetSpecialAbility", &Perl_Mob_SetSpecialAbility); + package.add("SetSpecialAbilityParam", &Perl_Mob_SetSpecialAbilityParam); + package.add("SetTarget", &Perl_Mob_SetTarget); + package.add("SetTargetable", &Perl_Mob_SetTargetable); + package.add("SetTexture", &Perl_Mob_SetTexture); + package.add("ShieldAbility", (void(*)(Mob*, uint32))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32, int32))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32, int32, int32))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32, int32, int32, int32))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32, int32, int32, int32, bool))&Perl_Mob_ShieldAbility); + package.add("ShieldAbility", (void(*)(Mob*, uint32, int32, int32, int32, int32, bool, bool))&Perl_Mob_ShieldAbility); + package.add("Shout", &Perl_Mob_Shout); + package.add("SignalClient", &Perl_Mob_SignalClient); + package.add("SpellEffect", (void(*)(Mob*, uint32))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool, uint32))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool, uint32, bool))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool, uint32, bool, Client*))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool, uint32, bool, perl::nullable, uint32))&Perl_Mob_SpellEffect); + package.add("SpellEffect", (void(*)(Mob*, uint32, uint32, uint32, bool, uint32, bool, perl::nullable, uint32, uint32))&Perl_Mob_SpellEffect); + package.add("SpellFinished", (void(*)(Mob*, uint16, Mob*))&Perl_Mob_SpellFinished); + package.add("SpellFinished", (void(*)(Mob*, uint16, Mob*, uint16))&Perl_Mob_SpellFinished); + package.add("SpellFinished", (void(*)(Mob*, uint16, Mob*, uint16, uint16))&Perl_Mob_SpellFinished); + package.add("Spin", &Perl_Mob_Spin); + package.add("StartEnrage", &Perl_Mob_StartEnrage); + package.add("StopNavigation", &Perl_Mob_StopNavigation); + package.add("Stun", &Perl_Mob_Stun); + package.add("TarGlobal", &Perl_Mob_TarGlobal); + package.add("TempName", (void(*)(Mob*))&Perl_Mob_TempName); + package.add("TempName", (void(*)(Mob*, const char*))&Perl_Mob_TempName); + package.add("ThrowingAttack", &Perl_Mob_ThrowingAttack); + package.add("TryMoveAlong", (void(*)(Mob*, float, float))&Perl_Mob_TryMoveAlong); + package.add("TryMoveAlong", (void(*)(Mob*, float, float, bool))&Perl_Mob_TryMoveAlong); + package.add("TypesTempPet", (void(*)(Mob*, uint32))&Perl_Mob_TypesTempPet); + package.add("TypesTempPet", (void(*)(Mob*, uint32, const char*))&Perl_Mob_TypesTempPet); + package.add("TypesTempPet", (void(*)(Mob*, uint32, const char*, uint32))&Perl_Mob_TypesTempPet); + package.add("TypesTempPet", (void(*)(Mob*, uint32, const char*, uint32, bool))&Perl_Mob_TypesTempPet); + package.add("TypesTempPet", (void(*)(Mob*, uint32, const char*, uint32, bool, Mob*))&Perl_Mob_TypesTempPet); + package.add("TypesTempPet", (void(*)(Mob*, uint32, const char*, uint32, bool, Mob*, bool))&Perl_Mob_TypesTempPet); + package.add("WalkTo", &Perl_Mob_WalkTo); + package.add("WearChange", (void(*)(Mob*, uint8, uint16, uint32))&Perl_Mob_WearChange); + package.add("WearChange", (void(*)(Mob*, uint8, uint16, uint32, uint32))&Perl_Mob_WearChange); + package.add("WipeHateList", &Perl_Mob_WipeHateList); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 1f11fe60b..9479f03a6 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -4,2055 +4,791 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - -typedef const char Const_char; - #include "npc.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_NPC \ - do { \ - if (sv_derived_from(ST(0), "NPC")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(NPC*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type NPC"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_NPC_SignalNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SignalNPC) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SignalNPC(THIS, int signal_id)"); // @categories Script Utility - { - NPC *THIS; - int _signal_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SignalNPC(_signal_id); - } - XSRETURN_EMPTY; +void Perl_NPC_SignalNPC(NPC* self, int signal_id) // @categories Script Utility +{ + self->SignalNPC(signal_id); } -XS(XS_NPC_CheckNPCFactionAlly); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_CheckNPCFactionAlly) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::CheckNPCFactionAlly(THIS, int32 faction_id)"); // @categories Faction - { - NPC *THIS; - FACTION_VALUE RETVAL; - dXSTARG; - int32 other_faction = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->CheckNPCFactionAlly(other_faction); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int Perl_NPC_CheckNPCFactionAlly(NPC* self, int32 faction_id) // @categories Faction +{ + return self->CheckNPCFactionAlly(faction_id); } -XS(XS_NPC_AddItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AddItem) { - dXSARGS; - if (items < 2 || items > 10) - Perl_croak(aTHX_ "Usage: NPC::AddItem(THIS, uint32 item_id, [uint16 charges = 0], [bool equip_item = true], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint32 aug6 = 0])"); // @categories Inventory and Items - { - NPC *THIS; - uint32 itemid = (uint32) SvUV(ST(1)); - uint16 charges = 0; - bool equipitem = true; - uint32 aug1 = 0; - uint32 aug2 = 0; - uint32 aug3 = 0; - uint32 aug4 = 0; - uint32 aug5 = 0; - uint32 aug6 = 0; - VALIDATE_THIS_IS_NPC; - if (items > 2) - charges = (uint16) SvUV(ST(2)); - if (items > 3) - equipitem = (bool) SvTRUE(ST(3)); - if (items > 4) - aug1 = (uint32) SvUV(ST(4)); - if (items > 5) - aug2 = (uint32) SvUV(ST(5)); - if (items > 6) - aug3 = (uint32) SvUV(ST(6)); - if (items > 7) - aug4 = (uint32) SvUV(ST(7)); - if (items > 8) - aug5 = (uint32) SvUV(ST(8)); - if (items > 9) - aug6 = (uint32) SvUV(ST(9)); - - THIS->AddItem(itemid, charges, equipitem, aug1, aug2, aug3, aug4, aug5, aug6); - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id) // @categories Inventory and Items +{ + self->AddItem(item_id, 0); } -XS(XS_NPC_AddLootTable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AddLootTable) { - dXSARGS; - if (items < 1) - Perl_croak(aTHX_ "Usage: NPC::AddLootTable(THIS, [uint32 loottable_id])"); // @categories Inventory and Items - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - uint32 loottable_id = 0; - - if (items > 1) { - loottable_id = (uint32) SvUV(ST(1)); - THIS->AddLootTable(loottable_id); - } else { - THIS->AddLootTable(); - } - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges) // @categories Inventory and Items +{ + self->AddItem(item_id, charges); } -XS(XS_NPC_RemoveItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RemoveItem) { - dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: NPC::RemoveItem(THIS, uint32 item_id, [uint16 quantity = 0], [uint16 slot_id = 0])"); // @categories Inventory and Items - { - NPC *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - uint16 quantity; - uint16 slot; - VALIDATE_THIS_IS_NPC; - if (items < 3) - quantity = 0; - else { - quantity = (uint16) SvUV(ST(2)); - } - - if (items < 4) - slot = 0; - else { - slot = (uint16) SvUV(ST(3)); - } - - THIS->RemoveItem(item_id, quantity, slot); - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item); } -XS(XS_NPC_ClearItemList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ClearItemList) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::ClearItemList(THIS)"); // @categories Inventory and Items - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->ClearItemList(); - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1); } -XS(XS_NPC_AddCash); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AddCash) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: NPC::AddCash(THIS, uint16 copper, uint16 silver, uint16 gold, uint16 platinum)"); // @categories Currency and Points - { - NPC *THIS; - uint16 in_copper = (uint16) SvUV(ST(1)); - uint16 in_silver = (uint16) SvUV(ST(2)); - uint16 in_gold = (uint16) SvUV(ST(3)); - uint16 in_platinum = (uint16) SvUV(ST(4)); - VALIDATE_THIS_IS_NPC; - THIS->AddCash(in_copper, in_silver, in_gold, in_platinum); - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1, uint32 aug2) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1, aug2); } -XS(XS_NPC_RemoveCash); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RemoveCash) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::RemoveCash(THIS)"); // @categories Currency and Points - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->RemoveCash(); - } - XSRETURN_EMPTY; +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1, uint32 aug2, uint32 aug3) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1, aug2, aug3); } -XS(XS_NPC_CountLoot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_CountLoot) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::CountLoot(THIS)"); // @categories Inventory and Items - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->CountLoot(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1, aug2, aug3, aug4); } -XS(XS_NPC_GetLoottableID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetLoottableID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetLoottableID(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetLoottableID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1, aug2, aug3, aug4, aug5); } -XS(XS_NPC_GetCopper); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetCopper) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetCopper(THIS)"); // @categories Currency and Points - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetCopper(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AddItem(NPC* self, uint32 item_id, uint16 charges, bool equip_item, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) // @categories Inventory and Items +{ + self->AddItem(item_id, charges, equip_item, aug1, aug2, aug3, aug4, aug5, aug6); } -XS(XS_NPC_GetSilver); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSilver) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSilver(THIS)"); // @categories Currency and Points - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSilver(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AddLootTable(NPC* self) // @categories Inventory and Items +{ + self->AddLootTable(); } -XS(XS_NPC_GetGold); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetGold) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetGold(THIS)"); // @categories Currency and Points - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetGold(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AddLootTable(NPC* self, uint32 loottable_id) // @categories Inventory and Items +{ + self->AddLootTable(loottable_id); } -XS(XS_NPC_GetPlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetPlatinum) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetPlatinum(THIS)"); // @categories Currency and Points - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetPlatinum(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_RemoveItem(NPC* self, uint32 item_id) // @categories Inventory and Items +{ + self->RemoveItem(item_id); } -XS(XS_NPC_SetCopper); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetCopper) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetCopper(THIS, uint32 copper_amount)"); // @categories Currency and Points - { - NPC *THIS; - uint32 amt = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetCopper(amt); - } - XSRETURN_EMPTY; +void Perl_NPC_RemoveItem(NPC* self, uint32 item_id, uint16 quantity) // @categories Inventory and Items +{ + self->RemoveItem(item_id, quantity); } -XS(XS_NPC_SetSilver); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSilver) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSilver(THIS, uint32 silver_amount)"); // @categories Currency and Points - { - NPC *THIS; - uint32 amt = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSilver(amt); - } - XSRETURN_EMPTY; +void Perl_NPC_RemoveItem(NPC* self, uint32 item_id, uint16 quantity, uint16 slot_id) // @categories Inventory and Items +{ + self->RemoveItem(item_id, quantity, slot_id); } -XS(XS_NPC_SetGold); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetGold) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetGold(THIS, uint32 gold_amount)"); // @categories Currency and Points - { - NPC *THIS; - uint32 amt = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetGold(amt); - } - XSRETURN_EMPTY; +void Perl_NPC_ClearItemList(NPC* self) // @categories Inventory and Items +{ + self->ClearItemList(); } -XS(XS_NPC_SetPlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetPlatinum) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetPlatinum(THIS, uint32 platinum_amount)"); // @categories Currency and Points - { - NPC *THIS; - uint32 amt = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetPlatinum(amt); - } - XSRETURN_EMPTY; +void Perl_NPC_AddCash(NPC* self, uint16 copper, uint16 silver, uint16 gold, uint16 platinum) // @categories Currency and Points +{ + self->AddCash(copper, silver, gold, platinum); } -XS(XS_NPC_SetGrid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetGrid) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetGrid(THIS, int32 grid_id)"); // @categories Script Utility - { - NPC *THIS; - int32 grid_ = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetGrid(grid_); - } - XSRETURN_EMPTY; +void Perl_NPC_RemoveCash(NPC* self) // @categories Currency and Points +{ + self->RemoveCash(); } -XS(XS_NPC_SetSaveWaypoint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSaveWaypoint) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSaveWaypoint(THIS, uint16 waypoint)"); // @categories Script Utility - { - NPC *THIS; - uint16 waypoint = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSaveWaypoint(waypoint); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_CountLoot(NPC* self) // @categories Inventory and Items +{ + return self->CountLoot(); } -XS(XS_NPC_SetSp2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSp2) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSp2(THIS, uint32 set_spawn_group_id)"); // @categories Spawns - { - NPC *THIS; - uint32 sg2 = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSpawnGroupId(sg2); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_GetLoottableID(NPC* self) // @categories Stats and Attributes +{ + return self->GetLoottableID(); } -XS(XS_NPC_GetWaypointMax); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetWaypointMax) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetWaypointMax(THIS)"); // @categories Script Utility - { - NPC *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetWaypointMax(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetCopper(NPC* self) // @categories Currency and Points +{ + return self->GetCopper(); } -XS(XS_NPC_GetGrid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetGrid) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetGrid(THIS)"); // @categories Script Utility, Spawns - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetGrid(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetSilver(NPC* self) // @categories Currency and Points +{ + return self->GetSilver(); } -XS(XS_NPC_GetSp2); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSp2) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSp2(THIS)"); // @categories Spawns - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnGroupId(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetGold(NPC* self) // @categories Currency and Points +{ + return self->GetGold(); } -XS(XS_NPC_GetNPCFactionID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetNPCFactionID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetNPCFactionID(THIS)"); // @categories Faction, Stats and Attributes - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetNPCFactionID(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetPlatinum(NPC* self) // @categories Currency and Points +{ + return self->GetPlatinum(); } -XS(XS_NPC_GetPrimaryFaction); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetPrimaryFaction) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetPrimaryFaction(THIS)"); // @categories Faction, Stats and Attributes - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetPrimaryFaction(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SetCopper(NPC* self, uint32 amt) // @categories Currency and Points +{ + self->SetCopper(amt); } -XS(XS_NPC_GetNPCHate); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetNPCHate) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::GetNPCHate(THIS, Mob* entity)"); // @categories Hate and Aggro - { - NPC *THIS; - int64 RETVAL; - dXSTARG; - Mob *in_ent; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - in_ent = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "in_ent is not of type Mob"); - if (in_ent == nullptr) - Perl_croak(aTHX_ "in_ent is nullptr, avoiding crash."); - - RETVAL = THIS->GetNPCHate(in_ent); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SetSilver(NPC* self, uint32 amt) // @categories Currency and Points +{ + self->SetSilver(amt); } -XS(XS_NPC_IsOnHatelist); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_IsOnHatelist) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::IsOnHatelist(THIS, Mob* target)"); // @categories Hate and Aggro - { - NPC *THIS; - bool RETVAL; - Mob *p; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - p = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "p is not of type Mob"); - if (p == nullptr) - Perl_croak(aTHX_ "p is nullptr, avoiding crash."); - - RETVAL = THIS->IsOnHatelist(p); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_NPC_SetGold(NPC* self, uint32 amt) // @categories Currency and Points +{ + self->SetGold(amt); } -XS(XS_NPC_RemoveFromHateList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RemoveFromHateList) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveFromHateList(THIS, Mob* target)"); // @categories Hate and Aggro - { - NPC *THIS; - Mob *ent; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - ent = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "ent is not of type Mob"); - if (ent == nullptr) - Perl_croak(aTHX_ "ent is nullptr, avoiding crash."); - - THIS->RemoveFromHateList(ent); +void Perl_NPC_SetPlatinum(NPC* self, uint32 amt) // @categories Currency and Points +{ + self->SetPlatinum(amt); +} - } - XSRETURN_EMPTY; +void Perl_NPC_SetGrid(NPC* self, int grid) // @categories Script Utility +{ + self->SetGrid(grid); } +void Perl_NPC_SetSaveWaypoint(NPC* self, uint16 wp) // @categories Script Utility +{ + self->SetSaveWaypoint(wp); +} -XS(XS_NPC_SetNPCFactionID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetNPCFactionID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetNPCFactionID(THIS, int32 faction_id)"); // @categories Faction - { - NPC *THIS; - int32 in = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetNPCFactionID(in); - } - XSRETURN_EMPTY; +void Perl_NPC_SetSp2(NPC* self, uint32 set_spawn_group_id) // @categories Spawns +{ + self->SetSpawnGroupId(set_spawn_group_id); } -XS(XS_NPC_GetMaxDMG); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetMaxDMG) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetMaxDMG(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetMaxDMG(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_NPC_GetWaypointMax(NPC* self) // @categories Script Utility +{ + return self->GetWaypointMax(); } -XS(XS_NPC_GetMinDMG); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetMinDMG) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetMinDMG(THIS)"); - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetMinDMG(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_NPC_GetGrid(NPC* self) // @categories Script Utility, Spawns +{ + return self->GetGrid(); } +uint32_t Perl_NPC_GetSp2(NPC* self) // @categories Spawns +{ + return self->GetSpawnGroupId(); +} -XS(XS_NPC_IsAnimal); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_IsAnimal) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::IsAnimal(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - bool RETVAL; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->IsAnimal(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_NPC_GetNPCFactionID(NPC* self) // @categories Faction, Stats and Attributes +{ + return self->GetNPCFactionID(); } -XS(XS_NPC_GetPetSpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetPetSpellID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetPetSpellID(THIS)"); // @categories Stats and Attributes, Pet - { - NPC *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetPetSpellID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +int Perl_NPC_GetPrimaryFaction(NPC* self) // @categories Faction, Stats and Attributes +{ + return self->GetPrimaryFaction(); } -XS(XS_NPC_SetPetSpellID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetPetSpellID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetPetSpellID(THIS, uint16 amount)"); // @categories Pet - { - NPC *THIS; - uint16 amt = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetPetSpellID(amt); - } - XSRETURN_EMPTY; +int64_t Perl_NPC_GetNPCHate(NPC* self, Mob* mob) // @categories Hate and Aggro +{ + return self->GetNPCHate(mob); } -XS(XS_NPC_GetMaxDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetMaxDamage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::GetMaxDamage(THIS, uint8 target_level)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - uint8 tlevel = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetMaxDamage(tlevel); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +bool Perl_NPC_IsOnHatelist(NPC* self, Mob* mob) // @categories Hate and Aggro +{ + return self->IsOnHatelist(mob); } -XS(XS_NPC_SetTaunting); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetTaunting) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetTaunting(THIS, bool toggle)"); // @categories Script Utility - { - NPC *THIS; - bool toggle = (bool) SvTRUE(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetTaunting(toggle); - } - XSRETURN_EMPTY; +void Perl_NPC_RemoveFromHateList(NPC* self, Mob* mob) // @categories Hate and Aggro +{ + self->RemoveFromHateList(mob); } -XS(XS_NPC_IsTaunting); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_IsTaunting) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::IsTaunting(THIS)"); - { - NPC *THIS; - bool RETVAL; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->IsTaunting(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_NPC_SetNPCFactionID(NPC* self, int faction_id) // @categories Faction +{ + self->SetNPCFactionID(faction_id); } -XS(XS_NPC_PickPocket); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_PickPocket) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::PickPocket(THIS, Client* thief)"); // @categories Skills and Recipes - { - NPC *THIS; - Client *thief; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - thief = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "thief is not of type Client"); - if (thief == nullptr) - Perl_croak(aTHX_ "thief is nullptr, avoiding crash."); - - THIS->PickPocket(thief); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_GetMaxDMG(NPC* self) // @categories Stats and Attributes +{ + return self->GetMaxDMG(); } -XS(XS_NPC_StartSwarmTimer); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_StartSwarmTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::StartSwarmTimer(THIS, uint32 duration)"); // @categories Script Utility, Pet - { - NPC *THIS; - uint32 duration = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->StartSwarmTimer(duration); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_GetMinDMG(NPC* self) +{ + return self->GetMinDMG(); } -XS(XS_NPC_DoClassAttacks); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_DoClassAttacks) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::DoClassAttacks(THIS, Mob* target)"); // @categories Script Utility - { - NPC *THIS; - Mob *target; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - target = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "target is not of type Mob"); - if (target == nullptr) - Perl_croak(aTHX_ "target is nullptr, avoiding crash."); - - THIS->DoClassAttacks(target); - } - XSRETURN_EMPTY; +bool Perl_NPC_IsAnimal(NPC* self) // @categories Stats and Attributes +{ + return self->IsAnimal(); } -XS(XS_NPC_GetMaxWp); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetMaxWp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetMaxWp(THIS)"); - { - NPC *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetMaxWp(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +int Perl_NPC_GetPetSpellID(NPC* self) // @categories Stats and Attributes, Pet +{ + return self->GetPetSpellID(); } -XS(XS_NPC_DisplayWaypointInfo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_DisplayWaypointInfo) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::DisplayWaypointInfo(THIS, Client* client)"); // @categories Script Utility - { - NPC *THIS; - Client *client; - VALIDATE_THIS_IS_NPC; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else { - Perl_croak(aTHX_ "client is not of type Client"); - } - - if (!client) { - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - } - - THIS->DisplayWaypointInfo(client); - } - XSRETURN_EMPTY; +void Perl_NPC_SetPetSpellID(NPC* self, uint16 amount) // @categories Pet +{ + self->SetPetSpellID(amount); } -XS(XS_NPC_CalculateNewWaypoint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_CalculateNewWaypoint) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::CalculateNewWaypoint(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->CalculateNewWaypoint(); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_GetMaxDamage(NPC* self, uint8 target_level) // @categories Stats and Attributes +{ + return self->GetMaxDamage(target_level); } -XS(XS_NPC_AssignWaypoints); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AssignWaypoints) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::AssignWaypoints(THIS, uint32 grid_id)"); // @categories Script Utility - { - NPC *THIS; - uint32 grid = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->AssignWaypoints(grid); - } - XSRETURN_EMPTY; +void Perl_NPC_SetTaunting(NPC* self, bool on) // @categories Script Utility +{ + self->SetTaunting(on); } -XS(XS_NPC_SetWaypointPause); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetWaypointPause) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::SetWaypointPause(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->SetWaypointPause(); - } - XSRETURN_EMPTY; +bool Perl_NPC_IsTaunting(NPC* self) +{ + return self->IsTaunting(); } -XS(XS_NPC_UpdateWaypoint); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_UpdateWaypoint) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::UpdateWaypoint(THIS, int wp_index)"); // @categories Script Utility - { - NPC *THIS; - int wp_index = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->UpdateWaypoint(wp_index); - } - XSRETURN_EMPTY; +void Perl_NPC_PickPocket(NPC* self, Client* thief) // @categories Skills and Recipes +{ + self->PickPocket(thief); } -XS(XS_NPC_StopWandering); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_StopWandering) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::StopWandering(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->StopWandering(); - } - XSRETURN_EMPTY; +void Perl_NPC_StartSwarmTimer(NPC* self, uint32 duration) // @categories Script Utility, Pet +{ + self->StartSwarmTimer(duration); } -XS(XS_NPC_ResumeWandering); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ResumeWandering) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::ResumeWandering(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->ResumeWandering(); - } - XSRETURN_EMPTY; +void Perl_NPC_DoClassAttacks(NPC* self, Mob* target) // @categories Script Utility +{ + self->DoClassAttacks(target); } -XS(XS_NPC_PauseWandering); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_PauseWandering) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::PauseWandering(THIS, int pause_time)"); // @categories Script Utility - { - NPC *THIS; - int pausetime = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->PauseWandering(pausetime); - } - XSRETURN_EMPTY; +int Perl_NPC_GetMaxWp(NPC* self) +{ + return self->GetMaxWp(); } -XS(XS_NPC_MoveTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_MoveTo) { - dXSARGS; - if (items != 4 && items != 5 && items != 6) - Perl_croak(aTHX_ "Usage: NPC::MoveTo(THIS, float x, float y, float z, [float heading], [bool save_guard_location = false])"); // @categories Script Utility - { - NPC *THIS; - float mtx = (float) SvNV(ST(1)); - float mty = (float) SvNV(ST(2)); - float mtz = (float) SvNV(ST(3)); - float mth = 0; - bool saveguard = false; - VALIDATE_THIS_IS_NPC; - if (items > 4) - mth = (float) SvNV(ST(4)); - if (items > 5) - saveguard = (bool) SvTRUE(ST(5)); - auto position = glm::vec4(mtx, mty, mtz, mth); - THIS->MoveTo(position, saveguard); - } - XSRETURN_EMPTY; +void Perl_NPC_DisplayWaypointInfo(NPC* self, Client* client) // @categories Script Utility +{ + self->DisplayWaypointInfo(client); } -XS(XS_NPC_NextGuardPosition); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_NextGuardPosition) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::NextGuardPosition(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->NextGuardPosition(); - } - XSRETURN_EMPTY; +void Perl_NPC_CalculateNewWaypoint(NPC* self) // @categories Script Utility +{ + self->CalculateNewWaypoint(); } -XS(XS_NPC_SaveGuardSpot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SaveGuardSpot) { - dXSARGS; - if (items != 1 && items != 2 && items != 5) - Perl_croak(aTHX_ "Usage: NPC::SaveGuardSpot(THIS, x, y, z, heading)"); // @categories Script Utility - { - NPC *THIS; - if (items == 1 || items == 2) { - bool clear_guard_spot = false; - - if (items > 1) { - clear_guard_spot = (bool) SvTRUE(ST(1)); - } - - VALIDATE_THIS_IS_NPC; - THIS->SaveGuardSpot(clear_guard_spot); - } else if (items == 5) { - float x = (float)SvNV(ST(1)); - float y = (float)SvNV(ST(2)); - float z = (float)SvNV(ST(3)); - float heading = (float)SvNV(ST(4)); - VALIDATE_THIS_IS_NPC; - THIS->SaveGuardSpot(glm::vec4(x, y, z, heading)); - } - } - XSRETURN_EMPTY; +void Perl_NPC_AssignWaypoints(NPC* self, uint32 grid_id) // @categories Script Utility +{ + self->AssignWaypoints(grid_id); } -XS(XS_NPC_IsGuarding); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_IsGuarding) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::IsGuarding(THIS)"); // @categories Script Utility - { - NPC *THIS; - bool RETVAL; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->IsGuarding(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_NPC_SetWaypointPause(NPC* self) // @categories Script Utility +{ + self->SetWaypointPause(); } -XS(XS_NPC_AI_SetRoambox); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AI_SetRoambox) { - dXSARGS; - if (items < 6 || items > 8) - Perl_croak(aTHX_ "Usage: NPC::AI_SetRoambox(THIS, float distance, float max_x, float min_x, float max_y, float min_y, [uint32 max_delay = 2500], [uint32 min_delay = 2500])"); // @categories Script Utility - { - NPC *THIS; - float iDist = (float) SvNV(ST(1)); - float iMaxX = (float) SvNV(ST(2)); - float iMinX = (float) SvNV(ST(3)); - float iMaxY = (float) SvNV(ST(4)); - float iMinY = (float) SvNV(ST(5)); - uint32 iDelay; - uint32 iMinDelay; - VALIDATE_THIS_IS_NPC; - if (items < 7) { - iMinDelay = 2500; - iDelay = 2500; - } else if (items < 8) { - iMinDelay = 2500; - iDelay = (uint32) SvUV(ST(6)); - } else { - iDelay = (uint32) SvUV(ST(6)); - iMinDelay = (uint32) SvUV(ST(7)); - } - - THIS->AI_SetRoambox(iDist, iMaxX, iMinX, iMaxY, iMinY, iDelay, iMinDelay); - } - XSRETURN_EMPTY; +void Perl_NPC_UpdateWaypoint(NPC* self, int wp_index) // @categories Script Utility +{ + self->UpdateWaypoint(wp_index); } -XS(XS_NPC_GetNPCSpellsID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetNPCSpellsID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetNPCSpellsID(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetNPCSpellsID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_StopWandering(NPC* self) // @categories Script Utility +{ + self->StopWandering(); } -XS(XS_NPC_GetSpawnPointID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnPointID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnPointID(THIS)"); // @categories Spawns - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnPointID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_ResumeWandering(NPC* self) // @categories Script Utility +{ + self->ResumeWandering(); } -XS(XS_NPC_GetSpawnPointX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnPointX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnPointX(THIS)"); // @categories Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnPoint().x; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_PauseWandering(NPC* self, int pause_time) // @categories Script Utility +{ + self->PauseWandering(pause_time); } -XS(XS_NPC_GetSpawnPointY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnPointY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnPointY(THIS)"); // @categories Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnPoint().y; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_MoveTo(NPC* self, float x, float y, float z) // @categories Script Utility +{ + auto position = glm::vec4(x, y, z, 0); + self->MoveTo(position, false); } -XS(XS_NPC_GetSpawnPointZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnPointZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnPointZ(THIS)"); // @categories Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnPoint().z; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_MoveTo(NPC* self, float x, float y, float z, float h) // @categories Script Utility +{ + auto position = glm::vec4(x, y, z, h); + self->MoveTo(position, false); } -XS(XS_NPC_GetSpawnPointH); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnPointH) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnPointH(THIS)"); // @categories Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnPoint().w; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_MoveTo(NPC* self, float x, float y, float z, float h, bool save) // @categories Script Utility +{ + auto position = glm::vec4(x, y, z, h); + self->MoveTo(position, save); } -XS(XS_NPC_GetGuardPointX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetGuardPointX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetGuardPointX(THIS)"); // @categories Script Utility, Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetGuardPoint().x; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_NextGuardPosition(NPC* self) // @categories Script Utility +{ + self->NextGuardPosition(); } -XS(XS_NPC_GetGuardPointY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetGuardPointY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetGuardPointY(THIS)"); // @categories Script Utility, Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetGuardPoint().y; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SaveGuardSpot(NPC* self) // @categories Script Utility +{ + self->SaveGuardSpot(); } -XS(XS_NPC_GetGuardPointZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetGuardPointZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetGuardPointZ(THIS)"); // @categories Script Utility, Spawns - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetGuardPoint().z; - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SaveGuardSpot(NPC* self, bool clear) // @categories Script Utility +{ + self->SaveGuardSpot(clear); } -XS(XS_NPC_SetPrimSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetPrimSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetPrimSkill(THIS, int skill_id)"); // @categories Stats and Attributes - { - NPC *THIS; - int skill_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetPrimSkill(skill_id); - } - XSRETURN_EMPTY; +void Perl_NPC_SaveGuardSpot(NPC* self, float x, float y, float z, float heading) // @categories Script Utility +{ + self->SaveGuardSpot(glm::vec4(x, y, z, heading)); } -XS(XS_NPC_SetSecSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSecSkill) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSecSkill(THIS, int skill_id)"); // @categories Stats and Attributes - { - NPC *THIS; - int skill_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSecSkill(skill_id); - } - XSRETURN_EMPTY; +bool Perl_NPC_IsGuarding(NPC* self) // @categories Script Utility +{ + return self->IsGuarding(); } -XS(XS_NPC_GetPrimSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetPrimSkill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetPrimSkill(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetPrimSkill(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AI_SetRoambox(NPC* self, float distance, float max_x, float min_x, float max_y, float min_y) // @categories Script Utility +{ + self->AI_SetRoambox(distance, max_x, min_x, max_y, min_y); } -XS(XS_NPC_GetSecSkill); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSecSkill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSecSkill(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSecSkill(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AI_SetRoambox(NPC* self, float distance, float max_x, float min_x, float max_y, float min_y, uint32 max_delay) // @categories Script Utility +{ + self->AI_SetRoambox(distance, max_x, min_x, max_y, min_y, max_delay); } -XS(XS_NPC_GetSwarmOwner); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSwarmOwner) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSwarmOwner(THIS)"); // @categories Pet - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSwarmOwner(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_AI_SetRoambox(NPC* self, float distance, float max_x, float min_x, float max_y, float min_y, uint32 max_delay, uint32 min_delay) // @categories Script Utility +{ + self->AI_SetRoambox(distance, max_x, min_x, max_y, min_y, max_delay, min_delay); } -XS(XS_NPC_GetSwarmTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSwarmTarget) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSwarmTarget(THIS)"); // @categories Pet - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSwarmTarget(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetNPCSpellsID(NPC* self) // @categories Stats and Attributes +{ + return self->GetNPCSpellsID(); } -XS(XS_NPC_SetSwarmTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSwarmTarget) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSwarmTarget(THIS, int target_id)"); // @categories Pet - { - NPC *THIS; - int target_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSwarmTarget(target_id); - } - XSRETURN_EMPTY; +uint32_t Perl_NPC_GetSpawnPointID(NPC* self) // @categories Spawns +{ + return self->GetSpawnPointID(); } -XS(XS_NPC_ModifyNPCStat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ModifyNPCStat) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: NPC::ModifyNPCStat(THIS, string key, string value)"); // @categories Stats and Attributes - { - NPC *THIS; - Const_char *identifier = (Const_char *) SvPV_nolen(ST(1)); - Const_char *newValue = (Const_char *) SvPV_nolen(ST(2)); - VALIDATE_THIS_IS_NPC; - THIS->ModifyNPCStat(identifier, newValue); - } - XSRETURN_EMPTY; +float Perl_NPC_GetSpawnPointX(NPC* self) // @categories Spawns +{ + return self->GetSpawnPoint().x; } -XS(XS_NPC_GetNPCStat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetNPCStat) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::GetNPCStat(THIS, string key)"); // @categories Stats and Attributes - { - NPC *THIS; - float RETVAL; - Const_char *identifier = (Const_char *)SvPV_nolen(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - - RETVAL = THIS->GetNPCStat(identifier); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_NPC_GetSpawnPointY(NPC* self) // @categories Spawns +{ + return self->GetSpawnPoint().y; } -XS(XS_NPC_AddSpellToNPCList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AddSpellToNPCList) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: NPC::AddAISpell(THIS, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust)"); // @categories Spells and Disciplines, Script Utility - { - NPC *THIS; - int priority = (int) SvIV(ST(1)); - int spell_id = (int) SvIV(ST(2)); - int type = (int) SvIV(ST(3)); - int mana_cost = (int) SvIV(ST(4)); - int recast_delay = (int) SvIV(ST(5)); - int resist_adjust = (int) SvIV(ST(6)); - VALIDATE_THIS_IS_NPC; - THIS->AddSpellToNPCList(priority, spell_id, type, mana_cost, recast_delay, resist_adjust, 0, 0); - } - XSRETURN_EMPTY; +float Perl_NPC_GetSpawnPointZ(NPC* self) // @categories Spawns +{ + return self->GetSpawnPoint().z; } -XS(XS_NPC_RemoveSpellFromNPCList); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RemoveSpellFromNPCList) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveAISpell(THIS, int spell_id)"); // @categories Spells and Disciplines - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->RemoveSpellFromNPCList(spell_id); - } - XSRETURN_EMPTY; +float Perl_NPC_GetSpawnPointH(NPC* self) // @categories Spawns +{ + return self->GetSpawnPoint().w; } -XS(XS_NPC_SetSpellFocusDMG); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSpellFocusDMG) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSpellFocusDMG(THIS, int new_spell_focus_dmg)"); // @categories Stats and Attributes - { - NPC *THIS; - int32 NewSpellFocusDMG = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSpellFocusDMG(NewSpellFocusDMG); - } - XSRETURN_EMPTY; +float Perl_NPC_GetGuardPointX(NPC* self) // @categories Script Utility, Spawns +{ + return self->GetGuardPoint().x; } -XS(XS_NPC_GetSpellFocusDMG); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpellFocusDMG) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpellFocusDMG(THIS)"); // @categories Spells and Disciplines - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpellFocusDMG(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +float Perl_NPC_GetGuardPointY(NPC* self) // @categories Script Utility, Spawns +{ + return self->GetGuardPoint().y; } -XS(XS_NPC_SetSpellFocusHeal); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSpellFocusHeal) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::SetSpellFocusHeal(THIS, int32 new_spell_focus_heal)"); // @categories Stats and Attributes - { - NPC *THIS; - int32 NewSpellFocusHeal = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->SetSpellFocusHeal(NewSpellFocusHeal); - } - XSRETURN_EMPTY; +float Perl_NPC_GetGuardPointZ(NPC* self) // @categories Script Utility, Spawns +{ + return self->GetGuardPoint().z; } -XS(XS_NPC_GetSpellFocusHeal); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpellFocusHeal) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpellFocusHeal(THIS)"); // @categories Spells and Disciplines - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpellFocusHeal(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SetPrimSkill(NPC* self, int skill_id) // @categories Stats and Attributes +{ + self->SetPrimSkill(skill_id); } -XS(XS_NPC_GetSlowMitigation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSlowMitigation) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSlowMitigation(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSlowMitigation(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SetSecSkill(NPC* self, int skill_id) // @categories Stats and Attributes +{ + self->SetSecSkill(skill_id); } -XS(XS_NPC_GetAttackSpeed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetAttackSpeed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetAttackSpeed(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetAttackSpeed(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetPrimSkill(NPC* self) // @categories Stats and Attributes +{ + return self->GetPrimSkill(); } -XS(XS_NPC_GetAttackDelay); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetAttackDelay) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetAttackDelay(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetAttackDelay(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetSecSkill(NPC* self) // @categories Stats and Attributes +{ + return self->GetSecSkill(); } -XS(XS_NPC_GetAccuracyRating); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetAccuracyRating) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetAccuracyRating(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetAccuracyRating(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetSwarmOwner(NPC* self) // @categories Pet +{ + return self->GetSwarmOwner(); } -XS(XS_NPC_GetAvoidanceRating); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetAvoidanceRating) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetAvoidanceRating(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - int32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetAvoidanceRating(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_NPC_GetSwarmTarget(NPC* self) // @categories Pet +{ + return self->GetSwarmTarget(); } -XS(XS_NPC_GetSpawnKillCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetSpawnKillCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpawnKillCount(THIS)"); // @categories Spawns - { - NPC *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetSpawnKillCount(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_SetSwarmTarget(NPC* self, int target_id) // @categories Pet +{ + self->SetSwarmTarget(target_id); } -XS(XS_NPC_GetScore); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetScore) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetScore(THIS)"); // @categories Script Utility - { - NPC *THIS; - int RETVAL; - dXSTARG; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetScore(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +void Perl_NPC_ModifyNPCStat(NPC* self, const char* stat, const char* value) // @categories Stats and Attributes +{ + self->ModifyNPCStat(stat, value); } -XS(XS_NPC_MerchantOpenShop); -XS(XS_NPC_MerchantOpenShop) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::MerchantOpenShop(THIS)"); // @categories Script Utility - { - NPC *THIS; - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->MerchantOpenShop(); - } - XSRETURN_EMPTY; +float Perl_NPC_GetNPCStat(NPC* self, const char* identifier) // @categories Stats and Attributes +{ + return self->GetNPCStat(identifier); } -XS(XS_NPC_MerchantCloseShop); -XS(XS_NPC_MerchantCloseShop) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::MerchantCloseShop(THIS)"); // @categories Script Utility - { - NPC *THIS; - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->MerchantCloseShop(); - } - XSRETURN_EMPTY; +void Perl_NPC_AddSpellToNPCList(NPC* self, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust) // @categories Spells and Disciplines, Script Utility +{ + self->AddSpellToNPCList(priority, spell_id, type, mana_cost, recast_delay, resist_adjust, 0, 0); } -XS(XS_NPC_AddMeleeProc); -XS(XS_NPC_AddMeleeProc) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: NPC::AddMeleeProc(THIS, int spell_id, int chance)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - int chance = (int) SvIV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->AddProcToWeapon(spell_id, true, chance); - } - XSRETURN_EMPTY; +void Perl_NPC_RemoveSpellFromNPCList(NPC* self, uint16_t spell_id) // @categories Spells and Disciplines +{ + self->RemoveSpellFromNPCList(spell_id); } -XS(XS_NPC_AddRangedProc); -XS(XS_NPC_AddRangedProc) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: NPC::AddRangedProc(THIS, int spell_id, int chance)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - int chance = (int) SvIV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->AddRangedProc(spell_id, chance); - } - XSRETURN_EMPTY; +void Perl_NPC_SetSpellFocusDMG(NPC* self, int new_spell_focus_dmg) // @categories Stats and Attributes +{ + self->SetSpellFocusDMG(new_spell_focus_dmg); } -XS(XS_NPC_AddDefensiveProc); -XS(XS_NPC_AddDefensiveProc) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: NPC::AddDefensiveProc(THIS, int spell_id, int chance)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - int chance = (int) SvIV(ST(2)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->AddDefensiveProc(spell_id, chance); - } - XSRETURN_EMPTY; +int Perl_NPC_GetSpellFocusDMG(NPC* self) // @categories Spells and Disciplines +{ + return self->GetSpellFocusDMG(); } -XS(XS_NPC_RemoveMeleeProc); -XS(XS_NPC_RemoveMeleeProc) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveMeleeProc(THIS, int spell_id)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->RemoveProcFromWeapon(spell_id, false); - } - XSRETURN_EMPTY; +void Perl_NPC_SetSpellFocusHeal(NPC* self, int new_spell_focus_heal) // @categories Stats and Attributes +{ + self->SetSpellFocusHeal(new_spell_focus_heal); } -XS(XS_NPC_RemoveRangedProc); -XS(XS_NPC_RemoveRangedProc) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveRangedProc(THIS, int spell_id)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->RemoveRangedProc(spell_id, false); - } - XSRETURN_EMPTY; +int Perl_NPC_GetSpellFocusHeal(NPC* self) // @categories Spells and Disciplines +{ + return self->GetSpellFocusHeal(); } -XS(XS_NPC_RemoveDefensiveProc); -XS(XS_NPC_RemoveDefensiveProc) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveDefensiveProc(THIS, int spell_id)"); // @categories Script Utility - { - NPC *THIS; - int spell_id = (int) SvIV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - THIS->RemoveDefensiveProc(spell_id, false); - } - XSRETURN_EMPTY; +float Perl_NPC_GetSlowMitigation(NPC* self) // @categories Stats and Attributes +{ + return self->GetSlowMitigation(); } -XS(XS_NPC_ChangeLastName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ChangeLastName) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::ChangeLastName(THIS, string last_name)"); // @categories Script Utility - { - NPC *THIS; - std::string last_name = (std::string) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->ChangeLastName(last_name); - } - XSRETURN_EMPTY; +float Perl_NPC_GetAttackSpeed(NPC* self) // @categories Stats and Attributes +{ + return self->GetAttackSpeed(); } -XS(XS_NPC_ClearLastName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ClearLastName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::ClearLastName(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->ClearLastName(); - } - XSRETURN_EMPTY; +int Perl_NPC_GetAttackDelay(NPC* self) // @categories Stats and Attributes +{ + return self->GetAttackDelay(); } -XS(XS_NPC_GetCombatState); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_GetCombatState) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetCombatState(THIS)"); // @categories Script Utility - { - NPC *THIS; - bool RETVAL; - VALIDATE_THIS_IS_NPC; - RETVAL = THIS->GetCombatEvent(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +int Perl_NPC_GetAccuracyRating(NPC* self) // @categories Stats and Attributes +{ + return self->GetAccuracyRating(); } -XS(XS_NPC_SetSimpleRoamBox); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_SetSimpleRoamBox) { - dXSARGS; - if (items < 2) - Perl_croak(aTHX_ "Usage: NPC::SetSimpleRoamBox(THIS, box_size, move_distance, move_delay)"); // @categories Script Utility - { - NPC *THIS; +int Perl_NPC_GetAvoidanceRating(NPC* self) // @categories Stats and Attributes +{ + return self->GetAvoidanceRating(); +} - auto box_size = (float) SvNV(ST(1)); - float move_distance = 0; - int move_delay = 0; +uint32_t Perl_NPC_GetSpawnKillCount(NPC* self) // @categories Spawns +{ + return self->GetSpawnKillCount(); +} - if (items >= 3) { - move_distance = (float) SvNV(ST(2)); - } +int Perl_NPC_GetScore(NPC* self) // @categories Script Utility +{ + return self->GetScore(); +} - if (items >= 4) { - move_delay = (int) SvIV(ST(3)); - } - VALIDATE_THIS_IS_NPC; - THIS->SetSimpleRoamBox(box_size, move_distance, move_delay); - } - XSRETURN_EMPTY; +void Perl_NPC_MerchantOpenShop(NPC* self) // @categories Script Utility +{ + self->MerchantOpenShop(); } +void Perl_NPC_MerchantCloseShop(NPC* self) // @categories Script Utility +{ + self->MerchantCloseShop(); +} -XS(XS_NPC_RecalculateSkills); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RecalculateSkills) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::RecalculateSkills(THIS)"); // @categories Skills and Recipes - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - THIS->RecalculateSkills(); - } - XSRETURN_EMPTY; +void Perl_NPC_AddMeleeProc(NPC* self, uint16_t spell_id, uint16_t chance) // @categories Script Utility +{ + self->AddProcToWeapon(spell_id, true, chance); } -XS(XS_NPC_ScaleNPC); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_ScaleNPC) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::ScaleNPC(THIS, uint8 npc_level)"); - { - NPC *THIS; - uint8 npc_level = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->ScaleNPC(npc_level); - } - XSRETURN_EMPTY; +void Perl_NPC_AddRangedProc(NPC* self, uint16_t spell_id, uint16_t chance) // @categories Script Utility +{ + self->AddRangedProc(spell_id, chance); } -XS(XS_NPC_IsRaidTarget); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_IsRaidTarget) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::IsRaidTarget(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - bool is_raid_target; - VALIDATE_THIS_IS_NPC; - is_raid_target = THIS->IsRaidTarget(); - ST(0) = boolSV(is_raid_target); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_NPC_AddDefensiveProc(NPC* self, uint16_t spell_id, uint16_t chance) // @categories Script Utility +{ + self->AddDefensiveProc(spell_id, chance); } -XS(XS_NPC_HasItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_HasItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::HasItem(THIS, uint32 item_id)"); // @categories Script Utility - { - NPC *THIS; - bool has_item = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_NPC; - has_item = THIS->HasItem(item_id); - ST(0) = boolSV(has_item); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_NPC_RemoveMeleeProc(NPC* self, uint16_t spell_id) // @categories Script Utility +{ + self->RemoveProcFromWeapon(spell_id, false); } -XS(XS_NPC_CountItem); -XS(XS_NPC_CountItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::CountItem(THIS, uint32 item_id)"); // @categories Script Utility - { - NPC *THIS; - uint16 item_count = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - item_count = THIS->CountItem(item_id); - XSprePUSH; - PUSHu((UV) item_count); - } - XSRETURN(1); +void Perl_NPC_RemoveRangedProc(NPC* self, uint16_t spell_id) // @categories Script Utility +{ + self->RemoveRangedProc(spell_id, false); } -XS(XS_NPC_GetItemIDBySlot); -XS(XS_NPC_GetItemIDBySlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::GetItemIDBySlot(THIS, uint16 loot_slot)"); // @categories Script Utility - { - NPC *THIS; - uint32 item_id = 0; - uint16 loot_slot = (uint16) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - item_id = THIS->GetItemIDBySlot(loot_slot); - XSprePUSH; - PUSHu((UV) item_id); - } - XSRETURN(1); +void Perl_NPC_RemoveDefensiveProc(NPC* self, uint16_t spell_id) // @categories Script Utility +{ + self->RemoveDefensiveProc(spell_id, false); } -XS(XS_NPC_GetFirstSlotByItemID); -XS(XS_NPC_GetFirstSlotByItemID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::GetFirstSlotByItemID(THIS, uint32 item_id)"); // @categories Script Utility - { - NPC *THIS; - uint16 loot_slot = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_NPC; - loot_slot = THIS->GetFirstSlotByItemID(item_id); - XSprePUSH; - PUSHu((UV) loot_slot); - } - XSRETURN(1); +void Perl_NPC_ChangeLastName(NPC* self, std::string name) // @categories Script Utility +{ + self->ChangeLastName(name); } -XS(XS_NPC_GetHealScale); -XS(XS_NPC_GetHealScale) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetHealScale(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - float healscale; - dXSTARG; - VALIDATE_THIS_IS_NPC; - healscale = THIS->GetHealScale(); - XSprePUSH; - PUSHn((double) healscale); - } - XSRETURN(1); +void Perl_NPC_ClearLastName(NPC* self) // @categories Script Utility +{ + self->ClearLastName(); } -XS(XS_NPC_GetSpellScale); -XS(XS_NPC_GetSpellScale) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetSpellScale(THIS)"); // @categories Stats and Attributes - { - NPC *THIS; - float spellscale; - dXSTARG; - VALIDATE_THIS_IS_NPC; - spellscale = THIS->GetSpellScale(); - XSprePUSH; - PUSHn((double) spellscale); - } - XSRETURN(1); +bool Perl_NPC_GetCombatState(NPC* self) // @categories Script Utility +{ + return self->GetCombatEvent(); } -XS(XS_NPC_GetLootList); -XS(XS_NPC_GetLootList) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: NPC::GetLootList(THIS)"); // @categories Script Utility - { - NPC *THIS; - VALIDATE_THIS_IS_NPC; - auto npc_items = THIS->GetLootList(); - auto item_count = npc_items.size(); - if (item_count > 0) { - EXTEND(sp, item_count); - for (int index = 0; index < item_count; ++index) { - ST(index) = sv_2mortal(newSVuv(npc_items[index])); - } - XSRETURN(item_count); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); - } +void Perl_NPC_SetSimpleRoamBox(NPC* self, float box_size, float move_distance, int move_delay) // @categories Script Utility +{ + self->SetSimpleRoamBox(box_size, move_distance, move_delay); } -XS(XS_NPC_AddAISpellEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_AddAISpellEffect) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: NPC::AddAISpellEffect(THIS, int spell_effect_id, int base_value, int limit_value, int max_value)"); // @categories Spells and Disciplines - { - NPC *THIS; +void Perl_NPC_RecalculateSkills(NPC* self) // @categories Skills and Recipes +{ + self->RecalculateSkills(); +} + +void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level) +{ + return self->ScaleNPC(npc_level); +} - int spell_effect_id = (int) SvIV(ST(1)); - int base_value = (int) SvIV(ST(2)); - int limit_value = (int) SvIV(ST(3)); - int max_value = (int) SvIV(ST(4)); +bool Perl_NPC_IsRaidTarget(NPC* self) +{ + return self->IsRaidTarget(); +} - VALIDATE_THIS_IS_NPC; - THIS->AddSpellEffectToNPCList(spell_effect_id, base_value, limit_value, max_value, true); - } - XSRETURN_EMPTY; +bool Perl_NPC_HasItem(NPC* self, uint32 item_id) // @categories Script Utility +{ + return self->HasItem(item_id); } -XS(XS_NPC_RemoveAISpellEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_RemoveAISpellEffect) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::RemoveAISpellEffect(THIS, int spell_effect_id)"); // @categories Spells and Disciplines - { - NPC *THIS; - int spell_effect_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - THIS->RemoveSpellEffectFromNPCList(spell_effect_id, true); - } - XSRETURN_EMPTY; +int Perl_NPC_CountItem(NPC* self, uint32 item_id) +{ + return self->CountItem(item_id); } -XS(XS_NPC_HasAISpellEffect); /* prototype to pass -Wmissing-prototypes */ -XS(XS_NPC_HasAISpellEffect) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: NPC::HasAISpellEffect(THIS, int spell_effect_id)"); // @categories Spells and Disciplines - { - NPC *THIS; - bool has_spell_effect = false; - int spell_effect_id = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_NPC; - has_spell_effect = THIS->HasAISpellEffect(spell_effect_id); - ST(0) = boolSV(has_spell_effect); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -#ifdef __cplusplus -extern "C" -#endif -XS(boot_NPC); /* prototype to pass -Wmissing-prototypes */ -XS(boot_NPC) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AI_SetRoambox"), XS_NPC_AI_SetRoambox, file, "$$$$$$;$$"); - newXSproto(strcpy(buf, "AddAISpell"), XS_NPC_AddSpellToNPCList, file, "$$$$$$$"); - newXSproto(strcpy(buf, "AddAISpellEffect"), XS_NPC_AddAISpellEffect, file, "$$$$$"); - newXSproto(strcpy(buf, "AddCash"), XS_NPC_AddCash, file, "$$$$$"); - newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$"); - newXSproto(strcpy(buf, "AddItem"), XS_NPC_AddItem, file, "$$;$$$$$$$$"); - newXSproto(strcpy(buf, "AddLootTable"), XS_NPC_AddLootTable, file, "$"); - newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$"); - newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$"); - newXSproto(strcpy(buf, "AssignWaypoints"), XS_NPC_AssignWaypoints, file, "$$"); - newXSproto(strcpy(buf, "CalculateNewWaypoint"), XS_NPC_CalculateNewWaypoint, file, "$"); - newXSproto(strcpy(buf, "ChangeLastName"), XS_NPC_ChangeLastName, file, "$:$"); - newXSproto(strcpy(buf, "CheckNPCFactionAlly"), XS_NPC_CheckNPCFactionAlly, file, "$$"); - newXSproto(strcpy(buf, "ClearItemList"), XS_NPC_ClearItemList, file, "$"); - newXSproto(strcpy(buf, "ClearLastName"), XS_NPC_ClearLastName, file, "$"); - newXSproto(strcpy(buf, "CountItem"), XS_NPC_CountItem, file, "$$"); - newXSproto(strcpy(buf, "CountLoot"), XS_NPC_CountLoot, file, "$"); - newXSproto(strcpy(buf, "DisplayWaypointInfo"), XS_NPC_DisplayWaypointInfo, file, "$$"); - newXSproto(strcpy(buf, "DoClassAttacks"), XS_NPC_DoClassAttacks, file, "$$"); - newXSproto(strcpy(buf, "GetAccuracyRating"), XS_NPC_GetAccuracyRating, file, "$"); - newXSproto(strcpy(buf, "GetAttackDelay"), XS_NPC_GetAttackDelay, file, "$"); - newXSproto(strcpy(buf, "GetAttackSpeed"), XS_NPC_GetAttackSpeed, file, "$"); - newXSproto(strcpy(buf, "GetAvoidanceRating"), XS_NPC_GetAvoidanceRating, file, "$"); - newXSproto(strcpy(buf, "GetCombatState"), XS_NPC_GetCombatState, file, "$"); - newXSproto(strcpy(buf, "GetCopper"), XS_NPC_GetCopper, file, "$"); - newXSproto(strcpy(buf, "GetFirstSlotByItemID"), XS_NPC_GetFirstSlotByItemID, file, "$$"); - newXSproto(strcpy(buf, "GetGold"), XS_NPC_GetGold, file, "$"); - newXSproto(strcpy(buf, "GetGrid"), XS_NPC_GetGrid, file, "$"); - newXSproto(strcpy(buf, "GetGuardPointX"), XS_NPC_GetGuardPointX, file, "$"); - newXSproto(strcpy(buf, "GetGuardPointY"), XS_NPC_GetGuardPointY, file, "$"); - newXSproto(strcpy(buf, "GetGuardPointZ"), XS_NPC_GetGuardPointZ, file, "$"); - newXSproto(strcpy(buf, "GetHealScale"), XS_NPC_GetHealScale, file, "$"); - newXSproto(strcpy(buf, "GetItemIDBySlot"), XS_NPC_GetItemIDBySlot, file, "$$"); - newXSproto(strcpy(buf, "GetLootList"), XS_NPC_GetLootList, file, "$"); - newXSproto(strcpy(buf, "GetLoottableID"), XS_NPC_GetLoottableID, file, "$"); - newXSproto(strcpy(buf, "GetMaxDMG"), XS_NPC_GetMaxDMG, file, "$"); - newXSproto(strcpy(buf, "GetMaxDamage"), XS_NPC_GetMaxDamage, file, "$$"); - newXSproto(strcpy(buf, "GetMaxWp"), XS_NPC_GetMaxWp, file, "$"); - newXSproto(strcpy(buf, "GetMinDMG"), XS_NPC_GetMinDMG, file, "$"); - newXSproto(strcpy(buf, "GetNPCFactionID"), XS_NPC_GetNPCFactionID, file, "$"); - newXSproto(strcpy(buf, "GetNPCHate"), XS_NPC_GetNPCHate, file, "$$"); - newXSproto(strcpy(buf, "GetNPCSpellsID"), XS_NPC_GetNPCSpellsID, file, "$"); - newXSproto(strcpy(buf, "GetNPCStat"), XS_NPC_GetNPCStat, file, "$$"); - newXSproto(strcpy(buf, "GetPetSpellID"), XS_NPC_GetPetSpellID, file, "$"); - newXSproto(strcpy(buf, "GetPlatinum"), XS_NPC_GetPlatinum, file, "$"); - newXSproto(strcpy(buf, "GetPrimSkill"), XS_NPC_GetPrimSkill, file, "$"); - newXSproto(strcpy(buf, "GetPrimaryFaction"), XS_NPC_GetPrimaryFaction, file, "$"); - newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$"); - newXSproto(strcpy(buf, "GetSecSkill"), XS_NPC_GetSecSkill, file, "$"); - newXSproto(strcpy(buf, "GetSilver"), XS_NPC_GetSilver, file, "$"); - newXSproto(strcpy(buf, "GetSlowMitigation"), XS_NPC_GetSlowMitigation, file, "$"); - newXSproto(strcpy(buf, "GetSp2"), XS_NPC_GetSp2, file, "$"); - newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$"); - newXSproto(strcpy(buf, "GetSpawnPointH"), XS_NPC_GetSpawnPointH, file, "$"); - newXSproto(strcpy(buf, "GetSpawnPointID"), XS_NPC_GetSpawnPointID, file, "$"); - newXSproto(strcpy(buf, "GetSpawnPointX"), XS_NPC_GetSpawnPointX, file, "$"); - newXSproto(strcpy(buf, "GetSpawnPointY"), XS_NPC_GetSpawnPointY, file, "$"); - newXSproto(strcpy(buf, "GetSpawnPointZ"), XS_NPC_GetSpawnPointZ, file, "$"); - newXSproto(strcpy(buf, "GetSpellFocusDMG"), XS_NPC_GetSpellFocusDMG, file, "$"); - newXSproto(strcpy(buf, "GetSpellFocusHeal"), XS_NPC_GetSpellFocusHeal, file, "$"); - newXSproto(strcpy(buf, "GetSpellScale"), XS_NPC_GetSpellScale, file, "$"); - newXSproto(strcpy(buf, "GetSwarmOwner"), XS_NPC_GetSwarmOwner, file, "$"); - newXSproto(strcpy(buf, "GetSwarmTarget"), XS_NPC_GetSwarmTarget, file, "$"); - newXSproto(strcpy(buf, "GetWaypointMax"), XS_NPC_GetWaypointMax, file, "$"); - newXSproto(strcpy(buf, "HasAISpellEffect"), XS_NPC_HasAISpellEffect, file, "$$"); - newXSproto(strcpy(buf, "HasItem"), XS_NPC_HasItem, file, "$$"); - newXSproto(strcpy(buf, "IsAnimal"), XS_NPC_IsAnimal, file, "$"); - newXSproto(strcpy(buf, "IsGuarding"), XS_NPC_IsGuarding, file, "$"); - newXSproto(strcpy(buf, "IsOnHatelist"), XS_NPC_IsOnHatelist, file, "$$"); - newXSproto(strcpy(buf, "IsRaidTarget"), XS_NPC_IsRaidTarget, file, "$"); - newXSproto(strcpy(buf, "IsTaunting"), XS_NPC_IsTaunting, file, "$"); - newXSproto(strcpy(buf, "MerchantCloseShop"), XS_NPC_MerchantCloseShop, file, "$"); - newXSproto(strcpy(buf, "MerchantOpenShop"), XS_NPC_MerchantOpenShop, file, "$"); - newXSproto(strcpy(buf, "ModifyNPCStat"), XS_NPC_ModifyNPCStat, file, "$$$"); - newXSproto(strcpy(buf, "MoveTo"), XS_NPC_MoveTo, file, "$$$$"); - newXSproto(strcpy(buf, "NextGuardPosition"), XS_NPC_NextGuardPosition, file, "$"); - newXSproto(strcpy(buf, "PauseWandering"), XS_NPC_PauseWandering, file, "$$"); - newXSproto(strcpy(buf, "PickPocket"), XS_NPC_PickPocket, file, "$$"); - newXSproto(strcpy(buf, "RecalculateSkills"), XS_NPC_RecalculateSkills, file, "$"); - newXSproto(strcpy(buf, "RemoveAISpell"), XS_NPC_RemoveSpellFromNPCList, file, "$$"); - newXSproto(strcpy(buf, "RemoveAISpellEffect"), XS_NPC_RemoveAISpellEffect, file, "$$"); - newXSproto(strcpy(buf, "RemoveCash"), XS_NPC_RemoveCash, file, "$"); - newXSproto(strcpy(buf, "RemoveDefensiveProc"), XS_NPC_RemoveDefensiveProc, file, "$$"); - newXSproto(strcpy(buf, "RemoveFromHateList"), XS_NPC_RemoveFromHateList, file, "$$"); - newXSproto(strcpy(buf, "RemoveItem"), XS_NPC_RemoveItem, file, "$$;$$"); - newXSproto(strcpy(buf, "RemoveMeleeProc"), XS_NPC_RemoveMeleeProc, file, "$$"); - newXSproto(strcpy(buf, "RemoveRangedProc"), XS_NPC_RemoveRangedProc, file, "$$"); - newXSproto(strcpy(buf, "ResumeWandering"), XS_NPC_ResumeWandering, file, "$"); - newXSproto(strcpy(buf, "SaveGuardSpot"), XS_NPC_SaveGuardSpot, file, "$;$$$$"); - newXSproto(strcpy(buf, "ScaleNPC"), XS_NPC_ScaleNPC, file, "$$"); - newXSproto(strcpy(buf, "SetCopper"), XS_NPC_SetCopper, file, "$$"); - newXSproto(strcpy(buf, "SetGold"), XS_NPC_SetGold, file, "$$"); - newXSproto(strcpy(buf, "SetGrid"), XS_NPC_SetGrid, file, "$$"); - newXSproto(strcpy(buf, "SetNPCFactionID"), XS_NPC_SetNPCFactionID, file, "$$"); - newXSproto(strcpy(buf, "SetPetSpellID"), XS_NPC_SetPetSpellID, file, "$$"); - newXSproto(strcpy(buf, "SetPlatinum"), XS_NPC_SetPlatinum, file, "$$"); - newXSproto(strcpy(buf, "SetPrimSkill"), XS_NPC_SetPrimSkill, file, "$$"); - newXSproto(strcpy(buf, "SetSaveWaypoint"), XS_NPC_SetSaveWaypoint, file, "$$"); - newXSproto(strcpy(buf, "SetSecSkill"), XS_NPC_SetSecSkill, file, "$$"); - newXSproto(strcpy(buf, "SetSilver"), XS_NPC_SetSilver, file, "$$"); - newXSproto(strcpy(buf, "SetSimpleRoamBox"), XS_NPC_SetSimpleRoamBox, file, "$$;$$"); - newXSproto(strcpy(buf, "SetSp2"), XS_NPC_SetSp2, file, "$$"); - newXSproto(strcpy(buf, "SetSpellFocusDMG"), XS_NPC_SetSpellFocusDMG, file, "$$"); - newXSproto(strcpy(buf, "SetSpellFocusHeal"), XS_NPC_SetSpellFocusHeal, file, "$$"); - newXSproto(strcpy(buf, "SetSwarmTarget"), XS_NPC_SetSwarmTarget, file, "$$"); - newXSproto(strcpy(buf, "SetTaunting"), XS_NPC_SetTaunting, file, "$$"); - newXSproto(strcpy(buf, "SetWaypointPause"), XS_NPC_SetWaypointPause, file, "$"); - newXSproto(strcpy(buf, "SignalNPC"), XS_NPC_SignalNPC, file, "$$"); - newXSproto(strcpy(buf, "StartSwarmTimer"), XS_NPC_StartSwarmTimer, file, "$$"); - newXSproto(strcpy(buf, "StopWandering"), XS_NPC_StopWandering, file, "$"); - newXSproto(strcpy(buf, "UpdateWaypoint"), XS_NPC_UpdateWaypoint, file, "$$"); - XSRETURN_YES; +uint32_t Perl_NPC_GetItemIDBySlot(NPC* self, uint16 loot_slot) +{ + return self->GetItemIDBySlot(loot_slot); +} + +int Perl_NPC_GetFirstSlotByItemID(NPC* self, uint32 item_id) +{ + return self->GetFirstSlotByItemID(item_id); +} + +float Perl_NPC_GetHealScale(NPC* self) // @categories Stats and Attributes +{ + return self->GetHealScale(); +} + +float Perl_NPC_GetSpellScale(NPC* self) // @categories Stats and Attributes +{ + return self->GetSpellScale(); +} + +perl::array Perl_NPC_GetLootList(NPC* self) // @categories Script Utility +{ + perl::array result; + auto npc_items = self->GetLootList(); + for (int item_id : npc_items) + { + result.push_back(item_id); + } + return result; +} + +void Perl_NPC_AddAISpellEffect(NPC* self, int spell_effect_id, int base_value, int limit_value, int max_value) // @categories Spells and Disciplines +{ + self->AddSpellEffectToNPCList(spell_effect_id, base_value, limit_value, max_value, true); +} + +void Perl_NPC_RemoveAISpellEffect(NPC* self, int spell_effect_id) // @categories Spells and Disciplines +{ + self->RemoveSpellEffectFromNPCList(spell_effect_id, true); +} + +bool Perl_NPC_HasAISpellEffect(NPC* self, int spell_effect_id) // @categories Spells and Disciplines +{ + return self->HasAISpellEffect(spell_effect_id); +} + +void perl_register_npc() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("NPC"); + package.add_base_class("Mob"); + package.add("AI_SetRoambox", (void(*)(NPC*, float, float, float, float, float))&Perl_NPC_AI_SetRoambox); + package.add("AI_SetRoambox", (void(*)(NPC*, float, float, float, float, float, uint32))&Perl_NPC_AI_SetRoambox); + package.add("AI_SetRoambox", (void(*)(NPC*, float, float, float, float, float, uint32, uint32))&Perl_NPC_AI_SetRoambox); + package.add("AddAISpell", &Perl_NPC_AddSpellToNPCList); + package.add("AddAISpellEffect", &Perl_NPC_AddAISpellEffect); + package.add("AddCash", &Perl_NPC_AddCash); + package.add("AddDefensiveProc", &Perl_NPC_AddDefensiveProc); + package.add("AddItem", (void(*)(NPC*, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32, uint32, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32, uint32, uint32, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32, uint32, uint32, uint32, uint32))&Perl_NPC_AddItem); + package.add("AddItem", (void(*)(NPC*, uint32, uint16, bool, uint32, uint32, uint32, uint32, uint32, uint32))&Perl_NPC_AddItem); + package.add("AddLootTable", (void(*)(NPC*))&Perl_NPC_AddLootTable); + package.add("AddLootTable", (void(*)(NPC*, uint32))&Perl_NPC_AddLootTable); + package.add("AddMeleeProc", &Perl_NPC_AddMeleeProc); + package.add("AddRangedProc", &Perl_NPC_AddRangedProc); + package.add("AssignWaypoints", &Perl_NPC_AssignWaypoints); + package.add("CalculateNewWaypoint", &Perl_NPC_CalculateNewWaypoint); + package.add("ChangeLastName", &Perl_NPC_ChangeLastName); + package.add("CheckNPCFactionAlly", &Perl_NPC_CheckNPCFactionAlly); + package.add("ClearItemList", &Perl_NPC_ClearItemList); + package.add("ClearLastName", &Perl_NPC_ClearLastName); + package.add("CountItem", &Perl_NPC_CountItem); + package.add("CountLoot", &Perl_NPC_CountLoot); + package.add("DisplayWaypointInfo", &Perl_NPC_DisplayWaypointInfo); + package.add("DoClassAttacks", &Perl_NPC_DoClassAttacks); + package.add("GetAccuracyRating", &Perl_NPC_GetAccuracyRating); + package.add("GetAttackDelay", &Perl_NPC_GetAttackDelay); + package.add("GetAttackSpeed", &Perl_NPC_GetAttackSpeed); + package.add("GetAvoidanceRating", &Perl_NPC_GetAvoidanceRating); + package.add("GetCombatState", &Perl_NPC_GetCombatState); + package.add("GetCopper", &Perl_NPC_GetCopper); + package.add("GetFirstSlotByItemID", &Perl_NPC_GetFirstSlotByItemID); + package.add("GetGold", &Perl_NPC_GetGold); + package.add("GetGrid", &Perl_NPC_GetGrid); + package.add("GetGuardPointX", &Perl_NPC_GetGuardPointX); + package.add("GetGuardPointY", &Perl_NPC_GetGuardPointY); + package.add("GetGuardPointZ", &Perl_NPC_GetGuardPointZ); + package.add("GetHealScale", &Perl_NPC_GetHealScale); + package.add("GetItemIDBySlot", &Perl_NPC_GetItemIDBySlot); + package.add("GetLootList", &Perl_NPC_GetLootList); + package.add("GetLoottableID", &Perl_NPC_GetLoottableID); + package.add("GetMaxDMG", &Perl_NPC_GetMaxDMG); + package.add("GetMaxDamage", &Perl_NPC_GetMaxDamage); + package.add("GetMaxWp", &Perl_NPC_GetMaxWp); + package.add("GetMinDMG", &Perl_NPC_GetMinDMG); + package.add("GetNPCFactionID", &Perl_NPC_GetNPCFactionID); + package.add("GetNPCHate", &Perl_NPC_GetNPCHate); + package.add("GetNPCSpellsID", &Perl_NPC_GetNPCSpellsID); + package.add("GetNPCStat", &Perl_NPC_GetNPCStat); + package.add("GetPetSpellID", &Perl_NPC_GetPetSpellID); + package.add("GetPlatinum", &Perl_NPC_GetPlatinum); + package.add("GetPrimSkill", &Perl_NPC_GetPrimSkill); + package.add("GetPrimaryFaction", &Perl_NPC_GetPrimaryFaction); + package.add("GetScore", &Perl_NPC_GetScore); + package.add("GetSecSkill", &Perl_NPC_GetSecSkill); + package.add("GetSilver", &Perl_NPC_GetSilver); + package.add("GetSlowMitigation", &Perl_NPC_GetSlowMitigation); + package.add("GetSp2", &Perl_NPC_GetSp2); + package.add("GetSpawnKillCount", &Perl_NPC_GetSpawnKillCount); + package.add("GetSpawnPointH", &Perl_NPC_GetSpawnPointH); + package.add("GetSpawnPointID", &Perl_NPC_GetSpawnPointID); + package.add("GetSpawnPointX", &Perl_NPC_GetSpawnPointX); + package.add("GetSpawnPointY", &Perl_NPC_GetSpawnPointY); + package.add("GetSpawnPointZ", &Perl_NPC_GetSpawnPointZ); + package.add("GetSpellFocusDMG", &Perl_NPC_GetSpellFocusDMG); + package.add("GetSpellFocusHeal", &Perl_NPC_GetSpellFocusHeal); + package.add("GetSpellScale", &Perl_NPC_GetSpellScale); + package.add("GetSwarmOwner", &Perl_NPC_GetSwarmOwner); + package.add("GetSwarmTarget", &Perl_NPC_GetSwarmTarget); + package.add("GetWaypointMax", &Perl_NPC_GetWaypointMax); + package.add("HasAISpellEffect", &Perl_NPC_HasAISpellEffect); + package.add("HasItem", &Perl_NPC_HasItem); + package.add("IsAnimal", &Perl_NPC_IsAnimal); + package.add("IsGuarding", &Perl_NPC_IsGuarding); + package.add("IsOnHatelist", &Perl_NPC_IsOnHatelist); + package.add("IsRaidTarget", &Perl_NPC_IsRaidTarget); + package.add("IsTaunting", &Perl_NPC_IsTaunting); + package.add("MerchantCloseShop", &Perl_NPC_MerchantCloseShop); + package.add("MerchantOpenShop", &Perl_NPC_MerchantOpenShop); + package.add("ModifyNPCStat", &Perl_NPC_ModifyNPCStat); + package.add("MoveTo", (void(*)(NPC*, float, float, float))&Perl_NPC_MoveTo); + package.add("MoveTo", (void(*)(NPC*, float, float, float, float))&Perl_NPC_MoveTo); + package.add("MoveTo", (void(*)(NPC*, float, float, float, float, bool))&Perl_NPC_MoveTo); + package.add("NextGuardPosition", &Perl_NPC_NextGuardPosition); + package.add("PauseWandering", &Perl_NPC_PauseWandering); + package.add("PickPocket", &Perl_NPC_PickPocket); + package.add("RecalculateSkills", &Perl_NPC_RecalculateSkills); + package.add("RemoveAISpell", &Perl_NPC_RemoveSpellFromNPCList); + package.add("RemoveAISpellEffect", &Perl_NPC_RemoveAISpellEffect); + package.add("RemoveCash", &Perl_NPC_RemoveCash); + package.add("RemoveDefensiveProc", &Perl_NPC_RemoveDefensiveProc); + package.add("RemoveFromHateList", &Perl_NPC_RemoveFromHateList); + package.add("RemoveItem", (void(*)(NPC*, uint32))&Perl_NPC_RemoveItem); + package.add("RemoveItem", (void(*)(NPC*, uint32, uint16))&Perl_NPC_RemoveItem); + package.add("RemoveItem", (void(*)(NPC*, uint32, uint16, uint16))&Perl_NPC_RemoveItem); + package.add("RemoveMeleeProc", &Perl_NPC_RemoveMeleeProc); + package.add("RemoveRangedProc", &Perl_NPC_RemoveRangedProc); + package.add("ResumeWandering", &Perl_NPC_ResumeWandering); + package.add("SaveGuardSpot", (void(*)(NPC*))&Perl_NPC_SaveGuardSpot); + package.add("SaveGuardSpot", (void(*)(NPC*, bool))&Perl_NPC_SaveGuardSpot); + package.add("SaveGuardSpot", (void(*)(NPC*, float, float, float, float))&Perl_NPC_SaveGuardSpot); + package.add("ScaleNPC", &Perl_NPC_ScaleNPC); + package.add("SetCopper", &Perl_NPC_SetCopper); + package.add("SetGold", &Perl_NPC_SetGold); + package.add("SetGrid", &Perl_NPC_SetGrid); + package.add("SetNPCFactionID", &Perl_NPC_SetNPCFactionID); + package.add("SetPetSpellID", &Perl_NPC_SetPetSpellID); + package.add("SetPlatinum", &Perl_NPC_SetPlatinum); + package.add("SetPrimSkill", &Perl_NPC_SetPrimSkill); + package.add("SetSaveWaypoint", &Perl_NPC_SetSaveWaypoint); + package.add("SetSecSkill", &Perl_NPC_SetSecSkill); + package.add("SetSilver", &Perl_NPC_SetSilver); + package.add("SetSimpleRoamBox", &Perl_NPC_SetSimpleRoamBox); + package.add("SetSp2", &Perl_NPC_SetSp2); + package.add("SetSpellFocusDMG", &Perl_NPC_SetSpellFocusDMG); + package.add("SetSpellFocusHeal", &Perl_NPC_SetSpellFocusHeal); + package.add("SetSwarmTarget", &Perl_NPC_SetSwarmTarget); + package.add("SetTaunting", &Perl_NPC_SetTaunting); + package.add("SetWaypointPause", &Perl_NPC_SetWaypointPause); + package.add("SignalNPC", &Perl_NPC_SignalNPC); + package.add("StartSwarmTimer", &Perl_NPC_StartSwarmTimer); + package.add("StopWandering", &Perl_NPC_StopWandering); + package.add("UpdateWaypoint", &Perl_NPC_UpdateWaypoint); } #endif //EMBPERL_XS_CLASSES - diff --git a/zone/perl_object.cpp b/zone/perl_object.cpp index 13b26391e..b958ade1f 100644 --- a/zone/perl_object.cpp +++ b/zone/perl_object.cpp @@ -4,756 +4,272 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "object.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_OBJECT \ - do { \ - if (sv_derived_from(ST(0), "Object")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Object*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Object"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Object_IsGroundSpawn); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_IsGroundSpawn) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::IsGroundSpawn(THIS)"); // @categories Objects - { - Object *THIS; - bool RETVAL; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->IsGroundSpawn(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Object_IsGroundSpawn(Object* self) // @categories Objects +{ + return self->IsGroundSpawn(); } - -XS(XS_Object_Close); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_Close) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::Close(THIS)"); // @categories Objects - { - Object *THIS; - VALIDATE_THIS_IS_OBJECT; - THIS->Close(); - } - XSRETURN_EMPTY; +void Perl_Object_Close(Object* self) // @categories Objects +{ + self->Close(); } - -XS(XS_Object_Delete); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_Delete) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Object::Delete(THIS, [bool reset_state = false])"); // @categories Objects - { - Object *THIS; - bool reset_state; - VALIDATE_THIS_IS_OBJECT; - if (items < 2) - reset_state = false; - else { - reset_state = (bool) SvTRUE(ST(1)); - } - - THIS->Delete(reset_state); - } - XSRETURN_EMPTY; -} -XS(XS_Object_StartDecay); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_StartDecay) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::StartDecay(THIS)"); // @categories Objects - { - Object *THIS; - VALIDATE_THIS_IS_OBJECT; - THIS->StartDecay(); - } - XSRETURN_EMPTY; +void Perl_Object_Delete(Object* self) // @categories Objects +{ + self->Delete(); } - -XS(XS_Object_DeleteItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_DeleteItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::DeleteItem(THIS, uint8 index)"); // @categories Objects - { - Object *THIS; - uint8 index = (uint8) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->DeleteItem(index); - } - XSRETURN_EMPTY; +void Perl_Object_Delete(Object* self, bool reset_state) // @categories Objects +{ + self->Delete(reset_state); } -XS(XS_Object_IsObject); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_IsObject) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::IsObject(THIS)"); // @categories Objects - { - Object *THIS; - bool RETVAL; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->IsObject(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Object_StartDecay(Object* self) // @categories Objects +{ + self->StartDecay(); } - -XS(XS_Object_Save); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_Save) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::Save(THIS)"); // @categories Objects - { - Object *THIS; - bool RETVAL; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->Save(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Object_DeleteItem(Object* self, uint8_t index) // @categories Objects +{ + self->DeleteItem(index); } - -XS(XS_Object_SetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetID(THIS, uint16 id)"); // @categories Objects - { - Object *THIS; - uint16 set_id = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetID(set_id); - } - XSRETURN_EMPTY; +bool Perl_Object_IsObject(Object* self) // @categories Objects +{ + return self->IsObject(); } - -XS(XS_Object_ClearUser); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_ClearUser) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::ClearUser(THIS)"); // @categories Objects - { - Object *THIS; - VALIDATE_THIS_IS_OBJECT; - THIS->ClearUser(); - } - XSRETURN_EMPTY; +bool Perl_Object_Save(Object* self) // @categories Objects +{ + return self->Save(); } - -XS(XS_Object_GetDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetDBID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetDBID(THIS)"); // @categories Objects - { - Object *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetDBID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Object_SetID(Object* self, uint16_t set_id) // @categories Objects +{ + self->SetID(set_id); } -XS(XS_Object_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetID(THIS)"); // @categories Objects - { - Object *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Object_ClearUser(Object* self) // @categories Objects +{ + self->ClearUser(); } -XS(XS_Object_GetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetX(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetX(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Object_GetDBID(Object* self) // @categories Objects +{ + return self->GetDBID(); } -XS(XS_Object_GetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetY(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetY(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Object_GetID(Object* self) // @categories Objects +{ + return self->GetID(); } -XS(XS_Object_GetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetZ) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetZ(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetZ(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Object_GetX(Object* self) // @categories Objects +{ + return self->GetX(); } -XS(XS_Object_GetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetHeading) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetHeading(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetHeadingData(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +float Perl_Object_GetY(Object* self) // @categories Objects +{ + return self->GetY(); } -XS(XS_Object_VarSave); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_VarSave) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::VarSave(THIS)"); // @categories Objects - { - Object *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->VarSave(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +float Perl_Object_GetZ(Object* self) // @categories Objects +{ + return self->GetZ(); } - -XS(XS_Object_GetType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetType(THIS)"); // @categories Objects - { - Object *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetType(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +float Perl_Object_GetHeading(Object* self) // @categories Objects +{ + return self->GetHeadingData(); } - -XS(XS_Object_SetType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetType) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetType(THIS, uint32 type)"); // @categories Objects - { - Object *THIS; - uint32 type = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetType(type); - } - XSRETURN_EMPTY; +uint32_t Perl_Object_VarSave(Object* self) // @categories Objects +{ + return self->VarSave(); } - -XS(XS_Object_GetIcon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetIcon) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetIcon(THIS)"); // @categories Objects - { - Object *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetIcon(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Object_GetType(Object* self) // @categories Objects +{ + return self->GetType(); } - -XS(XS_Object_SetIcon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetIcon) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetIcon(THIS, uint32 icon)"); // @categories Objects - { - Object *THIS; - uint32 icon = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetIcon(icon); - } - XSRETURN_EMPTY; +void Perl_Object_SetType(Object* self, uint32_t type) // @categories Objects +{ + self->SetType(type); } - -XS(XS_Object_GetItemID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetItemID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetItemID(THIS)"); // @categories Objects - { - Object *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetItemID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Object_GetIcon(Object* self) // @categories Objects +{ + return self->GetIcon(); } - -XS(XS_Object_SetItemID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetItemID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetItemID(THIS, uint32 item_id)"); // @categories Objects - { - Object *THIS; - uint32 itemid = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetItemID(itemid); - } - XSRETURN_EMPTY; +void Perl_Object_SetIcon(Object* self, uint32_t icon) // @categories Objects +{ + self->SetIcon(icon); } -XS(XS_Object_SetLocation); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetLocation) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Object::SetLocation(THIS, float x, float y, float z)"); // @categories Objects - { - Object *THIS; - float x = (float) SvNV(ST(1)); - float y = (float) SvNV(ST(2)); - float z = (float) SvNV(ST(3)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetLocation(x, y, z); - } - XSRETURN_EMPTY; +uint32_t Perl_Object_GetItemID(Object* self) // @categories Objects +{ + return self->GetItemID(); } -XS(XS_Object_SetX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetX) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetX(THIS, float x)"); // @categories Objects - { - Object *THIS; - float pos = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetX(pos); - } - XSRETURN_EMPTY; +void Perl_Object_SetItemID(Object* self, uint32_t itemid) // @categories Objects +{ + self->SetItemID(itemid); } -XS(XS_Object_SetY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetY) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetY(THIS, float y)"); // @categories Objects - { - Object *THIS; - float pos = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetY(pos); - } - XSRETURN_EMPTY; +void Perl_Object_SetLocation(Object* self, float x, float y, float z) // @categories Objects +{ + self->SetLocation(x, y, z); } -XS(XS_Object_SetZ); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetZ) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetZ(THIS, float z)"); // @categories Objects - { - Object *THIS; - float pos = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetZ(pos); - } - XSRETURN_EMPTY; +void Perl_Object_SetX(Object* self, float x) // @categories Objects +{ + self->SetX(x); } -XS(XS_Object_SetHeading); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetHeading) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetHeading(THIS, float heading)"); // @categories Objects - { - Object *THIS; - float heading = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetHeading(heading); - } - XSRETURN_EMPTY; +void Perl_Object_SetY(Object* self, float y) // @categories Objects +{ + self->SetY(y); } -XS(XS_Object_SetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetModelName) { - dXSARGS; - if (items < 1 || items > 2) - Perl_croak(aTHX_ "Usage: Object::SetModelName(THIS, string name)"); // @categories Objects - { - Object *THIS; - char *name = nullptr; - VALIDATE_THIS_IS_OBJECT; - if (items > 1) { name = (char *) SvPV_nolen(ST(1)); } - - THIS->SetModelName(name); - } - XSRETURN_EMPTY; -} -XS(XS_Object_GetModelName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetModelName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetModelName(THIS)"); // @categories Objects - { - Object *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetModelName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +void Perl_Object_SetZ(Object* self, float z) // @categories Objects +{ + self->SetZ(z); } -XS(XS_Object_Repop); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_Repop) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::Repop(THIS)"); // @categories Objects - { - Object *THIS; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; THIS->Repop(); - } - XSRETURN_EMPTY; +void Perl_Object_SetHeading(Object* self, float heading) // @categories Objects +{ + self->SetHeading(heading); } -XS(XS_Object_Depop); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_Depop) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::Depop(THIS)"); // @categories Objects - { - Object *THIS; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; THIS->Depop(); - } - XSRETURN_EMPTY; +void Perl_Object_SetModelName(Object* self, const char* name) // @categories Objects +{ + self->SetModelName(name); } - -XS(XS_Object_GetEntityVariable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetEntityVariable) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::GetEntityVariable(THIS, string key)"); // @categories Objects - { - Object *THIS; - Const_char *id = SvPV_nolen(ST(1)); - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetEntityVariable(id); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_Object_GetModelName(Object* self) // @categories Objects +{ + return self->GetModelName(); } -XS(XS_Object_EntityVariableExists); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_EntityVariableExists) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::EntityVariableExists(THIS, string key)"); // @categories Objects - { - Object *THIS; - Const_char *id = SvPV_nolen(ST(1)); - bool RETVAL; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->EntityVariableExists(id); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Object_Repop(Object* self) // @categories Objects +{ + self->Repop(); } -XS(XS_Object_SetEntityVariable); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetEntityVariable) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Object::SetEntityVariable(THIS, string key, string var)"); // @categories Objects - { - Object *THIS; - Const_char *id = SvPV_nolen(ST(1)); - const char *var = (const char *) SvPV_nolen(ST(2)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetEntityVariable(id, var); - } - XSRETURN_EMPTY; +void Perl_Object_Depop(Object* self) // @categories Objects +{ + self->Depop(); } -XS(XS_Object_GetSolidType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetSolidType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetSolidType(THIS)"); // @categories Objects - { - Object *THIS; - uint16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetSolidType(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +const char* Perl_Object_GetEntityVariable(Object* self, const char* key) // @categories Objects +{ + // supports possible nullptr return + return self->GetEntityVariable(key); } - -XS(XS_Object_SetSolidType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetSolidType) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetSolidType(THIS, uint16 type)"); // @categories Objects - { - Object *THIS; - uint16 type = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetSolidType(type); - } - XSRETURN_EMPTY; +bool Perl_Object_EntityVariableExists(Object* self, const char* key) // @categories Objects +{ + return self->EntityVariableExists(key); } -XS(XS_Object_GetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetSize) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetSize(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetSize(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_Object_SetEntityVariable(Object* self, const char* key, const char* var) // @categories Objects +{ + self->SetEntityVariable(key, var); } - -XS(XS_Object_SetSize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetSize) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetSize(THIS, float size)"); // @categories Objects - { - Object *THIS; - float size = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetSize(size); - } - XSRETURN_EMPTY; +uint32_t Perl_Object_GetSolidType(Object* self) // @categories Objects +{ + return self->GetSolidType(); } -XS(XS_Object_SetTiltX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetTiltX) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetTiltX(THIS, float tilt_x)"); // @categories Objects - { - Object *THIS; - float pos = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetTiltX(pos); - } - XSRETURN_EMPTY; +void Perl_Object_SetSolidType(Object* self, uint16_t type) // @categories Objects +{ + self->SetSolidType(type); } -XS(XS_Object_SetTiltY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_SetTiltY) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Object::SetTiltY(THIS, float tilt_y)"); // @categories Objects - { - Object *THIS; - float pos = (float) SvNV(ST(1)); - VALIDATE_THIS_IS_OBJECT; - THIS->SetTiltY(pos); - } - XSRETURN_EMPTY; +float Perl_Object_GetSize(Object* self) // @categories Objects +{ + return self->GetSize(); } -XS(XS_Object_GetTiltX); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetTiltX) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetTiltX(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetTiltX(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_Object_SetSize(Object* self, float size) // @categories Objects +{ + self->SetSize(size); } -XS(XS_Object_GetTiltY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Object_GetTiltY) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Object::GetTiltY(THIS)"); // @categories Objects - { - Object *THIS; - float RETVAL; - dXSTARG; - VALIDATE_THIS_IS_OBJECT; - RETVAL = THIS->GetTiltY(); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); +void Perl_Object_SetTiltX(Object* self, float tilt_x) // @categories Objects +{ + self->SetTiltX(tilt_x); } -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Object); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Object) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "ClearUser"), XS_Object_ClearUser, file, "$"); - newXSproto(strcpy(buf, "Close"), XS_Object_Close, file, "$"); - newXSproto(strcpy(buf, "Delete"), XS_Object_Delete, file, "$$"); - newXSproto(strcpy(buf, "DeleteItem"), XS_Object_DeleteItem, file, "$$"); - newXSproto(strcpy(buf, "Depop"), XS_Object_Depop, file, "$"); - newXSproto(strcpy(buf, "EntityVariableExists"), XS_Object_EntityVariableExists, file, "$$"); - newXSproto(strcpy(buf, "GetDBID"), XS_Object_GetDBID, file, "$"); - newXSproto(strcpy(buf, "GetEntityVariable"), XS_Object_GetEntityVariable, file, "$$"); - newXSproto(strcpy(buf, "GetHeading"), XS_Object_GetHeading, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Object_GetID, file, "$"); - newXSproto(strcpy(buf, "GetIcon"), XS_Object_GetIcon, file, "$"); - newXSproto(strcpy(buf, "GetItemID"), XS_Object_GetItemID, file, "$"); - newXSproto(strcpy(buf, "GetModelName"), XS_Object_GetModelName, file, "$"); - newXSproto(strcpy(buf, "GetSize"), XS_Object_GetSize, file, "$"); - newXSproto(strcpy(buf, "GetSolidType"), XS_Object_GetSolidType, file, "$"); - newXSproto(strcpy(buf, "GetTiltX"), XS_Object_GetTiltX, file, "$$"); - newXSproto(strcpy(buf, "GetTiltY"), XS_Object_GetTiltY, file, "$"); - newXSproto(strcpy(buf, "GetType"), XS_Object_GetType, file, "$"); - newXSproto(strcpy(buf, "GetX"), XS_Object_GetX, file, "$"); - newXSproto(strcpy(buf, "GetY"), XS_Object_GetY, file, "$"); - newXSproto(strcpy(buf, "GetZ"), XS_Object_GetZ, file, "$"); - newXSproto(strcpy(buf, "IsGroundSpawn"), XS_Object_IsGroundSpawn, file, "$"); - newXSproto(strcpy(buf, "Repop"), XS_Object_Repop, file, "$"); - newXSproto(strcpy(buf, "Save"), XS_Object_Save, file, "$"); - newXSproto(strcpy(buf, "SetEntityVariable"), XS_Object_SetEntityVariable, file, "$$$"); - newXSproto(strcpy(buf, "SetHeading"), XS_Object_SetHeading, file, "$$"); - newXSproto(strcpy(buf, "SetID"), XS_Object_SetID, file, "$$"); - newXSproto(strcpy(buf, "SetIcon"), XS_Object_SetIcon, file, "$$"); - newXSproto(strcpy(buf, "SetItemID"), XS_Object_SetItemID, file, "$$"); - newXSproto(strcpy(buf, "SetLocation"), XS_Object_SetLocation, file, "$$$$"); - newXSproto(strcpy(buf, "SetModelName"), XS_Object_SetModelName, file, "$$"); - newXSproto(strcpy(buf, "SetSize"), XS_Object_SetSize, file, "$$"); - newXSproto(strcpy(buf, "SetSolidType"), XS_Object_SetSolidType, file, "$$"); - newXSproto(strcpy(buf, "SetTiltX"), XS_Object_SetTiltX, file, "$$"); - newXSproto(strcpy(buf, "SetTiltY"), XS_Object_SetTiltY, file, "$"); - newXSproto(strcpy(buf, "SetType"), XS_Object_SetType, file, "$$"); - newXSproto(strcpy(buf, "SetX"), XS_Object_SetX, file, "$$"); - newXSproto(strcpy(buf, "SetY"), XS_Object_SetY, file, "$$"); - newXSproto(strcpy(buf, "SetZ"), XS_Object_SetZ, file, "$$"); - newXSproto(strcpy(buf, "StartDecay"), XS_Object_StartDecay, file, "$$"); - newXSproto(strcpy(buf, "VarSave"), XS_Object_VarSave, file, "$"); - XSRETURN_YES; +void Perl_Object_SetTiltY(Object* self, float tilt_y) // @categories Objects +{ + self->SetTiltY(tilt_y); } + +float Perl_Object_GetTiltX(Object* self) // @categories Objects +{ + return self->GetTiltX(); +} + +float Perl_Object_GetTiltY(Object* self) // @categories Objects +{ + return self->GetTiltY(); +} + +void perl_register_object() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("Object"); + package.add_base_class("Entity"); + package.add("ClearUser", &Perl_Object_ClearUser); + package.add("Close", &Perl_Object_Close); + package.add("Delete", (void(*)(Object*))&Perl_Object_Delete); + package.add("Delete", (void(*)(Object*, bool))&Perl_Object_Delete); + package.add("DeleteItem", &Perl_Object_DeleteItem); + package.add("Depop", &Perl_Object_Depop); + package.add("EntityVariableExists", &Perl_Object_EntityVariableExists); + package.add("GetDBID", &Perl_Object_GetDBID); + package.add("GetEntityVariable", &Perl_Object_GetEntityVariable); + package.add("GetHeading", &Perl_Object_GetHeading); + package.add("GetID", &Perl_Object_GetID); + package.add("GetIcon", &Perl_Object_GetIcon); + package.add("GetItemID", &Perl_Object_GetItemID); + package.add("GetModelName", &Perl_Object_GetModelName); + package.add("GetSize", &Perl_Object_GetSize); + package.add("GetSolidType", &Perl_Object_GetSolidType); + package.add("GetTiltX", &Perl_Object_GetTiltX); + package.add("GetTiltY", &Perl_Object_GetTiltY); + package.add("GetType", &Perl_Object_GetType); + package.add("GetX", &Perl_Object_GetX); + package.add("GetY", &Perl_Object_GetY); + package.add("GetZ", &Perl_Object_GetZ); + package.add("IsGroundSpawn", &Perl_Object_IsGroundSpawn); + package.add("Repop", &Perl_Object_Repop); + package.add("Save", &Perl_Object_Save); + package.add("SetEntityVariable", &Perl_Object_SetEntityVariable); + package.add("SetHeading", &Perl_Object_SetHeading); + package.add("SetID", &Perl_Object_SetID); + package.add("SetIcon", &Perl_Object_SetIcon); + package.add("SetItemID", &Perl_Object_SetItemID); + package.add("SetLocation", &Perl_Object_SetLocation); + package.add("SetModelName", &Perl_Object_SetModelName); + package.add("SetSize", &Perl_Object_SetSize); + package.add("SetSolidType", &Perl_Object_SetSolidType); + package.add("SetTiltX", &Perl_Object_SetTiltX); + package.add("SetTiltY", &Perl_Object_SetTiltY); + package.add("SetType", &Perl_Object_SetType); + package.add("SetX", &Perl_Object_SetX); + package.add("SetY", &Perl_Object_SetY); + package.add("SetZ", &Perl_Object_SetZ); + package.add("StartDecay", &Perl_Object_StartDecay); + package.add("VarSave", &Perl_Object_VarSave); +} + #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_perlpacket.cpp b/zone/perl_perlpacket.cpp index dd3875e7e..1f0a6411d 100644 --- a/zone/perl_perlpacket.cpp +++ b/zone/perl_perlpacket.cpp @@ -3,421 +3,149 @@ #include "../common/global_define.h" #include "../common/types.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "perlpacket.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_PACKET \ - do { \ - if (sv_derived_from(ST(0), "PerlPacket")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(PerlPacket*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type PerlPacket"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_PerlPacket_new); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_new) +PerlPacket* Perl_PerlPacket_new(const char* class_name) { - dXSARGS; - if (items < 1 || items > 3) - Perl_croak(aTHX_ "Usage: PerlPacket::new(CLASS, opcode= \"OP_Unknown\", len= 0)"); - { - char *CLASS = (char *)SvPV_nolen(ST(0)); - PerlPacket *RETVAL; - const char *opcode; - uint32 len; - - if (items < 2) - opcode = "OP_Unknown"; - else { - opcode = (char *)SvPV_nolen(ST(1)); - } - - if (items < 3) - len = 0; - else { - len = (uint32)SvUV(ST(2)); - } - - RETVAL = new PerlPacket(opcode, len); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "PerlPacket", (void*)RETVAL); - } - XSRETURN(1); + return new PerlPacket(); } -XS(XS_PerlPacket_DESTROY); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_DESTROY) +PerlPacket* Perl_PerlPacket_new(const char* class_name, const char* opcode) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: PerlPacket::DESTROY(THIS)"); - { - PerlPacket * THIS; - VALIDATE_THIS_IS_PACKET; - delete THIS; - } - XSRETURN_EMPTY; + return new PerlPacket(opcode); } -XS(XS_PerlPacket_SetOpcode); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetOpcode) +PerlPacket* Perl_PerlPacket_new(const char* class_name, const char* opcode, uint32_t len) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::SetOpcode(THIS, opcode)"); - { - PerlPacket * THIS; - bool RETVAL; - char * opcode = (char *)SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_PACKET; - RETVAL = THIS->SetOpcode(opcode); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); + return new PerlPacket(opcode, len); } -XS(XS_PerlPacket_Resize); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_Resize) +void Perl_PerlPacket_DESTROY(PerlPacket* self) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::Resize(THIS, len)"); - { - PerlPacket * THIS; - uint32 len = (uint32)SvUV(ST(1)); - VALIDATE_THIS_IS_PACKET; - THIS->Resize(len); - } - XSRETURN_EMPTY; + delete self; } -XS(XS_PerlPacket_SendTo); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SendTo) +bool Perl_PerlPacket_SetOpcode(PerlPacket* self, const char* opcode) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::SendTo(THIS, who)"); - { - PerlPacket * THIS; - Client * who; - VALIDATE_THIS_IS_PACKET; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV*)SvRV(ST(1))); - who = INT2PTR(Client *,tmp); - } - else - Perl_croak(aTHX_ "who is not of type Client"); - if(who == nullptr) - Perl_croak(aTHX_ "who is nullptr, avoiding crash."); - - THIS->SendTo(who); - } - XSRETURN_EMPTY; + return self->SetOpcode(opcode); } -XS(XS_PerlPacket_SendToAll); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SendToAll) +void Perl_PerlPacket_Resize(PerlPacket* self, uint32_t len) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: PerlPacket::SendToAll(THIS)"); - { - PerlPacket * THIS; - VALIDATE_THIS_IS_PACKET; - THIS->SendToAll(); - } - XSRETURN_EMPTY; + self->Resize(len); } -XS(XS_PerlPacket_Zero); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_Zero) +void Perl_PerlPacket_SendTo(PerlPacket* self, Client* who) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: PerlPacket::Zero(THIS)"); - { - PerlPacket * THIS; - VALIDATE_THIS_IS_PACKET; - THIS->Zero(); - } - XSRETURN_EMPTY; + self->SendTo(who); } -XS(XS_PerlPacket_FromArray); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_FromArray) +void Perl_PerlPacket_SendToAll(PerlPacket* self) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::FromArray(THIS, numbers, length)"); - { - PerlPacket * THIS; - int * numbers; - uint32 length = (uint32)SvUV(ST(2)); - VALIDATE_THIS_IS_PACKET; - AV *av_numbers; - if (SvROK(ST(1)) && SvTYPE(SvRV(ST(1)))==SVt_PVAV) - av_numbers = (AV*)SvRV(ST(1)); - else - Perl_croak(aTHX_ "numbers is not an array reference"); - I32 len_numbers = av_len(av_numbers) + 1; - I32 ix_numbers; - numbers = new int[len_numbers]; - for(ix_numbers = 0; ix_numbers < len_numbers; ix_numbers ++) { - SV **tmp = av_fetch(av_numbers, ix_numbers, 0); - if(tmp == nullptr || *tmp == nullptr) { - numbers[ix_numbers] = 0; - continue; - } - numbers[ix_numbers] = (int)SvIV(*tmp); - }; - - THIS->FromArray(numbers, length); - } - XSRETURN_EMPTY; + self->SendToAll(); } -XS(XS_PerlPacket_SetByte); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetByte) +void Perl_PerlPacket_Zero(PerlPacket* self) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::SetByte(THIS, pos, val)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - uint8 val = (uint8)SvUV(ST(2)); - VALIDATE_THIS_IS_PACKET; - THIS->SetByte(pos, val); - } - XSRETURN_EMPTY; + self->Zero(); } -XS(XS_PerlPacket_SetShort); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetShort) +void Perl_PerlPacket_FromArray(PerlPacket* self, perl::reference avref, uint32_t length) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::SetShort(THIS, pos, val)"); + perl::array av_numbers = avref; + int* numbers = new int[av_numbers.size()]; + + for (int i = 0; i < av_numbers.size(); ++i) { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - uint16 val = (uint16)SvUV(ST(2)); - VALIDATE_THIS_IS_PACKET; - THIS->SetShort(pos, val); + numbers[i] = av_numbers[i]; } - XSRETURN_EMPTY; + + self->FromArray(numbers, length); + + delete[] numbers; } -XS(XS_PerlPacket_SetLong); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetLong) +void Perl_PerlPacket_SetByte(PerlPacket* self, uint32_t pos, uint8_t val) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::SetLong(THIS, pos, val)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - uint32 val = (uint32)SvUV(ST(2)); - VALIDATE_THIS_IS_PACKET; - THIS->SetLong(pos, val); - } - XSRETURN_EMPTY; + self->SetByte(pos, val); } -XS(XS_PerlPacket_SetFloat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetFloat) +void Perl_PerlPacket_SetShort(PerlPacket* self, uint32_t pos, uint16_t val) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::SetFloat(THIS, pos, val)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - float val = (float)SvNV(ST(2)); - VALIDATE_THIS_IS_PACKET; - THIS->SetFloat(pos, val); - } - XSRETURN_EMPTY; + self->SetShort(pos, val); } -XS(XS_PerlPacket_SetString); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetString) +void Perl_PerlPacket_SetLong(PerlPacket* self, uint32_t pos, uint32_t val) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: PerlPacket::SetString(THIS, pos, str)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - char * str = (char *)SvPV_nolen(ST(2)); - VALIDATE_THIS_IS_PACKET; - THIS->SetString(pos, str); - } - XSRETURN_EMPTY; + self->SetLong(pos, val); } -XS(XS_PerlPacket_SetEQ1319); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetEQ1319) +void Perl_PerlPacket_SetFloat(PerlPacket* self, uint32_t pos, float val) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: PerlPacket::SetEQ1319(THIS, pos, part13, part19)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - float part13 = (float)SvNV(ST(2)); - float part19 = (float)SvNV(ST(3)); - VALIDATE_THIS_IS_PACKET; - THIS->SetEQ1319(pos, part13, part19); - } - XSRETURN_EMPTY; + self->SetFloat(pos, val); } -XS(XS_PerlPacket_SetEQ1913); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_SetEQ1913) +void Perl_PerlPacket_SetString(PerlPacket* self, uint32_t pos, char* str) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: PerlPacket::SetEQ1913(THIS, pos, part19, part13)"); - { - PerlPacket * THIS; - uint32 pos = (uint32)SvUV(ST(1)); - float part19 = (float)SvNV(ST(2)); - float part13 = (float)SvNV(ST(3)); - VALIDATE_THIS_IS_PACKET; - THIS->SetEQ1913(pos, part19, part13); - } - XSRETURN_EMPTY; + self->SetString(pos, str); } -XS(XS_PerlPacket_GetByte); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_GetByte) +void Perl_PerlPacket_SetEQ1319(PerlPacket* self, uint32_t pos, float part13, float part19) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::GetByte(THIS, pos)"); - { - PerlPacket * THIS; - uint8 RETVAL; - dXSTARG; - uint32 pos = (uint32)SvUV(ST(1)); - VALIDATE_THIS_IS_PACKET; - RETVAL = THIS->GetByte(pos); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); + self->SetEQ1319(pos, part13, part19); } -XS(XS_PerlPacket_GetShort); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_GetShort) +void Perl_PerlPacket_SetEQ1913(PerlPacket* self, uint32_t pos, float part19, float part13) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::GetShort(THIS, pos)"); - { - PerlPacket * THIS; - uint16 RETVAL; - dXSTARG; - uint32 pos = (uint32)SvUV(ST(1)); - VALIDATE_THIS_IS_PACKET; - RETVAL = THIS->GetShort(pos); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); + self->SetEQ1913(pos, part19, part13); } -XS(XS_PerlPacket_GetLong); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_GetLong) +uint8_t Perl_PerlPacket_GetByte(PerlPacket* self, uint32_t pos) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::GetLong(THIS, pos)"); - { - PerlPacket * THIS; - uint32 RETVAL; - dXSTARG; - uint32 pos = (uint32)SvUV(ST(1)); - VALIDATE_THIS_IS_PACKET; - RETVAL = THIS->GetLong(pos); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); + return self->GetByte(pos); } -XS(XS_PerlPacket_GetFloat); /* prototype to pass -Wmissing-prototypes */ -XS(XS_PerlPacket_GetFloat) +uint16_t Perl_PerlPacket_GetShort(PerlPacket* self, uint32_t pos) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: PerlPacket::GetFloat(THIS, pos)"); - { - PerlPacket * THIS; - float RETVAL; - dXSTARG; - uint32 pos = (uint32)SvUV(ST(1)); - VALIDATE_THIS_IS_PACKET; - RETVAL = THIS->GetFloat(pos); - XSprePUSH; - PUSHn((double) RETVAL); - } - XSRETURN(1); + return self->GetShort(pos); } -#ifdef __cplusplus -extern "C" -#endif -XS(boot_PerlPacket); /* prototype to pass -Wmissing-prototypes */ -XS(boot_PerlPacket) +uint32_t Perl_PerlPacket_GetLong(PerlPacket* self, uint32_t pos) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; + return self->GetLong(pos); +} - if(items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; +float Perl_PerlPacket_GetFloat(PerlPacket* self, uint32_t pos) +{ + return self->GetFloat(pos); +} - //add the strcpy stuff to get rid of const warnings.... +void perl_register_perlpacket() +{ + perl::interpreter perl(PERL_GET_THX); - XS_VERSION_BOOTCHECK ; - newXSproto(strcpy(buf, "DESTROY"), XS_PerlPacket_DESTROY, file, "$"); - newXSproto(strcpy(buf, "FromArray"), XS_PerlPacket_FromArray, file, "$$$"); - newXSproto(strcpy(buf, "GetByte"), XS_PerlPacket_GetByte, file, "$$"); - newXSproto(strcpy(buf, "GetFloat"), XS_PerlPacket_GetFloat, file, "$$"); - newXSproto(strcpy(buf, "GetLong"), XS_PerlPacket_GetLong, file, "$$"); - newXSproto(strcpy(buf, "GetShort"), XS_PerlPacket_GetShort, file, "$$"); - newXSproto(strcpy(buf, "Resize"), XS_PerlPacket_Resize, file, "$$"); - newXSproto(strcpy(buf, "SendTo"), XS_PerlPacket_SendTo, file, "$$"); - newXSproto(strcpy(buf, "SendToAll"), XS_PerlPacket_SendToAll, file, "$"); - newXSproto(strcpy(buf, "SetByte"), XS_PerlPacket_SetByte, file, "$$$"); - newXSproto(strcpy(buf, "SetEQ1319"), XS_PerlPacket_SetEQ1319, file, "$$$$"); - newXSproto(strcpy(buf, "SetEQ1913"), XS_PerlPacket_SetEQ1913, file, "$$$$"); - newXSproto(strcpy(buf, "SetFloat"), XS_PerlPacket_SetFloat, file, "$$$"); - newXSproto(strcpy(buf, "SetLong"), XS_PerlPacket_SetLong, file, "$$$"); - newXSproto(strcpy(buf, "SetOpcode"), XS_PerlPacket_SetOpcode, file, "$$"); - newXSproto(strcpy(buf, "SetShort"), XS_PerlPacket_SetShort, file, "$$$"); - newXSproto(strcpy(buf, "SetString"), XS_PerlPacket_SetString, file, "$$$"); - newXSproto(strcpy(buf, "Zero"), XS_PerlPacket_Zero, file, "$"); - newXSproto(strcpy(buf, "new"), XS_PerlPacket_new, file, "$;$$"); - XSRETURN_YES; + auto package = perl.new_class("PerlPacket"); + package.add("DESTROY", &Perl_PerlPacket_DESTROY); + package.add("FromArray", &Perl_PerlPacket_FromArray); + package.add("GetByte", &Perl_PerlPacket_GetByte); + package.add("GetFloat", &Perl_PerlPacket_GetFloat); + package.add("GetLong", &Perl_PerlPacket_GetLong); + package.add("GetShort", &Perl_PerlPacket_GetShort); + package.add("Resize", &Perl_PerlPacket_Resize); + package.add("SendTo", &Perl_PerlPacket_SendTo); + package.add("SendToAll", &Perl_PerlPacket_SendToAll); + package.add("SetByte", &Perl_PerlPacket_SetByte); + package.add("SetEQ1319", &Perl_PerlPacket_SetEQ1319); + package.add("SetEQ1913", &Perl_PerlPacket_SetEQ1913); + package.add("SetFloat", &Perl_PerlPacket_SetFloat); + package.add("SetLong", &Perl_PerlPacket_SetLong); + package.add("SetOpcode", &Perl_PerlPacket_SetOpcode); + package.add("SetShort", &Perl_PerlPacket_SetShort); + package.add("SetString", &Perl_PerlPacket_SetString); + package.add("Zero", &Perl_PerlPacket_Zero); + package.add("new", (PerlPacket*(*)(const char*))&Perl_PerlPacket_new); + package.add("new", (PerlPacket*(*)(const char*, const char*))&Perl_PerlPacket_new); + package.add("new", (PerlPacket*(*)(const char*, const char*, uint32_t))&Perl_PerlPacket_new); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_player_corpse.cpp b/zone/perl_player_corpse.cpp index 2306d3d07..740ef41c6 100644 --- a/zone/perl_player_corpse.cpp +++ b/zone/perl_player_corpse.cpp @@ -4,667 +4,238 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "corpse.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_CORPSE \ - do { \ - if (sv_derived_from(ST(0), "Corpse")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Corpse*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Corpse"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Corpse_GetCharID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetCharID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetCharID(THIS)"); // @categories Account and Character, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetCharID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetCharID(Corpse* self) // @categories Account and Character, Corpse +{ + return self->GetCharID(); } -XS(XS_Corpse_GetDecayTime); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetDecayTime) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetDecayTime(THIS)"); // @categories Script Utility, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetDecayTime(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetDecayTime(Corpse* self) // @categories Script Utility, Corpse +{ + return self->GetDecayTime(); } -XS(XS_Corpse_Lock); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_Lock) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::Lock(THIS)"); // @categories Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->Lock(); - } - XSRETURN_EMPTY; +void Perl_Corpse_Lock(Corpse* self) // @categories Corpse +{ + self->Lock(); } -XS(XS_Corpse_UnLock); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_UnLock) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::UnLock(THIS)"); // @categories Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->UnLock(); - } - XSRETURN_EMPTY; +void Perl_Corpse_UnLock(Corpse* self) // @categories Corpse +{ + self->UnLock(); } -XS(XS_Corpse_IsLocked); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_IsLocked) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::IsLocked(THIS)"); // @categories Corpse - { - Corpse *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->IsLocked(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Corpse_IsLocked(Corpse* self) // @categories Corpse +{ + return self->IsLocked(); } -XS(XS_Corpse_ResetLooter); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_ResetLooter) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::ResetLooter(THIS)"); // @categories Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->ResetLooter(); - } - XSRETURN_EMPTY; +void Perl_Corpse_ResetLooter(Corpse* self) // @categories Corpse +{ + self->ResetLooter(); } -XS(XS_Corpse_GetDBID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetDBID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetDBID(THIS)"); // @categories Script Utility, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetCorpseDBID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetDBID(Corpse* self) // @categories Script Utility, Corpse +{ + return self->GetCorpseDBID(); } -XS(XS_Corpse_GetOwnerName); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetOwnerName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetOwnerName(THIS)"); // @categories Account and Character, Corpse - { - Corpse *THIS; - char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetOwnerName(); - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_Corpse_GetOwnerName(Corpse* self) // @categories Account and Character, Corpse +{ + return self->GetOwnerName(); } -XS(XS_Corpse_SetDecayTimer); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_SetDecayTimer) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::SetDecayTimer(THIS, uint32 decay_time)"); // @categories Corpse - { - Corpse *THIS; - uint32 decaytime = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CORPSE; - THIS->SetDecayTimer(decaytime); - } - XSRETURN_EMPTY; +void Perl_Corpse_SetDecayTimer(Corpse* self, uint32_t decay_time) // @categories Corpse +{ + self->SetDecayTimer(decay_time); } -XS(XS_Corpse_IsEmpty); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_IsEmpty) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::IsEmpty(THIS)"); // @categories Inventory and Items, Corpse - { - Corpse *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->IsEmpty(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Corpse_IsEmpty(Corpse* self) // @categories Inventory and Items, Corpse +{ + return self->IsEmpty(); } -XS(XS_Corpse_AddItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_AddItem) { - dXSARGS; - if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Corpse::AddItem(THIS, uint32 item_id, uint16 charges, [unt16 slot = 0])"); // @categories Inventory and Items, Corpse - { - Corpse *THIS; - uint32 itemnum = (uint32) SvUV(ST(1)); - uint16 charges = (uint16) SvUV(ST(2)); - int16 slot; - VALIDATE_THIS_IS_CORPSE; - if (items < 4) - slot = 0; - else { - slot = (int16) SvIV(ST(3)); - } - - THIS->AddItem(itemnum, charges, slot); - } - XSRETURN_EMPTY; +void Perl_Corpse_AddItem(Corpse* self, uint32 item_id, uint16 charges) // @categories Inventory and Items, Corpse +{ + self->AddItem(item_id, charges); } -XS(XS_Corpse_GetWornItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetWornItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::GetWornItem(THIS, equipSlot)"); // @categories Inventory and Items, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - int16 equipSlot = (int16) SvIV(ST(1)); - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetWornItem(equipSlot); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Corpse_AddItem(Corpse* self, uint32 item_id, uint16 charges, uint16 slot) // @categories Inventory and Items, Corpse +{ + self->AddItem(item_id, charges, slot); } -XS(XS_Corpse_RemoveItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_RemoveItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::RemoveItem(THIS, uint16 loot_slot)"); // @categories Inventory and Items, Corpse - { - Corpse *THIS; - uint16 lootslot = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_CORPSE; - THIS->RemoveItem(lootslot); - } - XSRETURN_EMPTY; +uint32_t Perl_Corpse_GetWornItem(Corpse* self, uint16_t equip_slot) // @categories Inventory and Items, Corpse +{ + return self->GetWornItem(equip_slot); } -XS(XS_Corpse_SetCash); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_SetCash) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: Corpse::SetCash(THIS, uint16 copper, uint16 silver, uint16 gold, uint16 platinum)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - uint16 in_copper = (uint16) SvUV(ST(1)); - uint16 in_silver = (uint16) SvUV(ST(2)); - uint16 in_gold = (uint16) SvUV(ST(3)); - uint16 in_platinum = (uint16) SvUV(ST(4)); - VALIDATE_THIS_IS_CORPSE; - THIS->SetCash(in_copper, in_silver, in_gold, in_platinum); - } - XSRETURN_EMPTY; +void Perl_Corpse_RemoveItem(Corpse* self, uint16_t loot_slot) // @categories Inventory and Items, Corpse +{ + self->RemoveItem(loot_slot); } -XS(XS_Corpse_RemoveCash); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_RemoveCash) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::RemoveCash(THIS)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->RemoveCash(); - } - XSRETURN_EMPTY; +void Perl_Corpse_SetCash(Corpse* self, uint16 copper, uint16 silver, uint16 gold, uint16 platinum) // @categories Currency and Points, Corpse +{ + self->SetCash(copper, silver, gold, platinum); } -XS(XS_Corpse_CountItems); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_CountItems) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::CountItems(THIS)"); // @categories Inventory and Items, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->CountItems(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Corpse_RemoveCash(Corpse* self) // @categories Currency and Points, Corpse +{ + self->RemoveCash(); } -XS(XS_Corpse_Delete); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_Delete) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::Delete(THIS)"); // @categories Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->Delete(); - } - XSRETURN_EMPTY; +uint32_t Perl_Corpse_CountItems(Corpse* self) // @categories Inventory and Items, Corpse +{ + return self->CountItems(); } -XS(XS_Corpse_GetCopper); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetCopper) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetCopper(THIS)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetCopper(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +void Perl_Corpse_Delete(Corpse* self) // @categories Corpse +{ + self->Delete(); } -XS(XS_Corpse_GetSilver); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetSilver) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetSilver(THIS)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetSilver(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetCopper(Corpse* self) // @categories Currency and Points, Corpse +{ + return self->GetCopper(); } -XS(XS_Corpse_GetGold); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetGold) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetGold(THIS)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetGold(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetSilver(Corpse* self) // @categories Currency and Points, Corpse +{ + return self->GetSilver(); } -XS(XS_Corpse_GetPlatinum); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_GetPlatinum) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetPlatinum(THIS)"); // @categories Currency and Points, Corpse - { - Corpse *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->GetPlatinum(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetGold(Corpse* self)// @categories Currency and Points, Corpse +{ + return self->GetGold(); } -XS(XS_Corpse_Summon); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_Summon) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Corpse::Summon(THIS, Client* client, bool is_spell)"); // @categories Corpse - { - Corpse *THIS; - Client *client; - bool spell = (bool) SvTRUE(ST(2)); - VALIDATE_THIS_IS_CORPSE; - if (sv_derived_from(ST(1), "Client")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - client = INT2PTR(Client *, tmp); - } else - Perl_croak(aTHX_ "client is not of type Client"); - if (client == nullptr) - Perl_croak(aTHX_ "client is nullptr, avoiding crash."); - - THIS->Summon(client, spell, true); - } - XSRETURN_EMPTY; +uint32_t Perl_Corpse_GetPlatinum(Corpse* self) // @categories Currency and Points, Corpse +{ + return self->GetPlatinum(); } -XS(XS_Corpse_CastRezz); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_CastRezz) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Corpse::CastRezz(THIS, uint16 spell_id, [Mob* caster = nullptr])"); // @categories Spells and Disciplines, Corpse - { - Corpse *THIS; - uint16 spellid = (uint16) SvUV(ST(1)); - Mob *Caster; - VALIDATE_THIS_IS_CORPSE; - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - Caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "Caster is not of type Mob"); - if (Caster == nullptr) - Perl_croak(aTHX_ "Caster is nullptr, avoiding crash."); - - THIS->CastRezz(spellid, Caster); - } - XSRETURN_EMPTY; +void Perl_Corpse_Summon(Corpse* self, Client* client, bool is_spell) // @categories Corpse +{ + self->Summon(client, is_spell, true); } -XS(XS_Corpse_CompleteRezz); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_CompleteRezz) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::CompleteRezz(THIS)"); // @categories Spells and Disciplines, Corpse - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - THIS->CompleteResurrection(); - } - XSRETURN_EMPTY; +void Perl_Corpse_CastRezz(Corpse* self, uint16_t spell_id, Mob* caster) // @categories Spells and Disciplines, Corpse +{ + self->CastRezz(spell_id, caster); } -XS(XS_Corpse_CanMobLoot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_CanMobLoot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::CanMobLoot(THIS, int character_id)"); // @categories Script Utility, Corpse - { - Corpse *THIS; - bool RETVAL; - int charid = (int) SvIV(ST(1)); - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->CanPlayerLoot(charid); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Corpse_CompleteRezz(Corpse* self) // @categories Spells and Disciplines, Corpse +{ + self->CompleteResurrection(); } -XS(XS_Corpse_AllowMobLoot); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_AllowMobLoot) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Corpse::AllowMobLoot(THIS, Mob* them, uint8 slot)"); // @categories Account and Character, Corpse - { - Corpse *THIS; - Mob *them; - uint8 slot = (uint8) SvUV(ST(2)); - VALIDATE_THIS_IS_CORPSE; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - them = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "them is not of type Mob"); - if (them == nullptr) - Perl_croak(aTHX_ "them is nullptr, avoiding crash."); - - THIS->AllowPlayerLoot(them, slot); - } - XSRETURN_EMPTY; +bool Perl_Corpse_CanMobLoot(Corpse* self, int character_id) // @categories Script Utility, Corpse +{ + return self->CanPlayerLoot(character_id); } -XS(XS_Corpse_AddLooter); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_AddLooter) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::AddLooter(THIS, Mob* who)"); // @categories Account and Character, Corpse - { - Corpse *THIS; - Mob *who; - VALIDATE_THIS_IS_CORPSE; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - who = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "who is not of type Mob"); - if (who == nullptr) - Perl_croak(aTHX_ "who is nullptr, avoiding crash."); - - THIS->AddLooter(who); - } - XSRETURN_EMPTY; +void Perl_Corpse_AllowMobLoot(Corpse* self, Mob* them, uint8_t slot) // @categories Account and Character, Corpse +{ + self->AllowPlayerLoot(them, slot); } -XS(XS_Corpse_IsRezzed); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_IsRezzed) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::IsRezzed(THIS)"); // @categories Corpse - { - Corpse *THIS; - bool RETVAL; - VALIDATE_THIS_IS_CORPSE; - RETVAL = THIS->IsRezzed(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_Corpse_AddLooter(Corpse* self, Mob* who) // @categories Account and Character, Corpse +{ + self->AddLooter(who); } -XS(XS_Corpse_HasItem); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Corpse_HasItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::HasItem(THIS, uint32 item_id)"); // @categories Script Utility - { - Corpse *THIS; - bool has_item = false; - uint32 item_id = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_CORPSE; - has_item = THIS->HasItem(item_id); - ST(0) = boolSV(has_item); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_Corpse_IsRezzed(Corpse* self) // @categories Corpse +{ + return self->IsRezzed(); } -XS(XS_Corpse_CountItem); -XS(XS_Corpse_CountItem) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::CountItem(THIS, uint32 item_id)"); // @categories Script Utility - { - Corpse *THIS; - uint16 item_count = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - item_count = THIS->CountItem(item_id); - XSprePUSH; - PUSHu((UV) item_count); - } - XSRETURN(1); +bool Perl_Corpse_HasItem(Corpse* self, uint32_t item_id) // @categories Script Utility +{ + return self->HasItem(item_id); } -XS(XS_Corpse_GetItemIDBySlot); -XS(XS_Corpse_GetItemIDBySlot) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::GetItemIDBySlot(THIS, uint16 loot_slot)"); // @categories Script Utility - { - Corpse *THIS; - uint32 item_id = 0; - uint16 loot_slot = (uint16) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - item_id = THIS->GetItemIDBySlot(loot_slot); - XSprePUSH; - PUSHu((UV) item_id); - } - XSRETURN(1); +int Perl_Corpse_CountItem(Corpse* self, uint32_t item_id) // @categories Script Utility +{ + return self->CountItem(item_id); } -XS(XS_Corpse_GetFirstSlotByItemID); -XS(XS_Corpse_GetFirstSlotByItemID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Corpse::GetFirstSlotByItemID(THIS, uint32 item_id)"); // @categories Script Utility - { - Corpse *THIS; - uint16 loot_slot = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_CORPSE; - loot_slot = THIS->GetFirstSlotByItemID(item_id); - XSprePUSH; - PUSHu((UV) loot_slot); - } - XSRETURN(1); +uint32_t Perl_Corpse_GetItemIDBySlot(Corpse* self, uint16_t loot_slot) // @categories Script Utility +{ + return self->GetItemIDBySlot(loot_slot); } -XS(XS_Corpse_RemoveItemByID); -XS(XS_Corpse_RemoveItemByID) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: Corpse::RemoveItemByID(THIS, uint32 item_id, [int quantity = 1])"); // @categories Script Utility - { - Corpse *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - int quantity = 1; - VALIDATE_THIS_IS_CORPSE; - if (items == 3) - quantity = (int) SvIV(ST(2)); - - THIS->RemoveItemByID(item_id, quantity); - } - XSRETURN_EMPTY; +int Perl_Corpse_GetFirstSlotByItemID(Corpse* self, uint32_t item_id) // @categories Script Utility +{ + return self->GetFirstSlotByItemID(item_id); } -XS(XS_Corpse_GetLootList); -XS(XS_Corpse_GetLootList) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Corpse::GetLootList(THIS)"); // @categories Script Utility - { - Corpse *THIS; - VALIDATE_THIS_IS_CORPSE; - auto corpse_items = THIS->GetLootList(); - auto item_count = corpse_items.size(); - if (item_count > 0) { - EXTEND(sp, item_count); - for (int index = 0; index < item_count; ++index) { - ST(index) = sv_2mortal(newSVuv(corpse_items[index])); - } - XSRETURN(item_count); - } - SV* return_value = &PL_sv_undef; - ST(0) = return_value; - XSRETURN(1); - } +void Perl_Corpse_RemoveItemByID(Corpse* self, uint32_t item_id) // @categories Script Utility +{ + self->RemoveItemByID(item_id); } -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Corpse); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Corpse) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; +void Perl_Corpse_RemoveItemByID(Corpse* self, uint32_t item_id, int quantity) // @categories Script Utility +{ + self->RemoveItemByID(item_id); +} - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; +perl::array Perl_Corpse_GetLootList(Corpse* self) // @categories Script Utility +{ + perl::array result; - //add the strcpy stuff to get rid of const warnings.... + auto corpse_items = self->GetLootList(); + for (int i = 0; i < corpse_items.size(); ++i) + { + result.push_back(corpse_items[i]); + } - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "AddItem"), XS_Corpse_AddItem, file, "$$$;$"); - newXSproto(strcpy(buf, "AddLooter"), XS_Corpse_AddLooter, file, "$$"); - newXSproto(strcpy(buf, "AllowMobLoot"), XS_Corpse_AllowMobLoot, file, "$$$"); - newXSproto(strcpy(buf, "CanMobLoot"), XS_Corpse_CanMobLoot, file, "$$"); - newXSproto(strcpy(buf, "CastRezz"), XS_Corpse_CastRezz, file, "$$$"); - newXSproto(strcpy(buf, "CompleteRezz"), XS_Corpse_CompleteRezz, file, "$"); - newXSproto(strcpy(buf, "CountItem"), XS_Corpse_CountItem, file, "$$"); - newXSproto(strcpy(buf, "CountItems"), XS_Corpse_CountItems, file, "$"); - newXSproto(strcpy(buf, "Delete"), XS_Corpse_Delete, file, "$"); - newXSproto(strcpy(buf, "GetCharID"), XS_Corpse_GetCharID, file, "$"); - newXSproto(strcpy(buf, "GetCopper"), XS_Corpse_GetCopper, file, "$"); - newXSproto(strcpy(buf, "GetDBID"), XS_Corpse_GetDBID, file, "$"); - newXSproto(strcpy(buf, "GetDecayTime"), XS_Corpse_GetDecayTime, file, "$"); - newXSproto(strcpy(buf, "GetFirstSlotByItemID"), XS_Corpse_GetFirstSlotByItemID, file, "$$"); - newXSproto(strcpy(buf, "GetGold"), XS_Corpse_GetGold, file, "$"); - newXSproto(strcpy(buf, "GetItemIDBySlot"), XS_Corpse_GetItemIDBySlot, file, "$$"); - newXSproto(strcpy(buf, "GetLootList"), XS_Corpse_GetLootList, file, "$"); - newXSproto(strcpy(buf, "GetOwnerName"), XS_Corpse_GetOwnerName, file, "$"); - newXSproto(strcpy(buf, "GetPlatinum"), XS_Corpse_GetPlatinum, file, "$"); - newXSproto(strcpy(buf, "GetSilver"), XS_Corpse_GetSilver, file, "$"); - newXSproto(strcpy(buf, "GetWornItem"), XS_Corpse_GetWornItem, file, "$$"); - newXSproto(strcpy(buf, "HasItem"), XS_Corpse_HasItem, file, "$$"); - newXSproto(strcpy(buf, "IsEmpty"), XS_Corpse_IsEmpty, file, "$"); - newXSproto(strcpy(buf, "IsLocked"), XS_Corpse_IsLocked, file, "$"); - newXSproto(strcpy(buf, "IsRezzed"), XS_Corpse_IsRezzed, file, "$"); - newXSproto(strcpy(buf, "Lock"), XS_Corpse_Lock, file, "$"); - newXSproto(strcpy(buf, "RemoveCash"), XS_Corpse_RemoveCash, file, "$"); - newXSproto(strcpy(buf, "RemoveItem"), XS_Corpse_RemoveItem, file, "$$"); - newXSproto(strcpy(buf, "RemoveItemByID"), XS_Corpse_RemoveItemByID, file, "$$;$"); - newXSproto(strcpy(buf, "ResetLooter"), XS_Corpse_ResetLooter, file, "$"); - newXSproto(strcpy(buf, "SetCash"), XS_Corpse_SetCash, file, "$$$$$"); - newXSproto(strcpy(buf, "SetDecayTimer"), XS_Corpse_SetDecayTimer, file, "$$"); - newXSproto(strcpy(buf, "Summon"), XS_Corpse_Summon, file, "$$$"); - newXSproto(strcpy(buf, "UnLock"), XS_Corpse_UnLock, file, "$"); - XSRETURN_YES; + return result; +} + +void perl_register_corpse() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("Corpse"); + package.add_base_class("Mob"); + package.add("AddItem", (void(*)(Corpse*, uint32, uint16))&Perl_Corpse_AddItem); + package.add("AddItem", (void(*)(Corpse*, uint32, uint16, uint16))&Perl_Corpse_AddItem); + package.add("AddLooter", &Perl_Corpse_AddLooter); + package.add("AllowMobLoot", &Perl_Corpse_AllowMobLoot); + package.add("CanMobLoot", &Perl_Corpse_CanMobLoot); + package.add("CastRezz", &Perl_Corpse_CastRezz); + package.add("CompleteRezz", &Perl_Corpse_CompleteRezz); + package.add("CountItem", &Perl_Corpse_CountItem); + package.add("CountItems", &Perl_Corpse_CountItems); + package.add("Delete", &Perl_Corpse_Delete); + package.add("GetCharID", &Perl_Corpse_GetCharID); + package.add("GetCopper", &Perl_Corpse_GetCopper); + package.add("GetDBID", &Perl_Corpse_GetDBID); + package.add("GetDecayTime", &Perl_Corpse_GetDecayTime); + package.add("GetFirstSlotByItemID", &Perl_Corpse_GetFirstSlotByItemID); + package.add("GetGold", &Perl_Corpse_GetGold); + package.add("GetItemIDBySlot", &Perl_Corpse_GetItemIDBySlot); + package.add("GetLootList", &Perl_Corpse_GetLootList); + package.add("GetOwnerName", &Perl_Corpse_GetOwnerName); + package.add("GetPlatinum", &Perl_Corpse_GetPlatinum); + package.add("GetSilver", &Perl_Corpse_GetSilver); + package.add("GetWornItem", &Perl_Corpse_GetWornItem); + package.add("HasItem", &Perl_Corpse_HasItem); + package.add("IsEmpty", &Perl_Corpse_IsEmpty); + package.add("IsLocked", &Perl_Corpse_IsLocked); + package.add("IsRezzed", &Perl_Corpse_IsRezzed); + package.add("Lock", &Perl_Corpse_Lock); + package.add("RemoveCash", &Perl_Corpse_RemoveCash); + package.add("RemoveItem", &Perl_Corpse_RemoveItem); + package.add("RemoveItemByID", (void(*)(Corpse*, uint32_t))&Perl_Corpse_RemoveItemByID); + package.add("RemoveItemByID", (void(*)(Corpse*, uint32_t, int))&Perl_Corpse_RemoveItemByID); + package.add("ResetLooter", &Perl_Corpse_ResetLooter); + package.add("SetCash", &Perl_Corpse_SetCash); + package.add("SetDecayTimer", &Perl_Corpse_SetDecayTimer); + package.add("Summon", &Perl_Corpse_Summon); + package.add("UnLock", &Perl_Corpse_UnLock); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 8b2d32a02..8f2d30f5f 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -4,234 +4,82 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" +#include "../common/item_instance.h" #include "embperl.h" -#ifdef seed -#undef seed -#endif - -#include "../common/item_instance.h" - -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_ITEM \ - do { \ - if (sv_derived_from(ST(0), "QuestItem")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(EQ::ItemInstance*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type EQ::ItemInstance"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_QuestItem_GetName); -XS(XS_QuestItem_GetName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - Const_char *RETVAL; - dXSTARG; - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->GetItem()->Name; - sv_setpv(TARG, RETVAL); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); +std::string Perl_QuestItem_GetName(EQ::ItemInstance* self) // @categories Inventory and Items +{ + return self->GetItem()->Name; } -XS(XS_QuestItem_SetScale); -XS(XS_QuestItem_SetScale) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, float scale_multiplier)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - float Mult; - VALIDATE_THIS_IS_ITEM; - Mult = (float) SvNV(ST(1)); - - if (THIS->IsScaling()) { - THIS->SetExp((int) (Mult * 10000 + .5)); - } +void Perl_QuestItem_SetScale(EQ::ItemInstance* self, float scale_multiplier) // @categories Inventory and Items +{ + if (self->IsScaling()) { + self->SetExp((int) (scale_multiplier * 10000 + .5)); } - XSRETURN_EMPTY; } -XS(XS_QuestItem_ItemSay); -XS(XS_QuestItem_ItemSay) { - dXSARGS; - if (items != 2 && items != 3) - Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, string text [int language_id])"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - Const_char *text; - int lang = 0; - VALIDATE_THIS_IS_ITEM; - text = SvPV_nolen(ST(1)); - if (items == 3) - lang = (int) SvUV(ST(2)); - - quest_manager.GetInitiator()->ChannelMessageSend(THIS->GetItem()->Name, 0, 8, lang, 100, text); - } - XSRETURN_EMPTY; +void Perl_QuestItem_ItemSay(EQ::ItemInstance* self, const char* text) // @categories Inventory and Items +{ + quest_manager.GetInitiator()->ChannelMessageSend(self->GetItem()->Name, 0, 8, 0, 100, text); } -XS(XS_QuestItem_IsType); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_IsType) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - bool RETVAL; - uint32 type = (int32) SvIV(ST(1)); - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->IsType((EQ::item::ItemClass) type); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +void Perl_QuestItem_ItemSay(EQ::ItemInstance* self, const char* text, int language_id) // @categories Inventory and Items +{ + quest_manager.GetInitiator()->ChannelMessageSend(self->GetItem()->Name, 0, 8, language_id, 100, text); } -XS(XS_QuestItem_IsAttuned); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_IsAttuned) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - bool RETVAL; - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->IsAttuned(); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); +bool Perl_QuestItem_IsType(EQ::ItemInstance* self, int type) // @categories Inventory and Items +{ + return self->IsType(static_cast(type)); } -XS(XS_QuestItem_GetCharges); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_GetCharges) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - int16 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->GetCharges(); - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +bool Perl_QuestItem_IsAttuned(EQ::ItemInstance* self) // @categories Inventory and Items +{ + return self->IsAttuned(); } -XS(XS_QuestItem_GetAugment); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_GetAugment) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, int16 slot_id)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - int16 slot_id = (int16) SvIV(ST(1)); - EQ::ItemInstance *RETVAL; - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->GetAugment(slot_id); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "QuestItem", (void *) RETVAL); - } - XSRETURN(1); +int Perl_QuestItem_GetCharges(EQ::ItemInstance* self) // @categories Inventory and Items +{ + return self->GetCharges(); } -XS(XS_QuestItem_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_ITEM; - RETVAL = THIS->GetItem()->ID; - XSprePUSH; - PUSHi((IV) RETVAL); - } - XSRETURN(1); +EQ::ItemInstance* Perl_QuestItem_GetAugment(EQ::ItemInstance* self, int slot_id) // @categories Inventory and Items +{ + return self->GetAugment(slot_id); } -XS(XS_QuestItem_ContainsAugmentByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_ContainsAugmentByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: QuestItem::ContainsAugmentByID(THIS, uint32 item_id)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - uint32 item_id = (uint32) SvUV(ST(1)); - bool contains_augment = false; - VALIDATE_THIS_IS_ITEM; - contains_augment = THIS->ContainsAugmentByID(item_id); - ST(0) = boolSV(contains_augment); - sv_2mortal(ST(0)); - } - XSRETURN(1); +uint32_t Perl_QuestItem_GetID(EQ::ItemInstance* self) // @categories Inventory and Items +{ + return self->GetItem()->ID; } -XS(XS_QuestItem_CountAugmentByID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_QuestItem_CountAugmentByID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: QuestItem::CountAugmentByID(THIS, uint32 item_id)"); // @categories Inventory and Items - { - EQ::ItemInstance *THIS; - int quantity = 0; - uint32 item_id = (uint32) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_ITEM; - quantity = THIS->CountAugmentByID(item_id); - XSprePUSH; - PUSHi((IV) quantity); - } - XSRETURN(1); +bool Perl_QuestItem_ContainsAugmentByID(EQ::ItemInstance* self, uint32_t item_id) // @categories Inventory and Items +{ + return self->ContainsAugmentByID(item_id); } -#ifdef __cplusplus -extern "C" -#endif +int Perl_QuestItem_CountAugmentByID(EQ::ItemInstance* self, uint32_t item_id) // @categories Inventory and Items +{ + return self->CountAugmentByID(item_id); +} -XS(boot_QuestItem); -XS(boot_QuestItem) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; +void perl_register_questitem() +{ + perl::interpreter perl(PERL_GET_THX); - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "ContainsAugmentByID"), XS_QuestItem_ContainsAugmentByID, file, "$$"); - newXSproto(strcpy(buf, "CountAugmentByID"), XS_QuestItem_CountAugmentByID, file, "$$"); - newXSproto(strcpy(buf, "GetAugment"), XS_QuestItem_GetAugment, file, "$$"); - newXSproto(strcpy(buf, "GetCharges"), XS_QuestItem_GetCharges, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_QuestItem_GetID, file, "$"); - newXSproto(strcpy(buf, "GetName"), XS_QuestItem_GetName, file, "$"); - newXSproto(strcpy(buf, "IsAttuned"), XS_QuestItem_IsAttuned, file, "$"); - newXSproto(strcpy(buf, "IsType"), XS_QuestItem_IsType, file, "$$"); - newXSproto(strcpy(buf, "ItemSay"), XS_QuestItem_ItemSay, file, "$"); - newXSproto(strcpy(buf, "SetScale"), XS_QuestItem_SetScale, file, "$"); - XSRETURN_YES; + auto package = perl.new_class("QuestItem"); + package.add("ContainsAugmentByID", &Perl_QuestItem_ContainsAugmentByID); + package.add("CountAugmentByID", &Perl_QuestItem_CountAugmentByID); + package.add("GetAugment", &Perl_QuestItem_GetAugment); + package.add("GetCharges", &Perl_QuestItem_GetCharges); + package.add("GetID", &Perl_QuestItem_GetID); + package.add("GetName", &Perl_QuestItem_GetName); + package.add("IsAttuned", &Perl_QuestItem_IsAttuned); + package.add("IsType", &Perl_QuestItem_IsType); + package.add("ItemSay", (void(*)(EQ::ItemInstance*, const char*))&Perl_QuestItem_ItemSay); + package.add("ItemSay", (void(*)(EQ::ItemInstance*, const char*, int))&Perl_QuestItem_ItemSay); + package.add("SetScale", &Perl_QuestItem_SetScale); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_raids.cpp b/zone/perl_raids.cpp index c7c07e042..0ce43a749 100644 --- a/zone/perl_raids.cpp +++ b/zone/perl_raids.cpp @@ -4,443 +4,138 @@ #include "../common/global_define.h" #include "embperl.h" - -#ifdef seed -#undef seed -#endif - #include "raids.h" #include "client.h" -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif +bool Perl_Raid_IsRaidMember(Raid* self, const char* name) // @categories Raid +{ + return self->IsRaidMember(name); +} -#define VALIDATE_THIS_IS_RAID \ - do { \ - if (sv_derived_from(ST(0), "Raid")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(Raid*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type Raid"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); +void Perl_Raid_CastGroupSpell(Raid* self, Mob* caster, uint16 spell_id, uint32 group_id) // @categories Group, Raid +{ + self->CastGroupSpell(caster, spell_id, group_id); +} -XS(XS_Raid_IsRaidMember); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_IsRaidMember) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::IsRaidMember(THIS, string name)"); // @categories Raid +int Perl_Raid_GroupCount(Raid* self, uint32_t group_id) // @categories Group, Raid +{ + return self->GroupCount(group_id); +} + +int Perl_Raid_RaidCount(Raid* self) // @categories Raid +{ + return self->RaidCount(); +} + +uint32_t Perl_Raid_GetGroup(Raid* self, const char* name) // @categories Group, Raid +{ + return self->GetGroup(name); +} + +void Perl_Raid_SplitExp(Raid* self, uint32 experience, Mob* other) // @categories Experience and Level, Raid +{ + self->SplitExp(experience, other); +} + +uint32_t Perl_Raid_GetTotalRaidDamage(Raid* self, Mob* other) // @categories Raid +{ + return self->GetTotalRaidDamage(other); +} + +void Perl_Raid_SplitMoney(Raid* self, uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) // @categories Currency and Points, Raid +{ + self->SplitMoney(gid, copper, silver, gold, platinum); +} + +void Perl_Raid_BalanceHP(Raid* self, int32_t penalty, uint32_t group_id) // @categories Raid +{ + self->BalanceHP(penalty, group_id); +} + +bool Perl_Raid_IsLeader(Raid* self, const char* name) // @categories Raid +{ + return self->IsLeader(name); +} + +bool Perl_Raid_IsGroupLeader(Raid* self, const char* who) // @categories Group, Raid +{ + return self->IsGroupLeader(who); +} + +uint32_t Perl_Raid_GetHighestLevel(Raid* self) // @categories Raid +{ + return self->GetHighestLevel(); +} + +uint32_t Perl_Raid_GetLowestLevel(Raid* self) // @categories Raid +{ + return self->GetLowestLevel(); +} + +Client* Perl_Raid_GetClientByIndex(Raid* self, uint16_t raid_index) // @categories Raid +{ + return self->GetClientByIndex(raid_index); +} + +void Perl_Raid_TeleportGroup(Raid* self, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id) // @categories Group, Raid +{ + self->TeleportGroup(sender, zone_id, 0, x, y, z, heading, group_id); +} + +void Perl_Raid_TeleportRaid(Raid* self, Mob* sender, uint32 zone_id, float x, float y, float z, float heading) // @categories Raid +{ + self->TeleportRaid(sender, zone_id, 0, x, y, z, heading); +} + +uint32_t Perl_Raid_GetID(Raid* self) // @categories Raid +{ + return self->GetID(); +} + +Client* Perl_Raid_GetMember(Raid* self, int index) // @categories Raid +{ + if (index < 0 || index >= MAX_RAID_MEMBERS) { - Raid *THIS; - bool RETVAL; - const char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->IsRaidMember(name); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); + return nullptr; } - XSRETURN(1); + return self->members[index].member; } -XS(XS_Raid_CastGroupSpell); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_CastGroupSpell) { - dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Raid::CastGroupSpell(THIS, Mob* caster, uint16 spell_id, uint32 group_id)"); // @categories Group, Raid - { - Raid *THIS; - Mob *caster; - uint16 spellid = (uint16) SvUV(ST(2)); - uint32 gid = (uint32) SvUV(ST(3)); - VALIDATE_THIS_IS_RAID; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - caster = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "caster is not of type Mob"); - if (caster == nullptr) - Perl_croak(aTHX_ "caster is nullptr, avoiding crash."); - - THIS->CastGroupSpell(caster, spellid, gid); - } - XSRETURN_EMPTY; +bool Perl_Raid_DoesAnyMemberHaveExpeditionLockout(Raid* self, std::string expedition_name, std::string event_name) +{ + return self->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name); } -XS(XS_Raid_GroupCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GroupCount) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::GroupCount(THIS, uint32 group_id)"); // @categories Group, Raid - { - Raid *THIS; - uint8 RETVAL; - dXSTARG; - uint32 gid = (uint32) SvUV(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GroupCount(gid); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); +bool Perl_Raid_DoesAnyMemberHaveExpeditionLockout(Raid* self, std::string expedition_name, std::string event_name, int max_check_count) +{ + return self->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name, max_check_count); } -XS(XS_Raid_RaidCount); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_RaidCount) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Raid::RaidCount(THIS)"); // @categories Raid - { - Raid *THIS; - uint8 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->RaidCount(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} +void perl_register_raid() +{ + perl::interpreter perl(PERL_GET_THX); -XS(XS_Raid_GetGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetGroup) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::GetGroup(THIS, string name)"); // @categories Group, Raid - { - Raid *THIS; - uint32 RETVAL; - dXSTARG; - const char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GetGroup(name); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_SplitExp); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_SplitExp) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Raid::SplitExp(THIS, uint32 experience, [Mob* other = nullptr])"); // @categories Experience and Level, Raid - { - Raid *THIS; - uint32 exp = (uint32) SvUV(ST(1)); - Mob *other; - VALIDATE_THIS_IS_RAID; - if (sv_derived_from(ST(2), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(2))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - THIS->SplitExp(exp, other); - } - XSRETURN_EMPTY; -} - -XS(XS_Raid_GetTotalRaidDamage); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetTotalRaidDamage) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::GetTotalRaidDamage(THIS, [Mob* other = nullptr])"); // @categories Raid - { - Raid *THIS; - uint32 RETVAL; - dXSTARG; - Mob *other; - VALIDATE_THIS_IS_RAID; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - other = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "other is not of type Mob"); - if (other == nullptr) - Perl_croak(aTHX_ "other is nullptr, avoiding crash."); - - RETVAL = THIS->GetTotalRaidDamage(other); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_SplitMoney); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_SplitMoney) { - dXSARGS; - if (items != 5) - Perl_croak(aTHX_ "Usage: Raid::SplitMoney(THIS, uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum)"); // @categories Currency and Points, Raid - { - Raid *THIS; - uint32 gid = (uint32) SvUV(ST(1)); - uint32 copper = (uint32) SvUV(ST(2)); - uint32 silver = (uint32) SvUV(ST(3)); - uint32 gold = (uint32) SvUV(ST(4)); - uint32 platinum = (uint32) SvUV(ST(5)); - VALIDATE_THIS_IS_RAID; - THIS->SplitMoney(gid, copper, silver, gold, platinum); - } - XSRETURN_EMPTY; -} - -XS(XS_Raid_BalanceHP); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_BalanceHP) { - dXSARGS; - if (items != 3) - Perl_croak(aTHX_ "Usage: Raid::BalanceHP(THIS, int32 penalty, uint32 group_id)"); // @categories Raid - { - Raid *THIS; - int32 penalty = (int32) SvUV(ST(1)); - uint32 gid = (uint32) SvUV(ST(2)); - VALIDATE_THIS_IS_RAID; - THIS->BalanceHP(penalty, gid); - } - XSRETURN_EMPTY; -} - -XS(XS_Raid_IsLeader); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_IsLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::IsLeader(THIS, string name)"); // @categories Raid - { - Raid *THIS; - bool RETVAL; - const char *name = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->IsLeader(name); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Raid_IsGroupLeader); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_IsGroupLeader) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::IsGroupLeader(THIS, string name)"); // @categories Group, Raid - { - Raid *THIS; - bool RETVAL; - const char *who = (char *) SvPV_nolen(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->IsGroupLeader(who); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Raid_GetHighestLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetHighestLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Raid::GetHighestLevel(THIS)"); // @categories Raid - { - Raid *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GetHighestLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_GetLowestLevel); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetLowestLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Raid::GetLowestLevel(THIS)"); // @categories Raid - { - Raid *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GetLowestLevel(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_GetClientByIndex); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetClientByIndex) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::GetClientByIndex(THIS, uint16 raid_index)"); // @categories Raid - { - Raid *THIS; - Client *RETVAL; - uint16 index = (uint16) SvUV(ST(1)); - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GetClientByIndex(index); - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_TeleportGroup) { - dXSARGS; - if (items != 8) - Perl_croak(aTHX_ "Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)"); // @categories Group, Raid - { - Raid *THIS; - Mob *sender; - uint32 zoneID = (uint32) SvUV(ST(2)); - float x = (float) SvNV(ST(3)); - float y = (float) SvNV(ST(4)); - float z = (float) SvNV(ST(5)); - float heading = (float) SvNV(ST(6)); - uint32 gid = (uint32) SvUV(ST(7)); - VALIDATE_THIS_IS_RAID; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); - - THIS->TeleportGroup(sender, zoneID, 0, x, y, z, heading, gid); - } - XSRETURN_EMPTY; -} - -XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_TeleportRaid) { - dXSARGS; - if (items != 7) - Perl_croak(aTHX_ "Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)"); // @categories Raid - { - Raid *THIS; - Mob *sender; - uint32 zoneID = (uint32) SvUV(ST(2)); - float x = (float) SvNV(ST(3)); - float y = (float) SvNV(ST(4)); - float z = (float) SvNV(ST(5)); - float heading = (float) SvNV(ST(6)); - VALIDATE_THIS_IS_RAID; - if (sv_derived_from(ST(1), "Mob")) { - IV tmp = SvIV((SV *) SvRV(ST(1))); - sender = INT2PTR(Mob *, tmp); - } else - Perl_croak(aTHX_ "sender is not of type Mob"); - if (sender == nullptr) - Perl_croak(aTHX_ "sender is nullptr, avoiding crash."); - - THIS->TeleportRaid(sender, zoneID, 0, x, y, z, heading); - } - XSRETURN_EMPTY; -} - -XS(XS_Raid_GetID); /* prototype to pass -Wmissing-prototypes */ -XS(XS_Raid_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Raid::GetID(THIS)"); // @categories Raid - { - Raid *THIS; - uint32 RETVAL; - dXSTARG; - VALIDATE_THIS_IS_RAID; - RETVAL = THIS->GetID(); - XSprePUSH; - PUSHu((UV) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_GetMember); -XS(XS_Raid_GetMember) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Raid::GetMember(THIS, int raid_index)"); // @categories Raid - { - Raid *THIS; - Client *RETVAL = nullptr; - dXSTARG; - VALIDATE_THIS_IS_RAID; - int index = (int) SvUV(ST(1)); - if (index < 0 || index > 71) - RETVAL = nullptr; - else { - if (THIS->members[index].member != nullptr) - RETVAL = THIS->members[index].member->CastToClient(); - } - - ST(0) = sv_newmortal(); - sv_setref_pv(ST(0), "Client", (void *) RETVAL); - } - XSRETURN(1); -} - -XS(XS_Raid_DoesAnyMemberHaveExpeditionLockout); -XS(XS_Raid_DoesAnyMemberHaveExpeditionLockout) { - dXSARGS; - if (items != 3 && items != 4) { - Perl_croak(aTHX_ "Usage: Raid::DoesAnyMemberHaveExpeditionLockout(THIS, string expedition_name, string event_name, [int max_check_count = 0])"); - } - - Raid* THIS = nullptr; - VALIDATE_THIS_IS_RAID; - std::string expedition_name(SvPV_nolen(ST(1))); - std::string event_name(SvPV_nolen(ST(2))); - int max_check_count = (items == 4) ? static_cast(SvIV(ST(3))) : 0; - - bool result = THIS->DoesAnyMemberHaveExpeditionLockout(expedition_name, event_name, max_check_count); - ST(0) = boolSV(result); - XSRETURN(1); -} - -#ifdef __cplusplus -extern "C" -#endif -XS(boot_Raid); /* prototype to pass -Wmissing-prototypes */ -XS(boot_Raid) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - - if (items != 1) - fprintf(stderr, "boot_quest does not take any arguments."); - char buf[128]; - - //add the strcpy stuff to get rid of const warnings.... - - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "BalanceHP"), XS_Raid_BalanceHP, file, "$$$"); - newXSproto(strcpy(buf, "CastGroupSpell"), XS_Raid_CastGroupSpell, file, "$$$$"); - newXSproto(strcpy(buf, "DoesAnyMemberHaveExpeditionLockout"), XS_Raid_DoesAnyMemberHaveExpeditionLockout, file, "$$$;$"); - newXSproto(strcpy(buf, "GetClientByIndex"), XS_Raid_GetClientByIndex, file, "$$"); - newXSproto(strcpy(buf, "GetGroup"), XS_Raid_GetGroup, file, "$$"); - newXSproto(strcpy(buf, "GetHighestLevel"), XS_Raid_GetHighestLevel, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Raid_GetID, file, "$"); - newXSproto(strcpy(buf, "GetLowestLevel"), XS_Raid_GetLowestLevel, file, "$"); - newXSproto(strcpy(buf, "GetMember"), XS_Raid_GetMember, file, "$$"); - newXSproto(strcpy(buf, "GetTotalRaidDamage"), XS_Raid_GetTotalRaidDamage, file, "$$"); - newXSproto(strcpy(buf, "GroupCount"), XS_Raid_GroupCount, file, "$$"); - newXSproto(strcpy(buf, "IsGroupLeader"), XS_Raid_IsGroupLeader, file, "$$"); - newXSproto(strcpy(buf, "IsLeader"), XS_Raid_IsLeader, file, "$$"); - newXSproto(strcpy(buf, "IsRaidMember"), XS_Raid_IsRaidMember, file, "$$"); - newXSproto(strcpy(buf, "RaidCount"), XS_Raid_RaidCount, file, "$"); - newXSproto(strcpy(buf, "SplitExp"), XS_Raid_SplitExp, file, "$$$"); - newXSproto(strcpy(buf, "SplitMoney"), XS_Raid_SplitMoney, file, "$$$$$$"); - newXSproto(strcpy(buf, "TeleportGroup"), XS_Raid_TeleportGroup, file, "$$$$$$$$"); - newXSproto(strcpy(buf, "TeleportRaid"), XS_Raid_TeleportRaid, file, "$$$$$$$"); - XSRETURN_YES; + auto package = perl.new_class("Raid"); + package.add("BalanceHP", &Perl_Raid_BalanceHP); + package.add("CastGroupSpell", &Perl_Raid_CastGroupSpell); + package.add("DoesAnyMemberHaveExpeditionLockout", (bool(*)(Raid*, std::string, std::string))&Perl_Raid_DoesAnyMemberHaveExpeditionLockout); + package.add("DoesAnyMemberHaveExpeditionLockout", (bool(*)(Raid*, std::string, std::string, int))&Perl_Raid_DoesAnyMemberHaveExpeditionLockout); + package.add("GetClientByIndex", &Perl_Raid_GetClientByIndex); + package.add("GetGroup", &Perl_Raid_GetGroup); + package.add("GetHighestLevel", &Perl_Raid_GetHighestLevel); + package.add("GetID", &Perl_Raid_GetID); + package.add("GetLowestLevel", &Perl_Raid_GetLowestLevel); + package.add("GetMember", &Perl_Raid_GetMember); + package.add("GetTotalRaidDamage", &Perl_Raid_GetTotalRaidDamage); + package.add("GroupCount", &Perl_Raid_GroupCount); + package.add("IsGroupLeader", &Perl_Raid_IsGroupLeader); + package.add("IsLeader", &Perl_Raid_IsLeader); + package.add("IsRaidMember", &Perl_Raid_IsRaidMember); + package.add("RaidCount", &Perl_Raid_RaidCount); + package.add("SplitExp", &Perl_Raid_SplitExp); + package.add("SplitMoney", &Perl_Raid_SplitMoney); + package.add("TeleportGroup", &Perl_Raid_TeleportGroup); + package.add("TeleportRaid", &Perl_Raid_TeleportRaid); } #endif //EMBPERL_XS_CLASSES diff --git a/zone/perl_spell.cpp b/zone/perl_spell.cpp index 85aa27d05..d8fd34509 100644 --- a/zone/perl_spell.cpp +++ b/zone/perl_spell.cpp @@ -3,2136 +3,668 @@ #ifdef EMBPERL_XS_CLASSES #include "../common/global_define.h" +#include "../common/spdat.h" #include "embperl.h" -#ifdef seed -#undef seed -#endif - -#include "../common/spdat.h" - -#ifdef THIS /* this macro seems to leak out on some systems */ -#undef THIS -#endif - -#define VALIDATE_THIS_IS_SPELL \ - do { \ - if (sv_derived_from(ST(0), "Spell")) { \ - IV tmp = SvIV((SV*)SvRV(ST(0))); \ - THIS = INT2PTR(SPDat_Spell_Struct*, tmp); \ - } else { \ - Perl_croak(aTHX_ "THIS is not of type SPDat_Spell_Struct"); \ - } \ - if (THIS == nullptr) { \ - Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \ - } \ - } while (0); - -XS(XS_Spell_GetActivated); -XS(XS_Spell_GetActivated) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetActivated(THIS)"); - { - SPDat_Spell_Struct* THIS; - int activated; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - activated = THIS->activated; - XSprePUSH; - PUSHi((IV) activated); - } - XSRETURN(1); -} - -XS(XS_Spell_GetAllowRest); -XS(XS_Spell_GetAllowRest) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetAllowRest(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool allow_rest; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - allow_rest = THIS->allow_rest; - ST(0) = boolSV(allow_rest); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetAOEDuration); -XS(XS_Spell_GetAOEDuration) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetAOEDuration(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 aoe_duration; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - aoe_duration = THIS->aoe_duration; - XSprePUSH; - PUSHu((UV) aoe_duration); - } - XSRETURN(1); -} - -XS(XS_Spell_GetAOEMaxTargets); -XS(XS_Spell_GetAOEMaxTargets) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetAOEMaxTargets(THIS)"); - { - SPDat_Spell_Struct* THIS; - int aoe_max_targets; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - aoe_max_targets = THIS->aoe_max_targets; - XSprePUSH; - PUSHi((IV) aoe_max_targets); - } - XSRETURN(1); -} - -XS(XS_Spell_GetAOERange); -XS(XS_Spell_GetAOERange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetAOERange(THIS)"); - { - SPDat_Spell_Struct* THIS; - float aoe_range; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - aoe_range = THIS->aoe_range; - XSprePUSH; - PUSHn((double) aoe_range); - } - XSRETURN(1); -} - -XS(XS_Spell_GetBaseDifficulty); -XS(XS_Spell_GetBaseDifficulty) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetBaseDifficulty(THIS)"); - { - SPDat_Spell_Struct* THIS; - int base_difficulty; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - base_difficulty = THIS->base_difficulty; - XSprePUSH; - PUSHi((IV) base_difficulty); - } - XSRETURN(1); -} - -XS(XS_Spell_GetBaseValue); -XS(XS_Spell_GetBaseValue) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetBaseValue(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int base_value; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - base_value = THIS->base_value[slot]; - XSprePUSH; - PUSHi((IV) base_value); - } - XSRETURN(1); -} - -XS(XS_Spell_GetBonusHate); -XS(XS_Spell_GetBonusHate) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetBonusHate(THIS)"); - { - SPDat_Spell_Struct* THIS; - int bonus_hate; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - bonus_hate = THIS->bonus_hate; - XSprePUSH; - PUSHi((IV) bonus_hate); - } - XSRETURN(1); -} - -XS(XS_Spell_GetBuffDuration); -XS(XS_Spell_GetBuffDuration) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetBuffDuration(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 buff_duration; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - buff_duration = THIS->buff_duration; - XSprePUSH; - PUSHu((UV) buff_duration); - } - XSRETURN(1); -} - -XS(XS_Spell_GetBuffDurationFormula); -XS(XS_Spell_GetBuffDurationFormula) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetBuffDurationFormula(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 buff_duration_formula; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - buff_duration_formula = THIS->buff_duration_formula; - XSprePUSH; - PUSHu((UV) buff_duration_formula); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCanCastInCombat); -XS(XS_Spell_GetCanCastInCombat) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCanCastInCombat(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool can_cast_in_combat; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - can_cast_in_combat = THIS->can_cast_in_combat; - ST(0) = boolSV(can_cast_in_combat); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCanCastOutOfCombat); -XS(XS_Spell_GetCanCastOutOfCombat) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCanCastOutOfCombat(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool can_cast_out_of_combat; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - can_cast_out_of_combat = THIS->can_cast_out_of_combat; - ST(0) = boolSV(can_cast_out_of_combat); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCanMGB); -XS(XS_Spell_GetCanMGB) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCanMGB(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool can_mgb; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - can_mgb = THIS->can_mgb; - ST(0) = boolSV(can_mgb); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastNotStanding); -XS(XS_Spell_GetCastNotStanding) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastNotStanding(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool cast_not_standing; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - cast_not_standing = THIS->cast_not_standing; - ST(0) = boolSV(cast_not_standing); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastOnOther); -XS(XS_Spell_GetCastOnOther) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastOnOther(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string cast_on_other; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - cast_on_other = THIS->cast_on_other; - sv_setpv(TARG, cast_on_other.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastOnYou); -XS(XS_Spell_GetCastOnYou) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastOnYou(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string cast_on_you; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - cast_on_you = THIS->cast_on_you; - sv_setpv(TARG, cast_on_you.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastRestriction); -XS(XS_Spell_GetCastRestriction) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastRestriction(THIS)"); - { - SPDat_Spell_Struct* THIS; - int cast_restriction; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - cast_restriction = THIS->cast_restriction; - XSprePUSH; - PUSHi((IV) cast_restriction); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastTime); -XS(XS_Spell_GetCastTime) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastTime(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 cast_time; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - cast_time = THIS->cast_time; - XSprePUSH; - PUSHu((UV) cast_time); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCasterRequirementID); -XS(XS_Spell_GetCasterRequirementID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCasterRequirementID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int caster_requirement_id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - caster_requirement_id = THIS->caster_requirement_id; - XSprePUSH; - PUSHi((IV) caster_requirement_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetCastingAnimation); -XS(XS_Spell_GetCastingAnimation) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetCastingAnimation(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint8 casting_animation; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - casting_animation = THIS->casting_animation; - XSprePUSH; - PUSHu((UV) casting_animation); - } - XSRETURN(1); -} - -XS(XS_Spell_GetClasses); -XS(XS_Spell_GetClasses) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetClasses(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - uint8 classes; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - classes = THIS->classes[slot]; - XSprePUSH; - PUSHu((UV) classes); - } - XSRETURN(1); -} - -XS(XS_Spell_GetComponent); -XS(XS_Spell_GetComponent) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetComponent(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int component; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - component = THIS->component[slot]; - XSprePUSH; - PUSHi((IV) component); - } - XSRETURN(1); -} - -XS(XS_Spell_GetComponentCount); -XS(XS_Spell_GetComponentCount) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetComponentCount(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int component_count; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - component_count = THIS->component_count[slot]; - XSprePUSH; - PUSHi((IV) component_count); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDeities); -XS(XS_Spell_GetDeities) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetDeities(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int8 deities; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - deities = THIS->deities[slot]; - XSprePUSH; - PUSHi((IV) deities); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDeityAgnostic); -XS(XS_Spell_GetDeityAgnostic) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDeityAgnostic(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 deity_agnostic; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - deity_agnostic = THIS->deity_agnostic; - XSprePUSH; - PUSHi((IV) deity_agnostic); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDescriptionID); -XS(XS_Spell_GetDescriptionID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDescriptionID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int description_id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - description_id = THIS->description_id; - XSprePUSH; - PUSHi((IV) description_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDirectionalEnd); -XS(XS_Spell_GetDirectionalEnd) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDirectionalEnd(THIS)"); - { - SPDat_Spell_Struct* THIS; - float directional_end; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - directional_end = THIS->directional_end; - XSprePUSH; - PUSHn((double) directional_end); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDirectionalStart); -XS(XS_Spell_GetDirectionalStart) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDirectionalStart(THIS)"); - { - SPDat_Spell_Struct* THIS; - float directional_start; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - directional_start = THIS->directional_start; - XSprePUSH; - PUSHn((double) directional_start); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDisallowSit); -XS(XS_Spell_GetDisallowSit) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDisallowSit(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 disallow_sit; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - disallow_sit = THIS->disallow_sit; - XSprePUSH; - PUSHi((IV) disallow_sit); - } - XSRETURN(1); -} - -XS(XS_Spell_GetDispelFlag); -XS(XS_Spell_GetDispelFlag) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetDispelFlag(THIS)"); - { - SPDat_Spell_Struct* THIS; - int dispel_flag; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - dispel_flag = THIS->dispel_flag; - XSprePUSH; - PUSHi((IV) dispel_flag); - } - XSRETURN(1); -} - -XS(XS_Spell_GetEffectDescriptionID); -XS(XS_Spell_GetEffectDescriptionID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetEffectDescriptionID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int effect_description_id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - effect_description_id = THIS->effect_description_id; - XSprePUSH; - PUSHi((IV) effect_description_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetEffectID); -XS(XS_Spell_GetEffectID) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetEffectID(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int effect_id; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - effect_id = THIS->effect_id[slot]; - XSprePUSH; - PUSHi((IV) effect_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetEnduranceCost); -XS(XS_Spell_GetEnduranceCost) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetEnduranceCost(THIS)"); - { - SPDat_Spell_Struct* THIS; - int endurance_cost; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - endurance_cost = THIS->endurance_cost; - XSprePUSH; - PUSHi((IV) endurance_cost); - } - XSRETURN(1); -} - -XS(XS_Spell_GetEnduranceUpkeep); -XS(XS_Spell_GetEnduranceUpkeep) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetEnduranceUpkeep(THIS)"); - { - SPDat_Spell_Struct* THIS; - int endurance_upkeep; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - endurance_upkeep = THIS->endurance_upkeep; - XSprePUSH; - PUSHi((IV) endurance_upkeep); - } - XSRETURN(1); -} - -XS(XS_Spell_GetEnvironmentType); -XS(XS_Spell_GetEnvironmentType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetEnvironmentType(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 environment_type; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - environment_type = THIS->environment_type; - XSprePUSH; - PUSHi((IV) environment_type); - } - XSRETURN(1); -} - -XS(XS_Spell_GetFeedbackable); -XS(XS_Spell_GetFeedbackable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetFeedbackable(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool feedbackable; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - feedbackable = THIS->feedbackable; - ST(0) = boolSV(feedbackable); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetFormula); -XS(XS_Spell_GetFormula) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetFormula(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - uint16 formula; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - formula = THIS->formula[slot]; - XSprePUSH; - PUSHu((UV) formula); - } - XSRETURN(1); -} - -XS(XS_Spell_GetGoodEffect); -XS(XS_Spell_GetGoodEffect) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetGoodEffect(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 good_effect; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - good_effect = THIS->good_effect; - XSprePUSH; - PUSHi((IV) good_effect); - } - XSRETURN(1); -} - -XS(XS_Spell_GetHateAdded); -XS(XS_Spell_GetHateAdded) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetHateAdded(THIS)"); - { - SPDat_Spell_Struct* THIS; - int hate_added; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - hate_added = THIS->hate_added; - XSprePUSH; - PUSHi((IV) hate_added); - } - XSRETURN(1); -} - -XS(XS_Spell_GetHitNumber); -XS(XS_Spell_GetHitNumber) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetHitNumber(THIS)"); - { - SPDat_Spell_Struct* THIS; - int hit_number; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - hit_number = THIS->hit_number; - XSprePUSH; - PUSHi((IV) hit_number); - } - XSRETURN(1); -} - -XS(XS_Spell_GetHitNumberType); -XS(XS_Spell_GetHitNumberType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetHitNumberType(THIS)"); - { - SPDat_Spell_Struct* THIS; - int hit_number_type; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - hit_number_type = THIS->hit_number_type; - XSprePUSH; - PUSHi((IV) hit_number_type); - } - XSRETURN(1); -} - -XS(XS_Spell_GetID); -XS(XS_Spell_GetID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - id = THIS->id; - XSprePUSH; - PUSHi((IV) id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetIsDiscipline); -XS(XS_Spell_GetIsDiscipline) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetIsDiscipline(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool is_discipline; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - is_discipline = THIS->is_discipline; - ST(0) = boolSV(is_discipline); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetLDoNTrap); -XS(XS_Spell_GetLDoNTrap) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetLDoNTrap(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool ldon_trap; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - ldon_trap = THIS->ldon_trap; - ST(0) = boolSV(ldon_trap); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetLimitValue); -XS(XS_Spell_GetLimitValue) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetLimitValue(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int limit_value; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - limit_value = THIS->limit_value[slot]; - XSprePUSH; - PUSHi((IV) limit_value); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMana); -XS(XS_Spell_GetMana) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMana(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint16 mana; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - mana = THIS->mana; - XSprePUSH; - PUSHu((UV) mana); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMaxDistance); -XS(XS_Spell_GetMaxDistance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMaxDistance(THIS)"); - { - SPDat_Spell_Struct* THIS; - float max_distance; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - max_distance = THIS->max_distance; - XSprePUSH; - PUSHn((double) max_distance); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMaxDistanceMod); -XS(XS_Spell_GetMaxDistanceMod) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMaxDistanceMod(THIS)"); - { - SPDat_Spell_Struct* THIS; - float max_distance_mod; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - max_distance_mod = THIS->max_distance_mod; - XSprePUSH; - PUSHn((double) max_distance_mod); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMaxResist); -XS(XS_Spell_GetMaxResist) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMaxResist(THIS)"); - { - SPDat_Spell_Struct* THIS; - int max_resist; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - max_resist = THIS->max_resist; - XSprePUSH; - PUSHi((IV) max_resist); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMaxValue); -XS(XS_Spell_GetMaxValue) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetMaxValue(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int max_value; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - max_value = THIS->max_value[slot]; - XSprePUSH; - PUSHi((IV) max_value); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMinDistance); -XS(XS_Spell_GetMinDistance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMinDistance(THIS)"); - { - SPDat_Spell_Struct* THIS; - float min_distance; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - min_distance = THIS->min_distance; - XSprePUSH; - PUSHn((double) min_distance); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMinDistanceMod); -XS(XS_Spell_GetMinDistanceMod) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMinDistanceMod(THIS)"); - { - SPDat_Spell_Struct* THIS; - float min_distance_mod; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - min_distance_mod = THIS->min_distance_mod; - XSprePUSH; - PUSHn((double) min_distance_mod); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMinRange); -XS(XS_Spell_GetMinRange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMinRange(THIS)"); - { - SPDat_Spell_Struct* THIS; - float min_range; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - min_range = THIS->min_range; - XSprePUSH; - PUSHn((double) min_range); - } - XSRETURN(1); -} - -XS(XS_Spell_GetMinResist); -XS(XS_Spell_GetMinResist) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetMinResist(THIS)"); - { - SPDat_Spell_Struct* THIS; - int min_resist; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - min_resist = THIS->min_resist; - XSprePUSH; - PUSHi((IV) min_resist); - } - XSRETURN(1); -} - -XS(XS_Spell_GetName); -XS(XS_Spell_GetName) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetName(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string name; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - name = THIS->name; - sv_setpv(TARG, name.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetNewIcon); -XS(XS_Spell_GetNewIcon) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNewIcon(THIS)"); - { - SPDat_Spell_Struct* THIS; - int16 new_icon; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - new_icon = THIS->new_icon; - XSprePUSH; - PUSHi((IV) new_icon); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNimbusEffect); -XS(XS_Spell_GetNimbusEffect) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNimbusEffect(THIS)"); - { - SPDat_Spell_Struct* THIS; - int nimbus_effect; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - nimbus_effect = THIS->nimbus_effect; - XSprePUSH; - PUSHi((IV) nimbus_effect); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoBlock); -XS(XS_Spell_GetNoBlock) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoBlock(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool no_block; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_block = THIS->no_block; - ST(0) = boolSV(no_block); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoDetrimentalSpellAggro); -XS(XS_Spell_GetNoDetrimentalSpellAggro) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoDetrimentalSpellAggro(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool no_detrimental_spell_aggro; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_detrimental_spell_aggro = THIS->no_detrimental_spell_aggro; - ST(0) = boolSV(no_detrimental_spell_aggro); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoExpendReagent); -XS(XS_Spell_GetNoExpendReagent) { - dXSARGS; - if (items != 2) - Perl_croak(aTHX_ "Usage: Spell::GetNoExpendReagent(THIS, uint8 slot)"); - { - SPDat_Spell_Struct* THIS; - int no_expend_reagent; - uint8 slot = (uint8) SvUV(ST(1)); - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_expend_reagent = THIS->no_expend_reagent[slot]; - XSprePUSH; - PUSHi((IV) no_expend_reagent); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoHealDamageItemMod); -XS(XS_Spell_GetNoHealDamageItemMod) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoHealDamageItemMod(THIS)"); - { - SPDat_Spell_Struct* THIS; - int no_heal_damage_item_mod; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_heal_damage_item_mod = THIS->no_heal_damage_item_mod; - XSprePUSH; - PUSHi((IV) no_heal_damage_item_mod); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoPartialResist); -XS(XS_Spell_GetNoPartialResist) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoPartialResist(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool no_partial_resist; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_partial_resist = THIS->no_partial_resist; - ST(0) = boolSV(no_partial_resist); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoRemove); -XS(XS_Spell_GetNoRemove) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoRemove(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool no_remove; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_remove = THIS->no_remove; - ST(0) = boolSV(no_remove); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNoResist); -XS(XS_Spell_GetNoResist) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNoResist(THIS)"); - { - SPDat_Spell_Struct* THIS; - int no_resist; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - no_resist = THIS->no_resist; - XSprePUSH; - PUSHi((IV) no_resist); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNotFocusable); -XS(XS_Spell_GetNotFocusable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNotFocusable(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool not_focusable; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - not_focusable = THIS->not_focusable; - ST(0) = boolSV(not_focusable); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetNPCNoLOS); -XS(XS_Spell_GetNPCNoLOS) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetNPCNoLOS(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool npc_no_los; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - npc_no_los = THIS->npc_no_los; - ST(0) = boolSV(npc_no_los); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetOtherCasts); -XS(XS_Spell_GetOtherCasts) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetOtherCasts(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string other_casts; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - other_casts = THIS->other_casts; - sv_setpv(TARG, other_casts.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetOverrideCritChance); -XS(XS_Spell_GetOverrideCritChance) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetOverrideCritChance(THIS)"); - { - SPDat_Spell_Struct* THIS; - int override_crit_chance; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - override_crit_chance = THIS->override_crit_chance; - XSprePUSH; - PUSHi((IV) override_crit_chance); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPCNPCOnlyFlag); -XS(XS_Spell_GetPCNPCOnlyFlag) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPCNPCOnlyFlag(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pcnpc_only_flag; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pcnpc_only_flag = THIS->pcnpc_only_flag; - XSprePUSH; - PUSHi((IV) pcnpc_only_flag); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPersistDeath); -XS(XS_Spell_GetPersistDeath) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPersistDeath(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool persist_death; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - persist_death = THIS->persist_death; - ST(0) = boolSV(persist_death); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPlayer_1); -XS(XS_Spell_GetPlayer_1) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPlayer_1(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string player_1; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - player_1 = THIS->player_1; - sv_setpv(TARG, player_1.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetPushBack); -XS(XS_Spell_GetPushBack) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPushBack(THIS)"); - { - SPDat_Spell_Struct* THIS; - float push_back; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - push_back = THIS->push_back; - XSprePUSH; - PUSHn((double) push_back); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPushUp); -XS(XS_Spell_GetPushUp) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPushUp(THIS)"); - { - SPDat_Spell_Struct* THIS; - float push_up; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - push_up = THIS->push_up; - XSprePUSH; - PUSHn((double) push_up); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPVPDuration); -XS(XS_Spell_GetPVPDuration) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPVPDuration(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pvp_duration; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pvp_duration = THIS->pvp_duration; - XSprePUSH; - PUSHi((IV) pvp_duration); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPVPDurationCap); -XS(XS_Spell_GetPVPDurationCap) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPVPDurationCap(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pvp_duration_cap; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pvp_duration_cap = THIS->pvp_duration_cap; - XSprePUSH; - PUSHi((IV) pvp_duration_cap); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPVPResistBase); -XS(XS_Spell_GetPVPResistBase) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPVPResistBase(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pvp_resist_base; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pvp_resist_base = THIS->pvp_resist_base; - XSprePUSH; - PUSHi((IV) pvp_resist_base); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPVPResistCap); -XS(XS_Spell_GetPVPResistCap) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPVPResistCap(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pvp_resist_cap; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pvp_resist_cap = THIS->pvp_resist_cap; - XSprePUSH; - PUSHi((IV) pvp_resist_cap); - } - XSRETURN(1); -} - -XS(XS_Spell_GetPVPResistPerLevel); -XS(XS_Spell_GetPVPResistPerLevel) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetPVPResistPerLevel(THIS)"); - { - SPDat_Spell_Struct* THIS; - int pvp_resist_per_level; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - pvp_resist_per_level = THIS->pvp_resist_per_level; - XSprePUSH; - PUSHi((IV) pvp_resist_per_level); - } - XSRETURN(1); -} - -XS(XS_Spell_GetRange); -XS(XS_Spell_GetRange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetRange(THIS)"); - { - SPDat_Spell_Struct* THIS; - float range; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - range = THIS->range; - XSprePUSH; - PUSHn((double) range); - } - XSRETURN(1); -} - -XS(XS_Spell_GetRank); -XS(XS_Spell_GetRank) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetRank(THIS)"); - { - SPDat_Spell_Struct* THIS; - int rank; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - rank = THIS->rank; - XSprePUSH; - PUSHi((IV) rank); - } - XSRETURN(1); -} - -XS(XS_Spell_GetRecastTime); -XS(XS_Spell_GetRecastTime) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetRecastTime(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 recast_time; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - recast_time = THIS->recast_time; - XSprePUSH; - PUSHu((UV) recast_time); - } - XSRETURN(1); -} - -XS(XS_Spell_GetRecourseLink); -XS(XS_Spell_GetRecourseLink) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetRecourseLink(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint16 recourse_link; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - recourse_link = THIS->recourse_link; - XSprePUSH; - PUSHu((UV) recourse_link); - } - XSRETURN(1); -} - -XS(XS_Spell_GetRecoveryTime); -XS(XS_Spell_GetRecoveryTime) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetRecoveryTime(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint32 recovery_time; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - recovery_time = THIS->recovery_time; - XSprePUSH; - PUSHu((UV) recovery_time); - } - XSRETURN(1); -} - -XS(XS_Spell_GetReflectable); -XS(XS_Spell_GetReflectable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetReflectable(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool reflectable; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - reflectable = THIS->reflectable; - ST(0) = boolSV(reflectable); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetResistDifficulty); -XS(XS_Spell_GetResistDifficulty) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetResistDifficulty(THIS)"); - { - SPDat_Spell_Struct* THIS; - int16 resist_difficulty; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - resist_difficulty = THIS->resist_difficulty; - XSprePUSH; - PUSHi((IV) resist_difficulty); - } - XSRETURN(1); -} - -XS(XS_Spell_GetResistType); -XS(XS_Spell_GetResistType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetResistType(THIS)"); - { - SPDat_Spell_Struct* THIS; - int resist_type; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - resist_type = THIS->resist_type; - XSprePUSH; - PUSHi((IV) resist_type); - } - XSRETURN(1); -} - -XS(XS_Spell_GetShortBuffBox); -XS(XS_Spell_GetShortBuffBox) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetShortBuffBox(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 short_buff_box; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - short_buff_box = THIS->short_buff_box; - XSprePUSH; - PUSHi((IV) short_buff_box); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSkill); -XS(XS_Spell_GetSkill) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSkill(THIS)"); - { - SPDat_Spell_Struct* THIS; - EQ::skills::SkillType skill; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - skill = THIS->skill; - XSprePUSH; - PUSHi((IV) skill); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSneak); -XS(XS_Spell_GetSneak) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSneak(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool sneak; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - sneak = THIS->sneak; - ST(0) = boolSV(sneak); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSongCap); -XS(XS_Spell_GetSongCap) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSongCap(THIS)"); - { - SPDat_Spell_Struct* THIS; - int song_cap; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - song_cap = THIS->song_cap; - XSprePUSH; - PUSHi((IV) song_cap); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellAffectIndex); -XS(XS_Spell_GetSpellAffectIndex) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellAffectIndex(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint16 spell_affect_index; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_affect_index = THIS->spell_affect_index; - XSprePUSH; - PUSHu((UV) spell_affect_index); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellCategory); -XS(XS_Spell_GetSpellCategory) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellCategory(THIS)"); - { - SPDat_Spell_Struct* THIS; - int spell_category; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_category = THIS->spell_category; - XSprePUSH; - PUSHi((IV) spell_category); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellClass); -XS(XS_Spell_GetSpellClass) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellClass(THIS)"); - { - SPDat_Spell_Struct* THIS; - int spell_class; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_class = THIS->spell_class; - XSprePUSH; - PUSHi((IV) spell_class); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellFades); -XS(XS_Spell_GetSpellFades) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellFades(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string spell_fades; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_fades = THIS->spell_fades; - sv_setpv(TARG, spell_fades.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellGroup); -XS(XS_Spell_GetSpellGroup) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellGroup(THIS)"); - { - SPDat_Spell_Struct* THIS; - int spell_group; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_group = THIS->spell_group; - XSprePUSH; - PUSHi((IV) spell_group); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSpellSubclass); -XS(XS_Spell_GetSpellSubclass) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSpellSubclass(THIS)"); - { - SPDat_Spell_Struct* THIS; - int spell_subclass; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - spell_subclass = THIS->spell_subclass; - XSprePUSH; - PUSHi((IV) spell_subclass); - } - XSRETURN(1); -} - -XS(XS_Spell_GetSuspendable); -XS(XS_Spell_GetSuspendable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetSuspendable(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool suspendable; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - suspendable = THIS->suspendable; - ST(0) = boolSV(suspendable); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetTargetType); -XS(XS_Spell_GetTargetType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetTargetType(THIS)"); - { - SPDat_Spell_Struct* THIS; - SpellTargetType target_type; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - target_type = THIS->target_type; - XSprePUSH; - PUSHi((IV) target_type); - } - XSRETURN(1); -} - -XS(XS_Spell_GetTeleportZone); -XS(XS_Spell_GetTeleportZone) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetTeleportZone(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string teleport_zone; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - teleport_zone = THIS->teleport_zone; - sv_setpv(TARG, teleport_zone.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetTimeOfDay); -XS(XS_Spell_GetTimeOfDay) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetTimeOfDay(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 time_of_day; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - time_of_day = THIS->time_of_day; - XSprePUSH; - PUSHi((IV) time_of_day); - } - XSRETURN(1); -} - -XS(XS_Spell_GetTimerID); -XS(XS_Spell_GetTimerID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetTimerID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 timer_id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - timer_id = THIS->timer_id; - XSprePUSH; - PUSHi((IV) timer_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetTypeDescriptionID); -XS(XS_Spell_GetTypeDescriptionID) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetTypeDescriptionID(THIS)"); - { - SPDat_Spell_Struct* THIS; - int type_description_id; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - type_description_id = THIS->type_description_id; - XSprePUSH; - PUSHi((IV) type_description_id); - } - XSRETURN(1); -} - -XS(XS_Spell_GetUninterruptable); -XS(XS_Spell_GetUninterruptable) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetUninterruptable(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool uninterruptable; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - uninterruptable = THIS->uninterruptable; - ST(0) = boolSV(uninterruptable); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetUnstackableDOT); -XS(XS_Spell_GetUnstackableDOT) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetUnstackableDOT(THIS)"); - { - SPDat_Spell_Struct* THIS; - bool unstackable_dot; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - unstackable_dot = THIS->unstackable_dot; - ST(0) = boolSV(unstackable_dot); - sv_2mortal(ST(0)); - } - XSRETURN(1); -} - -XS(XS_Spell_GetViralRange); -XS(XS_Spell_GetViralRange) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetViralRange(THIS)"); - { - SPDat_Spell_Struct* THIS; - int viral_range; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - viral_range = THIS->viral_range; - XSprePUSH; - PUSHi((IV) viral_range); - } - XSRETURN(1); -} - -XS(XS_Spell_GetViralTargets); -XS(XS_Spell_GetViralTargets) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetViralTargets(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint8 viral_targets; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - viral_targets = THIS->viral_targets; - XSprePUSH; - PUSHu((UV) viral_targets); - } - XSRETURN(1); -} - -XS(XS_Spell_GetViralTimer); -XS(XS_Spell_GetViralTimer) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetViralTimer(THIS)"); - { - SPDat_Spell_Struct* THIS; - uint8 viral_timer; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - viral_timer = THIS->viral_timer; - XSprePUSH; - PUSHu((UV) viral_timer); - } - XSRETURN(1); -} - -XS(XS_Spell_GetYouCast); -XS(XS_Spell_GetYouCast) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetYouCast(THIS)"); - { - SPDat_Spell_Struct* THIS; - std::string you_cast; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - you_cast = THIS->you_cast; - sv_setpv(TARG, you_cast.c_str()); - XSprePUSH; - PUSHTARG; - } - XSRETURN(1); -} - -XS(XS_Spell_GetZoneType); -XS(XS_Spell_GetZoneType) { - dXSARGS; - if (items != 1) - Perl_croak(aTHX_ "Usage: Spell::GetZoneType(THIS)"); - { - SPDat_Spell_Struct* THIS; - int8 zone_type; - dXSTARG; - VALIDATE_THIS_IS_SPELL; - - zone_type = THIS->zone_type; - XSprePUSH; - PUSHi((IV) zone_type); - } - XSRETURN(1); -} - -#ifdef __cplusplus -extern "C" -#endif - -XS(boot_Spell); -XS(boot_Spell) { - dXSARGS; - char file[256]; - strncpy(file, __FILE__, 256); - file[255] = 0; - if (items != 1) - fprintf(stderr, "boot_Spell does not take any arguments."); - - char buf[128]; - XS_VERSION_BOOTCHECK; - newXSproto(strcpy(buf, "GetActivated"), XS_Spell_GetActivated, file, "$"); - newXSproto(strcpy(buf, "GetAllowRest"), XS_Spell_GetAllowRest, file, "$"); - newXSproto(strcpy(buf, "GetAOEDuration"), XS_Spell_GetAOEDuration, file, "$"); - newXSproto(strcpy(buf, "GetAOEMaxTargets"), XS_Spell_GetAOEMaxTargets, file, "$"); - newXSproto(strcpy(buf, "GetAOERange"), XS_Spell_GetAOERange, file, "$"); - newXSproto(strcpy(buf, "GetBaseDifficulty"), XS_Spell_GetBaseDifficulty, file, "$"); - newXSproto(strcpy(buf, "GetBaseValue"), XS_Spell_GetBaseValue, file, "$$"); - newXSproto(strcpy(buf, "GetBonusHate"), XS_Spell_GetBonusHate, file, "$"); - newXSproto(strcpy(buf, "GetBuffDuration"), XS_Spell_GetBuffDuration, file, "$"); - newXSproto(strcpy(buf, "GetBuffDurationFormula"), XS_Spell_GetBuffDurationFormula, file, "$"); - newXSproto(strcpy(buf, "GetCanCastInCombat"), XS_Spell_GetCanCastInCombat, file, "$"); - newXSproto(strcpy(buf, "GetCanCastOutOfCombat"), XS_Spell_GetCanCastOutOfCombat, file, "$"); - newXSproto(strcpy(buf, "GetCanMGB"), XS_Spell_GetCanMGB, file, "$"); - newXSproto(strcpy(buf, "GetCastNotStanding"), XS_Spell_GetCastNotStanding, file, "$"); - newXSproto(strcpy(buf, "GetCastOnOther"), XS_Spell_GetCastOnOther, file, "$"); - newXSproto(strcpy(buf, "GetCastOnYou"), XS_Spell_GetCastOnYou, file, "$"); - newXSproto(strcpy(buf, "GetCastRestriction"), XS_Spell_GetCastRestriction, file, "$"); - newXSproto(strcpy(buf, "GetCastTime"), XS_Spell_GetCastTime, file, "$"); - newXSproto(strcpy(buf, "GetCasterRequirementID"), XS_Spell_GetCasterRequirementID, file, "$"); - newXSproto(strcpy(buf, "GetCastingAnimation"), XS_Spell_GetCastingAnimation, file, "$"); - newXSproto(strcpy(buf, "GetClasses"), XS_Spell_GetClasses, file, "$$"); - newXSproto(strcpy(buf, "GetComponent"), XS_Spell_GetComponent, file, "$$"); - newXSproto(strcpy(buf, "GetComponentCount"), XS_Spell_GetComponentCount, file, "$$"); - newXSproto(strcpy(buf, "GetDeities"), XS_Spell_GetDeities, file, "$$"); - newXSproto(strcpy(buf, "GetDeityAgnostic"), XS_Spell_GetDeityAgnostic, file, "$"); - newXSproto(strcpy(buf, "GetDescriptionID"), XS_Spell_GetDescriptionID, file, "$"); - newXSproto(strcpy(buf, "GetDirectionalEnd"), XS_Spell_GetDirectionalEnd, file, "$"); - newXSproto(strcpy(buf, "GetDirectionalStart"), XS_Spell_GetDirectionalStart, file, "$"); - newXSproto(strcpy(buf, "GetDisallowSit"), XS_Spell_GetDisallowSit, file, "$"); - newXSproto(strcpy(buf, "GetDispelFlag"), XS_Spell_GetDispelFlag, file, "$"); - newXSproto(strcpy(buf, "GetEffectDescriptionID"), XS_Spell_GetEffectDescriptionID, file, "$"); - newXSproto(strcpy(buf, "GetEffectID"), XS_Spell_GetEffectID, file, "$$"); - newXSproto(strcpy(buf, "GetEnduranceCost"), XS_Spell_GetEnduranceCost, file, "$"); - newXSproto(strcpy(buf, "GetEnduranceUpkeep"), XS_Spell_GetEnduranceUpkeep, file, "$"); - newXSproto(strcpy(buf, "GetEnvironmentType"), XS_Spell_GetEnvironmentType, file, "$"); - newXSproto(strcpy(buf, "GetFeedbackable"), XS_Spell_GetFeedbackable, file, "$"); - newXSproto(strcpy(buf, "GetFormula"), XS_Spell_GetFormula, file, "$$"); - newXSproto(strcpy(buf, "GetGoodEffect"), XS_Spell_GetGoodEffect, file, "$"); - newXSproto(strcpy(buf, "GetHateAdded"), XS_Spell_GetHateAdded, file, "$"); - newXSproto(strcpy(buf, "GetHitNumber"), XS_Spell_GetHitNumber, file, "$"); - newXSproto(strcpy(buf, "GetHitNumberType"), XS_Spell_GetHitNumberType, file, "$"); - newXSproto(strcpy(buf, "GetID"), XS_Spell_GetID, file, "$"); - newXSproto(strcpy(buf, "GetIsDiscipline"), XS_Spell_GetIsDiscipline, file, "$"); - newXSproto(strcpy(buf, "GetLDoNTrap"), XS_Spell_GetLDoNTrap, file, "$"); - newXSproto(strcpy(buf, "GetLimitValue"), XS_Spell_GetLimitValue, file, "$$"); - newXSproto(strcpy(buf, "GetMana"), XS_Spell_GetMana, file, "$"); - newXSproto(strcpy(buf, "GetMaxDistance"), XS_Spell_GetMaxDistance, file, "$"); - newXSproto(strcpy(buf, "GetMaxDistanceMod"), XS_Spell_GetMaxDistanceMod, file, "$"); - newXSproto(strcpy(buf, "GetMaxResist"), XS_Spell_GetMaxResist, file, "$"); - newXSproto(strcpy(buf, "GetMaxValue"), XS_Spell_GetMaxValue, file, "$$"); - newXSproto(strcpy(buf, "GetMinDistance"), XS_Spell_GetMinDistance, file, "$"); - newXSproto(strcpy(buf, "GetMinDistanceMod"), XS_Spell_GetMinDistanceMod, file, "$"); - newXSproto(strcpy(buf, "GetMinRange"), XS_Spell_GetMinRange, file, "$"); - newXSproto(strcpy(buf, "GetMinResist"), XS_Spell_GetMinResist, file, "$"); - newXSproto(strcpy(buf, "GetName"), XS_Spell_GetName, file, "$"); - newXSproto(strcpy(buf, "GetNewIcon"), XS_Spell_GetNewIcon, file, "$"); - newXSproto(strcpy(buf, "GetNimbusEffect"), XS_Spell_GetNimbusEffect, file, "$"); - newXSproto(strcpy(buf, "GetNoBlock"), XS_Spell_GetNoBlock, file, "$"); - newXSproto(strcpy(buf, "GetNoDetrimentalSpellAggro"), XS_Spell_GetNoDetrimentalSpellAggro, file, "$"); - newXSproto(strcpy(buf, "GetNoExpendReagent"), XS_Spell_GetNoExpendReagent, file, "$$"); - newXSproto(strcpy(buf, "GetNoHealDamageItemMod"), XS_Spell_GetNoHealDamageItemMod, file, "$"); - newXSproto(strcpy(buf, "GetNoPartialResist"), XS_Spell_GetNoPartialResist, file, "$"); - newXSproto(strcpy(buf, "GetNoRemove"), XS_Spell_GetNoRemove, file, "$"); - newXSproto(strcpy(buf, "GetNoResist"), XS_Spell_GetNoResist, file, "$"); - newXSproto(strcpy(buf, "GetNotFocusable"), XS_Spell_GetNotFocusable, file, "$"); - newXSproto(strcpy(buf, "GetNPCNoLOS"), XS_Spell_GetNPCNoLOS, file, "$"); - newXSproto(strcpy(buf, "GetOtherCasts"), XS_Spell_GetOtherCasts, file, "$"); - newXSproto(strcpy(buf, "GetOverrideCritChance"), XS_Spell_GetOverrideCritChance, file, "$"); - newXSproto(strcpy(buf, "GetPCNPCOnlyFlag"), XS_Spell_GetPCNPCOnlyFlag, file, "$"); - newXSproto(strcpy(buf, "GetPersistDeath"), XS_Spell_GetPersistDeath, file, "$"); - newXSproto(strcpy(buf, "GetPlayer_1"), XS_Spell_GetPlayer_1, file, "$"); - newXSproto(strcpy(buf, "GetPushBack"), XS_Spell_GetPushBack, file, "$"); - newXSproto(strcpy(buf, "GetPushUp"), XS_Spell_GetPushUp, file, "$"); - newXSproto(strcpy(buf, "GetPVPDuration"), XS_Spell_GetPVPDuration, file, "$"); - newXSproto(strcpy(buf, "GetPVPDurationCap"), XS_Spell_GetPVPDurationCap, file, "$"); - newXSproto(strcpy(buf, "GetPVPResistBase"), XS_Spell_GetPVPResistBase, file, "$"); - newXSproto(strcpy(buf, "GetPVPResistCap"), XS_Spell_GetPVPResistCap, file, "$"); - newXSproto(strcpy(buf, "GetPVPResistPerLevel"), XS_Spell_GetPVPResistPerLevel, file, "$"); - newXSproto(strcpy(buf, "GetRange"), XS_Spell_GetRange, file, "$"); - newXSproto(strcpy(buf, "GetRank"), XS_Spell_GetRank, file, "$"); - newXSproto(strcpy(buf, "GetRecastTime"), XS_Spell_GetRecastTime, file, "$"); - newXSproto(strcpy(buf, "GetRecourseLink"), XS_Spell_GetRecourseLink, file, "$"); - newXSproto(strcpy(buf, "GetRecoveryTime"), XS_Spell_GetRecoveryTime, file, "$"); - newXSproto(strcpy(buf, "GetReflectable"), XS_Spell_GetReflectable, file, "$"); - newXSproto(strcpy(buf, "GetResistDifficulty"), XS_Spell_GetResistDifficulty, file, "$"); - newXSproto(strcpy(buf, "GetResistType"), XS_Spell_GetResistType, file, "$"); - newXSproto(strcpy(buf, "GetShortBuffBox"), XS_Spell_GetShortBuffBox, file, "$"); - newXSproto(strcpy(buf, "GetSkill"), XS_Spell_GetSkill, file, "$"); - newXSproto(strcpy(buf, "GetSneak"), XS_Spell_GetSneak, file, "$"); - newXSproto(strcpy(buf, "GetSongCap"), XS_Spell_GetSongCap, file, "$"); - newXSproto(strcpy(buf, "GetSpellAffectIndex"), XS_Spell_GetSpellAffectIndex, file, "$"); - newXSproto(strcpy(buf, "GetSpellCategory"), XS_Spell_GetSpellCategory, file, "$"); - newXSproto(strcpy(buf, "GetSpellClass"), XS_Spell_GetSpellClass, file, "$"); - newXSproto(strcpy(buf, "GetSpellFades"), XS_Spell_GetSpellFades, file, "$"); - newXSproto(strcpy(buf, "GetSpellGroup"), XS_Spell_GetSpellGroup, file, "$"); - newXSproto(strcpy(buf, "GetSpellSubclass"), XS_Spell_GetSpellSubclass, file, "$"); - newXSproto(strcpy(buf, "GetSuspendable"), XS_Spell_GetSuspendable, file, "$"); - newXSproto(strcpy(buf, "GetTargetType"), XS_Spell_GetTargetType, file, "$"); - newXSproto(strcpy(buf, "GetTeleportZone"), XS_Spell_GetTeleportZone, file, "$"); - newXSproto(strcpy(buf, "GetTimeOfDay"), XS_Spell_GetTimeOfDay, file, "$"); - newXSproto(strcpy(buf, "GetTimerID"), XS_Spell_GetTimerID, file, "$"); - newXSproto(strcpy(buf, "GetTypeDescriptionID"), XS_Spell_GetTypeDescriptionID, file, "$"); - newXSproto(strcpy(buf, "GetUninterruptable"), XS_Spell_GetUninterruptable, file, "$"); - newXSproto(strcpy(buf, "GetUnstackableDOT"), XS_Spell_GetUnstackableDOT, file, "$"); - newXSproto(strcpy(buf, "GetViralRange"), XS_Spell_GetViralRange, file, "$"); - newXSproto(strcpy(buf, "GetViralTargets"), XS_Spell_GetViralTargets, file, "$"); - newXSproto(strcpy(buf, "GetViralTimer"), XS_Spell_GetViralTimer, file, "$"); - newXSproto(strcpy(buf, "GetYouCast"), XS_Spell_GetYouCast, file, "$"); - newXSproto(strcpy(buf, "GetZoneType"), XS_Spell_GetZoneType, file, "$"); - XSRETURN_YES; +int Perl_Spell_GetActivated(SPDat_Spell_Struct* self) +{ + return self->activated; +} + +bool Perl_Spell_GetAllowRest(SPDat_Spell_Struct* self) +{ + return self->allow_rest; +} + +uint32_t Perl_Spell_GetAOEDuration(SPDat_Spell_Struct* self) +{ + return self->aoe_duration; +} + +int Perl_Spell_GetAOEMaxTargets(SPDat_Spell_Struct* self) +{ + return self->aoe_max_targets; +} + +float Perl_Spell_GetAOERange(SPDat_Spell_Struct* self) +{ + return self->aoe_range; +} + +int Perl_Spell_GetBaseDifficulty(SPDat_Spell_Struct* self) +{ + return self->base_difficulty; +} + +int Perl_Spell_GetBaseValue(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->base_value[slot]; +} + +int Perl_Spell_GetBonusHate(SPDat_Spell_Struct* self) +{ + return self->bonus_hate; +} + +uint32_t Perl_Spell_GetBuffDuration(SPDat_Spell_Struct* self) +{ + return self->buff_duration; +} + +uint32_t Perl_Spell_GetBuffDurationFormula(SPDat_Spell_Struct* self) +{ + return self->buff_duration_formula; +} + +bool Perl_Spell_GetCanCastInCombat(SPDat_Spell_Struct* self) +{ + return self->can_cast_in_combat; +} + +bool Perl_Spell_GetCanCastOutOfCombat(SPDat_Spell_Struct* self) +{ + return self->can_cast_out_of_combat; +} + +bool Perl_Spell_GetCanMGB(SPDat_Spell_Struct* self) +{ + return self->can_mgb; +} + +bool Perl_Spell_GetCastNotStanding(SPDat_Spell_Struct* self) +{ + return self->cast_not_standing; +} + +std::string Perl_Spell_GetCastOnOther(SPDat_Spell_Struct* self) +{ + return self->cast_on_other; +} + +std::string Perl_Spell_GetCastOnYou(SPDat_Spell_Struct* self) +{ + return self->cast_on_you; +} + +int Perl_Spell_GetCastRestriction(SPDat_Spell_Struct* self) +{ + return self->cast_restriction; +} + +uint32_t Perl_Spell_GetCastTime(SPDat_Spell_Struct* self) +{ + return self->cast_time; +} + +int Perl_Spell_GetCasterRequirementID(SPDat_Spell_Struct* self) +{ + return self->caster_requirement_id; +} + +int Perl_Spell_GetCastingAnimation(SPDat_Spell_Struct* self) +{ + return self->casting_animation; +} + +int Perl_Spell_GetClasses(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->classes[slot]; +} + +int Perl_Spell_GetComponent(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->component[slot]; +} + +int Perl_Spell_GetComponentCount(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->component_count[slot]; +} + +int Perl_Spell_GetDeities(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->deities[slot]; +} + +int Perl_Spell_GetDeityAgnostic(SPDat_Spell_Struct* self) +{ + return self->deity_agnostic; +} + +int Perl_Spell_GetDescriptionID(SPDat_Spell_Struct* self) +{ + return self->description_id; +} + +float Perl_Spell_GetDirectionalEnd(SPDat_Spell_Struct* self) +{ + return self->directional_end; +} + +float Perl_Spell_GetDirectionalStart(SPDat_Spell_Struct* self) +{ + return self->directional_start; +} + +int Perl_Spell_GetDisallowSit(SPDat_Spell_Struct* self) +{ + return self->disallow_sit; +} + +int Perl_Spell_GetDispelFlag(SPDat_Spell_Struct* self) +{ + return self->dispel_flag; +} + +int Perl_Spell_GetEffectDescriptionID(SPDat_Spell_Struct* self) +{ + return self->effect_description_id; +} + +int Perl_Spell_GetEffectID(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->effect_id[slot]; +} + +int Perl_Spell_GetEnduranceCost(SPDat_Spell_Struct* self) +{ + return self->endurance_cost; +} + +int Perl_Spell_GetEnduranceUpkeep(SPDat_Spell_Struct* self) +{ + return self->endurance_upkeep; +} + +int Perl_Spell_GetEnvironmentType(SPDat_Spell_Struct* self) +{ + return self->environment_type; +} + +bool Perl_Spell_GetFeedbackable(SPDat_Spell_Struct* self) +{ + return self->feedbackable; +} + +int Perl_Spell_GetFormula(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->formula[slot]; +} + +int Perl_Spell_GetGoodEffect(SPDat_Spell_Struct* self) +{ + return self->good_effect; +} + +int Perl_Spell_GetHateAdded(SPDat_Spell_Struct* self) +{ + return self->hate_added; +} + +int Perl_Spell_GetHitNumber(SPDat_Spell_Struct* self) +{ + return self->hit_number; +} + +int Perl_Spell_GetHitNumberType(SPDat_Spell_Struct* self) +{ + return self->hit_number_type; +} + +int Perl_Spell_GetID(SPDat_Spell_Struct* self) +{ + return self->id; +} + +bool Perl_Spell_GetIsDiscipline(SPDat_Spell_Struct* self) +{ + return self->is_discipline; +} + +bool Perl_Spell_GetLDoNTrap(SPDat_Spell_Struct* self) +{ + return self->ldon_trap; +} + +int Perl_Spell_GetLimitValue(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->limit_value[slot]; +} + +int Perl_Spell_GetMana(SPDat_Spell_Struct* self) +{ + return self->mana; +} + +float Perl_Spell_GetMaxDistance(SPDat_Spell_Struct* self) +{ + return self->max_distance; +} + +float Perl_Spell_GetMaxDistanceMod(SPDat_Spell_Struct* self) +{ + return self->max_distance_mod; +} + +int Perl_Spell_GetMaxResist(SPDat_Spell_Struct* self) +{ + return self->max_resist; +} + +int Perl_Spell_GetMaxValue(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->max_value[slot]; +} + +float Perl_Spell_GetMinDistance(SPDat_Spell_Struct* self) +{ + return self->min_distance; +} + +float Perl_Spell_GetMinDistanceMod(SPDat_Spell_Struct* self) +{ + return self->min_distance_mod; +} + +float Perl_Spell_GetMinRange(SPDat_Spell_Struct* self) +{ + return self->min_range; +} + +int Perl_Spell_GetMinResist(SPDat_Spell_Struct* self) +{ + return self->min_resist; +} + +std::string Perl_Spell_GetName(SPDat_Spell_Struct* self) +{ + return self->name; +} + +int Perl_Spell_GetNewIcon(SPDat_Spell_Struct* self) +{ + return self->new_icon; +} + +int Perl_Spell_GetNimbusEffect(SPDat_Spell_Struct* self) +{ + return self->nimbus_effect; +} + +bool Perl_Spell_GetNoBlock(SPDat_Spell_Struct* self) +{ + return self->no_block; +} + +bool Perl_Spell_GetNoDetrimentalSpellAggro(SPDat_Spell_Struct* self) +{ + return self->no_detrimental_spell_aggro; +} + +int Perl_Spell_GetNoExpendReagent(SPDat_Spell_Struct* self, uint8_t slot) +{ + return self->no_expend_reagent[slot]; +} + +int Perl_Spell_GetNoHealDamageItemMod(SPDat_Spell_Struct* self) +{ + return self->no_heal_damage_item_mod; +} + +bool Perl_Spell_GetNoPartialResist(SPDat_Spell_Struct* self) +{ + return self->no_partial_resist; +} + +bool Perl_Spell_GetNoRemove(SPDat_Spell_Struct* self) +{ + return self->no_remove; +} + +int Perl_Spell_GetNoResist(SPDat_Spell_Struct* self) +{ + return self->no_resist; +} + +bool Perl_Spell_GetNotFocusable(SPDat_Spell_Struct* self) +{ + return self->not_focusable; +} + +bool Perl_Spell_GetNPCNoLOS(SPDat_Spell_Struct* self) +{ + return self->npc_no_los; +} + +std::string Perl_Spell_GetOtherCasts(SPDat_Spell_Struct* self) +{ + return self->other_casts; +} + +int Perl_Spell_GetOverrideCritChance(SPDat_Spell_Struct* self) +{ + return self->override_crit_chance; +} + +int Perl_Spell_GetPCNPCOnlyFlag(SPDat_Spell_Struct* self) +{ + return self->pcnpc_only_flag; +} + +bool Perl_Spell_GetPersistDeath(SPDat_Spell_Struct* self) +{ + return self->persist_death; +} + +std::string Perl_Spell_GetPlayer_1(SPDat_Spell_Struct* self) +{ + return self->player_1; +} + +float Perl_Spell_GetPushBack(SPDat_Spell_Struct* self) +{ + return self->push_back; +} + +float Perl_Spell_GetPushUp(SPDat_Spell_Struct* self) +{ + return self->push_up; +} + +int Perl_Spell_GetPVPDuration(SPDat_Spell_Struct* self) +{ + return self->pvp_duration; +} + +int Perl_Spell_GetPVPDurationCap(SPDat_Spell_Struct* self) +{ + return self->pvp_duration_cap; +} + +int Perl_Spell_GetPVPResistBase(SPDat_Spell_Struct* self) +{ + return self->pvp_resist_base; +} + +int Perl_Spell_GetPVPResistCap(SPDat_Spell_Struct* self) +{ + return self->pvp_resist_cap; +} + +int Perl_Spell_GetPVPResistPerLevel(SPDat_Spell_Struct* self) +{ + return self->pvp_resist_per_level; +} + +float Perl_Spell_GetRange(SPDat_Spell_Struct* self) +{ + return self->range; +} + +int Perl_Spell_GetRank(SPDat_Spell_Struct* self) +{ + return self->rank; +} + +uint32_t Perl_Spell_GetRecastTime(SPDat_Spell_Struct* self) +{ + return self->recast_time; +} + +int Perl_Spell_GetRecourseLink(SPDat_Spell_Struct* self) +{ + return self->recourse_link; +} + +uint32_t Perl_Spell_GetRecoveryTime(SPDat_Spell_Struct* self) +{ + return self->recovery_time; +} + +bool Perl_Spell_GetReflectable(SPDat_Spell_Struct* self) +{ + return self->reflectable; +} + +int Perl_Spell_GetResistDifficulty(SPDat_Spell_Struct* self) +{ + return self->resist_difficulty; +} + +int Perl_Spell_GetResistType(SPDat_Spell_Struct* self) +{ + return self->resist_type; +} + +int Perl_Spell_GetShortBuffBox(SPDat_Spell_Struct* self) +{ + return self->short_buff_box; +} + +int Perl_Spell_GetSkill(SPDat_Spell_Struct* self) +{ + return self->skill; +} + +bool Perl_Spell_GetSneak(SPDat_Spell_Struct* self) +{ + return self->sneak; +} + +int Perl_Spell_GetSongCap(SPDat_Spell_Struct* self) +{ + return self->song_cap; +} + +int Perl_Spell_GetSpellAffectIndex(SPDat_Spell_Struct* self) +{ + return self->spell_affect_index; +} + +int Perl_Spell_GetSpellCategory(SPDat_Spell_Struct* self) +{ + return self->spell_category; +} + +int Perl_Spell_GetSpellClass(SPDat_Spell_Struct* self) +{ + return self->spell_class; +} + +std::string Perl_Spell_GetSpellFades(SPDat_Spell_Struct* self) +{ + return self->spell_fades; +} + +int Perl_Spell_GetSpellGroup(SPDat_Spell_Struct* self) +{ + return self->spell_group; +} + +int Perl_Spell_GetSpellSubclass(SPDat_Spell_Struct* self) +{ + return self->spell_subclass; +} + +bool Perl_Spell_GetSuspendable(SPDat_Spell_Struct* self) +{ + return self->suspendable; +} + +int Perl_Spell_GetTargetType(SPDat_Spell_Struct* self) +{ + return self->target_type; +} + +std::string Perl_Spell_GetTeleportZone(SPDat_Spell_Struct* self) +{ + return self->teleport_zone; +} + +int Perl_Spell_GetTimeOfDay(SPDat_Spell_Struct* self) +{ + return self->time_of_day; +} + +int Perl_Spell_GetTimerID(SPDat_Spell_Struct* self) +{ + return self->timer_id; +} + +int Perl_Spell_GetTypeDescriptionID(SPDat_Spell_Struct* self) +{ + return self->type_description_id; +} + +bool Perl_Spell_GetUninterruptable(SPDat_Spell_Struct* self) +{ + return self->uninterruptable; +} + +bool Perl_Spell_GetUnstackableDOT(SPDat_Spell_Struct* self) +{ + return self->unstackable_dot; +} + +int Perl_Spell_GetViralRange(SPDat_Spell_Struct* self) +{ + return self->viral_range; +} + +int Perl_Spell_GetViralTargets(SPDat_Spell_Struct* self) +{ + return self->viral_targets; +} + +int Perl_Spell_GetViralTimer(SPDat_Spell_Struct* self) +{ + return self->viral_timer; +} + +std::string Perl_Spell_GetYouCast(SPDat_Spell_Struct* self) +{ + return self->you_cast; +} + +int Perl_Spell_GetZoneType(SPDat_Spell_Struct* self) +{ + return self->zone_type; +} + +void perl_register_spell() +{ + perl::interpreter perl(PERL_GET_THX); + + auto package = perl.new_class("Spell"); + package.add("GetActivated", &Perl_Spell_GetActivated); + package.add("GetAllowRest", &Perl_Spell_GetAllowRest); + package.add("GetAOEDuration", &Perl_Spell_GetAOEDuration); + package.add("GetAOEMaxTargets", &Perl_Spell_GetAOEMaxTargets); + package.add("GetAOERange", &Perl_Spell_GetAOERange); + package.add("GetBaseDifficulty", &Perl_Spell_GetBaseDifficulty); + package.add("GetBaseValue", &Perl_Spell_GetBaseValue); + package.add("GetBonusHate", &Perl_Spell_GetBonusHate); + package.add("GetBuffDuration", &Perl_Spell_GetBuffDuration); + package.add("GetBuffDurationFormula", &Perl_Spell_GetBuffDurationFormula); + package.add("GetCanCastInCombat", &Perl_Spell_GetCanCastInCombat); + package.add("GetCanCastOutOfCombat", &Perl_Spell_GetCanCastOutOfCombat); + package.add("GetCanMGB", &Perl_Spell_GetCanMGB); + package.add("GetCastNotStanding", &Perl_Spell_GetCastNotStanding); + package.add("GetCastOnOther", &Perl_Spell_GetCastOnOther); + package.add("GetCastOnYou", &Perl_Spell_GetCastOnYou); + package.add("GetCastRestriction", &Perl_Spell_GetCastRestriction); + package.add("GetCastTime", &Perl_Spell_GetCastTime); + package.add("GetCasterRequirementID", &Perl_Spell_GetCasterRequirementID); + package.add("GetCastingAnimation", &Perl_Spell_GetCastingAnimation); + package.add("GetClasses", &Perl_Spell_GetClasses); + package.add("GetComponent", &Perl_Spell_GetComponent); + package.add("GetComponentCount", &Perl_Spell_GetComponentCount); + package.add("GetDeities", &Perl_Spell_GetDeities); + package.add("GetDeityAgnostic", &Perl_Spell_GetDeityAgnostic); + package.add("GetDescriptionID", &Perl_Spell_GetDescriptionID); + package.add("GetDirectionalEnd", &Perl_Spell_GetDirectionalEnd); + package.add("GetDirectionalStart", &Perl_Spell_GetDirectionalStart); + package.add("GetDisallowSit", &Perl_Spell_GetDisallowSit); + package.add("GetDispelFlag", &Perl_Spell_GetDispelFlag); + package.add("GetEffectDescriptionID", &Perl_Spell_GetEffectDescriptionID); + package.add("GetEffectID", &Perl_Spell_GetEffectID); + package.add("GetEnduranceCost", &Perl_Spell_GetEnduranceCost); + package.add("GetEnduranceUpkeep", &Perl_Spell_GetEnduranceUpkeep); + package.add("GetEnvironmentType", &Perl_Spell_GetEnvironmentType); + package.add("GetFeedbackable", &Perl_Spell_GetFeedbackable); + package.add("GetFormula", &Perl_Spell_GetFormula); + package.add("GetGoodEffect", &Perl_Spell_GetGoodEffect); + package.add("GetHateAdded", &Perl_Spell_GetHateAdded); + package.add("GetHitNumber", &Perl_Spell_GetHitNumber); + package.add("GetHitNumberType", &Perl_Spell_GetHitNumberType); + package.add("GetID", &Perl_Spell_GetID); + package.add("GetIsDiscipline", &Perl_Spell_GetIsDiscipline); + package.add("GetLDoNTrap", &Perl_Spell_GetLDoNTrap); + package.add("GetLimitValue", &Perl_Spell_GetLimitValue); + package.add("GetMana", &Perl_Spell_GetMana); + package.add("GetMaxDistance", &Perl_Spell_GetMaxDistance); + package.add("GetMaxDistanceMod", &Perl_Spell_GetMaxDistanceMod); + package.add("GetMaxResist", &Perl_Spell_GetMaxResist); + package.add("GetMaxValue", &Perl_Spell_GetMaxValue); + package.add("GetMinDistance", &Perl_Spell_GetMinDistance); + package.add("GetMinDistanceMod", &Perl_Spell_GetMinDistanceMod); + package.add("GetMinRange", &Perl_Spell_GetMinRange); + package.add("GetMinResist", &Perl_Spell_GetMinResist); + package.add("GetName", &Perl_Spell_GetName); + package.add("GetNewIcon", &Perl_Spell_GetNewIcon); + package.add("GetNimbusEffect", &Perl_Spell_GetNimbusEffect); + package.add("GetNoBlock", &Perl_Spell_GetNoBlock); + package.add("GetNoDetrimentalSpellAggro", &Perl_Spell_GetNoDetrimentalSpellAggro); + package.add("GetNoExpendReagent", &Perl_Spell_GetNoExpendReagent); + package.add("GetNoHealDamageItemMod", &Perl_Spell_GetNoHealDamageItemMod); + package.add("GetNoPartialResist", &Perl_Spell_GetNoPartialResist); + package.add("GetNoRemove", &Perl_Spell_GetNoRemove); + package.add("GetNoResist", &Perl_Spell_GetNoResist); + package.add("GetNotFocusable", &Perl_Spell_GetNotFocusable); + package.add("GetNPCNoLOS", &Perl_Spell_GetNPCNoLOS); + package.add("GetOtherCasts", &Perl_Spell_GetOtherCasts); + package.add("GetOverrideCritChance", &Perl_Spell_GetOverrideCritChance); + package.add("GetPCNPCOnlyFlag", &Perl_Spell_GetPCNPCOnlyFlag); + package.add("GetPersistDeath", &Perl_Spell_GetPersistDeath); + package.add("GetPlayer_1", &Perl_Spell_GetPlayer_1); + package.add("GetPushBack", &Perl_Spell_GetPushBack); + package.add("GetPushUp", &Perl_Spell_GetPushUp); + package.add("GetPVPDuration", &Perl_Spell_GetPVPDuration); + package.add("GetPVPDurationCap", &Perl_Spell_GetPVPDurationCap); + package.add("GetPVPResistBase", &Perl_Spell_GetPVPResistBase); + package.add("GetPVPResistCap", &Perl_Spell_GetPVPResistCap); + package.add("GetPVPResistPerLevel", &Perl_Spell_GetPVPResistPerLevel); + package.add("GetRange", &Perl_Spell_GetRange); + package.add("GetRank", &Perl_Spell_GetRank); + package.add("GetRecastTime", &Perl_Spell_GetRecastTime); + package.add("GetRecourseLink", &Perl_Spell_GetRecourseLink); + package.add("GetRecoveryTime", &Perl_Spell_GetRecoveryTime); + package.add("GetReflectable", &Perl_Spell_GetReflectable); + package.add("GetResistDifficulty", &Perl_Spell_GetResistDifficulty); + package.add("GetResistType", &Perl_Spell_GetResistType); + package.add("GetShortBuffBox", &Perl_Spell_GetShortBuffBox); + package.add("GetSkill", &Perl_Spell_GetSkill); + package.add("GetSneak", &Perl_Spell_GetSneak); + package.add("GetSongCap", &Perl_Spell_GetSongCap); + package.add("GetSpellAffectIndex", &Perl_Spell_GetSpellAffectIndex); + package.add("GetSpellCategory", &Perl_Spell_GetSpellCategory); + package.add("GetSpellClass", &Perl_Spell_GetSpellClass); + package.add("GetSpellFades", &Perl_Spell_GetSpellFades); + package.add("GetSpellGroup", &Perl_Spell_GetSpellGroup); + package.add("GetSpellSubclass", &Perl_Spell_GetSpellSubclass); + package.add("GetSuspendable", &Perl_Spell_GetSuspendable); + package.add("GetTargetType", &Perl_Spell_GetTargetType); + package.add("GetTeleportZone", &Perl_Spell_GetTeleportZone); + package.add("GetTimeOfDay", &Perl_Spell_GetTimeOfDay); + package.add("GetTimerID", &Perl_Spell_GetTimerID); + package.add("GetTypeDescriptionID", &Perl_Spell_GetTypeDescriptionID); + package.add("GetUninterruptable", &Perl_Spell_GetUninterruptable); + package.add("GetUnstackableDOT", &Perl_Spell_GetUnstackableDOT); + package.add("GetViralRange", &Perl_Spell_GetViralRange); + package.add("GetViralTargets", &Perl_Spell_GetViralTargets); + package.add("GetViralTimer", &Perl_Spell_GetViralTimer); + package.add("GetYouCast", &Perl_Spell_GetYouCast); + package.add("GetZoneType", &Perl_Spell_GetZoneType); } #endif //EMBPERL_XS_CLASSES