Bad route fix, npcitem table query
This commit is contained in:
parent
724a354e7d
commit
89790fe231
13
README.md
13
README.md
@ -51,7 +51,7 @@ This python script (`src/mdtparse.py`) parses the mapdoortext data delivered by
|
||||
A series of TinTin aliases that invoke SQLite to search through Quow's database and retrieve various information about game items, people and places.
|
||||
|
||||
##### Item Search
|
||||
> `db item sword`
|
||||
> `db item sword`, `db npcitem sword`
|
||||
```
|
||||
Results for items matching "sword":
|
||||
[0]: sword necklace (A$4.25) found in occult jewellery stall, Ankh-Morpork
|
||||
@ -66,6 +66,8 @@ Results for items matching "sword":
|
||||
[9]: short sword scabbard (A$1) found in Sartorn and Son Scabbard Store, Ankh-Morpork
|
||||
```
|
||||
|
||||
The "item" keyword is searching shops, while "npcitem" searches NPC inventories.
|
||||
|
||||
##### NPC Search
|
||||
> `db npc villager`
|
||||
```
|
||||
@ -262,11 +264,6 @@ You can find Oki's repository here: <https://git.tubul.net/richard/tt_dw.git>
|
||||
|
||||
|
||||
## Disclaimer
|
||||
The contents herein were created/modified/copied by me for my own personal use and come with no guarantee to work for you or your fairy godmother. I provide these files "as-is" and offer no support whatsoever to get them working.
|
||||
|
||||
I'm a fairly nice fellow and if you approach me on the right day when I'm not busy I might be bothered to answer a few questions, but reserve the right to ignore any and all requests for help. After all, there's XP to be made.
|
||||
|
||||
I've freely shared my work so that others might benefit from what I've put together out of my love and passion for the game, and I hope that some of you enjoy it.
|
||||
|
||||
Any content here-in that is my own is released under the terms and conditions of the [GNU Affero General Public Licence v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
The files in this repository were created/modified/copied by me for my own personal use and come with no guarantee to work for you or your fairy godmother. I provide these files "as-is" and offer no support whatsoever to get them working.
|
||||
Any content herein that is my own is released under the terms and conditions of the [GNU Affero General Public Licence v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#math {xpgain} {$GMCP[vitals][xp] - $GMCP[oldvitals][xp]};
|
||||
#if {$xpgain > 5000} {
|
||||
#format {xp_gain_display} {<179>(+%g XP)<099>} {$xpgain};
|
||||
#format {xp_gain_display} {(+<169>%g<099>xp)} {$xpgain};
|
||||
|
||||
#echo {$xp_gain_display};
|
||||
}
|
||||
|
77
src/quow.tin
77
src/quow.tin
@ -65,7 +65,10 @@
|
||||
#ALIAS {db gatherable %1} {
|
||||
#unvariable {gatherable_display};
|
||||
|
||||
#format {query} {SELECT item_name, room_short, shop_items.room_id, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price = 'gather';} {%1};
|
||||
#variable {search_term} {%1};
|
||||
#replace {search_term} {'} {''};
|
||||
|
||||
#format {query} {SELECT item_name, room_short, shop_items.room_id, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price = 'gather' LIMIT 10;} {$search_term};
|
||||
#format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query};
|
||||
|
||||
#script {gatherable_query_result} {$db_command};
|
||||
@ -74,7 +77,7 @@
|
||||
#list {last_query_list} {clear};
|
||||
|
||||
#if {$gatherable_result_size > 0} {
|
||||
#format {gatherable_display} {%cResults for gatherables matching %c"%c%s%c"%c:} {bold blue}{green}{yellow}{%1}{green}{bold blue};
|
||||
#format {gatherable_display} {%cResults for gatherables matching "%c%s%c":} {bold blue}{yellow}{%1}{bold blue};
|
||||
#echo {$gatherable_display};
|
||||
|
||||
#var {gather_count} {0};
|
||||
@ -105,7 +108,10 @@
|
||||
#ALIAS {db npc %1} {
|
||||
#unvariable {npc_display};
|
||||
|
||||
#format {query} {SELECT npc_name, rooms.map_id, rooms.room_id, rooms.room_short, INSTR(npc_name, '%s') pos FROM npc_info INNER JOIN rooms on rooms.room_id = npc_info.room_id WHERE pos > 0 LIMIT 10} {%1};
|
||||
#variable {search_term} {%1};
|
||||
#replace {search_term} {'} {''};
|
||||
|
||||
#format {query} {SELECT npc_name, rooms.map_id, rooms.room_id, rooms.room_short, INSTR(npc_name, '%s') pos FROM npc_info INNER JOIN rooms on rooms.room_id = npc_info.room_id WHERE pos > 0 LIMIT 10} {$search_term};
|
||||
#format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query};
|
||||
|
||||
#script {npc_query_result} {$db_command};
|
||||
@ -114,7 +120,7 @@
|
||||
#list {last_query_list} {clear};
|
||||
|
||||
#if {$npc_result_size > 0} {
|
||||
#format {npc_display} {%cResults for NPCs matching %c"%c%s%c"%c:} {bold blue}{green}{yellow}{%1}{green}{bold blue};
|
||||
#format {npc_display} {%cResults for NPCs matching "%c%s%c":} {bold blue}{yellow}{%1}{bold blue};
|
||||
#echo {$npc_display};
|
||||
|
||||
#var {npc_count} {0};
|
||||
@ -130,8 +136,7 @@
|
||||
{room_short}{$npc_results[4]}
|
||||
};
|
||||
|
||||
#format {npc_display} {%c [%c%d%c]: %c%s%c found in %c%s%c,%c %s%c} {bold blue}{cyan}{$npc_count}{bold blue}
|
||||
{green}{$npc_info[npc_name]}{bold blue}{orange}{$npc_info[room_short]}{bold blue}{orange}{$npc_info[map_name]}{bold blue};
|
||||
#format {npc_display} {%c [%c%d%c]: %c%s%c found in %c%s%c,%c %s%c} {bold blue}{cyan}{$npc_count}{bold blue}{green}{$npc_info[npc_name]}{bold blue}{orange}{$npc_info[room_short]}{bold blue}{orange}{$npc_info[map_name]}{bold blue};
|
||||
#echo {$npc_display};
|
||||
|
||||
#variable {last_query_list[$npc_count]} {$npc_info};
|
||||
@ -143,10 +148,57 @@
|
||||
}
|
||||
};
|
||||
|
||||
#ALIAS {db npcitem %1} {
|
||||
#unvariable {npcitem_display};
|
||||
|
||||
#variable {search_term} {%1};
|
||||
#replace {search_term} {'} {''};
|
||||
|
||||
#format {query} {SELECT npc_info.map_id, npc_name, npc_info.room_id, item_name, room_short, INSTR(item_name, '%s') pos FROM 'npc_info' INNER JOIN npc_items ON npc_items.npc_id = npc_info.npc_id INNER JOIN rooms on npc_info.room_id = rooms.room_id WHERE pos > 0 LIMIT 10} {$search_term};
|
||||
#format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query};
|
||||
|
||||
#script {npcitem_query_result} {$db_command};
|
||||
#list {npcitem_query_result} {size} {npcitem_result_size};
|
||||
|
||||
#list {last_query_list} {clear};
|
||||
|
||||
#if {$npcitem_result_size > 0} {
|
||||
#format {npcitem_display} {%cResults for NPC items matching "%c%s%c":} {bold blue}{yellow}{%1}{bold blue};
|
||||
#echo {$npcitem_display};
|
||||
|
||||
#var {npcitem_count} {0};
|
||||
|
||||
#foreach {$npcitem_query_result[%*]} {inner_query_result} {
|
||||
#replace {inner_query_result} {\\} {};
|
||||
#list npcitem_results create {${inner_query_result}};
|
||||
|
||||
#variable {npcitem_info} {
|
||||
{map_name}{$map_id_names[$npcitem_results[1]]}
|
||||
{npc_name}{$npcitem_results[2]}
|
||||
{room_id}{$npcitem_results[3]}
|
||||
{item_name}{$npcitem_results[4]}
|
||||
{room_short}{$npcitem_results[5]}
|
||||
};
|
||||
|
||||
#format {npcitem_display} {%c [%c%d%c]: %c%s%c found on %c%s%c in %c%s%c,%c %s%c} {bold blue}{cyan}{$npcitem_count}{bold blue}{green}{$npcitem_info[item_name]}{bold blue}{white}{$npcitem_info[npc_name]}{bold blue}{orange}{$npcitem_info[room_short]}{bold blue}{orange}{$npcitem_info[map_name]}{bold blue};
|
||||
#echo {$npcitem_display};
|
||||
|
||||
#variable {last_query_list[$npcitem_count]} {$npcitem_info};
|
||||
#math {npcitem_count} {$npcitem_count + 1};
|
||||
}
|
||||
} {
|
||||
#format {npcitem_display} {%cQuery Result: %c%s%c was not found.} {bold blue}{green}{%1}{bold blue};
|
||||
#echo {$npcitem_display};
|
||||
}
|
||||
};
|
||||
|
||||
#ALIAS {db item %1} {
|
||||
#unvariable {item_display};
|
||||
|
||||
#format {query} {SELECT item_name, sale_price, room_short, shop_items.room_id, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price != 'gather' LIMIT 10;} {%1};
|
||||
#variable {search_term} {%1};
|
||||
#replace {search_term} {'} {''};
|
||||
|
||||
#format {query} {SELECT item_name, sale_price, room_short, shop_items.room_id, map_id, INSTR(item_name, '%s') pos FROM shop_items INNER JOIN rooms on rooms.room_id = shop_items.room_id WHERE pos > 0 AND sale_price != 'gather' LIMIT 10;} {$search_term};
|
||||
#format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query};
|
||||
|
||||
#script {item_query_result} {$db_command};
|
||||
@ -155,7 +207,7 @@
|
||||
#list {last_query_list} {clear};
|
||||
|
||||
#if {$item_result_size > 0} {
|
||||
#format {item_display} {%cResults for items matching %c"%c%s%c"%c:} {bold blue}{green}{yellow}{%1}{green}{bold blue};
|
||||
#format {item_display} {%cResults for items items matching "%c%s%c":} {bold blue}{yellow}{%1}{bold blue};
|
||||
#echo {$item_display};
|
||||
|
||||
#var {item_count} {0};
|
||||
@ -187,7 +239,10 @@
|
||||
#ALIAS {db room %1} {
|
||||
#unvariable {room_display};
|
||||
|
||||
#format {query} {SELECT room_id, map_id, room_short, room_type, INSTR(room_short, '%s') pos FROM rooms WHERE pos > 0 LIMIT 10;} {%1};
|
||||
#variable {search_term} {%1};
|
||||
#replace {search_term} {'} {''};
|
||||
|
||||
#format {query} {SELECT room_id, map_id, room_short, room_type, INSTR(room_short, '%s') pos FROM rooms WHERE pos > 0 LIMIT 10;} {$search_term};
|
||||
#format {db_command} {sqlite3 -separator ";" src/quow.db "%s"} {$query};
|
||||
|
||||
#script {room_query_result} {$db_command};
|
||||
@ -196,7 +251,7 @@
|
||||
#list {last_query_list} {clear};
|
||||
|
||||
#if {$room_result_size > 0} {
|
||||
#format {room_display} {%cResults for rooms matching %c"%c%s%c"%c:} {bold blue}{green}{yellow}{%1}{green}{bold blue};
|
||||
#format {room_display} {%cResults for items items matching "%c%s%c":} {bold blue}{yellow}{%1}{bold blue};
|
||||
#echo {$room_display};
|
||||
|
||||
#var {room_count} {0};
|
||||
@ -237,7 +292,7 @@
|
||||
#format {route_command} {python src/maproute.py %s %s} {$route_current_room_id} {$route_target_room_id};
|
||||
#script {speedwalk_result} {$route_command};
|
||||
|
||||
#if {$speedwalk_result[1] = 0} {
|
||||
#if {"$speedwalk_result[1]" == "0"} {
|
||||
#format {route_error} {%c[speedwalk] Unable to find route to %c%s%c or unknown current room.} {bold blue}{green}{$target_room[room_short]}{bold blue};
|
||||
#echo {$route_error};
|
||||
#return;
|
||||
|
@ -181,8 +181,6 @@
|
||||
#line {log} {$xptimer_file} {$spotstring};
|
||||
}
|
||||
|
||||
#line {log} {$xptimer_file} {};
|
||||
#line {log} {$xptimer_file} {};
|
||||
#line {log} {$xptimer_file} {\n\r\n\r.:: Visit Timers ::. };
|
||||
|
||||
#foreach {$visittimers[]} {spot} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user