Browse Source

Cleanup of new gate code. Added messages when a gate fails due to location disabled. Modified the call to home lua to work as expected.

devn00b 1 year ago
parent
commit
d7caa38cd3

+ 4 - 2
EQ2/source/WorldServer/LuaFunctions.cpp

@@ -4479,8 +4479,10 @@ int EQ2Emu_lua_IsGateAllowed(lua_State* state) {
 	if (spawn) {
 		if (spawn->IsPlayer()) {
 			Client* client = spawn->GetZone()->GetClientBySpawn(spawn);
-			if (client)
-				ret = client->GateAllowed();
+			ZoneServer* zone = lua_interface->GetZone(state);
+			if (client && zone){
+					ret = zone->GetCanGate();
+			}
 		}
 	}
 	lua_interface->SetBooleanValue(state, ret);

+ 1 - 1
EQ2/source/WorldServer/client.cpp

@@ -8352,8 +8352,8 @@ void Client::ResetSendMail(bool cancel, bool needslock) {
 
 bool Client::GateAllowed() {
 	ZoneServer* zone = GetCurrentZone();
-	bool cangate = zone->GetCanGate();
 	if (zone){ 
+	bool cangate = zone->GetCanGate();
 	return cangate;
 	}
 		

+ 10 - 1
server/Spells/Commoner/CalltoHome.lua

@@ -9,10 +9,19 @@
 -- Teleports you to your recall point.
 function precast(Caster, Target)
     if GetBoundZoneID(Caster) == 0 then
+        SendMessage(Caster, "You are a failure", "red")
         return false
     end
 
-    return true
+    if(IsGateAllowed(Caster))
+    then
+        return true   
+    else
+        SendMessage(Caster, "You cannot use Call to Home from this location.", "red")
+        return false
+    end
+
+ return true
 end
 
 function cast(Caster, Target)