The "equip_arrow" seems unavailable in attackSkillSlot

Discussion about everything RO and OpenKore related. This place is NOT for ANY kind of support questions.

Moderator: Moderators

Message
Author
sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

The "equip_arrow" seems unavailable in attackSkillSlot

#1 Post by sofax222 »

The "equip_arrow" seems unavailable in attackSkillSlot.
Even the "equip_????" seem all unavailable in attackSkillSlot.
I can not found any code lines about the "equip_arrow" !!

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#2 Post by EternalHarvest »

AI::CoreLogic::processSkillUse:

Code: Select all

Actor::Item::scanConfigAndEquip("$args->{prefix}_equip");

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#3 Post by sofax222 »

EternalHarvest wrote:AI::CoreLogic::processSkillUse:

Code: Select all

Actor::Item::scanConfigAndEquip("$args->{prefix}_equip");
Thank you very much !
I got it !

But, I set the equip_arrow in attackSkillSlot, it sometimes does not work !

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#4 Post by EternalHarvest »

sofax222 wrote:it sometimes does not work !
Sometimes it does work?

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#5 Post by sofax222 »

EternalHarvest wrote: Sometimes it does work?
Yes !
I will make more check out.
May be it is a problem in config.txt.

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#6 Post by sofax222 »

When my role runs out of equip_arrow item (not un-equip).
And auto-get from storage with autostorage.
Then it can not be auto-equip in attackSkillSlot !

It could be a problem, I am not realy sure !

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#7 Post by sofax222 »

I got the solution !

I am sure that...
When my role runs out of equip_arrow item (not un-equip).
And auto-get from storage with autostorage.
Then it can not be auto-equip in attackSkillSlot !

I change the code:
Original src/Misc.pm

Code: Select all

##
# inventoryItemRemoved($invIndex, $amount)
#
# Removes $amount of $invIndex from $char->{inventory}.
# Also prints a message saying the item was removed (unless it is an arrow you
# fired).
sub inventoryItemRemoved {
	my ($invIndex, $amount) = @_;

	my $item = $char->inventory->get($invIndex);
	if (!$char->{arrow} || ($item && $char->{arrow} != $item->{index})) {
		# This item is not an equipped arrow
		message TF("Inventory Item Removed: %s (%d) x %d\n", $item->{name}, $invIndex, $amount), "inventory";
	}
	$item->{amount} -= $amount;
	$char->inventory->remove($item) if ($item->{amount} <= 0);
	$itemChange{$item->{name}} -= $amount;
}
My new code:

Code: Select all

##
# inventoryItemRemoved($invIndex, $amount)
#
# Removes $amount of $invIndex from $char->{inventory}.
# Also prints a message saying the item was removed (unless it is an arrow you
# fired).
sub inventoryItemRemoved {
	my ($invIndex, $amount) = @_;

	my $item = $char->inventory->get($invIndex);
	if (!$char->{arrow} || ($item && $char->{arrow} != $item->{index})) {
		# This item is not an equipped arrow
		message TF("Inventory Item Removed: %s (%d) x %d\n", $item->{name}, $invIndex, $amount), "inventory";
	}
	$item->{amount} -= $amount;

	# un-equip the Arrow
	if ($item->{amount} <= 0 && $char->{arrow} && ($char->{arrow} == $item->{index})) {
		message TF("Run out of Arrow/Bullet: %s (%d)\n", $item->{name}, $invIndex), "inventory";
		delete $char->{equipment}{arrow};
	}

	$char->inventory->remove($item) if ($item->{amount} <= 0);
	$itemChange{$item->{name}} -= $amount;
}
But, I am not sure this is a best solution !
If it is a good solution, I will update it with SVN !

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#8 Post by EternalHarvest »

Fine, if the client follows the same logic (when you've got the same arrows again, they're unequipped).

There's no unequip_item packet for it? Maybe it's here, but not handled right? Also this fix may share some code with unequip_item.

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#9 Post by sofax222 »

EternalHarvest wrote:Fine, if the client follows the same logic (when you've got the same arrows again, they're unequipped).

There's no unequip_item packet for it? Maybe it's here, but not handled right? Also this fix may share some code with unequip_item.
Yes, there is a "00AC" packet for "unequip_item".
And it includes the "Arrows" :

Code: Select all

.........
	if ($args->{type} == 10 || $args->{type} == 32768) {
		delete $char->{equipment}{arrow};
	} else {
.........
Actually, I can normally use the console commands eq / uneq on my arrow item.
So, I think the "unequip_item" packet works fine.

I will to check the received packets after running out of arrows.

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: The "equip_arrow" seems unavailable in attackSkillSlot

#10 Post by sofax222 »

I make sure that the running out of arrows without receiveing any "unequip_item" packets.

Firstly, I add some code into "unequip_item" subroutine to show some messsge on console, such as:
PS: the "unequip_item" subroutine is in src/Newwork/Receive/ServerType0.pm.

Code: Select all

....
sub unequip_item {
	my ($self, $args) = @_;

	message TF("--- Unequip Packet, item tyep: %d\n", $args->{type}), 'inventory';
.....
[/coe]

Then to process the following steps:
1. To get 10 arrows from storage and equip it.
2. To use the "uneq" to un-equip the arrow. The console show the "Unequip" message what I added.
3. To walk into field and to start to kill the monsters with arrows....
4. When running out the 10 arrows... The console [color=#FF0000]never[/color] show the "Unequip" message what I added.

I do the test twice. And get the same result:
The running out of arrows without receiveing any "unequip_item" packets.

So, I think adding the code into the "inventory_item_removed" packet is a solution, so far.
PS: Actually the modifief code is in inventoryItemRemoved of src/Misc.pm file

Post Reply