PDA

View Full Version : Dumping player inventory to a file (patch included)



Morannon
06-09-2002, 09:47 AM
I tried submitting it via sourceforge, but it kept timing out on me. So Im posting it here...

Seemed like a good idea from this thread, and wasnt much work...
http://seq.sourceforge.net/showthread.php?s=&threadid=1105

The attachment is the output from cvs diff -u

Morannon
06-09-2002, 09:50 AM
The attachement seems to have disappeared, but the board is telling me i have already attached it when I try to attach again...

At the risk of redundant postings, here it is included here :

Index: src/interface.cpp
================================================== =================
RCS file: /cvsroot/seq/showeq/src/interface.cpp,v
retrieving revision 1.35
diff -u -r1.35 interface.cpp
--- src/interface.cpp 8 Jun 2002 07:02:31 -0000 1.35
+++ src/interface.cpp 9 Jun 2002 15:39:33 -0000
@@ -3783,6 +3783,9 @@
void EQInterface::playerItem(const playerItemStruct* itemp)
{
QString tempStr;
+ char bankfilename[32];
+ sprintf(bankfilename, "/tmp/bankfile.%05d", getpid());
+ FILE *bankfile = fopen(bankfilename, "a");

if (!showeq_params->no_bank)
{
@@ -3792,6 +3795,12 @@
+ ", Value: " + reformatMoney(itemp->item.cost);

emit msgReceived(tempStr);
+ }
+ if (bankfile != NULL)
+ {
+ fprintf(bankfile, "Item: %s, Slot: %04d\n",
+ itemp->item.lore, itemp->item.equipSlot);
+ fclose(bankfile);
}
}

Index: src/player.cpp
================================================== =================
RCS file: /cvsroot/seq/showeq/src/player.cpp,v
retrieving revision 1.24
diff -u -r1.24 player.cpp
--- src/player.cpp 8 Jun 2002 07:02:31 -0000 1.24
+++ src/player.cpp 9 Jun 2002 15:39:36 -0000
@@ -6,6 +6,7 @@
*/

#include <stdio.h>
+#include <unistd.h>

#include <qfile.h>
#include <qdatastream.h>
@@ -56,10 +57,14 @@
void Player::backfill(const charProfileStruct* player)
{
QString messag;
+ char oldbankfile[32], newbankfile[128];
+
+ sprintf(oldbankfile, "/tmp/bankfile.%05d", getpid());
+ sprintf(newbankfile, "/tmp/bankfile.%s", player->name);
+ rename(oldbankfile, newbankfile);

printf("Player::backfill():\n");

-
messag.sprintf("Player: Name: '%s' Last: '%s'\n",
player->name, player->lastName);
emit msgReceived(messag);

domesticbeer
06-10-2002, 12:14 PM
I went ahead and got the file to upload correctly for you.