Openkore.com

OpenKore Forums
It is currently 20 Oct 2014, 09:09

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 11 May 2011, 21:08 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
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" !!


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 11 May 2011, 22:07 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1818
AI::CoreLogic::processSkillUse:
Code:
Actor::Item::scanConfigAndEquip("$args->{prefix}_equip");


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 12 May 2011, 00:11 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
EternalHarvest wrote:
AI::CoreLogic::processSkillUse:
Code:
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 !


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 12 May 2011, 08:37 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1818
sofax222 wrote:
it sometimes does not work !

Sometimes it does work?


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 12 May 2011, 11:29 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
EternalHarvest wrote:
Sometimes it does work?

Yes !
I will make more check out.
May be it is a problem in config.txt.


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 20 Jun 2011, 20:00 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
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 !


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 21 Jun 2011, 07:35 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
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:
##
# 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:
##
# 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 !


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 21 Jun 2011, 17:32 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1818
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.


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 21 Jun 2011, 20:53 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
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:
.........
   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.


Top
 Profile  
 
 Post subject: Re: The "equip_arrow" seems unavailable in attackSkillSlot
PostPosted: 22 Jun 2011, 20:13 
Offline
Developers
Developers

Joined: 24 Nov 2010, 03:08
Posts: 201
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]
....
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 never 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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[ Time : 0.044s | 16 Queries | GZIP : On ]