Rd 1 of setting up bind location checks. Run SQL Update.
This commit is contained in:
parent
38fbba1845
commit
f3526e14de
8 changed files with 80 additions and 5 deletions
33
DB/updates/canbind_jun14_2022.sql
Normal file
33
DB/updates/canbind_jun14_2022.sql
Normal file
|
@ -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;
|
|
@ -11044,6 +11044,30 @@ int EQ2Emu_lua_GetZoneHolidayFlag(lua_State* state) {
|
||||||
return 0;
|
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) {
|
int EQ2Emu_lua_AddSpawnProximity(lua_State* state) {
|
||||||
if (!lua_interface)
|
if (!lua_interface)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -505,6 +505,9 @@ int EQ2Emu_lua_GetZoneExpansionFlag(lua_State* state);
|
||||||
int EQ2Emu_lua_SetZoneHolidayFlag(lua_State* state);
|
int EQ2Emu_lua_SetZoneHolidayFlag(lua_State* state);
|
||||||
int EQ2Emu_lua_GetZoneHolidayFlag(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_AddSpawnProximity(lua_State* state);
|
||||||
|
|
||||||
int EQ2Emu_lua_CanSeeInvis(lua_State* state);
|
int EQ2Emu_lua_CanSeeInvis(lua_State* state);
|
||||||
|
|
|
@ -1364,6 +1364,9 @@ void LuaInterface::RegisterFunctions(lua_State* state) {
|
||||||
lua_register(state, "GetZoneExpansionFlag", EQ2Emu_lua_GetZoneExpansionFlag);
|
lua_register(state, "GetZoneExpansionFlag", EQ2Emu_lua_GetZoneExpansionFlag);
|
||||||
lua_register(state, "SetZoneHolidayFlag", EQ2Emu_lua_SetZoneHolidayFlag);
|
lua_register(state, "SetZoneHolidayFlag", EQ2Emu_lua_SetZoneHolidayFlag);
|
||||||
lua_register(state, "GetZoneHolidayFlag", EQ2Emu_lua_GetZoneHolidayFlag);
|
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);
|
lua_register(state, "AddSpawnProximity", EQ2Emu_lua_AddSpawnProximity);
|
||||||
|
|
||||||
|
|
|
@ -2698,7 +2698,7 @@ void WorldDatabase::LoadZoneInfo(ZoneServer* zone){
|
||||||
Query query;
|
Query query;
|
||||||
int32 ruleset_id;
|
int32 ruleset_id;
|
||||||
char* escaped = getEscapeString(zone->GetZoneName());
|
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) {
|
if(result && mysql_num_rows(result) > 0) {
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
row = mysql_fetch_row(result);
|
row = mysql_fetch_row(result);
|
||||||
|
@ -2744,6 +2744,7 @@ void WorldDatabase::LoadZoneInfo(ZoneServer* zone){
|
||||||
else
|
else
|
||||||
zone->SetupInstance(zone->GetInstanceID());
|
zone->SetupInstance(zone->GetInstanceID());
|
||||||
}
|
}
|
||||||
|
zone->SetCanBind(atoul(row[23]));
|
||||||
}
|
}
|
||||||
safe_delete_array(escaped);
|
safe_delete_array(escaped);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8355,13 +8355,18 @@ bool Client::GateAllowed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::BindAllowed() {
|
bool Client::BindAllowed() {
|
||||||
|
ZoneServer* zone = GetCurrentZone();
|
||||||
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__);
|
// int canbind;
|
||||||
|
bool canbind = zone->GetCanBind();
|
||||||
return true;
|
return canbind;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::Bind() {
|
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()->SetBindZone(GetCurrentZone()->GetZoneID());
|
||||||
player->GetPlayerInfo()->SetBindX(player->GetX());
|
player->GetPlayerInfo()->SetBindX(player->GetX());
|
||||||
player->GetPlayerInfo()->SetBindY(player->GetY());
|
player->GetPlayerInfo()->SetBindY(player->GetY());
|
||||||
|
|
|
@ -160,6 +160,7 @@ ZoneServer::ZoneServer(const char* name, bool incoming_clients) {
|
||||||
reloading_spellprocess = false;
|
reloading_spellprocess = false;
|
||||||
expansion_flag = 0;
|
expansion_flag = 0;
|
||||||
holiday_flag = 0;
|
holiday_flag = 0;
|
||||||
|
can_bind = 1;
|
||||||
MMasterZoneLock = new CriticalSection(MUTEX_ATTRIBUTE_RECURSIVE);
|
MMasterZoneLock = new CriticalSection(MUTEX_ATTRIBUTE_RECURSIVE);
|
||||||
|
|
||||||
pathing = nullptr;
|
pathing = nullptr;
|
||||||
|
|
|
@ -592,6 +592,9 @@ public:
|
||||||
|
|
||||||
int32 GetHolidayFlag() { return holiday_flag; }
|
int32 GetHolidayFlag() { return holiday_flag; }
|
||||||
void SetHolidayFlag(int32 val) { holiday_flag = val; }
|
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);
|
void RemoveClientImmediately(Client* client);
|
||||||
|
|
||||||
|
@ -905,6 +908,8 @@ private:
|
||||||
int32 spawn_delete_timer;
|
int32 spawn_delete_timer;
|
||||||
int32 expansion_flag;
|
int32 expansion_flag;
|
||||||
int32 holiday_flag;
|
int32 holiday_flag;
|
||||||
|
//devn00b:test
|
||||||
|
int can_bind;
|
||||||
map<int16, PacketStruct*> versioned_pos_structs;
|
map<int16, PacketStruct*> versioned_pos_structs;
|
||||||
map<int16, PacketStruct*> versioned_info_structs;
|
map<int16, PacketStruct*> versioned_info_structs;
|
||||||
map<int16, PacketStruct*> versioned_vis_structs;
|
map<int16, PacketStruct*> versioned_vis_structs;
|
||||||
|
|
Loading…
Reference in a new issue