mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Implemented Salvage AA.
Added a new coloumn to tradeskill_recipe_entires called salvagecount that works much in the same way to fail/success/componentcount The code will default to the component list if nothing is found with a salvagecount New script: generate_salvage.py will generate the entries for recipes with a failcount (make sure your config is vaild XML as well, it complains if it isn't)
This commit is contained in:
parent
53301289f5
commit
f8795bcd72
@ -1,5 +1,11 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
|
||||||
|
== 04/04/2013==
|
||||||
|
demonstar55: Implemented Salvage AA
|
||||||
|
required SQL: 2013_04_08_Salvage.sql
|
||||||
|
script: generate_salvage.py - will generate the entries for some exceptions for salvage returns.
|
||||||
|
|
||||||
== 04/04/2013 ==
|
== 04/04/2013 ==
|
||||||
demonstar55: Implemented SE_ForageAdditionalItems as a bonus
|
demonstar55: Implemented SE_ForageAdditionalItems as a bonus
|
||||||
required SQL: 2013_04_04_NaturesBounty.sql
|
required SQL: 2013_04_04_NaturesBounty.sql
|
||||||
|
|||||||
84
utils/scripts/generate_salvage.py
Normal file
84
utils/scripts/generate_salvage.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
# Requires MySQLdb (python-mysqldb)
|
||||||
|
|
||||||
|
import MySQLdb as mdb
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def main():
|
||||||
|
con = None
|
||||||
|
table = "tradeskill_recipe_entries"
|
||||||
|
db = "eq"
|
||||||
|
user = "eq"
|
||||||
|
password = "eq"
|
||||||
|
host = "localhost"
|
||||||
|
|
||||||
|
try:
|
||||||
|
tree = ET.parse('eqemu_config.xml')
|
||||||
|
database = tree.getroot().find('database')
|
||||||
|
db = database.find('db').text
|
||||||
|
user = database.find('username').text
|
||||||
|
password = database.find('password').text
|
||||||
|
host = database.find('host').text
|
||||||
|
|
||||||
|
except:
|
||||||
|
print("Trying with defaults")
|
||||||
|
print("Do you have a valid XML?")
|
||||||
|
|
||||||
|
try:
|
||||||
|
con = mdb.connect(host, user, password, db)
|
||||||
|
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute("SELECT MAX(id) FROM `tradeskill_recipe")
|
||||||
|
data = cur.fetchone()
|
||||||
|
highest = data[0]
|
||||||
|
for recipe_id in range(1, highest+1):
|
||||||
|
genflag = False
|
||||||
|
complist = []
|
||||||
|
cur.execute("SELECT item_id,componentcount FROM " + table + " WHERE componentcount>0 AND recipe_id=" + str(recipe_id))
|
||||||
|
rows = cur.fetchall()
|
||||||
|
for row in rows:
|
||||||
|
complist.append(row)
|
||||||
|
|
||||||
|
faillist = []
|
||||||
|
cur.execute("SELECT item_id,failcount FROM " + table + " WHERE failcount>0 AND recipe_id=" + str(recipe_id))
|
||||||
|
rows = cur.fetchall()
|
||||||
|
for row in rows:
|
||||||
|
faillist.append(row)
|
||||||
|
|
||||||
|
# Remove any items that are returned on a failure
|
||||||
|
for item in faillist:
|
||||||
|
if item in complist:
|
||||||
|
genflag = True
|
||||||
|
complist.remove(item)
|
||||||
|
|
||||||
|
# Remove some items that don't make sense
|
||||||
|
for item in faillist:
|
||||||
|
if item[0] == 10062:
|
||||||
|
for item2 in complist:
|
||||||
|
if item2[0] == 93510:
|
||||||
|
genflag = True
|
||||||
|
complist.remove(item2)
|
||||||
|
if item[0] == 93618:
|
||||||
|
for item2 in complist:
|
||||||
|
if item2[0] in [93508, 93509]:
|
||||||
|
genflag = True
|
||||||
|
complist.remove(item2)
|
||||||
|
|
||||||
|
|
||||||
|
if genflag:
|
||||||
|
for item in complist:
|
||||||
|
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:
|
||||||
|
print("Error %d: %s", e.args[0],e.args[1])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if con:
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Loading…
x
Reference in New Issue
Block a user