1.1.2 • Published 3 years ago

dfopenapi v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

dfopenapi

api wrapper for Dungeon and Fighterⓒ (dnf@korea) OpenAPI (powered by Neople OpenAPI) : support URL encoding, server name parsing, and ajax

Getting started

Installation

Using npm:

$ npm install dfopenapi

Integration

var apikey = <apikey>; // published by neople
var dfopenapi = require('dfopenapi');
var api = dfopenapi({key:apikey});

in short, you can serve apikey as string

var api = require('dfopenapi')(<apikey>);

Example:

var apikey = <apikey>;  // published by neople
var api = require('dfopenapi')({key:apikey});

api.character.search(
    {server: 'bakal', charname: 'DFCAT'}, 
    function (res) {
        console.log(res);
    }
);

api.character.info.equip(
    {server: 'bakal', cid: 'ccae5367270d0c2516cfb92df1d14ed3'}, 
    function (res) {
        console.log(res);
    }
);

api.auction.search(
    {itemname: '폭식', wordType: 'full'}, 
    function (res) {
        console.log(res)
    }
);

api.item.detail(
    {itemId: 'c6a38ab8c7540cfc51ea2b0b8b610fa7', wordType: 'full'}, 
    function (res) {
        console.log(res)
    }
);

API

Support all apis powered by Neople OpenAPI

  • Character Search
character.search({server: <server>, cname: <cname>[, limit: <limit>, wordType: <wordType>]})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cnamestringcharacter nameURL encodingornotY
limitinteger# rows of response10100
wordTypestringmatch / start / fullmatch

{characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName}, ...

  • Character Timeline
character.timeline({server: <server>, cid: <charname>[, limit: <limit>, wordType: <wordType>]})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y
limitinteger# rows of response10100
codestringtimeline class code

base info + {timeline: {nextUrl, rows: {code, name, date, data}, ...}}

  • Character Base Info
