About r8154 (npc_sell_list) commit

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Post Reply
Message
Author
iMikeLance
Moderators
Moderators
Posts: 209
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

About r8154 (npc_sell_list) commit

#1 Post by iMikeLance »

npc_sell_list packet sends us a list of what we're allowed to sell, the items normal price and the price + overcharge when we have the skill.

I'm experiencing a bug where kore is trying to sell a new event item that Level Up Games implemented (18809#Bandana de 8º aniversário#). Kore is not obeying items_control parameters because of an error in regex when parsing items.txt and items_control.txt because of "8º". I'll fix this but there's also another way around this.

We can store this list and check what we are allowed to sell in addition to items_control keys, so the users should be able to override this default action.

Code: Select all

[Sep 18 08:10:15 2012.45] Ready to start selling items
[Sep 18 08:10:15 2012.47] You can sell:
[Sep 18 08:10:15 2012.48] [36 x Asa de Mosca de Iniciante] for 0 z each. 
[Sep 18 08:10:15 2012.49] [38 x Asa de Borboleta de Iniciante] for 0 z each. 
[Sep 18 08:10:15 2012.51] [6 x Vale-Teletransporte] for 0 z each. 
[Sep 18 08:10:15 2012.53] [1 x Botas Valhalla Iniciantes] for 0 z each. 
[Sep 18 08:10:15 2012.54] [1 x Uniforme Valhalla Iniciante] for 0 z each. 
[Sep 18 08:10:15 2012.55] [2 x Poção do Despertar] for 750 z each. 
[Sep 18 08:10:15 2012.55] [2 x Osso] for 116 z each. 
[Sep 18 08:10:15 2012.56] [1 x Florzinha] for 10 z each. 
[Sep 18 08:10:15 2012.58] [4 x Laranja] for 150 z each. 
[Sep 18 08:10:15 2012.91] Conversa com Cozinheiro Auxiliar finalizada.
[Sep 18 08:10:15 2012.98] >>>>>Sell failed.<<<<< (Kore trying to sell 18809#Bandana de 8º aniversário#)
Inventory:

Code: Select all

[Sep 18 08:10:17 2012.10] ----------Inventário-----------
-- Equipamento (Equipado) --
14   Capa Valhalla -- Cape (4)                            
15   Botas Valhalla Intermediárias -- Foot Wear (64)      
16   Uniforme Valhalla Intermediário -- Armor (16)        
17   Adaga Valhalla Iniciante -- One-Handed Weapon (2)    
18   Chapéu Valhalla -- Helmet (256)                      
-- Equipamento (Não equipado) --
10   Botas Valhalla Iniciantes (Weapon)                   
11   Uniforme Valhalla Iniciante (Weapon)                 
12   Bandana de 8º aniversário (Weapon) -- Não Identificado 
13   Florzinha (Weapon) -- Não Identificado               
-- Não utilizável --
2    Vale-Teletransporte x 6                              
3    Emblema do Grupo Valhalla x 1                        
8    Osso x 2                                             
-- Utilizável --
0    Asa de Mosca de Iniciante x 36                       
1    Asa de Borboleta de Iniciante x 38                   
4    Biscoito da Sorte: Magnificat x 35                   
5    Biscoito da Sorte: Impositio Manus x 37              
6    Biscoito da Sorte: Glória x 28                       
7    Poção do Despertar x 2                               
9    Laranja x 4                   

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

Re: About r8154 (npc_sell_list) commit

#2 Post by EternalHarvest »

Good.

This information can be stored right into Actor::Item objects in $char->inventory, for example into $item->{sellable}.

iMikeLance
Moderators
Moderators
Posts: 209
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

Re: About r8154 (npc_sell_list) commit

#3 Post by iMikeLance »

Implemented: http://cia.vc/stats/project/openkore/.message/34dead

Thanks EternalHarvest !

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

Re: About r8154 (npc_sell_list) commit

#4 Post by EternalHarvest »

Maybe also set {unsellable} to all other items in inventory and check it in AI::ai_sellAutoCheck.

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

Re: About r8154 (npc_sell_list) commit

#5 Post by EternalHarvest »

Since subs npc_sell_list in ServerType0 nad kRO are identical and you seem to be ensuring that it works right now, you can move them to Receive.pm to reduce repetition.

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

Re: About r8154 (npc_sell_list) commit

#6 Post by sofax222 »

In the r8839 !!
The "unsellable" seems redundant !!

Actually, every map changing, the inventory will be reset, and the "unsellable" of items will be erased !!
So, the "$item->{unsellable}" always is "false" in ai_sellAutoCheck of AI.pm !
An othe wrod, the code lines:

Code: Select all

	foreach my $item (@{$char->inventory->getItems()}) {
		next if ($item->{equipped} || $item->{sellable});
		$item->{unsellable} = 1; # flag this item as unsellable
	}
are redundant !!

iMikeLance
Moderators
Moderators
Posts: 209
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

Re: About r8154 (npc_sell_list) commit

#7 Post by iMikeLance »

sofax222 wrote:In the r8839 !!
The "unsellable" seems redundant !!

Actually, every map changing, the inventory will be reset, and the "unsellable" of items will be erased !!
So, the "$item->{unsellable}" always is "false" in ai_sellAutoCheck of AI.pm !
An othe wrod, the code lines:

Code: Select all

	foreach my $item (@{$char->inventory->getItems()}) {
		next if ($item->{equipped} || $item->{sellable});
		$item->{unsellable} = 1; # flag this item as unsellable
	}
are redundant !!
You're right. Maybe we can store those flags inside an auto-generated text file (tables folder).

Post Reply