-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrects missing images #25
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -432,10 +432,12 @@ class CSGOCdn extends EventEmitter { | |
return; | ||
} | ||
|
||
const fileName = large ? `${name}_large.png` : `${name}.png`; | ||
const foundName = name.split('/').pop().toLowerCase(); | ||
|
||
const fileName = large ? `${foundName}_large.png` : `${foundName}.png`; | ||
const path = this.vpkFiles.find((t) => t.endsWith(fileName)); | ||
|
||
if (path) return this.getPathURL(path); | ||
if (path) return this.getPathURL(path).replace('\r', ''); | ||
} | ||
|
||
/** | ||
|
@@ -475,7 +477,7 @@ class CSGOCdn extends EventEmitter { | |
// Get the image url | ||
const cdnName = `${weaponName}_${skinName}`; | ||
|
||
return this.itemsGameCDN[cdnName]; | ||
return this.itemsGameCDN[cdnName].replace('\r', ''); | ||
} | ||
|
||
/** | ||
|
@@ -543,7 +545,16 @@ class CSGOCdn extends EventEmitter { | |
|
||
if (!match) return; | ||
|
||
const stickerName = match[1]; | ||
let stickerName = match[1]; | ||
|
||
const pharantesisWithSpaceIndex = stickerName.indexOf(' ('); | ||
const pharantesisWithoutSpaceIndex = stickerName.indexOf('('); | ||
|
||
if( pharantesisWithSpaceIndex === -1 && pharantesisWithoutSpaceIndex > -1 ) { | ||
const stickerNameArr = stickerName.split(''); | ||
stickerNameArr.splice(pharantesisWithoutSpaceIndex, 0, ' '); | ||
stickerName = stickerNameArr.join(''); | ||
} | ||
|
||
for (const tag of this.csgoEnglish['inverted'][stickerName] || []) { | ||
const stickerTag = `#${tag}`; | ||
|
@@ -614,7 +625,7 @@ class CSGOCdn extends EventEmitter { | |
const url = this.getStickerURL(kit.sticker_material, true); | ||
|
||
if (url) { | ||
return url; | ||
return url.replace('\r', ''); | ||
} | ||
} | ||
} | ||
|
@@ -713,7 +724,7 @@ class CSGOCdn extends EventEmitter { | |
const path = (paintKit ? `${weaponClass}_${paintKit}` : weaponClass).toLowerCase(); | ||
|
||
if (this.itemsGameCDN[path]) { | ||
return this.itemsGameCDN[path]; | ||
return this.itemsGameCDN[path].replace('\r', ''); | ||
} | ||
} | ||
} | ||
|
@@ -753,7 +764,7 @@ class CSGOCdn extends EventEmitter { | |
const url = this.getPathURL(path); | ||
|
||
if (url) { | ||
return url; | ||
return url.replace('\r', ''); | ||
} | ||
} | ||
} | ||
|
@@ -795,6 +806,10 @@ class CSGOCdn extends EventEmitter { | |
} | ||
else { | ||
// Other in items | ||
if( marketHashName.indexOf('(Holo-Foil)') > -1 ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK, there was an issue earlier where these were misspellings my Valve. They don't have proper market pages, right? Seems hacky to do this conversion if Valve isn't bothered to do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is a hacky way to do it and not looking the right way. But people who are using this package want to see the correct results. Perhaps we can make hooks or interceptors where users can add their own hacky codes. What do you think about it? |
||
marketHashName = marketHashName.replace('(Holo-Foil)', '(Holo/Foil)'); | ||
} | ||
|
||
for (const t of this.csgoEnglish['inverted'][marketHashName] || []) { | ||
const tag = `#${t.toLowerCase()}`; | ||
const items = this.itemsGame.items; | ||
|
@@ -827,7 +842,7 @@ class CSGOCdn extends EventEmitter { | |
const url = this.getPathURL(path); | ||
|
||
if (url) { | ||
return url; | ||
return url.replace('\r', ''); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is eliminating the carriage return absolutely necessary? If it is, then it should be universally stripped during the parsing of the game files instead of scattered everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's necessary. Because URLs become
https://steamcommunity.com/.../abcd.png\r
or something like that.You are right. I will change the replacer positions 👍