Jump to content

Recommended Posts

Posted (edited)

Can anyone help me tweak this part of the char.c:


Index: src/char/char.c
===================================================================
--- src/char/char.c	(revision 15572)
+++ src/char/char.c	(working copy)
@@ -715,7 +715,7 @@
// it significantly reduces cpu load on the database server.

StringBuf_Init(&buf);
-	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`");
+	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`");
for( j = 0; j < MAX_SLOTS; ++j )
	StringBuf_Printf(&buf, ", `card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id);
@@ -738,8 +738,9 @@
SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR,	  &item.refine,	  0, NULL, NULL);
SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR,	  &item.attribute,   0, NULL, NULL);
SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,	  &item.expire_time, 0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR,	  &item.favorite,	0, NULL, NULL);
for( j = 0; j < MAX_SLOTS; ++j )
-		SqlStmt_BindColumn(stmt, 8+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
+		SqlStmt_BindColumn(stmt, 9+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);

// bit array indicating which inventory items have already been matched
flag = (bool*) aCallocA(max, sizeof(bool));
@@ -766,14 +767,15 @@
				items[i].identify == item.identify &&
				items[i].refine == item.refine &&
				items[i].attribute == item.attribute &&
-					items[i].expire_time == item.expire_time )
+					items[i].expire_time == item.expire_time &&
+					items[i].favorite == item.favorite )
			;	//Do nothing.
			else
			{
				// update all fields.
				StringBuf_Clear(&buf);
-					StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u'",
-						tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time);
+					StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u',`favorite`='%d'",
+						tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite);
				for( j = 0; j < MAX_SLOTS; ++j )
					StringBuf_Printf(&buf, ", `card%d`=%d", j, items[i].card[j]);
				StringBuf_Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id);
@@ -801,7 +803,7 @@
SqlStmt_Free(stmt);

StringBuf_Clear(&buf);
-	StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`", tablename, selectoption);
+	StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`", tablename, selectoption);
for( j = 0; j < MAX_SLOTS; ++j )
	StringBuf_Printf(&buf, ", `card%d`", j);
StringBuf_AppendStr(&buf, ") VALUES ");
@@ -819,8 +821,8 @@
	else
		found = true;

-		StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u'",
-			id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time);
+		StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%d'",
+			id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite);
	for( j = 0; j < MAX_SLOTS; ++j )
		StringBuf_Printf(&buf, ", '%d'", items[i].card[j]);
	StringBuf_AppendStr(&buf, ")");
@@ -1063,7 +1065,7 @@
//read inventory
//`inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`)
StringBuf_Init(&buf);
-	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`");
+	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`");
for( i = 0; i < MAX_SLOTS; ++i )
	StringBuf_Printf(&buf, ", `card%d`", i);
StringBuf_Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, MAX_INVENTORY);
@@ -1078,10 +1080,11 @@
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,	  &tmp_item.identify, 0, NULL, NULL)
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR,	  &tmp_item.refine, 0, NULL, NULL)
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR,	  &tmp_item.attribute, 0, NULL, NULL)
-	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,	  &tmp_item.expire_time, 0, NULL, NULL) )
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,	  &tmp_item.expire_time, 0, NULL, NULL)
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_UINT,	  &tmp_item.favorite, 0, NULL, NULL))
	SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
-		if( SQL_ERROR == SqlStmt_BindColumn(stmt, 8+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
+		if( SQL_ERROR == SqlStmt_BindColumn(stmt, 9+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
		SqlStmt_ShowDebug(stmt);

for( i = 0; i < MAX_INVENTORY && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
@@ -1092,7 +1095,7 @@
//read cart
//`cart_inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`)
StringBuf_Clear(&buf);
-	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`");
+	StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`");
for( j = 0; j < MAX_SLOTS; ++j )
	StringBuf_Printf(&buf, ", `card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, MAX_CART);
@@ -1107,10 +1110,11 @@
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,		&tmp_item.identify, 0, NULL, NULL)
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR,		&tmp_item.refine, 0, NULL, NULL)
||	SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR,		&tmp_item.attribute, 0, NULL, NULL)
-	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,		&tmp_item.expire_time, 0, NULL, NULL) )
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,		&tmp_item.expire_time, 0, NULL, NULL)
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_UINT,		&tmp_item.favorite, 0, NULL, NULL) )
	SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
