Resolves some mistakes for getAttribute (#6207)

Follow-up 4d2c5b02d3
Fixed #6205

Thanks to @sonniez
This commit is contained in:
Atemo 2021-08-21 01:56:04 +02:00 committed by GitHub
parent 19ef916f6e
commit eb8c06743e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -6001,7 +6001,7 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
WBUFW(buf,18)= status->def_ele;
for(i=0;i<9;i++)
// The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
WBUFB(buf,20+i)= (unsigned char)((fix=elemental_attribute_db.getAttribute(i+1,status->def_ele, status->ele_lv))<0?0:fix);
WBUFB(buf,20+i)= (unsigned char)((fix=elemental_attribute_db.getAttribute(status->ele_lv, i+1, status->def_ele))<0?0:fix);
clif_send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF);
}

View File

@ -16003,7 +16003,7 @@ AttributeDatabase elemental_attribute_db;
* @param level Element level 1 ~ MAX_ELE_LEVEL
*/
int16 AttributeDatabase::getAttribute(uint16 level, uint16 atk_ele, uint16 def_ele) {
if (!CHK_ELEMENT(atk_ele) || !CHK_ELEMENT(def_ele) || !CHK_ELEMENT_LEVEL(level))
if (!CHK_ELEMENT(atk_ele) || !CHK_ELEMENT(def_ele) || !CHK_ELEMENT_LEVEL(level+1))
return 100;
return this->attr_fix_table[level][atk_ele][def_ele];