Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2009, 03:09 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,165
Default keyring quest fuctions (check&add)

Code:
Index: EQEmuServer/zone/perl_client.cpp
===================================================================
--- EQEmuServer/zone/perl_client.cpp	(revision 885)
+++ EQEmuServer/zone/perl_client.cpp	(working copy)
@@ -3957,10 +3957,61 @@
 	XSRETURN_EMPTY;
 }
 
+XS(XS_Client_KeyRingAdd);
+XS(XS_Client_KeyRingAdd)
+{
+	dXSARGS;
+	if (items != 2)
+		Perl_croak(aTHX_ "Usage: Client::KeyRingAdd(THIS, item_id)");
+	{
+		Client *	THIS;
+		dXSTARG;
+		uint32		item_id = (uint32)SvUV(ST(1));
 
-		
+		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->KeyRingAdd(item_id);;
+	}
+	XSRETURN_EMPTY;
+}
 
+XS(XS_Client_KeyRingCheck);
+XS(XS_Client_KeyRingCheck)
+{
+	dXSARGS;
+	if (items != 2)
+		Perl_croak(aTHX_ "Usage: Client::KeyRingCheck(THIS, item_id)");
+	{
+		Client *	THIS;
+		bool		RETVAL;
+		dXSTARG;
+		uint32		item_id = (uint32)SvUV(ST(1));
+
+		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.");
+
+		RETVAL = THIS->KeyRingCheck(item_id);;
+		ST(0) = boolSV(RETVAL);
+		sv_2mortal(ST(0));
+	}
+	XSRETURN(1);
+}
+
+
+
 #ifdef __cplusplus
 extern "C"
 #endif
@@ -4127,6 +4178,8 @@
 		newXSproto(strcpy(buf, "GetAugmentAt"), XS_Client_GetAugmentAt, file, "$$$");
 		newXSproto(strcpy(buf, "GetStartZone"), XS_Client_GetStartZone, file, "$");
 		newXSproto(strcpy(buf, "SetStartZone"), XS_Client_SetStartZone, file, "$$");
+		newXSproto(strcpy(buf, "KeyRingAdd"), XS_Client_KeyRingAdd, file, "$$");
+		newXSproto(strcpy(buf, "KeyRingCheck"), XS_Client_KeyRingCheck, file, "$$");
 		
 	XSRETURN_YES;
 }
This allows you to manipulate the key ring via quests!, will post example of skyfire/player.pl to handle clicking into VP

Code:
sub EVENT_CLICKDOOR {
   if(($doorid == 232 || $doorid == 488) && !defined $qglobals{dragon_not_ready}) {
     quest::setglobal("door_one",1,3,"S60");
     $client->Message(4,"The globe begins to spin faster and faster...");
     }
   if(($doorid == 1 || $doorid == 257) && !defined $qglobals{dragon_not_ready}) {
     quest::setglobal("door_two",1,3,"S60");
     $client->Message(4,"The globe begins to spin faster and faster...");
     }
   if(($doorid == 2 || $doorid == 258) && !defined $qglobals{dragon_not_ready}) {
     quest::setglobal("door_three",1,3,"S60");
     $client->Message(4,"The globe begins to spin faster and faster...");
     }
   if(($doorid == 3 || $doorid == 259) && !defined $qglobals{dragon_not_ready}) {
     quest::setglobal("door_four",1,3,"S60");
     $client->Message(4,"The globe begins to spin faster and faster...");
     }
   if(($doorid == 232 || $doorid == 488) && $dragon_not_ready == 1) {
     $client->Message(4,"The globe does not seem to do anything");
     }
   if(($doorid == 1 || $doorid == 257) && $dragon_not_ready == 1) {
     $client->Message(4,"The globe does not seem to do anything");
     }
   if(($doorid == 2 || $doorid == 258) && $dragon_not_ready == 1) {
     $client->Message(4,"The globe does not seem to do anything");
     }
   if(($doorid == 3 || $doorid == 259) && $dragon_not_ready == 1) {
     $client->Message(4,"The globe does not seem to do anything");
     }
   if($doorid == 135 || $doorid == 391){
      if($client->KeyRingCheck(69311)) {
		quest::movepc(108,1682,41,25.9);
	  }
	  elsif(plugin::check_hasitem($client, 69311) || plugin::check_hasitem($client, 69312)) {
	    $client->KeyRingAdd(69311);
        quest::movepc(108,1682,41,25.9);
      }
    elsif($doorid == 135 || $doorid == 391){
     $client->Message(13, "You lack the will to use this object!");
  }
 }
}
basically the structure is to check if you have the item in your keyring, then zone you in, and if not, check if you have the item, add it and then move you

I know the VP one is a little tricky do to it have two different keys, but I just went with doing one of them since it's easier and to the keyring thing it doesn't really matter :/

This can also be applied to other zones that have a keyring but don't currently handle correctly due to it being done in perl.

basic structure:

Code:
if($doorid == door_id) {
	if($client->KeyRingCheck(key_item_id)) {
		quest::movepc(stuffs);
	}
	elsif((plugin::check_hasitem($client, key_item_id)) {
		$client->KeyRingAdd(key_item_id);
		quest::movepc(stuffs);
	}
}
that would go into the player.pl
Reply With Quote
  #2  
Old 08-08-2009, 10:07 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Committed in Rev 903.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:26 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3