Compare commits

...

10 Commits

10 changed files with 2936 additions and 2889 deletions
-2
View File
@@ -1,8 +1,6 @@
// system use
N(OP_ExploreUnknown),
// start (please add new opcodes in descending order and re-order any name changes where applicable)
N(OP_0x0193),
N(OP_0x0347),
N(OP_AAAction),
N(OP_AAExpUpdate),
N(OP_AcceptNewTask),
+6 -6
View File
@@ -47,13 +47,13 @@ const char *RuleManager::s_categoryNames[_CatCount+1] = {
const RuleManager::RuleInfo RuleManager::s_RuleInfo[_IntRuleCount + _RealRuleCount + _BoolRuleCount + 1] = {
/* this is done in three steps so we can reliably get to them by index*/
#define RULE_INT(cat, rule, default_value, notes) \
{ #cat ":" #rule, Category__##cat, IntRule, Int__##rule, notes },
{ #cat ":" #rule, Category__##cat, IntRule, Int__##cat__##rule, notes },
#include "ruletypes.h"
#define RULE_REAL(cat, rule, default_value, notes) \
{ #cat ":" #rule, Category__##cat, RealRule, Real__##rule, notes },
{ #cat ":" #rule, Category__##cat, RealRule, Real__##cat__##rule, notes },
#include "ruletypes.h"
#define RULE_BOOL(cat, rule, default_value, notes) \
{ #cat ":" #rule, Category__##cat, BoolRule, Bool__##rule, notes },
{ #cat ":" #rule, Category__##cat, BoolRule, Bool__##cat__##rule, notes },
#include "ruletypes.h"
{ "Invalid Rule", _CatCount, IntRule }
};
@@ -180,11 +180,11 @@ void RuleManager::ResetRules(bool reload) {
Log(Logs::Detail, Logs::Rules, "Resetting running rules to default values");
#define RULE_INT(cat, rule, default_value, notes) \
m_RuleIntValues[ Int__##rule ] = default_value;
m_RuleIntValues[ Int__##cat__##rule ] = default_value;
#define RULE_REAL(cat, rule, default_value, notes) \
m_RuleRealValues[ Real__##rule ] = default_value;
m_RuleRealValues[ Real__##cat__##rule ] = default_value;
#define RULE_BOOL(cat, rule, default_value, notes) \
m_RuleBoolValues[ Bool__##rule ] = default_value;
m_RuleBoolValues[ Bool__##cat__##rule ] = default_value;
#include "ruletypes.h"
// restore these rules to their pre-reset values
+6 -6
View File
@@ -30,11 +30,11 @@
//which makes it a global for now, but with instancing we will do exactly
//what we do with the zone global and just make it a member of core classes
#define RuleI(cat, rule) \
RuleManager::Instance()->GetIntRule( RuleManager::Int__##rule )
RuleManager::Instance()->GetIntRule( RuleManager::Int__##cat__##rule )
#define RuleR(cat, rule) \
RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule )
RuleManager::Instance()->GetRealRule( RuleManager::Real__##cat__##rule )
#define RuleB(cat, rule) \
RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##rule )
RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##cat__##rule )
#include <vector>
@@ -50,21 +50,21 @@ public:
//generate our rule enums:
typedef enum {
#define RULE_INT(cat, rule, default_value, notes) \
Int__##rule,
Int__##cat__##rule,
#include "ruletypes.h"
_IntRuleCount
} IntType;
typedef enum {
#define RULE_REAL(cat, rule, default_value, notes) \
Real__##rule,
Real__##cat__##rule,
#include "ruletypes.h"
_RealRuleCount
} RealType;
typedef enum {
#define RULE_BOOL(cat, rule, default_value, notes) \
Bool__##rule,
Bool__##cat__##rule,
#include "ruletypes.h"
_BoolRuleCount
} BoolType;
-3
View File
@@ -578,8 +578,6 @@ RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit mess
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
RULE_CATEGORY_END()
#ifdef BOTS
RULE_CATEGORY(Bots)
RULE_INT(Bots, BotExpansionSettings, 16383, "Sets the expansion settings for bot use. Defaults to all expansions enabled up to TSS")
RULE_BOOL(Bots, AllowCamelCaseNames, false, "Allows the use of 'MyBot' type names")
@@ -612,7 +610,6 @@ RULE_BOOL(Bots, AllowApplyPoisonCommand, true, "Allows the use of the bot comman
RULE_BOOL(Bots, AllowApplyPotionCommand, true, "Allows the use of the bot command 'applypotion'")
RULE_BOOL(Bots, RestrictApplyPotionToRogue, true, "Restricts the bot command 'applypotion' to rogue-usable potions (i.e., poisons)")
RULE_CATEGORY_END()
#endif
RULE_CATEGORY(Chat)
RULE_BOOL(Chat, ServerWideOOC, true, "Enable server wide ooc-chat")
+20 -25
View File
@@ -116,7 +116,6 @@ void MapOpcodes()
ConnectingOpcodes[OP_ZoneEntry] = &Client::Handle_Connect_OP_ZoneEntry;
// connected opcode handler assignments:
ConnectedOpcodes[OP_0x0193] = &Client::Handle_0x0193;
ConnectedOpcodes[OP_AAAction] = &Client::Handle_OP_AAAction;
ConnectedOpcodes[OP_AcceptNewTask] = &Client::Handle_OP_AcceptNewTask;
ConnectedOpcodes[OP_AdventureInfoRequest] = &Client::Handle_OP_AdventureInfoRequest;
@@ -1169,10 +1168,6 @@ void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app)
void Client::Handle_Connect_OP_ZoneComplete(const EQApplicationPacket* app)
{
auto outapp = new EQApplicationPacket(OP_0x0347, 0);
QueuePacket(outapp);
safe_delete(outapp);
return;
}
void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket* app)
@@ -1368,7 +1363,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
int client_max_level = 0;
if (RuleB(Character, PerCharacterQglobalMaxLevel)) {
client_max_level = GetCharMaxLevelFromQGlobal();
} else if (RuleB(Character, PerCharacterBucketMaxLevel)) {
}
else if (RuleB(Character, PerCharacterBucketMaxLevel)) {
client_max_level = GetCharMaxLevelFromBucket();
}
SetClientMaxLevel(client_max_level);
@@ -1761,16 +1757,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
return;
}
// connected opcode handlers
void Client::Handle_0x0193(const EQApplicationPacket *app)
{
// Not sure what this opcode does. It started being sent when OP_ClientUpdate was
// changed to pump OP_ClientUpdate back out instead of OP_MobUpdate
// 2 bytes: 00 00
return;
}
void Client::Handle_OP_AAAction(const EQApplicationPacket* app)
{
LogAA("Received OP_AAAction");
@@ -2918,10 +2904,12 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app)
if (new_target && (GetGM() ||
Distance(m_Position, assistee->GetPosition()) <= TARGETING_RANGE)) {
eid->entity_id = new_target->GetID();
} else {
}
else {
eid->entity_id = 0;
}
} else {
}
else {
eid->entity_id = 0;
}
}
@@ -4677,7 +4665,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
if (gm_hide_me) {
entity_list.QueueClientsStatus(this, outapp, true, Admin(), 255);
} else {
}
else {
entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, ClientPositionUpdates), nullptr, true);
}
@@ -4688,7 +4677,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
if (raid) {
raid->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1));
} else if (group) {
}
else if (group) {
group->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1));
}
@@ -10196,7 +10186,8 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
target->SayString(PET_LEADERIS, owner->GetCleanName());
else
target->SayString(I_FOLLOW_NOONE);
} else if (mypet) {
}
else if (mypet) {
mypet->SayString(PET_LEADERIS, GetName());
}
}
@@ -10560,7 +10551,8 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (m_ClientVersionBit & EQ::versions::maskUFAndLater) {
MessageString(Chat::PetResponse, PET_ON_GHOLD);
mypet->SayString(this, Chat::PetResponse, PET_GHOLD_ON_MSG);
} else {
}
else {
mypet->SayString(this, Chat::PetResponse, PET_ON_HOLD);
}
mypet->SetGHeld(true);
@@ -10575,7 +10567,8 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (m_ClientVersionBit & EQ::versions::maskUFAndLater) {
MessageString(Chat::PetResponse, PET_ON_GHOLD);
mypet->SayString(this, Chat::PetResponse, PET_GHOLD_ON_MSG);
} else {
}
else {
mypet->SayString(this, Chat::PetResponse, PET_ON_HOLD);
}
mypet->SetGHeld(true);
@@ -10688,7 +10681,8 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if ((mypet->GetPetType() == petAnimation && aabonuses.PetCommands[PetCommand]) || mypet->GetPetType() != petAnimation) {
if (mypet->IsPetStop()) {
mypet->SetPetStop(false);
} else {
}
else {
mypet->SetPetStop(true);
mypet->StopNavigation();
mypet->SetTarget(nullptr);
@@ -10732,7 +10726,8 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
mypet->SayString(this, Chat::PetResponse, PET_OFF_REGROUPING);
} else {
}
else {
mypet->SetPetRegroup(true);
mypet->SetTarget(nullptr);
mypet->SayString(this, Chat::PetResponse, PET_ON_REGROUPING);
-1
View File
@@ -21,7 +21,6 @@
void Handle_Connect_OP_ZoneComplete(const EQApplicationPacket* app);
void Handle_Connect_OP_ZoneEntry(const EQApplicationPacket* app);
/* Connected opcode handlers*/
void Handle_0x0193(const EQApplicationPacket *app);
void Handle_0x01e7(const EQApplicationPacket* app);
void Handle_OP_AAAction(const EQApplicationPacket* app);
void Handle_OP_AcceptNewTask(const EQApplicationPacket* app);
+1 -1
View File
@@ -1589,7 +1589,7 @@ int Lua_Client::CalcATK() {
return self->CalcATK();
}
void Lua_Client::FilteredMessage(Mob *sender, uint32 type, int filter, const char *message)
void Lua_Client::FilteredMessage(Lua_Mob sender, uint32 type, int filter, const char *message)
{
Lua_Safe_Call_Void();
self->FilteredMessage(sender, type, (eqFilterType)filter, message);
+1 -1
View File
@@ -326,7 +326,7 @@ public:
bool IsDead();
int CalcCurrentWeight();
int CalcATK();
void FilteredMessage(Mob *sender, uint32 type, int filter, const char* message);
void FilteredMessage(Lua_Mob sender, uint32 type, int filter, const char* message);
void EnableAreaHPRegen(int value);
void DisableAreaHPRegen();
void EnableAreaManaRegen(int value);
+144 -111
View File
@@ -55,9 +55,9 @@ extern std::map<std::string, Encounter *> lua_encounters;
extern void MapOpcodes();
extern void ClearMappedOpcode(EmuOpcode op);
void unregister_event(std::string package_name, std::string name, int evt);
void lua_unregister_event(std::string package_name, std::string name, int evt);
void load_encounter(std::string name) {
void lua_load_encounter(std::string name) {
if (lua_encounters_loaded.count(name) > 0)
return;
auto enc = new Encounter(name.c_str());
@@ -67,7 +67,7 @@ void load_encounter(std::string name) {
parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, "", 0);
}
void load_encounter_with_data(std::string name, std::string info_str) {
void lua_load_encounter_with_data(std::string name, std::string info_str) {
if (lua_encounters_loaded.count(name) > 0)
return;
auto enc = new Encounter(name.c_str());
@@ -79,7 +79,7 @@ void load_encounter_with_data(std::string name, std::string info_str) {
parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, "", 0, &info_ptrs);
}
void unload_encounter(std::string name) {
void lua_unload_encounter(std::string name) {
if (lua_encounters_loaded.count(name) == 0)
return;
@@ -90,14 +90,16 @@ void unload_encounter(std::string name) {
while (iter != elist.end()) {
if ((*iter).encounter_name.compare(name) == 0) {
iter = elist.erase(iter);
} else {
}
else {
++iter;
}
}
if (elist.size() == 0) {
lua_encounter_events_registered.erase(liter++);
} else {
}
else {
++liter;
}
}
@@ -108,7 +110,7 @@ void unload_encounter(std::string name) {
parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, "", 0);
}
void unload_encounter_with_data(std::string name, std::string info_str) {
void lua_unload_encounter_with_data(std::string name, std::string info_str) {
if (lua_encounters_loaded.count(name) == 0)
return;
@@ -141,11 +143,11 @@ void unload_encounter_with_data(std::string name, std::string info_str) {
parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, "", 0, &info_ptrs);
}
void register_event(std::string package_name, std::string name, int evt, luabind::adl::object func) {
void lua_register_event(std::string package_name, std::string name, int evt, luabind::adl::object func) {
if (lua_encounters_loaded.count(name) == 0)
return;
unregister_event(package_name, name, evt);
lua_unregister_event(package_name, name, evt);
lua_registered_event e;
e.encounter_name = name;
@@ -157,13 +159,14 @@ void register_event(std::string package_name, std::string name, int evt, luabind
std::list<lua_registered_event> elist;
elist.push_back(e);
lua_encounter_events_registered[package_name] = elist;
} else {
}
else {
std::list<lua_registered_event>& elist = liter->second;
elist.push_back(e);
}
}
void unregister_event(std::string package_name, std::string name, int evt) {
void lua_unregister_event(std::string package_name, std::string name, int evt) {
auto liter = lua_encounter_events_registered.find(package_name);
if (liter != lua_encounter_events_registered.end()) {
std::list<lua_registered_event> elist = liter->second;
@@ -179,102 +182,102 @@ void unregister_event(std::string package_name, std::string name, int evt) {
}
}
void register_npc_event(std::string name, int evt, int npc_id, luabind::adl::object func) {
void lua_register_npc_event(std::string name, int evt, int npc_id, luabind::adl::object func) {
if (luabind::type(func) == LUA_TFUNCTION) {
std::stringstream package_name;
package_name << "npc_" << npc_id;
register_event(package_name.str(), name, evt, func);
lua_register_event(package_name.str(), name, evt, func);
}
}
void register_npc_event(int evt, int npc_id, luabind::adl::object func) {
void lua_register_npc_event(int evt, int npc_id, luabind::adl::object func) {
std::string name = quest_manager.GetEncounter();
register_npc_event(name, evt, npc_id, func);
lua_register_npc_event(name, evt, npc_id, func);
}
void unregister_npc_event(std::string name, int evt, int npc_id) {
void lua_unregister_npc_event(std::string name, int evt, int npc_id) {
std::stringstream package_name;
package_name << "npc_" << npc_id;
unregister_event(package_name.str(), name, evt);
lua_unregister_event(package_name.str(), name, evt);
}
void unregister_npc_event(int evt, int npc_id) {
void lua_unregister_npc_event(int evt, int npc_id) {
std::string name = quest_manager.GetEncounter();
unregister_npc_event(name, evt, npc_id);
lua_unregister_npc_event(name, evt, npc_id);
}
void register_player_event(std::string name, int evt, luabind::adl::object func) {
void lua_register_player_event(std::string name, int evt, luabind::adl::object func) {
if (luabind::type(func) == LUA_TFUNCTION) {
register_event("player", name, evt, func);
lua_register_event("player", name, evt, func);
}
}
void register_player_event(int evt, luabind::adl::object func) {
void lua_register_player_event(int evt, luabind::adl::object func) {
std::string name = quest_manager.GetEncounter();
register_player_event(name, evt, func);
lua_register_player_event(name, evt, func);
}
void unregister_player_event(std::string name, int evt) {
unregister_event("player", name, evt);
void lua_unregister_player_event(std::string name, int evt) {
lua_unregister_event("player", name, evt);
}
void unregister_player_event(int evt) {
void lua_unregister_player_event(int evt) {
std::string name = quest_manager.GetEncounter();
unregister_player_event(name, evt);
lua_unregister_player_event(name, evt);
}
void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) {
void lua_register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) {
std::string package_name = "item_";
package_name += std::to_string(item_id);
if (luabind::type(func) == LUA_TFUNCTION) {
register_event(package_name, name, evt, func);
lua_register_event(package_name, name, evt, func);
}
}
void register_item_event(int evt, int item_id, luabind::adl::object func) {
void lua_register_item_event(int evt, int item_id, luabind::adl::object func) {
std::string name = quest_manager.GetEncounter();
register_item_event(name, evt, item_id, func);
lua_register_item_event(name, evt, item_id, func);
}
void unregister_item_event(std::string name, int evt, int item_id) {
void lua_unregister_item_event(std::string name, int evt, int item_id) {
std::string package_name = "item_";
package_name += std::to_string(item_id);
unregister_event(package_name, name, evt);
lua_unregister_event(package_name, name, evt);
}
void unregister_item_event(int evt, int item_id) {
void lua_unregister_item_event(int evt, int item_id) {
std::string name = quest_manager.GetEncounter();
unregister_item_event(name, evt, item_id);
lua_unregister_item_event(name, evt, item_id);
}
void register_spell_event(std::string name, int evt, int spell_id, luabind::adl::object func) {
void lua_register_spell_event(std::string name, int evt, int spell_id, luabind::adl::object func) {
if (luabind::type(func) == LUA_TFUNCTION) {
std::stringstream package_name;
package_name << "spell_" << spell_id;
register_event(package_name.str(), name, evt, func);
lua_register_event(package_name.str(), name, evt, func);
}
}
void register_spell_event(int evt, int spell_id, luabind::adl::object func) {
void lua_register_spell_event(int evt, int spell_id, luabind::adl::object func) {
std::string name = quest_manager.GetEncounter();
register_spell_event(name, evt, spell_id, func);
lua_register_spell_event(name, evt, spell_id, func);
}
void unregister_spell_event(std::string name, int evt, int spell_id) {
void lua_unregister_spell_event(std::string name, int evt, int spell_id) {
std::stringstream package_name;
package_name << "spell_" << spell_id;
unregister_event(package_name.str(), name, evt);
lua_unregister_event(package_name.str(), name, evt);
}
void unregister_spell_event(int evt, int spell_id) {
void lua_unregister_spell_event(int evt, int spell_id) {
std::string name = quest_manager.GetEncounter();
unregister_spell_event(name, evt, spell_id);
lua_unregister_spell_event(name, evt, spell_id);
}
Lua_Mob lua_spawn2(int npc_type, int grid, int unused, double x, double y, double z, double heading) {
@@ -598,9 +601,11 @@ void lua_task_selector(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
} else {
catch (luabind::cast_failed&) {
}
}
else {
count = i - 1;
break;
}
@@ -628,9 +633,11 @@ void lua_enable_task(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
} else {
catch (luabind::cast_failed&) {
}
}
else {
count = i - 1;
break;
}
@@ -655,9 +662,11 @@ void lua_disable_task(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
} else {
catch (luabind::cast_failed&) {
}
}
else {
count = i - 1;
break;
}
@@ -1715,10 +1724,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
spawn2_id = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1726,10 +1737,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
spawngroup_id = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1737,10 +1750,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
x = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1748,10 +1763,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
y = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1759,10 +1776,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
z = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1770,10 +1789,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
heading = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1781,10 +1802,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
respawn = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1792,10 +1815,12 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
variance = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
return;
}
} else {
}
else {
return;
}
@@ -1803,7 +1828,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
timeleft = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -1811,7 +1837,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
grid = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -1819,7 +1846,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
condition_id = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -1827,7 +1855,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
condition_min_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -1835,7 +1864,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
enabled = luabind::object_cast<bool>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -1843,7 +1873,8 @@ void lua_add_spawn_point(luabind::adl::object table) {
if (luabind::type(cur) != LUA_TNIL) {
try {
animation = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed &) {
}
catch (luabind::cast_failed&) {
}
}
@@ -2438,61 +2469,61 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float
entity_list.AddNPC(npc);
}
int random_int(int low, int high) {
int lua_random_int(int low, int high) {
return zone->random.Int(low, high);
}
double random_real(double low, double high) {
double lua_random_real(double low, double high) {
return zone->random.Real(low, high);
}
bool random_roll_int(int required) {
bool lua_random_roll_int(int required) {
return zone->random.Roll(required);
}
bool random_roll_real(double required) {
bool lua_random_roll_real(double required) {
return zone->random.Roll(required);
}
int random_roll0(int max) {
int lua_random_roll0(int max) {
return zone->random.Roll0(max);
}
int get_rulei(int rule) {
int lua_get_rulei(int rule) {
return RuleManager::Instance()->GetIntRule((RuleManager::IntType)rule);
}
float get_ruler(int rule) {
float lua_get_ruler(int rule) {
return RuleManager::Instance()->GetRealRule((RuleManager::RealType)rule);
}
bool get_ruleb(int rule) {
bool lua_get_ruleb(int rule) {
return RuleManager::Instance()->GetBoolRule((RuleManager::BoolType)rule);
}
luabind::scope lua_register_general() {
return luabind::namespace_("eq")
[
luabind::def("load_encounter", &load_encounter),
luabind::def("unload_encounter", &unload_encounter),
luabind::def("load_encounter_with_data", &load_encounter_with_data),
luabind::def("unload_encounter_with_data", &unload_encounter_with_data),
luabind::def("register_npc_event", (void(*)(std::string, int, int, luabind::adl::object))&register_npc_event),
luabind::def("register_npc_event", (void(*)(int, int, luabind::adl::object))&register_npc_event),
luabind::def("unregister_npc_event", (void(*)(std::string, int, int))&unregister_npc_event),
luabind::def("unregister_npc_event", (void(*)(int, int))&unregister_npc_event),
luabind::def("register_player_event", (void(*)(std::string, int, luabind::adl::object))&register_player_event),
luabind::def("register_player_event", (void(*)(int, luabind::adl::object))&register_player_event),
luabind::def("unregister_player_event", (void(*)(std::string, int))&unregister_player_event),
luabind::def("unregister_player_event", (void(*)(int))&unregister_player_event),
luabind::def("register_item_event", (void(*)(std::string, int, int, luabind::adl::object))&register_item_event),
luabind::def("register_item_event", (void(*)(int, int, luabind::adl::object))&register_item_event),
luabind::def("unregister_item_event", (void(*)(std::string, int, int))&unregister_item_event),
luabind::def("unregister_item_event", (void(*)(int, int))&unregister_item_event),
luabind::def("register_spell_event", (void(*)(std::string, int, int, luabind::adl::object func))&register_spell_event),
luabind::def("register_spell_event", (void(*)(int, int, luabind::adl::object func))&register_spell_event),
luabind::def("unregister_spell_event", (void(*)(std::string, int, int))&unregister_spell_event),
luabind::def("unregister_spell_event", (void(*)(int, int))&unregister_spell_event),
luabind::def("load_encounter", &lua_load_encounter),
luabind::def("unload_encounter", &lua_unload_encounter),
luabind::def("load_encounter_with_data", &lua_load_encounter_with_data),
luabind::def("unload_encounter_with_data", &lua_unload_encounter_with_data),
luabind::def("register_npc_event", (void(*)(std::string, int, int, luabind::adl::object)) & lua_register_npc_event),
luabind::def("register_npc_event", (void(*)(int, int, luabind::adl::object)) & lua_register_npc_event),
luabind::def("unregister_npc_event", (void(*)(std::string, int, int)) & lua_unregister_npc_event),
luabind::def("unregister_npc_event", (void(*)(int, int)) & lua_unregister_npc_event),
luabind::def("register_player_event", (void(*)(std::string, int, luabind::adl::object)) & lua_register_player_event),
luabind::def("register_player_event", (void(*)(int, luabind::adl::object)) & lua_register_player_event),
luabind::def("unregister_player_event", (void(*)(std::string, int)) & lua_unregister_player_event),
luabind::def("unregister_player_event", (void(*)(int)) & lua_unregister_player_event),
luabind::def("register_item_event", (void(*)(std::string, int, int, luabind::adl::object)) & lua_register_item_event),
luabind::def("register_item_event", (void(*)(int, int, luabind::adl::object)) & lua_register_item_event),
luabind::def("unregister_item_event", (void(*)(std::string, int, int)) & lua_unregister_item_event),
luabind::def("unregister_item_event", (void(*)(int, int)) & lua_unregister_item_event),
luabind::def("register_spell_event", (void(*)(std::string, int, int, luabind::adl::object func)) & lua_register_spell_event),
luabind::def("register_spell_event", (void(*)(int, int, luabind::adl::object func)) & lua_register_spell_event),
luabind::def("unregister_spell_event", (void(*)(std::string, int, int)) & lua_unregister_spell_event),
luabind::def("unregister_spell_event", (void(*)(int, int)) & lua_unregister_spell_event),
luabind::def("spawn2", (Lua_Mob(*)(int, int, int, double, double, double, double)) & lua_spawn2),
luabind::def("unique_spawn", (Lua_Mob(*)(int, int, int, double, double, double)) & lua_unique_spawn),
luabind::def("unique_spawn", (Lua_Mob(*)(int, int, int, double, double, double, double)) & lua_unique_spawn),
@@ -2911,11 +2942,11 @@ luabind::scope lua_register_general() {
luabind::scope lua_register_random() {
return luabind::namespace_("Random")
[
luabind::def("Int", &random_int),
luabind::def("Real", &random_real),
luabind::def("Roll", &random_roll_int),
luabind::def("RollReal", &random_roll_real),
luabind::def("Roll0", &random_roll0)
luabind::def("Int", &lua_random_int),
luabind::def("Real", &lua_random_real),
luabind::def("Roll", &lua_random_roll_int),
luabind::def("RollReal", &lua_random_roll_real),
luabind::def("Roll0", &lua_random_roll0)
];
}
@@ -3001,7 +3032,9 @@ luabind::scope lua_register_events() {
luabind::value("tick", static_cast<int>(EVENT_TICK)),
luabind::value("spawn_zone", static_cast<int>(EVENT_SPAWN_ZONE)),
luabind::value("death_zone", static_cast<int>(EVENT_DEATH_ZONE)),
luabind::value("use_skill", static_cast<int>(EVENT_USE_SKILL))
luabind::value("use_skill", static_cast<int>(EVENT_USE_SKILL)),
luabind::value("combine_validate", static_cast<int>(EVENT_COMBINE_VALIDATE)),
luabind::value("bot_command", static_cast<int>(EVENT_BOT_COMMAND))
];
}
@@ -3487,17 +3520,17 @@ luabind::scope lua_register_rules_const() {
.enum_("constants")
[
#define RULE_INT(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Int__##rule),
luabind::value(#cat #rule, RuleManager::Int__##cat__##rule),
#include "../common/ruletypes.h"
luabind::value("_IntRuleCount", RuleManager::_IntRuleCount),
#undef RULE_INT
#define RULE_REAL(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Real__##rule),
luabind::value(#rule, RuleManager::Real__##cat__##rule),
#include "../common/ruletypes.h"
luabind::value("_RealRuleCount", RuleManager::_RealRuleCount),
#undef RULE_REAL
#define RULE_BOOL(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Bool__##rule),
luabind::value(#rule, RuleManager::Bool__##cat__##rule),
#include "../common/ruletypes.h"
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
];
@@ -3506,21 +3539,21 @@ luabind::scope lua_register_rules_const() {
luabind::scope lua_register_rulei() {
return luabind::namespace_("RuleI")
[
luabind::def("Get", &get_rulei)
luabind::def("Get", &lua_get_rulei)
];
}
luabind::scope lua_register_ruler() {
return luabind::namespace_("RuleR")
[
luabind::def("Get", &get_ruler)
luabind::def("Get", &lua_get_ruler)
];
}
luabind::scope lua_register_ruleb() {
return luabind::namespace_("RuleB")
[
luabind::def("Get", &get_ruleb)
luabind::def("Get", &lua_get_ruleb)
];
}
+532 -507
View File
File diff suppressed because it is too large Load Diff