summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/inter-server.conf1
-rw-r--r--conf/messages.conf4
-rw-r--r--npc/custom/quests/thq/THQS_TTShop.txt636
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c15
-rw-r--r--src/map/script.c2
9 files changed, 177 insertions, 492 deletions
diff --git a/conf/inter-server.conf b/conf/inter-server.conf
index a3acad9f5..184285cfd 100644
--- a/conf/inter-server.conf
+++ b/conf/inter-server.conf
@@ -127,6 +127,7 @@ mob_skill_db2_db: mob_skill_db2
mapreg_db: mapreg
autotrade_merchants_db: autotrade_merchants
autotrade_data_db: autotrade_data
+npc_market_data_db: npc_market_data
// == SQL item, mob, mob skill databases
// =====================================
diff --git a/conf/messages.conf b/conf/messages.conf
index 7070b80e0..5c860e501 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -637,8 +637,8 @@
878: You are no longer the Guild Master.
879: You have become the Guild Master!
880: You have been recovered!
-
-//881-899 FREE
+881: Shop is out of stock! Come again later!
+//882-899 FREE
//------------------------------------
// More atcommands message
diff --git a/npc/custom/quests/thq/THQS_TTShop.txt b/npc/custom/quests/thq/THQS_TTShop.txt
index dfa83a587..f25b09c7b 100644
--- a/npc/custom/quests/thq/THQS_TTShop.txt
+++ b/npc/custom/quests/thq/THQS_TTShop.txt
@@ -12,503 +12,183 @@
//= 1.0 - Straight conversion of Aegis NPC file
//= 1.1 - balanced some prices, fixed 1 missing label
//= removed Executioner&Mysteltain swords [Lupus]
+//= 1.2 - Optmized and fixed small error [Panikon]
//============================================================
prt_in,159,172,0 warp thqwrp 3,3,yuno_in01,123,155
-prt_in,164,174,1 script Treasure Hunter's Shop 1_M_YOUNGKNIGHT,{
- mes "[Ash]";
- mes "Ahh, "+strcharinfo(0)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
- mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
- next;
- menu "How does this place work?",-,"What do you have in stock?",N_Shop,"Nevermind",N_NVM;
- mes "[Ash]";
- mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
- mes " ";
- mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
- mes " ";
- mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
- mes " ";
- mes "Hope that solves your problem and questions.";
- close;
-N_NVM:
- close;
+// Main configuration object
+- script THQS#Configuration -1,{
+OnInit:
+ // Axes
+ setarray $THQS_menu_weapons_1[0], Sabbath, Slaughter, Tomahawk, Great_Axe, Guillotine;
+ setarray $THQS_menu_price_1[0], 160, 160, 180, 200, 200;
+ // One Handed Swords
+ setarray $THQS_menu_weapons_2[0], Edge, Solar_Sword, Scissores_Sword, Nagan, Immaterial_Sword, Excalibur, Byeorrun_Gum, Tale_Fing_;
+ setarray $THQS_menu_price_2[0], 130, 150, 170, 180, 200, 200, 240, 320;
+ // Two Handed Swords
+ setarray $THQS_menu_weapons_3[0],Dragon_Slayer, Schweizersabel, Katzbalger, Muramasa, Masamune, Balmung;
+ setarray $THQS_menu_price_3[0], 140,200,300,300,400,2000;
+ // Books
+ setarray $THQS_menu_weapons_4[0],Book_Of_Blazing_Sun, Book_Of_Billows, Book_Of_Gust_Of_Wind, Book_Of_Mother_Earth, Book_Of_The_Apocalypse, Bible, Tablet;
+ setarray $THQS_menu_price_4[0], 80, 80, 80, 80, 80, 90, 120;
+ // Bows
+ setarray $THQS_menu_weapons_5[0], Bow_Of_Rudra, Bow_Of_Roguemaster;
+ setarray $THQS_menu_price_5[0], 150, 150;
+ // Katars
+ setarray $THQS_menu_weapons_6[0], Katar_Of_Cold_Icicle,Katar_Of_Thornbush,Katar_Of_Raging_Blaze,Katar_Of_Piercing_Wind,Ghoul_Leg,Infiltrator;
+ setarray $THQS_menu_price_6[0],70,70,70,70,125,150;
+ // Knuckles
+ setarray $THQS_menu_weapons_7[0],Kaiser_Knuckle,Berserk;
+ setarray $THQS_menu_price_7[0],75,75;
+ // Maces
+ setarray $THQS_menu_weapons_8[0],Spike,Slash,Grand_Cross,Quadrille,Mjolnir;
+ setarray $THQS_menu_price_8[0],65,90,100,110,1000;
+ // Whips
+ setarray $THQS_menu_weapons_9[0],Rapture_Rose,Chemeti;
+ setarray $THQS_menu_price_9[0],50,65;
+ // Wands
+ setarray $THQS_menu_weapons_10[0],Mighty_Staff,Wizardy_Staff,Bone_Wand,Staff_Of_Soul;
+ setarray $THQS_menu_price_10[0],90,150,110,120;
+ // Cards
+ setarray $THQS_menu_cards[0],Poring_Card, Pasana_Card, Dokebi_Card, Sword_Fish_Card, Sand_Man_Card, Drainliar_Card,
+ Kaho_Card,Mandragora_Card,Vadon_Card,Mummy_Card,Zenorc_Card,Condor_Card, Zombie_Card;
+ setarray $THQS_menu_price[0],2,420,420,420,420,360,360,360,360,540,240,240,210;
end;
-N_Shop:
-//This is when it gets hard :)
- mes "[Ash]";
- mes "Ok here is our Big list of goods.";
- mes " ";
- mes "(Note T stands for a Treasure Token.)";
- next;
- menu "Trade for Zeny",-,"Trade for Weapons",N_BuyWeps,"Trade for Cards",N_BuyCards,"Nevermind",N_NVM;
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "1000z - 1T",-,"10000z - 10T",N_10T,"100000z - 100T",N_100T,"Nevermind",N_NVM;
- if (#Treasure_Token > 0) goto N_GetZeny1k;
- mes "You don't have enough tokens!";
- close;
-N_GetZeny1k:
- set #Treasure_Token,#Treasure_Token-1;
- Zeny += 1000;
- close;
-N_10T:
- if (#Treasure_Token > 9) goto N_GetZeny10k;
- mes "You don't have enough tokens!";
- close;
-N_GetZeny10k:
- set #Treasure_Token,#Treasure_Token-10;
- Zeny += 10000;
- close;
-N_100T:
- if (#Treasure_Token > 99) goto N_GetZeny100k;
- mes "You don't have enough tokens!";
- close;
-N_GetZeny100k:
- set #Treasure_Token,#Treasure_Token-100;
- Zeny += 100000;
- close;
-
-N_BuyWeps:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Axe's",-,"1 Handed Swords",N_1HandSword,"2 Handed Swords",N_2HandSword,"Book's",N_Book,"Bow's",N_Bow,"Katar's",N_Katar,"Knuckle's",N_Knuckle,"Mace's",N_Mace,"Whips",N_Whip,"Wands",N_Wand,"Nevermind",N_NVM;
-
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Sabbath - 160T",-,"Slaughter - 160T",N_Slau,"Tomahawk - 180T",N_Toma,"Great Axe - 200T",N_GreatA,"Guillotine - 200T",N_Guill,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 160) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-160;
- getitem 1365,1;
- logmes "Treasure Token: Bought a Sabbath";
- close;
-N_Slau:
- if (#Treasure_Token < 160) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-160;
- getitem 1367,1;
- logmes "Treasure Token: Bought a Slaughter";
- close;
-N_Toma:
- if (#Treasure_Token < 180) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-180;
- getitem 1368,1;
- logmes "Treasure Token: Bought a Tomahawk";
- close;
-N_GreatA:
- if (#Treasure_Token < 200) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-200;
- getitem 1364,1;
- logmes "Treasure Token: Bought a Great Axe";
- close;
-N_Guill:
- if (#Treasure_Token < 200) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-200;
- getitem 1369,1;
- logmes "Treasure Token: Bought a Guillotine";
- close;
-N_NeedToken:
- mes "[Ash]";
- mes "You don't have enough tokens!";
- close;
-
-
-N_1HandSword:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Edge - 130T",-,"Solar Sword - 150T",N_SolarS,"Caesar's Sword - 170T",N_CaesarS,"Nagan - 180T",N_Nagan,"Immaterial Sword - 200T",N_ImmatS,"Excalibur - 200T",N_Excal,"Byeollungum - 240T",N_Byeoll,"Talefing - 320T",N_Talef,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 130) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-130;
- getitem 1132,1;
- logmes "Treasure Token: Bought a Edge";
- close;
-N_SolarS:
- if (#Treasure_Token < 150) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-150;
- logmes "Treasure Token: Bought a Solar Sword";
- getitem 1136,1;
- close;
-N_CaesarS:
- if (#Treasure_Token < 170) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-170;
- logmes "Treasure Token: Bought a Caesars Sword";
- getitem 1134,1;
- close;
-N_Nagan:
- if (#Treasure_Token < 180) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-180;
- logmes "Treasure Token: Bought a Nagan";
- getitem 1130,1;
- close;
-N_ImmatS:
- if (#Treasure_Token < 200) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-200;
- logmes "Treasure Token: Bought a Immaterial Sword";
- getitem 1141,1;
- close;
-N_Excal:
- if (#Treasure_Token < 200) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-200;
- logmes "Treasure Token: Bought a Excalibur";
- getitem 1137,1;
- close;
-N_Byeoll:
- if (#Treasure_Token < 240) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-240;
- logmes "Treasure Token: Bought a Byeollungum";
- getitem 1140,1;
- close;
-N_Talef:
- if (#Treasure_Token < 320) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-320;
- logmes "Treasure Token: Bought a Talefing";
- getitem 1139,1;
- close;
-
-
-N_2HandSword:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Dragon Slayer - 140T",-,"Schweizersabel - 200T",N_Schwe,"Katzbalger - 300T",N_Katzb,"Muramasa - 300T",N_Murama,"Masamune - 400T",N_Masamu,"Balmung - 2000T",N_Balmu,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 140) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-140;
- logmes "Treasure Token: Bought a Dragon Slayer";
- getitem 1166,1;
- close;
-N_Schwe:
- if (#Treasure_Token < 200) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-200;
- logmes "Treasure Token: Bought a Schweizersabel";
- getitem 1167,1;
- close;
-N_Katzb:
- if (#Treasure_Token < 300) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-300;
- logmes "Treasure Token: Bought a Katzbalger";
- getitem 1170,1;
- close;
-N_Murama:
- if (#Treasure_Token < 300) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-300;
- logmes "Treasure Token: Bought a Muramasa";
- getitem 1164,1;
- close;
-N_Masamu:
- if (#Treasure_Token < 400) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-400;
- logmes "Treasure Token: Bought a Masamune";
- getitem 1165,1;
- close;
-N_Balmu:
- if (#Treasure_Token < 2000) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-2000;
- logmes "Treasure Token: Bought a Balmung";
- getitem 1161,1;
- close;
-
-
-N_Book:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Book of the Burning Sun - 80T",-,"Book of the Rough Seas - 80T",N_RoughSea,"Book of the Dry Winds - 80T",N_DryWinds,"Book of the Ripe Earth - 80T",N_RipeEarth,"Book of the Revelations - 80T",N_Revela,"Bible - 90T",N_Bible,"Tablet - 120T",N_Tablet,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 80) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-80;
- logmes "Treasure Token: Bought a Book of the Burning Sun";
- getitem 1555,1;
- close;
-N_RoughSea:
- if (#Treasure_Token < 80) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-80;
- logmes "Treasure Token: Bought a Book of the Rough Seas";
- getitem 1553,1;
- close;
-N_DryWinds:
- if (#Treasure_Token < 80) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-80;
- logmes "Treasure Token: Bought a Book of the Dry Winds";
- getitem 1556,1;
- close;
-N_RipeEarth:
- if (#Treasure_Token < 80) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-80;
- logmes "Treasure Token: Bought a Book of the Ripe Earth";
- getitem 1554,1;
- close;
-N_Revela:
- if (#Treasure_Token < 80) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-80;
- logmes "Treasure Token: Bought a Book of the Revelations";
- getitem 1557,1;
- close;
-N_Bible:
- if (#Treasure_Token < 90) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-90;
- logmes "Treasure Token: Bought a Bible";
- getitem 1551,1;
- close;
-N_Tablet:
- if (#Treasure_Token < 120) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-120;
- logmes "Treasure Token: Bought a Tablet";
- getitem 1552,1;
- close;
-
-N_Bow:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Rudra's Bow - 150T",-,"Roguemaster's Bow - 150T",N_Rogue,"Nevermind",N_NVM;
+}
- if (#Treasure_Token < 150) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-150;
- logmes "Treasure Token: Bought a Rudra Bow";
- getitem 1720,1;
- close;
-N_Rogue:
- if (#Treasure_Token < 150) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-150;
- logmes "Treasure Token: Bought a Roguemaster Bow";
- getitem 1719,1;
+// Trades tokens
+// getarg(0) - number of tokens to be traded
+function script thqs_trade_token {
+ .@type = getarg(0);
+ if( .@type == 4 )
+ close;
+ // 10^3, 10^4, 10^5
+ .@type += 2; // So we can use pow later to determine the qt of Zeny
+
+ if( #Treasure_Token < .@type ) {
+ mes "You don't have enough tokens!";
+ close;
+ }
+ mes ".@type "+.@type;
+
+ mes "pow(1000,.@type);" + pow(10,.@type);
+ #Treasure_Token -= .@type;
+ Zeny += pow(1000,.@type);
close;
+}
-N_Katar:
- mes "[Ash]";
- mes "This is what we have to offer.";
- next;
- menu "Katar of the Blazing Rage - 70T",-,"Katar of the Cold Icicle - 70T",N_ColdIce,"Katar of the Piercing Wind - 70T",N_PiercWind,"Katar of the Dusty Thornbush - 70T",N_DustyT,"Sharpened Legbone of Ghoul - 125T",N_Legbone,"Infiltrator - 150T",N_Infiltra,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 70) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-70;
- logmes "Treasure Token: Bought a Katar of the Blazing Rage";
- getitem 1258,1;
- close;
-N_ColdIce:
- if (#Treasure_Token < 70) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-70;
- logmes "Treasure Token: Bought a Katar of the Cold Icicle";
- getitem 1256,1;
- close;
-N_PiercWind:
- if (#Treasure_Token < 70) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-70;
- logmes "Treasure Token: Bought a Katar of the Piercing Wind";
- getitem 1259,1;
- close;
-N_DustyT:
- if (#Treasure_Token < 70) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-70;
- logmes "Treasure Token: Bought a Katar of the Dusty Thornbush";
- getitem 1257,1;
- close;
-N_Legbone:
- if (#Treasure_Token < 125) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-125;
- logmes "Treasure Token: Bought a Sharpened Legbone of Ghoul";
- getitem 1260,1;
- close;
-N_Infiltra:
- if (#Treasure_Token < 150) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-150;
- logmes "Treasure Token: Bought a Infiltrator";
- getitem 1261,1;
+// Creates a buying menu
+// getarg(0) - .@mw$ -> ID
+// getarg(1) - .@mp$ -> PRICE
+function script thqs_menu_buy {
+ if( getargcount() != 2 ) {
+ debugmes "thqs_menu_buy: Wrong number of arguments!!";
+ close;
+ }
+
+ .@mw$ = getarg(0);
+ .@mp$ = getarg(1);
+
+ if( getarraysize( getd(.@mw$) ) != getarraysize( getd(.@mp$) ) ) {
+ debugmes "thqs_menu_buy: Missing entries in data!";
+ close;
+ }
+
+ // Dynamic menu
+ // Uses a dynamic string and then applies it to a *select
+ .@select_menu$ = "";
+ for( .@i = 0; .@i < getarraysize( getd(.@mw$) ); .@i++ ) {
+ .@price = getd(.@mp$+"["+.@i+"]");
+
+ if( .@select_menu$ != "")
+ .@select_menu$ = .@select_menu$+":"+getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T";
+ else
+ .@select_menu$ = getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T";
+ }
+ .@select_menu$ = .@select_menu$ + ":Nevermind";
+ select(.@select_menu$);
+
+ if( @menu == (.@i+1) )
+ close;
+
+ @index = @menu - 1; // Arrays are 0 indexed while our menu is not
+ @item_id = getd(.@mw$+"["+@index+"]");
+ @price = getd(.@mp$+"["+@index+"]");
+ if( #Treasure_Token < @price ) {
+ mes "You don't have enough tokens!";
+ close;
+ }
+ #Treasure_Token -= @price;
+ logmes "Treasure Token: Bought a "+getitemname(@item_id);
+ getitem @item_id,1;
close;
+}
-N_Knuckle:
+// Creates the first weapon menu
+// getarg(0) - @menu
+function script ths_menu_weapons {
+ @first_option = getarg(0);
+ if( @first_option == 11 )
+ close;
mes "[Ash]";
- mes "This is what we have to offer.";
+ mes "This is what we have to offer."+@first_option;
next;
- menu "Kaiser Knuckle - 75T",-,"Berserk - 75T",N_Berserk,"Nevermind",N_NVM;
+ // Array names so they can be used by thqs_menu_buy
+ .@mw$ = "$THQS_menu_weapons_"+@first_option;
+ .@mp$ = "$THQS_menu_price_"+@first_option;
- if (#Treasure_Token < 75) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-75;
- logmes "Treasure Token: Bought a Kaiser Knuckle";
- getitem 1813,1;
- close;
-N_Berserk:
- if (#Treasure_Token < 75) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-75;
- logmes "Treasure Token: Bought a Berserk";
- getitem 1814,1;
- close;
+ thqs_menu_buy(.@mw$,.@mp$);
+}
-N_Mace:
+// Main script
+prt_in,164,174,1 script Treasure Hunter's Shop 1_M_YOUNGKNIGHT,{
mes "[Ash]";
- mes "This is what we have to offer.";
+ mes "Ahh, "+strcharinfo(0)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
+ mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
next;
- menu "Spike - 65T",-,"Slash - 90T",N_Slash,"Grand Cross - 100T",N_GrandC,"Quadrille - 110T",N_Quadr,"Mjolnir - 1000T",N_MJ,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 65) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-65;
- logmes "Treasure Token: Bought a Spike";
- getitem 1523,1;
- close;
-N_Slash:
- if (#Treasure_Token < 90) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-90;
- logmes "Treasure Token: Bought a Slash";
- getitem 1526,1;
- close;
-N_GrandC:
- if (#Treasure_Token < 100) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-100;
- logmes "Treasure Token: Bought a Grand Cross";
- getitem 1528,1;
- close;
-N_Quadr:
- if (#Treasure_Token < 110) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-110;
- logmes "Treasure Token: Bought a Quadrille";
- getitem 1527,1;
- close;
-N_MJ:
- if (#Treasure_Token < 1000) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-1000;
- logmes "Treasure Token: Bought a Mjolnir";
- getitem 1530,1;
- close;
+ switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
+ case 1:
+ mes "[Ash]";
+ mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
+ mes " ";
+ mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
+ mes " ";
+ mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
+ mes " ";
+ mes "Hope that solves your problem and questions.";
+ close;
+ case 2:
+ break;
+ case 3:
+ close;
+ }
-N_Whip:
mes "[Ash]";
- mes "This is what we have to offer.";
+ mes "Ok here is our Big list of goods.";
+ mes " ";
+ mes "(Note T stands for a Treasure Token.)";
next;
- menu "Rapture Rose - 50T",-,"Chemeti - 65T",N_Chemeti,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 50) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-50;
- logmes "Treasure Token: Bought a Rapture Rose";
- getitem 1963,1;
- close;
-N_Chemeti:
- if (#Treasure_Token < 65) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-65;
- logmes "Treasure Token: Bought a Chemeti";
- getitem 1964,1;
- close;
-
-N_Wand:
mes "[Ash]";
mes "This is what we have to offer.";
next;
- menu "Mighty Staff - 90T",-,"Wizardry Staff - 150T",N_Wizardry,"Bone Wand - 110T",N_BoneW,"Staff of Soul - 120T",N_SOSoul,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 90) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-90;
- logmes "Treasure Token: Bought a Mighty Staff";
- getitem 1613,1;//Items: Mighty_Staff,
- close;
-N_Wizardry:
- if (#Treasure_Token < 150) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-150;
- logmes "Treasure Token: Bought a Wizardry Staff";
- getitem 1473,1;//Items: Wizardy_Staff,
- close;
-N_BoneW:
- if (#Treasure_Token < 110) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-110;
- logmes "Treasure Token: Bought a Bone Wand";
- getitem 1615,1;//Items: Bone_Wand,
- close;
-N_SOSoul:
- if (#Treasure_Token < 120) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-120;
- logmes "Treasure Token: Bought a Staff of Soul";
- getitem 1472,1;//Items: Staff_of_Soul,
- close;
-
-N_BuyCards:
- mes "[Ash]";
- mes "This is what we have to offer. All Cards are 300T";
- next;
- menu "Poring Card - 2T",-,"Pasana Card - 420T",N_CPasana,"Dokebi Card - 420T",N_CDok,"Swordfish Card - 420T",N_CSFish,
- "Sandman Card - 420T",N_CSMan,"Drainliar Card - 360T",N_CDrain,"Kaho Card - 360T",N_CKaho,"Mandragora Card - 360T",N_CMand,
- "Vadon Card - 360T",N_CVadon,"Mummy Card - 540T",N_CMummy,"Zenorc Card - 240T",N_CZeno,"Condor Card - 240T",N_CCond,
- "Zombie Card - 210T",N_CZomb,"Nevermind",N_NVM;
-
- if (#Treasure_Token < 2) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-2;
- logmes "Treasure Token: Bought a Poring Card";
- getitem 4001,1;//Items: Poring_Card,
- close;
-
-N_CPasana:
- if (#Treasure_Token < 420) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-420;
- logmes "Treasure Token: Bought a Pasana Card";
- getitem 4099,1;//Items: Pasana_Card,
- close;
-N_CDok:
- if (#Treasure_Token < 420) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-420;
- logmes "Treasure Token: Bought a Dokebi Card";
- getitem 4098,1;//Items: Dokebi_Card,
- close;
-N_CSFish:
- if (#Treasure_Token < 420) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-420;
- logmes "Treasure Token: Bought a Swordfish Card";
- getitem 4089,1;//Items: Sword_Fish_Card,
- close;
-N_CSMan:
- if (#Treasure_Token < 420) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-420;
- logmes "Treasure Token: Bought a Sandman Card";
- getitem 4101,1;//Items: Sand_Man_Card,
- close;
-N_CDrain:
- if (#Treasure_Token < 360) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-360;
- logmes "Treasure Token: Bought a Drainliar Card";
- getitem 4069,1;//Items: Drainliar_Card,
- close;
-N_CKaho:
- if (#Treasure_Token < 360) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-360;
- logmes "Treasure Token: Bought a Kaho Card";
- getitem 4065,1;//Items: Kaho_Card,
- close;
-N_CMand:
- if (#Treasure_Token < 360) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-360;
- logmes "Treasure Token: Bought a Mandragora Card";
- getitem 4030,1;//Items: Mandragora_Card,
- close;
-N_CVadon:
- if (#Treasure_Token < 360) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-360;
- logmes "Treasure Token: Bought a Vadon Card";
- getitem 4049,1;//Items: Vadon_Card,
- close;
-N_CMummy:
- if (#Treasure_Token < 540) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-540;
- logmes "Treasure Token: Bought a Mummy Card";
- getitem 4106,1;//Items: Mummy_Card,
- close;
-N_CZeno:
- if (#Treasure_Token < 240) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-240;
- logmes "Treasure Token: Bought a Zenorc Card";
- getitem 4096,1;//Items: Zenorc_Card,
- close;
-N_CCond:
- if (#Treasure_Token < 240) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-240;
- logmes "Treasure Token: Bought a Condor Card";
- getitem 4015,1;//Items: Condor_Card,
- close;
-N_CZomb:
- if (#Treasure_Token < 210) goto N_NeedToken;
- set #Treasure_Token,#Treasure_Token-210;
- logmes "Treasure Token: Bought a Zombie Card";
- getitem 4038,1;//Items: Zombie_Card,
- close;
-}
+ switch( select("Trade for zeny", "Trade for Weapons", "Trade for Cards", "Nevermind") ) {
+ case 1:
+ select("1000z - 1T","10000z - 10T","100000z - 100T","Nevermind");
+ thqs_trade_token(@menu);
+ case 2:
+ mes "[Ash]";
+ mes "This is what we have to offer.";
+ next;
+ select("Axe's","1 Handed Swords","2 Handed Swords","Book's","Bow's","Katar's","Knuckle's","Mace's","Whips","Wands","Nevermind");
+ ths_menu_weapons(@menu);
+ case 3:
+ mes "[Ash]";
+ mes "This is what we have to offer.";
+ next;
+ thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
+ case 4:
+ close;
+ }
+ end;
+} \ No newline at end of file
diff --git a/src/map/clif.c b/src/map/clif.c
index 0fc1fe044..cb2474961 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8136,7 +8136,7 @@ void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum
/// result:
/// 0 = failure
/// 1 = success
-void clif_GM_kickack(struct map_session_data *sd, int id)
+void clif_GM_kickack(struct map_session_data *sd, int result)
{
int fd;
@@ -8145,7 +8145,7 @@ void clif_GM_kickack(struct map_session_data *sd, int id)
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0xcd));
WFIFOW(fd,0) = 0xcd;
- WFIFOB(fd,2) = id; // FIXME: this is not account id
+ WFIFOB(fd,2) = result;
WFIFOSET(fd, packet_len(0xcd));
}
@@ -8159,7 +8159,7 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) {
map->quit(tsd);
if( sd )
- clif->GM_kickack(sd,tsd->status.account_id);
+ clif->GM_kickack(sd, 1);
}
diff --git a/src/map/clif.h b/src/map/clif.h
index d0444f9fe..7b27e1fe6 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -926,7 +926,7 @@ struct clif_interface {
void (*friendslist_toggle) (struct map_session_data *sd,int account_id, int char_id, int online);
void (*friendlist_req) (struct map_session_data* sd, int account_id, int char_id, const char* name);
/* gm-related */
- void (*GM_kickack) (struct map_session_data *sd, int id);
+ void (*GM_kickack) (struct map_session_data *sd, int result);
void (*GM_kick) (struct map_session_data *sd,struct map_session_data *tsd);
void (*manner_message) (struct map_session_data* sd, uint32 type);
void (*GM_silence) (struct map_session_data* sd, struct map_session_data* tsd, uint8 type);
diff --git a/src/map/map.c b/src/map/map.c
index 0d6445021..01d3dbb9f 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3656,6 +3656,8 @@ int inter_config_read(char *cfgName) {
strcpy(map->autotrade_merchants_db, w2);
else if(strcmpi(w1,"autotrade_data_db")==0)
strcpy(map->autotrade_data_db, w2);
+ else if(strcmpi(w1,"npc_market_data_db")==0)
+ strcpy(map->npc_market_data_db, w2);
/* sql log db */
else if(strcmpi(w1,"log_db_ip")==0)
strcpy(logs->db_ip, w2);
diff --git a/src/map/map.h b/src/map/map.h
index 8277c7a62..539b02ed8 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -845,6 +845,7 @@ struct map_interface {
char interreg_db[32];
char autotrade_merchants_db[32];
char autotrade_data_db[32];
+ char npc_market_data_db[32];
char default_codepage[32];
diff --git a/src/map/npc.c b/src/map/npc.c
index 5596b8e23..8e5854dbf 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1426,8 +1426,7 @@ void npc_market_fromsql(void) {
int itemid;
int amount;
- /* TODO inter-server.conf npc_market_data */
- if ( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `name`, `itemid`, `amount` FROM `npc_market_data`")
+ if ( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `name`, `itemid`, `amount` FROM `%s`", map->npc_market_data_db)
|| SQL_ERROR == SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
@@ -1474,20 +1473,20 @@ void npc_market_fromsql(void) {
* Saves persistent NPC Market Data into SQL
**/
void npc_market_tosql(struct npc_data *nd, unsigned short index) {
- /* TODO inter-server.conf npc_market_data */
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `npc_market_data` VALUES ('%s','%d','%d')", nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%d')",
+ map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty) )
Sql_ShowDebug(map->mysql_handle);
}
/**
* Removes persistent NPC Market Data from SQL
*/
void npc_market_delfromsql_sub(const char *npcname, unsigned short index) {
- /* TODO inter-server.conf npc_market_data */
if( index == USHRT_MAX ) {
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `npc_market_data` WHERE `name`='%s'", npcname) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `name`='%s'", map->npc_market_data_db, npcname) )
Sql_ShowDebug(map->mysql_handle);
} else {
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `npc_market_data` WHERE `name`='%s' AND `itemid`='%d' LIMIT 1", npcname, index) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `name`='%s' AND `itemid`='%d' LIMIT 1",
+ map->npc_market_data_db, npcname, index) )
Sql_ShowDebug(map->mysql_handle);
}
}
@@ -1520,7 +1519,7 @@ bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) {
/* nothing to display, no items available */
if( i == nd->u.scr.shop->items ) {
- clif->colormes(sd->fd,COLOR_RED,"Shop is out of stock! Come again later!");/* TODO messages.conf-it */
+ clif->colormes(sd->fd,COLOR_RED, msg_txt(881));
return false;
}
diff --git a/src/map/script.c b/src/map/script.c
index e4cf7f227..068be8524 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2914,6 +2914,8 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
return pc_setglobalreg_str(sd, num, str);
}
} else {// integer variable
+ // FIXME: This isn't safe, in 32bits systems we're converting a 64bit pointer
+ // to a 32bit int, this will lead to overflows! [Panikon]
int val = (int)__64BPTRSIZE(value);
if(script->str_data[script_getvarid(num)].type == C_PARAM) {