• 0
Sign in to follow this  
Followers 0
fiction

Q> About compatibility Shop variables

Question

Hi to all,

   In herc, what is the way to manipualte custom shops via npcshopdelitem, npcshopadditem, etc?

For example, in rathena, when i use shops that the currency is an item, i use itemshop, like this...

-    itemshop    asdfas    -1,7828,13036:100,13411:100

and then i call that shop via  callshop "asdfas",0;

How can i do that here in herc?

Greetings.-

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

In case that i use SQL Queries to fill the entry, how can i do here?.


In rathena i use query sqls to fill my menu and the shop, and then order alphabetically.


For example:

	OnInit:
		.@mob_db$  = "mob_db";
		.@item_db$ = "item_db";


.@total = query_sql( "SELECT DISTINCT LEFT( `name_japanese`, 1 ) AS alphabets FROM `"+ .@item_db$ +"` RIGHT JOIN `"+ .@mob_db$ +"` ON `"+ .@item_db$ +"`.`id` = `"+ .@mob_db$ +"`.`dropcardid` WHERE  `type` = 6 AND `mexp` = 0 GROUP BY `name_japanese` ORDER BY alphabets;", .alphabet$ );

	for ( .@i = 0; .@i < .@total; .@i++ ) {
		
		.alphabet_menu$ = .alphabet_menu$ + .alphabet$[.@i] +" Cards:";
		
		.@nb = query_sql( "SELECT `"+ .@item_db$ +"`.`id` FROM `"+ .@item_db$ +"` RIGHT JOIN `"+ .@mob_db$ +"` ON `"+ .@item_db$ +"`.`id` = `"+ .@mob_db$ +"`.`dropcardid` WHERE  ~(`MODE`) & 32 AND `type` = 6 AND `mexp` = 0 AND LEFT( `name_japanese`, 1 ) = '"+ .alphabet$[.@i] +"' GROUP BY `name_japanese` ORDER BY `name_japanese` LIMIT 128;", .@id );
      
      		for ( .@j = 0; .@j < .@nb; .@j++ )
			
			npcshopadditem "card_mob#"+ .alphabet$[.@i], .@id[.@j], 3;
			
			}
	freeloop 0;
	end;

}

// Shop Normal Cards
-	itemshop	card_mob#A	-1,30004,1515:1
-	itemshop	card_mob#B	-1,30004,1515:1
-	itemshop	card_mob#C	-1,30004,1515:1
-	ietmshop	card_mob#D	-1,30004,1515:1
...

 

Share this post


Link to post
Share on other sites
  • 0

at first itemshop not exists in client or packets, this is some kind of fake shop in rathena, probably limited market (bargarian shop) or cash shop.

For shop with data synced to sql table automatically you can use market shop type, see https://github.com/HerculesWS/Hercules/blob/stable/doc/script_commands.txt#L310

or search in npc folder shop types what you want.

 

If you asking how fill shop with all existing items in db, you can use one of trader shop type and add items by sql queries.

 

Share this post


Link to post
Share on other sites
  • 0

@4144
Hercules has our own dynamic shop system, implement right after Hercules founded

 

by your definition, yes, we also has our own fake shop in hercules

 

@fiction

that's my script by the way ... you see my name in rathena repo

Share this post


Link to post
Share on other sites
  • 0

I mean in client no itemshop. Exists normal shop. cash shop, market (aka bargarian) and barter. Herc using all of them in some way in official or custom way.

But here no shop with name item shop. Checked source, itemshop using really cash shop.

 

Share this post


Link to post
Share on other sites
  • 0

Thank you @AnnieRuru, @4144 and yes, indeed is part of your script, but i made some modification (I hope you do not mind hehe), because i don't want to trade in Zeny, i want to trade in custom items.

I'll try to re-read the documentation of herc and try to adapt it.

Share this post


Link to post
Share on other sites
  • 0

For this you can use trader with type NST_CUSTOM. See in docs or npc folder (it using cash shop on client too(

 

If you using 2019 clients you also can use barter shop. See here information about barter shops

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0