View Full Version : shared bank plat?
arkinia
05-03-2008, 01:22 AM
Is shared bank plat not working? It doesn't seem to be on my server.
eski2
05-27-2008, 07:34 AM
it doesn't work on mine either? i use minilogin if that's relevant?
AndMetal
05-27-2008, 12:35 PM
This has actually been discussed a few (http://www.eqemulator.net/forums/showthread.php?t=15497) times (http://www.eqemulator.net/forums/showthread.php?t=24682&highlight=Shared+Bank), 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.
Kayot
05-27-2008, 01:57 PM
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.
AndMetal
05-27-2008, 02:07 PM
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).
Knightly
05-27-2008, 04:09 PM
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.
Theeper
07-30-2008, 09:43 PM
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.
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
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
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_a dd);
}
}
4. In zone/zonedb.cpp at line 706, add
uint32 char_id = atoi(row[0]);
pp->platinum_shared = database.GetSharedPlatinum(GetAccountIDByChar(char _id));
Any thoughts ?
trevius
07-30-2008, 10:40 PM
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 :D
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.