Customizing some very specific things.

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Customizing some very specific things.

Post by atom0s » Tue May 06, 2014 10:47 am

There is no call to just fully delete an account entirely. Front end management is not implemented or done at all by us, and is typically up to the server host to handle.
Look at the lobby server code to see what tables get created when an account is created.
Keep in mind if you do not clean up all the tables properly after deleting an account (and all characters linked to that account) you are going to get database errors or character mishaps that are unwanted.

There is a stored proc to cleanup character data (see triggers.sql) though which can help with part of the cleanup if you just want to kill the character and not the whole account.

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 5:01 pm

Yes it is just the one character not the whole account I want to delete. That is all. There has to be code to delete a specific character, as this is something a client can do in the lobby. I'm pretty sure I can just copy paste that code (might have to import a library) into the code that detects homepoint packet.

Detect homepoint packet.
Detect player is dead.
Force log out the player.
Delete the player's character.

First 3 already coded in, it's the fourth one that I am having trouble finding, don't see any code labled or resembling where we delete player characters. Slowly making my way through it all though.

Edit: Found it -.-;

Code: Select all

//delete char
                uint32 ContentID = RBUFL(session[fd]->rdata, 0x1C);
                uint32 CharID = RBUFL(session[fd]->rdata, 0x20);

                ShowInfo(CL_WHITE"lobbyview_parse" CL_RESET":attempt to delete char:<" CL_WHITE"%d" CL_RESET"> from ip:<%s>\n", CharID, ip2str(sd->client_addr, NULL));

                uint8 sendsize = 0x20;

                LOBBY_ACTION_DONE(ReservePacket);
                unsigned char hash[16];

                md5(ReservePacket, hash, sendsize);
                memcpy(ReservePacket + 12, hash, 16);

                memcpy(session[fd]->wdata, ReservePacket, sendsize);
                WFIFOSET(fd, sendsize);
                RFIFOSKIP(fd, session[fd]->rdata_size);
                RFIFOFLUSH(fd);

                //Выполнение удаления персонажа из основных таблиц
                //Достаточно удалить значение из таблицы chars, все остальное сделает mysql-сервер

                const char *pfmtQuery = "DELETE FROM chars WHERE charid = %i AND accid = %i";
                Sql_Query(SqlHandle, pfmtQuery, CharID, sd->accid);

                break;
			}

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 5:45 pm

Ok I guess literally I can just do

Code: Select all

const char *pfmtQuery = "DELETE FROM chars WHERE charid = %i AND accid = %i";
                Sql_Query(SqlHandle, pfmtQuery, CharID, AccID);
What is the easiest and fastest way to get a character's charid and accid from within the game?

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Customizing some very specific things.

Post by kjLotus » Tue May 06, 2014 9:05 pm

the map server doesn't have accid anywhere

CBaseEntity::id has the charid

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 9:22 pm

Looking at the character list in chars, every character has a unique ID anyways, right? Would

Code: Select all

const char *pfmtQuery = "DELETE FROM chars WHERE charid = %i";
                Sql_Query(SqlHandle, pfmtQuery, Pchar->ID);
Do the job? Or would that give me issues in the future?

I'll try out this code and test if it works...

Code: Select all

		case 0x0B: // homepoint
		{
			if (!PChar->isDead())
				return;

			const char *pfmtQuery = "DELETE FROM chars WHERE charid = %i";
			Sql_Query(SqlHandle, pfmtQuery, PChar->id);

			PChar->status = STATUS_SHUTDOWN;
			PChar->pushPacket(new CServerIPPacket(PChar, 1));

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 9:53 pm

Ok, it works, also found the code to lower death timer from 60 misn to 2 mins. Taking off the skill cap on synthing levels was really easy, now I have one last big thing to figure out, and that's augments.

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Customizing some very specific things.

Post by atom0s » Tue May 06, 2014 10:00 pm

Keep in mind as I said before, the auto-homepoint bug still exists so people may never see that 2minute timer and just get deleted.

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 10:27 pm

I think I am fine with that, it's an annoyance but part of me doesn't even want to have a timer period.

Now, does anyone know of a good database that has a list of armor by ID? Or better yet, can I detect what slot an item is in the server?

I have

Code: Select all

if (PItem->isType(ITEM_ARMOR)) {
no problem, but I would like to be able to detect if the piece of gear is say, a helm or sword or hand to hand or etc.

How hard is this to do? If there's a database of items sorted by ID then I can probably just do something like...

Code: Select all

		if (PItem->isType(ITEM_ARMOR)) {
			uint16 armorID = PItem->getID;
			if (armorID < 1) {
				//its this slot
			}
			else if (armorID < 2) {
				//its this slot
			}
			else (armorID < 3) {
				//its this slot
			}
		else (armorID < 4) {
			//its this slot
		}
Since I am 99% sure ffxi sorts it's weapons by ID already, this brute force method should work, but if there already exists a cleaner method then that would save me a lot of work.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Customizing some very specific things.

Post by kjLotus » Tue May 06, 2014 10:30 pm

masterurat wrote:Or better yet, can I detect what slot an item is in the server?
have you tried looking in item_armor.h

masterurat
Posts: 81
Joined: Sat May 03, 2014 7:05 pm

Re: Customizing some very specific things.

Post by masterurat » Tue May 06, 2014 10:46 pm

Thats exactly what I was looking for. Is SlotType or SlotID the one I want for detecting what type of armor it is?

Post Reply