View Single Post
  #1  
Old 07-30-2011, 02:29 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default COMMITTED: $client->Freeze(); $client->UnFreeze();

Very simple implementation of the already #command made function.

All it is, is a appearance packet setting anim to 102 completely freezing the client, keeping it from targeting or doing anything. I am using this for cut scene purposes and you can easily implement this into events to keep players from doing anything. You will need to UnFreeze them.

I thought about merging it into one object but thought it would be less confusing this way.

Code:
Index: EQEmuServer/zone/perl_client.cpp
===================================================================
--- EQEmuServer/zone/perl_client.cpp	(revision 1989)
+++ EQEmuServer/zone/perl_client.cpp	(working copy)
@@ -4813,6 +4813,53 @@
 	XSRETURN_EMPTY;
 }
 
+
+XS(XS_Client_Freeze);
+XS(XS_Client_Freeze)
+{
+	dXSARGS;
+	if (items != 1)
+		Perl_croak(aTHX_ "Usage: Client:Freeze(THIS)");
+	{
+		Client *	THIS;
+
+		if (sv_derived_from(ST(0), "Client")) {
+			IV tmp = SvIV((SV*)SvRV(ST(0)));
+			THIS = INT2PTR(Client *,tmp);
+		}
+		else
+			Perl_croak(aTHX_ "THIS is not of type Client");
+		if(THIS == NULL)
+			Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
+
+		THIS->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
+	}
+	XSRETURN_EMPTY;
+}
+
+XS(XS_Client_UnFreeze);
+XS(XS_Client_UnFreeze)
+{
+	dXSARGS;
+	if (items != 1)
+		Perl_croak(aTHX_ "Usage: Client:UnFreeze(THIS)");
+	{
+		Client *	THIS;
+
+		if (sv_derived_from(ST(0), "Client")) {
+			IV tmp = SvIV((SV*)SvRV(ST(0)));
+			THIS = INT2PTR(Client *,tmp);
+		}
+		else
+			Perl_croak(aTHX_ "THIS is not of type Client");
+		if(THIS == NULL)
+			Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
+
+		THIS->SendAppearancePacket(AT_Anim, ANIM_STAND);
+	}
+	XSRETURN_EMPTY;
+}
+
 XS(XS_Client_GetFreeSpellBookSlot); /* prototype to pass -Wmissing-prototypes */
 XS(XS_Client_GetFreeSpellBookSlot)
 {
@@ -5328,6 +5375,8 @@
 		newXSproto(strcpy(buf, "GetAALevel"), XS_Client_GetAALevel, file, "$$");
 		newXSproto(strcpy(buf, "MarkCompassLoc"), XS_Client_MarkCompassLoc, file, "$$$$");
 		newXSproto(strcpy(buf, "ClearCompassMark"), XS_Client_ClearCompassMark, file, "$");
+		newXSproto(strcpy(buf, "Freeze"), XS_Client_Freeze, file, "$");
+		newXSproto(strcpy(buf, "UnFreeze"), XS_Client_UnFreeze, file, "$");
 		newXSproto(strcpy(buf, "GetFreeSpellBookSlot"), XS_Client_GetFreeSpellBookSlot, file, "$;$");
 		newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$");
 		newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$");
Reply With Quote