mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 02:31:03 +00:00
More lua work, client should be completely exported barring any more bugs that crop up. Starting work on getting the rest of the general functions
This commit is contained in:
+22
-96
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_iteminst.h"
|
||||
#include "lua_entity.h"
|
||||
@@ -44,103 +45,28 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *
|
||||
lua_createtable(L, 0, 0);
|
||||
std::stringstream ident;
|
||||
ident << npc->GetNPCTypeID();
|
||||
|
||||
for(int i = 1; i <= 4; ++i) {
|
||||
std::string prefix = "item" + std::to_string(i);
|
||||
|
||||
std::string cur = prefix;
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar(prefix + "." + ident.str())));
|
||||
lua_setfield(L, -2, prefix.c_str());
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar(prefix + ".charges." + ident.str())));
|
||||
lua_setfield(L, -2, std::string(prefix + "_charges").c_str());
|
||||
|
||||
lua_pushboolean(L, std::stoul(parse->GetVar(prefix + ".attuned." + ident.str())));
|
||||
lua_setfield(L, -2, std::string(prefix + "_attuned").c_str());
|
||||
|
||||
for(int j = 1; j <= 5; ++j) {
|
||||
std::string augment = "augment" + std::to_string(j);
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar(prefix + "." + augment + "." + ident.str())));
|
||||
lua_setfield(L, -2, std::string(prefix + "_" + augment).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1." + ident.str())));
|
||||
lua_setfield(L, -2, "item1");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2." + ident.str())));
|
||||
lua_setfield(L, -2, "item2");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3." + ident.str())));
|
||||
lua_setfield(L, -2, "item3");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4." + ident.str())));
|
||||
lua_setfield(L, -2, "item4");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.charges." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_charges");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.charges." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_charges");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.charges." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_charges");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.charges." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_charges");
|
||||
|
||||
lua_pushboolean(L, std::stoul(parse->GetVar("item1.attuned." + ident.str())) != 0 ? true : false);
|
||||
lua_setfield(L, -2, "item1_attuned");
|
||||
|
||||
lua_pushboolean(L, std::stoul(parse->GetVar("item2.attuned." + ident.str())) != 0 ? true : false);
|
||||
lua_setfield(L, -2, "item2_attuned");
|
||||
|
||||
lua_pushboolean(L, std::stoul(parse->GetVar("item3.attuned." + ident.str())) != 0 ? true : false);
|
||||
lua_setfield(L, -2, "item3_attuned");
|
||||
|
||||
lua_pushboolean(L, std::stoul(parse->GetVar("item4.attuned." + ident.str())) != 0 ? true : false);
|
||||
lua_setfield(L, -2, "item4_attuned");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.augment1." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_augment1");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.augment2." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_augment2");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.augment3." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_augment3");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.augment4." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_augment4");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item1.augment5." + ident.str())));
|
||||
lua_setfield(L, -2, "item1_augment5");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.augment1." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_augment1");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.augment2." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_augment2");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.augment3." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_augment3");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.augment4." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_augment4");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item2.augment5." + ident.str())));
|
||||
lua_setfield(L, -2, "item2_augment5");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.augment1." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_augment1");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.augment2." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_augment2");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.augment3." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_augment3");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.augment4." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_augment4");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item3.augment5." + ident.str())));
|
||||
lua_setfield(L, -2, "item3_augment5");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.augment1." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_augment1");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.augment2." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_augment2");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.augment3." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_augment3");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.augment4." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_augment4");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("item4.augment5." + ident.str())));
|
||||
lua_setfield(L, -2, "item4_augment5");
|
||||
|
||||
lua_pushinteger(L, std::stoul(parse->GetVar("platinum." + ident.str())));
|
||||
lua_setfield(L, -2, "platinum");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user