12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761 |
- // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
- // For more information, see LICENCE in the main folder
- #include <fstream>
- #include <functional>
- #include <iostream>
- #include <locale>
- #include <map>
- #include <unordered_map>
- #include <vector>
- #ifdef WIN32
- #include <conio.h>
- #else
- #include <termios.h>
- #include <unistd.h>
- #include <stdio.h>
- #endif
- #include <yaml-cpp/yaml.h>
- #include "../common/cbasetypes.hpp"
- #include "../common/core.hpp"
- #include "../common/malloc.hpp"
- #include "../common/mmo.hpp"
- #include "../common/nullpo.hpp"
- #include "../common/showmsg.hpp"
- #include "../common/strlib.hpp"
- #include "../common/utilities.hpp"
- #include "../common/utils.hpp"
- #ifdef WIN32
- #include "../common/winapi.hpp"
- #endif
- // Only for constants - do not use functions of it or linking will fail
- #include "../map/achievement.hpp"
- #include "../map/battle.hpp"
- #include "../map/battleground.hpp"
- #include "../map/channel.hpp"
- #include "../map/chat.hpp"
- #include "../map/date.hpp"
- #include "../map/instance.hpp"
- #include "../map/mercenary.hpp"
- #include "../map/mob.hpp"
- #include "../map/npc.hpp"
- #include "../map/pc.hpp"
- #include "../map/pet.hpp"
- #include "../map/quest.hpp"
- #include "../map/script.hpp"
- #include "../map/skill.hpp"
- #include "../map/storage.hpp"
- using namespace rathena;
- #define MAX_MAP_PER_INSTANCE 255
- #ifndef WIN32
- int getch( void ){
- struct termios oldattr, newattr;
- int ch;
- tcgetattr( STDIN_FILENO, &oldattr );
- newattr = oldattr;
- newattr.c_lflag &= ~( ICANON | ECHO );
- tcsetattr( STDIN_FILENO, TCSANOW, &newattr );
- ch = getchar();
- tcsetattr( STDIN_FILENO, TCSANOW, &oldattr );
- return ch;
- }
- #endif
- // Required constant and structure definitions
- #define MAX_GUILD_SKILL_REQUIRE 5
- #define MAX_SKILL_ITEM_REQUIRE 10
- #define MAX_SKILL_STATUS_REQUIRE 3
- #define MAX_SKILL_EQUIP_REQUIRE 10
- #define MAX_QUEST_DROPS 3
- struct s_skill_unit_csv : s_skill_db {
- std::string target_str;
- int unit_flag_csv;
- };
- std::unordered_map<uint16, s_skill_require> skill_require;
- std::unordered_map<uint16, s_skill_db> skill_cast;
- std::unordered_map<uint16, s_skill_db> skill_castnodex;
- std::unordered_map<uint16, s_skill_unit_csv> skill_unit;
- std::unordered_map<uint16, s_skill_copyable> skill_copyable;
- std::unordered_map<uint16, s_skill_db> skill_nearnpc;
- struct s_item_flag_csv2yaml {
- bool buyingstore, dead_branch, group, guid, broadcast, bindOnEquip, delay_consume;
- e_item_drop_effect dropEffect;
- };
- struct s_item_delay_csv2yaml {
- uint32 delay;
- std::string sc;
- };
- struct s_item_stack_csv2yaml {
- uint16 amount;
- bool inventory, cart, storage, guild_storage;
- };
- struct s_item_nouse_csv2yaml {
- uint16 override;
- bool sitting;
- };
- struct s_item_trade_csv2yaml {
- uint16 override;
- bool drop, trade, trade_partner, sell, cart, storage, guild_storage, mail, auction;
- };
- std::unordered_map<t_itemid, t_itemid> item_avail;
- std::unordered_map<t_itemid, bool> item_buyingstore;
- std::unordered_map<t_itemid, s_item_flag_csv2yaml> item_flag;
- std::unordered_map<t_itemid, s_item_delay_csv2yaml> item_delay;
- std::unordered_map<t_itemid, s_item_stack_csv2yaml> item_stack;
- std::unordered_map<t_itemid, s_item_nouse_csv2yaml> item_nouse;
- std::unordered_map<t_itemid, s_item_trade_csv2yaml> item_trade;
- struct s_random_opt_group_csv : s_random_opt_group {
- std::vector<uint16> rate;
- };
- std::unordered_map<uint16, std::string> rand_opt_db;
- std::unordered_map<uint16, s_random_opt_group_csv> rand_opt_group;
- static std::map<std::string, int> um_mapid2jobname {
- { "Novice", JOB_NOVICE }, // Novice and Super Novice share the same value
- { "SuperNovice", JOB_NOVICE },
- { "Swordman", JOB_SWORDMAN },
- { "Mage", JOB_MAGE },
- { "Archer", JOB_ARCHER },
- { "Acolyte", JOB_ACOLYTE },
- { "Merchant", JOB_MERCHANT },
- { "Thief", JOB_THIEF },
- { "Knight", JOB_KNIGHT },
- { "Priest", JOB_PRIEST },
- { "Wizard", JOB_WIZARD },
- { "Blacksmith", JOB_BLACKSMITH },
- { "Hunter", JOB_HUNTER },
- { "Assassin", JOB_ASSASSIN },
- { "Crusader", JOB_CRUSADER },
- { "Monk", JOB_MONK },
- { "Sage", JOB_SAGE },
- { "Rogue", JOB_ROGUE },
- { "Alchemist", JOB_ALCHEMIST },
- { "BardDancer", JOB_BARD }, // Bard and Dancer share the same value
- { "BardDancer", JOB_DANCER },
- { "Gunslinger", JOB_GUNSLINGER },
- { "Ninja", JOB_NINJA },
- { "Taekwon", 21 },
- { "StarGladiator", 22 },
- { "SoulLinker", 23 },
- // { "Gangsi", 26 },
- // { "DeathKnight", 27 },
- // { "DarkCollector", 28 },
- #ifdef RENEWAL
- { "KagerouOboro", 29 }, // Kagerou and Oboro share the same value
- { "Rebellion", 30 },
- { "Summoner", 31 },
- #endif
- };
- static std::unordered_map<std::string, equip_pos> um_equipnames {
- { "Head_Low", EQP_HEAD_LOW },
- { "Head_Mid", EQP_HEAD_MID },
- { "Head_Top", EQP_HEAD_TOP },
- { "Right_Hand", EQP_HAND_R },
- { "Left_Hand", EQP_HAND_L },
- { "Armor", EQP_ARMOR },
- { "Shoes", EQP_SHOES },
- { "Garment", EQP_GARMENT },
- { "Right_Accessory", EQP_ACC_R },
- { "Left_Accessory", EQP_ACC_L },
- { "Costume_Head_Top", EQP_COSTUME_HEAD_TOP },
- { "Costume_Head_Mid", EQP_COSTUME_HEAD_MID },
- { "Costume_Head_Low", EQP_COSTUME_HEAD_LOW },
- { "Costume_Garment", EQP_COSTUME_GARMENT },
- { "Ammo", EQP_AMMO },
- { "Shadow_Armor", EQP_SHADOW_ARMOR },
- { "Shadow_Weapon", EQP_SHADOW_WEAPON },
- { "Shadow_Shield", EQP_SHADOW_SHIELD },
- { "Shadow_Shoes", EQP_SHADOW_SHOES },
- { "Shadow_Right_Accessory", EQP_SHADOW_ACC_R },
- { "Shadow_Left_Accessory", EQP_SHADOW_ACC_L },
- };
- // Forward declaration of conversion functions
- static bool guild_read_guildskill_tree_db( char* split[], int columns, int current );
- static bool pet_read_db( const char* file );
- static bool skill_parse_row_magicmushroomdb(char *split[], int column, int current);
- static bool skill_parse_row_abradb(char* split[], int columns, int current);
- static bool skill_parse_row_spellbookdb(char* split[], int columns, int current);
- static bool mob_readdb_mobavail(char *str[], int columns, int current);
- static bool skill_parse_row_requiredb(char* split[], int columns, int current);
- static bool skill_parse_row_castdb(char* split[], int columns, int current);
- static bool skill_parse_row_castnodexdb(char* split[], int columns, int current);
- static bool skill_parse_row_unitdb(char* split[], int columns, int current);
- static bool skill_parse_row_copyabledb(char* split[], int columns, int current);
- static bool skill_parse_row_nonearnpcrangedb(char* split[], int columns, int current);
- static bool skill_parse_row_skilldb(char* split[], int columns, int current);
- static bool quest_read_db(char *split[], int columns, int current);
- static bool instance_readdb_sub(char* str[], int columns, int current);
- static bool itemdb_read_itemavail(char *str[], int columns, int current);
- static bool itemdb_read_buyingstore(char* fields[], int columns, int current);
- static bool itemdb_read_flag(char* fields[], int columns, int current);
- static bool itemdb_read_itemdelay(char* str[], int columns, int current);
- static bool itemdb_read_stack(char* fields[], int columns, int current);
- static bool itemdb_read_nouse(char* fields[], int columns, int current);
- static bool itemdb_read_itemtrade(char* fields[], int columns, int current);
- static bool itemdb_read_db(const char *file);
- static bool itemdb_read_randomopt(const char* file);
- static bool itemdb_read_randomopt_group(char *str[], int columns, int current);
- static bool itemdb_randomopt_group_yaml(void);
- // Constants for conversion
- std::unordered_map<t_itemid, std::string> aegis_itemnames;
- std::unordered_map<t_itemid, t_itemid> aegis_itemviewid;
- std::unordered_map<uint16, std::string> aegis_mobnames;
- std::unordered_map<uint16, std::string> aegis_skillnames;
- std::unordered_map<const char*, int64> constants;
- // Forward declaration of constant loading functions
- static bool parse_item_constants_txt( const char* path );
- static bool parse_mob_constants( char* split[], int columns, int current );
- static bool parse_skill_constants_txt( char* split[], int columns, int current );
- static bool parse_skill_constants_yml(std::string path, std::string filename);
- static void init_random_option_constants();
- bool fileExists( const std::string& path );
- bool askConfirmation( const char* fmt, ... );
- // Skill database data to memory
- static void skill_txt_data(const std::string& modePath, const std::string& fixedPath) {
- skill_require.clear();
- skill_cast.clear();
- skill_castnodex.clear();
- skill_unit.clear();
- skill_copyable.clear();
- skill_nearnpc.clear();
- if (fileExists(modePath + "/skill_require_db.txt"))
- sv_readdb(modePath.c_str(), "skill_require_db.txt", ',', 34, 34, -1, skill_parse_row_requiredb, false);
- if (fileExists(modePath + "/skill_cast_db.txt"))
- sv_readdb(modePath.c_str(), "skill_cast_db.txt", ',', 7, 8, -1, skill_parse_row_castdb, false);
- if (fileExists(modePath + "/skill_castnodex_db.txt"))
- sv_readdb(modePath.c_str(), "skill_castnodex_db.txt", ',', 2, 3, -1, skill_parse_row_castnodexdb, false);
- if (fileExists(modePath + "/skill_unit_db.txt"))
- sv_readdb(modePath.c_str(), "skill_unit_db.txt", ',', 8, 8, -1, skill_parse_row_unitdb, false);
- if (fileExists(fixedPath + "/skill_copyable_db.txt"))
- sv_readdb(fixedPath.c_str(), "skill_copyable_db.txt", ',', 2, 4, -1, skill_parse_row_copyabledb, false);
- if (fileExists(fixedPath + "/skill_nonearnpc_db.txt"))
- sv_readdb(fixedPath.c_str(), "skill_nonearnpc_db.txt", ',', 2, 3, -1, skill_parse_row_nonearnpcrangedb, false);
- }
- // Item database data to memory
- static void item_txt_data(const std::string& modePath, const std::string& fixedPath) {
- item_avail.clear();
- item_buyingstore.clear();
- item_flag.clear();
- item_delay.clear();
- item_stack.clear();
- item_nouse.clear();
- item_trade.clear();
- if (fileExists(fixedPath + "/item_avail.txt"))
- sv_readdb(fixedPath.c_str(), "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail, false);
- if (fileExists(modePath + "/item_buyingstore.txt"))
- sv_readdb(modePath.c_str(), "item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore, false);
- if (fileExists(modePath + "/item_flag.txt"))
- sv_readdb(modePath.c_str(), "item_flag.txt", ',', 2, 2, -1, &itemdb_read_flag, false);
- if (fileExists(modePath + "/item_delay.txt"))
- sv_readdb(modePath.c_str(), "item_delay.txt", ',', 2, 3, -1, &itemdb_read_itemdelay, false);
- if (fileExists(modePath + "/item_stack.txt"))
- sv_readdb(modePath.c_str(), "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack, false);
- if (fileExists(fixedPath + "/item_nouse.txt"))
- sv_readdb(fixedPath.c_str(), "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse, false);
- if (fileExists(modePath + "/item_trade.txt"))
- sv_readdb(modePath.c_str(), "item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade, false);
- }
- YAML::Emitter body;
- // Implement the function instead of including the original version by linking
- void script_set_constant_( const char* name, int64 value, const char* constant_name, bool isparameter, bool deprecated ){
- constants[name] = value;
- }
- const char* constant_lookup( int32 value, const char* prefix ){
- if (prefix == nullptr)
- return nullptr;
- for( auto const& pair : constants ){
- // Same prefix group and same value
- if( strncasecmp( pair.first, prefix, strlen( prefix ) ) == 0 && pair.second == value ){
- return pair.first;
- }
- }
- return nullptr;
- }
- int64 constant_lookup_int(const char* constant) {
- if (constant == nullptr)
- return -100;
- for (auto const &pair : constants) {
- if (strlen(pair.first) == strlen(constant) && strncasecmp(pair.first, constant, strlen(constant)) == 0) {
- return pair.second;
- }
- }
- return -100;
- }
- void copyFileIfExists( std::ofstream& file,const std::string& name, bool newLine ){
- std::string path = "doc/yaml/db/" + name + ".yml";
- if( fileExists( path ) ){
- std::ifstream source( path, std::ios::binary );
- std::istreambuf_iterator<char> begin_source( source );
- std::istreambuf_iterator<char> end_source;
- std::ostreambuf_iterator<char> begin_dest( file );
- copy( begin_source, end_source, begin_dest );
- source.close();
- if( newLine ){
- file << "\n";
- }
- }
- }
- void prepareHeader(std::ofstream &file, const std::string& type, uint32 version, const std::string& name) {
- copyFileIfExists( file, "license", false );
- copyFileIfExists( file, name, true );
- YAML::Emitter header(file);
- header << YAML::BeginMap;
- header << YAML::Key << "Header";
- header << YAML::BeginMap;
- header << YAML::Key << "Type" << YAML::Value << type;
- header << YAML::Key << "Version" << YAML::Value << version;
- header << YAML::EndMap;
- header << YAML::EndMap;
- file << "\n";
- file << "\n";
- }
- void prepareBody(void) {
- body << YAML::BeginMap;
- body << YAML::Key << "Body";
- body << YAML::BeginSeq;
- }
- void finalizeBody(void) {
- body << YAML::EndSeq;
- body << YAML::EndMap;
- }
- template<typename Func>
- bool process( const std::string& type, uint32 version, const std::vector<std::string>& paths, const std::string& name, Func lambda, const std::string& rename = "" ){
- for( const std::string& path : paths ){
- const std::string name_ext = name + ".txt";
- const std::string from = path + "/" + name_ext;
- const std::string to = path + "/" + (rename.size() > 0 ? rename : name) + ".yml";
- if( fileExists( from ) ){
- if( !askConfirmation( "Found the file \"%s\", which requires migration to yml.\nDo you want to convert it now? (Y/N)\n", from.c_str() ) ){
- continue;
- }
- if (fileExists(to)) {
- if (!askConfirmation("The file \"%s\" already exists.\nDo you want to replace it? (Y/N)\n", to.c_str())) {
- continue;
- }
- }
- std::ofstream out;
- body.~Emitter();
- new (&body) YAML::Emitter();
- out.open(to);
- if (!out.is_open()) {
- ShowError("Can not open file \"%s\" for writing.\n", to.c_str());
- return false;
- }
- prepareHeader(out, type, version, (rename.size() > 0 ? rename : name));
- prepareBody();
- if( !lambda( path, name_ext ) ){
- out.close();
- return false;
- }
- finalizeBody();
- out << body.c_str();
- // Make sure there is an empty line at the end of the file for git
- out << "\n";
- out.close();
-
- // TODO: do you want to delete?
- }
- }
- return true;
- }
- int do_init( int argc, char** argv ){
- const std::string path_db = std::string( db_path );
- const std::string path_db_mode = path_db + "/" + DBPATH;
- const std::string path_db_import = path_db + "/" + DBIMPORT + "/";
- // Loads required conversion constants
- if (fileExists(item_db.getDefaultLocation())) {
- item_db.load();
- } else {
- parse_item_constants_txt( ( path_db_mode + "item_db.txt" ).c_str() );
- parse_item_constants_txt( ( path_db_import + "item_db.txt" ).c_str() );
- }
- sv_readdb( path_db_mode.c_str(), "mob_db.txt", ',', 31 + 2 * MAX_MVP_DROP + 2 * MAX_MOB_DROP, 31 + 2 * MAX_MVP_DROP + 2 * MAX_MOB_DROP, -1, &parse_mob_constants, false );
- sv_readdb( path_db_import.c_str(), "mob_db.txt", ',', 31 + 2 * MAX_MVP_DROP + 2 * MAX_MOB_DROP, 31 + 2 * MAX_MVP_DROP + 2 * MAX_MOB_DROP, -1, &parse_mob_constants, false );
- if (fileExists(path_db + "/" + "skill_db.yml")) {
- parse_skill_constants_yml(path_db_mode, "skill_db.yml");
- parse_skill_constants_yml(path_db_import + "/", "skill_db.yml");
- } else {
- sv_readdb(path_db_mode.c_str(), "skill_db.txt", ',', 18, 18, -1, parse_skill_constants_txt, false);
- sv_readdb(path_db_import.c_str(), "skill_db.txt", ',', 18, 18, -1, parse_skill_constants_txt, false);
- }
- // Load constants
- #define export_constant_npc(a) export_constant(a)
- init_random_option_constants();
- #include "../map/script_constants.hpp"
- std::vector<std::string> root_paths = {
- path_db,
- path_db_mode,
- path_db_import
- };
- if( !process( "GUILD_SKILL_TREE_DB", 1, root_paths, "guild_skill_tree", []( const std::string& path, const std::string& name_ext ) -> bool {
- return sv_readdb( path.c_str(), name_ext.c_str(), ',', 2 + MAX_GUILD_SKILL_REQUIRE * 2, 2 + MAX_GUILD_SKILL_REQUIRE * 2, -1, &guild_read_guildskill_tree_db, false );
- } ) ){
- return 0;
- }
- if( !process( "PET_DB", 1, root_paths, "pet_db", []( const std::string& path, const std::string& name_ext ) -> bool {
- return pet_read_db( ( path + name_ext ).c_str() );
- } ) ){
- return 0;
- }
- if (!process("MAGIC_MUSHROOM_DB", 1, root_paths, "magicmushroom_db", [](const std::string &path, const std::string &name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 1, 1, -1, &skill_parse_row_magicmushroomdb, false);
- })) {
- return 0;
- }
- if (!process("ABRA_DB", 1, root_paths, "abra_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 3, 3, -1, &skill_parse_row_abradb, false);
- })) {
- return 0;
- }
- if (!process("READING_SPELLBOOK_DB", 1, root_paths, "spellbook_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 3, 3, -1, &skill_parse_row_spellbookdb, false);
- })) {
- return 0;
- }
- if (!process("MOB_AVAIL_DB", 1, root_paths, "mob_avail", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 2, 12, -1, &mob_readdb_mobavail, false);
- })) {
- return 0;
- }
- skill_txt_data( path_db_mode, path_db );
- if (!process("SKILL_DB", 1, { path_db_mode }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 18, 18, -1, &skill_parse_row_skilldb, false);
- })){
- return 0;
- }
- skill_txt_data( path_db_import, path_db_import );
- if (!process("SKILL_DB", 1, { path_db_import }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 18, 18, -1, &skill_parse_row_skilldb, false);
- })){
- return 0;
- }
- if (!process("QUEST_DB", 1, root_paths, "quest_db", [](const std::string &path, const std::string &name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 3 + MAX_QUEST_OBJECTIVES * 2 + MAX_QUEST_DROPS * 3, 100, -1, &quest_read_db, false);
- })) {
- return 0;
- }
- if (!process("INSTANCE_DB", 1, root_paths, "instance_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 7, 7 + MAX_MAP_PER_INSTANCE, -1, &instance_readdb_sub, false);
- })) {
- return 0;
- }
- item_txt_data(path_db_mode, path_db);
- if (!process("ITEM_DB", 1, { path_db_mode }, "item_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return itemdb_read_db((path + name_ext).c_str());
- })) {
- return 0;
- }
- item_txt_data(path_db_import, path_db_import);
- if (!process("ITEM_DB", 1, { path_db_import }, "item_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return itemdb_read_db((path + name_ext).c_str());
- })) {
- return 0;
- }
- rand_opt_db.clear();
- if (!process("RANDOM_OPTION_DB", 1, root_paths, "item_randomopt_db", [](const std::string& path, const std::string& name_ext) -> bool {
- return itemdb_read_randomopt((path + name_ext).c_str());
- })) {
- return 0;
- }
- rand_opt_group.clear();
- if (!process("RANDOM_OPTION_GROUP", 1, root_paths, "item_randomopt_group", [](const std::string& path, const std::string& name_ext) -> bool {
- return sv_readdb(path.c_str(), name_ext.c_str(), ',', 5, 2 + 5 * MAX_ITEM_RDM_OPT, -1, &itemdb_read_randomopt_group, false) && itemdb_randomopt_group_yaml();
- })) {
- return 0;
- }
- // TODO: add implementations ;-)
- return 0;
- }
- void do_final(void){
- }
- bool fileExists( const std::string& path ){
- std::ifstream in;
- in.open( path );
- if( in.is_open() ){
- in.close();
- return true;
- }else{
- return false;
- }
- }
- bool askConfirmation( const char* fmt, ... ){
- va_list ap;
- va_start( ap, fmt );
- _vShowMessage( MSG_NONE, fmt, ap );
- va_end( ap );
- char c = getch();
- if( c == 'Y' || c == 'y' ){
- return true;
- }else{
- return false;
- }
- }
- // Constant loading functions
- static bool parse_item_constants_txt( const char* path ){
- uint32 lines = 0, count = 0;
- char line[1024];
- FILE* fp;
- fp = fopen(path, "r");
- if (fp == NULL) {
- ShowWarning("parse_item_constants_txt: File not found \"%s\", skipping.\n", path);
- return false;
- }
- // process rows one by one
- while (fgets(line, sizeof(line), fp))
- {
- char *str[32], *p;
- int i;
- lines++;
- if (line[0] == '/' && line[1] == '/')
- continue;
- memset(str, 0, sizeof(str));
- p = strstr(line, "//");
- if (p != nullptr) {
- *p = '\0';
- }
- p = line;
- while (ISSPACE(*p))
- ++p;
- if (*p == '\0')
- continue;// empty line
- for (i = 0; i < 19; ++i)
- {
- str[i] = p;
- p = strchr(p, ',');
- if (p == NULL)
- break;// comma not found
- *p = '\0';
- ++p;
- }
- if (p == NULL)
- {
- ShowError("parse_item_constants_txt: Insufficient columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- // Script
- if (*p != '{')
- {
- ShowError("parse_item_constants_txt: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- str[19] = p + 1;
- p = strstr(p + 1, "},");
- if (p == NULL)
- {
- ShowError("parse_item_constants_txt: Invalid format (Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- *p = '\0';
- p += 2;
- // OnEquip_Script
- if (*p != '{')
- {
- ShowError("parse_item_constants_txt: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- str[20] = p + 1;
- p = strstr(p + 1, "},");
- if (p == NULL)
- {
- ShowError("parse_item_constants_txt: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- *p = '\0';
- p += 2;
- // OnUnequip_Script (last column)
- if (*p != '{')
- {
- ShowError("parse_item_constants_txt: Invalid format (OnUnequip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- str[21] = p;
- p = &str[21][strlen(str[21]) - 2];
- if (*p != '}') {
- /* lets count to ensure it's not something silly e.g. a extra space at line ending */
- int lcurly = 0, rcurly = 0;
- for (size_t v = 0; v < strlen(str[21]); v++) {
- if (str[21][v] == '{')
- lcurly++;
- else if (str[21][v] == '}') {
- rcurly++;
- p = &str[21][v];
- }
- }
- if (lcurly != rcurly) {
- ShowError("parse_item_constants_txt: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
- }
- }
- str[21] = str[21] + 1; //skip the first left curly
- *p = '\0'; //null the last right curly
- uint16 item_id = atoi( str[0] );
- char* name = trim( str[1] );
- aegis_itemnames[item_id] = std::string(name);
- if (atoi(str[14]) & (EQP_HELM | EQP_COSTUME_HELM) && util::umap_find(aegis_itemviewid, (t_itemid)atoi(str[18])) == nullptr)
- aegis_itemviewid[atoi(str[18])] = item_id;
- count++;
- }
- fclose(fp);
- ShowStatus("Done reading '" CL_WHITE "%u" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, path);
- return true;
- }
- const std::string ItemDatabase::getDefaultLocation(){
- return std::string( db_path ) + "/item_db.yml";
- }
- uint64 ItemDatabase::parseBodyNode(const YAML::Node& node) {
- t_itemid nameid;
- if (!this->asUInt32(node, "Id", nameid))
- return 0;
- if (this->nodeExists(node, "AegisName")) {
- std::string name;
- if (!this->asString(node, "AegisName", name))
- return 0;
- aegis_itemnames[nameid] = name;
- }
- if (this->nodeExists(node, "View")) {
- uint32 look;
- if (!this->asUInt32(node, "View", look))
- return 0;
- if( look > 0 ){
- if (this->nodeExists(node, "Locations")) {
- const YAML::Node& locationNode = node["Locations"];
- static std::vector<std::string> locations = {
- "Head_Low",
- "Head_Mid",
- "Head_Top",
- "Costume_Head_Low",
- "Costume_Head_Mid",
- "Costume_Head_Top"
- };
- for( std::string& location : locations ){
- if (this->nodeExists(locationNode, location)) {
- bool active;
- if (!this->asBool(locationNode, location, active))
- return 0;
- aegis_itemviewid[look] = nameid;
- break;
- }
- }
- }
- }
- }
- return 1;
- }
- void ItemDatabase::loadingFinished(){
- }
- ItemDatabase item_db;
- static bool parse_mob_constants( char* split[], int columns, int current ){
- uint16 mob_id = atoi( split[0] );
- char* name = trim( split[1] );
- aegis_mobnames[mob_id] = std::string( name );
- return true;
- }
- static bool parse_skill_constants_txt( char* split[], int columns, int current ){
- uint16 skill_id = atoi( split[0] );
- char* name = trim( split[16] );
- aegis_skillnames[skill_id] = std::string( name );
- return true;
- }
- static bool parse_skill_constants_yml(std::string path, std::string filename) {
- YAML::Node rootNode;
- try {
- rootNode = YAML::LoadFile(path + filename);
- } catch (YAML::Exception &e) {
- ShowError("Failed to read file from '" CL_WHITE "%s%s" CL_RESET "'.\n", path.c_str(), filename.c_str());
- ShowError("%s (Line %d: Column %d)\n", e.msg.c_str(), e.mark.line, e.mark.column);
- return false;
- }
- uint64 count = 0;
- for (const YAML::Node &body : rootNode["Body"]) {
- aegis_skillnames[body["Id"].as<uint16>()] = body["Name"].as<std::string>();
- count++;
- }
- ShowStatus("Done reading '" CL_WHITE "%" PRIu64 CL_RESET "' entries in '" CL_WHITE "%s%s" CL_RESET "'" CL_CLL "\n", count, path.c_str(), filename.c_str());
- return true;
- }
- /**
- * Split the string with ':' as separator and put each value for a skilllv
- * @param str: String to split
- * @param val: Array of MAX_SKILL_LEVEL to put value into
- * @return 0:error, x:number of value assign (should be MAX_SKILL_LEVEL)
- */
- int skill_split_atoi(char *str, int *val) {
- int i;
- for (i = 0; i < MAX_SKILL_LEVEL; i++) {
- if (!str)
- break;
- val[i] = atoi(str);
- str = strchr(str, ':');
- if (str)
- *str++ = 0;
- }
- if (i == 0) // No data found.
- return 0;
- if (i == 1) // Single value, have the whole range have the same value.
- return 1;
- return i;
- }
- /**
- * Split string to int by constant value (const.txt) or atoi()
- * @param *str: String input
- * @param *val: Temporary storage
- * @param *delim: Delimiter (for multiple value support)
- * @param min_value: Minimum value. If the splitted value is less or equal than this, will be skipped
- * @param max: Maximum number that can be allocated
- * @return count: Number of success
- */
- uint8 skill_split_atoi2(char *str, int64 *val, const char *delim, int min_value, uint16 max) {
- uint8 i = 0;
- char *p = strtok(str, delim);
- while (p != NULL) {
- int64 n = min_value;
- trim(p);
- if (ISDIGIT(p[0])) // If using numeric
- n = atoi(p);
- else {
- n = constant_lookup_int(p);
- p = strtok(NULL, delim);
- }
- if (n > min_value) {
- val[i] = n;
- i++;
- if (i >= max)
- break;
- }
- p = strtok(NULL, delim);
- }
- return i;
- }
- /**
- * Split string to int
- * @param str: String input
- * @param val1: Temporary storage to first value
- * @param val2: Temporary storage to second value
- */
- static void itemdb_re_split_atoi(char* str, int* val1, int* val2) {
- int i, val[2];
- for (i = 0; i < 2; i++) {
- if (!str)
- break;
- val[i] = atoi(str);
- str = strchr(str, ':');
- if (str)
- *str++ = 0;
- }
- if (i == 0) {
- *val1 = *val2 = 0;
- return; // no data found
- }
- if (i == 1) { // Single Value
- *val1 = val[0];
- *val2 = 0;
- return;
- }
- // We assume we have 2 values.
- *val1 = val[0];
- *val2 = val[1];
- return;
- }
- // Implementation of the conversion functions
- // Copied and adjusted from guild.cpp
- // <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
- static bool guild_read_guildskill_tree_db( char* split[], int columns, int current ){
- uint16 skill_id = (uint16)atoi(split[0]);
- std::string* name = util::umap_find( aegis_skillnames, skill_id );
- if( name == nullptr ){
- ShowError( "Skill name for skill id %hu is not known.\n", skill_id );
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << *name;
- body << YAML::Key << "MaxLevel" << YAML::Value << atoi(split[1]);
- if (atoi(split[2]) > 0) {
- body << YAML::Key << "Required";
- body << YAML::BeginSeq;
- for (int i = 0, j = 0; i < MAX_GUILD_SKILL_REQUIRE; i++) {
- uint16 required_skill_id = atoi(split[i * 2 + 2]);
- uint16 required_skill_level = atoi(split[i * 2 + 3]);
- if (required_skill_id == 0 || required_skill_level == 0) {
- continue;
- }
- std::string* required_name = util::umap_find(aegis_skillnames, required_skill_id);
- if (required_name == nullptr) {
- ShowError("Skill name for required skill id %hu is not known.\n", required_skill_id);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << *required_name;
- body << YAML::Key << "Level" << YAML::Value << required_skill_level;
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from pet.cpp
- static bool pet_read_db( const char* file ){
- FILE* fp = fopen( file, "r" );
- if( fp == nullptr ){
- ShowError( "can't read %s\n", file );
- return false;
- }
- int lines = 0;
- size_t entries = 0;
- char line[1024];
- while( fgets( line, sizeof(line), fp ) ) {
- char *str[22], *p;
- unsigned k;
- lines++;
- if(line[0] == '/' && line[1] == '/')
- continue;
- memset(str, 0, sizeof(str));
- p = line;
- while( ISSPACE(*p) )
- ++p;
- if( *p == '\0' )
- continue; // empty line
- for( k = 0; k < 20; ++k ) {
- str[k] = p;
- p = strchr(p,',');
- if( p == NULL )
- break; // comma not found
- *p = '\0';
- ++p;
- }
- if( p == NULL ) {
- ShowError("read_petdb: Insufficient columns in line %d, skipping.\n", lines);
- continue;
- }
- // Pet Script
- if( *p != '{' ) {
- ShowError("read_petdb: Invalid format (Pet Script column) in line %d, skipping.\n", lines);
- continue;
- }
- str[20] = p;
- p = strstr(p+1,"},");
- if( p == NULL ) {
- ShowError("read_petdb: Invalid format (Pet Script column) in line %d, skipping.\n", lines);
- continue;
- }
- p[1] = '\0';
- p += 2;
- // Equip Script
- if( *p != '{' ) {
- ShowError("read_petdb: Invalid format (Equip Script column) in line %d, skipping.\n", lines);
- continue;
- }
- str[21] = p;
- uint16 mob_id = atoi( str[0] );
- std::string* mob_name = util::umap_find( aegis_mobnames, mob_id );
- if( mob_name == nullptr ){
- ShowWarning( "pet_db reading: Invalid mob-class %hu, pet not read.\n", mob_id );
- continue;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Mob" << YAML::Value << *mob_name;
- t_itemid tame_item_id = strtoul( str[3], nullptr, 10 );
- if( tame_item_id > 0 ){
- std::string* tame_item_name = util::umap_find( aegis_itemnames, tame_item_id );
- if( tame_item_name == nullptr ){
- ShowError( "Item name for item id %u is not known.\n", tame_item_id );
- return false;
- }
- body << YAML::Key << "TameItem" << YAML::Value << *tame_item_name;
- }
- t_itemid egg_item_id = strtoul( str[4], nullptr, 10 );
- std::string* egg_item_name = util::umap_find( aegis_itemnames, egg_item_id );
- if( egg_item_name == nullptr ){
- ShowError( "Item name for item id %u is not known.\n", egg_item_id );
- return false;
- }
- body << YAML::Key << "EggItem" << YAML::Value << *egg_item_name;
- t_itemid equip_item_id = strtoul( str[5], nullptr, 10 );
- if( equip_item_id > 0 ){
- std::string* equip_item_name = util::umap_find( aegis_itemnames, equip_item_id );
- if( equip_item_name == nullptr ){
- ShowError( "Item name for item id %u is not known.\n", equip_item_id );
- return false;
- }
- body << YAML::Key << "EquipItem" << YAML::Value << *equip_item_name;
- }
- t_itemid food_item_id = strtoul( str[6], nullptr, 10 );
- if( food_item_id > 0 ){
- std::string* food_item_name = util::umap_find( aegis_itemnames, food_item_id );
- if( food_item_name == nullptr ){
- ShowError( "Item name for item id %u is not known.\n", food_item_id );
- return false;
- }
- body << YAML::Key << "FoodItem" << YAML::Value << *food_item_name;
- }
- body << YAML::Key << "Fullness" << YAML::Value << atoi(str[7]);
- // Default: 60
- if( atoi( str[8] ) != 60 ){
- body << YAML::Key << "HungryDelay" << YAML::Value << atoi(str[8]);
- }
- // Default: 250
- if( atoi( str[11] ) != 250 ){
- body << YAML::Key << "IntimacyStart" << YAML::Value << atoi(str[11]);
- }
- body << YAML::Key << "IntimacyFed" << YAML::Value << atoi(str[9]);
- // Default: -100
- if( atoi( str[10] ) != 100 ){
- body << YAML::Key << "IntimacyOverfed" << YAML::Value << -atoi(str[10]);
- }
- // pet_hungry_friendly_decrease battle_conf
- //body << YAML::Key << "IntimacyHungry" << YAML::Value << -5;
- // Default: -20
- if( atoi( str[12] ) != 20 ){
- body << YAML::Key << "IntimacyOwnerDie" << YAML::Value << -atoi(str[12]);
- }
- body << YAML::Key << "CaptureRate" << YAML::Value << atoi(str[13]);
- // Default: true
- if( atoi( str[15] ) == 0 ){
- body << YAML::Key << "SpecialPerformance" << YAML::Value << "false";
- }
- body << YAML::Key << "AttackRate" << YAML::Value << atoi(str[17]);
- body << YAML::Key << "RetaliateRate" << YAML::Value << atoi(str[18]);
- body << YAML::Key << "ChangeTargetRate" << YAML::Value << atoi(str[19]);
- if( *str[21] ){
- body << YAML::Key << "Script" << YAML::Value << YAML::Literal << str[21];
- }
- if( *str[20] ){
- body << YAML::Key << "SupportScript" << YAML::Value << YAML::Literal << str[20];
- }
- body << YAML::EndMap;
- entries++;
- }
- fclose(fp);
- ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' pets in '" CL_WHITE "%s" CL_RESET "'.\n", entries, file );
- return true;
- }
- // Copied and adjusted from skill.cpp
- static bool skill_parse_row_magicmushroomdb(char *split[], int column, int current)
- {
- uint16 skill_id = atoi(split[0]);
- std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
- if (skill_name == nullptr) {
- ShowError("Skill name for Magic Mushroom skill ID %hu is not known.\n", skill_id);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Skill" << YAML::Value << *skill_name;
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from skill.cpp
- static bool skill_parse_row_abradb(char* split[], int columns, int current)
- {
- uint16 skill_id = atoi(split[0]);
- std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
- if (skill_name == nullptr) {
- ShowError("Skill name for Abra skill ID %hu is not known.\n", skill_id);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Skill" << YAML::Value << *skill_name;
- int arr[MAX_SKILL_LEVEL];
- int arr_size = skill_split_atoi(split[2], arr);
- if (arr_size == 1) {
- if (arr[0] != 500)
- body << YAML::Key << "Probability" << YAML::Value << arr[0];
- } else {
- body << YAML::Key << "Probability";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- if (arr[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Probability" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from skill.cpp
- static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
- {
- uint16 skill_id = atoi(split[0]);
- std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
- if (skill_name == nullptr) {
- ShowError("Skill name for Spell Book skill ID %hu is not known.\n", skill_id);
- return false;
- }
- t_itemid nameid = strtoul(split[2], nullptr, 10);
- std::string *book_name = util::umap_find(aegis_itemnames, nameid);
- if (book_name == nullptr) {
- ShowError("Book name for item ID %u is not known.\n", nameid);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Skill" << YAML::Value << *skill_name;
- body << YAML::Key << "Book" << YAML::Value << *book_name;
- body << YAML::Key << "PreservePoints" << YAML::Value << atoi(split[1]);
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from mob.cpp
- static bool mob_readdb_mobavail(char* str[], int columns, int current) {
- uint16 mob_id = atoi(str[0]);
- std::string *mob_name = util::umap_find(aegis_mobnames, mob_id);
- if (mob_name == nullptr) {
- ShowWarning("mob_avail reading: Invalid mob-class %hu, Mob not read.\n", mob_id);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Mob" << YAML::Value << *mob_name;
- uint16 sprite_id = atoi(str[1]);
- std::string *sprite_name = util::umap_find(aegis_mobnames, sprite_id);
- if (sprite_name == nullptr) {
- char *sprite = const_cast<char *>(constant_lookup(sprite_id, "JOB_"));
- if (sprite == nullptr) {
- sprite = const_cast<char *>(constant_lookup(sprite_id, "JT_"));
- if (sprite == nullptr) {
- ShowError("Sprite name for id %d is not known.\n", sprite_id);
- return false;
- }
- sprite += 3; // Strip JT_ here because the script engine doesn't send this prefix for NPC.
- body << YAML::Key << "Sprite" << YAML::Value << sprite;
- } else
- body << YAML::Key << "Sprite" << YAML::Value << sprite;
- } else
- body << YAML::Key << "Sprite" << YAML::Value << *sprite_name;
- if (columns == 12) {
- body << YAML::Key << "Sex" << YAML::Value << (atoi(str[2]) ? "Male" : "Female");
- if (atoi(str[3]) != 0)
- body << YAML::Key << "HairStyle" << YAML::Value << atoi(str[3]);
- if (atoi(str[4]) != 0)
- body << YAML::Key << "HairColor" << YAML::Value << atoi(str[4]);
- if (atoi(str[11]) != 0)
- body << YAML::Key << "ClothColor" << YAML::Value << atoi(str[11]);
- if (atoi(str[5]) != 0) {
- t_itemid weapon_item_id = strtoul( str[5], nullptr, 10 );
- std::string *weapon_item_name = util::umap_find(aegis_itemnames, weapon_item_id);
- if (weapon_item_name == nullptr) {
- ShowError("Item name for item ID %u (weapon) is not known.\n", weapon_item_id);
- return false;
- }
- body << YAML::Key << "Weapon" << YAML::Value << *weapon_item_name;
- }
- if (atoi(str[6]) != 0) {
- t_itemid shield_item_id = strtoul( str[6], nullptr, 10 );
- std::string *shield_item_name = util::umap_find(aegis_itemnames, shield_item_id);
- if (shield_item_name == nullptr) {
- ShowError("Item name for item ID %u (shield) is not known.\n", shield_item_id);
- return false;
- }
- body << YAML::Key << "Shield" << YAML::Value << *shield_item_name;
- }
- if (atoi(str[7]) != 0) {
- t_itemid *headtop_item_id = util::umap_find(aegis_itemviewid, (t_itemid)atoi(str[7]));
- if (headtop_item_id == nullptr) {
- ShowError("Item ID for view ID %hu (head top) is not known.\n", atoi(str[7]));
- return false;
- }
- std::string *headtop_item_name = util::umap_find(aegis_itemnames, (t_itemid)*headtop_item_id);
- if (headtop_item_name == nullptr) {
- ShowError("Item name for item ID %hu (head top) is not known.\n", *headtop_item_id);
- return false;
- }
- body << YAML::Key << "HeadTop" << YAML::Value << *headtop_item_name;
- }
- if (atoi(str[8]) != 0) {
- t_itemid *headmid_item_id = util::umap_find(aegis_itemviewid, (t_itemid)atoi(str[8]));
- if (headmid_item_id == nullptr) {
- ShowError("Item ID for view ID %hu (head mid) is not known.\n", atoi(str[8]));
- return false;
- }
- std::string *headmid_item_name = util::umap_find(aegis_itemnames, (t_itemid)*headmid_item_id);
- if (headmid_item_name == nullptr) {
- ShowError("Item name for item ID %hu (head mid) is not known.\n", *headmid_item_id);
- return false;
- }
- body << YAML::Key << "HeadMid" << YAML::Value << *headmid_item_name;
- }
- if (atoi(str[9]) != 0) {
- t_itemid *headlow_item_id = util::umap_find(aegis_itemviewid, (t_itemid)atoi(str[9]));
- if (headlow_item_id == nullptr) {
- ShowError("Item ID for view ID %hu (head low) is not known.\n", atoi(str[9]));
- return false;
- }
- std::string *headlow_item_name = util::umap_find(aegis_itemnames, (t_itemid)*headlow_item_id);
- if (headlow_item_name == nullptr) {
- ShowError("Item name for item ID %hu (head low) is not known.\n", *headlow_item_id);
- return false;
- }
- body << YAML::Key << "HeadLow" << YAML::Value << *headlow_item_name;
- }
- if (atoi(str[10]) != 0) {
- uint32 options = atoi(str[10]);
- body << YAML::Key << "Options";
- body << YAML::BeginMap;
- while (options > OPTION_NOTHING && options <= OPTION_SUMMER2) {
- if (options & OPTION_SIGHT) {
- body << YAML::Key << "Sight" << YAML::Value << "true";
- options &= ~OPTION_SIGHT;
- } else if (options & OPTION_CART1) {
- body << YAML::Key << "Cart1" << YAML::Value << "true";
- options &= ~OPTION_CART1;
- } else if (options & OPTION_FALCON) {
- body << YAML::Key << "Falcon" << YAML::Value << "true";
- options &= ~OPTION_FALCON;
- } else if (options & OPTION_RIDING) {
- body << YAML::Key << "Riding" << YAML::Value << "true";
- options &= ~OPTION_RIDING;
- } else if (options & OPTION_CART2) {
- body << YAML::Key << "Cart2" << YAML::Value << "true";
- options &= ~OPTION_CART2;
- } else if (options & OPTION_CART3) {
- body << YAML::Key << "Cart2" << YAML::Value << "true";
- options &= ~OPTION_CART3;
- } else if (options & OPTION_CART4) {
- body << YAML::Key << "Cart4" << YAML::Value << "true";
- options &= ~OPTION_CART4;
- } else if (options & OPTION_CART5) {
- body << YAML::Key << "Cart5" << YAML::Value << "true";
- options &= ~OPTION_CART5;
- } else if (options & OPTION_ORCISH) {
- body << YAML::Key << "Orcish" << YAML::Value << "true";
- options &= ~OPTION_ORCISH;
- } else if (options & OPTION_WEDDING) {
- body << YAML::Key << "Wedding" << YAML::Value << "true";
- options &= ~OPTION_WEDDING;
- } else if (options & OPTION_RUWACH) {
- body << YAML::Key << "Ruwach" << YAML::Value << "true";
- options &= ~OPTION_RUWACH;
- } else if (options & OPTION_FLYING) {
- body << YAML::Key << "Flying" << YAML::Value << "true";
- options &= ~OPTION_FLYING;
- } else if (options & OPTION_XMAS) {
- body << YAML::Key << "Xmas" << YAML::Value << "true";
- options &= ~OPTION_XMAS;
- } else if (options & OPTION_TRANSFORM) {
- body << YAML::Key << "Transform" << YAML::Value << "true";
- options &= ~OPTION_TRANSFORM;
- } else if (options & OPTION_SUMMER) {
- body << YAML::Key << "Summer" << YAML::Value << "true";
- options &= ~OPTION_SUMMER;
- } else if (options & OPTION_DRAGON1) {
- body << YAML::Key << "Dragon1" << YAML::Value << "true";
- options &= ~OPTION_DRAGON1;
- } else if (options & OPTION_WUG) {
- body << YAML::Key << "Wug" << YAML::Value << "true";
- options &= ~OPTION_WUG;
- } else if (options & OPTION_WUGRIDER) {
- body << YAML::Key << "WugRider" << YAML::Value << "true";
- options &= ~OPTION_WUGRIDER;
- } else if (options & OPTION_MADOGEAR) {
- body << YAML::Key << "MadoGear" << YAML::Value << "true";
- options &= ~OPTION_MADOGEAR;
- } else if (options & OPTION_DRAGON2) {
- body << YAML::Key << "Dragon2" << YAML::Value << "true";
- options &= ~OPTION_DRAGON2;
- } else if (options & OPTION_DRAGON3) {
- body << YAML::Key << "Dragon3" << YAML::Value << "true";
- options &= ~OPTION_DRAGON3;
- } else if (options & OPTION_DRAGON4) {
- body << YAML::Key << "Dragon4" << YAML::Value << "true";
- options &= ~OPTION_DRAGON4;
- } else if (options & OPTION_DRAGON5) {
- body << YAML::Key << "Dragon5" << YAML::Value << "true";
- options &= ~OPTION_DRAGON5;
- } else if (options & OPTION_HANBOK) {
- body << YAML::Key << "Hanbok" << YAML::Value << "true";
- options &= ~OPTION_HANBOK;
- } else if (options & OPTION_OKTOBERFEST) {
- body << YAML::Key << "Oktoberfest" << YAML::Value << "true";
- options &= ~OPTION_OKTOBERFEST;
- } else if (options & OPTION_SUMMER2) {
- body << YAML::Key << "Summer2" << YAML::Value << "true";
- options &= ~OPTION_SUMMER2;
- }
- }
- body << YAML::EndMap;
- }
- } else if (columns == 3) {
- if (atoi(str[5]) != 0) {
- t_itemid peteq_item_id = strtoul( str[5], nullptr, 10 );
- std::string *peteq_item_name = util::umap_find(aegis_itemnames, peteq_item_id);
- if (peteq_item_name == nullptr) {
- ShowError("Item name for item ID %u (pet equip) is not known.\n", peteq_item_id);
- return false;
- }
- body << YAML::Key << "PetEquip" << YAML::Value << *peteq_item_name;
- }
- }
- body << YAML::EndMap;
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_requiredb(char* split[], int columns, int current)
- {
- s_skill_require entry = {};
- skill_split_atoi(split[1], entry.hp);
- skill_split_atoi(split[2], entry.mhp);
- skill_split_atoi(split[3], entry.sp);
- skill_split_atoi(split[4], entry.hp_rate);
- skill_split_atoi(split[5], entry.sp_rate);
- skill_split_atoi(split[6], entry.zeny);
- char *p;
- p = split[7];
- while (p) {
- int l = atoi(p);
- if (l == 99) { // Any weapon
- entry.weapon = 0;
- break;
- } else
- entry.weapon |= 1 << l;
- p = strchr(p, ':');
- if (!p)
- break;
- p++;
- }
- p = split[8];
- while (p) {
- int l = atoi(p);
- if (l == 99) { // Any ammo type
- entry.ammo = AMMO_TYPE_ALL;
- break;
- } else if (l) // 0 stands for no requirement
- entry.ammo |= 1 << l;
- p = strchr(p, ':');
- if (!p)
- break;
- p++;
- }
- skill_split_atoi(split[9], entry.ammo_qty);
- if (strcmpi(split[10], "hidden") == 0) entry.state = ST_HIDDEN;
- else if (strcmpi(split[10], "riding") == 0) entry.state = ST_RIDING;
- else if (strcmpi(split[10], "falcon") == 0) entry.state = ST_FALCON;
- else if (strcmpi(split[10], "cart") == 0) entry.state = ST_CART;
- else if (strcmpi(split[10], "shield") == 0) entry.state = ST_SHIELD;
- else if (strcmpi(split[10], "recover_weight_rate") == 0) entry.state = ST_RECOVER_WEIGHT_RATE;
- else if (strcmpi(split[10], "move_enable") == 0) entry.state = ST_MOVE_ENABLE;
- else if (strcmpi(split[10], "water") == 0) entry.state = ST_WATER;
- else if (strcmpi(split[10], "dragon") == 0) entry.state = ST_RIDINGDRAGON;
- else if (strcmpi(split[10], "warg") == 0) entry.state = ST_WUG;
- else if (strcmpi(split[10], "ridingwarg") == 0) entry.state = ST_RIDINGWUG;
- else if (strcmpi(split[10], "mado") == 0) entry.state = ST_MADO;
- else if (strcmpi(split[10], "elementalspirit") == 0) entry.state = ST_ELEMENTALSPIRIT;
- else if (strcmpi(split[10], "elementalspirit2") == 0) entry.state = ST_ELEMENTALSPIRIT2;
- else if (strcmpi(split[10], "peco") == 0) entry.state = ST_PECO;
- else if (strcmpi(split[10], "sunstance") == 0) entry.state = ST_SUNSTANCE;
- else if (strcmpi(split[10], "moonstance") == 0) entry.state = ST_MOONSTANCE;
- else if (strcmpi(split[10], "starstance") == 0) entry.state = ST_STARSTANCE;
- else if (strcmpi(split[10], "universestance") == 0) entry.state = ST_UNIVERSESTANCE;
- else entry.state = ST_NONE; // Unknown or no state
- trim(split[11]);
- if (split[11][0] != '\0' || atoi(split[11])) {
- int64 require[MAX_SKILL_STATUS_REQUIRE];
- int32 count;
- if ((count = skill_split_atoi2(split[11], require, ":", SC_STONE, ARRAYLENGTH(require)))) {
- for (int i = 0; i < count; i++) {
- entry.status.push_back((sc_type)require[i]);
- }
- }
- }
- skill_split_atoi(split[12], entry.spiritball);
- for (int i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++) {
- if (atoi(split[13 + 2 * i]) > 0) {
- t_itemid item_id = strtoul( split[13 + 2 * i], nullptr, 10 );
- std::string *item_name = util::umap_find(aegis_itemnames, item_id);
- if (item_name == nullptr) {
- ShowError("Item name for item id %u is not known.\n", item_id);
- return false;
- }
- entry.itemid[i] = item_id;
- entry.amount[i] = atoi(split[14 + 2 * i]);
- }
- }
- trim(split[33]);
- if (split[33][0] != '\0' || atoi(split[33])) {
- int64 require[MAX_SKILL_EQUIP_REQUIRE];
- int32 count;
- if ((count = skill_split_atoi2(split[33], require, ":", 500, ARRAYLENGTH(require)))) {
- for (int i = 0; i < count; i++) {
- if (require[i] > 0)
- entry.eqItem.push_back(static_cast<int32>(require[i]));
- }
- }
- }
- skill_require.insert({ atoi(split[0]), entry });
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_castdb(char* split[], int columns, int current)
- {
- s_skill_db entry = {};
- skill_split_atoi(split[1], entry.cast);
- skill_split_atoi(split[2], entry.delay);
- skill_split_atoi(split[3], entry.walkdelay);
- skill_split_atoi(split[4], entry.upkeep_time);
- skill_split_atoi(split[5], entry.upkeep_time2);
- skill_split_atoi(split[6], entry.cooldown);
- #ifdef RENEWAL_CAST
- skill_split_atoi(split[7], (int *)entry.fixed_cast);
- #endif
- skill_cast.insert({ atoi(split[0]), entry });
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_castnodexdb(char* split[], int columns, int current)
- {
- s_skill_db entry = {};
- entry.castnodex = atoi(split[1]);
- if (split[2]) // optional column
- entry.delaynodex = atoi(split[2]);
- skill_castnodex.insert({ atoi(split[0]), entry });
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_unitdb(char* split[], int columns, int current)
- {
- s_skill_unit_csv entry = {};
- entry.unit_id = (uint16)strtol(split[1], NULL, 16);
- entry.unit_id2 = (uint16)strtol(split[2], NULL, 16);
- skill_split_atoi(split[3], entry.unit_layout_type);
- skill_split_atoi(split[4], entry.unit_range);
- entry.unit_interval = atoi(split[5]);
- entry.target_str = trim(split[6]);
- entry.unit_flag_csv = strtol(split[7], NULL, 16);
- skill_unit.insert({ atoi(split[0]), entry });
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_copyabledb(char* split[], int column, int current)
- {
- s_skill_copyable entry = {};
- int skill_id = -1;
- trim(split[0]);
- if (ISDIGIT(split[0][0]))
- skill_id = atoi(split[0]);
- else {
- for (const auto &it : aegis_skillnames) {
- if (it.second == split[0])
- skill_id = it.first;
- }
- if (skill_id == -1) {
- ShowError("Skill %s is unknown.\n", split[0]);
- return false;
- }
- }
- entry.option = atoi(split[1]);
- entry.req_opt = cap_value(atoi(split[3]), 0, (0x2000) - 1);
- skill_copyable.insert({ skill_id, entry });
- return true;
- }
- // skill_db.yml function
- //----------------------
- static bool skill_parse_row_nonearnpcrangedb(char* split[], int column, int current)
- {
- s_skill_db entry = {};
- int skill_id = -1;
- trim(split[0]);
- if (ISDIGIT(split[0][0]))
- skill_id = atoi(split[0]);
- else {
- for (const auto &it : aegis_skillnames) {
- if (it.second == split[0])
- skill_id = it.first;
- }
- if (skill_id == -1) {
- ShowError("Skill %s is unknown.\n", split[0]);
- return false;
- }
- }
- entry.unit_nonearnpc_range = max(atoi(split[1]), 0);
- entry.unit_nonearnpc_type = (atoi(split[2])) ? cap_value(atoi(split[2]), 1, 15) : 15;
- skill_nearnpc.insert({ skill_id, entry });
- return true;
- }
- static bool isMultiLevel(int arr[]) {
- int count = 0;
- for (int i = 0; i < MAX_SKILL_LEVEL; i++) {
- if (arr[i] != 0)
- count++;
- }
- return (count == 0 || count == 1 ? false : true);
- }
- std::string name2Upper(std::string name) {
- std::transform(name.begin(), name.end(), name.begin(), ::tolower);
- name[0] = toupper(name[0]);
- for (size_t i = 0; i < name.size(); i++) {
- if (name[i - 1] == '_' || (name[i - 2] == '1' && name[i - 1] == 'h') || (name[i - 2] == '2' && name[i - 1] == 'h'))
- name[i] = toupper(name[i]);
- }
- return name;
- }
- // Copied and adjusted from skill.cpp
- static bool skill_parse_row_skilldb(char* split[], int columns, int current) {
- int arr[MAX_SKILL_LEVEL], arr_size, skill_id = atoi(split[0]);
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << skill_id;
- body << YAML::Key << "Name" << YAML::Value << trim(split[16]);
- body << YAML::Key << "Description" << YAML::Value << trim(split[17]);
- body << YAML::Key << "MaxLevel" << YAML::Value << atoi(split[7]);
- if (strcmpi(split[13], "weapon") == 0)
- body << YAML::Key << "Type" << YAML::Value << "Weapon";
- else if (strcmpi(split[13], "magic") == 0)
- body << YAML::Key << "Type" << YAML::Value << "Magic";
- else if (strcmpi(split[13], "misc") == 0)
- body << YAML::Key << "Type" << YAML::Value << "Misc";
- std::string constant;
- if (atoi(split[3]) != 0) {
- constant = constant_lookup(atoi(split[3]), "INF_");
- constant.erase(0, 4);
- constant.erase(constant.size() - 6);
- body << YAML::Key << "TargetType" << YAML::Value << name2Upper(constant);
- }
- uint64 nk_val = strtol(split[5], NULL, 0);
- if (nk_val) {
- body << YAML::Key << "DamageFlags";
- body << YAML::BeginMap;
- if (nk_val & 0x1)
- body << YAML::Key << "NoDamage" << YAML::Value << "true";
- if (nk_val & 0x2)
- body << YAML::Key << "Splash" << YAML::Value << "true";
- if (nk_val & 0x4)
- body << YAML::Key << "SplashSplit" << YAML::Value << "true";
- if (nk_val & 0x8)
- body << YAML::Key << "IgnoreAtkCard" << YAML::Value << "true";
- if (nk_val & 0x10)
- body << YAML::Key << "IgnoreElement" << YAML::Value << "true";
- if (nk_val & 0x20)
- body << YAML::Key << "IgnoreDefense" << YAML::Value << "true";
- if (nk_val & 0x40)
- body << YAML::Key << "IgnoreFlee" << YAML::Value << "true";
- if (nk_val & 0x80)
- body << YAML::Key << "IgnoreDefCard" << YAML::Value << "true";
- if (nk_val & 0x100)
- body << YAML::Key << "Critical" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- uint64 inf2_val = strtol(split[11], nullptr, 0);
- uint64 inf3_val = strtol(split[15], nullptr, 0);
- if (inf2_val || inf3_val) {
- body << YAML::Key << "Flags";
- body << YAML::BeginMap;
- if (inf2_val & 0x1)
- body << YAML::Key << "IsQuest" << YAML::Value << "true";
- if (inf2_val & 0x2)
- body << YAML::Key << "IsNpc" << YAML::Value << "true";
- if (inf2_val & 0x4)
- body << YAML::Key << "IsWedding" << YAML::Value << "true";
- if (inf2_val & 0x8)
- body << YAML::Key << "IsSpirit" << YAML::Value << "true";
- if (inf2_val & 0x10)
- body << YAML::Key << "IsGuild" << YAML::Value << "true";
- if (inf2_val & 0x20)
- body << YAML::Key << "IsSong" << YAML::Value << "true";
- if (inf2_val & 0x40)
- body << YAML::Key << "IsEnsemble" << YAML::Value << "true";
- if (inf2_val & 0x80)
- body << YAML::Key << "IsTrap" << YAML::Value << "true";
- if (inf2_val & 0x100)
- body << YAML::Key << "TargetSelf" << YAML::Value << "true";
- if (inf2_val & 0x200)
- body << YAML::Key << "NoTargetSelf" << YAML::Value << "true";
- if (inf2_val & 0x400)
- body << YAML::Key << "PartyOnly" << YAML::Value << "true";
- if (inf2_val & 0x800)
- body << YAML::Key << "GuildOnly" << YAML::Value << "true";
- if (inf2_val & 0x1000)
- body << YAML::Key << "NoTargetEnemy" << YAML::Value << "true";
- if (inf2_val & 0x2000)
- body << YAML::Key << "IsAutoShadowSpell" << YAML::Value << "true";
- if (inf2_val & 0x4000)
- body << YAML::Key << "IsChorus" << YAML::Value << "true";
- if (inf2_val & 0x8000)
- body << YAML::Key << "IgnoreBgReduction" << YAML::Value << "true";
- if (inf2_val & 0x10000)
- body << YAML::Key << "IgnoreGvgReduction" << YAML::Value << "true";
- if (inf2_val & 0x20000)
- body << YAML::Key << "DisableNearNpc" << YAML::Value << "true";
- if (inf2_val & 0x40000)
- body << YAML::Key << "TargetTrap" << YAML::Value << "true"; // ?
- if (inf3_val & 0x1)
- body << YAML::Key << "IgnoreLandProtector" << YAML::Value << "true";
- if (inf3_val & 0x4)
- body << YAML::Key << "AllowWhenHidden" << YAML::Value << "true";
- if (inf3_val & 0x8)
- body << YAML::Key << "AllowWhenPerforming" << YAML::Value << "true";
- if (inf3_val & 0x10)
- body << YAML::Key << "TargetEmperium" << YAML::Value << "true";
- if (inf3_val & 0x20)
- body << YAML::Key << "IgnoreStasis" << YAML::Value << "true";
- if (inf3_val & 0x40)
- body << YAML::Key << "IgnoreKagehumi" << YAML::Value << "true";
- if (inf3_val & 0x80)
- body << YAML::Key << "AlterRangeVulture" << YAML::Value << "true";
- if (inf3_val & 0x100)
- body << YAML::Key << "AlterRangeSnakeEye" << YAML::Value << "true";
- if (inf3_val & 0x200)
- body << YAML::Key << "AlterRangeShadowJump" << YAML::Value << "true";
- if (inf3_val & 0x400)
- body << YAML::Key << "AlterRangeRadius" << YAML::Value << "true";
- if (inf3_val & 0x800)
- body << YAML::Key << "AlterRangeResearchTrap" << YAML::Value << "true";
- if (inf3_val & 0x1000)
- body << YAML::Key << "IgnoreHovering" << YAML::Value << "true";
- if (inf3_val & 0x2000)
- body << YAML::Key << "AllowOnWarg" << YAML::Value << "true";
- if (inf3_val & 0x4000)
- body << YAML::Key << "AllowOnMado" << YAML::Value << "true";
- if (inf3_val & 0x8000)
- body << YAML::Key << "TargetManHole" << YAML::Value << "true";
- if (inf3_val & 0x10000)
- body << YAML::Key << "TargetHidden" << YAML::Value << "true";
- if (inf3_val & 0x40000)
- body << YAML::Key << "IncreaseDanceWithWugDamage" << YAML::Value << "true";
- if (inf3_val & 0x80000)
- body << YAML::Key << "IgnoreWugBite" << YAML::Value << "true";
- if (inf3_val & 0x100000)
- body << YAML::Key << "IgnoreAutoGuard" << YAML::Value << "true";
- if (inf3_val & 0x200000)
- body << YAML::Key << "IgnoreCicada" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[1], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0) {
- body << YAML::Key << "Range";
- body << YAML::Value << arr[0];
- }
- } else {
- body << YAML::Key << "Range";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Size" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- if (atoi(split[2]) != 0) {
- constant = constant_lookup(atoi(split[2]), "DMG_");
- constant.erase(0, 4);
- body << YAML::Key << "Hit" << YAML::Value << name2Upper(constant);
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[8], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0) {
- body << YAML::Key << "HitCount";
- body << YAML::Value << arr[0];
- }
- } else {
- body << YAML::Key << "HitCount";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Count" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[4], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0){
- body << YAML::Key << "Element";
- if (arr[0] == -1)
- body << YAML::Value << "Weapon";
- else if (arr[0] == -2)
- body << YAML::Value << "Endowed";
- else if (arr[0] == -3)
- body << YAML::Value << "Random";
- else {
- constant = constant_lookup(arr[0], "ELE_");
- constant.erase(0, 4);
- body << YAML::Value << name2Upper(constant);
- }
- }
- } else {
- body << YAML::Key << "Element";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- if (arr[i] == -1)
- body << YAML::Key << "Element" << YAML::Value << "Weapon";
- else if (arr[i] == -2)
- body << YAML::Key << "Element" << YAML::Value << "Endowed";
- else if (arr[i] == -3)
- body << YAML::Key << "Element" << YAML::Value << "Random";
- else {
- constant = constant_lookup(arr[i], "ELE_");
- constant.erase(0, 4);
- body << YAML::Key << "Element" << YAML::Value << name2Upper(constant);
- }
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[6], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0) {
- body << YAML::Key << "SplashArea";
- body << YAML::Value << arr[0];
- }
- } else {
- body << YAML::Key << "SplashArea";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Area" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[12], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0) {
- body << YAML::Key << "ActiveInstance";
- body << YAML::Value << arr[0];
- }
- } else {
- body << YAML::Key << "ActiveInstance";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Max" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- memset(arr, 0, sizeof(arr));
- arr_size = skill_split_atoi(split[14], arr);
- if (arr_size != 0) {
- if (arr_size == 1) {
- if (arr[0] != 0) {
- body << YAML::Key << "Knockback";
- body << YAML::Value << arr[0];
- }
- } else {
- body << YAML::Key << "Knockback";
- body << YAML::BeginSeq;
- for (int i = 0; i < arr_size; i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << arr[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- }
- auto it_copyable = skill_copyable.find(skill_id);
- if (it_copyable != skill_copyable.end()) {
- body << YAML::Key << "CopyFlags";
- body << YAML::BeginMap;
- body << YAML::Key << "Skill";
- body << YAML::BeginMap;
- if (it_copyable->second.option & 1)
- body << YAML::Key << "Plagiarism" << YAML::Value << "true";
- if (it_copyable->second.option & 2)
- body << YAML::Key << "Reproduce" << YAML::Value << "true";
- body << YAML::EndMap;
- if (it_copyable->second.req_opt > 0) {
- body << YAML::Key << "RemoveRequirement";
- body << YAML::BeginMap;
- if (it_copyable->second.req_opt & 0x1)
- body << YAML::Key << "HpCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x4)
- body << YAML::Key << "SpCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x8)
- body << YAML::Key << "HpRateCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x10)
- body << YAML::Key << "SpRateCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x2)
- body << YAML::Key << "MaxHpTrigger" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x20)
- body << YAML::Key << "ZenyCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x40)
- body << YAML::Key << "Weapon" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x80)
- body << YAML::Key << "Ammo" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x100)
- body << YAML::Key << "State" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x200)
- body << YAML::Key << "Status" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x400)
- body << YAML::Key << "SpiritSphereCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x800)
- body << YAML::Key << "ItemCost" << YAML::Value << "true";
- if (it_copyable->second.req_opt & 0x1000)
- body << YAML::Key << "Equipment" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- }
- auto it_nearnpc = skill_nearnpc.find(skill_id);
- if (it_nearnpc != skill_nearnpc.end()) {
- body << YAML::Key << "NoNearNPC";
- body << YAML::BeginMap;
- if (it_nearnpc->second.unit_nonearnpc_range > 0)
- body << YAML::Key << "AdditionalRange" << YAML::Value << it_nearnpc->second.unit_nonearnpc_range;
- if (it_nearnpc->second.unit_nonearnpc_type > 0) {
- body << YAML::Key << "Type";
- body << YAML::BeginMap;
- if (it_nearnpc->second.unit_nonearnpc_type & 1)
- body << YAML::Key << "WarpPortal" << YAML::Value << "true";
- if (it_nearnpc->second.unit_nonearnpc_type & 2)
- body << YAML::Key << "Shop" << YAML::Value << "true";
- if (it_nearnpc->second.unit_nonearnpc_type & 4)
- body << YAML::Key << "Npc" << YAML::Value << "true";
- if (it_nearnpc->second.unit_nonearnpc_type & 8)
- body << YAML::Key << "Tomb" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- }
- if (strcmpi(split[9], "yes") == 0)
- body << YAML::Key << "CastCancel" << YAML::Value << "true";
- if (atoi(split[10]) != 0)
- body << YAML::Key << "CastDefenseReduction" << YAML::Value << atoi(split[10]);
- auto it_cast = skill_cast.find(skill_id);
- if (it_cast != skill_cast.end()) {
- if (!isMultiLevel(it_cast->second.cast)) {
- if (it_cast->second.cast[0] > 0)
- body << YAML::Key << "CastTime" << YAML::Value << it_cast->second.cast[0];
- } else {
- body << YAML::Key << "CastTime";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.cast); i++) {
- if (it_cast->second.cast[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.cast[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_cast->second.delay)) {
- if (it_cast->second.delay[0] > 0)
- body << YAML::Key << "AfterCastActDelay" << YAML::Value << it_cast->second.delay[0];
- } else {
- body << YAML::Key << "AfterCastActDelay";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.delay); i++) {
- if (it_cast->second.delay[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.delay[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_cast->second.walkdelay)) {
- if (it_cast->second.walkdelay[0] > 0)
- body << YAML::Key << "AfterCastWalkDelay" << YAML::Value << it_cast->second.walkdelay[0];
- } else {
- body << YAML::Key << "AfterCastWalkDelay";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.walkdelay); i++) {
- if (it_cast->second.walkdelay[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.walkdelay[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_cast->second.upkeep_time)) {
- if (it_cast->second.upkeep_time[0] != 0)
- body << YAML::Key << "Duration1" << YAML::Value << it_cast->second.upkeep_time[0];
- } else {
- body << YAML::Key << "Duration1";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.upkeep_time); i++) {
- if (it_cast->second.upkeep_time[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.upkeep_time[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- if (!isMultiLevel(it_cast->second.upkeep_time2)) {
- if (it_cast->second.upkeep_time2[0] != 0)
- body << YAML::Key << "Duration2" << YAML::Value << it_cast->second.upkeep_time2[0];
- } else {
- body << YAML::Key << "Duration2";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.upkeep_time2); i++) {
- if (it_cast->second.upkeep_time2[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.upkeep_time2[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_cast->second.cooldown)) {
- if (it_cast->second.cooldown[0] > 0)
- body << YAML::Key << "Cooldown" << YAML::Value << it_cast->second.cooldown[0];
- } else {
- body << YAML::Key << "Cooldown";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.cooldown); i++) {
- if (it_cast->second.cooldown[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.cooldown[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- #ifdef RENEWAL_CAST
- if (!isMultiLevel(it_cast->second.fixed_cast)) {
- if (it_cast->second.fixed_cast[0] != 0)
- body << YAML::Key << "FixedCastTime" << YAML::Value << it_cast->second.fixed_cast[0];
- } else {
- body << YAML::Key << "FixedCastTime";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_cast->second.fixed_cast); i++) {
- if (it_cast->second.fixed_cast[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Time" << YAML::Value << it_cast->second.fixed_cast[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- #endif
- }
- auto it_castdex = skill_castnodex.find(skill_id);
- if (it_castdex != skill_castnodex.end()) {
- if (it_castdex->second.castnodex > 0) {
- body << YAML::Key << "CastTimeFlags";
- body << YAML::BeginMap;
- if (it_castdex->second.castnodex & 1)
- body << YAML::Key << "IgnoreDex" << YAML::Value << "true";
- if (it_castdex->second.castnodex & 2)
- body << YAML::Key << "IgnoreStatus" << YAML::Value << "true";
- if (it_castdex->second.castnodex & 4)
- body << YAML::Key << "IgnoreItemBonus" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- if (it_castdex->second.delaynodex > 0) {
- body << YAML::Key << "CastDelayFlags";
- body << YAML::BeginMap;
- if (it_castdex->second.delaynodex & 1)
- body << YAML::Key << "IgnoreDex" << YAML::Value << "true";
- if (it_castdex->second.delaynodex & 2)
- body << YAML::Key << "IgnoreStatus" << YAML::Value << "true";
- if (it_castdex->second.delaynodex & 4)
- body << YAML::Key << "IgnoreItemBonus" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- }
- auto it_req = skill_require.find(skill_id);
- if (it_req != skill_require.end()) {
- body << YAML::Key << "Requires";
- body << YAML::BeginMap;
-
- if (!isMultiLevel(it_req->second.hp)) {
- if (it_req->second.hp[0] > 0)
- body << YAML::Key << "HpCost" << YAML::Value << it_req->second.hp[0];
- } else {
- body << YAML::Key << "HpCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.hp); i++) {
- if (it_req->second.hp[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.hp[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_req->second.sp)) {
- if (it_req->second.sp[0] > 0)
- body << YAML::Key << "SpCost" << YAML::Value << it_req->second.sp[0];
- } else {
- body << YAML::Key << "SpCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.sp); i++) {
- if (it_req->second.sp[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.sp[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_req->second.hp_rate)) {
- if (it_req->second.hp_rate[0] != 0)
- body << YAML::Key << "HpRateCost" << YAML::Value << it_req->second.hp_rate[0];
- } else {
- body << YAML::Key << "HpRateCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.hp_rate); i++) {
- if (it_req->second.hp_rate[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.hp_rate[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_req->second.sp_rate)) {
- if (it_req->second.sp_rate[0] != 0)
- body << YAML::Key << "SpRateCost" << YAML::Value << it_req->second.sp_rate[0];
- } else {
- body << YAML::Key << "SpRateCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.sp_rate); i++) {
- if (it_req->second.sp_rate[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.sp_rate[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_req->second.mhp)) {
- if (it_req->second.mhp[0] > 0)
- body << YAML::Key << "MaxHpTrigger" << YAML::Value << it_req->second.mhp[0];
- } else {
- body << YAML::Key << "MaxHpTrigger";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.mhp); i++) {
- if (it_req->second.mhp[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.mhp[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_req->second.zeny)) {
- if (it_req->second.zeny[0] > 0)
- body << YAML::Key << "ZenyCost" << YAML::Value << it_req->second.zeny[0];
- } else {
- body << YAML::Key << "ZenyCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.zeny); i++) {
- if (it_req->second.zeny[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.zeny[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- if (it_req->second.weapon != 0) {
- body << YAML::Key << "Weapon";
- body << YAML::BeginMap;
- int temp = it_req->second.weapon;
- if (temp != 99) { // Not "All"
- for (int i = 0; i < MAX_WEAPON_TYPE_ALL; i++) {
- if (i == MAX_WEAPON_TYPE)
- continue;
- if (temp & 1 << i) {
- constant = constant_lookup(i, "W_");
- constant.erase(0, 2);
- body << YAML::Key << name2Upper(constant) << YAML::Value << "true";
- temp ^= 1 << i;
- }
- }
- }
- body << YAML::EndMap;
- }
- if (it_req->second.ammo != 0) {
- body << YAML::Key << "Ammo";
- body << YAML::BeginMap;
- int temp = it_req->second.ammo;
- for (int i = 1; i < MAX_AMMO_TYPE; i++) {
- if (temp & 1 << i) {
- constant = constant_lookup(i, "A_");
- constant.erase(0, 2);
- body << YAML::Key << name2Upper(constant) << YAML::Value << "true";
- temp ^= 1 << i;
- }
- }
- body << YAML::EndMap;
- }
- if (!isMultiLevel(it_req->second.ammo_qty)) {
- if (it_req->second.ammo_qty[0] > 0)
- body << YAML::Key << "AmmoAmount" << YAML::Value << it_req->second.ammo_qty[0];
- } else {
- body << YAML::Key << "AmmoAmount";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.ammo_qty); i++) {
- if (it_req->second.ammo_qty[i] > 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.ammo_qty[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- if (it_req->second.state) {
- constant = constant_lookup(it_req->second.state, "ST_");
- constant.erase(0, 3);
- body << YAML::Key << "State" << YAML::Value << name2Upper(constant);
- }
- if (it_req->second.status.size() > 0) {
- body << YAML::Key << "Status";
- body << YAML::BeginMap;
- for (const auto &it : it_req->second.status) {
- constant = constant_lookup(it, "SC_");
- constant.erase(0, 3);
- body << YAML::Key << name2Upper(constant) << YAML::Value << "true";
- }
- body << YAML::EndMap;
- }
-
- if (!isMultiLevel(it_req->second.spiritball)) {
- if (it_req->second.spiritball[0] != 0)
- body << YAML::Key << "SpiritSphereCost" << YAML::Value << it_req->second.spiritball[0];
- } else {
- body << YAML::Key << "SpiritSphereCost";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_req->second.spiritball); i++) {
- if (it_req->second.spiritball[i] != 0) {
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.spiritball[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- if (it_req->second.itemid[0] > 0) {
- body << YAML::Key << "ItemCost";
- body << YAML::BeginSeq;
- for (uint8 i = 0; i < ARRAYLENGTH(it_req->second.itemid); i++) {
- if (it_req->second.itemid[i] > 0) {
- body << YAML::BeginMap;
- std::string *item_name = util::umap_find(aegis_itemnames, it_req->second.itemid[i]);
- if (item_name == nullptr) {
- ShowError("Item name for item id %hu is not known (itemcost).\n", it_req->second.itemid[i]);
- return false;
- }
- body << YAML::Key << "Item" << YAML::Value << *item_name;
- body << YAML::Key << "Amount" << YAML::Value << it_req->second.amount[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- }
- if (it_req->second.eqItem.size() > 0) {
- body << YAML::Key << "Equipment";
- body << YAML::BeginMap;
- for (const auto &it : it_req->second.eqItem) {
- std::string *item_name = util::umap_find(aegis_itemnames, it);
- if (item_name == nullptr) {
- ShowError("Item name for item id %u is not known (equipment).\n", it);
- return false;
- }
- body << YAML::Key << *item_name << YAML::Value << "true";
- }
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- }
- auto it_unit = skill_unit.find(skill_id);
- if (it_unit != skill_unit.end()) {
- body << YAML::Key << "Unit";
- body << YAML::BeginMap;
- constant = constant_lookup(it_unit->second.unit_id, "UNT_");
- constant.erase(0, 4);
- body << YAML::Key << "Id" << YAML::Value << name2Upper(constant);
- if (it_unit->second.unit_id2 > 0) {
- constant = constant_lookup(it_unit->second.unit_id2, "UNT_");
- constant.erase(0, 4);
- body << YAML::Key << "AlternateId" << YAML::Value << name2Upper(constant);
- }
-
- if (!isMultiLevel(it_unit->second.unit_layout_type)) {
- if (it_unit->second.unit_layout_type[0] != 0)
- body << YAML::Key << "Layout" << YAML::Value << it_unit->second.unit_layout_type[0];
- } else {
- body << YAML::Key << "Layout";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_unit->second.unit_layout_type); i++) {
- if (it_unit->second.unit_layout_type[i] == 0 && i + 1 > 5)
- continue;
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Size" << YAML::Value << it_unit->second.unit_layout_type[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
-
- if (!isMultiLevel(it_unit->second.unit_range)) {
- if (it_unit->second.unit_range[0] != 0)
- body << YAML::Key << "Range" << YAML::Value << it_unit->second.unit_range[0];
- } else {
- body << YAML::Key << "Range";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < ARRAYLENGTH(it_unit->second.unit_range); i++) {
- if (it_unit->second.unit_range[i] == 0 && i + 1 > 5)
- continue;
- body << YAML::BeginMap;
- body << YAML::Key << "Level" << YAML::Value << i + 1;
- body << YAML::Key << "Size" << YAML::Value << it_unit->second.unit_range[i];
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- if (it_unit->second.unit_interval != 0)
- body << YAML::Key << "Interval" << YAML::Value << it_unit->second.unit_interval;
- if (it_unit->second.target_str.size() > 0) {
- if (it_unit->second.target_str.compare("noenemy") == 0 || it_unit->second.target_str.compare("friend") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Friend";
- //else if (it_unit->second.target_str.compare("noenemy") == 0) // Same as Friend
- // body << YAML::Key << "Target" << YAML::Value << "NoEnemy";
- else if (it_unit->second.target_str.compare("party") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Party";
- else if (it_unit->second.target_str.compare("ally") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Ally";
- else if (it_unit->second.target_str.compare("guild") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Guild";
- //else if (it_unit->second.target_str.compare("all") == 0)
- // body << YAML::Key << "Target" << YAML::Value << "All";
- else if (it_unit->second.target_str.compare("enemy") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Enemy";
- else if (it_unit->second.target_str.compare("self") == 0)
- body << YAML::Key << "Target" << YAML::Value << "Self";
- else if (it_unit->second.target_str.compare("sameguild") == 0)
- body << YAML::Key << "Target" << YAML::Value << "SameGuild";
- }
- if (it_unit->second.unit_flag_csv > 0) {
- body << YAML::Key << "Flag";
- body << YAML::BeginMap;
- if (it_unit->second.unit_flag_csv & 0x1)
- body << YAML::Value << "NoEnemy" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x2)
- body << YAML::Value << "NoReiteration" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x4)
- body << YAML::Value << "NoFootSet" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x8)
- body << YAML::Value << "NoOverlap" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x10)
- body << YAML::Value << "PathCheck" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x20)
- body << YAML::Value << "NoPc" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x40)
- body << YAML::Value << "NoMob" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x80)
- body << YAML::Value << "Skill" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x100)
- body << YAML::Value << "Dance" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x200)
- body << YAML::Value << "Ensemble" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x400)
- body << YAML::Value << "Song" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x800)
- body << YAML::Value << "DualMode" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x1000)
- body << YAML::Value << "NoKnockback" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x2000)
- body << YAML::Value << "RangedSingleUnit" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x4000)
- body << YAML::Value << "CrazyWeedImmune" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x8000)
- body << YAML::Value << "RemovedByFireRain" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x10000)
- body << YAML::Value << "KnockbackGroup" << YAML::Value << "true";
- if (it_unit->second.unit_flag_csv & 0x20000)
- body << YAML::Value << "HiddenTrap" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from quest.cpp
- static bool quest_read_db(char *split[], int columns, int current) {
- int quest_id = atoi(split[0]);
- if (quest_id < 0 || quest_id >= INT_MAX) {
- ShowError("quest_read_db: Invalid quest ID '%d'.\n", quest_id);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << quest_id;
- std::string title = split[17];
-
- if (columns > 18) { // If the title has a comma in it, concatenate
- int col = 18;
- while (col < columns) {
- title += ',' + std::string(split[col]);
- col++;
- }
- }
- title.erase(std::remove(title.begin(), title.end(), '"'), title.end()); // Strip double quotes out
- body << YAML::Key << "Title" << YAML::Value << title;
- if (strchr(split[1], ':') == NULL) {
- uint32 time = atoi(split[1]);
- if (time > 0) {
- int day = time / 86400;
- time %= (24 * 3600);
- int hour = time / 3600;
- time %= 3600;
- int minute = time / 60;
- time %= 60;
- int second = time;
- std::string output = "+";
- if (day > 0)
- output += std::to_string(day) + "d";
- if (hour > 0)
- output += std::to_string(hour) + "h";
- if (minute > 0)
- output += std::to_string(minute) + "mn";
- if (second > 0)
- output += std::to_string(second) + "s";
- body << YAML::Key << "TimeLimit" << YAML::Value << output;
- }
- } else {
- if (*split[1]) {
- std::string time_str(split[1]), hour = time_str.substr(0, time_str.find(':')), output = {};
- time_str.erase(0, 3); // Remove "HH:"
- if (std::stoi(hour) > 0)
- output = std::to_string(std::stoi(hour)) + "h";
- if (std::stoi(time_str) > 0)
- output += std::to_string(std::stoi(time_str)) + "mn";
- body << YAML::Key << "TimeLimit" << YAML::Value << output; // No quests in TXT format had days, default to 0
- }
- }
- if (atoi(split[2]) > 0) {
- body << YAML::Key << "Targets";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < MAX_QUEST_OBJECTIVES; i++) {
- int32 mob_id = (int32)atoi(split[i * 2 + 2]), count = atoi(split[i * 2 + 3]);
- if (!mob_id || !count)
- continue;
- std::string *mob_name = util::umap_find(aegis_mobnames, static_cast<uint16>(mob_id));
- if (!mob_name) {
- ShowError("quest_read_db: Invalid mob-class %hu, target not read.\n", mob_id);
- continue;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Mob" << YAML::Value << *mob_name;
- body << YAML::Key << "Count" << YAML::Value << count;
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- if (atoi(split[2 * MAX_QUEST_OBJECTIVES + 2]) > 0) {
- body << YAML::Key << "Drops";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < MAX_QUEST_DROPS; i++) {
- int32 mob_id = (int32)atoi(split[3 * i + (2 * MAX_QUEST_OBJECTIVES + 2)]);
- t_itemid nameid = strtoul(split[3 * i + (2 * MAX_QUEST_OBJECTIVES + 3)], nullptr, 10);
- if (!mob_id || !nameid)
- continue;
- std::string *mob_name = util::umap_find(aegis_mobnames, static_cast<uint16>(mob_id));
- if (!mob_name) {
- ShowError("quest_read_db: Invalid mob-class %hu, drop not read.\n", mob_id);
- continue;
- }
- std::string *item_name = util::umap_find(aegis_itemnames, nameid);
- if (!item_name) {
- ShowError("quest_read_db: Invalid item name %u, drop not read.\n", nameid);
- return false;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Mob" << YAML::Value << *mob_name;
- body << YAML::Key << "Item" << YAML::Value << *item_name;
- //body << YAML::Key << "Count" << YAML::Value << 1; // Default is 1
- body << YAML::Key << "Rate" << YAML::Value << atoi(split[3 * i + (2 * MAX_QUEST_OBJECTIVES + 4)]);
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- }
- body << YAML::EndMap;
- return true;
- }
- // Copied and adjusted from instance.cpp
- static bool instance_readdb_sub(char* str[], int columns, int current) {
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << atoi(str[0]);
- body << YAML::Key << "Name" << YAML::Value << str[1];
- if (atoi(str[2]) != 3600)
- body << YAML::Key << "TimeLimit" << YAML::Value << atoi(str[2]);
- if (atoi(str[3]) != 300)
- body << YAML::Key << "IdleTimeOut" << YAML::Value << atoi(str[3]);
- body << YAML::Key << "Enter";
- body << YAML::BeginMap;
- body << YAML::Key << "Map" << YAML::Value << str[4];
- body << YAML::Key << "X" << YAML::Value << atoi(str[5]);
- body << YAML::Key << "Y" << YAML::Value << atoi(str[6]);
- body << YAML::EndMap;
- if (columns > 7) {
- body << YAML::Key << "AdditionalMaps";
- body << YAML::BeginMap;
- for (int i = 7; i < columns; i++) {
- if (!strlen(str[i]))
- continue;
- if (strcmpi(str[4], str[i]) == 0)
- continue;
- body << YAML::Key << str[i] << YAML::Value << "true";
- }
- body << YAML::EndMap;
- }
- body << YAML::EndMap;
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_itemavail(char *str[], int columns, int current) {
- item_avail.insert({ strtoul(str[0], nullptr, 10), strtoul(str[1], nullptr, 10) });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
- item_buyingstore.insert({ strtoul(fields[0], nullptr, 10), true });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_flag(char* fields[], int columns, int current) {
- s_item_flag_csv2yaml item = { 0 };
- uint16 flag = abs(atoi(fields[1]));
- if (flag & 1)
- item.dead_branch = true;
- if (flag & 2)
- item.group = true;
- if (flag & 4)
- item.guid = true;
- if (flag & 8)
- item.bindOnEquip = true;
- if (flag & 16)
- item.broadcast = true;
- if (flag & 32)
- item.delay_consume = true;
- if (flag & 64)
- item.dropEffect = DROPEFFECT_CLIENT;
- else if (flag & 128)
- item.dropEffect = DROPEFFECT_WHITE_PILLAR;
- else if (flag & 256)
- item.dropEffect = DROPEFFECT_BLUE_PILLAR;
- else if (flag & 512)
- item.dropEffect = DROPEFFECT_YELLOW_PILLAR;
- else if (flag & 1024)
- item.dropEffect = DROPEFFECT_PURPLE_PILLAR;
- else if (flag & 2048)
- item.dropEffect = DROPEFFECT_ORANGE_PILLAR;
- item_flag.insert({ strtoul(fields[0], nullptr, 10), item });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
- s_item_delay_csv2yaml item = { 0 };
- item.delay = atoi(str[1]);
- if (columns == 3)
- item.sc = trim(str[2]);
- item_delay.insert({ strtoul(str[0], nullptr, 10), item });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_stack(char* fields[], int columns, int current) {
- s_item_stack_csv2yaml item = { 0 };
- item.amount = atoi(fields[1]);
- int type = strtoul(fields[2], NULL, 10);
- if (type & 1)
- item.inventory = true;
- if (type & 2)
- item.cart = true;
- if (type & 4)
- item.storage = true;
- if (type & 8)
- item.guild_storage = true;
- item_stack.insert({ strtoul(fields[0], nullptr, 10), item });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_nouse(char* fields[], int columns, int current) {
- s_item_nouse_csv2yaml item = { 0 };
- item.sitting = "true";
- item.override = atoi(fields[2]);
- item_nouse.insert({ strtoul(fields[0], nullptr, 10), item });
- return true;
- }
- // item_db.yml function
- //---------------------
- static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
- s_item_trade_csv2yaml item = { 0 };
- int flag = atoi(str[1]);
- if (flag & 1)
- item.drop = true;
- if (flag & 2)
- item.trade = true;
- if (flag & 4)
- item.trade_partner = true;
- if (flag & 8)
- item.sell = true;
- if (flag & 16)
- item.cart = true;
- if (flag & 32)
- item.storage = true;
- if (flag & 64)
- item.guild_storage = true;
- if (flag & 128)
- item.mail = true;
- if (flag & 256)
- item.auction = true;
- item.override = atoi(str[2]);
- item_trade.insert({ strtoul(str[0], nullptr, 10), item });
- return true;
- }
- // Copied and adjusted from itemdb.cpp
- static bool itemdb_read_db(const char* file) {
- FILE* fp = fopen(file, "r");
- if (fp == nullptr) {
- ShowError("can't read %s\n", file);
- return false;
- }
- int lines = 0;
- size_t entries = 0;
- char line[1024];
- while (fgets(line, sizeof(line), fp)) {
- char* str[32], * p;
- int i;
- lines++;
- if (line[0] == '/' && line[1] == '/')
- continue;
- memset(str, 0, sizeof(str));
- p = strstr(line, "//");
- if (p != nullptr) {
- *p = '\0';
- }
- p = line;
- while (ISSPACE(*p))
- ++p;
- if (*p == '\0')
- continue;// empty line
- for (i = 0; i < 19; ++i) {
- str[i] = p;
- p = strchr(p, ',');
- if (p == NULL)
- break;// comma not found
- *p = '\0';
- ++p;
- }
- if (p == NULL) {
- ShowError("itemdb_read_db: Insufficient columns in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- // Script
- if (*p != '{') {
- ShowError("itemdb_read_db: Invalid format (Script column) in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- str[19] = p + 1;
- p = strstr(p + 1, "},");
- if (p == NULL) {
- ShowError("itemdb_read_db: Invalid format (Script column) in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- *p = '\0';
- p += 2;
- // OnEquip_Script
- if (*p != '{') {
- ShowError("itemdb_read_db: Invalid format (OnEquip_Script column) in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- str[20] = p + 1;
- p = strstr(p + 1, "},");
- if (p == NULL) {
- ShowError("itemdb_read_db: Invalid format (OnEquip_Script column) in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- *p = '\0';
- p += 2;
- // OnUnequip_Script (last column)
- if (*p != '{') {
- ShowError("itemdb_read_db: Invalid format (OnUnequip_Script column) in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- str[21] = p;
- p = &str[21][strlen(str[21]) - 2];
- if (*p != '}') {
- /* lets count to ensure it's not something silly e.g. a extra space at line ending */
- int lcurly = 0, rcurly = 0;
- for (size_t v = 0; v < strlen(str[21]); v++) {
- if (str[21][v] == '{')
- lcurly++;
- else if (str[21][v] == '}') {
- rcurly++;
- p = &str[21][v];
- }
- }
- if (lcurly != rcurly) {
- ShowError("itemdb_read_db: Mismatching curly braces in line %d (item with id %u), skipping.\n", lines, strtoul(str[0], nullptr, 10));
- continue;
- }
- }
- str[21] = str[21] + 1; //skip the first left curly
- *p = '\0'; //null the last right curly
- t_itemid nameid = strtoul(str[0], nullptr, 10);
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << nameid;
- body << YAML::Key << "AegisName" << YAML::Value << str[1];
- body << YAML::Key << "Name" << YAML::Value << str[2];
- int type = atoi(str[3]), subtype = atoi(str[18]);
- const char* constant = constant_lookup( type, "IT_" );
- if( constant == nullptr ){
- ShowError( "itemdb_read_db: Unknown item type %d for item %u, skipping.\n", type, nameid );
- continue;
- }
- body << YAML::Key << "Type" << YAML::Value << name2Upper( constant + 3 );
- if( type == IT_WEAPON && subtype ){
- constant = constant_lookup( subtype, "W_" );
- if( constant == nullptr ){
- ShowError( "itemdb_read_db: Unknown weapon type %d for item %u, skipping.\n", subtype, nameid );
- continue;
- }
- body << YAML::Key << "SubType" << YAML::Value << name2Upper( constant + 2 );
- }else if( type == IT_AMMO && subtype ){
- constant = constant_lookup( subtype, "AMMO_" );
- if( constant == nullptr ){
- ShowError( "itemdb_read_db: Unknown ammo type %d for item %u, skipping.\n", subtype, nameid );
- continue;
- }
- body << YAML::Key << "SubType" << YAML::Value << name2Upper(constant + 5);
- }
- if (atoi(str[4]) > 0)
- body << YAML::Key << "Buy" << YAML::Value << atoi(str[4]);
- if (atoi(str[5]) > 0) {
- if (atoi(str[4]) / 2 != atoi(str[5]))
- body << YAML::Key << "Sell" << YAML::Value << atoi(str[5]);
- }
- if (atoi(str[6]) > 0)
- body << YAML::Key << "Weight" << YAML::Value << atoi(str[6]);
- #ifdef RENEWAL
- int atk = 0, matk = 0;
- itemdb_re_split_atoi(str[7], &atk, &matk);
- if (atk > 0)
- body << YAML::Key << "Attack" << YAML::Value << atk;
- if (matk > 0)
- body << YAML::Key << "MagicAttack" << YAML::Value << matk;
- #else
- if (atoi(str[7]) > 0)
- body << YAML::Key << "Attack" << YAML::Value << atoi(str[7]);
- #endif
- if (atoi(str[8]) > 0)
- body << YAML::Key << "Defense" << YAML::Value << atoi(str[8]);
- if (atoi(str[9]) > 0)
- body << YAML::Key << "Range" << YAML::Value << atoi(str[9]);
- if (atoi(str[10]) > 0)
- body << YAML::Key << "Slots" << YAML::Value << atoi(str[10]);
- bool equippable = type == IT_UNKNOWN ? false : type == IT_ETC ? false : type == IT_CARD ? false : type == IT_PETEGG ? false : type == IT_PETARMOR ? false : type == IT_UNKNOWN2 ? false : true;
- if (equippable) {
- uint64 temp_mask = strtoull(str[11], NULL, 0);
- if (temp_mask == 0) {
- //body << YAML::Key << "Jobs";
- //body << YAML::BeginMap << YAML::Key << "All" << YAML::Value << "false" << YAML::EndMap;
- } else if (temp_mask == 0xFFFFFFFF) { // Commented out because it's the default value
- //body << YAML::Key << "Jobs";
- //body << YAML::BeginMap << YAML::Key << "All" << YAML::Value << "true" << YAML::EndMap;
- } else if (temp_mask == 0xFFFFFFFE) {
- body << YAML::Key << "Jobs";
- body << YAML::BeginMap;
- body << YAML::Key << "All" << YAML::Value << "true";
- body << YAML::Key << "Novice" << YAML::Value << "false";
- body << YAML::Key << "SuperNovice" << YAML::Value << "false";
- body << YAML::EndMap;
- } else {
- body << YAML::Key << "Jobs";
- body << YAML::BeginMap;
- for (const auto &it : um_mapid2jobname) {
- uint64 job_mask = 1ULL << it.second;
- if ((temp_mask & job_mask) == job_mask)
- body << YAML::Key << it.first << YAML::Value << "true";
- }
- body << YAML::EndMap;
- }
- int temp_class = atoi(str[12]);
- if (temp_class == ITEMJ_NONE) {
- body << YAML::Key << "Classes";
- body << YAML::BeginMap << YAML::Key << "All" << YAML::Value << "false" << YAML::EndMap;
- } else if (temp_class == ITEMJ_ALL) { // Commented out because it's the default value
- //body << YAML::Key << "Classes";
- //body << YAML::BeginMap << YAML::Key << "All" << YAML::Value << "true" << YAML::EndMap;
- } else {
- body << YAML::Key << "Classes";
- body << YAML::BeginMap;
- if ((ITEMJ_THIRD & temp_class) && (ITEMJ_THIRD_UPPER & temp_class) && (ITEMJ_THIRD_BABY & temp_class)) {
- temp_class &= ~ITEMJ_ALL_THIRD;
- body << YAML::Key << "All_Third" << YAML::Value << "true";
- }
- if ((ITEMJ_UPPER & temp_class) && (ITEMJ_THIRD_UPPER & temp_class)) {
- temp_class &= ~ITEMJ_ALL_UPPER;
- body << YAML::Key << "All_Upper" << YAML::Value << "true";
- }
- if ((ITEMJ_BABY & temp_class) && (ITEMJ_THIRD_BABY & temp_class)) {
- temp_class &= ~ITEMJ_ALL_BABY;
- body << YAML::Key << "All_Baby" << YAML::Value << "true";
- }
- for (int32 i = ITEMJ_NONE; i <= ITEMJ_THIRD_BABY; i++) {
- if (i & temp_class) {
- const char* class_ = constant_lookup(i, "ITEMJ_");
- if (class_ != nullptr)
- body << YAML::Key << name2Upper(class_ + 6) << YAML::Value << "true";
- }
- }
- body << YAML::EndMap;
- }
- switch (atoi(str[13])) {
- case SEX_FEMALE:
- body << YAML::Key << "Gender" << YAML::Value << "Female";
- break;
- case SEX_MALE:
- body << YAML::Key << "Gender" << YAML::Value << "Male";
- break;
- //case SEX_BOTH: // Commented out because it's the default value
- // body << YAML::Key << "Gender" << YAML::Value << "Both";
- // break;
- }
- }
- if (atoi(str[14]) > 0) {
- int temp_loc = atoi(str[14]);
- body << YAML::Key << "Locations";
- body << YAML::BeginMap;
- if ((EQP_HAND_R & temp_loc) && (EQP_HAND_L & temp_loc)) {
- temp_loc &= ~EQP_ARMS;
- body << YAML::Key << "Both_Hand" << YAML::Value << "true";
- }
- if ((EQP_ACC_R & temp_loc) && (EQP_ACC_L & temp_loc)) {
- temp_loc &= ~EQP_ACC_RL;
- body << YAML::Key << "Both_Accessory" << YAML::Value << "true";
- }
- for (const auto &it : um_equipnames) {
- if (it.second & temp_loc)
- body << YAML::Key << it.first << YAML::Value << "true";
- }
- body << YAML::EndMap;
- }
- if (atoi(str[15]) > 0)
- body << YAML::Key << "WeaponLevel" << YAML::Value << atoi(str[15]);
- int elv = 0, elvmax = 0;
- itemdb_re_split_atoi(str[16], &elv, &elvmax);
- if (elv > 0)
- body << YAML::Key << "EquipLevelMin" << YAML::Value << elv;
- if (elvmax > 0)
- body << YAML::Key << "EquipLevelMax" << YAML::Value << elvmax;
- if (atoi(str[17]) > 0)
- body << YAML::Key << "Refineable" << YAML::Value << "true";
- if (strtoul(str[18], nullptr, 10) > 0 && type != IT_WEAPON && type != IT_AMMO)
- body << YAML::Key << "View" << YAML::Value << strtoul(str[18], nullptr, 10);
- auto it_avail = item_avail.find(nameid);
- if (it_avail != item_avail.end()) {
- std::string *item_name = util::umap_find(aegis_itemnames, static_cast<t_itemid>(it_avail->second));
- if (item_name == nullptr)
- ShowError("Item name for item id %u is not known (item_avail).\n", it_avail->second);
- else
- body << YAML::Key << "AliasName" << YAML::Value << *item_name;
- }
- auto it_flag = item_flag.find(nameid);
- auto it_buying = item_buyingstore.find(nameid);
- if (it_flag != item_flag.end() || it_buying != item_buyingstore.end()) {
- body << YAML::Key << "Flags";
- body << YAML::BeginMap;
- if (it_buying != item_buyingstore.end())
- body << YAML::Key << "BuyingStore" << YAML::Value << "true";
- if (it_flag != item_flag.end() && it_flag->second.dead_branch)
- body << YAML::Key << "DeadBranch" << YAML::Value << it_flag->second.dead_branch;
- if (it_flag != item_flag.end() && it_flag->second.group)
- body << YAML::Key << "Container" << YAML::Value << it_flag->second.group;
- if (it_flag != item_flag.end() && it_flag->second.guid)
- body << YAML::Key << "UniqueId" << YAML::Value << it_flag->second.guid;
- if (it_flag != item_flag.end() && it_flag->second.bindOnEquip)
- body << YAML::Key << "BindOnEquip" << YAML::Value << it_flag->second.bindOnEquip;
- if (it_flag != item_flag.end() && it_flag->second.broadcast)
- body << YAML::Key << "DropAnnounce" << YAML::Value << it_flag->second.broadcast;
- if (it_flag != item_flag.end() && it_flag->second.delay_consume)
- body << YAML::Key << "NoConsume" << YAML::Value << it_flag->second.delay_consume;
- if (it_flag != item_flag.end() && it_flag->second.dropEffect)
- body << YAML::Key << "DropEffect" << YAML::Value << name2Upper(constant_lookup(it_flag->second.dropEffect, "DROPEFFECT_") + 11);
- body << YAML::EndMap;
- }
- auto it_delay = item_delay.find(nameid);
- if (it_delay != item_delay.end()) {
- body << YAML::Key << "Delay";
- body << YAML::BeginMap;
- body << YAML::Key << "Duration" << YAML::Value << it_delay->second.delay;
- if (it_delay->second.sc.size() > 0)
- body << YAML::Key << "Status" << YAML::Value << name2Upper(it_delay->second.sc.erase(0, 3));
- body << YAML::EndMap;
- }
- auto it_stack = item_stack.find(nameid);
- if (it_stack != item_stack.end()) {
- body << YAML::Key << "Stack";
- body << YAML::BeginMap;
- body << YAML::Key << "Amount" << YAML::Value << it_stack->second.amount;
- if (it_stack->second.inventory)
- body << YAML::Key << "Inventory" << YAML::Value << it_stack->second.inventory;
- if (it_stack->second.cart)
- body << YAML::Key << "Cart" << YAML::Value << it_stack->second.cart;
- if (it_stack->second.storage)
- body << YAML::Key << "Storage" << YAML::Value << it_stack->second.storage;
- if (it_stack->second.guild_storage)
- body << YAML::Key << "GuildStorage" << YAML::Value << it_stack->second.guild_storage;
- body << YAML::EndMap;
- }
- auto it_nouse = item_nouse.find(nameid);
- if (it_nouse != item_nouse.end()) {
- body << YAML::Key << "NoUse";
- body << YAML::BeginMap;
- body << YAML::Key << "Override" << YAML::Value << it_nouse->second.override;
- body << YAML::Key << "Sitting" << YAML::Value << "true";
- body << YAML::EndMap;
- }
- auto it_trade = item_trade.find(nameid);
- if (it_trade != item_trade.end()) {
- body << YAML::Key << "Trade";
- body << YAML::BeginMap;
- body << YAML::Key << "Override" << YAML::Value << it_trade->second.override;
- if (it_trade->second.drop)
- body << YAML::Key << "NoDrop" << YAML::Value << it_trade->second.drop;
- if (it_trade->second.trade)
- body << YAML::Key << "NoTrade" << YAML::Value << it_trade->second.trade;
- if (it_trade->second.trade_partner)
- body << YAML::Key << "TradePartner" << YAML::Value << it_trade->second.trade_partner;
- if (it_trade->second.sell)
- body << YAML::Key << "NoSell" << YAML::Value << it_trade->second.sell;
- if (it_trade->second.cart)
- body << YAML::Key << "NoCart" << YAML::Value << it_trade->second.cart;
- if (it_trade->second.storage)
- body << YAML::Key << "NoStorage" << YAML::Value << it_trade->second.storage;
- if (it_trade->second.guild_storage)
- body << YAML::Key << "NoGuildStorage" << YAML::Value << it_trade->second.guild_storage;
- if (it_trade->second.mail)
- body << YAML::Key << "NoMail" << YAML::Value << it_trade->second.mail;
- if (it_trade->second.auction)
- body << YAML::Key << "NoAuction" << YAML::Value << it_trade->second.auction;
- body << YAML::EndMap;
- }
- if (*str[19])
- body << YAML::Key << "Script" << YAML::Value << YAML::Literal << trim(str[19]);
- if (*str[20])
- body << YAML::Key << "EquipScript" << YAML::Value << YAML::Literal << trim(str[20]);
- if (*str[21])
- body << YAML::Key << "UnEquipScript" << YAML::Value << YAML::Literal << trim(str[21]);
- body << YAML::EndMap;
- entries++;
- }
- fclose(fp);
- ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' items in '" CL_WHITE "%s" CL_RESET "'.\n", entries, file);
- return true;
- }
- // Copied and adjusted from itemdb.cpp
- static bool itemdb_read_randomopt(const char* file) {
- FILE* fp = fopen( file, "r" );
- if( fp == nullptr ){
- ShowError( "Can't read %s\n", file );
- return 0;
- }
- uint32 lines = 0, count = 0;
- char line[1024];
- char path[256];
- while (fgets(line, sizeof(line), fp)) {
- char *str[2], *p;
- lines++;
- if (line[0] == '/' && line[1] == '/') // Ignore comments
- continue;
- memset(str, 0, sizeof(str));
- p = trim(line);
- if (*p == '\0')
- continue;// empty line
- if (!strchr(p, ','))
- {
- ShowError("itemdb_read_randomopt: Insufficient columns in line %d of \"%s\", skipping.\n", lines, path);
- continue;
- }
- str[0] = p;
- p = strchr(p, ',');
- *p = '\0';
- p++;
- str[1] = p;
- if (str[1][0] != '{') {
- ShowError("itemdb_read_randomopt(#1): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, path);
- continue;
- }
- /* no ending key anywhere (missing \}\) */
- if (str[1][strlen(str[1]) - 1] != '}') {
- ShowError("itemdb_read_randomopt(#2): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, path);
- continue;
- } else {
- str[0] = trim(str[0]);
- int64 id = constant_lookup_int(str[0]);
- if (id == -100) {
- ShowError("itemdb_read_randomopt: Unknown random option '%s' constant, skipping.\n", str[0]);
- continue;
- }
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << id;
- body << YAML::Key << "Option" << YAML::Value << str[0] + 7;
- body << YAML::Key << "Script" << YAML::Literal << str[1];
- body << YAML::EndMap;
- rand_opt_db.insert({ count, str[0] + 7 });
- }
- count++;
- }
- fclose(fp);
- ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", count, file);
- return true;
- }
- // Copied and adjusted from itemdb.cpp
- static bool itemdb_read_randomopt_group(char* str[], int columns, int current) {
- if ((columns - 2) % 3 != 0) {
- ShowError("itemdb_read_randomopt_group: Invalid column entries '%d'.\n", columns);
- return false;
- }
- uint16 id = static_cast<uint16>(rand_opt_group.size() + 1);
- s_random_opt_group_csv *group = util::umap_find(rand_opt_group, id);
- s_random_opt_group_csv group_entry;
- if (group == nullptr)
- group_entry.rate.push_back((uint16)strtoul(str[1], nullptr, 10));
- for (int j = 0, k = 2; k < columns && j < MAX_ITEM_RDM_OPT; k += 3) {
- int32 randid_tmp = -1;
- for (const auto &opt : rand_opt_db) {
- if (opt.second.compare(str[k]) == 0) {
- randid_tmp = opt.first;
- break;
- }
- }
- if (randid_tmp < 0) {
- ShowError("itemdb_read_randomopt_group: Invalid random group id '%s' in column %d!\n", str[k], k + 1);
- continue;
- }
- std::vector<std::shared_ptr<s_random_opt_group_entry>> entries = {};
- if (group != nullptr)
- entries = group->slots[j];
- std::shared_ptr<s_random_opt_group_entry> entry;
- entry->id = static_cast<uint16>(randid_tmp);
- entry->min_value = (int16)strtoul(str[k + 1], nullptr, 10);
- entry->max_value = 0;
- entry->param = (int8)strtoul(str[k + 2], nullptr, 10);
- entry->chance = 0;
- entries.push_back(entry);
- if (group == nullptr)
- group_entry.slots[j] = entries;
- else
- group->slots[j] = entries;
- j++;
- }
- if (group == nullptr)
- rand_opt_group.insert({ id, group_entry });
- return true;
- }
- static bool itemdb_randomopt_group_yaml(void) {
- for (const auto &it : rand_opt_group) {
- body << YAML::BeginMap;
- body << YAML::Key << "Id" << YAML::Value << it.first;
- body << YAML::Key << "Group" << YAML::Value << it.second.name;
- body << YAML::Key << "Slots";
- body << YAML::BeginSeq;
- for (size_t i = 0; i < it.second.rate.size(); i++) {
- body << YAML::BeginMap;
- body << YAML::Key << "Slot" << YAML::Value << i + 1;
- body << YAML::Key << "Options";
- body << YAML::BeginSeq;
- for (size_t j = 0; j < it.second.slots.size(); j++) {
- std::vector<std::shared_ptr<s_random_opt_group_entry>> options = it.second.slots.at(static_cast<uint16>(j));
- for (const auto &opt_it : options) {
- body << YAML::BeginMap;
- for (const auto &opt : rand_opt_db) {
- if (opt.first == opt_it->id) {
- body << YAML::Key << "Option" << YAML::Value << opt.second;
- break;
- }
- }
- if (opt_it->min_value != 0)
- body << YAML::Key << "MinValue" << YAML::Value << opt_it->min_value;
- if (opt_it->param != 0)
- body << YAML::Key << "Param" << YAML::Value << opt_it->param;
- body << YAML::Key << "Chance" << YAML::Value << it.second.rate[i];
- body << YAML::EndMap;
- }
- }
- body << YAML::EndSeq;
- body << YAML::EndMap;
- }
- body << YAML::EndSeq;
- body << YAML::EndMap;
- }
- return true;
- }
- // Initialize Random Option constants
- void init_random_option_constants() {
- #define export_constant2(a, b) script_set_constant_(a, b, a, false, false)
- export_constant2("RDMOPT_VAR_MAXHPAMOUNT", 1);
- export_constant2("RDMOPT_VAR_MAXSPAMOUNT", 2);
- export_constant2("RDMOPT_VAR_STRAMOUNT", 3);
- export_constant2("RDMOPT_VAR_AGIAMOUNT", 4);
- export_constant2("RDMOPT_VAR_VITAMOUNT", 5);
- export_constant2("RDMOPT_VAR_INTAMOUNT", 6);
- export_constant2("RDMOPT_VAR_DEXAMOUNT", 7);
- export_constant2("RDMOPT_VAR_LUKAMOUNT", 8);
- export_constant2("RDMOPT_VAR_MAXHPPERCENT", 9);
- export_constant2("RDMOPT_VAR_MAXSPPERCENT", 10);
- export_constant2("RDMOPT_VAR_HPACCELERATION", 11);
- export_constant2("RDMOPT_VAR_SPACCELERATION", 12);
- export_constant2("RDMOPT_VAR_ATKPERCENT", 13);
- export_constant2("RDMOPT_VAR_MAGICATKPERCENT", 14);
- export_constant2("RDMOPT_VAR_PLUSASPD", 15);
- export_constant2("RDMOPT_VAR_PLUSASPDPERCENT", 16);
- export_constant2("RDMOPT_VAR_ATTPOWER", 17);
- export_constant2("RDMOPT_VAR_HITSUCCESSVALUE", 18);
- export_constant2("RDMOPT_VAR_ATTMPOWER", 19);
- export_constant2("RDMOPT_VAR_ITEMDEFPOWER", 20);
- export_constant2("RDMOPT_VAR_MDEFPOWER", 21);
- export_constant2("RDMOPT_VAR_AVOIDSUCCESSVALUE", 22);
- export_constant2("RDMOPT_VAR_PLUSAVOIDSUCCESSVALUE", 23);
- export_constant2("RDMOPT_VAR_CRITICALSUCCESSVALUE", 24);
- export_constant2("RDMOPT_ATTR_TOLERACE_NOTHING", 25);
- export_constant2("RDMOPT_ATTR_TOLERACE_WATER", 26);
- export_constant2("RDMOPT_ATTR_TOLERACE_GROUND", 27);
- export_constant2("RDMOPT_ATTR_TOLERACE_FIRE", 28);
- export_constant2("RDMOPT_ATTR_TOLERACE_WIND", 29);
- export_constant2("RDMOPT_ATTR_TOLERACE_POISON", 30);
- export_constant2("RDMOPT_ATTR_TOLERACE_SAINT", 31);
- export_constant2("RDMOPT_ATTR_TOLERACE_DARKNESS", 32);
- export_constant2("RDMOPT_ATTR_TOLERACE_TELEKINESIS", 33);
- export_constant2("RDMOPT_ATTR_TOLERACE_UNDEAD", 34);
- export_constant2("RDMOPT_ATTR_TOLERACE_ALLBUTNOTHING", 35);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_NOTHING_USER", 36);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET", 37);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_WATER_USER", 38);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_WATER_TARGET", 39);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_GROUND_USER", 40);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET", 41);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_FIRE_USER", 42);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET", 43);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_WIND_USER", 44);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_WIND_TARGET", 45);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_POISON_USER", 46);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_POISON_TARGET", 47);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_SAINT_USER", 48);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET", 49);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_DARKNESS_USER", 50);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET", 51);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_USER", 52);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET", 53);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_UNDEAD_USER", 54);
- export_constant2("RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET", 55);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_NOTHING_USER", 56);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_NOTHING_TARGET", 57);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_WATER_USER", 58);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_WATER_TARGET", 59);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_GROUND_USER", 60);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_GROUND_TARGET", 61);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_FIRE_USER", 62);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_FIRE_TARGET", 63);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_WIND_USER", 64);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_WIND_TARGET", 65);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_POISON_USER", 66);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_POISON_TARGET", 67);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_SAINT_USER", 68);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_SAINT_TARGET", 69);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_DARKNESS_USER", 70);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_DARKNESS_TARGET", 71);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_TELEKINESIS_USER", 72);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_TELEKINESIS_TARGET", 73);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_UNDEAD_USER", 74);
- export_constant2("RDMOPT_MDAMAGE_PROPERTY_UNDEAD_TARGET", 75);
- export_constant2("RDMOPT_BODY_ATTR_NOTHING", 76);
- export_constant2("RDMOPT_BODY_ATTR_WATER", 77);
- export_constant2("RDMOPT_BODY_ATTR_GROUND", 78);
- export_constant2("RDMOPT_BODY_ATTR_FIRE", 79);
- export_constant2("RDMOPT_BODY_ATTR_WIND", 80);
- export_constant2("RDMOPT_BODY_ATTR_POISON", 81);
- export_constant2("RDMOPT_BODY_ATTR_SAINT", 82);
- export_constant2("RDMOPT_BODY_ATTR_DARKNESS", 83);
- export_constant2("RDMOPT_BODY_ATTR_TELEKINESIS", 84);
- export_constant2("RDMOPT_BODY_ATTR_UNDEAD", 85);
- export_constant2("RDMOPT_RACE_TOLERACE_NOTHING", 87);
- export_constant2("RDMOPT_RACE_TOLERACE_UNDEAD", 88);
- export_constant2("RDMOPT_RACE_TOLERACE_ANIMAL", 89);
- export_constant2("RDMOPT_RACE_TOLERACE_PLANT", 90);
- export_constant2("RDMOPT_RACE_TOLERACE_INSECT", 91);
- export_constant2("RDMOPT_RACE_TOLERACE_FISHS", 92);
- export_constant2("RDMOPT_RACE_TOLERACE_DEVIL", 93);
- export_constant2("RDMOPT_RACE_TOLERACE_HUMAN", 94);
- export_constant2("RDMOPT_RACE_TOLERACE_ANGEL", 95);
- export_constant2("RDMOPT_RACE_TOLERACE_DRAGON", 96);
- export_constant2("RDMOPT_RACE_DAMAGE_NOTHING", 97);
- export_constant2("RDMOPT_RACE_DAMAGE_UNDEAD", 98);
- export_constant2("RDMOPT_RACE_DAMAGE_ANIMAL", 99);
- export_constant2("RDMOPT_RACE_DAMAGE_PLANT", 100);
- export_constant2("RDMOPT_RACE_DAMAGE_INSECT", 101);
- export_constant2("RDMOPT_RACE_DAMAGE_FISHS", 102);
- export_constant2("RDMOPT_RACE_DAMAGE_DEVIL", 103);
- export_constant2("RDMOPT_RACE_DAMAGE_HUMAN", 104);
- export_constant2("RDMOPT_RACE_DAMAGE_ANGEL", 105);
- export_constant2("RDMOPT_RACE_DAMAGE_DRAGON", 106);
- export_constant2("RDMOPT_RACE_MDAMAGE_NOTHING", 107);
- export_constant2("RDMOPT_RACE_MDAMAGE_UNDEAD", 108);
- export_constant2("RDMOPT_RACE_MDAMAGE_ANIMAL", 109);
- export_constant2("RDMOPT_RACE_MDAMAGE_PLANT", 110);
- export_constant2("RDMOPT_RACE_MDAMAGE_INSECT", 111);
- export_constant2("RDMOPT_RACE_MDAMAGE_FISHS", 112);
- export_constant2("RDMOPT_RACE_MDAMAGE_DEVIL", 113);
- export_constant2("RDMOPT_RACE_MDAMAGE_HUMAN", 114);
- export_constant2("RDMOPT_RACE_MDAMAGE_ANGEL", 115);
- export_constant2("RDMOPT_RACE_MDAMAGE_DRAGON", 116);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_NOTHING", 117);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_UNDEAD", 118);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_ANIMAL", 119);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_PLANT", 120);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_INSECT", 121);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_FISHS", 122);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_DEVIL", 123);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_HUMAN", 124);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_ANGEL", 125);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_DRAGON", 126);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_NOTHING", 127);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_UNDEAD", 128);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_ANIMAL", 129);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_PLANT", 130);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_INSECT", 131);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_FISHS", 132);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_DEVIL", 133);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_HUMAN", 134);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_ANGEL", 135);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_DRAGON", 136);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_NOTHING", 137);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_UNDEAD", 138);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_ANIMAL", 139);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_PLANT", 140);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_INSECT", 141);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_FISHS", 142);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_DEVIL", 143);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_HUMAN", 144);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_ANGEL", 145);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_DRAGON", 146);
- export_constant2("RDMOPT_CLASS_DAMAGE_NORMAL_TARGET", 147);
- export_constant2("RDMOPT_CLASS_DAMAGE_BOSS_TARGET", 148);
- export_constant2("RDMOPT_CLASS_DAMAGE_NORMAL_USER", 149);
- export_constant2("RDMOPT_CLASS_DAMAGE_BOSS_USER", 150);
- export_constant2("RDMOPT_CLASS_MDAMAGE_NORMAL", 151);
- export_constant2("RDMOPT_CLASS_MDAMAGE_BOSS", 152);
- export_constant2("RDMOPT_CLASS_IGNORE_DEF_PERCENT_NORMAL", 153);
- export_constant2("RDMOPT_CLASS_IGNORE_DEF_PERCENT_BOSS", 154);
- export_constant2("RDMOPT_CLASS_IGNORE_MDEF_PERCENT_NORMAL", 155);
- export_constant2("RDMOPT_CLASS_IGNORE_MDEF_PERCENT_BOSS", 156);
- export_constant2("RDMOPT_DAMAGE_SIZE_SMALL_TARGET", 157);
- export_constant2("RDMOPT_DAMAGE_SIZE_MIDIUM_TARGET", 158);
- export_constant2("RDMOPT_DAMAGE_SIZE_LARGE_TARGET", 159);
- export_constant2("RDMOPT_DAMAGE_SIZE_SMALL_USER", 160);
- export_constant2("RDMOPT_DAMAGE_SIZE_MIDIUM_USER", 161);
- export_constant2("RDMOPT_DAMAGE_SIZE_LARGE_USER", 162);
- export_constant2("RDMOPT_DAMAGE_SIZE_PERFECT", 163);
- export_constant2("RDMOPT_DAMAGE_CRI_TARGET", 164);
- export_constant2("RDMOPT_DAMAGE_CRI_USER", 165);
- export_constant2("RDMOPT_RANGE_ATTACK_DAMAGE_TARGET", 166);
- export_constant2("RDMOPT_RANGE_ATTACK_DAMAGE_USER", 167);
- export_constant2("RDMOPT_HEAL_VALUE", 168);
- export_constant2("RDMOPT_HEAL_MODIFY_PERCENT", 169);
- export_constant2("RDMOPT_DEC_SPELL_CAST_TIME", 170);
- export_constant2("RDMOPT_DEC_SPELL_DELAY_TIME", 171);
- export_constant2("RDMOPT_DEC_SP_CONSUMPTION", 172);
- export_constant2("RDMOPT_WEAPON_ATTR_NOTHING", 175);
- export_constant2("RDMOPT_WEAPON_ATTR_WATER", 176);
- export_constant2("RDMOPT_WEAPON_ATTR_GROUND", 177);
- export_constant2("RDMOPT_WEAPON_ATTR_FIRE", 178);
- export_constant2("RDMOPT_WEAPON_ATTR_WIND", 179);
- export_constant2("RDMOPT_WEAPON_ATTR_POISON", 180);
- export_constant2("RDMOPT_WEAPON_ATTR_SAINT", 181);
- export_constant2("RDMOPT_WEAPON_ATTR_DARKNESS", 182);
- export_constant2("RDMOPT_WEAPON_ATTR_TELEKINESIS", 183);
- export_constant2("RDMOPT_WEAPON_ATTR_UNDEAD", 184);
- export_constant2("RDMOPT_WEAPON_INDESTRUCTIBLE", 185);
- export_constant2("RDMOPT_BODY_INDESTRUCTIBLE", 186);
- export_constant2("RDMOPT_MDAMAGE_SIZE_SMALL_TARGET", 187);
- export_constant2("RDMOPT_MDAMAGE_SIZE_MIDIUM_TARGET", 188);
- export_constant2("RDMOPT_MDAMAGE_SIZE_LARGE_TARGET", 189);
- export_constant2("RDMOPT_MDAMAGE_SIZE_SMALL_USER", 190);
- export_constant2("RDMOPT_MDAMAGE_SIZE_MIDIUM_USER", 191);
- export_constant2("RDMOPT_MDAMAGE_SIZE_LARGE_USER", 192);
- export_constant2("RDMOPT_ATTR_TOLERACE_ALL", 193);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_NOTHING", 194);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_UNDEAD", 195);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_ANIMAL", 196);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_PLANT", 197);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_INSECT", 198);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_FISHS", 199);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_DEVIL", 200);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_HUMAN", 201);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_ANGEL", 202);
- export_constant2("RDMOPT_RACE_WEAPON_TOLERACE_DRAGON", 203);
- export_constant2("RDMOPT_RACE_TOLERACE_PLAYER_HUMAN", 206);
- export_constant2("RDMOPT_RACE_TOLERACE_PLAYER_DORAM", 207);
- export_constant2("RDMOPT_RACE_DAMAGE_PLAYER_HUMAN", 208);
- export_constant2("RDMOPT_RACE_DAMAGE_PLAYER_DORAM", 209);
- export_constant2("RDMOPT_RACE_MDAMAGE_PLAYER_HUMAN", 210);
- export_constant2("RDMOPT_RACE_MDAMAGE_PLAYER_DORAM", 211);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_PLAYER_HUMAN", 212);
- export_constant2("RDMOPT_RACE_CRI_PERCENT_PLAYER_DORAM", 213);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_PLAYER_HUMAN", 214);
- export_constant2("RDMOPT_RACE_IGNORE_DEF_PERCENT_PLAYER_DORAM", 215);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_PLAYER_HUMAN", 216);
- export_constant2("RDMOPT_RACE_IGNORE_MDEF_PERCENT_PLAYER_DORAM", 217);
- export_constant2("RDMOPT_MELEE_ATTACK_DAMAGE_TARGET", 219);
- export_constant2("RDMOPT_MELEE_ATTACK_DAMAGE_USER", 220);
- #undef export_constant2
- }
|