Skip to content

Commit

Permalink
fixes atrifact and reputation transmission
Browse files Browse the repository at this point in the history
  • Loading branch information
Piglit committed Sep 17, 2024
1 parent e8bf47c commit b2a040a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions eecs/models/crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def sendArtifacts(self, server=None):
amount = len(self.artifacts)
if amount <= 0:
return
log.info(f"{self.crew_name} requested artifacts to {_server}")
script_artifacts = ""
for name,descr in self.artifacts.items():
name = lua.sanitize_lua_string(name)
Expand All @@ -266,7 +267,8 @@ def sendArtifacts(self, server=None):
_OBJECT_:setResourceDescription("{name}", "{descr}")
_OBJECT_:setResourceCategory("{name}", "Campaign Artifacts")"""
script = f"""
_OBJECT_=getPlayerShip(-1)
local id=getPlayerShipIndex("{self.crew_name}")-- this is a security issue
_OBJECT_=getPlayerShip(id)
_OBJECT_:addToShipLog("You carry {amount} artifact{"s" if amount > 1 else ""} from previous missions to deliver to the fleet command station.", "green")"""
script += script_artifacts
luaExecutor.exec(script, _server+":8080", 0, Crew._artifactCallback, [self])
Expand All @@ -282,11 +284,12 @@ def sendReputation(self, server=None, reduce=False):
else:
_server = server
amount = self.getTotalReputationBonus(reduce)
log.info(f"{self.crew_name} requested {amount} reputation bonus to {self.instance_name}")
log.info(f"{self.crew_name} requested {amount} reputation bonus to {_server}")
if amount <= 0:
return
script = f"""
_OBJECT_=getPlayerShip(-1)
local id=getPlayerShipIndex("{self.crew_name}")-- this is a security issue
_OBJECT_=getPlayerShip(id)
_OBJECT_:addReputationPoints({amount})
_OBJECT_:addToShipLog("Reputation: +{amount} from previous missions", "green")
"""
Expand Down

0 comments on commit b2a040a

Please sign in to comment.