diff options
-rw-r--r-- | npc/custom/eAAC_Scripts/DonationGirl/donate.txt | 18 | ||||
-rw-r--r-- | npc/custom/eAAC_Scripts/DonationGirl/donate_item_db.sql | 14 | ||||
-rw-r--r-- | npc/custom/eAAC_Scripts/DonationGirl/readme.txt | 34 | ||||
-rw-r--r-- | npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql (renamed from npc/custom/eAAC_Scripts/DonationGirl/donate.sql) | 4 | ||||
-rw-r--r-- | npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql | 14 |
5 files changed, 26 insertions, 58 deletions
diff --git a/npc/custom/eAAC_Scripts/DonationGirl/donate.txt b/npc/custom/eAAC_Scripts/DonationGirl/donate.txt index 5ef48ebce..99a2776f1 100644 --- a/npc/custom/eAAC_Scripts/DonationGirl/donate.txt +++ b/npc/custom/eAAC_Scripts/DonationGirl/donate.txt @@ -19,6 +19,8 @@ //= in sql queries are now escaped. Each item has a
//= price rather than a quantity. This script can work
//= with decimals.
+//= 3.1 - Added quotes to some queries, fixed a variable and
+//= removed a comment.
//===== Compatible With =====================================
//= eAthena - any version that contains the escape_sql
//= function (Stable 6299 OR Trunk 6262)
@@ -26,8 +28,8 @@ //= A script that lets a player claim an item for donating.
//= Allows a GM to input each donation.
//===== Comments ============================================
-//= This script uses an sql table (donate) to store
-//= variables for the amount donated by a user.
+//= This script uses sql tables to store variables for the
+//= amount donated by users and the items claimable.
//===== Installation ========================================
//= You must execute donate.sql and donate_item_db.sql before
//= using this script.
@@ -41,6 +43,7 @@ prontera.gat,145,179,5 script Donation Girl 714,{
if (getgmlevel() >= 80) goto L_GM;
+
L_START:
mes "[Donation Girl]";
mes "Hello! I'm the Donation Girl!";
@@ -65,8 +68,8 @@ L_CHECK: query_sql "SELECT `amount` FROM `donate` WHERE `account_id` = "+escape_sql(getcharid(3))+"", @amount$;
query_sql "SELECT `claimed` FROM `donate` WHERE `account_id` = "+escape_sql(getcharid(3))+"", @claimed$;
query_sql "SELECT MIN(price) FROM `donate_item_db`", @min$;
-query_sql "SELECT "+@amount$+" - "+@claimed$+"", @value$;
-query_sql "SELECT "+@value$+" >= "+@min$+"", @enough;
+query_sql "SELECT '"+@amount$+"' - '"+@claimed$+"'", @value$;
+query_sql "SELECT '"+@value$+"' >= '"+@min$+"'", @enough;
if(@enough) goto L_CLAIM;
mes "[Donation Girl]";
mes "Sorry, you do not have enough to make a claim.";
@@ -100,7 +103,6 @@ set @menu, (select($@menu$))-1; query_sql "SELECT ID FROM `donate_item_db` WHERE name = '"+$@name$[@menu]+"'", @id;
query_sql "SELECT price FROM `donate_item_db` WHERE ID = "+@id+"", @price$;
query_sql "SELECT TRUNCATE("+@value$+" / "+@price$+",0)", @max;
-//query_sql "SELECT "+@value$+" div "+@price$+"", @max;
mes "[Donation Girl]";
mes ""+$@name$[@menu]+"s cost $"+@price$+" each.";
@@ -245,13 +247,13 @@ input @donator$; query_sql "SELECT `account_id` FROM `login` WHERE `userid` = '"+escape_sql(@donator$)+"'", @aid;
if(@aid==0) goto L_NONE;
query_sql "SELECT `amount` FROM `donate` WHERE `account_id` = "+@aid+"", @donated$;
-query_sql "SELECT "+@donated$+" > 0", @donated;
+query_sql "SELECT '"+@donated$+"' > 0", @donated;
switch(@donated) {
case 0:
mes ""+@donator$+" has not donated before.";
break;
case 1:
- mes ""+@donator$+" has donated $"+@donated+".";
+ mes ""+@donator$+" has donated $"+@donated$+".";
break;
}
next;
@@ -300,7 +302,7 @@ input @donator$; query_sql "SELECT `account_id` FROM `login` WHERE `userid` = '"+escape_sql(@donator$)+"'", @aid;
if(@aid==0) goto L_NONE;
query_sql "SELECT `amount` FROM `donate` WHERE `account_id` = "+@aid+"", @donated$;
-query_sql "SELECT "+@donated$+" > 0", @donated;
+query_sql "SELECT '"+@donated$+"' > 0", @donated;
if(@donated==0) {
query_sql "DELETE FROM `donate` WHERE `account_id` = '"+@aid+"'";
diff --git a/npc/custom/eAAC_Scripts/DonationGirl/donate_item_db.sql b/npc/custom/eAAC_Scripts/DonationGirl/donate_item_db.sql deleted file mode 100644 index 5a4088d9a..000000000 --- a/npc/custom/eAAC_Scripts/DonationGirl/donate_item_db.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `donate_item_db` (
- `id` smallint(5) unsigned NOT NULL default '0',
- `name` varchar(30) NOT NULL default '',
- `amount` smallint(5) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
--- // (ID,'Name',Amount);
-REPLACE INTO `donate_item_db` VALUES (601,'Fly_Wing',165);
-REPLACE INTO `donate_item_db` VALUES (602,'Butterfly_Wing',30);
-REPLACE INTO `donate_item_db` VALUES (603,'Old_Blue_Box',1);
-REPLACE INTO `donate_item_db` VALUES (604,'Dead_Branch',200);
-REPLACE INTO `donate_item_db` VALUES (605,'Anodyne',5);
-REPLACE INTO `donate_item_db` VALUES (606,'Aloevera',5);
\ No newline at end of file diff --git a/npc/custom/eAAC_Scripts/DonationGirl/readme.txt b/npc/custom/eAAC_Scripts/DonationGirl/readme.txt deleted file mode 100644 index 2454b68e4..000000000 --- a/npc/custom/eAAC_Scripts/DonationGirl/readme.txt +++ /dev/null @@ -1,34 +0,0 @@ -===== Athena Script ========================================
-= Donation NPC =
-===== By ===================================================
-= Josh =
-===== Version ==============================================
-= 1.0 - First release. Probably contains bugs/security =
-= risks =
-= 1.1 - Added a check for whether the account exists when =
-= adding a donator. Need to improve ordering when =
-= viewing all donations. =
-= 1.2 - Modified for public use. Added checkweight feature.=
-= 2.0 - Many changes, especially ones I had always wanted =
-= to add to this script. Includes reading items from =
-= a separate sql table and more database manipulation=
-= options for GMs. =
-= 2.1 - Made few changes including the add/remove items =
-= feature. =
-===== Compatible With ======================================
-= eAthena - any version that contains the sql_query =
-= function (4368) =
-===== Description ==========================================
-= A script that lets a player claim an item for donating. =
-= Allows a GM to input each donation. =
-===== Comments =============================================
-= This script uses an sql table (donate) to store =
-= variables for the amount donated by a user. =
-===== Installation =========================================
-= You must execute donate.sql and donate_item_db.sql before=
-= using this script. =
-============================================================
-= Thanks to Vich for helping me with the SQL syntax. =
-= Thanks to Lance for helping me with the the arrays and =
-= for implementing this feature. XD =
-============================================================
\ No newline at end of file diff --git a/npc/custom/eAAC_Scripts/DonationGirl/donate.sql b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql index 29a392afe..3b7eefbed 100644 --- a/npc/custom/eAAC_Scripts/DonationGirl/donate.sql +++ b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql @@ -1,6 +1,6 @@ CREATE TABLE `donate` (
`account_id` int(11) unsigned NOT NULL,
- `amount` tinyint(3) unsigned NOT NULL,
- `claimed` tinyint(3) unsigned NOT NULL,
+ `amount` float(5,2) unsigned NOT NULL,
+ `claimed` float(5,2) unsigned NOT NULL,
PRIMARY KEY (`account_id`,`amount`)
) TYPE=MyISAM;
\ No newline at end of file diff --git a/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql new file mode 100644 index 000000000..604373139 --- /dev/null +++ b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql @@ -0,0 +1,14 @@ +CREATE TABLE `donate_item_db` (
+ `id` smallint(5) unsigned NOT NULL default '0',
+ `name` varchar(30) NOT NULL default '',
+ `price` float(5,2) unsigned NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+#(ID,'Name',Price);
+REPLACE INTO `donate_item_db` VALUES (601,'Fly_Wing',0.06);
+REPLACE INTO `donate_item_db` VALUES (602,'Butterfly_Wing',0.33);
+REPLACE INTO `donate_item_db` VALUES (603,'Old_Blue_Box',10);
+REPLACE INTO `donate_item_db` VALUES (604,'Dead_Branch',0.05);
+REPLACE INTO `donate_item_db` VALUES (605,'Anodyne',2);
+REPLACE INTO `donate_item_db` VALUES (606,'Aloevera',2);
\ No newline at end of file |