mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Realized there was a better way to do the DB entries for salvage, so I changed the script.
Run the optional 2013_04_09_SalvageCleanOld.sql if you ran the old script.
This commit is contained in:
parent
f8795bcd72
commit
b8febdd440
@ -1,7 +1,11 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
|
||||||
== 04/04/2013==
|
== 04/09/2013 ==
|
||||||
|
demonstar55: Realized I was an idiot, changed salvage script to be better
|
||||||
|
optional SQL: 2013_04_09_SalvageCleanOld.sql - run if ran old script
|
||||||
|
|
||||||
|
== 04/08/2013 ==
|
||||||
demonstar55: Implemented Salvage AA
|
demonstar55: Implemented Salvage AA
|
||||||
required SQL: 2013_04_08_Salvage.sql
|
required SQL: 2013_04_08_Salvage.sql
|
||||||
script: generate_salvage.py - will generate the entries for some exceptions for salvage returns.
|
script: generate_salvage.py - will generate the entries for some exceptions for salvage returns.
|
||||||
|
|||||||
@ -33,7 +33,6 @@ def main():
|
|||||||
data = cur.fetchone()
|
data = cur.fetchone()
|
||||||
highest = data[0]
|
highest = data[0]
|
||||||
for recipe_id in range(1, highest+1):
|
for recipe_id in range(1, highest+1):
|
||||||
genflag = False
|
|
||||||
complist = []
|
complist = []
|
||||||
cur.execute("SELECT item_id,componentcount FROM " + table + " WHERE componentcount>0 AND recipe_id=" + str(recipe_id))
|
cur.execute("SELECT item_id,componentcount FROM " + table + " WHERE componentcount>0 AND recipe_id=" + str(recipe_id))
|
||||||
rows = cur.fetchall()
|
rows = cur.fetchall()
|
||||||
@ -49,7 +48,6 @@ def main():
|
|||||||
# Remove any items that are returned on a failure
|
# Remove any items that are returned on a failure
|
||||||
for item in faillist:
|
for item in faillist:
|
||||||
if item in complist:
|
if item in complist:
|
||||||
genflag = True
|
|
||||||
complist.remove(item)
|
complist.remove(item)
|
||||||
|
|
||||||
# Remove some items that don't make sense
|
# Remove some items that don't make sense
|
||||||
@ -57,18 +55,15 @@ def main():
|
|||||||
if item[0] == 10062:
|
if item[0] == 10062:
|
||||||
for item2 in complist:
|
for item2 in complist:
|
||||||
if item2[0] == 93510:
|
if item2[0] == 93510:
|
||||||
genflag = True
|
|
||||||
complist.remove(item2)
|
complist.remove(item2)
|
||||||
if item[0] == 93618:
|
if item[0] == 93618:
|
||||||
for item2 in complist:
|
for item2 in complist:
|
||||||
if item2[0] in [93508, 93509]:
|
if item2[0] in [93508, 93509]:
|
||||||
genflag = True
|
|
||||||
complist.remove(item2)
|
complist.remove(item2)
|
||||||
|
|
||||||
|
|
||||||
if genflag:
|
for item in complist:
|
||||||
for item in complist:
|
cur.execute("UPDATE `" + table + "` SET `salvagecount` = '" + str(item[1]) + "' WHERE `componentcount` > '0' AND `item_id` = '" + str(item[0]) + "' AND `recipe_id` = '" + str(recipe_id) + "';")
|
||||||
cur.execute("INSERT INTO `" + table + "` (`recipe_id`, `item_id`, `componentcount`, `salvagecount`) VALUES ('" + str(recipe_id) + "', '" + str(item[0]) + "', '0', '" + str(item[1]) + "');\n")
|
|
||||||
|
|
||||||
except mdb.Error, e:
|
except mdb.Error, e:
|
||||||
print("Error %d: %s", e.args[0],e.args[1])
|
print("Error %d: %s", e.args[0],e.args[1])
|
||||||
|
|||||||
2
utils/sql/git/optional/2013_04_09_SalvageCleanOld.sql
Normal file
2
utils/sql/git/optional/2013_04_09_SalvageCleanOld.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DELETE FROM `tradeskill_recipe_entries` WHERE `salvagecount`>0 AND `componentcount`='0';
|
||||||
|
|
||||||
@ -1426,36 +1426,18 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
|
|||||||
|
|
||||||
spec->salvage.clear();
|
spec->salvage.clear();
|
||||||
// Don't bother with the query if TS is nofail
|
// Don't bother with the query if TS is nofail
|
||||||
if (!spec->nofail) {
|
if (!spec->nofail && RunQuery(query, qlen, errbuf, &result)) {
|
||||||
if (RunQuery(query, qlen, errbuf, &result)) {
|
qcount = mysql_num_rows(result);
|
||||||
qcount = mysql_num_rows(result);
|
uint8 r;
|
||||||
uint8 r;
|
for(r = 0; r < qcount; r++) {
|
||||||
for(r = 0; r < qcount; r++) {
|
row = mysql_fetch_row(result);
|
||||||
row = mysql_fetch_row(result);
|
uint32 item = (uint32)atoi(row[0]);
|
||||||
uint32 item = (uint32)atoi(row[0]);
|
uint8 num = (uint8)atoi(row[1]);
|
||||||
uint8 num = (uint8)atoi(row[1]);
|
spec->salvage.push_back(pair<uint32,uint8>(item, num));
|
||||||
spec->salvage.push_back(pair<uint32,uint8>(item, num));
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Previous query returned nothing, default to component list
|
|
||||||
if (!spec->salvage.size()) {
|
|
||||||
qlen = MakeAnyLenString(&query, "SELECT item_id,componentcount FROM tradeskill_recipe_entries"
|
|
||||||
" WHERE componentcount>0 AND recipe_id=%u", recipe_id);
|
|
||||||
if (RunQuery(query, qlen, errbuf, &result)) {
|
|
||||||
qcount = mysql_num_rows(result);
|
|
||||||
uint8 r;
|
|
||||||
for(r =0; r < qcount; r++) {
|
|
||||||
row = mysql_fetch_row(result);
|
|
||||||
uint32 item = (uint32)atoi(row[0]);
|
|
||||||
uint8 num = (uint8)atoi(row[1]);
|
|
||||||
spec->salvage.push_back(pair<uint32,uint8>(item, num));
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
mysql_free_result(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user