diff --git a/DB/updates/canbind_jun14_2022.sql b/DB/updates/canbind_jun14_2022.sql new file mode 100644 index 000000000..58f2adca8 --- /dev/null +++ b/DB/updates/canbind_jun14_2022.sql @@ -0,0 +1,33 @@ +ALTER TABLE `zones` ADD COLUMN `can_bind` INT NULL DEFAULT '0' AFTER `sky_file`; + +UPDATE `zones` SET `can_bind`='1' WHERE `id`=46; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=114; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=128; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=134; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=135; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=136; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=137; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=138; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=139; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=144; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=166; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=168; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=184; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=221; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=222; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=231; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=233; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=234; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=235; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=236; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=237; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=238; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=470; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=589; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=644; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=645; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=646; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=647; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=648; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=649; +UPDATE `zones` SET `can_bind`='1' WHERE `id`=660; diff --git a/EQ2/source/WorldServer/LuaFunctions.cpp b/EQ2/source/WorldServer/LuaFunctions.cpp index 91343d989..e7dafc829 100644 --- a/EQ2/source/WorldServer/LuaFunctions.cpp +++ b/EQ2/source/WorldServer/LuaFunctions.cpp @@ -11044,6 +11044,30 @@ int EQ2Emu_lua_GetZoneHolidayFlag(lua_State* state) { return 0; } +//devn00b test +int EQ2Emu_lua_SetCanBind(lua_State* state) { + if (!lua_interface) + return 0; + Spawn* player = lua_interface->GetSpawn(state); + ZoneServer* zone = player->GetZone(); + bool canbind = lua_interface->GetInt32Value(state, 2); + if (zone) + zone->SetCanBind(canbind); + return 0; +} + +int EQ2Emu_lua_GetCanBind(lua_State* state) { + if (!lua_interface) + return 0; + Spawn* player = lua_interface->GetSpawn(state); + ZoneServer* zone = player->GetZone(); + if (zone) { + lua_interface->SetInt32Value(state, zone->GetCanBind()); + return 1; + } + return 0; +} + int EQ2Emu_lua_AddSpawnProximity(lua_State* state) { if (!lua_interface) return 0; diff --git a/EQ2/source/WorldServer/LuaFunctions.h b/EQ2/source/WorldServer/LuaFunctions.h index 666c84cb9..10b1bccf4 100644 --- a/EQ2/source/WorldServer/LuaFunctions.h +++ b/EQ2/source/WorldServer/LuaFunctions.h @@ -505,6 +505,9 @@ int EQ2Emu_lua_GetZoneExpansionFlag(lua_State* state); int EQ2Emu_lua_SetZoneHolidayFlag(lua_State* state); int EQ2Emu_lua_GetZoneHolidayFlag(lua_State* state); +int EQ2Emu_lua_SetCanBind(lua_State* state); +int EQ2Emu_lua_GetCanBind(lua_State* state); + int EQ2Emu_lua_AddSpawnProximity(lua_State* state); int EQ2Emu_lua_CanSeeInvis(lua_State* state); diff --git a/EQ2/source/WorldServer/LuaInterface.cpp b/EQ2/source/WorldServer/LuaInterface.cpp index 0e0254d76..3706a20a3 100644 --- a/EQ2/source/WorldServer/LuaInterface.cpp +++ b/EQ2/source/WorldServer/LuaInterface.cpp @@ -1364,6 +1364,9 @@ void LuaInterface::RegisterFunctions(lua_State* state) { lua_register(state, "GetZoneExpansionFlag", EQ2Emu_lua_GetZoneExpansionFlag); lua_register(state, "SetZoneHolidayFlag", EQ2Emu_lua_SetZoneHolidayFlag); lua_register(state, "GetZoneHolidayFlag", EQ2Emu_lua_GetZoneHolidayFlag); + + lua_register(state, "SetCanBind", EQ2Emu_lua_SetCanBind); + lua_register(state, "GetCanBind", EQ2Emu_lua_GetCanBind); lua_register(state, "AddSpawnProximity", EQ2Emu_lua_AddSpawnProximity); diff --git a/EQ2/source/WorldServer/WorldDatabase.cpp b/EQ2/source/WorldServer/WorldDatabase.cpp index 3d50d9854..6c9f97264 100644 --- a/EQ2/source/WorldServer/WorldDatabase.cpp +++ b/EQ2/source/WorldServer/WorldDatabase.cpp @@ -2698,7 +2698,7 @@ void WorldDatabase::LoadZoneInfo(ZoneServer* zone){ Query query; int32 ruleset_id; char* escaped = getEscapeString(zone->GetZoneName()); - MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, file, description, underworld, safe_x, safe_y, safe_z, min_status, min_level, max_level, instance_type+0, shutdown_timer, zone_motd, default_reenter_time, default_reset_time, default_lockout_time, force_group_to_zone, safe_heading, xp_modifier, ruleset_id, expansion_id, weather_allowed, sky_file FROM zones where name='%s'",escaped); + MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT id, file, description, underworld, safe_x, safe_y, safe_z, min_status, min_level, max_level, instance_type+0, shutdown_timer, zone_motd, default_reenter_time, default_reset_time, default_lockout_time, force_group_to_zone, safe_heading, xp_modifier, ruleset_id, expansion_id, weather_allowed, sky_file, can_bind FROM zones where name='%s'",escaped); if(result && mysql_num_rows(result) > 0) { MYSQL_ROW row; row = mysql_fetch_row(result); @@ -2744,6 +2744,7 @@ void WorldDatabase::LoadZoneInfo(ZoneServer* zone){ else zone->SetupInstance(zone->GetInstanceID()); } + zone->SetCanBind(atoul(row[23])); } safe_delete_array(escaped); } diff --git a/EQ2/source/WorldServer/client.cpp b/EQ2/source/WorldServer/client.cpp index db4876797..929cfef58 100644 --- a/EQ2/source/WorldServer/client.cpp +++ b/EQ2/source/WorldServer/client.cpp @@ -8355,13 +8355,18 @@ bool Client::GateAllowed() { } bool Client::BindAllowed() { - - LogWrite(MISC__TODO, 1, "TODO", "possibly add a check here to see if a player is allowed to bind in this spot, allow anywhere for now\nfile: %s, func: %s, line: %i", __FILE__, __FUNCTION__, __LINE__); - - return true; + ZoneServer* zone = GetCurrentZone(); +// int canbind; + bool canbind = zone->GetCanBind(); + return canbind; } bool Client::Bind() { + int canbind = BindAllowed(); + cout << "\n\n--------------------DEV2------------------- [" << canbind << "]\n\n"; + if(canbind == 0) { + return false; + } player->GetPlayerInfo()->SetBindZone(GetCurrentZone()->GetZoneID()); player->GetPlayerInfo()->SetBindX(player->GetX()); player->GetPlayerInfo()->SetBindY(player->GetY()); diff --git a/EQ2/source/WorldServer/zoneserver.cpp b/EQ2/source/WorldServer/zoneserver.cpp index 1a7e2f5e5..332b0c0f0 100644 --- a/EQ2/source/WorldServer/zoneserver.cpp +++ b/EQ2/source/WorldServer/zoneserver.cpp @@ -160,6 +160,7 @@ ZoneServer::ZoneServer(const char* name, bool incoming_clients) { reloading_spellprocess = false; expansion_flag = 0; holiday_flag = 0; + can_bind = 1; MMasterZoneLock = new CriticalSection(MUTEX_ATTRIBUTE_RECURSIVE); pathing = nullptr; diff --git a/EQ2/source/WorldServer/zoneserver.h b/EQ2/source/WorldServer/zoneserver.h index 38be0ee16..c7773fc3a 100644 --- a/EQ2/source/WorldServer/zoneserver.h +++ b/EQ2/source/WorldServer/zoneserver.h @@ -592,6 +592,9 @@ public: int32 GetHolidayFlag() { return holiday_flag; } void SetHolidayFlag(int32 val) { holiday_flag = val; } +//devn00b test + int32 GetCanBind() { return can_bind; } + void SetCanBind(int32 val) { can_bind = val; } void RemoveClientImmediately(Client* client); @@ -905,6 +908,8 @@ private: int32 spawn_delete_timer; int32 expansion_flag; int32 holiday_flag; + //devn00b:test + int can_bind; map versioned_pos_structs; map versioned_info_structs; map versioned_vis_structs;