character.info.base({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y

{characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName, adventureName, guildId, guildName}

  • Character Status Info
character.info.status({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y

base info + {buff:모험단버프, 무제한 길드능력치, 기간제 길드능력치, status:[HP, MP, 힘, 지능,체력, 정신력, 물리 공격, 마법 공격, 독립 공격, 물리 방어, 마법 방어, 물리 크리티컬, 마법 크리티컬, 공격 속도, 캐스팅 속도, 이동 속도, 항마, 적중률, 회피율, HP 회복량, MP 회복량, 경직도, 히트리커버리, 화속성 강화, 화속성 저항, 수속성 강화, 수속성 저항, 명속성 강화, 명속성 저항, 암속성 강화, 암속성 저항 }

  • Character Equipment Info
character.info.equip({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y

base info + {equipment:WEAPON, TITLE, JACKET, SHOULDER, PANTS, SHOES, WAIST, AMULET, WRIST, RING, SUPPORT, MAGIC_STON, EARRING}

  • Character Avatar Info
character.info.avatar({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y

base info + {avatar(array of each avatar)}

  • Character Creature Info
character.info.creature({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y
  • Character Flag Info
character.info.flag({server: <server>, cid: <charname>})
parametertypedescriptionrequireddefaultmaximum
serverstringserver unique nameoruser defined server nameY
cidstringcharacter unique code(128bit hash)Y
  • Auction Search
auction.search({itemId: <itemId>, itemName: <itemName>[, minLevel: <minLevel>, maxLevel: <maxLevel>, rarity: <rarity>, minReinforce: <minReinforce>, maxReinforce: <maxReinforce>, minRefine: <minRefine>, maxRefine: <maxRefine>, unitPrice: <unitPrice>, reinforce: <reinforce>, auctionNo: <auctionNo>, limit: <limit>, wordType: <wordType>]})
parametertypedescriptionrequireddefaultmaximum
itemIdstringY
itemNamestringitem nameURL encodingornotY
minLevelintegerminimum required level
maxLevelintegermaximum required level
raritystringitem rarity
minReinforceintegerminimum reinforce level
maxReinforceintegermaximum reinforce level
minRefineintegerminimum refine level
maxRefineintegermaximum refine level
unitPricestringsort by item unit priceasc / desc
reinforcestringsort by reinforce levelasc / desc
auctionNostringsort by auctionNoasc / desc
limitinteger# rows of response10100
wordTypestringmatch / start / fullmatch

itemId or itemName is required.

auctionNo: 'asc' is default unless any sort option is defined.

  • Auction Detail
auction.detail({auctionNo: <auctionNo>})
parametertypedescriptionrequireddefaultmaximum
auctionNostringY
  • Item Search
item.search({itemName: <itemName>[, minLevel: <minLevel>, maxLevel: <maxLevel>, rarity: <rarity>, trade: <trade>, limit: <limit>, wordType: <wordType>]})
parametertypedescriptionrequireddefaultmaximum
itemNamestringitem nameURL encodingornotY
minLevelintegerminimum required level
maxLevelintegermaximum required level
raritystringitem rarity
tradebooleancan regist auctionfalse
limitinteger# rows of response10100
wordTypestringmatch / start / fullmatch
  • Item Detail
item.detail({itemId: <itemId>})
parametertypedescriptionrequireddefaultmaximum
itemIdstringY

array of {characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName}

Legacy API in Officail Homepage

!! Legacy API is not recommanded. We have no responsiblilty for abusing this legacy api.

In officail homepage of dungeon and fighter, there is legacy api via http://df.nexon.com/FRM/info/charac_search_api.php for character search and view detail. It is for pure web browser, not for 3-party app like pris.kr.

Legacy api is not need apikey. So, it cannot be controlled by neople and can cause big traffic on neople server, and might access blocked from neople.

Legacy api is not separated by category (equip/avatar/...). Its response contains full information and it has redundant. Legacy api is not supported by Neople API, it is not up-to-date. For example, Neople API update to contain {adventureName, guildId, guildName} in base info in 20180104, however, legacy api is not contains adventrueName which is important for identifing unique user (or account).

Legacy api handles no (charac_no in response) for characterId. But it is different from Neople API's. You must be careful of mix legacy API with Neople API.

Legacy api contains avatar_image and occDate, not supported in Neople API.

DNF Web Avatar renderer(http://avatar.df.nexon.com/) uses charac_no in legacy API, not characterId in Neople API. So, if you want to contain avatar image on your service, you should use legacy API until Neople support avatar image url in Neople API. (Or merge no and characterId).

occDate in stat shows the time recent logout.

Character API

  • Common API for Search / Detail
character.legacy.axios({mode: <mode>, no: <charname>, server: <server>})
parametertypedescriptionnecessarydefaultmaximum
modestringsearch / detailY
nostringcharacter unique code(128bit hash)Differ from Neople APIY
serverstringserver unique nameoruser defined server nameY
  • Character Detail
character.legacy.character.info({no: <charac_no>, server: <server>})
parametertypedescriptionnecessarydefaultmaximum
nostringcharacter unique code(128bit hash)Differ from Neople APIY
serverstringserver unique nameoruser defined server nameY

Community API

  • Common API for Community
character.legacy.request({url: <url>)
parametertypedescriptionnecessarydefaultmaximum
urlstringY
  • Capture Board
character.legacy.community.api({type: <search_type>, keyword: <keyword>})
parametertypedescriptionnecessarydefaultmaximum
typestringcharac_name / titleY
keywordstringcharacter name / titleURL encodingornotY

For euc-kr decoding, use request insted of axios.

Addons

User Defined Server Name

dfopenapi contains server name parsing through parseServer.

Unique server name is like 'bakal', 'cain', however, you can use user defined server name like '바칼'. Even if you can use just 'B' for server name.

Wanna more, add additional set into parser in lib/parseServer.js like "dire": "diregie".

Smart URL encoding

dfopenapi contains URL Encoding process esc for username/itemname.

It use regular expression to check name is URL encoded. If it already already encoded, return string directly. Else, use querystring.escape to URL encoding.

So, you don't care about name is URL encoded or not.

Release Note

20180105

Include {adventureName, guildId, guildName} and trade property in item.search in 20180104 patch.

20180106

Include community capture crawler in official homepage legacy.community.capture

Divide single dfopenapi.js into each modules (api.js, auction.js, character.js, escape.js, item.js, legacy.js, parseServer.js)

20180111

Include character.timeline in 20180111 patch.

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago