HTTP functions #5

This commit is contained in:
Federico Cecchetto
2022-06-14 23:56:15 +02:00
parent 2111db394d
commit 8c0d999a2a
12 changed files with 272 additions and 35 deletions

View File

@@ -67,6 +67,12 @@ namespace game
return utils::hook::invoke<unsigned int>(func, inst);
}
void Scr_NotifyId(scriptInstance_t inst, int /*client_num*/, unsigned int id,
unsigned int string_value, unsigned int paramcount)
{
game::Scr_NotifyNum_Internal(inst, -1, id, 0, string_value, paramcount);
}
VariableValue Scr_GetArrayIndexValue(scriptInstance_t, unsigned int name)
{
VariableValue value{};

View File

@@ -65,6 +65,9 @@ namespace game
VariableValue Scr_GetArrayIndexValue(scriptInstance_t inst, unsigned int name);
unsigned int Scr_GetSelf(scriptInstance_t inst, unsigned int threadId);
void Scr_NotifyId(scriptInstance_t inst, int client_num, unsigned int id,
unsigned int string_value, unsigned int paramcount);
}
#include "symbols.hpp"

View File

@@ -72,6 +72,8 @@ namespace scripting
{
return {this->id_, this->get_value_id(key.as<S>())};
}
throw std::runtime_error("Invalid key type");
}
private:

View File

@@ -63,17 +63,7 @@ namespace scripting
object::object()
{
this->id_ = make_object();
}
object::object(std::unordered_map<std::string, script_value> values)
{
this->id_ = make_object();
for (const auto& value : values)
{
this->set(value.first, value.second);
}
this->id_ = game::AllocObject(game::SCRIPTINSTANCE_SERVER);
}
object::~object()
@@ -157,14 +147,14 @@ namespace scripting
return game::Scr_GetSelf(game::SCRIPTINSTANCE_SERVER, this->id_);
}
void object::erase(const std::string& key) const
void object::erase(const std::string& /*key*/) const
{
const auto string_value = game::SL_GetCanonicalString(key.data(), 0);
/*const auto string_value = game::SL_GetCanonicalString(key.data(), 0);
const auto variable_id = game::FindVariable(game::SCRIPTINSTANCE_SERVER, this->id_, string_value);
if (variable_id)
{
game::RemoveVariableValue(game::SCRIPTINSTANCE_SERVER, this->id_, variable_id);
}
}*/
}
script_value object::get(const std::string& /*key*/) const

View File

@@ -19,8 +19,6 @@ namespace scripting
object();
object(const unsigned int);
object(std::unordered_map<std::string, script_value>);
object(const object& other);
object(object&& other) noexcept;

View File

@@ -41,7 +41,7 @@ namespace game
WEAK symbol<void(scriptInstance_t inst)> Scr_ClearOutParams{0x654D10, 0x588680};
WEAK symbol<unsigned int(scriptInstance_t inst)> AllocObject{0x0, 0x0};
WEAK symbol<unsigned int(scriptInstance_t inst)> AllocObject{0x603400, 0x6970B0};
WEAK symbol<unsigned int(scriptInstance_t inst, unsigned int id)> AllocThread{0x69E140, 0x43CA60};
WEAK symbol<void(scriptInstance_t inst, unsigned int id)> RemoveRefToObject{0x5517B0, 0x698FA0};
WEAK symbol<void(scriptInstance_t inst, const float* vectorValue)> RemoveRefToVector{0x0, 0x0};
@@ -69,7 +69,8 @@ namespace game
WEAK symbol<VariableValue(scriptInstance_t inst, unsigned int classnum, int entnum, int clientNum, int offset)> GetEntityFieldValue{0x0, 0x0};
WEAK symbol<void(gentity_s* ent, unsigned int stringValue, unsigned int paramcount)> Scr_Notify{0x0, 0x0};
WEAK symbol<void(scriptInstance_t inst, int clientNum, unsigned int id, unsigned int stringValue, unsigned int paramcount)> Scr_NotifyId{0x0, 0x0};
WEAK symbol<void(scriptInstance_t inst, int clientNum, int entnum,
unsigned int classnum, unsigned int stringValue, unsigned int paramcount)> Scr_NotifyNum_Internal{0x41D270, 0x4162E0};
WEAK symbol<void(int entnum, unsigned int classnum, unsigned int stringValue, unsigned int paramcount)> Scr_NotifyNum{0x0, 0x0};
WEAK symbol<unsigned int(const char* str, unsigned int user, scriptInstance_t inst)> SL_GetString{0x463130, 0x4B1770};