Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-03-2008, 01:22 AM
arkinia
Fire Beetle
 
Join Date: Apr 2008
Location: California, USA
Posts: 27
Default shared bank plat?

Is shared bank plat not working? It doesn't seem to be on my server.
Reply With Quote
  #2  
Old 05-27-2008, 07:34 AM
eski2
Hill Giant
 
Join Date: May 2008
Location: sydney
Posts: 177
Default

it doesn't work on mine either? i use minilogin if that's relevant?
Reply With Quote
  #3  
Old 05-27-2008, 12:35 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

This has actually been discussed a few times, but the bottom line is that shared items work, but shared plat doesn't transfer across characters. It currently stores it in a character's profile, so it will be there when you log in & out of that character, but won't be available to anyone else.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #4  
Old 05-27-2008, 01:57 PM
Kayot
Discordant
 
Join Date: Sep 2006
Location: Subsection 185.D354 C.12
Posts: 346
Default

I've been wondering, why doesn't any one fix this?

I'd work on it, but for one the source confuses me as nothing is were it should be.

Metal, do you know where the SQL readers are located for the character? Which files I mean.
__________________
If at first you don't succeed destroy all evidence that you ever tried.

God doesn't give second chances... Hell, he sets you up the first time.
Reply With Quote
  #5  
Old 05-27-2008, 02:07 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by Kayot View Post
Metal, do you know where the SQL readers are located for the character? Which files I mean.
You mean where it pulls the structure for the profile?

I have an idea on a workaround for the shared plat, but I don't really have any time to talk it out right now (about to head out).
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #6  
Old 05-27-2008, 04:09 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default

Ideally, we could change all shared plat to reference the account database rather than the profile blob. That would allow administrators to manipulate the field easily.

However, from AndMetal's post, it sounds like the profile blob is already setup to store the information...so my workaround ideas are below.

On a one character login per account server, the Shared Plat theory sounds like it would work like this:
When the profile blob changes with regard to shared plat, update the database field sharedplat for the account to reflect the new amount of money.
When a character logs in, copy the database information for shared plat into their profile blob.

However, since most eqemulator servers allow you to log in multiple characters, this would not work (one character would end up with a profile blob of one number and the other character would have a separate profile blob with a different number).

I would think that the multiple character theory would be:
When the profile blob changes with regard to shared plat, do A & B:
A.) Update the database field sharedplat for the account to reflect the new amount of money.
B.) Update all character profile blobs to reflect the shared plat change.
When a character logs in, copy the database information for shared plat into their profile blob.

However, I don't know much about profiles so I don't know if online characters would need to be forced to read the change or what.
Reply With Quote
  #7  
Old 07-30-2008, 09:43 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

I was thinking about shared plat the other night and how to keep people from duping shared plat on servers that allow more than one login per account like Knightly mentioned. I wrote up a simple hack to make it use the account table, but it does allow duping when you login two toons on the same account, as expected.

I thought I'd post this and see what you guys think is the best way to fix it.

Basically, it's two functions which get and set the shared plat value in the profile from the shared_plat field in the account table. When you zone or click on coins in the shared bank slot, the profile value is updated prior to the 'move coin' action happening. The plat is still stored in the profile, it's just updated from the DB before calculating how much to move.

This all works fine for single logins, but again, will allow duping with multiple logins. I tested it with 1018 and 1019 and it seems to work fine. Don't run this on your live server though, as it will set everyone's shared plat to whatever is in their shared_plat field in the DB.

To eliminate duping, I'm thinking we need to send a packet telling the client to delete the coins on the cursor when the server says the count is wrong. I'm guessing that the reason shared items go poof if you try to dupe them in the bank window is because they are instanced in the DB. For coins, the client seems to ignore what is in the profile and will 'pick up' whatever amount the bank window shows even if the shared plat value is zero.


1. Prototype the two new functions. Add the parts in red into common/shareddb.h at line 40.

Code:
	sint32	DeleteStalePlayerCorpses();
	sint32	DeleteStalePlayerBackups();
	bool	SetSharedPlatinum(uint32 account_id, sint32 amount_to_add);
	uint32	GetSharedPlatinum(uint32 account_id);
2. Then add the functions to common/shareddb.cpp at line 46

Code:

uint32 SharedDatabase::GetSharedPlatinum(int32 account_id)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;
	if (RunQuery(query, MakeAnyLenString(&query, "SELECT sharedplat FROM account WHERE id='%i'", account_id), errbuf, &result)) {
		safe_delete_array(query);
		if (mysql_num_rows(result) == 1)
		{
			row = mysql_fetch_row(result);
			uint32 shared_platinum = atoi(row[0]);
			mysql_free_result(result);
			return shared_platinum;
		}
		else
		{
			mysql_free_result(result);
			return 0;
		}
		mysql_free_result(result);
	}
	else
	{
		
		cerr << "Error in GetSharedPlatinum query '" << query << "' " << errbuf << endl;
		safe_delete_array(query);
		return false;
	}
	
	return 0;
}

bool SharedDatabase::SetSharedPlatinum(uint32 account_id, sint32 amount_to_add)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;

	if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id), errbuf)) {
		cerr << "Error in SetSharedPlatinum query '" << query << "' " << errbuf << endl;
		safe_delete_array(query);
		return false;
	}
	
	safe_delete_array(query);
	return true;
}
3. In zone/clientprocess.cpp at line 1280, add
Code:
	if(to_bucket)
	{
		if(*to_bucket + amount_to_add > *to_bucket)	// overflow check
			*to_bucket += amount_to_add;

		if (to_bucket == &m_pp.platinum_shared || from_bucket == &m_pp.platinum_shared)
		{
			if (from_bucket == &m_pp.platinum_shared) 
				amount_to_add = 0 - amount_to_take;

			database.SetSharedPlatinum(AccountID(),amount_to_add);
		}

	}

4. In zone/zonedb.cpp at line 706, add
Code:
		uint32 char_id = atoi(row[0]);
		pp->platinum_shared = database.GetSharedPlatinum(GetAccountIDByChar(char_id));

Any thoughts ?
Reply With Quote
  #8  
Old 07-30-2008, 10:40 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Personally, I think the best fix would be for someone to make a rule that would allow admins to toggle on or off the option of logging in more than 1 character from a single account at the same time. This is something I have wanted for a while anyway and resolves a couple of issues. Not to mention, it is much easier on the players, since if they are botting from the same account at the same time, they are getting disconnected almost every time they zone on at least 1 character. This would work the same way live does and I think it would be helpful to resolve a few things.

It would be nice to see a rule for this to enable or disable the setting and maybe even a minimum account status setting to be exempt from the rule as well.

I think this would resolve your plat duping issue and so it would basically kill 2 birds with 1 stone. And, I don't think the code would be way too bad to write. I might even be able to figure it out by using the IP limiting code that TheLieka posted as an example. Though, my coding skills are still gimp, so if someone else can do it, that would be great
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 11:45 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3