-		if( SQL_ERROR == SqlStmt_BindColumn(stmt, 8+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
+		if( SQL_ERROR == SqlStmt_BindColumn(stmt, 9+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
		SqlStmt_ShowDebug(stmt);

for( i = 0; i < MAX_CART && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )

so that it can work with an eAthena version? I got everything else to work including what is written above except for this part =/

Edited by Mysterious
Posted

i don't think it's solved yet about the cart items losing when renting cart :P

of course, i didn't see that problem.

a @refresh can fix it for the moment.

it needs a fix in clif_cartlist @clif.c

Posted

Yes, i found the solution Judas said :

Add

case SC_ON_PUSH_CART:

After

case SC_FOOD_LUK_CASH:

at line ~8029 in status.c

and Add

case SC_ON_PUSH_CART:

After

case SC_CURSEDCIRCLE_TARGET:

at line ~9644 in status.c

Carts don't disappear anymore on dying with this, so the problem is fixed

nice that worked. but now there's another bug >.<

so if you have a character that has a cart on, you will notice that all other characters on that account will also show the cart button in the equipment window (alt+q) and also the OFF button. alt+w will work for those characters although no items can be put in. so far it doesn't seem like a bug that can be abused, but it would be nice to have it fixed.

I think it only happens when you reconnect your character with cart and then, login using different character.

Posted (edited)
if( tsd->sc.count && tsd->sc.data[sC_ON_PUSH_CART] )

clif_statuschange_single(&sd->bl,&tsd->bl,SI_ON_PUSH_CART,1,9999,tsd->sc.data[sC_ON_PUSH_CART]->val1,0,0);

in clif.c, i copied script from the ALL_RIDING system. Riding using a SC too right?

is it because it will has the same effect as the SC_ALL_RIDING have.. ALL_RIDING effect is account bound right? maybe we should modify it like the effect of it is only for 1 char right and only for that job? and maybe we should put a case statement of SC_ON_PUSH_CART on the dispell skill it should be immuned? correct me if i'm wrong!

Edited by Lordamax
Posted (edited)

There's a fix :

Add

clif_cartlist(sd);

clif_updatestatus(sd,SP_CARTINFO);

After

sc_start2(&sd->bl, SC_ON_PUSH_CART, 9999, type, 0, INVALID_TIMER);

in pc.c

The problem of showing items when rent cart is solved.

Well, the problem remaining is others players can't show carts

Edit: It don't works entirely, it works only with default cart. If you use change cart -> disconnect/reconnect you can't show cart anymore.

Edited by Ronaldo07
Posted

Check the lua files. You need the require lua files for the status icon.

Seem to be getting an error for this:

case SC_ON_PUSH_CART:
val_flag = 1|2|3|4|5|6|7|8|9;
break;

val_flag = 1|2|3|4|5|6|7|8|9; Compile errors --->

error: ‘val_flag’ undeclared (first use in this function)

error: (Each undeclared identifier is reported only once

for each function it appears in.)

Posted (edited)

retract my previous statement,

i guess just the diff that was provided in this topic is pretty bad, I had some npcs dissapear while logging on but that is due to the favorite lines in the patch.

we can either just revert back to option and stick with only 4 carts I believe or see if there is any way to make these kinds of status refresh silently like SC_Sit

Edited by Judas
Posted (edited)

retract my previous statement,

i guess just the diff that was provided in this topic is pretty bad, I had some npcs dissapear while logging on but that is due to the favorite lines in the patch.

we can either just revert back to option and stick with only 4 carts I believe or see if there is any way to make these kinds of status refresh silently like SC_Sit

I agree Sir Judas, we should wait for the official updates for these new carts by the rA developers...but this diff is good because it lets us test the new carts.. thanks scriptor for this diff :D

Edited by Lordamax
Posted

yep i guess that's the main point, i know that options don't work anymore, but it seems most skills use the option~opt to show visible effects to users, since that how it is defined to do

Posted

i posted this on my site but here is what i found out for all 2012 clients 2012-01 through 2012-03

yeah this may be a dilemma...So this is what I found out, All 2012 clients have Cart Options removed, meaning that carts are not allowed to be used as an option anymore. Option is used to tell the client that characters outside the player's visible range will still be able to see what effects are on the player at all times. So without this, it means that the cart status patch that is available now, players can't see at all time. So if we removing the new carts won't really do anything. Therefore, if we want to keep using 2012 clients then that means we have to stick with this problem unless a dev finds a way for it to keep its status while showing it other players outside their range. 2011-12-20b-2011-12-28, is the latest client that will still use the Option on the cart

Posted

i posted this on my site but here is what i found out for all 2012 clients 2012-01 through 2012-03

yeah this may be a dilemma...So this is what I found out, All 2012 clients have Cart Options removed, meaning that carts are not allowed to be used as an option anymore. Option is used to tell the client that characters outside the player's visible range will still be able to see what effects are on the player at all times. So without this, it means that the cart status patch that is available now, players can't see at all time. So if we removing the new carts won't really do anything. Therefore, if we want to keep using 2012 clients then that means we have to stick with this problem unless a dev finds a way for it to keep its status while showing it other players outside their range. 2011-12-20b-2011-12-28, is the latest client that will still use the Option on the cart

So in short, Gravity made their new carts hard to emulate :)

  • 2 weeks later...
Posted

Shouldnt there be a Packetver check in the source for the cart option? Make it more organized? :P!

If someone want to add this diff to rAthena, then yes.. we need to add PACKETVER check in this..

Sir fataleror what fixes did you made from your diff patch?

Maybe this?

New bugs found.

1) If your character dies, your cart disappears.

2) If you rent out a cart that you previously had items stored in, it will not display those items inside the cart until you relog respawn with the cart on. Therefore, even if you go rent another cart after dying, you won't be able to see the items you had inside the cart until you relog respawn.

Another here is if you rent a cart the other player doesn't see your cart until you use the Change Cart skill :P

nice that worked. but now there's another bug >.<

so if you have a character that has a cart on, you will notice that all other characters on that account will also show the cart button in the equipment window (alt+q) and also the OFF button. alt+w will work for those characters although no items can be put in. so far it doesn't seem like a bug that can be abused, but it would be nice to have it fixed.

i posted this on my site but here is what i found out for all 2012 clients 2012-01 through 2012-03

yeah this may be a dilemma...So this is what I found out, All 2012 clients have Cart Options removed, meaning that carts are not allowed to be used as an option anymore. Option is used to tell the client that characters outside the player's visible range will still be able to see what effects are on the player at all times. So without this, it means that the cart status patch that is available now, players can't see at all time. So if we removing the new carts won't really do anything. Therefore, if we want to keep using 2012 clients then that means we have to stick with this problem unless a dev finds a way for it to keep its status while showing it other players outside their range. 2011-12-20b-2011-12-28, is the latest client that will still use the Option on the cart

the skill "SA_DISPELL" removing the cart. Anyone know how to solve this?

Thanks.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...