forked from Dniel97/artemis
Adding rare drops saving to SAO
This commit is contained in:
parent
84fc002cdb
commit
a0b25e2b7b
@ -676,6 +676,22 @@ class SaoBase:
|
||||
hero_data["skill_slot5_skill_id"]
|
||||
)
|
||||
|
||||
# Grab the rare loot from the table, match it with the right item and then push to the player profile
|
||||
for r in range(0,req_data.get_rare_drop_data_list_length):
|
||||
rewardList = self.game_data.static.get_rare_drop_id(int(req_data.get_rare_drop_data_list[r].quest_rare_drop_id))
|
||||
commonRewardId = rewardList["commonRewardId"]
|
||||
|
||||
heroList = self.game_data.static.get_hero_id(commonRewardId)
|
||||
equipmentList = self.game_data.static.get_equipment_id(commonRewardId)
|
||||
itemList = self.game_data.static.get_item_id(commonRewardId)
|
||||
|
||||
if heroList:
|
||||
self.game_data.item.put_hero_log(req_data.user_id, commonRewardId, 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
|
||||
if equipmentList:
|
||||
self.game_data.item.put_equipment_data(req_data.user_id, commonRewardId, 1, 200, 0, 0, 0)
|
||||
if itemList:
|
||||
self.game_data.item.put_item(req_data.user_id, commonRewardId)
|
||||
|
||||
# Generate random hero(es) based off the response
|
||||
for a in range(0,req_data.get_unanalyzed_log_tmp_reward_data_list_length):
|
||||
|
||||
@ -825,7 +841,6 @@ class SaoBase:
|
||||
player_level = int(data[i][0])
|
||||
break
|
||||
|
||||
# Update profile
|
||||
updated_profile = self.game_data.profile.put_profile(
|
||||
req_data.user_id,
|
||||
profile["user_type"],
|
||||
@ -866,6 +881,22 @@ class SaoBase:
|
||||
hero_data["skill_slot5_skill_id"]
|
||||
)
|
||||
|
||||
# Grab the rare loot from the table, match it with the right item and then push to the player profile
|
||||
for r in range(0,req_data.get_rare_drop_data_list_length):
|
||||
rewardList = self.game_data.static.get_rare_drop_id(int(req_data.get_rare_drop_data_list[r].quest_rare_drop_id))
|
||||
commonRewardId = rewardList["commonRewardId"]
|
||||
|
||||
heroList = self.game_data.static.get_hero_id(commonRewardId)
|
||||
equipmentList = self.game_data.static.get_equipment_id(commonRewardId)
|
||||
itemList = self.game_data.static.get_item_id(commonRewardId)
|
||||
|
||||
if heroList:
|
||||
self.game_data.item.put_hero_log(req_data.user_id, commonRewardId, 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
|
||||
if equipmentList:
|
||||
self.game_data.item.put_equipment_data(req_data.user_id, commonRewardId, 1, 200, 0, 0, 0)
|
||||
if itemList:
|
||||
self.game_data.item.put_item(req_data.user_id, commonRewardId)
|
||||
|
||||
# Generate random hero(es) based off the response
|
||||
for a in range(0,req_data.get_unanalyzed_log_tmp_reward_data_list_length):
|
||||
|
||||
|
@ -228,3 +228,27 @@ class SaoReader(BaseReader):
|
||||
continue
|
||||
except:
|
||||
self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping")
|
||||
|
||||
self.logger.info("Now reading RareDropTable.csv")
|
||||
try:
|
||||
fullPath = bin_dir + "/RareDropTable.csv"
|
||||
with open(fullPath, encoding="UTF-8") as fp:
|
||||
reader = csv.DictReader(fp)
|
||||
for row in reader:
|
||||
questRareDropId = row["QuestRareDropId"]
|
||||
commonRewardId = row["CommonRewardId"]
|
||||
enabled = True
|
||||
|
||||
self.logger.info(f"Added rare drop {questRareDropId} | Reward: {commonRewardId}")
|
||||
|
||||
try:
|
||||
self.data.static.put_rare_drop(
|
||||
0,
|
||||
questRareDropId,
|
||||
commonRewardId,
|
||||
enabled
|
||||
)
|
||||
except Exception as err:
|
||||
print(err)
|
||||
except:
|
||||
self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping")
|
||||
|
@ -96,6 +96,20 @@ support = Table(
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
rare_drop = Table(
|
||||
"sao_static_rare_drop_list",
|
||||
metadata,
|
||||
Column("id", Integer, primary_key=True, nullable=False),
|
||||
Column("version", Integer),
|
||||
Column("questRareDropId", Integer),
|
||||
Column("commonRewardId", Integer),
|
||||
Column("enabled", Boolean),
|
||||
UniqueConstraint(
|
||||
"version", "questRareDropId", "commonRewardId", name="sao_static_rare_drop_list_uk"
|
||||
),
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
title = Table(
|
||||
"sao_static_title_list",
|
||||
metadata,
|
||||
@ -216,6 +230,23 @@ class SaoStaticData(BaseData):
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
def put_rare_drop( self, version: int, questRareDropId: int, commonRewardId: int, enabled: bool ) -> Optional[int]:
|
||||
sql = insert(rare_drop).values(
|
||||
version=version,
|
||||
questRareDropId=questRareDropId,
|
||||
commonRewardId=commonRewardId,
|
||||
enabled=enabled,
|
||||
)
|
||||
|
||||
conflict = sql.on_duplicate_key_update(
|
||||
questRareDropId=questRareDropId, commonRewardId=commonRewardId, version=version
|
||||
)
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
def put_title( self, version: int, titleId: int, displayName: str, requirement: int, rank: int, imageFilePath: str, enabled: bool ) -> Optional[int]:
|
||||
sql = insert(title).values(
|
||||
version=version,
|
||||
@ -290,6 +321,14 @@ class SaoStaticData(BaseData):
|
||||
return None
|
||||
return result.fetchone()
|
||||
|
||||
def get_rare_drop_id(self, questRareDropId: int) -> Optional[Dict]:
|
||||
sql = rare_drop.select(rare_drop.c.questRareDropId == questRareDropId)
|
||||
|
||||
result = self.execute(sql)
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchone()
|
||||
|
||||
def get_item_ids(self, version: int, enabled: bool) -> Optional[List[Dict]]:
|
||||
sql = item.select(item.c.version == version and item.c.enabled == enabled).order_by(
|
||||
item.c.itemId.asc()
|
||||
|
Loading…
Reference in New Issue
Block a user