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

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-16-2008, 07:57 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default quest::collectitems

all credit for this goes to aza77, i'm just post it before it gets lost:

questmgr.cpp

Code:
int QuestManager::collectitems_processSlot(sint16 slot_id, uint32 item_id,
	bool remove)
{
	ItemInst *item;
	int quantity = 0;
 
	item = initiator->GetInv().GetItem(slot_id);
 
	// If we have found matching item, add quantity
	if (item && item->GetID() == item_id)
	{
		// If item is stackable, add its charges (quantity)
		if (item->IsStackable())
		{
			quantity = item->GetCharges();
		}
		else
		{
			quantity = 1;
		}
 
		// Remove item from inventory
		if (remove)
		{
			initiator->DeleteItemInInventory(slot_id, 0, true);
		}
	}
 
	return quantity;
}
 
// Returns number of item_id that exist in inventory
// If remove is true, items are removed as they are counted.
int QuestManager::collectitems(uint32 item_id, bool remove)
{
	int quantity = 0;
	int slot_id;
 
	for (slot_id = 22; slot_id <= 29; ++slot_id)
	{
		quantity += collectitems_processSlot(slot_id, item_id, remove);
	}
 
	for (slot_id = 251; slot_id <= 330; ++slot_id)
	{
		quantity += collectitems_processSlot(slot_id, item_id, remove);
	}
 
	return quantity;
}
questmgr.h non-protected area:

Code:
int collectitems(uint32 item_id, bool remove);
int collectitems_processSlot(sint16 slot_id, uint32 item_id, bool remove);
perlparser.cpp

Code:
XS(XS__collectitems);
XS(XS__collectitems)
{
	dXSARGS;
	if (items != 2)
		Perl_croak(aTHX_ "Usage: collectitems(item_id, remove?)");
	
	uint32 item_id = (int)SvIV(ST(0));
	bool remove = ((int)SvIV(ST(1))) == 0?false:true;

	int quantity =
		quest_manager.collectitems(item_id, remove);

	XSRETURN_IV(quantity);
}
let me know if i'm missing anything. I think I got it all, though..

example of how it would work in a script:

Code:
sub EVENT_SAY {
my $itemstotake = quest::collectitems(1337, 0);
my $credittostore = $qglobals{credit} ? $qglobals{credit} : 0;
if($text=~/hail/i)
{
$credittostore += $itemstotake;
quest::collectitems(1337, 1);
quest::setglobal("credit", $credittostore, 5, "F");
quest::say("Ha! I will take all those items off you now, and tell you how many I have taken, while storing it in a global that adds items to itself! All at once! Muhahaha!");
quest::say("You now have $credittostore items!");
}
}
hopefully that's not too confusing on how to use it.

the script basically takes items from your character, or counts how many you have if you specify 0 on the remove flag. pretty neat command.
have fun!
  #2  
Old 01-06-2009, 07:30 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Great piece of code, thanks Secrets!
Nice to see code submissions coming in still -

As for this;
Quote:
This is the reason that the user gave:
This person has directly stolen code from the Raid Addicts source code.. He was a paid employee of Raid Addicts and was able to get this out of our source.. Azamorra donated this source to my server and told me to not give it to anyone else DIRECTLY... * Please delete this post and warn this user.. He has been fired from my project...
If I started to feel this way about code and submissions, then I'd stop submitting code to the SVN.
I hate to think ANYONE is hoarding code, since all other people here do is give away their best in code, time and work - Personally, If I were hoarding anything EqEmu related, I would feel ashamed.
  #3  
Old 01-06-2009, 12:05 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Quote:
Originally Posted by Angelox View Post
Great piece of code, thanks Secrets!
Nice to see code submissions coming in still -

As for this;


If I started to feel this way about code and submissions, then I'd stop submitting code to the SVN.
I hate to think ANYONE is hoarding code, since all other people here do is give away their best in code, time and work - Personally, If I were hoarding anything EqEmu related, I would feel ashamed.
To me, that quote sounds like you're saying RA applies changes to the EQEmu source and doesn't give it back to the project... which breaks the agreement set in the GPL, which this project uses...
  #4  
Old 01-06-2009, 12:48 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by KingMort
This person has directly stolen code from the Raid Addicts source code.. He was a paid employee of Raid Addicts and was able to get this out of our source.. Azamorra donated this source to my server and told me to not give it to anyone else DIRECTLY... * Please delete this post and warn this user.. He has been fired from my project...
Yeah, about this guy...

1) How is stealing? As far as I know, you're profiting off of an opensource project, and other people who volunteer to your community.

2) You claim I am a paid employee. I did not sign any contract, I did not fill out a work permit, or any of that. I am a volunteer who you gave money to over paypal. You have no one to blame but yourself.

3) aza77 gave it to your server, however, that was a donation. It's not your code, it's not mine. I submitted it to prevent it from being lost in raid addicts code forever, it's quite useful, you know.

4) Do not delete this post, or warn this user; I have done nothing wrong by contributing code to a GPL project that was kept from it.

I have a long list of lies KingMort has said, such as, "SOE donates to my server", "Sony Developers play and test content here", etc... I could pull up a few quotes from last night too. "I am a registered government business", "I am registered with the state, and you stole from my server, all I have to do is call the Department of Justice to have you fined", etc.

I'm just saying, KingMort, you dedicate almost your entire life to this server in hopes you can profit on another companies' game, yet, you call me out and try and have me arrested because I distribute code on your server to an open-source community whose codebase you use? I find that greedy and selfish, and highly illegal in itself for various reasons.

This guy is a complete lunatic, Angelox. Pay no mind to him.
  #5  
Old 01-06-2009, 01:35 PM
Richardo
Banned
 
Join Date: Oct 2003
Location: Mattmecks Basement
Posts: 546
Default

As soon as KingMort provides me with actual evidence that Aza77 did in fact donate this bit of code ONLY for the use of KMRA. This post stays. As for your threats in the PM you sent me KingMort, you're more than welcome to file a complaint against Secrets. I am not convinced that this is legally your code and I am also not convinced you are telling the complete truth.


It's a damn shame that you can't share such a minuet useful utility to the project that has given you so much.

Last edited by Richardo; 01-06-2009 at 09:51 PM..
  #6  
Old 01-06-2009, 01:44 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

I would also like to present further proof of stealing from a GPL Project.

http://egov.sos.state.or.us/br/pkg_w...&p_print=FALSE

He is a registered business that profits off of a GPL project.

Nice.
  #7  
Old 01-06-2009, 02:13 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

There are a lot of businesses that resell GPL software. As long as he maintains the proper rights and distributes the GPL license, it's fair use.

However, the scope of the source shared is very small and would not be difficult for any competent coder to write so it's not worth arguing once it's been released to public domain.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Closed Thread

Thread Tools
Display Modes

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 10:15 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3