Common.cs 246 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247
  1. using MySql.Data.MySqlClient;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. //using System.Drawing.Imaging;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Reflection;
  11. using System.Text.RegularExpressions;
  12. using C = ClientPackets;
  13. using S = ServerPackets;
  14. public class ExchangeConfigGroup
  15. {
  16. public string Name;
  17. public List<ExchangeConfigGroupInfo> ExchangeConfigGroupInfos = new List<ExchangeConfigGroupInfo>();
  18. public bool IsTypeGroup=false;
  19. public string GroupDescription;
  20. public override string ToString()
  21. {
  22. return Name;
  23. }
  24. }
  25. public class ExchangeConfigGroupInfo
  26. {
  27. public string Description { get; set; } = "默认";
  28. [Newtonsoft.Json.JsonIgnore]
  29. public int InputGold { get { return ItemCounts[6]; } set { ItemCounts[6] = value; } }
  30. [Newtonsoft.Json.JsonIgnore]
  31. public int InputZanzhu { get { return ItemCounts[7]; } set { ItemCounts[7] = value; } }
  32. [Newtonsoft.Json.JsonIgnore]
  33. public int InputItem1Index { get { return ItemIndexs[0]; } set { ItemIndexs[0] = value; } }
  34. [Newtonsoft.Json.JsonIgnore]
  35. public int InputItem1Count { get { return ItemCounts[0]; } set { ItemCounts[0] = value; } }
  36. [Newtonsoft.Json.JsonIgnore]
  37. public int InputItem2Index { get { return ItemIndexs[1]; } set { ItemIndexs[1] = value; } }
  38. [Newtonsoft.Json.JsonIgnore]
  39. public int InputItem2Count { get { return ItemCounts[1]; } set { ItemCounts[1] = value; } }
  40. [Newtonsoft.Json.JsonIgnore]
  41. public int InputItem3Index { get { return ItemIndexs[2]; } set { ItemIndexs[2] = value; } }
  42. [Newtonsoft.Json.JsonIgnore]
  43. public int InputItem3Count { get { return ItemCounts[2]; } set { ItemCounts[2] = value; } }
  44. [Newtonsoft.Json.JsonIgnore]
  45. public int OutputGold { get { return ItemCounts[8]; } set { ItemCounts[8] = value; } }
  46. [Newtonsoft.Json.JsonIgnore]
  47. public int OutputZanzhu { get { return ItemCounts[9]; } set { ItemCounts[9] = value; } }
  48. [Newtonsoft.Json.JsonIgnore]
  49. public int OutputItem1Index { get { return ItemIndexs[3]; } set { ItemIndexs[3] = value; } }
  50. [Newtonsoft.Json.JsonIgnore]
  51. public int OutputItem1Count { get { return ItemCounts[3]; } set { ItemCounts[3] = value; } }
  52. [Newtonsoft.Json.JsonIgnore]
  53. public int OutputItem2Index { get { return ItemIndexs[4]; } set { ItemIndexs[4] = value; } }
  54. [Newtonsoft.Json.JsonIgnore]
  55. public int OutputItem2Count { get { return ItemCounts[4]; } set { ItemCounts[4] = value; } }
  56. [Newtonsoft.Json.JsonIgnore]
  57. public int OutputItem3Index { get { return ItemIndexs[5]; } set { ItemIndexs[5] = value; } }
  58. [Newtonsoft.Json.JsonIgnore]
  59. public int OutputItem3Count { get { return ItemCounts[5]; } set { ItemCounts[5] = value; } }
  60. public List<int> ItemIndexs { get; set; }
  61. public List<int> ItemCounts { get; set; }
  62. public override string ToString()
  63. {
  64. return Description;
  65. }
  66. public bool IsAvaliable
  67. {
  68. get {
  69. return (InputGold > 0 || InputZanzhu > 0 || (InputItem1Index != -1 && InputItem1Count > 0) || (InputItem2Index != -1 && InputItem2Count > 0) || (InputItem3Index != -1 && InputItem3Count > 0))
  70. && (OutputGold > 0 || OutputZanzhu > 0 || (OutputItem1Index != -1 && OutputItem1Count > 0) || (OutputItem2Index != -1 && OutputItem2Count > 0) || (OutputItem3Index != -1 && OutputItem3Count > 0));
  71. }
  72. }
  73. }
  74. public class ExchangeConfigGroupInfoNew
  75. {
  76. public string Description { get; set; } = "默认";
  77. public int InputGold { get; set; } = 0;
  78. public int InputZanzhu { get; set; } = 0;
  79. public int InputItem1Index { get { return ItemIndexs[0]; } set{ ItemIndexs[0] = value; } }
  80. public int InputItem1Count { get { return ItemCounts[0]; } set { ItemCounts[0] = value; } }
  81. public int InputItem2Index { get { return ItemIndexs[1]; } set { ItemIndexs[1] = value; } }
  82. public int InputItem2Count { get { return ItemCounts[1]; } set { ItemCounts[1] = value; } }
  83. public int InputItem3Index { get { return ItemIndexs[2]; } set { ItemIndexs[2] = value; } }
  84. public int InputItem3Count { get { return ItemCounts[2]; } set { ItemCounts[2] = value; } }
  85. public int OutputGold { get; set; } = 0;
  86. public int OutputZanzhu { get; set; } = 0;
  87. public int OutputItem1Index { get { return ItemIndexs[3]; } set { ItemIndexs[3] = value; } }
  88. public int OutputItem1Count { get { return ItemCounts[3]; } set { ItemCounts[3] = value; } }
  89. public int OutputItem2Index { get { return ItemIndexs[4]; } set { ItemIndexs[4] = value; } }
  90. public int OutputItem2Count { get { return ItemCounts[4]; } set { ItemCounts[4] = value; } }
  91. public int OutputItem3Index { get { return ItemIndexs[5]; } set { ItemIndexs[5] = value; } }
  92. public int OutputItem3Count { get { return ItemCounts[5]; } set { ItemCounts[5] = value; } }
  93. public List<int> ItemIndexs { get; set; }
  94. public List<int> ItemCounts { get; set; }
  95. public override string ToString()
  96. {
  97. return Description;
  98. }
  99. public bool IsAvaliable
  100. {
  101. get
  102. {
  103. return (InputGold > 0 || InputZanzhu > 0 || (InputItem1Index != -1 && InputItem1Count > 0) || (InputItem2Index != -1 && InputItem2Count > 0) || (InputItem3Index != -1 && InputItem3Count > 0))
  104. && (OutputGold > 0 || OutputZanzhu > 0 || (OutputItem1Index != -1 && OutputItem1Count > 0) || (OutputItem2Index != -1 && OutputItem2Count > 0) || (OutputItem3Index != -1 && OutputItem3Count > 0));
  105. }
  106. }
  107. }
  108. public class TreasureOutput
  109. {
  110. public int ItemIndex;
  111. public uint Count;
  112. }
  113. public class GameShopItemInfo
  114. {
  115. public int ImageIndex { get; set; } = -1;
  116. public int ItemIndex { get; set; }
  117. public int ItemCount { get; set; }
  118. public int Price { get; set; }
  119. }
  120. public class GameShopGroupInfo
  121. {
  122. public string Name { get; set; }
  123. public List<GameShopItemInfo> GameShopItemInfos { get; set; }
  124. }
  125. public class AwakeInfos
  126. {
  127. public List<AwakeInfo> AwakeInfoList = new List<AwakeInfo>();
  128. public int Grade1AwakeLevel = 3;
  129. public int Grade2AwakeLevel = 4;
  130. public int Grade3AwakeLevel = 6;
  131. public int Grade4AwakeLevel = 6;
  132. }
  133. public class AwakeInfo
  134. {
  135. public AwakeType AwakeType { get; set; }
  136. public ItemType ItemType { get; set; }
  137. public List<int> LevelValues { get; set; }
  138. public override string ToString()
  139. {
  140. return AwakeType.ToString();
  141. }
  142. }
  143. public static class Scope
  144. {
  145. public readonly static Stopwatch Timer = Stopwatch.StartNew();
  146. }
  147. public enum ManagerUUID : short
  148. {
  149. MirCommand = -1,
  150. MirReturn = 1,
  151. MirConfig,
  152. SwitchPort,
  153. }
  154. public enum BlendMode : sbyte
  155. {
  156. NONE = -1,
  157. NORMAL = 0,
  158. LIGHT = 1,
  159. LIGHTINV = 2,
  160. INVNORMAL = 3,
  161. INVLIGHT = 4,
  162. INVLIGHTINV = 5,
  163. INVCOLOR = 6,
  164. INVBACKGROUND = 7
  165. }
  166. public enum DamageType : byte
  167. {
  168. Hit = 0,
  169. Miss = 1,
  170. Critical = 2,
  171. Recovery = 3,
  172. Poison = 4,
  173. Parry = 5
  174. }
  175. [Flags]
  176. public enum GMOptions : byte
  177. {
  178. None = 0,
  179. GameMaster = 0x0001,
  180. Observer = 0x0002,
  181. Superman = 0x0004
  182. }
  183. public enum AwakeType : byte
  184. {
  185. None = 0,
  186. 物防,
  187. 法防,
  188. 暴击伤害,
  189. 冰冻,
  190. 毒攻击,
  191. 准确,
  192. 伤害反弹,
  193. 增加血量,
  194. 毒物抵抗,
  195. 中毒恢复,
  196. 生命恢复,
  197. 魔法恢复,
  198. 暴击率,
  199. 魔法免疫,
  200. 幸运,
  201. 物理防御率,
  202. 魔法防御率,
  203. 无视物防,
  204. 无视魔防御,
  205. 格挡
  206. }
  207. [Flags]
  208. public enum LevelEffects : byte
  209. {
  210. None = 0,
  211. Mist = 0x0001,
  212. RedDragon = 0x0002,
  213. BlueDragon = 0x0004
  214. }
  215. public enum OutputMessageType : byte
  216. {
  217. Normal,
  218. Quest,
  219. }
  220. enum Element : byte
  221. {
  222. 火 = 0,
  223. 冰 = 1,
  224. 雷 = 2,
  225. 风 = 3,
  226. 神圣 = 4,
  227. 暗黑 = 5,
  228. 幻影 = 6,
  229. }
  230. enum Elementss : byte
  231. {
  232. 火焰 = 0,
  233. 冰寒 = 1,
  234. 雷击 = 2,
  235. 风 = 3,
  236. 神圣 = 4,
  237. 暗黑 = 5,
  238. 幻影 = 6,
  239. }
  240. public class EquipCombineConfig
  241. {
  242. public List<string> Names;
  243. public uint GoldNeed;
  244. public Dictionary<string, uint> ItemNeeds;
  245. }
  246. public enum ItemGrade : byte
  247. {
  248. None = 0,
  249. 一般 = 1,//Common
  250. 高级 = 2,//Rare
  251. 稀有 = 3,//Legendary
  252. 神器 = 4,//Mythical
  253. }
  254. public enum StatType : byte
  255. {
  256. AC = 0,
  257. MAC = 1,
  258. DC = 2,
  259. MC = 3,
  260. SC = 4,
  261. HP = 5,
  262. MP = 6,
  263. HP_Percent = 7,
  264. MP_Percent = 8,
  265. HP_Regen = 9,
  266. MP_Regen = 10,
  267. ASpeed = 11,
  268. Luck = 12,
  269. Strong = 13,
  270. Accuracy = 14,
  271. Agility = 15,
  272. MagicResist = 16,
  273. PoisonResist = 17,
  274. PoisonAttack = 18,
  275. PoisonRegen = 19,
  276. Freezing = 20,
  277. Holy = 21,
  278. Durability = 22,
  279. Unknown = 23
  280. }
  281. public enum RefinedValue : byte
  282. {
  283. None = 0,
  284. DC = 1,
  285. MC = 2,
  286. SC = 3,
  287. FireAC = 4,
  288. IceAC = 5,
  289. WindAC = 6,
  290. LightAC = 7,
  291. HolyAC = 8,
  292. DarkAC = 9,
  293. PhantomAC = 10,
  294. }
  295. public enum QuestType : byte
  296. {
  297. General = 0,
  298. Daily = 1,
  299. Repeatable = 2,
  300. Story = 3,
  301. Random = 4,
  302. Season = 5,
  303. WanShiTong=6
  304. }
  305. public enum QuestIcon : byte
  306. {
  307. None = 0,
  308. QuestionWhite = 1,
  309. ExclamationYellow = 2,
  310. QuestionYellow = 3,
  311. ExclamationBlue = 5,
  312. QuestionBlue = 6,
  313. ExclamationGreen = 7,
  314. QuestionGreen = 8
  315. }
  316. public enum QuestState : byte
  317. {
  318. Add,
  319. Update,
  320. Remove,
  321. None,
  322. }
  323. public enum DefaultNPCType : byte
  324. {
  325. Login,
  326. LevelUp,
  327. UseItem,
  328. MapCoord,
  329. MapEnter,
  330. Die,
  331. Trigger,
  332. CustomCommand,
  333. OnAcceptQuest,
  334. OnFinishQuest,
  335. Daily,
  336. TalkMonster
  337. }
  338. public enum IntelligentCreatureType : byte
  339. {
  340. None = 99,
  341. BabyPig = 0,
  342. Chick = 1,
  343. Kitten = 2,
  344. BabySkeleton = 3,
  345. Baekdon = 4,
  346. Wimaen = 5,
  347. BlackKitten = 6,
  348. BabyDragon = 7,
  349. OlympicFlame = 8,
  350. BabySnowMan = 9,
  351. Frog = 10,
  352. BabyMonkey = 11
  353. }
  354. //1 blank mob files
  355. //7 mob frames not added
  356. //2 blank frame sets (92, 173)
  357. //4 mob frames duplicate of other frame sets
  358. //TODO: add 2 missing frames in to blank frames, remove 2 duplicate frames (leaving no blanks and 2 duplicates)
  359. public enum Monster : ushort
  360. {
  361. 沙漠蜥蜴 = 0,
  362. 夜行鬼 = 1,
  363. 触角神魔 = 2,
  364. 沙鬼0 = 3,
  365. 沙漠石人 = 4,
  366. 异界之门 = 5,
  367. 轻甲守卫 = 6,
  368. 蚂蚁道士 = 7,
  369. 盔甲蚂蚁 = 8,
  370. 海神将领 = 9,
  371. 霸王守卫 = 10,
  372. 犬猴魔 = 12,
  373. 大法老 = 13,
  374. 蚂蚁战士 = 14,
  375. 劳动蚂蚁 = 16,
  376. 诺玛将士 = 17,
  377. 诺玛0 = 18,
  378. 红衣法师 = 19,
  379. 鸡 = 20,
  380. 鹿 = 21,
  381. 半兽人 = 22,
  382. 半兽战士 = 23,
  383. 半兽勇士 = 24,
  384. 毒蜘蛛 = 25,
  385. 卫士 = 26,
  386. 蛤蟆 = 27,
  387. 蝎子 = 28,
  388. 山洞蝙蝠 = 29,
  389. 森林雪人 = 30,
  390. 食人花 = 31,
  391. 骷髅 = 32,
  392. 掷斧骷髅 = 33,
  393. 骷髅战士 = 34,
  394. 骷髅战将 = 35,
  395. 骷髅精灵 = 36,
  396. 洞蛆 = 37,
  397. 多钩猫 = 38,
  398. 钉耙猫 = 39,
  399. 稻草人 = 40,
  400. 沃玛战士 = 41,
  401. 沃玛勇士 = 42,
  402. 火焰沃玛 = 43,
  403. 沃玛护卫 = 44,
  404. 沃玛教主 = 45,
  405. 暗黑战士 = 46,
  406. 粪虫 = 47,
  407. 僵尸1 = 48,
  408. 僵尸2 = 49,
  409. 僵尸3 = 50,
  410. 僵尸4 = 51,
  411. 僵尸5 = 52,
  412. 尸王 = 53,
  413. 红蛇 = 54,
  414. 练功师 = 55,
  415. 变异骷髅 = 56,
  416. 虎蛇 = 57,
  417. 羊 = 58,
  418. 猎鹰 = 59,
  419. 盔甲虫 = 60,
  420. 威思而小虫 = 62,
  421. 多角虫 = 63,
  422. 巨型多角虫 = 64,
  423. 狼 = 65,
  424. 蜈蚣 = 66,
  425. 触龙神 = 67,
  426. 黑色恶蛆 = 68,
  427. 钳虫 = 69,
  428. 邪恶钳虫 = 70,
  429. 跳跳蜂 = 71,
  430. 蝴蝶虫 = 72,
  431. 角蝇 = 73,
  432. 蝙蝠 = 74,
  433. 楔蛾 = 75,
  434. 红野猪 = 76,
  435. 黑野猪 = 77,
  436. 白野猪 = 78,
  437. 蝎蛇 = 79,
  438. 邪恶毒蛇 = 80,
  439. 大老鼠 = 81,
  440. 祖玛弓箭手 = 82,
  441. 祖玛雕像 = 83,
  442. 祖玛卫士 = 84,
  443. 祖玛教主 = 85,
  444. 弓箭手 = 86,
  445. 神兽 = 89,
  446. 神兽1 = 90,
  447. 沃玛战将 = 91,
  448. 恶形鬼 = 92,
  449. 爆毒神魔 = 93,
  450. 沙漠鱼魔 = 94,
  451. 沙漠树魔 = 95,
  452. 爆毒蚂蚁 = 96,
  453. 沙漠风魔 = 97,
  454. 驽马王 = 98,
  455. 神舰守卫 = 99,
  456. 月魔蜘蛛 = 101,
  457. 独眼蜘蛛 = 102,
  458. 天狼蜘蛛 = 103,
  459. 赤月恶魔 = 104,
  460. 爆裂蜘蛛 = 105,
  461. 幻影蜘蛛 = 106,
  462. 血巨人 = 107,
  463. 血金刚 = 108,
  464. 赤血恶魔 = 109,
  465. 灰血恶魔 = 110,
  466. 花色蜘蛛 = 111,
  467. 黑角蜘蛛1 = 112,
  468. 卫士1 = 113,
  469. 图书馆护卫 = 114,
  470. 沙漠战士 = 115,
  471. 褐色马 = 116,
  472. 白马 = 117,
  473. 黑马 = 118,
  474. 赤兔马 = 118,
  475. 猪 = 119,
  476. 霸王教主 = 120,
  477. 牛 = 121,
  478. 诺玛1 = 122,
  479. 篮球 = 123,
  480. 新人女助手 = 124,
  481. 新人男助手 = 125,
  482. 七点白蛇 = 126,
  483. 栗子树 = 127,
  484. 诺玛2 = 128,
  485. 诺玛3 = 129,
  486. 潘夜右护卫 = 130,
  487. 潘夜左护卫 = 131,
  488. 腐蚀人鬼 = 132,
  489. 潘夜冰魔 = 133,
  490. 潘夜云魔 = 134,
  491. 潘夜风魔 = 135,
  492. 潘夜火魔 = 136,
  493. 潘夜战士 = 137,
  494. 年兽 = 137,
  495. 浪子人鬼 = 138,
  496. 潘夜牛魔王 = 139,
  497. 骷髅武将 = 140,
  498. 骷髅教主 = 141,
  499. 骷髅士兵 = 142,
  500. 骷髅武士 = 143,
  501. 骷髅弓箭手 = 144,
  502. 多脚虫1 = 145,
  503. 多脚虫2 = 146,
  504. 胞眼虫1 = 147,
  505. 胞眼虫2 = 148,
  506. 蜘蛛娃 = 149,
  507. 赤黄猪王 = 150,
  508. 圣诞鹿 = 151,
  509. 怒龙神 = 152,
  510. 圣诞树 = 153,
  511. 猿猴战士 = 154,
  512. 圣诞老人 = 155,
  513. 魔神怪1 = 156,
  514. 魔神怪2 = 157,
  515. 巨象兽 = 158,
  516. 火焰狮子 = 159,
  517. 石像狮子 = 160,
  518. 武力神将 = 161,
  519. 地牢女神1 = 162,
  520. 地牢女神2 = 163,
  521. 震天魔神 = 164,
  522. 丛林战士1 = 165,
  523. 丛林战士2 = 166,
  524. 投石车 = 167,
  525. 弩车 = 169,
  526. 冰魄女神 = 170,
  527. 野猪 = 171,
  528. 寒冰守护神 = 172,
  529. 木障 = 173,
  530. 雄诺玛 = 174,
  531. 雌诺玛 = 175,
  532. 溪谷法师 = 175,
  533. 溪谷战士 = 176,
  534. 溪谷使者 = 177,
  535. 溪谷邪神 = 178,
  536. 诺玛卫士 = 179,
  537. 木栅栏8 = 179,
  538. 诺玛骑兵 = 180,
  539. 诺玛装甲兵 = 181,
  540. 诺玛抛石兵 = 183,
  541. 诺玛司令 = 184,
  542. 诺玛斧兵 = 185,
  543. 诺玛教主 = 186,
  544. 聚宝箱1 = 188,
  545. 木栅栏7 = 189,
  546. 寒冰射手 = 200,
  547. 寒冰半兽战士 = 201,
  548. 寒冰巫师 = 202,
  549. 寒冰法师 = 203,
  550. 寒冰无头骑士 = 204,
  551. 寒冰帝王 = 205,
  552. 寒冰斧兵 = 206,
  553. 寒冰狼人 = 207,
  554. 寒冰白狼 = 208,
  555. 寒冰链手 = 209,
  556. 绝情护卫 = 210,
  557. 绝情战士 = 211,
  558. 绝情红姬 = 212,
  559. 绝情绿姬 = 213,
  560. 熔岩战士 = 220,
  561. 熔岩魔龙 = 221,
  562. 熔岩祭司 = 222,
  563. 熔岩魔兵 = 223,
  564. 熔岩穿甲兵 = 224,
  565. 熔岩收割者 = 225,
  566. 熔岩魔法师 = 226,
  567. 月河变异者 = 227,
  568. 月河巫师 = 228,
  569. 月河大门 = 229,
  570. 月河野蛮人 = 230,
  571. 月河勇士 = 231,
  572. 月河死神 = 232,
  573. 月河刺客 = 233,
  574. 月河树妖 = 234,
  575. 月河门卫 = 235,
  576. 月河剑客 = 236,
  577. 圣殿左护卫 = 240,
  578. 圣殿右护卫 = 241,
  579. 圣殿左守卫 = 242,
  580. 圣殿右守卫 = 243,
  581. 圣殿左判官 = 244,
  582. 圣殿右判官 = 245,
  583. 圣殿阴魂 = 246,
  584. 圣殿阳魂 = 247,
  585. 圣兽1 = 250,
  586. 圣兽2 = 252,
  587. 圣兽3 = 253,
  588. 丛林掠夺者 = 260,
  589. 丛林魔法师 = 261,
  590. 丛林潜行者 = 262,
  591. 丛林之王 = 263,
  592. 丛林穿刺者 = 264,
  593. 丛林金罐子 = 265,
  594. 潜行男 = 266,
  595. 潜行女 = 267,
  596. 沃玛锤兵 = 268,
  597. 沙漠蜥蜴新 = 270,
  598. 沙鬼新 = 271,
  599. 诺玛将军 = 272,
  600. 蚂蚁战士新 = 273,
  601. 半兽人新 = 274,
  602. 蛤蟆新 = 275,
  603. 钉耙猫新 = 276,
  604. 蛤蟆新二 = 277,
  605. 独眼蜘蛛1 = 278,
  606. 天狼蜘蛛1 = 279,
  607. 石头人 = 280,
  608. 诺玛守卫 = 281,
  609. 诺玛祭司 = 282,
  610. 霸王幽灵 = 283,
  611. 黑衣法师 = 284,
  612. 神舰鳄鱼 = 285,
  613. 虹魔教主 = 286,
  614. 诺马小怪 = 287,
  615. 野蛮人 = 288,
  616. 绿色半兽战士 = 289,
  617. 猿猴战将 = 290,
  618. 白色森林雪人 = 291,
  619. 盘龙柱 = 292,
  620. 鸭子 = 293,
  621. 兔子 = 294,
  622. 骨头堆 = 295,
  623. 足球 = 296,
  624. 小巫师 = 297,
  625. 红巫师 = 298,
  626. 卧龙教主=300,
  627. 月河巡逻使=301,
  628. 月河督抚使=302,
  629. 变异迅猛蜥 = 311,
  630. 变异刺骨蜥 = 312,
  631. 变异丑蜥 = 313,
  632. 变异毒蜥 = 314,
  633. 变异利爪蜥 = 319,
  634. 魔石咆哮者 = 315,
  635. 魔石狂热者 = 316,
  636. 魔石守护神 = 317,
  637. 地天灭王 = 318,
  638. 冰魂弓箭手 = 320,
  639. 冰魂半兽战士 = 321,
  640. 冰魂武将0 = 322,
  641. 冰魂武将 = 323,
  642. 冰魂骑手 = 324,
  643. 冰城帝王 = 325,
  644. 冰魂武士 = 326,
  645. 狼人 = 327,
  646. 雪狼 = 328,
  647. 冰魂斧兵 = 329,
  648. 狂兽人猎手=330,
  649. 狂兽人萨满0=331,
  650. 嗜魂兽=332,
  651. 骷髅翼龙=333,
  652. 骷髅狂兽=334,
  653. 狂兽人萨满=335,
  654. 狂兽人骑兵=336,
  655. 护卫将军 =340,
  656. 黎明女王=341,
  657. 舞姬=342,
  658. 绿姬=343,
  659. 蚩尤将军=350,
  660. 赤龙魔王=351,
  661. 赤龙女王=352,
  662. 无影魔卒 = 353,
  663. 无影魔将 = 354,
  664. 阎昆将军 = 355,
  665. 阎昆魔女 = 356,
  666. 真幻鬼 = 357,
  667. 真幻魔将 = 358,
  668. 千年白虎王= 368,
  669. 霸王虎= 367,
  670. 白翼虎= 366,
  671. 黑翼虎= 365,
  672. 黑虎= 364,
  673. 冰虎= 363,
  674. 血虎= 362,
  675. 黄虎= 361,
  676. 纯虎= 360,
  677. 皇陵将军俑 =379,
  678. 皇陵护卫兵俑= 378,
  679. 皇陵戟骑兵俑= 377,
  680. 皇陵刀骑兵俑= 376,
  681. 皇陵戟兵俑= 375,
  682. 皇陵刀兵俑= 374,
  683. 石化金刚= 371,
  684. 真炎剑魔= 370,
  685. 赤岩龙= 388,
  686. 赤岩龙将军 =385,
  687. 赤岩龙战士 =384,
  688. 红爪之龙 =383,
  689. 破趾之龙 =382,
  690. 月下莲= 381,
  691. 月莲树= 380,
  692. 月河教主= 435,
  693. 堕落幻影使= 434,
  694. 堕落勾魂使 =433,
  695. 堕落禁卫= 432,
  696. 堕落勇士 =431,
  697. 堕落红毛 =426,
  698. 堕落马面 =425,
  699. 树人精灵 =424,
  700. 堕落战士 =423,
  701. 堕落鼠仙 =422,
  702. 堕落罗汉 =421,
  703. 堕落幽灵 =420,
  704. 六角魔王 =413,
  705. 银猴= 412,
  706. 雪兔= 411,
  707. 红兔=410,
  708. 沼泽石鬼 =409,
  709. 弧形鬼= 408,
  710. 灵验鬼= 407,
  711. 斩鬼 =406,
  712. 猛犸象= 405,
  713. 铁甲犀牛 =404,
  714. 黑鬃虎 =403,
  715. 白鬃虎 =402,
  716. 赤耳狼= 401,
  717. 白耳狼 =400,
  718. 幻影禁卫= 399,
  719. 混沌禁卫= 398,
  720. 灭绝禁卫= 397,
  721. 破坏禁卫= 396,
  722. 禁卫将军= 395,
  723. 蝙蝠怪2= 394,
  724. 蝙蝠怪= 393,
  725. 青岩龙= 392,
  726. 禁卫队长= 391,
  727. 禁卫战士 =390,
  728. 黑蟒= 458,
  729. 山贼运宝车队= 456,
  730. 盗贼运宝车队= 455,
  731. 暗影鬼迹= 454,
  732. 巨型鼹鼠= 453,
  733. 剧毒蝎子= 452,
  734. 沙尘暴= 451,
  735. 烈炎眼镜蛇= 450,
  736. 山贼头领= 449,
  737. 山贼= 448,
  738. 盗贼= 447,
  739. 女刺客 =446,
  740. 修道僧 =445,
  741. 泰山战狼= 444,
  742. 变卦法师= 443,
  743. 伏兵= 442,
  744. 石人怪 =441,
  745. 爆炎石人怪 =440,
  746. 沙巴克城门1 = 530,
  747. 沙巴克城门2 = 531,
  748. 沙巴克城门3 = 532,
  749. 沙巴克城门4 = 533,
  750. 木栅栏1 = 534,
  751. 木栅栏2 = 535,
  752. 木栅栏3 = 536,
  753. 木栅栏4 = 537,
  754. 诺玛城门 = 538,
  755. 白眼钳虫 = 2000,
  756. 青铜钳虫 = 2004,
  757. 沃角钳虫 = 2005,
  758. 白月黑色恶蛆 = 2030,
  759. 金刚黑色恶蛆 = 2033,
  760. 沃毒黑色恶蛆 = 2034,
  761. 洞穴蜈蚣 = 2042,
  762. 沃毒蜈蚣 = 2045,
  763. 邪恶蜈蚣61 = 2046,
  764. 我的宝宝6 = 3078,
  765. 我的宝宝2 = 3591,
  766. 我的宝宝4 = 4104,
  767. 金龙神
  768. }
  769. public enum MirAction : byte
  770. {
  771. Standing,
  772. Walking,
  773. Running,
  774. Pushed,
  775. DashL,
  776. DashR,
  777. DashFail,
  778. Stance,
  779. Stance2,
  780. Attack1,
  781. Attack2,
  782. Attack3,
  783. Attack4,
  784. Attack5,
  785. Attack6,
  786. Attack7,
  787. AttackRange1,
  788. AttackRange2,
  789. AttackRange3,
  790. Special,
  791. Struck,
  792. Harvest,
  793. Spell,
  794. Spell2,
  795. Die,
  796. Dead,
  797. Skeleton,
  798. Show,
  799. Hide,
  800. Stoned,
  801. Appear,
  802. Revive,
  803. SitDown,
  804. Mine,
  805. Sneek,
  806. DashAttack,
  807. Lunge,
  808. WalkingBow,
  809. RunningBow,
  810. Jump,
  811. MountStanding,
  812. MountWalking,
  813. MountRunning,
  814. MountStruck,
  815. MountAttack,
  816. FishingCast,
  817. FishingWait,
  818. FishingReel
  819. }
  820. public enum CellAttribute : byte
  821. {
  822. Walk = 0,
  823. HighWall = 1,
  824. LowWall = 2,
  825. }
  826. public enum LightSetting : byte
  827. {
  828. Normal = 0,
  829. Dawn = 1,
  830. Day = 2,
  831. Evening = 3,
  832. Night = 4
  833. }
  834. [Obfuscation(Feature = "renaming", Exclude = true)]
  835. public enum MirGender : byte
  836. {
  837. Male = 0,
  838. Female = 1
  839. }
  840. [Obfuscation(Feature = "renaming", Exclude = true)]
  841. public enum MirClass : byte
  842. {
  843. Warrior = 0,
  844. Wizard = 1,
  845. Taoist = 2,
  846. Assassin = 3,
  847. Archer = 4
  848. }
  849. public enum MirDirection : byte
  850. {
  851. Up = 0,
  852. UpRight = 1,
  853. Right = 2,
  854. DownRight = 3,
  855. Down = 4,
  856. DownLeft = 5,
  857. Left = 6,
  858. UpLeft = 7
  859. }
  860. public enum ObjectType : byte
  861. {
  862. None = 0,
  863. Player = 1,
  864. Item = 2,
  865. Merchant = 3,
  866. Spell = 4,
  867. Monster = 5,
  868. Deco = 6,
  869. Creature = 7
  870. }
  871. public enum ChatType : byte
  872. {
  873. Normal = 0,
  874. Shout = 1,
  875. System = 2,
  876. Hint = 3,
  877. Announcement = 4,
  878. Group = 5,
  879. WhisperIn = 6,
  880. WhisperOut = 7,
  881. Guild = 8,
  882. Trainer = 9,
  883. LevelUp = 10,
  884. System2 = 11,
  885. Relationship = 12,
  886. Mentor = 13,
  887. Shout2 = 14,
  888. Shout3 = 15,
  889. AutoBoss = 16,
  890. AutoItem = 17,
  891. ItemNoice = 18,
  892. Grade3=19,
  893. Grade4=20
  894. }
  895. public enum ItemType : byte
  896. {
  897. Nothing = 0,
  898. Weapon = 1,
  899. Armour = 2,
  900. Helmet = 4,
  901. Necklace = 5,
  902. Bracelet = 6,
  903. Ring = 7,
  904. Amulet = 8,
  905. Belt = 9,
  906. Boots = 10,
  907. Stone = 11,
  908. Torch = 12,
  909. Potion = 13,
  910. Ore = 14,
  911. Meat = 15,
  912. CraftingMaterial = 16,
  913. Scroll = 17,
  914. Gem = 18,
  915. Mount = 19,
  916. Book = 20,
  917. Script = 21,
  918. Reins = 22,
  919. Bells = 23,
  920. Saddle = 24,
  921. Ribbon = 25,
  922. Mask = 26,
  923. Food = 27,
  924. Hook = 28,
  925. Float = 29,
  926. Bait = 30,
  927. Finder = 31,
  928. Reel = 32,
  929. Fish = 33,
  930. Quest = 34,
  931. Awakening = 35,
  932. Pets = 36,
  933. Transform = 37,
  934. Recipe = 38,
  935. Treasure=39 //宝箱礼盒
  936. }
  937. public enum MirGridType : byte
  938. {
  939. None = 0,
  940. Inventory = 1,
  941. Equipment = 2,
  942. Trade = 3,
  943. Storage = 4,
  944. BuyBack = 5,
  945. DropPanel = 6,
  946. Inspect = 7,
  947. TrustMerchant = 8,
  948. GuildStorage = 9,
  949. GuestTrade = 10,
  950. Mount = 11,
  951. Fishing = 12,
  952. QuestInventory = 13,
  953. AwakenItem = 14,
  954. Mail = 15,
  955. Refine = 16,
  956. UnAwakenItem = 17,
  957. MailShow = 18,
  958. GameShop=19,
  959. Taobao=20,
  960. TrustMerchantSign=21,
  961. MACUpgrade=22
  962. }
  963. public enum EquipmentSlot : byte
  964. {
  965. Weapon = 0,
  966. Armour = 1,
  967. Helmet = 2,
  968. Torch = 3,
  969. Necklace = 4,
  970. BraceletL = 5,
  971. BraceletR = 6,
  972. RingL = 7,
  973. RingR = 8,
  974. Amulet = 9,
  975. Belt = 10,
  976. Boots = 11,
  977. Stone = 12,
  978. Mount = 13
  979. }
  980. public enum MountSlot : byte
  981. {
  982. Reins = 0,
  983. Bells = 1,
  984. Saddle = 2,
  985. Ribbon = 3,
  986. Mask = 4
  987. }
  988. public enum FishingSlot : byte
  989. {
  990. Hook = 0,
  991. Float = 1,
  992. Bait = 2,
  993. Finder = 3,
  994. Reel = 4
  995. }
  996. [Obfuscation(Feature = "renaming", Exclude = true)]
  997. public enum AttackMode : byte
  998. {
  999. Peace = 0,
  1000. Group = 1,
  1001. Guild = 2,
  1002. EnemyGuild = 3,
  1003. RedBrown = 4,
  1004. All = 5
  1005. }
  1006. [Obfuscation(Feature = "renaming", Exclude = true)]
  1007. public enum PetMode : byte
  1008. {
  1009. Both = 0,
  1010. MoveOnly = 1,
  1011. AttackOnly = 2,
  1012. None = 3,
  1013. }
  1014. [Flags]
  1015. [Obfuscation(Feature = "renaming", Exclude = true)]
  1016. public enum PoisonType : ushort
  1017. {
  1018. None = 0,
  1019. Green = 1,
  1020. Red = 2,
  1021. Curse = 3,
  1022. Slow = 4,
  1023. Frozen = 8,
  1024. Stun = 16,
  1025. Paralysis = 32,
  1026. DelayedExplosion = 64,
  1027. Bleeding = 128,
  1028. LRParalysis = 256
  1029. }
  1030. [Flags]
  1031. [Obfuscation(Feature = "renaming", Exclude = true)]
  1032. public enum BindMode : short
  1033. {
  1034. none = 0,
  1035. DontDeathdrop = 1,//0x0001
  1036. DontDrop = 2,//0x0002
  1037. DontSell = 4,//0x0004
  1038. DontStore = 8,//0x0008
  1039. DontTrade = 16,//0x0010
  1040. DontRepair = 32,//0x0020
  1041. DontUpgrade = 64,//0x0040
  1042. DestroyOnDrop = 128,//0x0080
  1043. BreakOnDeath = 256,//0x0100
  1044. BindOnEquip = 512,//0x0200
  1045. NoSRepair = 1024,//0x0400
  1046. NoWeddingRing = 2048,//0x0800
  1047. MustDrop = 4096,//0X1000
  1048. }
  1049. [Flags]
  1050. [Obfuscation(Feature = "renaming", Exclude = true)]
  1051. public enum MakeMode
  1052. {
  1053. NODamaged = 0,
  1054. Ordinary = 1,
  1055. Perfect = 2,
  1056. Luminous = 4,
  1057. }
  1058. [Flags]
  1059. [Obfuscation(Feature = "renaming", Exclude = true)]
  1060. public enum SpecialItemMode : short
  1061. {
  1062. None = 0,
  1063. Paralize = 0x0001,
  1064. Teleport = 0x0002,
  1065. Clearring = 0x0004,
  1066. Protection = 0x0008,
  1067. Revival = 0x0010,
  1068. Muscle = 0x0020,
  1069. Flame = 0x0040,
  1070. Healing = 0x0080,
  1071. Probe = 0x0100,
  1072. Skill = 0x0200,
  1073. NoDuraLoss = 0x0400,
  1074. }
  1075. [Flags]
  1076. [Obfuscation(Feature = "renaming", Exclude = true)]
  1077. public enum RequiredClass : byte
  1078. {
  1079. Warrior = 1,
  1080. Wizard = 2,
  1081. Taoist = 4,
  1082. Assassin = 8,
  1083. Archer = 16,
  1084. WarWizTao = Warrior | Wizard | Taoist,
  1085. None = WarWizTao | Assassin | Archer
  1086. }
  1087. [Flags]
  1088. [Obfuscation(Feature = "renaming", Exclude = true)]
  1089. public enum RequiredGender : byte
  1090. {
  1091. Male = 1,
  1092. Female = 2,
  1093. None = Male | Female
  1094. }
  1095. [Obfuscation(Feature = "renaming", Exclude = true)]
  1096. public enum RequiredType : byte
  1097. {
  1098. Level = 0,
  1099. AC = 1,
  1100. MAC = 2,
  1101. DC = 3,
  1102. MC = 4,
  1103. SC = 5,
  1104. }
  1105. //[Obfuscation(Feature = "renaming", Exclude = true)]
  1106. //public enum ItemSet : byte
  1107. //{
  1108. // None = 0,
  1109. // Spirit = 1,
  1110. // Recall = 2,
  1111. // RedOrchid = 3,
  1112. // RedFlower = 4,
  1113. // Smash = 5,
  1114. // HwanDevil = 6,
  1115. // Purity = 7,
  1116. // FiveString = 8,
  1117. // Mundane = 9,
  1118. // NokChi = 10,
  1119. // TaoProtect = 11,
  1120. // Mir = 12,
  1121. // Bone = 13,
  1122. // Bug = 14,
  1123. // WhiteGold = 15,
  1124. // WhiteGoldH = 16,
  1125. // RedJade = 17,
  1126. // RedJadeH = 18,
  1127. // Nephrite = 19,
  1128. // NephriteH = 20,
  1129. // Whisker1 = 21,
  1130. // Whisker2 = 22,
  1131. // Whisker3 = 23,
  1132. // Whisker4 = 24,
  1133. // Whisker5 = 25,
  1134. // Hyeolryong = 26,
  1135. // Monitor = 27,
  1136. // Oppressive = 28,
  1137. // Paeok = 29,
  1138. // Sulgwan = 30,
  1139. // 虹膜 = 31,
  1140. // 魔血 = 32,
  1141. // 金刚 = 33,
  1142. // 魔令 = 34,
  1143. // 祈祷 = 35,
  1144. // 诺玛 = 36,
  1145. // 祖玛战 = 37,
  1146. // 祖玛法 = 38,
  1147. // 祖玛道 = 39,
  1148. // 诺玛火 = 40,
  1149. // 诺玛冰 = 41,
  1150. // 诺玛风 = 42,
  1151. // 诺玛电 = 43,
  1152. // 诺玛神圣 = 44,
  1153. // 诺玛暗黑 = 45,
  1154. // 诺玛幻影 = 46,
  1155. //}
  1156. [Obfuscation(Feature = "renaming", Exclude = true)]
  1157. public enum Spell : byte
  1158. {
  1159. None = 0,
  1160. 基本剑术 = 1,//基本剑术
  1161. 攻杀剑术 = 2,//Slaying
  1162. 刺杀剑术 = 3,//Thrusting
  1163. 半月弯刀 = 4,//HalfMoon
  1164. 野蛮冲撞 = 5,//ShoulderDash
  1165. //双龙斩 = 6,//TwinDrakeBlade
  1166. 莲月剑法 = 6,//TwinDrakeBlade
  1167. 捕绳剑 = 7,//Entrapment
  1168. 烈火剑法 = 8,//FlamingSword
  1169. 狮子吼 = 9,//LionRoar
  1170. //狂风斩 = 10,//CrossHalfMoon
  1171. 十方斩 = 10,//CrossHalfMoon
  1172. 空破闪 = 11,//BladeAvalanche
  1173. //护身气幕 = 12,//ProtectionField
  1174. 铁布衫 = 12,//ProtectionField
  1175. // 剑气爆 = 13,//Rage
  1176. 破血狂杀 = 13,//Rage
  1177. 天务 = 14,//CounterAttack
  1178. 日闪 = 15,//SlashingBurst
  1179. 血龙剑法 = 16,//Fury
  1180. 金刚不坏 = 17,//ImmortalSkin
  1181. 翔空剑法 = 18, //Swordsle
  1182. 斗转星移 = 19, //PassingNight
  1183. 乾坤大挪移 = 20, //HellMoving
  1184. //Wizard
  1185. 火球术 = 31,//FireBall //OK
  1186. 抗拒火环 = 32,//Repulsion
  1187. 诱惑之光 = 33,//ElectricShock
  1188. 大火球 = 34,//GreatFireBall //OK
  1189. 地狱火 = 35,//HellFire //OK
  1190. 雷电术 = 36,//ThunderBolt
  1191. 瞬息移动 = 37,//Teleport
  1192. 爆裂火焰 = 38,//FireBang //OK
  1193. 火墙 = 39,//FireWall //OK
  1194. 疾光电影 = 40,//Lightning
  1195. 冰月神掌 = 41,//FrostCrunch
  1196. 地狱雷光 = 42,//ThunderStorm
  1197. 魔法盾 = 43,//MagicShield
  1198. 圣言术 = 44,//TurnUndead
  1199. 噬血术 = 45,//Vampirism
  1200. 冰咆哮 = 46,//IceStorm
  1201. 灭天火 = 47,//FlameDisruptor
  1202. 分身术 = 48,//Mirroring
  1203. 火龙气焰 = 49,//FlameField
  1204. 天霜冰环 = 50,//Blizzard
  1205. 凝血离魂 = 51,//MagicBooster
  1206. 天上落焰 = 52,//MeteorStrike
  1207. 冰焰术 = 53,//IceThrust
  1208. FastMove = 54,//FastMove
  1209. StormEscape = 55,//StormEscape
  1210. 焰天火雨 = 56, //FlameRain
  1211. 冰月震天 = 57, //IceMoon
  1212. 冰沙掌 = 58, //IceMpalms
  1213. 魄冰刺 = 59, //PiercSpines
  1214. 风掌 = 60, //Windpalms
  1215. 击风 = 161, //WindBlow
  1216. 风震天 = 162, //WindEarth
  1217. 龙卷风 = 163, //WindTornado
  1218. 霹雳掌 = 164, //Thunderpalms
  1219. 怒神霹雳 = 165, //ThunderClap
  1220. 移行换位 = 151,//Blink
  1221. //Taoist
  1222. 治愈术 = 61,//Healing
  1223. 精神力战法 = 62,//SpiritSword
  1224. 施毒术 = 63,//Poisoning
  1225. 灵魂火符 = 64,//SoulFireBall
  1226. 召唤骷髅 = 65,//SummonSkeleton
  1227. 隐身术 = 67,//Hiding
  1228. 集体隐身术 = 68,//MassHiding
  1229. 幽灵盾 = 69,//SoulShield
  1230. 心灵启示 = 70,//Revelation
  1231. 神圣战甲术 = 71,//BlessedArmour
  1232. 气功波 = 72,//EnergyRepulsor
  1233. 困魔咒 = 73,//TrapHexagon
  1234. 云寂术 = 74,//Purification
  1235. 群体治疗术 = 75,//MassHealing
  1236. 迷魂术 = 76,//Hallucination
  1237. 无极真气 = 77,//UltimateEnhancer
  1238. 召唤神兽 = 78,//SummonShinsu
  1239. 回生术 = 79,//Reincarnation
  1240. 超强召唤骷髅 = 80,//SummonHolyDeva
  1241. 诅咒术 = 81,//Curse
  1242. 烦恼 = 82,//Plague
  1243. 毒云 = 83,//PoisonCloud
  1244. 阴阳法环 = 84,//EnergyShield
  1245. 移花接玉 = 85,//PetEnhancer
  1246. 阴阳五行阵 = 86, //HealingCircle
  1247. 月魂断玉 = 87, //BrokenJade
  1248. 月魂灵波 = 88, //BrokenWavezx
  1249. 强魔震法 = 89,//MagicShock
  1250. 猛虎强势 = 90,//TigerStrong
  1251. 妙影无踪 = 166, //GoodShadow
  1252. 空拳刀法 = 167, //EmptyFist
  1253. //Assassin
  1254. 绝命剑法 = 91,//FatalSword
  1255. 风剑术 = 92,//DoubleSlash
  1256. 体迅风 = 93,//Haste
  1257. 拔刀术 = 94,//FlashDash
  1258. 风身术 = 95,//LightBody
  1259. 迁移剑 = 96,//HeavenlySword
  1260. 烈风击 = 97,//FireBurst
  1261. 捕缚术 = 98,//Trap
  1262. 猛毒剑气 = 99,//PoisonSword
  1263. 月影术 = 100,//MoonLight
  1264. 吸气 = 101,//MPEater
  1265. 轻身步 = 102,//SwiftFeet
  1266. 烈火身 = 103,//DarkBody
  1267. 血风击 = 104,//Hemorrhage
  1268. 月华乱舞 = 105,//CrescentSlash
  1269. MoonMist = 106,//MoonMist
  1270. //Archer
  1271. 必中闪 = 121,//Focus
  1272. 天日闪 = 122,//StraightShot
  1273. 无我闪 = 123,//DoubleShot
  1274. 爆阱 = 124,//ExplosiveTrap
  1275. 爆闪 = 125,//DelayedExplosion
  1276. 气功术 = 126,//Meditation
  1277. 风弹步 = 127,//BackStep
  1278. 万斤闪 = 128,//ElementalShot
  1279. 气流术 = 129,//Concentration
  1280. 金刚术 = 130,//Stonetrap
  1281. 元素护盾 = 131,//ElementalBarrier
  1282. 吸血地精 = 132,//SummonVampire
  1283. 吸血地闪 = 133,//VampireShot
  1284. 痹魔阱 = 134,//SummonToad
  1285. 毒魔闪 = 135,//PoisonShot
  1286. 邪爆闪 = 136,//CrippleShot
  1287. 蛇柱阱 = 137,//SummonSnakes
  1288. 血龙闪 = 138,//NapalmShot
  1289. 血龙闪秘籍 = 139,//OneWithNature
  1290. 地柱钉 = 140,//BindingShot
  1291. 精神状态 = 141,//MentalState
  1292. //Custom
  1293. 空间转移 = 152,//Portal
  1294. //
  1295. //Map Events
  1296. DigOutZombie = 200,//
  1297. Rubble = 201,//
  1298. MapLightning = 202,//
  1299. MapLava = 203,//
  1300. MapQuake1 = 204,//
  1301. MapQuake2 = 205//
  1302. }
  1303. public enum SpellEffect : byte
  1304. {
  1305. None,
  1306. FatalSword,
  1307. Teleport,
  1308. Healing,
  1309. RedMoonEvil,
  1310. TwinDrakeBlade,
  1311. MagicShieldUp,
  1312. MagicShieldDown,
  1313. GreatFoxSpirit,
  1314. Entrapment,
  1315. Reflect,
  1316. Critical,
  1317. Mine,
  1318. ElementalBarrierUp,
  1319. ElementalBarrierDown,
  1320. DelayedExplosion,
  1321. MPEater,
  1322. Hemorrhage,
  1323. Bleeding,
  1324. AwakeningSuccess,
  1325. AwakeningFail,
  1326. AwakeningMiss,
  1327. AwakeningHit,
  1328. StormEscape,
  1329. TurtleKing,
  1330. Behemoth,
  1331. Stunned,
  1332. IcePillar
  1333. }
  1334. public enum BuffType : byte
  1335. {
  1336. None = 0,
  1337. //magics
  1338. TemporalFlux,
  1339. Hiding,
  1340. GoodShadow,
  1341. Haste,
  1342. SwiftFeet,
  1343. Fury,
  1344. SoulShield,
  1345. BlessedArmour,
  1346. MagicShock,
  1347. TigerStrong,
  1348. LightBody,
  1349. UltimateEnhancer,
  1350. ProtectionField,
  1351. Rage,
  1352. WeakCurse,
  1353. Curse,
  1354. MoonLight,
  1355. DarkBody,
  1356. Concentration,
  1357. VampireShot,
  1358. PoisonShot,
  1359. CounterAttack,
  1360. MentalState,
  1361. EnergyShield,
  1362. MagicBooster,
  1363. PetEnhancer,
  1364. ImmortalSkin,
  1365. MagicShield,
  1366. //special
  1367. GameMaster = 100,
  1368. General,
  1369. Exp,
  1370. Drop,
  1371. Gold,
  1372. BagWeight,
  1373. Transform,
  1374. RelationshipEXP,
  1375. Mentee,
  1376. Mentor,
  1377. Guild,
  1378. Prison,
  1379. Rested,
  1380. GroupHp,
  1381. PowerBlessing,
  1382. Impact = 200,
  1383. Magic,
  1384. Taoist,
  1385. Storm,
  1386. HealthAid,
  1387. ManaAid,
  1388. Defence,
  1389. MagicDefence,
  1390. WonderDrug,
  1391. Knapsack,
  1392. AutoGetItem,
  1393. AutoBoss,
  1394. AutoShowItem,
  1395. PetMaster,
  1396. LuckProtector,
  1397. LadyBlessing,
  1398. NewGuildEXP,
  1399. }
  1400. public enum DefenceType : byte
  1401. {
  1402. ACAgility,
  1403. AC,
  1404. MACAgility,
  1405. MAC,
  1406. Agility,
  1407. Repulsion,
  1408. None
  1409. }
  1410. // 1-30000 客户包 30001-60000 服务包 60000-65535 通讯包
  1411. public enum ServerPacketIds : ushort
  1412. {
  1413. ClientVersion = 30001,
  1414. Disconnect,
  1415. KeepAlive,
  1416. HookSuspicionMsg,
  1417. HookSuspicionMsgFailure,
  1418. Connected,
  1419. EnterAlive,
  1420. NewAccount,
  1421. ChangePassword,
  1422. ChangePasswordBanned,
  1423. Login,
  1424. LoginAccount,
  1425. LoginBanned,
  1426. LoginSuccess,
  1427. NewCharacter,
  1428. NewCharacterSuccess,
  1429. DeleteCharacter,
  1430. DeleteCharacterSuccess,
  1431. StartGame,
  1432. StartGameBanned,
  1433. StartGameDelay,
  1434. MapInformation,
  1435. UserInformation,
  1436. UserLocation,
  1437. ObjectPlayer,
  1438. ObjectRemove,
  1439. ObjectTurn,
  1440. ObjectWalk,
  1441. ObjectRun,
  1442. Chat,
  1443. ObjectChat,
  1444. NewItemInfo,
  1445. MoveItem,
  1446. EquipItem,
  1447. MergeItem,
  1448. RemoveItem,
  1449. RemoveSlotItem,
  1450. TakeBackItem,
  1451. StoreItem,
  1452. SureBuyStorage,
  1453. StorPasswordAuthResult,
  1454. ReceiveMessageBox,
  1455. SetStoragePassword,
  1456. StorPasswordAsk,
  1457. SplitItem,
  1458. SplitItem1,
  1459. DepositRefineItem,
  1460. RetrieveRefineItem,
  1461. RefineCancel,
  1462. RefineItem,
  1463. Mir3RefineItem,
  1464. ClientHP,
  1465. Mir3AtkRefine,
  1466. FindBlackItem,
  1467. DepositTradeItem,
  1468. RetrieveTradeItem,
  1469. UseItem,
  1470. DropItem,
  1471. PlayerUpdate,
  1472. PlayerInspect,
  1473. LogOutSuccess,
  1474. LogOutFailed,
  1475. TimeOfDay,
  1476. ChangeAMode,
  1477. ChangePMode,
  1478. ObjectItem,
  1479. ObjectUseItem,
  1480. DropProtectSuccess,
  1481. ObjectGold,
  1482. GainedItem,
  1483. GainedGold,
  1484. LoseGold,
  1485. GainedCredit,
  1486. LoseCredit,
  1487. ObjectMonster,
  1488. ObjectAttack,
  1489. Struck,
  1490. ObjectStruck,
  1491. DamageIndicator,
  1492. DuraChanged,
  1493. PoisonChangaChanged,
  1494. HealthChanged,
  1495. DeleteItem,
  1496. Death,
  1497. ObjectDied,
  1498. ColorChanged,
  1499. ObjectColorChanged,
  1500. ObjectGuildNameChanged,
  1501. GainExperience,
  1502. SubExperience,
  1503. LevelChanged,
  1504. ExtraChanged,
  1505. ObjectLeveled,
  1506. ObjectWpLeveled,
  1507. ObjectShowHelmet,
  1508. ObjectHarvest,
  1509. ObjectHarvested,
  1510. ObjectNpc,
  1511. QueryMapNPCs,
  1512. QueryAllMaps,
  1513. NPCResponse,
  1514. ObjectHide,
  1515. ObjectShow,
  1516. Poisoned,
  1517. ObjectPoisoned,
  1518. MapChanged,
  1519. ObjectTeleportOut,
  1520. ObjectTeleportIn,
  1521. TeleportIn,
  1522. NPCGoods,
  1523. NPCSelectGoods,
  1524. NPCSell,
  1525. NPCRepair,
  1526. NPCSRepair,
  1527. NPCRefine,
  1528. NPCCheckRefine,
  1529. NPCCollectRefine,
  1530. NPCReplaceWedRing,
  1531. NPCStorage,
  1532. StartMACUpgrade,
  1533. ClearMACUpgrade,
  1534. MACUpgradeResult,
  1535. SellItem,
  1536. RepairItem,
  1537. ItemRepaired,
  1538. NewMagic,
  1539. RemoveMagic,
  1540. MagicLeveled,
  1541. Magic,
  1542. MagicDelay,
  1543. MagicCast,
  1544. ObjectMagic,
  1545. ObjectEffect,
  1546. RangeAttack,
  1547. Pushed,
  1548. ObjectPushed,
  1549. ObjectName,
  1550. UserStorage,
  1551. SwitchGroup,
  1552. DeleteGroup,
  1553. DeleteMember,
  1554. MemberLocation,
  1555. GroupInvite,
  1556. AddMember,
  1557. Revived,
  1558. ObjectRevived,
  1559. SpellToggle,
  1560. ObjectHealth,
  1561. MapEffect,
  1562. ObjectRangeAttack,
  1563. AddBuff,
  1564. RemoveBuff,
  1565. ObjectHidden,
  1566. ObjectSpHidden,
  1567. RefreshItem,
  1568. RefreshHair,
  1569. ObjectRefreshHair,
  1570. ObjectSpell,
  1571. UserDash,
  1572. ObjectDash,
  1573. UserDashFail,
  1574. ObjectDashFail,
  1575. NPCConsign,
  1576. NPCMarket,
  1577. ZanZhuChangeName,
  1578. AuctionGroups,
  1579. GameShopSearch,
  1580. ItemProtectStart,
  1581. ExchangeConfigSearch,
  1582. ItemAuctionSearch,
  1583. MyAuctionSearch,
  1584. // GNPCMarket,
  1585. NPCMarketPage,
  1586. ConsignItem,
  1587. MarketFail,
  1588. MarketSuccess,
  1589. ObjectSitDown,
  1590. RefreshSeasonExitTime,
  1591. InTrapRock,
  1592. BaseStatsInfo,
  1593. UserName,
  1594. ChatItemStats,
  1595. GuildNoticeChange,
  1596. GuildMemberChange,
  1597. GuildStatus,
  1598. GetAllGuild,
  1599. GetAllJoinRequest,
  1600. GuildInvite,
  1601. GuildExpGain,
  1602. GuildNameRequest,
  1603. GuildStorageGoldChange,
  1604. GuildStorageItemChange,
  1605. GuildStorageList,
  1606. GuildRequestWar,
  1607. DefaultNPC,
  1608. NPCUpdate,
  1609. MarriageRequest,
  1610. DivorceRequest,
  1611. MentorRequest,
  1612. TradeRequest,
  1613. TradeAccept,
  1614. TradeGold,
  1615. TradeItem,
  1616. TradeCost,
  1617. TradeConfirm,
  1618. TradeCancel,
  1619. MountUpdate,
  1620. EquipSlotItem,
  1621. FishingUpdate,
  1622. ChangeQuest,
  1623. CompleteQuest,
  1624. ShareQuest,
  1625. NewQuestInfo,
  1626. GainedQuestItem,
  1627. DeleteQuestItem,
  1628. CancelReincarnation,
  1629. RequestReincarnation,
  1630. UserBackStep,
  1631. ObjectBackStep,
  1632. UserDashAttack,
  1633. ObjectDashAttack,
  1634. UserAttackMove,
  1635. CombineItem,
  1636. ItemUpgraded,
  1637. SetConcentration,
  1638. SetObjectConcentration,
  1639. SetElemental,
  1640. SetObjectElemental,
  1641. RemoveDelayedExplosion,
  1642. ObjectDeco,
  1643. ObjectSneaking,
  1644. ObjectLevelEffects,
  1645. SetBindingShot,
  1646. SendOutputMessage,
  1647. NPCAwakening,
  1648. NPCDisassemble,
  1649. NPCDowngrade,
  1650. NPCReset,
  1651. AwakeningNeedMaterials,
  1652. DropProtectNeedMaterials,
  1653. AwakeningLockedItem,
  1654. Awakening,
  1655. ReceiveMail,
  1656. MailLockedItem,
  1657. MailSendRequest,
  1658. MailSent,
  1659. ParcelCollected,
  1660. MailCost,
  1661. ResizeInventory,
  1662. NewIntelligentCreature,
  1663. UpdateIntelligentCreatureList,
  1664. IntelligentCreatureEnableRename,
  1665. IntelligentCreaturePickup,
  1666. NPCPearlGoods,
  1667. TransformUpdate,
  1668. FriendUpdate,
  1669. FriendRequest,
  1670. LoverUpdate,
  1671. MentorUpdate,
  1672. GuildBuffList,
  1673. NPCRequestInput,
  1674. GameShopInfo,
  1675. GameShopStock,
  1676. Rankings,
  1677. Opendoor,
  1678. ReshRecipes,
  1679. AboutToQuest,
  1680. ServerArea,
  1681. NPCUnAwaken,
  1682. NPCDocument,
  1683. NPCUnAwakening,
  1684. UnAwakening,
  1685. OpenJyxt,
  1686. InitialItem,
  1687. MoveShield,
  1688. }
  1689. public enum ClientPacketIds : ushort
  1690. {
  1691. ClientVersion = 1,
  1692. Disconnect,
  1693. KeepAlive,
  1694. EnterAlive,
  1695. NewAccount,
  1696. ChangePassword,
  1697. Login,
  1698. LoginAccount,
  1699. NewCharacter,
  1700. DeleteCharacter,
  1701. StartGame,
  1702. LogOut,
  1703. Turn,
  1704. Walk,
  1705. Run,
  1706. Chat,
  1707. MoveItem,
  1708. StoreItem,
  1709. SendStorPassword,
  1710. SetStorPassword,
  1711. CancelPassword,
  1712. BuyStorage,
  1713. UseHorn,
  1714. TakeBackItem,
  1715. MergeItem,
  1716. EquipItem,
  1717. RemoveItem,
  1718. RemoveSlotItem,
  1719. SplitItem,
  1720. UseItem,
  1721. DropItem,
  1722. DepositRefineItem,
  1723. RetrieveRefineItem,
  1724. RefineCancel,
  1725. RefineItem,
  1726. CheckRefine,
  1727. ReplaceWedRing,
  1728. DepositTradeItem,
  1729. RetrieveTradeItem,
  1730. DropGold,
  1731. PickUp,
  1732. Inspect,
  1733. ChangeAMode,
  1734. ChangePMode,
  1735. ChangeTrade,
  1736. ChangeHelmetoff,
  1737. Attack,
  1738. RangeAttack,
  1739. Harvest,
  1740. CallNPC,
  1741. TalkMonsterNPC,
  1742. BuyItem,
  1743. GetSelectItem,
  1744. SellItem,
  1745. RepairItem,
  1746. BuyItemBack,
  1747. FindItem,
  1748. PoisonChangaChanged,
  1749. SRepairItem,
  1750. MagicKey,
  1751. Magic,
  1752. SwitchGroup,
  1753. AddMember,
  1754. DellMember,
  1755. GroupInvite,
  1756. TownRevive,
  1757. SpellToggle,
  1758. ConsignItem,
  1759. MarketSearch,
  1760. MarketSearch2,
  1761. ItemAuctionSearch,
  1762. MyAuctionSearch,
  1763. MarketGroupSearch,
  1764. GameShopSearch,
  1765. ExchangeSend,
  1766. MACUpgradeSend,
  1767. ClearMACUpgradeSend,
  1768. DropProtectUpgradeSend,
  1769. BuyGameShopItem,
  1770. MarketRefresh,
  1771. MarketPage,
  1772. MarketBuy,
  1773. MarketGetBack,
  1774. RequestUserName,
  1775. RequestChatItem,
  1776. HookQuestionRespose,
  1777. EditGuildMember,
  1778. GetAllGuild,
  1779. GetAllJoinRequest,
  1780. ResposeJoinGuild,
  1781. RequestJoinGuild,
  1782. EditGuildNotice,
  1783. GuildInvite,
  1784. GuildNameReturn,
  1785. RequestGuildInfo,
  1786. GuildStorageGoldChange,
  1787. GuildStorageItemChange,
  1788. GuildWarReturn,
  1789. MarriageRequest,
  1790. MarriageReply,
  1791. ChangeMarriage,
  1792. ChangeName,
  1793. DivorceRequest,
  1794. DivorceReply,
  1795. AddMentor,
  1796. MentorReply,
  1797. AllowMentor,
  1798. CancelMentor,
  1799. TradeRequest,
  1800. TradeReply,
  1801. TradeGold,
  1802. TradeConfirm,
  1803. TradeCancel,
  1804. EquipSlotItem,
  1805. FishingCast,
  1806. FishingChangeAutocast,
  1807. AcceptQuest,
  1808. FinishQuest,
  1809. AbandonQuest,
  1810. ShareQuest,
  1811. AcceptReincarnation,
  1812. CancelReincarnation,
  1813. CombineItem,
  1814. SetConcentration,
  1815. AwakeningNeedMaterials,
  1816. DropProtectNeedMaterials,
  1817. AwakeningLockedItem,
  1818. Awakening,
  1819. DisassembleItem,
  1820. DowngradeAwakening,
  1821. ResetAddedItem,
  1822. SendMail,
  1823. ReadMail,
  1824. CollectParcel,
  1825. DeleteMail,
  1826. LockMail,
  1827. MailLockedItem,
  1828. MailCost,
  1829. GetAllhp,
  1830. UpdateIntelligentCreature,
  1831. IntelligentCreaturePickup,
  1832. AddFriend,
  1833. AddFriendRespose,
  1834. RemoveFriend,
  1835. RefreshFriends,
  1836. AddMemo,
  1837. GuildBuffUpdate,
  1838. NPCConfirmInput,
  1839. QueryMapNPCs,
  1840. QueryAllMaps,
  1841. GameshopBuy,
  1842. ReportIssue,
  1843. GetRanking,
  1844. Opendoor,
  1845. PayMail,
  1846. RefreshRecipe,
  1847. VersionName,
  1848. UnAwakening,
  1849. InitialItem,
  1850. MoveShield,
  1851. PrepareMoveShield,
  1852. }
  1853. public enum CustomPacketIds : ushort
  1854. {
  1855. Manager = 60001,
  1856. }
  1857. public enum ConquestType : byte
  1858. {
  1859. Request = 0,
  1860. Auto = 1,
  1861. Forced = 2,
  1862. }
  1863. public enum ConquestGame : byte
  1864. {
  1865. CapturePalace = 0,
  1866. KingOfHill = 1,
  1867. Random = 2,
  1868. Classic = 3,
  1869. }
  1870. public class InIReader
  1871. {
  1872. #region Fields
  1873. private readonly List<string> _contents;
  1874. private readonly string _fileName;
  1875. #endregion
  1876. #region Constructor
  1877. public InIReader(string fileName)
  1878. {
  1879. _fileName = fileName;
  1880. _contents = new List<string>();
  1881. try
  1882. {
  1883. if (File.Exists(_fileName))
  1884. _contents.AddRange(File.ReadAllLines(_fileName));
  1885. }
  1886. catch
  1887. {
  1888. }
  1889. }
  1890. #endregion
  1891. #region Functions
  1892. private string FindValue(string section, string key)
  1893. {
  1894. for (int a = 0; a < _contents.Count; a++)
  1895. if (String.CompareOrdinal(_contents[a], "[" + section + "]") == 0)
  1896. for (int b = a + 1; b < _contents.Count; b++)
  1897. if (String.CompareOrdinal(_contents[b].Split('=')[0], key) == 0)
  1898. return _contents[b].Split('=')[1];
  1899. else if (_contents[b].StartsWith("[") && _contents[b].EndsWith("]"))
  1900. return null;
  1901. return null;
  1902. }
  1903. private int FindIndex(string section, string key)
  1904. {
  1905. for (int a = 0; a < _contents.Count; a++)
  1906. if (String.CompareOrdinal(_contents[a], "[" + section + "]") == 0)
  1907. for (int b = a + 1; b < _contents.Count; b++)
  1908. if (String.CompareOrdinal(_contents[b].Split('=')[0], key) == 0)
  1909. return b;
  1910. else if (_contents[b].StartsWith("[") && _contents[b].EndsWith("]"))
  1911. {
  1912. _contents.Insert(b - 1, key + "=");
  1913. return b - 1;
  1914. }
  1915. else if (_contents.Count - 1 == b)
  1916. {
  1917. _contents.Add(key + "=");
  1918. return _contents.Count - 1;
  1919. }
  1920. if (_contents.Count > 0)
  1921. _contents.Add("");
  1922. _contents.Add("[" + section + "]");
  1923. _contents.Add(key + "=");
  1924. return _contents.Count - 1;
  1925. }
  1926. public void Save()
  1927. {
  1928. try
  1929. {
  1930. File.WriteAllLines(_fileName, _contents);
  1931. }
  1932. catch
  1933. {
  1934. }
  1935. }
  1936. #endregion
  1937. #region Read
  1938. public bool ReadBoolean(string section, string key, bool Default)
  1939. {
  1940. bool result;
  1941. if (!bool.TryParse(FindValue(section, key), out result))
  1942. {
  1943. result = Default;
  1944. Write(section, key, Default);
  1945. }
  1946. return result;
  1947. }
  1948. public byte ReadByte(string section, string key, byte Default)
  1949. {
  1950. byte result;
  1951. if (!byte.TryParse(FindValue(section, key), out result))
  1952. {
  1953. result = Default;
  1954. Write(section, key, Default);
  1955. }
  1956. return result;
  1957. }
  1958. public sbyte ReadSByte(string section, string key, sbyte Default)
  1959. {
  1960. sbyte result;
  1961. if (!sbyte.TryParse(FindValue(section, key), out result))
  1962. {
  1963. result = Default;
  1964. Write(section, key, Default);
  1965. }
  1966. return result;
  1967. }
  1968. public ushort ReadUInt16(string section, string key, ushort Default)
  1969. {
  1970. ushort result;
  1971. if (!ushort.TryParse(FindValue(section, key), out result))
  1972. {
  1973. result = Default;
  1974. Write(section, key, Default);
  1975. }
  1976. return result;
  1977. }
  1978. public short ReadInt16(string section, string key, short Default)
  1979. {
  1980. short result;
  1981. if (!short.TryParse(FindValue(section, key), out result))
  1982. {
  1983. result = Default;
  1984. Write(section, key, Default);
  1985. }
  1986. return result;
  1987. }
  1988. public uint ReadUInt32(string section, string key, uint Default)
  1989. {
  1990. uint result;
  1991. if (!uint.TryParse(FindValue(section, key), out result))
  1992. {
  1993. result = Default;
  1994. Write(section, key, Default);
  1995. }
  1996. return result;
  1997. }
  1998. public int ReadInt32(string section, string key, int Default)
  1999. {
  2000. int result;
  2001. if (!int.TryParse(FindValue(section, key), out result))
  2002. {
  2003. result = Default;
  2004. Write(section, key, Default);
  2005. }
  2006. return result;
  2007. }
  2008. public ulong ReadUInt64(string section, string key, ulong Default)
  2009. {
  2010. ulong result;
  2011. if (!ulong.TryParse(FindValue(section, key), out result))
  2012. {
  2013. result = Default;
  2014. Write(section, key, Default);
  2015. }
  2016. return result;
  2017. }
  2018. public long ReadInt64(string section, string key, long Default)
  2019. {
  2020. long result;
  2021. if (!long.TryParse(FindValue(section, key), out result))
  2022. {
  2023. result = Default;
  2024. Write(section, key, Default);
  2025. }
  2026. return result;
  2027. }
  2028. public float ReadSingle(string section, string key, float Default)
  2029. {
  2030. float result;
  2031. if (!float.TryParse(FindValue(section, key), out result))
  2032. {
  2033. result = Default;
  2034. Write(section, key, Default);
  2035. }
  2036. return result;
  2037. }
  2038. public double ReadDouble(string section, string key, double Default)
  2039. {
  2040. double result;
  2041. if (!double.TryParse(FindValue(section, key), out result))
  2042. {
  2043. result = Default;
  2044. Write(section, key, Default);
  2045. }
  2046. return result;
  2047. }
  2048. public decimal ReadDecimal(string section, string key, decimal Default)
  2049. {
  2050. decimal result;
  2051. if (!decimal.TryParse(FindValue(section, key), out result))
  2052. {
  2053. result = Default;
  2054. Write(section, key, Default);
  2055. }
  2056. return result;
  2057. }
  2058. public string ReadString(string section, string key, string Default)
  2059. {
  2060. string result = FindValue(section, key);
  2061. if (string.IsNullOrEmpty(result))
  2062. {
  2063. result = Default;
  2064. Write(section, key, Default);
  2065. }
  2066. return result;
  2067. }
  2068. public char ReadChar(string section, string key, char Default)
  2069. {
  2070. char result;
  2071. if (!char.TryParse(FindValue(section, key), out result))
  2072. {
  2073. result = Default;
  2074. Write(section, key, Default);
  2075. }
  2076. return result;
  2077. }
  2078. public Point ReadPoint(string section, string key, Point Default)
  2079. {
  2080. string temp = FindValue(section, key);
  2081. int tempX, tempY;
  2082. if (temp == null || !int.TryParse(temp.Split(',')[0], out tempX))
  2083. {
  2084. Write(section, key, Default);
  2085. return Default;
  2086. }
  2087. if (!int.TryParse(temp.Split(',')[1], out tempY))
  2088. {
  2089. Write(section, key, Default);
  2090. return Default;
  2091. }
  2092. return new Point(tempX, tempY);
  2093. }
  2094. public Size ReadSize(string section, string key, Size Default)
  2095. {
  2096. string temp = FindValue(section, key);
  2097. int tempX, tempY;
  2098. if (!int.TryParse(temp.Split(',')[0], out tempX))
  2099. {
  2100. Write(section, key, Default);
  2101. return Default;
  2102. }
  2103. if (!int.TryParse(temp.Split(',')[1], out tempY))
  2104. {
  2105. Write(section, key, Default);
  2106. return Default;
  2107. }
  2108. return new Size(tempX, tempY);
  2109. }
  2110. public TimeSpan ReadTimeSpan(string section, string key, TimeSpan Default)
  2111. {
  2112. TimeSpan result;
  2113. if (!TimeSpan.TryParse(FindValue(section, key), out result))
  2114. {
  2115. result = Default;
  2116. Write(section, key, Default);
  2117. }
  2118. return result;
  2119. }
  2120. public float ReadFloat(string section, string key, float Default)
  2121. {
  2122. float result;
  2123. if (!float.TryParse(FindValue(section, key), out result))
  2124. {
  2125. result = Default;
  2126. Write(section, key, Default);
  2127. }
  2128. return result;
  2129. }
  2130. #endregion
  2131. #region Write
  2132. public void Write(string section, string key, bool value)
  2133. {
  2134. _contents[FindIndex(section, key)] = key + "=" + value;
  2135. Save();
  2136. }
  2137. public void Write(string section, string key, byte value)
  2138. {
  2139. _contents[FindIndex(section, key)] = key + "=" + value;
  2140. Save();
  2141. }
  2142. public void Write(string section, string key, sbyte value)
  2143. {
  2144. _contents[FindIndex(section, key)] = key + "=" + value;
  2145. Save();
  2146. }
  2147. public void Write(string section, string key, ushort value)
  2148. {
  2149. _contents[FindIndex(section, key)] = key + "=" + value;
  2150. Save();
  2151. }
  2152. public void Write(string section, string key, short value)
  2153. {
  2154. _contents[FindIndex(section, key)] = key + "=" + value;
  2155. Save();
  2156. }
  2157. public void Write(string section, string key, uint value)
  2158. {
  2159. _contents[FindIndex(section, key)] = key + "=" + value;
  2160. Save();
  2161. }
  2162. public void Write(string section, string key, int value)
  2163. {
  2164. _contents[FindIndex(section, key)] = key + "=" + value;
  2165. Save();
  2166. }
  2167. public void Write(string section, string key, ulong value)
  2168. {
  2169. _contents[FindIndex(section, key)] = key + "=" + value;
  2170. Save();
  2171. }
  2172. public void Write(string section, string key, long value)
  2173. {
  2174. _contents[FindIndex(section, key)] = key + "=" + value;
  2175. Save();
  2176. }
  2177. public void Write(string section, string key, float value)
  2178. {
  2179. _contents[FindIndex(section, key)] = key + "=" + value;
  2180. Save();
  2181. }
  2182. public void Write(string section, string key, double value)
  2183. {
  2184. _contents[FindIndex(section, key)] = key + "=" + value;
  2185. Save();
  2186. }
  2187. public void Write(string section, string key, decimal value)
  2188. {
  2189. _contents[FindIndex(section, key)] = key + "=" + value;
  2190. Save();
  2191. }
  2192. public void Write(string section, string key, string value)
  2193. {
  2194. _contents[FindIndex(section, key)] = key + "=" + value;
  2195. Save();
  2196. }
  2197. public void Write(string section, string key, char value)
  2198. {
  2199. _contents[FindIndex(section, key)] = key + "=" + value;
  2200. Save();
  2201. }
  2202. public void Write(string section, string key, Point value)
  2203. {
  2204. _contents[FindIndex(section, key)] = key + "=" + value.X + "," + value.Y;
  2205. Save();
  2206. }
  2207. public void Write(string section, string key, Size value)
  2208. {
  2209. _contents[FindIndex(section, key)] = key + "=" + value.Width + "," + value.Height;
  2210. Save();
  2211. }
  2212. public void Write(string section, string key, TimeSpan value)
  2213. {
  2214. _contents[FindIndex(section, key)] = key + "=" + value;
  2215. Save();
  2216. }
  2217. #endregion
  2218. }
  2219. public static class Globals
  2220. {
  2221. public const int
  2222. MinAccountIDLength = 3,
  2223. MaxAccountIDLength = 10,
  2224. MinPasswordLength = 5,
  2225. MaxPasswordLength = 12,
  2226. MinCharacterNameLength = 2,
  2227. MaxCharacterNameLength = 8,
  2228. MaxCharacterCount = 4,
  2229. MaxChatLength = 80,
  2230. MaxGroup = 15,
  2231. MaxAttackRange = 9,
  2232. MaxDragonLevel = 13,
  2233. FlagIndexCount = 999,
  2234. MaxConcurrentQuests = 20,
  2235. LogDelay = 0,
  2236. DataRange = 16;//Was 24
  2237. public static float Commission = 0.05F;
  2238. public const uint SearchDelay = 500,
  2239. ConsignmentLength = 7,
  2240. ConsignmentCost = 5000,
  2241. MinConsignment = 10,
  2242. MaxConsignment = 99999999;
  2243. public static ushort[,] HpLevel = {
  2244. {21,26,33,41,48,57,66,76,87,98,110,122,135,150,164,179,195,211,229,246,265,284,304,325,345,367,389,413,437,461,486,512,538,565,593,622,650,680,711,741,773,805,838,872,906,942,977,1013,1051,1090,1130,1170,1210,1250,1290,1330,1370,1410,1450,1490},
  2245. {22,25,28,31,35,38,42,46,50,55,59,63,69,73,78,84,90,95,101,108,113,120,127,134,141,148,155,164,171,179,188,196,204,213,223,231,241,251,260,270,280,290,301,311,322,333,344,356,367,379,391,403,415,427,439,451,463,475,487,499},
  2246. {19,22,25,30,34,39,44,50,55,62,68,75,83,90,98,107,116,124,134,144,154,165,176,187,199,211,223,237,250,263,277,292,306,321,337,352,369,385,402,419,437,454,473,492,510,530,550,570,591,612,633,654,675,696,717,738,759,780,801,822}
  2247. };
  2248. public static ushort[,] MpLevel = {
  2249. {17,20,24,28,32,35,40,43,47,51,55,58,63,66,70,74,78,81,86,89,94,97,101,105,109,112,117,120,124,128,132,135,140,143,147,151,155,158,163,166,171,174,178,182,186,189,194,197,201,205,209,213,217,221,225,229,234,239,244,249},
  2250. {21,28,35,44,53,63,75,87,101,116,132,148,167,185,205,225,247,270,293,319,344,371,399,428,458,489,521,553,588,622,658,695,733,772,812,853,895,938,982,1027,1073,1120,1168,1217,1267,1318,1371,1424,1478,1533,1588,1643,1698,1753,1808,1863,1918,1973,2028,2083},
  2251. {14,15,17,19,22,25,29,34,39,45,51,58,65,74,83,91,101,112,123,135,147,161,174,188,204,219,234,252,268,287,305,325,343,364,385,406,428,451,474,498,523,548,573,600,627,655,682,712,740,771,802,833,864,895,926,957,988,1019,1050,1081}
  2252. };
  2253. public static uint[] WpLevelExp ={
  2254. 60000, 60000, 60000, 90000, 90000, 90000, 90000, 120000, 120000, 120000, 120000,150000, 150000, 150000, 150000, 180000, 420000, 420000, 420000, 480000, 480000, 480000, 480000,
  2255. 540000, 540000, 540000, 540000, 600000, 600000, 600000, 600000, 660000, 660000, 660000, 660000, 720000
  2256. };
  2257. public static Color[] EIColor =
  2258. {
  2259. Color.White,
  2260. Color.FromArgb(255, 240, 180, 100),
  2261. Color.FromArgb(255, 100, 140, 190),
  2262. Color.FromArgb(255, 140, 200, 150),
  2263. Color.FromArgb(255, 50, 70, 200),
  2264. Color.FromArgb(255, 200, 200, 200),
  2265. Color.FromArgb(255, 160, 100, 180),
  2266. Color.FromArgb(255, 200, 220, 130),
  2267. };
  2268. public static string[] OrdMystery = { "神秘头盔(普通)",
  2269. "神秘战戒(普通)",
  2270. "神秘法戒(普通)",
  2271. "神秘道戒(普通)",
  2272. "神秘战镯(普通)",
  2273. "神秘法镯(普通)",
  2274. "神秘道镯(普通)",
  2275. "神秘战链(普通)",
  2276. "神秘法链(普通)",
  2277. "神秘道链(普通)"};
  2278. public static string[] SenMystery = { "神秘头盔(高级)",
  2279. "神秘战戒(高级)",
  2280. "神秘法戒(高级)",
  2281. "神秘道戒(高级)",
  2282. "神秘战镯(高级)",
  2283. "神秘法镯(高级)",
  2284. "神秘道镯(高级)",
  2285. "神秘战链(高级)",
  2286. "神秘法链(高级)",
  2287. "神秘道链(高级)"};
  2288. //保存到数据库的BUFF类型
  2289. public static BuffType[] SaveBuff = { BuffType.Drop ,
  2290. BuffType.Exp,
  2291. BuffType.General,
  2292. BuffType.Transform,
  2293. BuffType.Impact,
  2294. BuffType.Magic,
  2295. BuffType.Taoist,
  2296. BuffType.Storm,
  2297. BuffType.HealthAid,
  2298. BuffType.ManaAid,
  2299. BuffType.Defence,
  2300. BuffType.MagicDefence,
  2301. BuffType.LuckProtector,
  2302. BuffType.Rested,
  2303. BuffType.PowerBlessing,
  2304. BuffType.LadyBlessing
  2305. };
  2306. public static int[] RefinProemolecule = { 500, 100, 20, 5, 5, 3,2,2,2 };
  2307. public static int[] NotRefinIndex = { };
  2308. public static List<MagicLevelPro> Magicelevelps = LoadMagicelevelps();
  2309. public static void SaveMagicelevelps()
  2310. {
  2311. File.WriteAllText("./Configs/Magicelevelps.json", JsonConvert.SerializeObject(Magicelevelps));
  2312. }
  2313. public static List<MagicLevelPro> LoadMagicelevelps()
  2314. {
  2315. if (File.Exists("./Configs/Magicelevelps.json"))
  2316. {
  2317. var str = File.ReadAllText("./Configs/Magicelevelps.json");
  2318. return JsonConvert.DeserializeObject<List<MagicLevelPro>>(str);
  2319. }
  2320. else
  2321. {
  2322. return new List<MagicLevelPro>() ;
  2323. }
  2324. }
  2325. public static ExtraDamageItem[] DamageItems =
  2326. {
  2327. new ExtraDamageItem
  2328. {
  2329. // 黑天暗云 自然系魔法伤害加成 20%
  2330. // type; 1 物理攻击伤害加成 2 自然系魔法伤害加成 3 灵魂系魔法伤害加成 4 攻击双倍伤害 Rate 表示概率 5 灵魂系魔法伤害双倍 Rate 表示概率 6 反弹所收到的5%魔法和物理伤害回敬给对方 106 施加3级施毒术的绿毒效果
  2331. Type = 2,
  2332. ItemIndex=1018,
  2333. Rate=0.2
  2334. }, new ExtraDamageItem
  2335. {
  2336. // 九宫云雾:10%魔法躲避 有14份之一的概率灵魂系攻击双倍伤害
  2337. ItemIndex=1019,
  2338. Type=4,
  2339. Rate=1.0/14.0
  2340. }, new ExtraDamageItem
  2341. {
  2342. // 万里碧海:10%暴击几率 有14份之一的概率攻击双倍伤害
  2343. ItemIndex=1020,
  2344. Type=4,
  2345. Rate=1.0/14.0
  2346. }, new ExtraDamageItem
  2347. {
  2348. // 血花落照:反弹所收到的魔法和物理伤害回敬给对方
  2349. ItemIndex=1017,
  2350. Type=6,
  2351. Rate=0.05
  2352. }
  2353. };
  2354. public static SpecialEffectItem[] SpecialEffects =
  2355. {
  2356. new SpecialEffectItem
  2357. {
  2358. // 血花落照:15%几率给人或怪施加3级施毒术的绿毒效果
  2359. ItemIndex=1017,
  2360. Type=106,
  2361. Rate=0.15
  2362. }
  2363. };
  2364. public static string[] AmulTtpye = { "普通符",
  2365. "火符",
  2366. "冰符",
  2367. "风符",
  2368. "雷符",
  2369. "神圣",
  2370. "暗黑",
  2371. "幻影",};
  2372. }
  2373. public static class Functions
  2374. {
  2375. /// <summary>
  2376. /// 时间戳转为C#格式时间
  2377. /// </summary>
  2378. /// <param name="timeStamp">Unix时间戳格式</param>
  2379. /// <returns>C#格式时间</returns>
  2380. public static DateTime GetTime(string timeStamp)
  2381. {
  2382. DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
  2383. long lTime = long.Parse(timeStamp + "0000000");
  2384. TimeSpan toNow = new TimeSpan(lTime);
  2385. return dtStart.Add(toNow);
  2386. }
  2387. /// <summary>
  2388. /// DateTime时间格式转换为Unix时间戳格式
  2389. /// </summary>
  2390. /// <param name="time"> DateTime时间格式</param>
  2391. /// <returns>Unix时间戳格式</returns>
  2392. public static int ConvertDateTimeInt(System.DateTime time)
  2393. {
  2394. System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
  2395. return (int)(time - startTime).TotalSeconds;
  2396. }
  2397. public static bool CompareBytes(byte[] a, byte[] b)
  2398. {
  2399. if (a == b) return true;
  2400. if (a == null || b == null || a.Length != b.Length) return false;
  2401. for (int i = 0; i < a.Length; i++) if (a[i] != b[i]) return false;
  2402. return true;
  2403. }
  2404. public static bool TryParse(string s, out Point temp)
  2405. {
  2406. temp = Point.Empty;
  2407. int tempX, tempY;
  2408. if (String.IsNullOrWhiteSpace(s)) return false;
  2409. string[] data = s.Split(',');
  2410. if (data.Length <= 1) return false;
  2411. if (!Int32.TryParse(data[0], out tempX))
  2412. return false;
  2413. if (!Int32.TryParse(data[1], out tempY))
  2414. return false;
  2415. temp = new Point(tempX, tempY);
  2416. return true;
  2417. }
  2418. public static Point Subtract(this Point p1, Point p2)
  2419. {
  2420. return new Point(p1.X - p2.X, p1.Y - p2.Y);
  2421. }
  2422. public static Point Subtract(this Point p1, int x, int y)
  2423. {
  2424. return new Point(p1.X - x, p1.Y - y);
  2425. }
  2426. public static Point Add(this Point p1, Point p2)
  2427. {
  2428. return new Point(p1.X + p2.X, p1.Y + p2.Y);
  2429. }
  2430. public static Point Add(this Point p1, int x, int y)
  2431. {
  2432. return new Point(p1.X + x, p1.Y + y);
  2433. }
  2434. public static string PointToString(Point p)
  2435. {
  2436. return String.Format("{0}, {1}", p.X, p.Y);
  2437. }
  2438. public static bool InRange(Point a, Point b, int i)
  2439. {
  2440. return Math.Abs(a.X - b.X) <= i && Math.Abs(a.Y - b.Y) <= i;
  2441. }
  2442. public static bool FacingEachOther(MirDirection dirA, Point pointA, MirDirection dirB, Point pointB)
  2443. {
  2444. if (dirA == DirectionFromPoint(pointA, pointB) && dirB == DirectionFromPoint(pointB, pointA))
  2445. {
  2446. return true;
  2447. }
  2448. return false;
  2449. }
  2450. public static string PrintTimeSpanFromSeconds(double secs, bool accurate = true)
  2451. {
  2452. TimeSpan t = TimeSpan.FromSeconds(secs);
  2453. string answer;
  2454. if (t.TotalMinutes < 1.0)
  2455. {
  2456. answer = string.Format("{0}s", t.Seconds);
  2457. }
  2458. else if (t.TotalHours < 1.0)
  2459. {
  2460. answer = accurate ? string.Format("{0}m {1:D2}s", t.Minutes, t.Seconds) : string.Format("{0}m", t.Minutes);
  2461. }
  2462. else if (t.TotalDays < 1.0)
  2463. {
  2464. answer = accurate ? string.Format("{0}h {1:D2}m {2:D2}s", (int)t.Hours, t.Minutes, t.Seconds) : string.Format("{0}h {1:D2}m", (int)t.TotalHours, t.Minutes);
  2465. }
  2466. else // more than 1 day
  2467. {
  2468. answer = accurate ? string.Format("{0}d {1:D2}h {2:D2}m {3:D2}s", (int)t.Days, (int)t.Hours, t.Minutes, t.Seconds) : string.Format("{0}d {1}h {2:D2}m", (int)t.TotalDays, (int)t.Hours, t.Minutes);
  2469. }
  2470. return answer;
  2471. }
  2472. public static string PrintTimeSpanFromMilliSeconds(double milliSeconds)
  2473. {
  2474. TimeSpan t = TimeSpan.FromMilliseconds(milliSeconds);
  2475. string answer;
  2476. if (t.TotalMinutes < 1.0)
  2477. {
  2478. answer = string.Format("{0}.{1}s", t.Seconds, (decimal)(t.Milliseconds / 100));
  2479. }
  2480. else if (t.TotalHours < 1.0)
  2481. {
  2482. answer = string.Format("{0}m {1:D2}s", t.TotalMinutes, t.Seconds);
  2483. }
  2484. else if (t.TotalDays < 1.0)
  2485. {
  2486. answer = string.Format("{0}h {1:D2}m {2:D2}s", (int)t.TotalHours, t.Minutes, t.Seconds);
  2487. }
  2488. else
  2489. {
  2490. answer = string.Format("{0}d {1}h {2:D2}m {3:D2}s", (int)t.Days, (int)t.Hours, t.Minutes, t.Seconds);
  2491. }
  2492. return answer;
  2493. }
  2494. public static MirDirection PreviousDir(MirDirection d)
  2495. {
  2496. switch (d)
  2497. {
  2498. case MirDirection.Up:
  2499. return MirDirection.UpLeft;
  2500. case MirDirection.UpRight:
  2501. return MirDirection.Up;
  2502. case MirDirection.Right:
  2503. return MirDirection.UpRight;
  2504. case MirDirection.DownRight:
  2505. return MirDirection.Right;
  2506. case MirDirection.Down:
  2507. return MirDirection.DownRight;
  2508. case MirDirection.DownLeft:
  2509. return MirDirection.Down;
  2510. case MirDirection.Left:
  2511. return MirDirection.DownLeft;
  2512. case MirDirection.UpLeft:
  2513. return MirDirection.Left;
  2514. default: return d;
  2515. }
  2516. }
  2517. public static MirDirection NextDir(MirDirection d)
  2518. {
  2519. switch (d)
  2520. {
  2521. case MirDirection.Up:
  2522. return MirDirection.UpRight;
  2523. case MirDirection.UpRight:
  2524. return MirDirection.Right;
  2525. case MirDirection.Right:
  2526. return MirDirection.DownRight;
  2527. case MirDirection.DownRight:
  2528. return MirDirection.Down;
  2529. case MirDirection.Down:
  2530. return MirDirection.DownLeft;
  2531. case MirDirection.DownLeft:
  2532. return MirDirection.Left;
  2533. case MirDirection.Left:
  2534. return MirDirection.UpLeft;
  2535. case MirDirection.UpLeft:
  2536. return MirDirection.Up;
  2537. default: return d;
  2538. }
  2539. }
  2540. public static MirDirection DirectionFromPoint(Point source, Point dest)
  2541. {
  2542. if (source.X < dest.X)
  2543. {
  2544. if (source.Y < dest.Y)
  2545. return MirDirection.DownRight;
  2546. if (source.Y > dest.Y)
  2547. return MirDirection.UpRight;
  2548. return MirDirection.Right;
  2549. }
  2550. if (source.X > dest.X)
  2551. {
  2552. if (source.Y < dest.Y)
  2553. return MirDirection.DownLeft;
  2554. if (source.Y > dest.Y)
  2555. return MirDirection.UpLeft;
  2556. return MirDirection.Left;
  2557. }
  2558. return source.Y < dest.Y ? MirDirection.Down : MirDirection.Up;
  2559. }
  2560. public static Size Add(this Size p1, Size p2)
  2561. {
  2562. return new Size(p1.Width + p2.Width, p1.Height + p2.Height);
  2563. }
  2564. public static Size Add(this Size p1, int width, int height)
  2565. {
  2566. return new Size(p1.Width + width, p1.Height + height);
  2567. }
  2568. public static Point PointMove(Point p, MirDirection d, int i)
  2569. {
  2570. switch (d)
  2571. {
  2572. case MirDirection.Up:
  2573. p.Offset(0, -i);
  2574. break;
  2575. case MirDirection.UpRight:
  2576. p.Offset(i, -i);
  2577. break;
  2578. case MirDirection.Right:
  2579. p.Offset(i, 0);
  2580. break;
  2581. case MirDirection.DownRight:
  2582. p.Offset(i, i);
  2583. break;
  2584. case MirDirection.Down:
  2585. p.Offset(0, i);
  2586. break;
  2587. case MirDirection.DownLeft:
  2588. p.Offset(-i, i);
  2589. break;
  2590. case MirDirection.Left:
  2591. p.Offset(-i, 0);
  2592. break;
  2593. case MirDirection.UpLeft:
  2594. p.Offset(-i, -i);
  2595. break;
  2596. }
  2597. return p;
  2598. }
  2599. public static Point Left(Point p, MirDirection d)
  2600. {
  2601. switch (d)
  2602. {
  2603. case MirDirection.Up:
  2604. p.Offset(-1, 0);
  2605. break;
  2606. case MirDirection.UpRight:
  2607. p.Offset(-1, -1);
  2608. break;
  2609. case MirDirection.Right:
  2610. p.Offset(0, -1);
  2611. break;
  2612. case MirDirection.DownRight:
  2613. p.Offset(1, -1);
  2614. break;
  2615. case MirDirection.Down:
  2616. p.Offset(1, 0);
  2617. break;
  2618. case MirDirection.DownLeft:
  2619. p.Offset(1, 1);
  2620. break;
  2621. case MirDirection.Left:
  2622. p.Offset(0, 1);
  2623. break;
  2624. case MirDirection.UpLeft:
  2625. p.Offset(-1, 1);
  2626. break;
  2627. }
  2628. return p;
  2629. }
  2630. public static Point Right(Point p, MirDirection d)
  2631. {
  2632. switch (d)
  2633. {
  2634. case MirDirection.Up:
  2635. p.Offset(1, 0);
  2636. break;
  2637. case MirDirection.UpRight:
  2638. p.Offset(1, 1);
  2639. break;
  2640. case MirDirection.Right:
  2641. p.Offset(0, 1);
  2642. break;
  2643. case MirDirection.DownRight:
  2644. p.Offset(-1, 1);
  2645. break;
  2646. case MirDirection.Down:
  2647. p.Offset(-1, 0);
  2648. break;
  2649. case MirDirection.DownLeft:
  2650. p.Offset(-1, -1);
  2651. break;
  2652. case MirDirection.Left:
  2653. p.Offset(0, -1);
  2654. break;
  2655. case MirDirection.UpLeft:
  2656. p.Offset(1, -1);
  2657. break;
  2658. }
  2659. return p;
  2660. }
  2661. public static MirDirection leftDirection(MirDirection d)
  2662. {
  2663. switch (d)
  2664. {
  2665. case MirDirection.Up:
  2666. d = MirDirection.UpLeft;
  2667. break;
  2668. case MirDirection.UpRight:
  2669. d = MirDirection.Up;
  2670. break;
  2671. case MirDirection.Right:
  2672. d = MirDirection.UpRight;
  2673. break;
  2674. case MirDirection.DownRight:
  2675. d = MirDirection.Right;
  2676. break;
  2677. case MirDirection.Down:
  2678. d = MirDirection.DownRight;
  2679. break;
  2680. case MirDirection.DownLeft:
  2681. d = MirDirection.Down;
  2682. break;
  2683. case MirDirection.Left:
  2684. d = MirDirection.DownLeft;
  2685. break;
  2686. case MirDirection.UpLeft:
  2687. d = MirDirection.Left;
  2688. break;
  2689. }
  2690. return d;
  2691. }
  2692. public static string ToArrow1(this MirDirection dir)
  2693. {
  2694. switch (dir)
  2695. {
  2696. case MirDirection.Up:
  2697. return "↑";
  2698. case MirDirection.UpRight:
  2699. return "↗";
  2700. case MirDirection.Right:
  2701. return "→";
  2702. case MirDirection.DownRight:
  2703. return "↘";
  2704. case MirDirection.Down:
  2705. return "↓";
  2706. case MirDirection.DownLeft:
  2707. return "↙";
  2708. case MirDirection.Left:
  2709. return "←";
  2710. case MirDirection.UpLeft:
  2711. return "↖";
  2712. default:
  2713. return "㊥";
  2714. }
  2715. }
  2716. public static string ToArrow(this MirDirection dir)
  2717. {
  2718. switch (dir)
  2719. {
  2720. case MirDirection.Up:
  2721. return "正上↑";
  2722. case MirDirection.UpRight:
  2723. return "左上↗";
  2724. case MirDirection.Right:
  2725. return "正右→";
  2726. case MirDirection.DownRight:
  2727. return "左下↘";
  2728. case MirDirection.Down:
  2729. return "正下↓";
  2730. case MirDirection.DownLeft:
  2731. return "左下↙";
  2732. case MirDirection.Left:
  2733. return "正左←";
  2734. case MirDirection.UpLeft:
  2735. return "左上↖";
  2736. default:
  2737. return "正中㊥";
  2738. }
  2739. }
  2740. public static MirDirection GetGlobalDirection(Point source, Point target)
  2741. {
  2742. var offset=source.Subtract(target);
  2743. if (target.X>0)
  2744. {
  2745. if (target.Y>0)
  2746. {
  2747. return MirDirection.UpLeft;
  2748. }
  2749. else if (target.Y<0)
  2750. {
  2751. return MirDirection.DownLeft;
  2752. }
  2753. else
  2754. {
  2755. return MirDirection.Left;
  2756. }
  2757. }
  2758. else if (target.X < 0)
  2759. {
  2760. if (target.Y > 0)
  2761. {
  2762. return MirDirection.UpRight;
  2763. }
  2764. else if (target.Y < 0)
  2765. {
  2766. return MirDirection.DownRight;
  2767. }
  2768. else
  2769. {
  2770. return MirDirection.Right;
  2771. }
  2772. }
  2773. else
  2774. {
  2775. if (target.Y > 0)
  2776. {
  2777. return MirDirection.Up;
  2778. }
  2779. else
  2780. {
  2781. return MirDirection.Down;
  2782. }
  2783. }
  2784. }
  2785. public static MirDirection rightDirection(MirDirection d) //找到方向的朝右边上方方向
  2786. {
  2787. switch (d)
  2788. {
  2789. case MirDirection.Up:
  2790. d = MirDirection.UpRight;
  2791. break;
  2792. case MirDirection.UpRight:
  2793. d = MirDirection.Right;
  2794. break;
  2795. case MirDirection.Right:
  2796. d = MirDirection.DownRight;
  2797. break;
  2798. case MirDirection.DownRight:
  2799. d = MirDirection.Down;
  2800. break;
  2801. case MirDirection.Down:
  2802. d = MirDirection.DownLeft;
  2803. break;
  2804. case MirDirection.DownLeft:
  2805. d = MirDirection.Left;
  2806. break;
  2807. case MirDirection.Left:
  2808. d = MirDirection.UpLeft;
  2809. break;
  2810. case MirDirection.UpLeft:
  2811. d = MirDirection.Up;
  2812. break;
  2813. }
  2814. return d;
  2815. }
  2816. public static MirDirection rightRowDirection(MirDirection d)
  2817. {
  2818. switch (d)
  2819. {
  2820. case MirDirection.Up:
  2821. d = MirDirection.Right;
  2822. break;
  2823. case MirDirection.UpRight:
  2824. d = MirDirection.DownRight;
  2825. break;
  2826. case MirDirection.Right:
  2827. d = MirDirection.Down;
  2828. break;
  2829. case MirDirection.DownRight:
  2830. d = MirDirection.DownLeft;
  2831. break;
  2832. case MirDirection.Down:
  2833. d = MirDirection.Left;
  2834. break;
  2835. case MirDirection.DownLeft:
  2836. d = MirDirection.UpLeft;
  2837. break;
  2838. case MirDirection.Left:
  2839. d = MirDirection.Up;
  2840. break;
  2841. case MirDirection.UpLeft:
  2842. d = MirDirection.UpRight;
  2843. break;
  2844. }
  2845. return d;
  2846. }
  2847. public static MirDirection leftRowDirection(MirDirection d)
  2848. {
  2849. switch (d)
  2850. {
  2851. case MirDirection.Up:
  2852. d = MirDirection.Left;
  2853. break;
  2854. case MirDirection.UpRight:
  2855. d = MirDirection.UpLeft;
  2856. break;
  2857. case MirDirection.Right:
  2858. d = MirDirection.Up;
  2859. break;
  2860. case MirDirection.DownRight:
  2861. d = MirDirection.UpRight;
  2862. break;
  2863. case MirDirection.Down:
  2864. d = MirDirection.Right;
  2865. break;
  2866. case MirDirection.DownLeft:
  2867. d = MirDirection.DownRight;
  2868. break;
  2869. case MirDirection.Left:
  2870. d = MirDirection.Down;
  2871. break;
  2872. case MirDirection.UpLeft:
  2873. d = MirDirection.DownLeft;
  2874. break;
  2875. }
  2876. return d;
  2877. }
  2878. public static int MaxDistance(Point p1, Point p2)
  2879. {
  2880. return Math.Max(Math.Abs(p1.X - p2.X), Math.Abs(p1.Y - p2.Y));
  2881. }
  2882. public static MirDirection ReverseDirection(MirDirection dir)
  2883. {
  2884. switch (dir)
  2885. {
  2886. case MirDirection.Up:
  2887. return MirDirection.Down;
  2888. case MirDirection.UpRight:
  2889. return MirDirection.DownLeft;
  2890. case MirDirection.Right:
  2891. return MirDirection.Left;
  2892. case MirDirection.DownRight:
  2893. return MirDirection.UpLeft;
  2894. case MirDirection.Down:
  2895. return MirDirection.Up;
  2896. case MirDirection.DownLeft:
  2897. return MirDirection.UpRight;
  2898. case MirDirection.Left:
  2899. return MirDirection.Right;
  2900. case MirDirection.UpLeft:
  2901. return MirDirection.DownRight;
  2902. default:
  2903. return dir;
  2904. }
  2905. }
  2906. public static ItemInfo GetRealItem(ItemInfo Origin, ushort Level, MirClass job, List<ItemInfo> ItemList)
  2907. {
  2908. if (Origin.ClassBased && Origin.LevelBased)
  2909. return GetClassAndLevelBasedItem(Origin, job, Level, ItemList);
  2910. if (Origin.ClassBased)
  2911. return GetClassBasedItem(Origin, job, ItemList);
  2912. if (Origin.LevelBased)
  2913. return GetLevelBasedItem(Origin, Level, ItemList);
  2914. return Origin;
  2915. }
  2916. public static ItemInfo GetLevelBasedItem(ItemInfo Origin, ushort level, List<ItemInfo> ItemList)
  2917. {
  2918. ItemInfo output = Origin;
  2919. for (int i = 0; i < ItemList.Count; i++)
  2920. {
  2921. ItemInfo info = ItemList[i];
  2922. if (info.Name.StartsWith(Origin.Name))
  2923. if ((info.RequiredType == RequiredType.Level) && (info.RequiredAmount <= level) && (output.RequiredAmount < info.RequiredAmount) && (Origin.RequiredGender == info.RequiredGender))
  2924. output = info;
  2925. }
  2926. return output;
  2927. }
  2928. public static ItemInfo GetClassBasedItem(ItemInfo Origin, MirClass job, List<ItemInfo> ItemList)
  2929. {
  2930. for (int i = 0; i < ItemList.Count; i++)
  2931. {
  2932. ItemInfo info = ItemList[i];
  2933. if (info.Name.StartsWith(Origin.Name))
  2934. if (((byte)info.RequiredClass == (1 << (byte)job)) && (Origin.RequiredGender == info.RequiredGender))
  2935. return info;
  2936. }
  2937. return Origin;
  2938. }
  2939. public static ItemInfo GetClassAndLevelBasedItem(ItemInfo Origin, MirClass job, ushort level, List<ItemInfo> ItemList)
  2940. {
  2941. ItemInfo output = Origin;
  2942. for (int i = 0; i < ItemList.Count; i++)
  2943. {
  2944. ItemInfo info = ItemList[i];
  2945. if (info.Name.StartsWith(Origin.Name))
  2946. if ((byte)info.RequiredClass == (1 << (byte)job))
  2947. if ((info.RequiredType == RequiredType.Level) && (info.RequiredAmount <= level) && (output.RequiredAmount <= info.RequiredAmount) && (Origin.RequiredGender == info.RequiredGender))
  2948. output = info;
  2949. }
  2950. return output;
  2951. }
  2952. public static string StringOverLines(string line, int maxWordsPerLine, int maxLettersPerLine)
  2953. {
  2954. string newString = string.Empty;
  2955. string[] words = line.Split(' ');
  2956. int lineLength = 0;
  2957. for (int i = 0; i < words.Length; i++)
  2958. {
  2959. lineLength += words[i].Length + 1;
  2960. newString += words[i] + " ";
  2961. if (i > 0 && i % maxWordsPerLine == 0 && lineLength > maxLettersPerLine)
  2962. {
  2963. lineLength = 0;
  2964. newString += "\r\n";
  2965. }
  2966. }
  2967. return newString;
  2968. }
  2969. //public static byte[] ImageToByteArray(Image imageIn)
  2970. //{
  2971. // MemoryStream ms = new MemoryStream();
  2972. // imageIn.Save(ms, ImageFormat.Gif);
  2973. // return ms.ToArray();
  2974. //}
  2975. //public static Image ByteArrayToImage(byte[] byteArrayIn)
  2976. //{
  2977. // MemoryStream ms = new MemoryStream(byteArrayIn);
  2978. // Image returnImage = Image.FromStream(ms);
  2979. // return returnImage;
  2980. //}
  2981. public static IEnumerable<byte[]> SplitArray(byte[] value, int bufferLength)
  2982. {
  2983. int countOfArray = value.Length / bufferLength;
  2984. if (value.Length % bufferLength > 0)
  2985. countOfArray++;
  2986. for (int i = 0; i < countOfArray; i++)
  2987. {
  2988. yield return value.Skip(i * bufferLength).Take(bufferLength).ToArray();
  2989. }
  2990. }
  2991. public static byte[] CombineArray(List<byte[]> arrays)
  2992. {
  2993. byte[] rv = new byte[arrays.Sum(x => x.Length)];
  2994. int offset = 0;
  2995. foreach (byte[] array in arrays)
  2996. {
  2997. System.Buffer.BlockCopy(array, 0, rv, offset, array.Length);
  2998. offset += array.Length;
  2999. }
  3000. return rv;
  3001. }
  3002. public static short MaxMineimac(short num)
  3003. {
  3004. if (num >= 5)
  3005. return 5;
  3006. else if (num <= -5)
  3007. return -5;
  3008. else
  3009. return num;
  3010. }
  3011. public static List<MagicLevelPro> FindSpellPro(int index)
  3012. {
  3013. List<MagicLevelPro> templist = new List<MagicLevelPro>();
  3014. for (int i = 0; i < Globals.Magicelevelps.Count; i++)
  3015. {
  3016. if (Globals.Magicelevelps[i].Itemindex == index)
  3017. templist.Add(Globals.Magicelevelps[i]);
  3018. }
  3019. return templist;
  3020. }
  3021. public static ExtraDamageItem FindDamageItem(int index)
  3022. {
  3023. foreach (ExtraDamageItem item in Globals.DamageItems)
  3024. {
  3025. if (item.ItemIndex == index)
  3026. return item;
  3027. }
  3028. return null;
  3029. }
  3030. public static SpecialEffectItem FindEffectItem(int index)
  3031. {
  3032. foreach (SpecialEffectItem item in Globals.SpecialEffects)
  3033. {
  3034. if (item.ItemIndex == index)
  3035. return item;
  3036. }
  3037. return null;
  3038. }
  3039. }
  3040. // 附加属性 -- 直接给角色属性做加成
  3041. public class ExtraDamageItem
  3042. {
  3043. public int ItemIndex;
  3044. public double Rate;
  3045. public byte Type;
  3046. }
  3047. // 特殊效果 -- 在特定条件下触发
  3048. public class SpecialEffectItem
  3049. {
  3050. public int ItemIndex;
  3051. public double Rate;
  3052. public byte Type;
  3053. }
  3054. public class IgnoreItem
  3055. {
  3056. public int Itemindex;
  3057. public byte IgnoreACnum;
  3058. public byte IgnoreMACnum;
  3059. }
  3060. public class MagicLevelPro
  3061. {
  3062. public Spell Spell;
  3063. public int Itemindex;
  3064. public byte LevelPro;
  3065. }
  3066. public class SelectInfo
  3067. {
  3068. public int Index;
  3069. public string Name = string.Empty;
  3070. public ushort Level;
  3071. public MirClass Class;
  3072. public MirGender Gender;
  3073. public DateTime LastAccess;
  3074. public string LocationDown;
  3075. public SelectInfo()
  3076. { }
  3077. public SelectInfo(BinaryReader reader)
  3078. {
  3079. Index = reader.ReadInt32();
  3080. Name = reader.ReadString();
  3081. Level = reader.ReadUInt16();
  3082. Class = (MirClass)reader.ReadByte();
  3083. Gender = (MirGender)reader.ReadByte();
  3084. LastAccess = DateTime.FromBinary(reader.ReadInt64());
  3085. LocationDown = reader.ReadString();
  3086. }
  3087. public void Save(BinaryWriter writer)
  3088. {
  3089. writer.Write(Index);
  3090. writer.Write(Name);
  3091. writer.Write(Level);
  3092. writer.Write((byte)Class);
  3093. writer.Write((byte)Gender);
  3094. writer.Write(LastAccess.ToBinary());
  3095. writer.Write(LocationDown);
  3096. }
  3097. }
  3098. public class ItemInfo
  3099. {
  3100. public int Index;
  3101. public string Name = string.Empty;
  3102. public ItemType Type;
  3103. public ItemGrade Grade;
  3104. public RequiredType RequiredType = RequiredType.Level;
  3105. public RequiredClass RequiredClass = RequiredClass.None;
  3106. public RequiredGender RequiredGender = RequiredGender.None;
  3107. public int Set;
  3108. public short Shape;
  3109. public byte Weight, Light, RequiredAmount;
  3110. public ushort Image, Durability;
  3111. public uint Price, StackSize = 1;
  3112. public byte MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC, MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility;
  3113. public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC;
  3114. public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC;
  3115. public ushort HP, MP;
  3116. public sbyte AttackSpeed, Luck;
  3117. public short BagWeight, HandWeight, WearWeight;
  3118. public bool StartItem;
  3119. public byte Effect;
  3120. public byte Strong;
  3121. public byte MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate;
  3122. public byte CriticalRate, CriticalDamage;
  3123. public bool NeedIdentify, ShowGroupPickup;
  3124. public bool ClassBased;
  3125. public bool LevelBased;
  3126. public bool CanMine;
  3127. public bool CanFastRun;
  3128. public bool CanAwakening;
  3129. public byte MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, HpDrainRate;
  3130. public BindMode Bind = BindMode.none;
  3131. public byte Reflect,Parry,IgnoreAC,IgnoreMAC;
  3132. public SpecialItemMode Unique = SpecialItemMode.None;
  3133. public byte RandomStatsId;
  3134. public RandomItemStat RandomStats;
  3135. public string ToolTip = string.Empty;
  3136. public byte HideMinAC, HideMaxAC, HideMinMAC, HideMaxMAC, HideMinDC, HideMaxDC, HideMinMC, HideMaxMC, HideMinSC, HideMaxSC, HideAccuracy, HideAgility;
  3137. public byte HideMagicResist, HidePoisonResist, HideHealthRecovery, HideSpellRecovery, HidePoisonRecovery;
  3138. public byte HideMaxAcRate, HideMaxMacRate, HideHoly, HideFreezing, HidePoisonAttack, HideHpDrainRate;
  3139. public byte HideCriticalRate, HideCriticalDamage;
  3140. public short HideFireAC, HideWindAC, HideIceAC, HideLightAC, HideHolyAC, HideDarkAC, HidePhantomAC;
  3141. public short HideFireMAC, HideWindMAC, HideIceMAC, HideLightMAC, HideHolyMAC, HideDarkMAC, HidePhantomMAC;
  3142. public sbyte HideAttackSpeed, HideLuck;
  3143. public byte HideStrong, HideReflect,HideParry, HideIgnoreAC, HideIgnoreMAC;
  3144. public byte Bt;
  3145. public bool IsConsumable
  3146. {
  3147. get { return Type == ItemType.Potion || Type == ItemType.Scroll || Type == ItemType.Food || Type == ItemType.Transform; }
  3148. }
  3149. public string FriendlyName
  3150. {
  3151. get
  3152. {
  3153. string temp = Name;
  3154. temp = Regex.Replace(temp, @"\d+$", string.Empty); //hides end numbers
  3155. temp = Regex.Replace(temp, @"\[[^]]*\]", string.Empty); //hides square brackets
  3156. return temp;
  3157. }
  3158. }
  3159. public ItemInfo()
  3160. {
  3161. }
  3162. public ItemInfo(MySqlDataReader readerItemInfo)
  3163. {
  3164. Index = Convert.ToInt32(readerItemInfo["IndexID"]);
  3165. Name = readerItemInfo["Name"].ToString();
  3166. Type = (ItemType)Convert.ToByte(readerItemInfo["Type"]);
  3167. Grade = (ItemGrade)Convert.ToUInt16(readerItemInfo["Grade"]);
  3168. RequiredType = (RequiredType)Convert.ToByte(readerItemInfo["RequiredType"]);
  3169. RequiredClass = (RequiredClass)Convert.ToByte(readerItemInfo["RequiredClass"]);
  3170. RequiredGender = (RequiredGender)Convert.ToByte(readerItemInfo["RequiredGender"]);
  3171. Set = (int)Convert.ToByte(readerItemInfo["Set_"]);
  3172. Shape = Convert.ToInt16(readerItemInfo["Shape"]);
  3173. Weight = Convert.ToByte(readerItemInfo["Weight"]);
  3174. Light = Convert.ToByte(readerItemInfo["Light"]);
  3175. RequiredAmount = Convert.ToByte(readerItemInfo["RequiredAmount"]);
  3176. Image = Convert.ToUInt16(readerItemInfo["Image"]);
  3177. Durability = Convert.ToUInt16(readerItemInfo["Durability"]);
  3178. StackSize = Convert.ToUInt32(readerItemInfo["StackSize"]);
  3179. Price = Convert.ToUInt32(readerItemInfo["Price"]);
  3180. MinAC = Convert.ToByte(readerItemInfo["MinAC"]);
  3181. MaxAC = Convert.ToByte(readerItemInfo["MaxAC"]);
  3182. MinMAC = Convert.ToByte(readerItemInfo["MinMAC"]);
  3183. MaxMAC = Convert.ToByte(readerItemInfo["MaxMAC"]);
  3184. MinDC = Convert.ToByte(readerItemInfo["MinDC"]);
  3185. MaxDC = Convert.ToByte(readerItemInfo["MaxDC"]);
  3186. MinMC = Convert.ToByte(readerItemInfo["MinMC"]);
  3187. MaxMC = Convert.ToByte(readerItemInfo["MaxMC"]);
  3188. MinSC = Convert.ToByte(readerItemInfo["MinSC"]);
  3189. MaxSC = Convert.ToByte(readerItemInfo["MaxSC"]);
  3190. HP = Convert.ToUInt16(readerItemInfo["HP"]);
  3191. MP = Convert.ToUInt16(readerItemInfo["MP"]);
  3192. Accuracy = Convert.ToByte(readerItemInfo["Accuracy"]);
  3193. Agility = Convert.ToByte(readerItemInfo["Agility"]);
  3194. FireAC = Convert.ToInt16(readerItemInfo["FireAC"]);
  3195. WindAC = Convert.ToInt16(readerItemInfo["WindAC"]);
  3196. IceAC = Convert.ToInt16(readerItemInfo["IceAC"]);
  3197. LightAC = Convert.ToInt16(readerItemInfo["LightAC"]);
  3198. HolyAC = Convert.ToInt16(readerItemInfo["HolyAC"]);
  3199. DarkAC = Convert.ToInt16(readerItemInfo["DarkAC"]);
  3200. PhantomAC = Convert.ToInt16(readerItemInfo["PhantomAC"]);
  3201. FireMAC = Convert.ToInt16(readerItemInfo["FireMAC"]);
  3202. WindMAC = Convert.ToInt16(readerItemInfo["WindMAC"]);
  3203. IceMAC = Convert.ToInt16(readerItemInfo["IceMAC"]);
  3204. LightMAC = Convert.ToInt16(readerItemInfo["LightMAC"]);
  3205. HolyMAC = Convert.ToInt16(readerItemInfo["HolyMAC"]);
  3206. DarkMAC = Convert.ToInt16(readerItemInfo["DarkMAC"]);
  3207. PhantomMAC = Convert.ToInt16(readerItemInfo["PhantomMAC"]);
  3208. Luck = Convert.ToSByte(readerItemInfo["Luck"]);
  3209. AttackSpeed = Convert.ToSByte(readerItemInfo["AttackSpeed"]);
  3210. StartItem = Convert.ToBoolean(readerItemInfo["StartItem"]);
  3211. BagWeight = Convert.ToInt16(readerItemInfo["BagWeight"]);
  3212. HandWeight = Convert.ToInt16(readerItemInfo["HandWeight"]);
  3213. WearWeight = Convert.ToInt16(readerItemInfo["WearWeight"]);
  3214. Effect = Convert.ToByte(readerItemInfo["Effect"]);
  3215. Strong = Convert.ToByte(readerItemInfo["Strong"]);
  3216. MagicResist = Convert.ToByte(readerItemInfo["MagicResist"]);
  3217. PoisonResist = Convert.ToByte(readerItemInfo["PoisonResist"]);
  3218. HealthRecovery = Convert.ToByte(readerItemInfo["HealthRecovery"]);
  3219. SpellRecovery = Convert.ToByte(readerItemInfo["SpellRecovery"]);
  3220. PoisonRecovery = Convert.ToByte(readerItemInfo["PoisonRecovery"]);
  3221. HPrate = Convert.ToByte(readerItemInfo["HPrate"]);
  3222. MPrate = Convert.ToByte(readerItemInfo["MPrate"]);
  3223. CriticalRate = Convert.ToByte(readerItemInfo["CriticalRate"]);
  3224. CriticalDamage = Convert.ToByte(readerItemInfo["CriticalDamage"]);
  3225. NeedIdentify = Convert.ToBoolean(readerItemInfo["NeedIdentify"]);
  3226. ShowGroupPickup = Convert.ToBoolean(readerItemInfo["ShowGroupPickup"]);
  3227. ClassBased = Convert.ToBoolean(readerItemInfo["ClassBased"]);
  3228. LevelBased = Convert.ToBoolean(readerItemInfo["LevelBased"]);
  3229. CanMine = Convert.ToBoolean(readerItemInfo["CanMine"]);
  3230. MaxAcRate = Convert.ToByte(readerItemInfo["MaxAcRate"]);
  3231. MaxMacRate = Convert.ToByte(readerItemInfo["MaxMacRate"]);
  3232. Holy = Convert.ToByte(readerItemInfo["Holy"]);
  3233. Freezing = Convert.ToByte(readerItemInfo["Freezing"]);
  3234. PoisonAttack = Convert.ToByte(readerItemInfo["PoisonAttack"]);
  3235. Bind = (BindMode)Convert.ToUInt16(readerItemInfo["Bind"]);
  3236. Reflect = Convert.ToByte(readerItemInfo["Reflect"]);
  3237. Parry = Convert.ToByte(readerItemInfo["Parry"]);
  3238. HideParry = Convert.ToByte(readerItemInfo["HideParry"]);
  3239. IgnoreAC = Convert.ToByte(readerItemInfo["IgnoreAC"]);
  3240. HideIgnoreAC = Convert.ToByte(readerItemInfo["HideIgnoreAC"]);
  3241. IgnoreMAC = Convert.ToByte(readerItemInfo["IgnoreMAC"]);
  3242. HideIgnoreMAC = Convert.ToByte(readerItemInfo["HideIgnoreMAC"]);
  3243. HpDrainRate = Convert.ToByte(readerItemInfo["HpDrainRate"]);
  3244. Unique = (SpecialItemMode)Convert.ToUInt16(readerItemInfo["Unique_"]);
  3245. RandomStatsId = Convert.ToByte(readerItemInfo["RandomStatsId"]);
  3246. CanFastRun = Convert.ToBoolean(readerItemInfo["CanFastRun"]);
  3247. CanAwakening = Convert.ToBoolean(readerItemInfo["CanAwakening"]);
  3248. // RandomStats = (RandomItemStat)readerItemInfo["RandomStats"];
  3249. ToolTip = readerItemInfo["ToolTip"].ToString();
  3250. //if ((readerItemInfo != null) && (RandomStatsId < Server.Settings.RandomItemStatsList.Count))
  3251. //{
  3252. // RandomStats = Server.Settings.RandomItemStatsList[RandomStatsId];
  3253. //}
  3254. HideMinAC = Convert.ToByte(readerItemInfo["HideMinAC"]);
  3255. HideMaxAC = Convert.ToByte(readerItemInfo["HideMaxAC"]);
  3256. HideMinMAC = Convert.ToByte(readerItemInfo["HideMinMAC"]);
  3257. HideMaxMAC = Convert.ToByte(readerItemInfo["HideMaxMAC"]);
  3258. HideMinDC = Convert.ToByte(readerItemInfo["HideMinDC"]);
  3259. HideMaxDC = Convert.ToByte(readerItemInfo["HideMaxDC"]);
  3260. HideMinMC = Convert.ToByte(readerItemInfo["HideMinMC"]);
  3261. HideMaxMC = Convert.ToByte(readerItemInfo["HideMaxMC"]);
  3262. HideMinSC = Convert.ToByte(readerItemInfo["HideMinSC"]);
  3263. HideMaxSC = Convert.ToByte(readerItemInfo["HideMaxSC"]);
  3264. HideAccuracy = Convert.ToByte(readerItemInfo["HideAccuracy"]);
  3265. HideAgility = Convert.ToByte(readerItemInfo["HideAgility"]);
  3266. HideFireAC = Convert.ToInt16(readerItemInfo["HideFireAC"]);
  3267. HideWindAC = Convert.ToInt16(readerItemInfo["HideWindAC"]);
  3268. HideIceAC = Convert.ToInt16(readerItemInfo["HideIceAC"]);
  3269. HideLightAC = Convert.ToInt16(readerItemInfo["HideLightAC"]);
  3270. HideHolyAC = Convert.ToInt16(readerItemInfo["HideHolyAC"]);
  3271. HideDarkAC = Convert.ToInt16(readerItemInfo["HideDarkAC"]);
  3272. HidePhantomAC = Convert.ToInt16(readerItemInfo["HidePhantomAC"]);
  3273. HideFireMAC = Convert.ToInt16(readerItemInfo["HideFireMAC"]);
  3274. HideWindMAC = Convert.ToInt16(readerItemInfo["HideWindMAC"]);
  3275. HideIceMAC = Convert.ToInt16(readerItemInfo["HideIceMAC"]);
  3276. HideLightMAC = Convert.ToInt16(readerItemInfo["HideLightMAC"]);
  3277. HideHolyMAC = Convert.ToInt16(readerItemInfo["HideHolyMAC"]);
  3278. HideDarkMAC = Convert.ToInt16(readerItemInfo["HideDarkMAC"]);
  3279. HidePhantomMAC = Convert.ToInt16(readerItemInfo["HidePhantomMAC"]);
  3280. HideMagicResist = Convert.ToByte(readerItemInfo["HideMagicResist"]);
  3281. HidePoisonResist = Convert.ToByte(readerItemInfo["HidePoisonResist"]);
  3282. HideHealthRecovery = Convert.ToByte(readerItemInfo["HideHealthRecovery"]);
  3283. HideSpellRecovery = Convert.ToByte(readerItemInfo["HideSpellRecovery"]);
  3284. HidePoisonRecovery = Convert.ToByte(readerItemInfo["HidePoisonRecovery"]);
  3285. HideMaxAcRate = Convert.ToByte(readerItemInfo["HideMaxAcRate"]);
  3286. HideHpDrainRate = Convert.ToByte(readerItemInfo["HideHpDrainRate"]);
  3287. HideMaxMacRate = Convert.ToByte(readerItemInfo["HideMaxMacRate"]);
  3288. HideHoly = Convert.ToByte(readerItemInfo["HideHoly"]);
  3289. HideFreezing = Convert.ToByte(readerItemInfo["HideFreezing"]);
  3290. HidePoisonAttack = Convert.ToByte(readerItemInfo["HidePoisonAttack"]);
  3291. HideCriticalRate = Convert.ToByte(readerItemInfo["HideCriticalRate"]);
  3292. HideCriticalDamage = Convert.ToByte(readerItemInfo["HideCriticalDamage"]);
  3293. HideLuck = Convert.ToSByte(readerItemInfo["HideLuck"]);
  3294. HideAttackSpeed = Convert.ToSByte(readerItemInfo["HideAttackSpeed"]);
  3295. HideStrong = Convert.ToByte(readerItemInfo["HideStrong"]);
  3296. HideReflect = Convert.ToByte(readerItemInfo["HideReflect"]);
  3297. Bt = Convert.ToByte(readerItemInfo["Bt"]);
  3298. }
  3299. public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
  3300. {
  3301. Index = reader.ReadInt32();
  3302. Name = reader.ReadString(); //1
  3303. Type = (ItemType)reader.ReadByte(); //2
  3304. if (version >= 40) Grade = (ItemGrade)reader.ReadByte(); //3
  3305. RequiredType = (RequiredType)reader.ReadByte();
  3306. RequiredClass = (RequiredClass)reader.ReadByte();
  3307. RequiredGender = (RequiredGender)reader.ReadByte();
  3308. if (version >= 17) Set = (int)reader.ReadByte();
  3309. Shape = version >= 30 ? reader.ReadInt16() : reader.ReadSByte();
  3310. Weight = reader.ReadByte();
  3311. Light = reader.ReadByte();
  3312. RequiredAmount = reader.ReadByte();
  3313. Image = reader.ReadUInt16();
  3314. Durability = reader.ReadUInt16();
  3315. StackSize = reader.ReadUInt32();
  3316. Price = reader.ReadUInt32();
  3317. MinAC = reader.ReadByte();
  3318. MaxAC = reader.ReadByte();
  3319. MinMAC = reader.ReadByte();
  3320. MaxMAC = reader.ReadByte();
  3321. MinDC = reader.ReadByte();
  3322. MaxDC = reader.ReadByte();
  3323. MinMC = reader.ReadByte();
  3324. MaxMC = reader.ReadByte();
  3325. MinSC = reader.ReadByte();
  3326. MaxSC = reader.ReadByte();
  3327. if (version < 25)
  3328. {
  3329. HP = reader.ReadByte();
  3330. MP = reader.ReadByte();
  3331. }
  3332. else
  3333. {
  3334. HP = reader.ReadUInt16();
  3335. MP = reader.ReadUInt16();
  3336. }
  3337. Accuracy = reader.ReadByte();
  3338. Agility = reader.ReadByte();
  3339. FireAC = reader.ReadInt16();
  3340. WindAC = reader.ReadInt16();
  3341. IceAC = reader.ReadInt16();
  3342. LightAC = reader.ReadInt16();
  3343. HolyAC = reader.ReadInt16();
  3344. DarkAC = reader.ReadInt16();
  3345. PhantomAC = reader.ReadInt16();
  3346. FireMAC = reader.ReadInt16();
  3347. WindMAC = reader.ReadInt16();
  3348. IceMAC = reader.ReadInt16();
  3349. LightMAC = reader.ReadInt16();
  3350. HolyMAC = reader.ReadInt16();
  3351. DarkMAC = reader.ReadInt16();
  3352. PhantomMAC = reader.ReadInt16();
  3353. Luck = reader.ReadSByte();
  3354. AttackSpeed = reader.ReadSByte();
  3355. StartItem = reader.ReadBoolean();
  3356. BagWeight = reader.ReadInt16();
  3357. HandWeight = reader.ReadInt16();
  3358. WearWeight = reader.ReadInt16();
  3359. if (version >= 9) Effect = reader.ReadByte();
  3360. if (version >= 20)
  3361. {
  3362. Strong = reader.ReadByte();
  3363. MagicResist = reader.ReadByte();
  3364. PoisonResist = reader.ReadByte();
  3365. HealthRecovery = reader.ReadByte();
  3366. SpellRecovery = reader.ReadByte();
  3367. PoisonRecovery = reader.ReadByte();
  3368. HPrate = reader.ReadByte();
  3369. MPrate = reader.ReadByte();
  3370. CriticalRate = reader.ReadByte();
  3371. CriticalDamage = reader.ReadByte();
  3372. byte bools = reader.ReadByte();
  3373. NeedIdentify = (bools & 0x01) == 0x01;
  3374. ShowGroupPickup = (bools & 0x02) == 0x02;
  3375. ClassBased = (bools & 0x04) == 0x04;
  3376. LevelBased = (bools & 0x08) == 0x08;
  3377. CanMine = (bools & 0x10) == 0x10;
  3378. MaxAcRate = reader.ReadByte();
  3379. MaxMacRate = reader.ReadByte();
  3380. Holy = reader.ReadByte();
  3381. Freezing = reader.ReadByte();
  3382. PoisonAttack = reader.ReadByte();
  3383. if (version < 55)
  3384. {
  3385. Bind = (BindMode)reader.ReadByte();
  3386. }
  3387. else
  3388. {
  3389. Bind = (BindMode)reader.ReadInt16();
  3390. }
  3391. }
  3392. if (version >= 21)
  3393. {
  3394. Reflect = reader.ReadByte();
  3395. HpDrainRate = reader.ReadByte();
  3396. Unique = (SpecialItemMode)reader.ReadInt16();
  3397. }
  3398. if (version >= 24)
  3399. {
  3400. RandomStatsId = reader.ReadByte();
  3401. }
  3402. else
  3403. {
  3404. RandomStatsId = 255;
  3405. if ((Type == ItemType.Weapon) || (Type == ItemType.Armour) || (Type == ItemType.Helmet) || (Type == ItemType.Necklace) || (Type == ItemType.Bracelet) || (Type == ItemType.Ring) || (Type == ItemType.Mount))
  3406. RandomStatsId = (byte)Type;
  3407. if ((Type == ItemType.Belt) || (Type == ItemType.Boots))
  3408. RandomStatsId = 7;
  3409. }
  3410. if (version >= 40) CanFastRun = reader.ReadBoolean();
  3411. if (version >= 41)
  3412. {
  3413. CanAwakening = reader.ReadBoolean();
  3414. bool isTooltip = reader.ReadBoolean();
  3415. if (isTooltip)
  3416. ToolTip = reader.ReadString();
  3417. }
  3418. if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option
  3419. {
  3420. if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None))
  3421. Bind |= BindMode.NoWeddingRing;
  3422. }
  3423. Parry=reader.ReadByte();
  3424. IgnoreAC=reader.ReadByte();
  3425. IgnoreMAC=reader.ReadByte();
  3426. }
  3427. public void Save(BinaryWriter writer)
  3428. {
  3429. writer.Write(Index);
  3430. writer.Write(Name);
  3431. writer.Write((byte)Type);
  3432. writer.Write((byte)Grade);
  3433. writer.Write((byte)RequiredType);
  3434. writer.Write((byte)RequiredClass);
  3435. writer.Write((byte)RequiredGender);
  3436. writer.Write((byte)Set);
  3437. writer.Write(Shape);
  3438. writer.Write(Weight);
  3439. writer.Write(Light);
  3440. writer.Write(RequiredAmount);
  3441. writer.Write(Image);
  3442. writer.Write(Durability);
  3443. writer.Write(StackSize);
  3444. writer.Write(Price);
  3445. writer.Write(MinAC);
  3446. writer.Write(MaxAC);
  3447. writer.Write(MinMAC);
  3448. writer.Write(MaxMAC);
  3449. writer.Write(MinDC);
  3450. writer.Write(MaxDC);
  3451. writer.Write(MinMC);
  3452. writer.Write(MaxMC);
  3453. writer.Write(MinSC);
  3454. writer.Write(MaxSC);
  3455. writer.Write(HP);
  3456. writer.Write(MP);
  3457. writer.Write(Accuracy);
  3458. writer.Write(Agility);
  3459. writer.Write(FireAC);
  3460. writer.Write(WindAC);
  3461. writer.Write(IceAC);
  3462. writer.Write(LightAC);
  3463. writer.Write(HolyAC);
  3464. writer.Write(DarkAC);
  3465. writer.Write(PhantomAC);
  3466. writer.Write(FireMAC);
  3467. writer.Write(WindMAC);
  3468. writer.Write(IceMAC);
  3469. writer.Write(LightMAC);
  3470. writer.Write(HolyMAC);
  3471. writer.Write(DarkMAC);
  3472. writer.Write(PhantomMAC);
  3473. writer.Write(Luck);
  3474. writer.Write(AttackSpeed);
  3475. writer.Write(StartItem);
  3476. writer.Write(BagWeight);
  3477. writer.Write(HandWeight);
  3478. writer.Write(WearWeight);
  3479. writer.Write(Effect);
  3480. writer.Write(Strong);
  3481. writer.Write(MagicResist);
  3482. writer.Write(PoisonResist);
  3483. writer.Write(HealthRecovery);
  3484. writer.Write(SpellRecovery);
  3485. writer.Write(PoisonRecovery);
  3486. writer.Write(HPrate);
  3487. writer.Write(MPrate);
  3488. writer.Write(CriticalRate);
  3489. writer.Write(CriticalDamage);
  3490. byte bools = 0;
  3491. if (NeedIdentify) bools |= 0x01;
  3492. if (ShowGroupPickup) bools |= 0x02;
  3493. if (ClassBased) bools |= 0x04;
  3494. if (LevelBased) bools |= 0x08;
  3495. if (CanMine) bools |= 0x10;
  3496. writer.Write(bools);
  3497. writer.Write(MaxAcRate);
  3498. writer.Write(MaxMacRate);
  3499. writer.Write(Holy);
  3500. writer.Write(Freezing);
  3501. writer.Write(PoisonAttack);
  3502. writer.Write((short)Bind);
  3503. writer.Write(Reflect);
  3504. writer.Write(HpDrainRate);
  3505. writer.Write((short)Unique);
  3506. writer.Write(RandomStatsId);
  3507. writer.Write(CanFastRun);
  3508. writer.Write(CanAwakening);
  3509. writer.Write(ToolTip != null);
  3510. if (ToolTip != null)
  3511. writer.Write(ToolTip);
  3512. writer.Write(Parry);
  3513. writer.Write(IgnoreAC);
  3514. writer.Write(IgnoreMAC);
  3515. }
  3516. public static ItemInfo FromText(string text)
  3517. {
  3518. string[] data = text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  3519. if (data.Length < 33) return null;
  3520. ItemInfo info = new ItemInfo { Name = data[0] };
  3521. if (!Enum.TryParse(data[1], out info.Type)) return null;
  3522. if (!Enum.TryParse(data[2], out info.Grade)) return null;
  3523. if (!Enum.TryParse(data[3], out info.RequiredType)) return null;
  3524. if (!Enum.TryParse(data[4], out info.RequiredClass)) return null;
  3525. if (!Enum.TryParse(data[5], out info.RequiredGender)) return null;
  3526. if (!int.TryParse(data[6], out info.Set)) return null;
  3527. if (!short.TryParse(data[7], out info.Shape)) return null;
  3528. if (!byte.TryParse(data[8], out info.Weight)) return null;
  3529. if (!byte.TryParse(data[9], out info.Light)) return null;
  3530. if (!byte.TryParse(data[10], out info.RequiredAmount)) return null;
  3531. if (!byte.TryParse(data[11], out info.MinAC)) return null;
  3532. if (!byte.TryParse(data[12], out info.MaxAC)) return null;
  3533. if (!byte.TryParse(data[13], out info.MinMAC)) return null;
  3534. if (!byte.TryParse(data[14], out info.MaxMAC)) return null;
  3535. if (!byte.TryParse(data[15], out info.MinDC)) return null;
  3536. if (!byte.TryParse(data[16], out info.MaxDC)) return null;
  3537. if (!byte.TryParse(data[17], out info.MinMC)) return null;
  3538. if (!byte.TryParse(data[18], out info.MaxMC)) return null;
  3539. if (!byte.TryParse(data[19], out info.MinSC)) return null;
  3540. if (!byte.TryParse(data[20], out info.MaxSC)) return null;
  3541. if (!byte.TryParse(data[21], out info.Accuracy)) return null;
  3542. if (!byte.TryParse(data[22], out info.Agility)) return null;
  3543. if (!short.TryParse(data[23], out info.FireAC)) return null;
  3544. if (!short.TryParse(data[24], out info.WindAC)) return null;
  3545. if (!short.TryParse(data[25], out info.IceAC)) return null;
  3546. if (!short.TryParse(data[26], out info.LightAC)) return null;
  3547. if (!short.TryParse(data[27], out info.HolyAC)) return null;
  3548. if (!short.TryParse(data[28], out info.DarkAC)) return null;
  3549. if (!short.TryParse(data[29], out info.PhantomAC)) return null;
  3550. if (!short.TryParse(data[30], out info.FireMAC)) return null;
  3551. if (!short.TryParse(data[31], out info.WindMAC)) return null;
  3552. if (!short.TryParse(data[32], out info.IceMAC)) return null;
  3553. if (!short.TryParse(data[33], out info.LightMAC)) return null;
  3554. if (!short.TryParse(data[34], out info.HolyMAC)) return null;
  3555. if (!short.TryParse(data[35], out info.DarkMAC)) return null;
  3556. if (!short.TryParse(data[36], out info.PhantomMAC)) return null;
  3557. if (!ushort.TryParse(data[37], out info.HP)) return null;
  3558. if (!ushort.TryParse(data[38], out info.MP)) return null;
  3559. if (!sbyte.TryParse(data[39], out info.AttackSpeed)) return null;
  3560. if (!sbyte.TryParse(data[40], out info.Luck)) return null;
  3561. if (!short.TryParse(data[41], out info.BagWeight)) return null;
  3562. if (!short.TryParse(data[42], out info.HandWeight)) return null;
  3563. if (!short.TryParse(data[43], out info.WearWeight)) return null;
  3564. if (!bool.TryParse(data[44], out info.StartItem)) return null;
  3565. if (!ushort.TryParse(data[45], out info.Image)) return null;
  3566. if (!ushort.TryParse(data[46], out info.Durability)) return null;
  3567. if (!uint.TryParse(data[47], out info.Price)) return null;
  3568. if (!uint.TryParse(data[48], out info.StackSize)) return null;
  3569. if (!byte.TryParse(data[49], out info.Effect)) return null;
  3570. if (!byte.TryParse(data[50], out info.Strong)) return null;
  3571. if (!byte.TryParse(data[51], out info.MagicResist)) return null;
  3572. if (!byte.TryParse(data[52], out info.PoisonResist)) return null;
  3573. if (!byte.TryParse(data[53], out info.HealthRecovery)) return null;
  3574. if (!byte.TryParse(data[54], out info.SpellRecovery)) return null;
  3575. if (!byte.TryParse(data[55], out info.PoisonRecovery)) return null;
  3576. if (!byte.TryParse(data[56], out info.HPrate)) return null;
  3577. if (!byte.TryParse(data[57], out info.MPrate)) return null;
  3578. if (!byte.TryParse(data[58], out info.CriticalRate)) return null;
  3579. if (!byte.TryParse(data[59], out info.CriticalDamage)) return null;
  3580. if (!bool.TryParse(data[60], out info.NeedIdentify)) return null;
  3581. if (!bool.TryParse(data[61], out info.ShowGroupPickup)) return null;
  3582. if (!byte.TryParse(data[62], out info.MaxAcRate)) return null;
  3583. if (!byte.TryParse(data[63], out info.MaxMacRate)) return null;
  3584. if (!byte.TryParse(data[64], out info.Holy)) return null;
  3585. if (!byte.TryParse(data[65], out info.Freezing)) return null;
  3586. if (!byte.TryParse(data[66], out info.PoisonAttack)) return null;
  3587. if (!bool.TryParse(data[67], out info.ClassBased)) return null;
  3588. if (!bool.TryParse(data[68], out info.LevelBased)) return null;
  3589. if (!Enum.TryParse(data[69], out info.Bind)) return null;
  3590. if (!byte.TryParse(data[70], out info.Reflect)) return null;
  3591. if (!byte.TryParse(data[71], out info.HpDrainRate)) return null;
  3592. if (!Enum.TryParse(data[72], out info.Unique)) return null;
  3593. if (!byte.TryParse(data[73], out info.RandomStatsId)) return null;
  3594. if (!bool.TryParse(data[74], out info.CanMine)) return null;
  3595. if (!bool.TryParse(data[75], out info.CanFastRun)) return null;
  3596. if (!bool.TryParse(data[76], out info.CanAwakening)) return null;
  3597. if (!byte.TryParse(data[77], out info.Parry)) return null;
  3598. if (!byte.TryParse(data[78], out info.HideParry)) return null;
  3599. if (!byte.TryParse(data[79], out info.IgnoreAC)) return null;
  3600. if (!byte.TryParse(data[80], out info.HideIgnoreAC)) return null;
  3601. if (!byte.TryParse(data[81], out info.IgnoreMAC)) return null;
  3602. if (!byte.TryParse(data[82], out info.HideIgnoreMAC)) return null;
  3603. if (data[83] == "-")
  3604. info.ToolTip = "";
  3605. else
  3606. {
  3607. info.ToolTip = data[83];
  3608. info.ToolTip = info.ToolTip.Replace("&^&", "\r\n");
  3609. }
  3610. return info;
  3611. }
  3612. public string ToText()
  3613. {
  3614. string TransToolTip = ToolTip;
  3615. int length = TransToolTip.Length;
  3616. if (TransToolTip == null || TransToolTip.Length == 0)
  3617. {
  3618. TransToolTip = "-";
  3619. }
  3620. else
  3621. {
  3622. TransToolTip = TransToolTip.Replace("\r\n", "&^&");
  3623. }
  3624. return string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26}," +
  3625. "{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},{39},{40},{41},{42},{43},{44},{45},{46},{47},{48},{49},{50},{51}," +
  3626. "{52},{53},{54},{55},{56},{57},{58},{59},{60},{61},{62},{63},{64},{65},{66},{67},{68},{69},{70},{71},{72},{73},{74},{75},{76},{77}",
  3627. Name, (byte)Type, (byte)Grade, (byte)RequiredType, (byte)RequiredClass, (byte)RequiredGender, (byte)Set, Shape, Weight, Light, RequiredAmount, MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC,
  3628. MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility, FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC, FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC, HP, MP, AttackSpeed, Luck, BagWeight, HandWeight, WearWeight, StartItem, Image, Durability, Price,
  3629. StackSize, Effect, Strong, MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate, CriticalRate, CriticalDamage, NeedIdentify,
  3630. ShowGroupPickup, MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, ClassBased, LevelBased, (short)Bind, Reflect, HpDrainRate, (short)Unique,
  3631. RandomStatsId, CanMine, CanFastRun, CanAwakening,Parry,HideParry,IgnoreAC,HideIgnoreAC,IgnoreMAC,HideIgnoreMAC, TransToolTip);
  3632. }
  3633. public Color GetNameColor()
  3634. {
  3635. if (Grade == ItemGrade.None)
  3636. return Color.DarkGray;
  3637. if (Grade == ItemGrade.高级)
  3638. return Color.DeepSkyBlue;
  3639. if (Grade == ItemGrade.稀有)
  3640. return Color.DarkOrange;
  3641. if (Grade == ItemGrade.神器)
  3642. return Color.Fuchsia;
  3643. if (Grade == ItemGrade.一般)
  3644. return Color.Lime;
  3645. return Color.White;
  3646. }
  3647. public override string ToString()
  3648. {
  3649. //return string.Format("{0}: {1}", Index, Name);
  3650. return Name;
  3651. }
  3652. }
  3653. public class UserItem
  3654. {
  3655. public ulong UniqueID;
  3656. public int ItemIndex;
  3657. public ItemInfo Info;
  3658. public int CurrentDura, MaxDura;
  3659. public string Store;
  3660. public int InitialPosition;
  3661. public uint Count = 1, GemCount = 0;
  3662. public byte AC, MAC, DC, MC, SC, Accuracy, Agility, HP, MP, Strong, MagicResist, PoisonResist, HealthRecovery, ManaRecovery, PoisonRecovery, CriticalRate, CriticalDamage, Freezing, PoisonAttack, Reflect, MaxAcRate, MaxMacRate,Parry,IgnoreAC,IgnoreMAC;
  3663. public byte HideAC, HideMAC, HideDC, HideMC, HideSC, HideAccuracy, HideAgility;
  3664. public byte BagWeight, WearWeight, HandWeight;
  3665. public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC;
  3666. public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC;
  3667. public int DropProtect;
  3668. //装备颜色
  3669. public byte IR;
  3670. public byte IG;
  3671. public byte IB;
  3672. public uint WpLevelExp;
  3673. public sbyte AttackSpeed, Luck;
  3674. public RefinedValue RefinedValue = RefinedValue.None;
  3675. public byte RefineAdded = 0;
  3676. public bool DuraChanged;
  3677. public int SoulBoundId = -1;
  3678. public bool Identified = false;
  3679. public bool Cursed = false;
  3680. public int WeddingRing = -1;
  3681. public ulong Attached;
  3682. public bool IsAttached = false;
  3683. public int AwakeType;
  3684. public bool IsAwake = false;
  3685. public UserItem[] Slots = new UserItem[5];
  3686. public DateTime ExpiryDate;
  3687. public DateTime BuybackExpiryDate;
  3688. public ExpireInfo ExpireInfo;
  3689. public string MakeName;
  3690. public short Make;
  3691. public int SuperRefineLevel;
  3692. public DateTime DropProtectTick;
  3693. public Awake Awake = new Awake();
  3694. public bool IsAdded
  3695. {
  3696. get
  3697. {
  3698. return AC != 0 || MAC != 0 || DC != 0 || MC != 0 || SC != 0 || Accuracy != 0 || Agility != 0 || HP != 0 || MP != 0 || AttackSpeed != 0 || Luck != 0 || Strong != 0 || MagicResist != 0 || PoisonResist != 0 ||
  3699. HealthRecovery != 0 || ManaRecovery != 0 || PoisonRecovery != 0 || CriticalRate != 0 || CriticalDamage != 0 || Freezing != 0 || PoisonAttack != 0 || Reflect != 0 || MaxMacRate != 0 || MaxMacRate != 0 ||
  3700. FireAC != 0 || WindAC != 0 || IceAC != 0 || LightAC != 0 || HolyAC != 0 || DarkAC != 0 || PhantomAC != 0 ||
  3701. FireMAC != 0 || WindMAC != 0 || IceMAC != 0 || LightMAC != 0 || HolyMAC != 0 || DarkMAC != 0 || PhantomMAC != 0;
  3702. }
  3703. }
  3704. public uint Weight
  3705. {
  3706. get { return Info.Type == ItemType.Amulet ? Info.Weight : Info.Weight * Count; }
  3707. }
  3708. public string Name
  3709. {
  3710. get { return Count > 1 ? string.Format("{0} ({1})", Info.Name, Count) : Info.Name; }
  3711. }
  3712. public string FriendlyName
  3713. {
  3714. get { return Count > 1 ? string.Format("{0} ({1})", Info.FriendlyName, Count) : Info.FriendlyName; }
  3715. }
  3716. public UserItem()
  3717. {
  3718. }
  3719. public UserItem(ItemInfo info)
  3720. {
  3721. SoulBoundId = -1;
  3722. ItemIndex = info.Index;
  3723. Info = info;
  3724. SetSlotSize();
  3725. }
  3726. public UserItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
  3727. {
  3728. UniqueID = reader.ReadUInt64();
  3729. ItemIndex = reader.ReadInt32();
  3730. CurrentDura = reader.ReadInt32();
  3731. MaxDura = reader.ReadInt32();
  3732. Count = reader.ReadUInt32();
  3733. AC = reader.ReadByte();
  3734. MAC = reader.ReadByte();
  3735. DC = reader.ReadByte();
  3736. MC = reader.ReadByte();
  3737. SC = reader.ReadByte();
  3738. Accuracy = reader.ReadByte();
  3739. Agility = reader.ReadByte();
  3740. BagWeight = reader.ReadByte();
  3741. WearWeight = reader.ReadByte();
  3742. HandWeight = reader.ReadByte();
  3743. FireAC = reader.ReadInt16();
  3744. WindAC = reader.ReadInt16();
  3745. IceAC = reader.ReadInt16();
  3746. LightAC = reader.ReadInt16();
  3747. HolyAC = reader.ReadInt16();
  3748. DarkAC = reader.ReadInt16();
  3749. PhantomAC = reader.ReadInt16();
  3750. FireMAC = reader.ReadInt16();
  3751. WindMAC = reader.ReadInt16();
  3752. IceMAC = reader.ReadInt16();
  3753. LightMAC = reader.ReadInt16();
  3754. HolyMAC = reader.ReadInt16();
  3755. DarkMAC = reader.ReadInt16();
  3756. PhantomMAC = reader.ReadInt16();
  3757. //装备颜色
  3758. IR = reader.ReadByte();
  3759. IG = reader.ReadByte();
  3760. IB = reader.ReadByte();
  3761. WpLevelExp = reader.ReadUInt32();
  3762. HP = reader.ReadByte();
  3763. MP = reader.ReadByte();
  3764. AttackSpeed = reader.ReadSByte();
  3765. Luck = reader.ReadSByte();
  3766. if (version <= 19) return;
  3767. SoulBoundId = reader.ReadInt32();
  3768. byte Bools = reader.ReadByte();
  3769. Identified = (Bools & 0x01) == 0x01;
  3770. Cursed = (Bools & 0x02) == 0x02;
  3771. Strong = reader.ReadByte();
  3772. MagicResist = reader.ReadByte();
  3773. PoisonResist = reader.ReadByte();
  3774. HealthRecovery = reader.ReadByte();
  3775. ManaRecovery = reader.ReadByte();
  3776. PoisonRecovery = reader.ReadByte();
  3777. CriticalRate = reader.ReadByte();
  3778. CriticalDamage = reader.ReadByte();
  3779. Freezing = reader.ReadByte();
  3780. PoisonAttack = reader.ReadByte();
  3781. if (version <= 31) return;
  3782. int count = reader.ReadInt32();
  3783. for (int i = 0; i < count; i++)
  3784. {
  3785. if (reader.ReadBoolean()) continue;
  3786. UserItem item = new UserItem(reader, version, Customversion);
  3787. Slots[i] = item;
  3788. }
  3789. if (version <= 38) return;
  3790. GemCount = reader.ReadUInt32();
  3791. if (version <= 40) return;
  3792. Awake = new Awake(reader);
  3793. if (version <= 56) return;
  3794. RefinedValue = (RefinedValue)reader.ReadByte();
  3795. RefineAdded = reader.ReadByte();
  3796. if (version < 60) return;
  3797. WeddingRing = reader.ReadInt32();
  3798. if (version < 65) return;
  3799. if (reader.ReadBoolean())
  3800. {
  3801. ExpireInfo = new ExpireInfo(reader, version, Customversion);
  3802. }
  3803. HideAC = reader.ReadByte();
  3804. HideMAC = reader.ReadByte();
  3805. HideDC = reader.ReadByte();
  3806. HideMC = reader.ReadByte();
  3807. HideSC = reader.ReadByte();
  3808. HideAccuracy = reader.ReadByte();
  3809. HideAgility = reader.ReadByte();
  3810. Reflect = reader.ReadByte();
  3811. MaxAcRate = reader.ReadByte();
  3812. MaxMacRate = reader.ReadByte();
  3813. MakeName = reader.ReadString();
  3814. Make = reader.ReadInt16();
  3815. Parry=reader.ReadByte();
  3816. IgnoreAC=reader.ReadByte();
  3817. IgnoreMAC=reader.ReadByte();
  3818. DropProtect=reader.ReadInt32();
  3819. SuperRefineLevel=reader.ReadInt32();
  3820. }
  3821. public void Save(BinaryWriter writer)
  3822. {
  3823. writer.Write(UniqueID);
  3824. writer.Write(ItemIndex);
  3825. writer.Write(CurrentDura);
  3826. writer.Write(MaxDura);
  3827. writer.Write(Count);
  3828. writer.Write(AC);
  3829. writer.Write(MAC);
  3830. writer.Write(DC);
  3831. writer.Write(MC);
  3832. writer.Write(SC);
  3833. writer.Write(Accuracy);
  3834. writer.Write(Agility);
  3835. writer.Write(BagWeight);
  3836. writer.Write(WearWeight);
  3837. writer.Write(HandWeight);
  3838. writer.Write(FireAC);
  3839. writer.Write(WindAC);
  3840. writer.Write(IceAC);
  3841. writer.Write(LightAC);
  3842. writer.Write(HolyAC);
  3843. writer.Write(DarkAC);
  3844. writer.Write(PhantomAC);
  3845. writer.Write(FireMAC);
  3846. writer.Write(WindMAC);
  3847. writer.Write(IceMAC);
  3848. writer.Write(LightMAC);
  3849. writer.Write(HolyMAC);
  3850. writer.Write(DarkMAC);
  3851. writer.Write(PhantomMAC);
  3852. writer.Write(IR);
  3853. writer.Write(IG);
  3854. writer.Write(IB);
  3855. writer.Write(WpLevelExp);
  3856. writer.Write(HP);
  3857. writer.Write(MP);
  3858. writer.Write(AttackSpeed);
  3859. writer.Write(Luck);
  3860. writer.Write(SoulBoundId);
  3861. byte Bools = 0;
  3862. if (Identified) Bools |= 0x01;
  3863. if (Cursed) Bools |= 0x02;
  3864. writer.Write(Bools);
  3865. writer.Write(Strong);
  3866. writer.Write(MagicResist);
  3867. writer.Write(PoisonResist);
  3868. writer.Write(HealthRecovery);
  3869. writer.Write(ManaRecovery);
  3870. writer.Write(PoisonRecovery);
  3871. writer.Write(CriticalRate);
  3872. writer.Write(CriticalDamage);
  3873. writer.Write(Freezing);
  3874. writer.Write(PoisonAttack);
  3875. writer.Write(Slots.Length);
  3876. for (int i = 0; i < Slots.Length; i++)
  3877. {
  3878. writer.Write(Slots[i] == null);
  3879. if (Slots[i] == null) continue;
  3880. Slots[i].Save(writer);
  3881. }
  3882. writer.Write(GemCount);
  3883. Awake.Save(writer);
  3884. writer.Write((byte)RefinedValue);
  3885. writer.Write(RefineAdded);
  3886. writer.Write(WeddingRing);
  3887. writer.Write(ExpireInfo != null);
  3888. if (ExpireInfo != null)
  3889. {
  3890. ExpireInfo.Save(writer);
  3891. }
  3892. writer.Write(HideAC);
  3893. writer.Write(HideMAC);
  3894. writer.Write(HideDC);
  3895. writer.Write(HideMC);
  3896. writer.Write(HideSC);
  3897. writer.Write(HideAccuracy);
  3898. writer.Write(HideAgility);
  3899. writer.Write(Reflect);
  3900. writer.Write(MaxAcRate);
  3901. writer.Write(MaxMacRate);
  3902. if (MakeName == null)
  3903. {
  3904. writer.Write("null");
  3905. }
  3906. else
  3907. {
  3908. writer.Write(MakeName);
  3909. }
  3910. writer.Write((short)Make);
  3911. writer.Write(Parry);
  3912. writer.Write(IgnoreAC);
  3913. writer.Write(IgnoreMAC);
  3914. writer.Write(DropProtect);
  3915. writer.Write(SuperRefineLevel);
  3916. }
  3917. public uint Price()
  3918. {
  3919. if (Info == null) return 0;
  3920. uint p = Info.Price;
  3921. if (Info.Durability > 0&&Info.Type!=ItemType.Potion)
  3922. {
  3923. float r = ((Info.Price / 2F) / Info.Durability);
  3924. p = (uint)(MaxDura * r);
  3925. if (MaxDura > 0)
  3926. r = CurrentDura / (float)MaxDura;
  3927. else
  3928. r = 0;
  3929. p = (uint)Math.Floor(p / 2F + ((p / 2F) * r) + Info.Price / 2F);
  3930. }
  3931. p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.1F + 1F));
  3932. return p * Count;
  3933. }
  3934. public uint RepairPrice()
  3935. {
  3936. if (Info == null || Info.Durability == 0) return 0;
  3937. uint p = Info.Price;
  3938. if (Info.Durability > 0)
  3939. {
  3940. p = (uint)Math.Floor(MaxDura * ((Info.Price / 2F) / Info.Durability) + Info.Price / 2F);
  3941. p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.1F + 1F));
  3942. }
  3943. return (p * Count) - Price();
  3944. }
  3945. public uint Quality()
  3946. {
  3947. uint q = (uint)(AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack + Awake.getAwakeLevel() + 1);
  3948. return q;
  3949. }
  3950. public uint AwakeningPrice()
  3951. {
  3952. if (Info == null) return 0;
  3953. uint p = 1500;
  3954. p = (uint)((p * (1 + Awake.getAwakeLevel() * 2)) * (uint)Info.Grade);
  3955. return p;
  3956. }
  3957. public uint DisassemblePrice()
  3958. {
  3959. if (Info == null) return 0;
  3960. uint p = 1500 * (uint)Info.Grade;
  3961. p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack + Awake.getAwakeLevel()) * 0.1F + 1F));
  3962. return p;
  3963. }
  3964. public uint DowngradePrice()
  3965. {
  3966. if (Info == null) return 0;
  3967. uint p = 3000;
  3968. p = (uint)((p * (1 + (Awake.getAwakeLevel() + 1) * 2)) * (uint)Info.Grade);
  3969. return p;
  3970. }
  3971. public uint ResetPrice()
  3972. {
  3973. if (Info == null) return 0;
  3974. uint p = 3000 * (uint)Info.Grade;
  3975. p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.2F + 1F));
  3976. return p;
  3977. }
  3978. public void SetSlotSize() //set slot size in db?
  3979. {
  3980. int amount = 0;
  3981. switch (Info.Type)
  3982. {
  3983. case ItemType.Mount:
  3984. if (Info.Shape < 7)
  3985. amount = 4;
  3986. else if (Info.Shape < 12)
  3987. amount = 5;
  3988. break;
  3989. case ItemType.Weapon:
  3990. if (Info.Shape == 49 || Info.Shape == 50)
  3991. amount = 5;
  3992. break;
  3993. }
  3994. if (amount == Slots.Length) return;
  3995. Array.Resize(ref Slots, amount);
  3996. }
  3997. public ushort Image
  3998. {
  3999. get
  4000. {
  4001. switch (Info.Type)
  4002. {
  4003. case ItemType.Amulet:
  4004. // if (Info.StackSize > 0)
  4005. // {
  4006. // switch (Info.Shape)
  4007. // {
  4008. // case 0: //Amulet
  4009. // if (Count >= 300) return 3662;
  4010. // if (Count >= 200) return 3661;
  4011. // if (Count >= 100) return 3660;
  4012. // return 3660;
  4013. // case 1: //Grey Poison
  4014. // if (Count >= 150) return 3675;
  4015. // if (Count >= 100) return 2960;
  4016. // if (Count >= 50) return 3674;
  4017. // return 3673;
  4018. // case 2: //Yellow Poison
  4019. // if (Count >= 150) return 3672;
  4020. // if (Count >= 100) return 2961;
  4021. // if (Count >= 50) return 3671;
  4022. // return 3670;
  4023. // }
  4024. // }
  4025. break;
  4026. }
  4027. return Info.Image;
  4028. }
  4029. }
  4030. public UserItem Clone()
  4031. {
  4032. UserItem item = new UserItem(Info)
  4033. {
  4034. UniqueID = UniqueID,
  4035. CurrentDura = CurrentDura,
  4036. MaxDura = MaxDura,
  4037. Count = Count,
  4038. AC = AC,
  4039. MAC = MAC,
  4040. DC = DC,
  4041. MC = MC,
  4042. SC = SC,
  4043. Accuracy = Accuracy,
  4044. Agility = Agility,
  4045. BagWeight = BagWeight,
  4046. WearWeight = WearWeight,
  4047. HandWeight = HandWeight,
  4048. FireAC = FireAC,
  4049. WindAC = WindAC,
  4050. IceAC = IceAC,
  4051. LightAC = LightAC,
  4052. HolyAC = HolyAC,
  4053. DarkAC = DarkAC,
  4054. PhantomAC = PhantomAC,
  4055. FireMAC = FireMAC,
  4056. WindMAC = WindMAC,
  4057. IceMAC = IceMAC,
  4058. LightMAC = LightMAC,
  4059. HolyMAC = HolyMAC,
  4060. DarkMAC = DarkMAC,
  4061. PhantomMAC = PhantomMAC,
  4062. IR = IR,
  4063. IG = IG,
  4064. IB = IB,
  4065. WpLevelExp = WpLevelExp,
  4066. HP = HP,
  4067. MP = MP,
  4068. AttackSpeed = AttackSpeed,
  4069. Luck = Luck,
  4070. DuraChanged = DuraChanged,
  4071. SoulBoundId = SoulBoundId,
  4072. Identified = Identified,
  4073. Cursed = Cursed,
  4074. Strong = Strong,
  4075. MagicResist = MagicResist,
  4076. PoisonResist = PoisonResist,
  4077. HealthRecovery = HealthRecovery,
  4078. ManaRecovery = ManaRecovery,
  4079. PoisonRecovery = PoisonRecovery,
  4080. CriticalRate = CriticalRate,
  4081. CriticalDamage = CriticalDamage,
  4082. Freezing = Freezing,
  4083. PoisonAttack = PoisonAttack,
  4084. Slots = Slots,
  4085. Awake = Awake,
  4086. AwakeType = AwakeType,
  4087. RefinedValue = RefinedValue,
  4088. RefineAdded = RefineAdded,
  4089. Reflect = Reflect,
  4090. MaxMacRate = MaxMacRate,
  4091. MaxAcRate = MaxAcRate,
  4092. ExpireInfo = ExpireInfo,
  4093. MakeName = MakeName,
  4094. Make = Make,
  4095. Parry=Parry,
  4096. IgnoreAC=IgnoreAC,
  4097. IgnoreMAC=IgnoreMAC,
  4098. DropProtect= DropProtect,
  4099. SuperRefineLevel=SuperRefineLevel
  4100. };
  4101. return item;
  4102. }
  4103. public void Resetstat()
  4104. {
  4105. AC = MAC = DC = MC = SC = Accuracy = Agility = HP = MP = Strong = MagicResist = PoisonResist = 0;
  4106. AttackSpeed = Luck = 0;
  4107. HealthRecovery = ManaRecovery = PoisonRecovery = CriticalRate = CriticalDamage = Freezing = PoisonAttack = 0;
  4108. FireAC = WindAC = IceAC = LightAC = HolyAC = DarkAC = PhantomAC = 0;
  4109. FireMAC = WindMAC = IceMAC = LightMAC = HolyMAC = DarkMAC = PhantomMAC = 0;
  4110. BagWeight = WearWeight = HandWeight = 0;
  4111. HideAC = HideMAC = HideDC = HideMC = HideSC = HideAccuracy = HideAgility = 0;
  4112. BagWeight = WearWeight = HandWeight = 0;
  4113. AwakeType = 0;
  4114. RefineAdded = 0;
  4115. IR = IG = IB = 0;
  4116. SuperRefineLevel = 0;
  4117. WpLevelExp = 0;
  4118. Luck = 0;
  4119. }
  4120. public void Resetstatwp()
  4121. {
  4122. AC = MAC = DC = MC = SC = 0;
  4123. // AttackSpeed = Luck = 0;
  4124. FireAC = WindAC = IceAC = LightAC = HolyAC = DarkAC = PhantomAC = 0;
  4125. FireMAC = WindMAC = IceMAC = LightMAC = HolyMAC = DarkMAC = PhantomMAC = 0;
  4126. BagWeight = WearWeight = HandWeight = 0;
  4127. HideAC = HideMAC = HideDC = HideMC = HideSC = HideAccuracy = HideAgility = 0;
  4128. BagWeight = WearWeight = HandWeight = 0;
  4129. IR = IG = IB = 0;
  4130. SuperRefineLevel = 0;
  4131. WpLevelExp = 0;
  4132. }
  4133. public void ReinfinResetstat()
  4134. {
  4135. Accuracy = 0;
  4136. CriticalRate = PoisonResist = PoisonRecovery = CriticalDamage = Freezing = PoisonAttack = Reflect = MaxAcRate = MaxMacRate = 0;
  4137. HealthRecovery = ManaRecovery = 0;
  4138. RefineAdded = HP = 0;
  4139. Parry = Reflect = IgnoreAC = IgnoreMAC = 0;
  4140. }
  4141. public void ReinfinClone(UserItem temp)
  4142. {
  4143. Accuracy = temp.Accuracy;
  4144. CriticalRate = temp.CriticalRate;
  4145. PoisonResist = temp.PoisonResist;
  4146. PoisonRecovery = temp.PoisonRecovery;
  4147. CriticalDamage = temp.CriticalDamage;
  4148. Freezing = temp.Freezing;
  4149. PoisonAttack = temp.PoisonAttack;
  4150. Reflect = temp.Reflect;
  4151. HealthRecovery = temp.HealthRecovery;
  4152. ManaRecovery = temp.ManaRecovery;
  4153. MaxAcRate = temp.MaxAcRate;
  4154. MaxMacRate = temp.MaxMacRate;
  4155. RefineAdded = temp.RefineAdded;
  4156. HP = temp.HP;
  4157. }
  4158. }
  4159. public class ExpireInfo
  4160. {
  4161. public DateTime ExpiryDate;
  4162. public ExpireInfo()
  4163. {
  4164. }
  4165. public ExpireInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
  4166. {
  4167. ExpiryDate = DateTime.FromBinary(reader.ReadInt64());
  4168. }
  4169. public void Save(BinaryWriter writer)
  4170. {
  4171. writer.Write(ExpiryDate.ToBinary());
  4172. }
  4173. }
  4174. public class GameShopItem
  4175. {
  4176. public int ItemIndex;
  4177. public int GIndex;
  4178. public ItemInfo Info;
  4179. public uint GoldPrice = 0;
  4180. public uint CreditPrice = 0;
  4181. public uint Count = 1;
  4182. public string Class = "";
  4183. public string Category = "";
  4184. public int Stock = 0;
  4185. public bool iStock = false;
  4186. public bool Deal = false;
  4187. public bool TopItem = false;
  4188. public DateTime Date;
  4189. public GameShopItem()
  4190. {
  4191. }
  4192. //public GameShopItem(MySqlDataReader readerGameShopItem)
  4193. //{
  4194. // ItemIndex = Convert.ToInt32(readerGameShopItem["ItemIndex"]);
  4195. // GIndex = Convert.ToInt32(readerGameShopItem["GIndex"]);
  4196. // GoldPrice = Convert.ToUInt32(readerGameShopItem["GoldPrice"]);
  4197. // CreditPrice = Convert.ToUInt32(readerGameShopItem["CreditPrice"]);
  4198. // Count = Convert.ToUInt32(readerGameShopItem["Count"]);
  4199. // Class = readerGameShopItem["Class"].ToString();
  4200. // Category = readerGameShopItem["Category"].ToString();
  4201. // Stock = Convert.ToInt32(readerGameShopItem["Stock"]);
  4202. // iStock = Convert.ToBoolean(readerGameShopItem["iStock"]);
  4203. // Deal = Convert.ToBoolean(readerGameShopItem["Deal"]);
  4204. // TopItem = Convert.ToBoolean(readerGameShopItem["TopItem"]);
  4205. // Date = readerGameShopItem.GetDateTime(readerGameShopItem.GetOrdinal("Date"));
  4206. //}
  4207. public GameShopItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
  4208. {
  4209. ItemIndex = reader.ReadInt32();
  4210. GIndex = reader.ReadInt32();
  4211. GoldPrice = reader.ReadUInt32();
  4212. CreditPrice = reader.ReadUInt32();
  4213. Count = reader.ReadUInt32();
  4214. Class = reader.ReadString();
  4215. Category = reader.ReadString();
  4216. Stock = reader.ReadInt32();
  4217. iStock = reader.ReadBoolean();
  4218. Deal = reader.ReadBoolean();
  4219. TopItem = reader.ReadBoolean();
  4220. Date = DateTime.FromBinary(reader.ReadInt64());
  4221. }
  4222. public GameShopItem(BinaryReader reader, bool packet = false)
  4223. {
  4224. ItemIndex = reader.ReadInt32();
  4225. GIndex = reader.ReadInt32();
  4226. Info = new ItemInfo(reader);
  4227. GoldPrice = reader.ReadUInt32();
  4228. CreditPrice = reader.ReadUInt32();
  4229. Count = reader.ReadUInt32();
  4230. Class = reader.ReadString();
  4231. Category = reader.ReadString();
  4232. Stock = reader.ReadInt32();
  4233. iStock = reader.ReadBoolean();
  4234. Deal = reader.ReadBoolean();
  4235. TopItem = reader.ReadBoolean();
  4236. Date = DateTime.FromBinary(reader.ReadInt64());
  4237. }
  4238. public void Save(BinaryWriter writer, bool packet = false)
  4239. {
  4240. writer.Write(ItemIndex);
  4241. writer.Write(GIndex);
  4242. if (packet) Info.Save(writer);
  4243. writer.Write(GoldPrice);
  4244. writer.Write(CreditPrice);
  4245. writer.Write(Count);
  4246. writer.Write(Class);
  4247. writer.Write(Category);
  4248. writer.Write(Stock);
  4249. writer.Write(iStock);
  4250. writer.Write(Deal);
  4251. writer.Write(TopItem);
  4252. writer.Write(Date.ToBinary());
  4253. }
  4254. public override string ToString()
  4255. {
  4256. return string.Format("{0}: {1}", GIndex, Info.Name);
  4257. }
  4258. }
  4259. public class Awake
  4260. {
  4261. //Awake Option
  4262. public static byte AwakeSuccessRate = 70;
  4263. public static byte AwakeHitRate = 70;
  4264. public static int MaxAwakeLevel = 6;
  4265. public static byte Awake_WeaponRate = 1;
  4266. public static byte Awake_HelmetRate = 1;
  4267. public static byte Awake_ArmorRate = 5;
  4268. public static byte AwakeChanceMin = 1;
  4269. public static float[] AwakeMaterialRate = new float[4] { 1.0F, 1.0F, 1.0F, 1.0F };
  4270. public static byte[] AwakeChanceMax = new byte[4] { 1, 2, 3, 4 };
  4271. public static List<List<byte>[]> AwakeMaterials = new List<List<byte>[]>();
  4272. public AwakeType type;
  4273. public List<byte> listAwake = new List<byte>();
  4274. public Awake(BinaryReader reader)
  4275. {
  4276. type = (AwakeType)reader.ReadByte();
  4277. int count = reader.ReadInt32();
  4278. for (int i = 0; i < count; i++)
  4279. {
  4280. listAwake.Add(reader.ReadByte());
  4281. }
  4282. }
  4283. public void Save(BinaryWriter writer)
  4284. {
  4285. writer.Write((byte)type);
  4286. writer.Write(listAwake.Count);
  4287. foreach (byte value in listAwake)
  4288. {
  4289. writer.Write(value);
  4290. }
  4291. }
  4292. public Awake()
  4293. {
  4294. type = AwakeType.None;
  4295. }
  4296. public bool IsMaxLevel() { return listAwake.Count == Awake.MaxAwakeLevel; }
  4297. public int getAwakeLevel() { return listAwake.Count; }
  4298. public byte getAwakeValue()
  4299. {
  4300. byte total = 0;
  4301. foreach (byte value in listAwake)
  4302. {
  4303. total += value;
  4304. }
  4305. return total;
  4306. }
  4307. public bool CheckAwakening(UserItem item, AwakeType type)
  4308. {
  4309. // if (item.Info.CanAwakening != true) return false;
  4310. if (item.Info.Grade == ItemGrade.None) return false;
  4311. if (item.RefineAdded > 5) return false;
  4312. // if (IsMaxLevel()) return false;
  4313. if (this.type == AwakeType.None)
  4314. {
  4315. if (item.Info.Type == ItemType.Weapon)
  4316. {
  4317. if (type == AwakeType.准确 ||
  4318. type == AwakeType.暴击率 ||
  4319. type == AwakeType.冰冻 ||
  4320. type == AwakeType.毒攻击)
  4321. {
  4322. this.type = type;
  4323. return true;
  4324. }
  4325. else
  4326. return false;
  4327. }
  4328. else if (item.Info.Type == ItemType.Helmet)
  4329. {
  4330. if (type == AwakeType.物防 ||
  4331. type == AwakeType.法防)
  4332. {
  4333. this.type = type;
  4334. return true;
  4335. }
  4336. else
  4337. return false;
  4338. }
  4339. else if (item.Info.Type == ItemType.Armour)
  4340. {
  4341. return false;
  4342. }
  4343. else
  4344. return false;
  4345. }
  4346. else
  4347. {
  4348. if (this.type == type)
  4349. return true;
  4350. else
  4351. return false;
  4352. }
  4353. }
  4354. public int UpgradeAwake(UserItem item, AwakeType type, out bool[] isHit)
  4355. {
  4356. //return -1 condition error, -1 = dont upgrade, 0 = failed, 1 = Succeed,
  4357. isHit = null;
  4358. if (CheckAwakening(item, type) != true)
  4359. return -1;
  4360. Random rand = new Random(DateTime.Now.Millisecond);
  4361. if (rand.Next(0, 100) <= AwakeSuccessRate)
  4362. {
  4363. isHit = Awakening(item);
  4364. return 1;
  4365. }
  4366. else
  4367. {
  4368. int idx;
  4369. isHit = makeHit(1, out idx);
  4370. return 0;
  4371. }
  4372. }
  4373. public int RemoveAwake()
  4374. {
  4375. if (listAwake.Count > 0)
  4376. {
  4377. listAwake.Remove(listAwake[listAwake.Count - 1]);
  4378. if (listAwake.Count == 0)
  4379. type = AwakeType.None;
  4380. return 1;
  4381. }
  4382. else
  4383. {
  4384. type = AwakeType.None;
  4385. return 0;
  4386. }
  4387. }
  4388. public int getAwakeLevelValue(int i) { return listAwake[i]; }
  4389. //public byte getDC() { return (type == AwakeType.破坏 ? getAwakeValue() : (byte)0); }
  4390. //public byte getMC() { return (type == AwakeType.法攻 ? getAwakeValue() : (byte)0); }
  4391. //public byte getSC() { return (type == AwakeType.道攻 ? getAwakeValue() : (byte)0); }
  4392. public byte getAC() { return (type == AwakeType.物防 ? getAwakeValue() : (byte)0); }
  4393. public byte getMAC() { return (type == AwakeType.法防 ? getAwakeValue() : (byte)0); }
  4394. // public byte getHPMP() { return (type == AwakeType.HPMP ? getAwakeValue() : (byte)0); }
  4395. private bool[] makeHit(int maxValue, out int makeValue)
  4396. {
  4397. float stepValue = (float)maxValue / 5.0f;
  4398. float totalValue = 0.0f;
  4399. bool[] isHit = new bool[5];
  4400. Random rand = new Random(DateTime.Now.Millisecond);
  4401. for (int i = 0; i < 5; i++)
  4402. {
  4403. if (rand.Next(0, 100) < AwakeHitRate)
  4404. {
  4405. totalValue += stepValue;
  4406. isHit[i] = true;
  4407. }
  4408. else
  4409. {
  4410. isHit[i] = false;
  4411. }
  4412. }
  4413. makeValue = totalValue <= 1.0f ? 1 : (int)totalValue;
  4414. return isHit;
  4415. }
  4416. private bool[] Awakening(UserItem item)
  4417. {
  4418. int minValue = AwakeChanceMin;
  4419. int maxValue = (AwakeChanceMax[(int)item.Info.Grade - 1] < AwakeChanceMin) ? AwakeChanceMin : AwakeChanceMax[(int)item.Info.Grade - 1];
  4420. int result;
  4421. bool[] returnValue = makeHit(maxValue, out result);
  4422. switch (item.Info.Type)
  4423. {
  4424. case ItemType.Weapon:
  4425. result *= (int)Awake_WeaponRate;
  4426. break;
  4427. case ItemType.Armour:
  4428. result *= (int)Awake_ArmorRate;
  4429. break;
  4430. case ItemType.Helmet:
  4431. result *= (int)Awake_HelmetRate;
  4432. break;
  4433. default:
  4434. result = 0;
  4435. break;
  4436. }
  4437. listAwake.Add((byte)result);
  4438. return returnValue;
  4439. }
  4440. }
  4441. public class ClientMagic
  4442. {
  4443. public Spell Spell;
  4444. public byte BaseCost, LevelCost, Icon;
  4445. public byte Level1, Level2, Level3;
  4446. public ushort Need1, Need2, Need3;
  4447. public byte Level, Key, Range;
  4448. public ushort Experience;
  4449. public bool IsTempSpell;
  4450. public long CastTime, Delay;
  4451. public ClientMagic()
  4452. {
  4453. }
  4454. public ClientMagic(BinaryReader reader)
  4455. {
  4456. Spell = (Spell)reader.ReadByte();
  4457. BaseCost = reader.ReadByte();
  4458. LevelCost = reader.ReadByte();
  4459. Icon = reader.ReadByte();
  4460. Level1 = reader.ReadByte();
  4461. Level2 = reader.ReadByte();
  4462. Level3 = reader.ReadByte();
  4463. Need1 = reader.ReadUInt16();
  4464. Need2 = reader.ReadUInt16();
  4465. Need3 = reader.ReadUInt16();
  4466. Level = reader.ReadByte();
  4467. Key = reader.ReadByte();
  4468. Experience = reader.ReadUInt16();
  4469. Delay = reader.ReadInt64();
  4470. Range = reader.ReadByte();
  4471. CastTime = reader.ReadInt64();
  4472. }
  4473. public void Save(BinaryWriter writer)
  4474. {
  4475. writer.Write((byte)Spell);
  4476. writer.Write(BaseCost);
  4477. writer.Write(LevelCost);
  4478. writer.Write(Icon);
  4479. writer.Write(Level1);
  4480. writer.Write(Level2);
  4481. writer.Write(Level3);
  4482. writer.Write(Need1);
  4483. writer.Write(Need2);
  4484. writer.Write(Need3);
  4485. writer.Write(Level);
  4486. writer.Write(Key);
  4487. writer.Write(Experience);
  4488. writer.Write(Delay);
  4489. writer.Write(Range);
  4490. writer.Write(CastTime);
  4491. }
  4492. }
  4493. public class ClientAuction
  4494. {
  4495. public ulong AuctionID;
  4496. public UserItem Item;
  4497. public string Seller = string.Empty;
  4498. public uint Price;
  4499. public DateTime ConsignmentDate;
  4500. public bool IsUseGold;
  4501. public string Message;
  4502. public bool isSold, isGetBack;
  4503. public ClientAuction()
  4504. {
  4505. }
  4506. public ClientAuction(BinaryReader reader)
  4507. {
  4508. AuctionID = reader.ReadUInt64();
  4509. Item = new UserItem(reader);
  4510. Seller = reader.ReadString();
  4511. Price = reader.ReadUInt32();
  4512. ConsignmentDate = DateTime.FromBinary(reader.ReadInt64());
  4513. IsUseGold=reader.ReadBoolean();
  4514. Message = reader.ReadString();
  4515. }
  4516. public void Save(BinaryWriter writer)
  4517. {
  4518. writer.Write(AuctionID);
  4519. Item.Save(writer);
  4520. writer.Write(Seller);
  4521. writer.Write(Price);
  4522. writer.Write(ConsignmentDate.ToBinary());
  4523. writer.Write(IsUseGold);
  4524. writer.Write(Message==null?"":Message);
  4525. }
  4526. }
  4527. public class GClientAuction
  4528. {
  4529. public ulong AuctionID;
  4530. public string Seller = string.Empty;
  4531. public int Price;
  4532. public DateTime ConsignmentDate;
  4533. public GClientAuction()
  4534. {
  4535. }
  4536. public GClientAuction(BinaryReader reader)
  4537. {
  4538. AuctionID = reader.ReadUInt64();
  4539. Seller = reader.ReadString();
  4540. Price = reader.ReadInt32();
  4541. ConsignmentDate = DateTime.FromBinary(reader.ReadInt64());
  4542. }
  4543. public void Save(BinaryWriter writer)
  4544. {
  4545. writer.Write(AuctionID);
  4546. writer.Write(Seller);
  4547. writer.Write(Price);
  4548. writer.Write(ConsignmentDate.ToBinary());
  4549. }
  4550. }
  4551. public class ClientQuestInfo
  4552. {
  4553. public int Index;
  4554. public uint NPCIndex;
  4555. public string Name, Group;
  4556. public List<string> Description = new List<string>();
  4557. public List<string> TaskDescription = new List<string>();
  4558. public List<string> CompletionDescription = new List<string>();
  4559. public int MinLevelNeeded, MaxLevelNeeded;
  4560. public int QuestNeeded;
  4561. public RequiredClass ClassNeeded;
  4562. public int GenderNeeded;
  4563. public QuestType Type;
  4564. public uint RewardGold;
  4565. public uint RewardExp;
  4566. public uint RewardCredit;
  4567. public List<QuestItemReward> RewardsFixedItem = new List<QuestItemReward>();
  4568. public List<QuestItemReward> RewardsSelectItem = new List<QuestItemReward>();
  4569. public List<QuestItemReward> RewardRandomItem =new List<QuestItemReward>();
  4570. public uint FinishNPCIndex;
  4571. public List<string> KillTaskNames = new List<string>();
  4572. public List<int> KillTaskCounts=new List<int>();
  4573. public List<string> ItemTaskNames=new List<string>();
  4574. public List<int> ItemTaskCounts = new List<int>();
  4575. public DateTime SeasonStartTime=DateTime.Now;
  4576. public DateTime SeasonEndTime=DateTime.Now;
  4577. public bool SameFinishNPC
  4578. {
  4579. get { return NPCIndex == FinishNPCIndex; }
  4580. }
  4581. public ClientQuestInfo() { }
  4582. public ClientQuestInfo(BinaryReader reader)
  4583. {
  4584. Index = reader.ReadInt32();
  4585. NPCIndex = reader.ReadUInt32();
  4586. Name = reader.ReadString();
  4587. Group = reader.ReadString();
  4588. int count = reader.ReadInt32();
  4589. for (int i = 0; i < count; i++)
  4590. Description.Add(reader.ReadString());
  4591. count = reader.ReadInt32();
  4592. for (int i = 0; i < count; i++)
  4593. TaskDescription.Add(reader.ReadString());
  4594. count = reader.ReadInt32();
  4595. for (int i = 0; i < count; i++)
  4596. CompletionDescription.Add(reader.ReadString());
  4597. MinLevelNeeded = reader.ReadInt32();
  4598. MaxLevelNeeded = reader.ReadInt32();
  4599. QuestNeeded = reader.ReadInt32();
  4600. ClassNeeded = (RequiredClass)reader.ReadByte();
  4601. GenderNeeded = reader.ReadInt32();
  4602. Type = (QuestType)reader.ReadByte();
  4603. RewardGold = reader.ReadUInt32();
  4604. RewardExp = reader.ReadUInt32();
  4605. RewardCredit = reader.ReadUInt32();
  4606. count = reader.ReadInt32();
  4607. for (int i = 0; i < count; i++)
  4608. RewardsFixedItem.Add(new QuestItemReward(reader));
  4609. count = reader.ReadInt32();
  4610. for (int i = 0; i < count; i++)
  4611. RewardsSelectItem.Add(new QuestItemReward(reader));
  4612. FinishNPCIndex = reader.ReadUInt32();
  4613. count = reader.ReadInt32();
  4614. for (int i = 0; i < count; i++)
  4615. RewardRandomItem.Add(new QuestItemReward(reader));
  4616. count = reader.ReadInt32();
  4617. for (int i = 0; i < count; i++)
  4618. KillTaskNames.Add(reader.ReadString());
  4619. count= reader.ReadInt32();
  4620. for (int i = 0; i < count; i++)
  4621. KillTaskCounts.Add(reader.ReadInt32());
  4622. count = reader.ReadInt32();
  4623. for (int i = 0; i < count; i++)
  4624. ItemTaskNames.Add(reader.ReadString());
  4625. count = reader.ReadInt32();
  4626. for (int i = 0; i < count; i++)
  4627. ItemTaskCounts.Add(reader.ReadInt32());
  4628. SeasonStartTime = DateTime.FromBinary(reader.ReadInt64());
  4629. SeasonEndTime = DateTime.FromBinary(reader.ReadInt64());
  4630. }
  4631. public void Save(BinaryWriter writer)
  4632. {
  4633. writer.Write(Index);
  4634. writer.Write(NPCIndex);
  4635. writer.Write(Name);
  4636. writer.Write(Group);
  4637. writer.Write(Description.Count);
  4638. for (int i = 0; i < Description.Count; i++)
  4639. writer.Write(Description[i]);
  4640. writer.Write(TaskDescription.Count);
  4641. for (int i = 0; i < TaskDescription.Count; i++)
  4642. writer.Write(TaskDescription[i]);
  4643. writer.Write(CompletionDescription.Count);
  4644. for (int i = 0; i < CompletionDescription.Count; i++)
  4645. writer.Write(CompletionDescription[i]);
  4646. writer.Write(MinLevelNeeded);
  4647. writer.Write(MaxLevelNeeded);
  4648. writer.Write(QuestNeeded);
  4649. writer.Write((byte)ClassNeeded);
  4650. writer.Write(GenderNeeded);
  4651. writer.Write((byte)Type);
  4652. writer.Write(RewardGold);
  4653. writer.Write(RewardExp);
  4654. writer.Write(RewardCredit);
  4655. writer.Write(RewardsFixedItem.Count);
  4656. for (int i = 0; i < RewardsFixedItem.Count; i++)
  4657. RewardsFixedItem[i].Save(writer);
  4658. writer.Write(RewardsSelectItem.Count);
  4659. for (int i = 0; i < RewardsSelectItem.Count; i++)
  4660. RewardsSelectItem[i].Save(writer);
  4661. writer.Write(FinishNPCIndex);
  4662. writer.Write(RewardRandomItem.Count);
  4663. for (int i = 0; i < RewardRandomItem.Count; i++)
  4664. RewardRandomItem[i].Save(writer);
  4665. writer.Write(KillTaskNames.Count);
  4666. for (int i = 0; i < KillTaskNames.Count; i++)
  4667. writer.Write(KillTaskNames[i]);
  4668. writer.Write(KillTaskCounts.Count);
  4669. for (int i = 0; i < KillTaskCounts.Count; i++)
  4670. writer.Write(KillTaskCounts[i]);
  4671. writer.Write(ItemTaskNames.Count);
  4672. for (int i = 0; i < ItemTaskNames.Count; i++)
  4673. writer.Write(ItemTaskNames[i]);
  4674. writer.Write(ItemTaskCounts.Count);
  4675. for (int i = 0; i < ItemTaskCounts.Count; i++)
  4676. writer.Write(ItemTaskCounts[i]);
  4677. writer.Write(SeasonStartTime.ToBinary());
  4678. writer.Write(SeasonEndTime.ToBinary());
  4679. }
  4680. public QuestIcon GetQuestIcon(bool taken = false, bool completed = false)
  4681. {
  4682. QuestIcon icon = QuestIcon.None;
  4683. switch (Type)
  4684. {
  4685. case QuestType.General:
  4686. case QuestType.Repeatable:
  4687. if (completed)
  4688. icon = QuestIcon.QuestionYellow;
  4689. else if (taken)
  4690. icon = QuestIcon.QuestionWhite;
  4691. else
  4692. icon = QuestIcon.ExclamationYellow;
  4693. break;
  4694. case QuestType.Season:
  4695. case QuestType.Daily:
  4696. case QuestType.Random:
  4697. if (completed)
  4698. icon = QuestIcon.QuestionBlue;
  4699. else if (taken)
  4700. icon = QuestIcon.QuestionWhite;
  4701. else
  4702. icon = QuestIcon.ExclamationBlue;
  4703. break;
  4704. case QuestType.Story:
  4705. if (completed)
  4706. icon = QuestIcon.QuestionGreen;
  4707. else if (taken)
  4708. icon = QuestIcon.QuestionWhite;
  4709. else
  4710. icon = QuestIcon.ExclamationGreen;
  4711. break;
  4712. }
  4713. return icon;
  4714. }
  4715. }
  4716. public class ClientQuestProgress
  4717. {
  4718. public int Id;
  4719. public ClientQuestInfo QuestInfo;
  4720. public List<string> TaskList = new List<string>();
  4721. public bool Taken;
  4722. public bool Completed;
  4723. public bool New;
  4724. public QuestIcon Icon
  4725. {
  4726. get
  4727. {
  4728. return QuestInfo.GetQuestIcon(Taken, Completed);
  4729. }
  4730. }
  4731. public ClientQuestProgress() { }
  4732. public ClientQuestProgress(BinaryReader reader)
  4733. {
  4734. Id = reader.ReadInt32();
  4735. int count = reader.ReadInt32();
  4736. for (int i = 0; i < count; i++)
  4737. TaskList.Add(reader.ReadString());
  4738. Taken = reader.ReadBoolean();
  4739. Completed = reader.ReadBoolean();
  4740. New = reader.ReadBoolean();
  4741. }
  4742. public void Save(BinaryWriter writer)
  4743. {
  4744. writer.Write(Id);
  4745. writer.Write(TaskList.Count);
  4746. for (int i = 0; i < TaskList.Count; i++)
  4747. writer.Write(TaskList[i]);
  4748. writer.Write(Taken);
  4749. writer.Write(Completed);
  4750. writer.Write(New);
  4751. }
  4752. }
  4753. public class QuestItemReward
  4754. {
  4755. public ItemInfo Item;
  4756. public uint Count = 1;
  4757. public uint Power = 0;
  4758. public QuestItemReward() { }
  4759. public QuestItemReward(BinaryReader reader)
  4760. {
  4761. Item = new ItemInfo(reader);
  4762. Count = reader.ReadUInt32();
  4763. Power = reader.ReadUInt32();
  4764. }
  4765. public void Save(BinaryWriter writer)
  4766. {
  4767. Item.Save(writer);
  4768. writer.Write(Count);
  4769. writer.Write(Power);
  4770. }
  4771. public override string ToString()
  4772. {
  4773. return Item==null?"空":Item.Name;
  4774. }
  4775. }
  4776. public class ClientMail
  4777. {
  4778. public ulong MailID;
  4779. public string SenderName;
  4780. public string Message;
  4781. public bool Opened, Locked, CanReply, Collected;
  4782. public DateTime DateSent;
  4783. public uint Gold;
  4784. public List<UserItem> Items = new List<UserItem>();
  4785. public ClientMail() { }
  4786. public ClientMail(BinaryReader reader)
  4787. {
  4788. MailID = reader.ReadUInt64();
  4789. SenderName = reader.ReadString();
  4790. Message = reader.ReadString();
  4791. Opened = reader.ReadBoolean();
  4792. Locked = reader.ReadBoolean();
  4793. CanReply = reader.ReadBoolean();
  4794. Collected = reader.ReadBoolean();
  4795. DateSent = DateTime.FromBinary(reader.ReadInt64());
  4796. Gold = reader.ReadUInt32();
  4797. int count = reader.ReadInt32();
  4798. for (int i = 0; i < count; i++)
  4799. Items.Add(new UserItem(reader));
  4800. }
  4801. public void Save(BinaryWriter writer)
  4802. {
  4803. writer.Write(MailID);
  4804. writer.Write(SenderName);
  4805. writer.Write(Message);
  4806. writer.Write(Opened);
  4807. writer.Write(Locked);
  4808. writer.Write(CanReply);
  4809. writer.Write(Collected);
  4810. writer.Write(DateSent.ToBinary());
  4811. writer.Write(Gold);
  4812. writer.Write(Items.Count);
  4813. for (int i = 0; i < Items.Count; i++)
  4814. Items[i].Save(writer);
  4815. }
  4816. }
  4817. public class ClientFriend
  4818. {
  4819. public int Index;
  4820. public string Name;
  4821. public string Memo = "";
  4822. public bool Blocked;
  4823. public bool Online;
  4824. public int Level;
  4825. public string LoacateMap;
  4826. public ClientFriend() { }
  4827. public ClientFriend(BinaryReader reader)
  4828. {
  4829. Index = reader.ReadInt32();
  4830. Name = reader.ReadString();
  4831. Memo = reader.ReadString();
  4832. Blocked = reader.ReadBoolean();
  4833. Online = reader.ReadBoolean();
  4834. Level = reader.ReadInt32();
  4835. LoacateMap = reader.ReadString();
  4836. }
  4837. public void Save(BinaryWriter writer)
  4838. {
  4839. writer.Write(Index);
  4840. writer.Write(Name);
  4841. writer.Write(Memo);
  4842. writer.Write(Blocked);
  4843. writer.Write(Online);
  4844. writer.Write(Level);
  4845. writer.Write(LoacateMap);
  4846. }
  4847. }
  4848. public enum IntelligentCreaturePickupMode : byte
  4849. {
  4850. Automatic = 0,
  4851. SemiAutomatic = 1,
  4852. }
  4853. public class IntelligentCreatureRules
  4854. {
  4855. public int MinimalFullness = 1;
  4856. public bool MousePickupEnabled = false;
  4857. public int MousePickupRange = 0;
  4858. public bool AutoPickupEnabled = false;
  4859. public int AutoPickupRange = 0;
  4860. public bool SemiAutoPickupEnabled = false;
  4861. public int SemiAutoPickupRange = 0;
  4862. public bool CanProduceBlackStone = false;
  4863. public string Info = "";
  4864. public string Info1 = "";
  4865. public string Info2 = "";
  4866. public IntelligentCreatureRules()
  4867. {
  4868. }
  4869. public IntelligentCreatureRules(BinaryReader reader)
  4870. {
  4871. MinimalFullness = reader.ReadInt32();
  4872. MousePickupEnabled = reader.ReadBoolean();
  4873. MousePickupRange = reader.ReadInt32();
  4874. AutoPickupEnabled = reader.ReadBoolean();
  4875. AutoPickupRange = reader.ReadInt32();
  4876. SemiAutoPickupEnabled = reader.ReadBoolean();
  4877. SemiAutoPickupRange = reader.ReadInt32();
  4878. CanProduceBlackStone = reader.ReadBoolean();
  4879. Info = reader.ReadString();
  4880. Info1 = reader.ReadString();
  4881. Info2 = reader.ReadString();
  4882. }
  4883. public void Save(BinaryWriter writer)
  4884. {
  4885. writer.Write(MinimalFullness);
  4886. writer.Write(MousePickupEnabled);
  4887. writer.Write(MousePickupRange);
  4888. writer.Write(AutoPickupEnabled);
  4889. writer.Write(AutoPickupRange);
  4890. writer.Write(SemiAutoPickupEnabled);
  4891. writer.Write(SemiAutoPickupRange);
  4892. writer.Write(CanProduceBlackStone);
  4893. writer.Write(Info);
  4894. writer.Write(Info1);
  4895. writer.Write(Info2);
  4896. }
  4897. }
  4898. public class IntelligentCreatureItemFilter
  4899. {
  4900. public bool PetPickupAll = true;
  4901. public bool PetPickupGold = false;
  4902. public bool PetPickupWeapons = false;
  4903. public bool PetPickupArmours = false;
  4904. public bool PetPickupHelmets = false;
  4905. public bool PetPickupBoots = false;
  4906. public bool PetPickupBelts = false;
  4907. public bool PetPickupAccessories = false;
  4908. public bool PetPickupOthers = false;
  4909. public ItemGrade PickupGrade = ItemGrade.None;
  4910. public IntelligentCreatureItemFilter()
  4911. {
  4912. }
  4913. public void SetItemFilter(int idx)
  4914. {
  4915. switch (idx)
  4916. {
  4917. case 0://all items
  4918. PetPickupAll = true;
  4919. PetPickupGold = false;
  4920. PetPickupWeapons = false;
  4921. PetPickupArmours = false;
  4922. PetPickupHelmets = false;
  4923. PetPickupBoots = false;
  4924. PetPickupBelts = false;
  4925. PetPickupAccessories = false;
  4926. PetPickupOthers = false;
  4927. break;
  4928. case 1://gold
  4929. PetPickupAll = false;
  4930. PetPickupGold = !PetPickupGold;
  4931. break;
  4932. case 2://weapons
  4933. PetPickupAll = false;
  4934. PetPickupWeapons = !PetPickupWeapons;
  4935. break;
  4936. case 3://armours
  4937. PetPickupAll = false;
  4938. PetPickupArmours = !PetPickupArmours;
  4939. break;
  4940. case 4://helmets
  4941. PetPickupAll = false;
  4942. PetPickupHelmets = !PetPickupHelmets;
  4943. break;
  4944. case 5://boots
  4945. PetPickupAll = false;
  4946. PetPickupBoots = !PetPickupBoots;
  4947. break;
  4948. case 6://belts
  4949. PetPickupAll = false;
  4950. PetPickupBelts = !PetPickupBelts;
  4951. break;
  4952. case 7://jewelry
  4953. PetPickupAll = false;
  4954. PetPickupAccessories = !PetPickupAccessories;
  4955. break;
  4956. case 8://others
  4957. PetPickupAll = false;
  4958. PetPickupOthers = !PetPickupOthers;
  4959. break;
  4960. }
  4961. if (PetPickupGold && PetPickupWeapons && PetPickupArmours && PetPickupHelmets && PetPickupBoots && PetPickupBelts && PetPickupAccessories && PetPickupOthers)
  4962. {
  4963. PetPickupAll = true;
  4964. PetPickupGold = false;
  4965. PetPickupWeapons = false;
  4966. PetPickupArmours = false;
  4967. PetPickupHelmets = false;
  4968. PetPickupBoots = false;
  4969. PetPickupBelts = false;
  4970. PetPickupAccessories = false;
  4971. PetPickupOthers = false;
  4972. }
  4973. else
  4974. if (!PetPickupGold && !PetPickupWeapons && !PetPickupArmours && !PetPickupHelmets && !PetPickupBoots && !PetPickupBelts && !PetPickupAccessories && !PetPickupOthers)
  4975. {
  4976. PetPickupAll = true;
  4977. }
  4978. }
  4979. public IntelligentCreatureItemFilter(BinaryReader reader)
  4980. {
  4981. PetPickupAll = reader.ReadBoolean();
  4982. PetPickupGold = reader.ReadBoolean();
  4983. PetPickupWeapons = reader.ReadBoolean();
  4984. PetPickupArmours = reader.ReadBoolean();
  4985. PetPickupHelmets = reader.ReadBoolean();
  4986. PetPickupBoots = reader.ReadBoolean();
  4987. PetPickupBelts = reader.ReadBoolean();
  4988. PetPickupAccessories = reader.ReadBoolean();
  4989. PetPickupOthers = reader.ReadBoolean();
  4990. //PickupGrade = (ItemGrade)reader.ReadByte();
  4991. }
  4992. public void Save(BinaryWriter writer)
  4993. {
  4994. writer.Write(PetPickupAll);
  4995. writer.Write(PetPickupGold);
  4996. writer.Write(PetPickupWeapons);
  4997. writer.Write(PetPickupArmours);
  4998. writer.Write(PetPickupHelmets);
  4999. writer.Write(PetPickupBoots);
  5000. writer.Write(PetPickupBelts);
  5001. writer.Write(PetPickupAccessories);
  5002. writer.Write(PetPickupOthers);
  5003. //writer.Write((byte)PickupGrade);
  5004. }
  5005. }
  5006. public class ClientIntelligentCreature
  5007. {
  5008. public IntelligentCreatureType PetType;
  5009. public int Icon;
  5010. public string CustomName;
  5011. public int Fullness;
  5012. public int SlotIndex;
  5013. public long ExpireTime;//in days
  5014. public long BlackstoneTime;
  5015. public long MaintainFoodTime;
  5016. public IntelligentCreaturePickupMode petMode = IntelligentCreaturePickupMode.SemiAutomatic;
  5017. public IntelligentCreatureRules CreatureRules;
  5018. public IntelligentCreatureItemFilter Filter;
  5019. public ClientIntelligentCreature()
  5020. {
  5021. }
  5022. public ClientIntelligentCreature(BinaryReader reader)
  5023. {
  5024. PetType = (IntelligentCreatureType)reader.ReadByte();
  5025. Icon = reader.ReadInt32();
  5026. CustomName = reader.ReadString();
  5027. Fullness = reader.ReadInt32();
  5028. SlotIndex = reader.ReadInt32();
  5029. ExpireTime = reader.ReadInt64();
  5030. BlackstoneTime = reader.ReadInt64();
  5031. petMode = (IntelligentCreaturePickupMode)reader.ReadByte();
  5032. CreatureRules = new IntelligentCreatureRules(reader);
  5033. Filter = new IntelligentCreatureItemFilter(reader);
  5034. Filter.PickupGrade = (ItemGrade)reader.ReadByte();
  5035. MaintainFoodTime = reader.ReadInt64();
  5036. }
  5037. public void Save(BinaryWriter writer)
  5038. {
  5039. writer.Write((byte)PetType);
  5040. writer.Write(Icon);
  5041. writer.Write(CustomName);
  5042. writer.Write(Fullness);
  5043. writer.Write(SlotIndex);
  5044. writer.Write(ExpireTime);
  5045. writer.Write(BlackstoneTime);
  5046. writer.Write((byte)petMode);
  5047. CreatureRules.Save(writer);
  5048. Filter.Save(writer);
  5049. writer.Write((byte)Filter.PickupGrade);
  5050. writer.Write(MaintainFoodTime);
  5051. }
  5052. }
  5053. public class ManagePacket
  5054. {
  5055. public string Type = "Lost";
  5056. public Object Data;
  5057. }
  5058. public class GiveItemPacket
  5059. {
  5060. public string ItemName;
  5061. public int Count;
  5062. public string PlayerName;
  5063. }
  5064. public class DeleteItemPacket
  5065. {
  5066. public ulong UniqueID;
  5067. public uint OwnerID;
  5068. public string Store;
  5069. }
  5070. public class SendItemToInventoryPacket
  5071. {
  5072. public ulong UniqueID;
  5073. public uint OwnerID;
  5074. public string Store;
  5075. }
  5076. public class SendItemToMailPacket
  5077. {
  5078. public ulong UniqueID;
  5079. public uint OwnerID;
  5080. public string Store;
  5081. }
  5082. public class EditDDropPacket
  5083. {
  5084. public uint PlayerID;
  5085. public int Value;
  5086. public string MonsterName;
  5087. }
  5088. public class EditItemPacket
  5089. {
  5090. public ulong UniqueID;
  5091. public uint OwnerID;
  5092. public string Store;
  5093. public string ItemName;
  5094. public int Position;
  5095. public int Count;
  5096. public int MC;
  5097. public int SC;
  5098. public int AC;
  5099. public int DC;
  5100. public int MAC;
  5101. public int Accuracy;
  5102. public int Agility;
  5103. public int BagWeight;
  5104. public int WearWeight;
  5105. public int HandWeight;
  5106. public int FireAC;
  5107. public int WindAC;
  5108. public int IceAC;
  5109. public int LightAC;
  5110. public int HolyAC;
  5111. public int DarkAC;
  5112. public int PhantomAC;
  5113. public int FireMAC;
  5114. public int WindMAC;
  5115. public int IceMAC;
  5116. public int LightMAC;
  5117. public int HolyMAC;
  5118. public int DarkMAC;
  5119. public int PhantomMAC;
  5120. public int IR;
  5121. public int IG;
  5122. public int IB;
  5123. public int WpLevelExp;
  5124. public int HP;
  5125. public int MP;
  5126. public int AttackSpeed;
  5127. public int Luck;
  5128. public int MagicResist;
  5129. public int PoisonResist;
  5130. public int HealthRecovery;
  5131. public int ManaRecovery;
  5132. public int PoisonRecovery;
  5133. public int CriticalRate;
  5134. public int CriticalDamage;
  5135. public int Freezing;
  5136. public int PoisonAttack;
  5137. public int RefineAdded;
  5138. public int Reflect;
  5139. public int MaxAcRate;
  5140. public int MaxMacRate;
  5141. public int Parry;
  5142. public int IgnoreAC;
  5143. public int IgnoreMAC;
  5144. public int DropProtect;
  5145. }
  5146. public class ManageMsgResult
  5147. {
  5148. public int StatusCode;
  5149. public string Message;
  5150. }
  5151. public class KickPlayerPacket
  5152. {
  5153. public uint PlayerID;
  5154. }
  5155. public class BanPlayerPacket
  5156. {
  5157. public string AccountID;
  5158. }
  5159. public class UnbanPlayerPacket
  5160. {
  5161. public string AccountID;
  5162. }
  5163. public class SendHookQuestionPacket
  5164. {
  5165. public string AccountID;
  5166. }
  5167. public class ChangeHookSuspicionLevelPacket
  5168. {
  5169. public string AccountID;
  5170. public int Value;
  5171. }
  5172. public class AddBannedAddressPacket
  5173. {
  5174. public int Type;
  5175. public string Address;
  5176. }
  5177. public abstract class Packet
  5178. {
  5179. // public static byte IsServer;
  5180. public static byte[] alive;
  5181. public static uint pid = 1;
  5182. public abstract ushort Index { get; }
  5183. internal uint PID = 0;
  5184. public Packet()
  5185. {
  5186. }
  5187. public static Packet GetPacket(ushort index)
  5188. {
  5189. if (index <= 30000)
  5190. {
  5191. return GetClientPacket(index);
  5192. }
  5193. else if (index <= 60000)
  5194. {
  5195. return GetServerPacket(index);
  5196. }
  5197. else
  5198. {
  5199. return GetCustomPacket(index);
  5200. }
  5201. }
  5202. public static Packet ReceivePacket(byte[] rawBytes, out byte[] extra)
  5203. {
  5204. extra = rawBytes;
  5205. Packet p;
  5206. if (rawBytes.Length < 4) return null; //| 2Bytes: Packet Size | 2Bytes: Packet ID |
  5207. int length = (rawBytes[1] << 8) + rawBytes[0];
  5208. if (length > rawBytes.Length || length < 2) return null;
  5209. using (MemoryStream stream = new MemoryStream(rawBytes, 2, length - 2))
  5210. using (BinaryReader reader = new BinaryReader(stream))
  5211. {
  5212. try
  5213. {
  5214. stream.Seek(1, SeekOrigin.Begin);
  5215. uint xh = reader.ReadUInt32();
  5216. ushort id = reader.ReadUInt16();
  5217. if (id == (ushort)ClientPacketIds.MoveShield)
  5218. {
  5219. Console.Write("AAA");
  5220. }
  5221. p = GetPacket(id);
  5222. if (p == null) return null;
  5223. p.PID = xh;
  5224. p.ReadPacket(reader);
  5225. }
  5226. catch
  5227. {
  5228. extra = new byte[0];
  5229. return null;
  5230. }
  5231. }
  5232. extra = new byte[rawBytes.Length - length];
  5233. System.Buffer.BlockCopy(rawBytes, length, extra, 0, rawBytes.Length - length);
  5234. return p;
  5235. }
  5236. public IEnumerable<byte> GetPacketBytes(object peer = null)
  5237. {
  5238. if (Index < 0) return new byte[0];
  5239. byte[] data;
  5240. using (MemoryStream stream = new MemoryStream())
  5241. {
  5242. stream.SetLength(2);
  5243. stream.Seek(2, SeekOrigin.Begin);
  5244. using (BinaryWriter writer = new BinaryWriter(stream))
  5245. {
  5246. writer.Write((byte)0);
  5247. if (PID == 0) PID = pid++;
  5248. writer.Write(PID);
  5249. writer.Write(Index);
  5250. WritePacket(writer);
  5251. stream.Seek(0, SeekOrigin.Begin);
  5252. writer.Write((short)stream.Length);
  5253. stream.Seek(0, SeekOrigin.Begin);
  5254. data = new byte[stream.Length];
  5255. stream.Read(data, 0, data.Length);
  5256. aliveData(data, (byte[])peer);
  5257. }
  5258. }
  5259. return data;
  5260. }
  5261. protected void aliveData(byte[] ak, byte[] peer)
  5262. {
  5263. byte[] student;
  5264. if (Index > 30000)
  5265. {
  5266. return;
  5267. }
  5268. else
  5269. {
  5270. student = peer == null ? alive : peer;
  5271. }
  5272. if (student == null)
  5273. {
  5274. return;
  5275. }
  5276. else
  5277. {
  5278. ak[2] = 1;
  5279. // byte car = 0;
  5280. for (int i = 3; i < ak.Length; i++)
  5281. {
  5282. // car = (byte)(ak[i] ^ car);
  5283. ak[i] = (byte)(ak[i] ^ student[i % 8]);
  5284. }
  5285. // ak[ak.Length] = (byte)(car ^ student[4] ^ student[5]);
  5286. }
  5287. }
  5288. protected void setAlive(byte[] value)
  5289. {
  5290. setAlive(value);
  5291. }
  5292. protected abstract void ReadPacket(BinaryReader reader);
  5293. protected abstract void WritePacket(BinaryWriter writer);
  5294. //服务端获得数据包并返回数据包函数
  5295. private static Packet GetClientPacket(ushort index)
  5296. {
  5297. //if (index != (short)ClientPacketIds.KeepAlive && index != (short)ClientPacketIds.PickUp)
  5298. //{
  5299. // Console.WriteLine("111");
  5300. //}
  5301. switch (index)
  5302. {
  5303. case (ushort)ClientPacketIds.ClientVersion:
  5304. return new C.ClientVersion();
  5305. case (ushort)ClientPacketIds.Disconnect:
  5306. return new C.Disconnect();
  5307. case (ushort)ClientPacketIds.KeepAlive:
  5308. return new C.KeepAlive();
  5309. case (ushort)ClientPacketIds.EnterAlive:
  5310. return new C.EnterAlive();
  5311. case (ushort)ClientPacketIds.NewAccount:
  5312. return new C.NewAccount();
  5313. case (ushort)ClientPacketIds.ChangePassword:
  5314. return new C.ChangePassword();
  5315. case (ushort)ClientPacketIds.Login:
  5316. return new C.Login();
  5317. case (ushort)ClientPacketIds.LoginAccount:
  5318. return new C.LoginAccount();
  5319. case (ushort)ClientPacketIds.NewCharacter:
  5320. return new C.NewCharacter();
  5321. case (ushort)ClientPacketIds.DeleteCharacter:
  5322. return new C.DeleteCharacter();
  5323. case (ushort)ClientPacketIds.StartGame:
  5324. return new C.StartGame();
  5325. case (ushort)ClientPacketIds.LogOut:
  5326. return new C.LogOut();
  5327. case (ushort)ClientPacketIds.Turn:
  5328. return new C.Turn();
  5329. case (ushort)ClientPacketIds.Walk:
  5330. return new C.Walk();
  5331. case (ushort)ClientPacketIds.Run:
  5332. return new C.Run();
  5333. case (ushort)ClientPacketIds.Chat:
  5334. return new C.Chat();
  5335. case (ushort)ClientPacketIds.MoveItem:
  5336. return new C.MoveItem();
  5337. case (ushort)ClientPacketIds.StoreItem:
  5338. return new C.StoreItem();
  5339. case (ushort)ClientPacketIds.SendStorPassword:
  5340. return new C.SendStorPassword();
  5341. case (ushort)ClientPacketIds.SetStorPassword:
  5342. return new C.SetStorPassword();
  5343. case (ushort)ClientPacketIds.CancelPassword:
  5344. return new C.CancelPassword();
  5345. case (ushort)ClientPacketIds.BuyStorage:
  5346. return new C.BuyStorage();
  5347. case (ushort)ClientPacketIds.UseHorn:
  5348. return new C.UseHorn();
  5349. case (ushort)ClientPacketIds.TakeBackItem:
  5350. return new C.TakeBackItem();
  5351. case (ushort)ClientPacketIds.MergeItem:
  5352. return new C.MergeItem();
  5353. case (ushort)ClientPacketIds.EquipItem:
  5354. return new C.EquipItem();
  5355. case (ushort)ClientPacketIds.RemoveItem:
  5356. return new C.RemoveItem();
  5357. case (ushort)ClientPacketIds.RemoveSlotItem:
  5358. return new C.RemoveSlotItem();
  5359. case (ushort)ClientPacketIds.SplitItem:
  5360. return new C.SplitItem();
  5361. case (ushort)ClientPacketIds.UseItem:
  5362. return new C.UseItem();
  5363. case (ushort)ClientPacketIds.DropItem:
  5364. return new C.DropItem();
  5365. case (ushort)ClientPacketIds.DepositRefineItem:
  5366. return new C.DepositRefineItem();
  5367. case (ushort)ClientPacketIds.RetrieveRefineItem:
  5368. return new C.RetrieveRefineItem();
  5369. case (ushort)ClientPacketIds.RefineCancel:
  5370. return new C.RefineCancel();
  5371. case (ushort)ClientPacketIds.RefineItem:
  5372. return new C.RefineItem();
  5373. case (ushort)ClientPacketIds.CheckRefine:
  5374. return new C.CheckRefine();
  5375. case (ushort)ClientPacketIds.ReplaceWedRing:
  5376. return new C.ReplaceWedRing();
  5377. case (ushort)ClientPacketIds.DepositTradeItem:
  5378. return new C.DepositTradeItem();
  5379. case (ushort)ClientPacketIds.RetrieveTradeItem:
  5380. return new C.RetrieveTradeItem();
  5381. case (ushort)ClientPacketIds.DropGold:
  5382. return new C.DropGold();
  5383. case (ushort)ClientPacketIds.PickUp:
  5384. return new C.PickUp();
  5385. case (ushort)ClientPacketIds.Inspect:
  5386. return new C.Inspect();
  5387. case (ushort)ClientPacketIds.ChangeAMode:
  5388. return new C.ChangeAMode();
  5389. case (ushort)ClientPacketIds.ChangePMode:
  5390. return new C.ChangePMode();
  5391. case (ushort)ClientPacketIds.ChangeHelmetoff:
  5392. return new C.ChangeHelmetoff();
  5393. case (ushort)ClientPacketIds.ChangeTrade:
  5394. return new C.ChangeTrade();
  5395. case (ushort)ClientPacketIds.Attack:
  5396. return new C.Attack();
  5397. case (ushort)ClientPacketIds.RangeAttack:
  5398. return new C.RangeAttack();
  5399. case (ushort)ClientPacketIds.Harvest:
  5400. return new C.Harvest();
  5401. case (ushort)ClientPacketIds.CallNPC:
  5402. return new C.CallNPC();
  5403. case (ushort)ClientPacketIds.TalkMonsterNPC:
  5404. return new C.TalkMonsterNPC();
  5405. case (ushort)ClientPacketIds.BuyItem:
  5406. return new C.BuyItem();
  5407. case (ushort)ClientPacketIds.GetSelectItem:
  5408. return new C.GetSelectItem();
  5409. case (ushort)ClientPacketIds.SellItem:
  5410. return new C.SellItem();
  5411. case (ushort)ClientPacketIds.RepairItem:
  5412. return new C.RepairItem();
  5413. case (ushort)ClientPacketIds.BuyItemBack:
  5414. return new C.BuyItemBack();
  5415. case (ushort)ClientPacketIds.GetAllhp:
  5416. return new C.GetAllhp();
  5417. case (ushort)ClientPacketIds.FindItem:
  5418. return new C.FindItem();
  5419. case (ushort)ClientPacketIds.PoisonChangaChanged:
  5420. return new C.PoisonChangaChanged();
  5421. case (ushort)ClientPacketIds.SRepairItem:
  5422. return new C.SRepairItem();
  5423. case (ushort)ClientPacketIds.MagicKey:
  5424. return new C.MagicKey();
  5425. case (ushort)ClientPacketIds.Magic:
  5426. return new C.Magic();
  5427. case (ushort)ClientPacketIds.SwitchGroup:
  5428. return new C.SwitchGroup();
  5429. case (ushort)ClientPacketIds.AddMember:
  5430. return new C.AddMember();
  5431. case (ushort)ClientPacketIds.DellMember:
  5432. return new C.DelMember();
  5433. case (ushort)ClientPacketIds.GroupInvite:
  5434. return new C.GroupInvite();
  5435. case (ushort)ClientPacketIds.TownRevive:
  5436. return new C.TownRevive();
  5437. case (ushort)ClientPacketIds.SpellToggle:
  5438. return new C.SpellToggle();
  5439. case (ushort)ClientPacketIds.ConsignItem:
  5440. return new C.ConsignItem();
  5441. case (ushort)ClientPacketIds.MarketSearch:
  5442. return new C.MarketSearch();
  5443. case (ushort)ClientPacketIds.MarketSearch2:
  5444. return new C.MarketSearch2();
  5445. case (ushort)ClientPacketIds.ItemAuctionSearch:
  5446. return new C.ItemAuctionSearch();
  5447. case (ushort)ClientPacketIds.MyAuctionSearch:
  5448. return new C.MyAuctionSearch();
  5449. case (ushort)ClientPacketIds.MarketGroupSearch:
  5450. return new C.MarketGroupSearch();
  5451. case (ushort)ClientPacketIds.GameShopSearch:
  5452. return new C.GameShopSearch();
  5453. case (ushort)ClientPacketIds.ExchangeSend:
  5454. return new C.ExchangeSend();
  5455. case (ushort)ClientPacketIds.MACUpgradeSend:
  5456. return new C.MACUpgradeSend();
  5457. case (ushort)ClientPacketIds.ClearMACUpgradeSend:
  5458. return new C.ClearMACUpgradeSend();
  5459. case (ushort)ClientPacketIds.DropProtectUpgradeSend:
  5460. return new C.DropProtectUpgradeSend();
  5461. case (ushort)ClientPacketIds.BuyGameShopItem:
  5462. return new C.BuyGameShopItem();
  5463. case (ushort)ClientPacketIds.MarketRefresh:
  5464. return new C.MarketRefresh();
  5465. case (ushort)ClientPacketIds.MarketPage:
  5466. return new C.MarketPage();
  5467. case (ushort)ClientPacketIds.MarketBuy:
  5468. return new C.MarketBuy();
  5469. case (ushort)ClientPacketIds.MarketGetBack:
  5470. return new C.MarketGetBack();
  5471. case (ushort)ClientPacketIds.RequestUserName:
  5472. return new C.RequestUserName();
  5473. case (ushort)ClientPacketIds.RequestChatItem:
  5474. return new C.RequestChatItem();
  5475. case (ushort)ClientPacketIds.HookQuestionRespose:
  5476. return new C.HookQuestionRespose();
  5477. case (ushort)ClientPacketIds.EditGuildMember:
  5478. return new C.EditGuildMember();
  5479. case (ushort)ClientPacketIds.GetAllGuild:
  5480. return new C.GetAllGuild();
  5481. case (ushort)ClientPacketIds.GetAllJoinRequest:
  5482. return new C.GetAllJoinRequest();
  5483. case (ushort)ClientPacketIds.ResposeJoinGuild:
  5484. return new C.ResposeJoinGuild();
  5485. case (ushort)ClientPacketIds.RequestJoinGuild:
  5486. return new C.RequestJoinGuild();
  5487. case (ushort)ClientPacketIds.EditGuildNotice:
  5488. return new C.EditGuildNotice();
  5489. case (ushort)ClientPacketIds.GuildInvite:
  5490. return new C.GuildInvite();
  5491. case (ushort)ClientPacketIds.GuildNameReturn:
  5492. return new C.GuildNameReturn();
  5493. case (ushort)ClientPacketIds.RequestGuildInfo:
  5494. return new C.RequestGuildInfo();
  5495. case (ushort)ClientPacketIds.GuildStorageGoldChange:
  5496. return new C.GuildStorageGoldChange();
  5497. case (ushort)ClientPacketIds.GuildStorageItemChange:
  5498. return new C.GuildStorageItemChange();
  5499. case (ushort)ClientPacketIds.GuildWarReturn:
  5500. return new C.GuildWarReturn();
  5501. case (ushort)ClientPacketIds.MarriageRequest:
  5502. return new C.MarriageRequest();
  5503. case (ushort)ClientPacketIds.MarriageReply:
  5504. return new C.MarriageReply();
  5505. case (ushort)ClientPacketIds.ChangeMarriage:
  5506. return new C.ChangeMarriage();
  5507. case (ushort)ClientPacketIds.ChangeName:
  5508. return new C.ChangeName();
  5509. case (ushort)ClientPacketIds.DivorceRequest:
  5510. return new C.DivorceRequest();
  5511. case (ushort)ClientPacketIds.DivorceReply:
  5512. return new C.DivorceReply();
  5513. case (ushort)ClientPacketIds.AddMentor:
  5514. return new C.AddMentor();
  5515. case (ushort)ClientPacketIds.MentorReply:
  5516. return new C.MentorReply();
  5517. case (ushort)ClientPacketIds.AllowMentor:
  5518. return new C.AllowMentor();
  5519. case (ushort)ClientPacketIds.CancelMentor:
  5520. return new C.CancelMentor();
  5521. case (ushort)ClientPacketIds.TradeRequest:
  5522. return new C.TradeRequest();
  5523. case (ushort)ClientPacketIds.TradeReply:
  5524. return new C.TradeReply();
  5525. case (ushort)ClientPacketIds.TradeGold:
  5526. return new C.TradeGold();
  5527. case (ushort)ClientPacketIds.TradeConfirm:
  5528. return new C.TradeConfirm();
  5529. case (ushort)ClientPacketIds.TradeCancel:
  5530. return new C.TradeCancel();
  5531. case (ushort)ClientPacketIds.EquipSlotItem:
  5532. return new C.EquipSlotItem();
  5533. case (ushort)ClientPacketIds.FishingCast:
  5534. return new C.FishingCast();
  5535. case (ushort)ClientPacketIds.FishingChangeAutocast:
  5536. return new C.FishingChangeAutocast();
  5537. case (ushort)ClientPacketIds.AcceptQuest:
  5538. return new C.AcceptQuest();
  5539. case (ushort)ClientPacketIds.FinishQuest:
  5540. return new C.FinishQuest();
  5541. case (ushort)ClientPacketIds.AbandonQuest:
  5542. return new C.AbandonQuest();
  5543. case (ushort)ClientPacketIds.ShareQuest:
  5544. return new C.ShareQuest();
  5545. case (ushort)ClientPacketIds.AcceptReincarnation:
  5546. return new C.AcceptReincarnation();
  5547. case (ushort)ClientPacketIds.CancelReincarnation:
  5548. return new C.CancelReincarnation();
  5549. case (ushort)ClientPacketIds.CombineItem:
  5550. return new C.CombineItem();
  5551. case (ushort)ClientPacketIds.SetConcentration:
  5552. return new C.SetConcentration();
  5553. case (ushort)ClientPacketIds.AwakeningNeedMaterials:
  5554. return new C.AwakeningNeedMaterials();
  5555. case (ushort)ClientPacketIds.DropProtectNeedMaterials:
  5556. return new C.DropProtectNeedMaterials();
  5557. case (ushort)ClientPacketIds.AwakeningLockedItem:
  5558. return new C.AwakeningLockedItem();
  5559. case (ushort)ClientPacketIds.Awakening:
  5560. return new C.Awakening();
  5561. case (ushort)ClientPacketIds.UnAwakening:
  5562. return new C.UnAwakening();
  5563. case (ushort)ClientPacketIds.DisassembleItem:
  5564. return new C.DisassembleItem();
  5565. case (ushort)ClientPacketIds.DowngradeAwakening:
  5566. return new C.DowngradeAwakening();
  5567. case (ushort)ClientPacketIds.ResetAddedItem:
  5568. return new C.ResetAddedItem();
  5569. case (ushort)ClientPacketIds.SendMail:
  5570. return new C.SendMail();
  5571. case (ushort)ClientPacketIds.ReadMail:
  5572. return new C.ReadMail();
  5573. case (ushort)ClientPacketIds.CollectParcel:
  5574. return new C.CollectParcel();
  5575. case (ushort)ClientPacketIds.DeleteMail:
  5576. return new C.DeleteMail();
  5577. case (ushort)ClientPacketIds.LockMail:
  5578. return new C.LockMail();
  5579. case (ushort)ClientPacketIds.MailLockedItem:
  5580. return new C.MailLockedItem();
  5581. case (ushort)ClientPacketIds.MailCost:
  5582. return new C.MailCost();
  5583. case (ushort)ClientPacketIds.UpdateIntelligentCreature://IntelligentCreature
  5584. return new C.UpdateIntelligentCreature();
  5585. case (ushort)ClientPacketIds.IntelligentCreaturePickup://IntelligentCreature
  5586. return new C.IntelligentCreaturePickup();
  5587. case (ushort)ClientPacketIds.AddFriend:
  5588. return new C.AddFriend();
  5589. case (ushort)ClientPacketIds.AddFriendRespose:
  5590. return new C.AddFriendRespose();
  5591. case (ushort)ClientPacketIds.RemoveFriend:
  5592. return new C.RemoveFriend();
  5593. case (ushort)ClientPacketIds.RefreshFriends:
  5594. return new C.RefreshFriends();
  5595. case (ushort)ClientPacketIds.AddMemo:
  5596. return new C.AddMemo();
  5597. case (ushort)ClientPacketIds.GuildBuffUpdate:
  5598. return new C.GuildBuffUpdate();
  5599. case (ushort)ClientPacketIds.GameshopBuy:
  5600. return new C.GameshopBuy();
  5601. case (ushort)ClientPacketIds.NPCConfirmInput:
  5602. return new C.NPCConfirmInput();
  5603. case (ushort)ClientPacketIds.QueryMapNPCs:
  5604. return new C.QueryMapNPCs();
  5605. case (ushort)ClientPacketIds.QueryAllMaps:
  5606. return new C.QueryAllMaps();
  5607. case (ushort)ClientPacketIds.ReportIssue:
  5608. return new C.ReportIssue();
  5609. case (ushort)ClientPacketIds.GetRanking:
  5610. return new C.GetRanking();
  5611. case (ushort)ClientPacketIds.Opendoor:
  5612. return new C.Opendoor();
  5613. case (ushort)ClientPacketIds.PayMail:
  5614. return new C.PayMail();
  5615. case (ushort)ClientPacketIds.RefreshRecipe:
  5616. return new C.RefreshRecipe();
  5617. case (ushort)ClientPacketIds.VersionName:
  5618. return new C.VersionName();
  5619. case (ushort)ClientPacketIds.InitialItem:
  5620. return new C.InitialItem();
  5621. case (ushort)ClientPacketIds.MoveShield:
  5622. return new C.MoveShield();
  5623. case (ushort)ClientPacketIds.PrepareMoveShield:
  5624. return new C.PrepareMoveShield();
  5625. default:
  5626. return null;
  5627. }
  5628. }
  5629. private static Packet GetCustomPacket(ushort index)
  5630. {
  5631. switch (index)
  5632. {
  5633. case (ushort)CustomPacketIds.Manager:
  5634. return new C.Manager();
  5635. default:
  5636. return null;
  5637. }
  5638. }
  5639. private static Packet GetServerPacket(ushort index)
  5640. {
  5641. switch (index)
  5642. {
  5643. case (ushort)ServerPacketIds.Connected:
  5644. return new S.Connected();
  5645. case (ushort)ServerPacketIds.ClientVersion:
  5646. return new S.ClientVersion();
  5647. case (ushort)ServerPacketIds.Disconnect:
  5648. return new S.Disconnect();
  5649. case (ushort)ServerPacketIds.KeepAlive:
  5650. return new S.KeepAlive();
  5651. case (ushort)ServerPacketIds.HookSuspicionMsg:
  5652. return new S.HookSuspicionMsg();
  5653. case (ushort)ServerPacketIds.HookSuspicionMsgFailure:
  5654. return new S.HookSuspicionMsgFailure();
  5655. case (ushort)ServerPacketIds.NewAccount:
  5656. return new S.NewAccount();
  5657. case (ushort)ServerPacketIds.ChangePassword:
  5658. return new S.ChangePassword();
  5659. case (ushort)ServerPacketIds.ChangePasswordBanned:
  5660. return new S.ChangePasswordBanned();
  5661. case (ushort)ServerPacketIds.Login:
  5662. return new S.Login();
  5663. case (ushort)ServerPacketIds.LoginBanned:
  5664. return new S.LoginBanned();
  5665. case (ushort)ServerPacketIds.LoginSuccess:
  5666. return new S.LoginSuccess();
  5667. case (ushort)ServerPacketIds.NewCharacter:
  5668. return new S.NewCharacter();
  5669. case (ushort)ServerPacketIds.NewCharacterSuccess:
  5670. return new S.NewCharacterSuccess();
  5671. case (ushort)ServerPacketIds.DeleteCharacter:
  5672. return new S.DeleteCharacter();
  5673. case (ushort)ServerPacketIds.DeleteCharacterSuccess:
  5674. return new S.DeleteCharacterSuccess();
  5675. case (ushort)ServerPacketIds.StartGame:
  5676. return new S.StartGame();
  5677. case (ushort)ServerPacketIds.StartGameBanned:
  5678. return new S.StartGameBanned();
  5679. case (ushort)ServerPacketIds.StartGameDelay:
  5680. return new S.StartGameDelay();
  5681. case (ushort)ServerPacketIds.EnterAlive:
  5682. return new S.EnterAlive();
  5683. case (ushort)ServerPacketIds.MapInformation:
  5684. return new S.MapInformation();
  5685. case (ushort)ServerPacketIds.UserInformation:
  5686. return new S.UserInformation();
  5687. case (ushort)ServerPacketIds.UserLocation:
  5688. return new S.UserLocation();
  5689. case (ushort)ServerPacketIds.ObjectPlayer:
  5690. return new S.ObjectPlayer();
  5691. case (ushort)ServerPacketIds.ObjectRemove:
  5692. return new S.ObjectRemove();
  5693. case (ushort)ServerPacketIds.ObjectTurn:
  5694. return new S.ObjectTurn();
  5695. case (ushort)ServerPacketIds.ObjectWalk:
  5696. return new S.ObjectWalk();
  5697. case (ushort)ServerPacketIds.ObjectRun:
  5698. return new S.ObjectRun();
  5699. case (ushort)ServerPacketIds.Chat:
  5700. return new S.Chat();
  5701. case (ushort)ServerPacketIds.ObjectChat:
  5702. return new S.ObjectChat();
  5703. case (ushort)ServerPacketIds.NewItemInfo:
  5704. return new S.NewItemInfo();
  5705. case (ushort)ServerPacketIds.MoveItem:
  5706. return new S.MoveItem();
  5707. case (ushort)ServerPacketIds.EquipItem:
  5708. return new S.EquipItem();
  5709. case (ushort)ServerPacketIds.MergeItem:
  5710. return new S.MergeItem();
  5711. case (ushort)ServerPacketIds.RemoveItem:
  5712. return new S.RemoveItem();
  5713. case (ushort)ServerPacketIds.RemoveSlotItem:
  5714. return new S.RemoveSlotItem();
  5715. case (ushort)ServerPacketIds.TakeBackItem:
  5716. return new S.TakeBackItem();
  5717. case (ushort)ServerPacketIds.StoreItem:
  5718. return new S.StoreItem();
  5719. case (ushort)ServerPacketIds.SureBuyStorage:
  5720. return new S.SureBuyStorage();
  5721. case (ushort)ServerPacketIds.StorPasswordAuthResult:
  5722. return new S.StorPasswordAuthResult();
  5723. case (ushort)ServerPacketIds.ReceiveMessageBox:
  5724. return new S.ReceiveMessageBox();
  5725. case (ushort)ServerPacketIds.SetStoragePassword:
  5726. return new S.SetStoragePassword();
  5727. case (ushort)ServerPacketIds.StorPasswordAsk:
  5728. return new S.StorPasswordAsk();
  5729. case (ushort)ServerPacketIds.DepositRefineItem:
  5730. return new S.DepositRefineItem();
  5731. case (ushort)ServerPacketIds.RetrieveRefineItem:
  5732. return new S.RetrieveRefineItem();
  5733. case (ushort)ServerPacketIds.RefineItem:
  5734. return new S.RefineItem();
  5735. case (ushort)ServerPacketIds.Mir3RefineItem:
  5736. return new S.Mir3RefineItem();
  5737. case (ushort)ServerPacketIds.Mir3AtkRefine:
  5738. return new S.Mir3AtkRefine();
  5739. case (ushort)ServerPacketIds.ClientHP:
  5740. return new S.ClientHP();
  5741. case (ushort)ServerPacketIds.FindBlackItem:
  5742. return new S.FindBlackItem();
  5743. case (ushort)ServerPacketIds.DepositTradeItem:
  5744. return new S.DepositTradeItem();
  5745. case (ushort)ServerPacketIds.RetrieveTradeItem:
  5746. return new S.RetrieveTradeItem();
  5747. case (ushort)ServerPacketIds.SplitItem:
  5748. return new S.SplitItem();
  5749. case (ushort)ServerPacketIds.SplitItem1:
  5750. return new S.SplitItem1();
  5751. case (ushort)ServerPacketIds.UseItem:
  5752. return new S.UseItem();
  5753. case (ushort)ServerPacketIds.DropItem:
  5754. return new S.DropItem();
  5755. case (ushort)ServerPacketIds.PlayerUpdate:
  5756. return new S.PlayerUpdate();
  5757. case (ushort)ServerPacketIds.PlayerInspect:
  5758. return new S.PlayerInspect();
  5759. case (ushort)ServerPacketIds.LogOutSuccess:
  5760. return new S.LogOutSuccess();
  5761. case (ushort)ServerPacketIds.LogOutFailed:
  5762. return new S.LogOutFailed();
  5763. case (ushort)ServerPacketIds.TimeOfDay:
  5764. return new S.TimeOfDay();
  5765. case (ushort)ServerPacketIds.ChangeAMode:
  5766. return new S.ChangeAMode();
  5767. case (ushort)ServerPacketIds.ChangePMode:
  5768. return new S.ChangePMode();
  5769. case (ushort)ServerPacketIds.ObjectUseItem:
  5770. return new S.ObjectUseItem();
  5771. case (ushort)ServerPacketIds.DropProtectSuccess:
  5772. return new S.DropProtectSuccess();
  5773. case (ushort)ServerPacketIds.ObjectItem:
  5774. return new S.ObjectItem();
  5775. case (ushort)ServerPacketIds.ObjectGold:
  5776. return new S.ObjectGold();
  5777. case (ushort)ServerPacketIds.GainedItem:
  5778. return new S.GainedItem();
  5779. case (ushort)ServerPacketIds.GainedGold:
  5780. return new S.GainedGold();
  5781. case (ushort)ServerPacketIds.LoseGold:
  5782. return new S.LoseGold();
  5783. case (ushort)ServerPacketIds.GainedCredit:
  5784. return new S.GainedCredit();
  5785. case (ushort)ServerPacketIds.LoseCredit:
  5786. return new S.LoseCredit();
  5787. case (ushort)ServerPacketIds.ObjectMonster:
  5788. return new S.ObjectMonster();
  5789. case (ushort)ServerPacketIds.ObjectAttack:
  5790. return new S.ObjectAttack();
  5791. case (ushort)ServerPacketIds.Struck:
  5792. return new S.Struck();
  5793. case (ushort)ServerPacketIds.DamageIndicator:
  5794. return new S.DamageIndicator();
  5795. case (ushort)ServerPacketIds.ObjectStruck:
  5796. return new S.ObjectStruck();
  5797. case (ushort)ServerPacketIds.DuraChanged:
  5798. return new S.DuraChanged();
  5799. case (ushort)ServerPacketIds.PoisonChangaChanged:
  5800. return new S.PoisonChangaChanged();
  5801. case (ushort)ServerPacketIds.HealthChanged:
  5802. return new S.HealthChanged();
  5803. case (ushort)ServerPacketIds.DeleteItem:
  5804. return new S.DeleteItem();
  5805. case (ushort)ServerPacketIds.Death:
  5806. return new S.Death();
  5807. case (ushort)ServerPacketIds.ObjectDied:
  5808. return new S.ObjectDied();
  5809. case (ushort)ServerPacketIds.ColorChanged:
  5810. return new S.ColorChanged();
  5811. case (ushort)ServerPacketIds.ObjectColorChanged:
  5812. return new S.ObjectColorChanged();
  5813. case (ushort)ServerPacketIds.ObjectGuildNameChanged:
  5814. return new S.ObjectGuildNameChanged();
  5815. case (ushort)ServerPacketIds.GainExperience:
  5816. return new S.GainExperience();
  5817. case (ushort)ServerPacketIds.SubExperience:
  5818. return new S.SubExperience();
  5819. case (ushort)ServerPacketIds.LevelChanged:
  5820. return new S.LevelChanged();
  5821. case (ushort)ServerPacketIds.ExtraChanged:
  5822. return new S.ExtraChanged();
  5823. case (ushort)ServerPacketIds.ObjectLeveled:
  5824. return new S.ObjectLeveled();
  5825. case (ushort)ServerPacketIds.ObjectWpLeveled:
  5826. return new S.ObjectWpLeveled();
  5827. case (ushort)ServerPacketIds.ObjectShowHelmet:
  5828. return new S.ObjectShowHelmet();
  5829. case (ushort)ServerPacketIds.ObjectHarvest:
  5830. return new S.ObjectHarvest();
  5831. case (ushort)ServerPacketIds.ObjectHarvested:
  5832. return new S.ObjectHarvested();
  5833. case (ushort)ServerPacketIds.ObjectNpc:
  5834. return new S.ObjectNPC();
  5835. case (ushort)ServerPacketIds.QueryMapNPCs:
  5836. return new S.QueryMapNPCs();
  5837. case (ushort)ServerPacketIds.QueryAllMaps:
  5838. return new S.QueryAllMaps();
  5839. case (ushort)ServerPacketIds.NPCResponse:
  5840. return new S.NPCResponse();
  5841. case (ushort)ServerPacketIds.NPCDocument:
  5842. return new S.NPCDocument();
  5843. case (ushort)ServerPacketIds.ObjectHide:
  5844. return new S.ObjectHide();
  5845. case (ushort)ServerPacketIds.ObjectShow:
  5846. return new S.ObjectShow();
  5847. case (ushort)ServerPacketIds.Poisoned:
  5848. return new S.Poisoned();
  5849. case (ushort)ServerPacketIds.ObjectPoisoned:
  5850. return new S.ObjectPoisoned();
  5851. case (ushort)ServerPacketIds.MapChanged:
  5852. return new S.MapChanged();
  5853. case (ushort)ServerPacketIds.ObjectTeleportOut:
  5854. return new S.ObjectTeleportOut();
  5855. case (ushort)ServerPacketIds.ObjectTeleportIn:
  5856. return new S.ObjectTeleportIn();
  5857. case (ushort)ServerPacketIds.TeleportIn:
  5858. return new S.TeleportIn();
  5859. case (ushort)ServerPacketIds.NPCGoods:
  5860. return new S.NPCGoods();
  5861. case (ushort)ServerPacketIds.NPCSelectGoods:
  5862. return new S.NPCSelectGoods();
  5863. case (ushort)ServerPacketIds.NPCSell:
  5864. return new S.NPCSell();
  5865. case (ushort)ServerPacketIds.NPCRepair:
  5866. return new S.NPCRepair();
  5867. case (ushort)ServerPacketIds.NPCSRepair:
  5868. return new S.NPCSRepair();
  5869. case (ushort)ServerPacketIds.NPCRefine:
  5870. return new S.NPCRefine();
  5871. case (ushort)ServerPacketIds.NPCCheckRefine:
  5872. return new S.NPCCheckRefine();
  5873. case (ushort)ServerPacketIds.NPCCollectRefine:
  5874. return new S.NPCCollectRefine();
  5875. case (ushort)ServerPacketIds.NPCReplaceWedRing:
  5876. return new S.NPCReplaceWedRing();
  5877. case (ushort)ServerPacketIds.NPCStorage:
  5878. return new S.NPCStorage();
  5879. case (ushort)ServerPacketIds.StartMACUpgrade:
  5880. return new S.StartMACUpgrade();
  5881. case (ushort)ServerPacketIds.ClearMACUpgrade:
  5882. return new S.ClearMACUpgrade();
  5883. case (ushort)ServerPacketIds.MACUpgradeResult:
  5884. return new S.MACUpgradeResult();
  5885. case (ushort)ServerPacketIds.SellItem:
  5886. return new S.SellItem();
  5887. case (ushort)ServerPacketIds.RepairItem:
  5888. return new S.RepairItem();
  5889. case (ushort)ServerPacketIds.ItemRepaired:
  5890. return new S.ItemRepaired();
  5891. case (ushort)ServerPacketIds.NewMagic:
  5892. return new S.NewMagic();
  5893. case (ushort)ServerPacketIds.MagicLeveled:
  5894. return new S.MagicLeveled();
  5895. case (ushort)ServerPacketIds.Magic:
  5896. return new S.Magic();
  5897. case (ushort)ServerPacketIds.MagicDelay:
  5898. return new S.MagicDelay();
  5899. case (ushort)ServerPacketIds.MagicCast:
  5900. return new S.MagicCast();
  5901. case (ushort)ServerPacketIds.ObjectMagic:
  5902. return new S.ObjectMagic();
  5903. case (ushort)ServerPacketIds.ObjectEffect:
  5904. return new S.ObjectEffect();
  5905. case (ushort)ServerPacketIds.RangeAttack:
  5906. return new S.RangeAttack();
  5907. case (ushort)ServerPacketIds.Pushed:
  5908. return new S.Pushed();
  5909. case (ushort)ServerPacketIds.ObjectPushed:
  5910. return new S.ObjectPushed();
  5911. case (ushort)ServerPacketIds.ObjectName:
  5912. return new S.ObjectName();
  5913. case (ushort)ServerPacketIds.UserStorage:
  5914. return new S.UserStorage();
  5915. case (ushort)ServerPacketIds.SwitchGroup:
  5916. return new S.SwitchGroup();
  5917. case (ushort)ServerPacketIds.DeleteGroup:
  5918. return new S.DeleteGroup();
  5919. case (ushort)ServerPacketIds.DeleteMember:
  5920. return new S.DeleteMember();
  5921. case (ushort)ServerPacketIds.MemberLocation:
  5922. return new S.MemberLocation();
  5923. case (ushort)ServerPacketIds.GroupInvite:
  5924. return new S.GroupInvite();
  5925. case (ushort)ServerPacketIds.AddMember:
  5926. return new S.AddMember();
  5927. case (ushort)ServerPacketIds.Revived:
  5928. return new S.Revived();
  5929. case (ushort)ServerPacketIds.ObjectRevived:
  5930. return new S.ObjectRevived();
  5931. case (ushort)ServerPacketIds.SpellToggle:
  5932. return new S.SpellToggle();
  5933. case (ushort)ServerPacketIds.ObjectHealth:
  5934. return new S.ObjectHealth();
  5935. case (ushort)ServerPacketIds.MapEffect:
  5936. return new S.MapEffect();
  5937. case (ushort)ServerPacketIds.ObjectRangeAttack:
  5938. return new S.ObjectRangeAttack();
  5939. case (ushort)ServerPacketIds.AddBuff:
  5940. return new S.AddBuff();
  5941. case (ushort)ServerPacketIds.RemoveBuff:
  5942. return new S.RemoveBuff();
  5943. case (ushort)ServerPacketIds.ObjectHidden:
  5944. return new S.ObjectHidden();
  5945. case (ushort)ServerPacketIds.ObjectSpHidden:
  5946. return new S.ObjectSpHidden();
  5947. case (ushort)ServerPacketIds.RefreshItem:
  5948. return new S.RefreshItem();
  5949. case (ushort)ServerPacketIds.RefreshHair:
  5950. return new S.RefreshHair();
  5951. case (ushort)ServerPacketIds.ObjectRefreshHair:
  5952. return new S.ObjectRefreshHair();
  5953. case (ushort)ServerPacketIds.ObjectSpell:
  5954. return new S.ObjectSpell();
  5955. case (ushort)ServerPacketIds.UserDash:
  5956. return new S.UserDash();
  5957. case (ushort)ServerPacketIds.ObjectDash:
  5958. return new S.ObjectDash();
  5959. case (ushort)ServerPacketIds.UserDashFail:
  5960. return new S.UserDashFail();
  5961. case (ushort)ServerPacketIds.ObjectDashFail:
  5962. return new S.ObjectDashFail();
  5963. case (ushort)ServerPacketIds.NPCConsign:
  5964. return new S.NPCConsign();
  5965. case (ushort)ServerPacketIds.ZanZhuChangeName:
  5966. return new S.ZanZhuChangeName();
  5967. case (ushort)ServerPacketIds.NPCMarket:
  5968. return new S.NPCMarket();
  5969. case (ushort)ServerPacketIds.NPCMarketPage:
  5970. return new S.NPCMarketPage();
  5971. case (ushort)ServerPacketIds.AuctionGroups:
  5972. return new S.AuctionGroups();
  5973. case (ushort)ServerPacketIds.GameShopSearch:
  5974. return new S.GameShopSearch();
  5975. case (ushort)ServerPacketIds.ItemProtectStart:
  5976. return new S.ItemProtectStart();
  5977. case (ushort)ServerPacketIds.ExchangeConfigSearch:
  5978. return new S.ExchangeConfigSearch();
  5979. case (ushort)ServerPacketIds.ItemAuctionSearch:
  5980. return new S.ItemAuctionSearch();
  5981. case (ushort)ServerPacketIds.MyAuctionSearch:
  5982. return new S.MyAuctionSearch();
  5983. case (ushort)ServerPacketIds.ConsignItem:
  5984. return new S.ConsignItem();
  5985. case (ushort)ServerPacketIds.MarketFail:
  5986. return new S.MarketFail();
  5987. case (ushort)ServerPacketIds.MarketSuccess:
  5988. return new S.MarketSuccess();
  5989. case (ushort)ServerPacketIds.ObjectSitDown:
  5990. return new S.ObjectSitDown();
  5991. case (ushort)ServerPacketIds.RefreshSeasonExitTime:
  5992. return new S.RefreshSeasonExitTime();
  5993. case (ushort)ServerPacketIds.InTrapRock:
  5994. return new S.InTrapRock();
  5995. case (ushort)ServerPacketIds.RemoveMagic:
  5996. return new S.RemoveMagic();
  5997. case (ushort)ServerPacketIds.BaseStatsInfo:
  5998. return new S.BaseStatsInfo();
  5999. case (ushort)ServerPacketIds.UserName:
  6000. return new S.UserName();
  6001. case (ushort)ServerPacketIds.ChatItemStats:
  6002. return new S.ChatItemStats();
  6003. case (ushort)ServerPacketIds.GuildMemberChange:
  6004. return new S.GuildMemberChange();
  6005. case (ushort)ServerPacketIds.GuildNoticeChange:
  6006. return new S.GuildNoticeChange();
  6007. case (ushort)ServerPacketIds.GuildStatus:
  6008. return new S.GuildStatus();
  6009. case (ushort)ServerPacketIds.GetAllGuild:
  6010. return new S.GetAllGuild();
  6011. case (ushort)ServerPacketIds.GetAllJoinRequest:
  6012. return new S.GetAllJoinRequest();
  6013. case (ushort)ServerPacketIds.GuildInvite:
  6014. return new S.GuildInvite();
  6015. case (ushort)ServerPacketIds.GuildExpGain:
  6016. return new S.GuildExpGain();
  6017. case (ushort)ServerPacketIds.GuildNameRequest:
  6018. return new S.GuildNameRequest();
  6019. case (ushort)ServerPacketIds.GuildStorageGoldChange:
  6020. return new S.GuildStorageGoldChange();
  6021. case (ushort)ServerPacketIds.GuildStorageItemChange:
  6022. return new S.GuildStorageItemChange();
  6023. case (ushort)ServerPacketIds.GuildStorageList:
  6024. return new S.GuildStorageList();
  6025. case (ushort)ServerPacketIds.GuildRequestWar:
  6026. return new S.GuildRequestWar();
  6027. case (ushort)ServerPacketIds.DefaultNPC:
  6028. return new S.DefaultNPC();
  6029. case (ushort)ServerPacketIds.NPCUpdate:
  6030. return new S.NPCUpdate();
  6031. case (ushort)ServerPacketIds.MarriageRequest:
  6032. return new S.MarriageRequest();
  6033. case (ushort)ServerPacketIds.DivorceRequest:
  6034. return new S.DivorceRequest();
  6035. case (ushort)ServerPacketIds.MentorRequest:
  6036. return new S.MentorRequest();
  6037. case (ushort)ServerPacketIds.TradeRequest:
  6038. return new S.TradeRequest();
  6039. case (ushort)ServerPacketIds.TradeAccept:
  6040. return new S.TradeAccept();
  6041. case (ushort)ServerPacketIds.TradeGold:
  6042. return new S.TradeGold();
  6043. case (ushort)ServerPacketIds.TradeItem:
  6044. return new S.TradeItem();
  6045. case (ushort)ServerPacketIds.TradeCost:
  6046. return new S.TradeCost();
  6047. case (ushort)ServerPacketIds.TradeConfirm:
  6048. return new S.TradeConfirm();
  6049. case (ushort)ServerPacketIds.TradeCancel:
  6050. return new S.TradeCancel();
  6051. case (ushort)ServerPacketIds.MountUpdate:
  6052. return new S.MountUpdate();
  6053. case (ushort)ServerPacketIds.TransformUpdate:
  6054. return new S.TransformUpdate();
  6055. case (ushort)ServerPacketIds.EquipSlotItem:
  6056. return new S.EquipSlotItem();
  6057. case (ushort)ServerPacketIds.FishingUpdate:
  6058. return new S.FishingUpdate();
  6059. case (ushort)ServerPacketIds.ChangeQuest:
  6060. return new S.ChangeQuest();
  6061. case (ushort)ServerPacketIds.CompleteQuest:
  6062. return new S.CompleteQuest();
  6063. case (ushort)ServerPacketIds.ShareQuest:
  6064. return new S.ShareQuest();
  6065. case (ushort)ServerPacketIds.NewQuestInfo:
  6066. return new S.NewQuestInfo();
  6067. case (ushort)ServerPacketIds.GainedQuestItem:
  6068. return new S.GainedQuestItem();
  6069. case (ushort)ServerPacketIds.DeleteQuestItem:
  6070. return new S.DeleteQuestItem();
  6071. case (ushort)ServerPacketIds.CancelReincarnation:
  6072. return new S.CancelReincarnation();
  6073. case (ushort)ServerPacketIds.RequestReincarnation:
  6074. return new S.RequestReincarnation();
  6075. case (ushort)ServerPacketIds.UserBackStep:
  6076. return new S.UserBackStep();
  6077. case (ushort)ServerPacketIds.ObjectBackStep:
  6078. return new S.ObjectBackStep();
  6079. case (ushort)ServerPacketIds.UserDashAttack:
  6080. return new S.UserDashAttack();
  6081. case (ushort)ServerPacketIds.ObjectDashAttack:
  6082. return new S.ObjectDashAttack();
  6083. case (ushort)ServerPacketIds.UserAttackMove://Warrior Skill - SlashingBurst
  6084. return new S.UserAttackMove();
  6085. case (ushort)ServerPacketIds.CombineItem:
  6086. return new S.CombineItem();
  6087. case (ushort)ServerPacketIds.ItemUpgraded:
  6088. return new S.ItemUpgraded();
  6089. case (ushort)ServerPacketIds.SetConcentration:
  6090. return new S.SetConcentration();
  6091. case (ushort)ServerPacketIds.SetObjectConcentration:
  6092. return new S.SetObjectConcentration();
  6093. case (ushort)ServerPacketIds.SetElemental:
  6094. return new S.SetElemental();
  6095. case (ushort)ServerPacketIds.SetObjectElemental:
  6096. return new S.SetObjectElemental();
  6097. case (ushort)ServerPacketIds.RemoveDelayedExplosion:
  6098. return new S.RemoveDelayedExplosion();
  6099. case (ushort)ServerPacketIds.ObjectDeco:
  6100. return new S.ObjectDeco();
  6101. case (ushort)ServerPacketIds.ObjectSneaking:
  6102. return new S.ObjectSneaking();
  6103. case (ushort)ServerPacketIds.ObjectLevelEffects:
  6104. return new S.ObjectLevelEffects();
  6105. case (ushort)ServerPacketIds.SetBindingShot:
  6106. return new S.SetBindingShot();
  6107. case (ushort)ServerPacketIds.SendOutputMessage:
  6108. return new S.SendOutputMessage();
  6109. case (ushort)ServerPacketIds.NPCAwakening:
  6110. return new S.NPCAwakening();
  6111. case (ushort)ServerPacketIds.NPCUnAwaken:
  6112. return new S.NPCUnAwaken();
  6113. case (ushort)ServerPacketIds.NPCDisassemble:
  6114. return new S.NPCDisassemble();
  6115. case (ushort)ServerPacketIds.NPCDowngrade:
  6116. return new S.NPCDowngrade();
  6117. case (ushort)ServerPacketIds.NPCReset:
  6118. return new S.NPCReset();
  6119. case (ushort)ServerPacketIds.AwakeningNeedMaterials:
  6120. return new S.AwakeningNeedMaterials();
  6121. case (ushort)ServerPacketIds.DropProtectNeedMaterials:
  6122. return new S.DropProtectNeedMaterials();
  6123. case (ushort)ServerPacketIds.AwakeningLockedItem:
  6124. return new S.AwakeningLockedItem();
  6125. case (ushort)ServerPacketIds.Awakening:
  6126. return new S.Awakening();
  6127. case (ushort)ServerPacketIds.UnAwakening:
  6128. return new S.UnAwakening();
  6129. case (ushort)ServerPacketIds.ReceiveMail:
  6130. return new S.ReceiveMail();
  6131. case (ushort)ServerPacketIds.MailLockedItem:
  6132. return new S.MailLockedItem();
  6133. case (ushort)ServerPacketIds.MailSent:
  6134. return new S.MailSent();
  6135. case (ushort)ServerPacketIds.MailSendRequest:
  6136. return new S.MailSendRequest();
  6137. case (ushort)ServerPacketIds.ParcelCollected:
  6138. return new S.ParcelCollected();
  6139. case (ushort)ServerPacketIds.MailCost:
  6140. return new S.MailCost();
  6141. case (ushort)ServerPacketIds.ResizeInventory:
  6142. return new S.ResizeInventory();
  6143. case (ushort)ServerPacketIds.NewIntelligentCreature:
  6144. return new S.NewIntelligentCreature();
  6145. case (ushort)ServerPacketIds.UpdateIntelligentCreatureList:
  6146. return new S.UpdateIntelligentCreatureList();
  6147. case (ushort)ServerPacketIds.IntelligentCreatureEnableRename:
  6148. return new S.IntelligentCreatureEnableRename();
  6149. case (ushort)ServerPacketIds.IntelligentCreaturePickup:
  6150. return new S.IntelligentCreaturePickup();
  6151. case (ushort)ServerPacketIds.NPCPearlGoods:
  6152. return new S.NPCPearlGoods();
  6153. case (ushort)ServerPacketIds.FriendUpdate:
  6154. return new S.FriendUpdate();
  6155. case (ushort)ServerPacketIds.FriendRequest:
  6156. return new S.FriendRequest();
  6157. case (ushort)ServerPacketIds.LoverUpdate:
  6158. return new S.LoverUpdate();
  6159. case (ushort)ServerPacketIds.MentorUpdate:
  6160. return new S.MentorUpdate();
  6161. case (ushort)ServerPacketIds.GuildBuffList:
  6162. return new S.GuildBuffList();
  6163. case (ushort)ServerPacketIds.GameShopInfo:
  6164. return new S.GameShopInfo();
  6165. case (ushort)ServerPacketIds.GameShopStock:
  6166. return new S.GameShopStock();
  6167. case (ushort)ServerPacketIds.NPCRequestInput:
  6168. return new S.NPCRequestInput();
  6169. case (ushort)ServerPacketIds.Rankings:
  6170. return new S.Rankings();
  6171. case (ushort)ServerPacketIds.Opendoor:
  6172. return new S.Opendoor();
  6173. case (ushort)ServerPacketIds.OpenJyxt:
  6174. return new S.OpenJyxt();
  6175. case (ushort)ServerPacketIds.InitialItem:
  6176. return new S.InitialItem();
  6177. case (ushort)ServerPacketIds.MoveShield:
  6178. return new S.MoveShield();
  6179. case (ushort)ServerPacketIds.ReshRecipes:
  6180. return new S.ReshRecipes();
  6181. case (ushort)ServerPacketIds.AboutToQuest:
  6182. return new S.AboutToQuest();
  6183. default:
  6184. return null;
  6185. }
  6186. }
  6187. }
  6188. public class BaseStats
  6189. {
  6190. public float HpGain, HpGainRate, MpGainRate, BagWeightGain, WearWeightGain, HandWeightGain;
  6191. public byte MinAc, MaxAc, MinMac, MaxMac, MinDc, MaxDc, MinMc, MaxMc, MinSc, MaxSc, StartAgility, StartAccuracy, StartCriticalRate, StartCriticalDamage, CritialRateGain, CriticalDamageGain;
  6192. public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC;
  6193. public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC;
  6194. public BaseStats(MirClass Job)
  6195. {
  6196. switch (Job)
  6197. {
  6198. case MirClass.Warrior:
  6199. HpGain = 4F;
  6200. HpGainRate = 4.5F;
  6201. MpGainRate = 0;
  6202. BagWeightGain = 3F;
  6203. WearWeightGain = 20F;
  6204. HandWeightGain = 13F;
  6205. MinAc = 0;
  6206. MaxAc = 7;
  6207. MinMac = 0;
  6208. MaxMac = 0;
  6209. MinDc = 5;
  6210. MaxDc = 5;
  6211. MinMc = 0;
  6212. MaxMc = 0;
  6213. MinSc = 0;
  6214. MaxSc = 0;
  6215. FireAC = 0;
  6216. WindAC = 0;
  6217. IceAC = 0;
  6218. LightAC = 0;
  6219. HolyAC = 0;
  6220. DarkAC = 0;
  6221. PhantomAC = 0;
  6222. FireMAC = 0;
  6223. WindMAC = 0;
  6224. IceMAC = 0;
  6225. LightMAC = 0;
  6226. HolyMAC = 0;
  6227. DarkMAC = 0;
  6228. PhantomMAC = 0;
  6229. StartAgility = 15;
  6230. StartAccuracy = 5;
  6231. StartCriticalRate = 0;
  6232. StartCriticalDamage = 0;
  6233. CritialRateGain = 0;
  6234. CriticalDamageGain = 0;
  6235. break;
  6236. case MirClass.Wizard:
  6237. HpGain = 15F;
  6238. HpGainRate = 1.8F;
  6239. MpGainRate = 0;
  6240. BagWeightGain = 5F;
  6241. WearWeightGain = 100F;
  6242. HandWeightGain = 90F;
  6243. MinAc = 0;
  6244. MaxAc = 0;
  6245. MinMac = 0;
  6246. MaxMac = 0;
  6247. MinDc = 7;
  6248. MaxDc = 7;
  6249. MinMc = 7;
  6250. MaxMc = 7;
  6251. MinSc = 0;
  6252. MaxSc = 0;
  6253. FireAC = 0;
  6254. WindAC = 0;
  6255. IceAC = 0;
  6256. LightAC = 0;
  6257. HolyAC = 0;
  6258. DarkAC = 0;
  6259. PhantomAC = 0;
  6260. FireMAC = 0;
  6261. WindMAC = 0;
  6262. IceMAC = 0;
  6263. LightMAC = 0;
  6264. HolyMAC = 0;
  6265. DarkMAC = 0;
  6266. PhantomMAC = 0;
  6267. StartAgility = 15;
  6268. StartAccuracy = 5;
  6269. StartCriticalRate = 0;
  6270. StartCriticalDamage = 0;
  6271. CritialRateGain = 0;
  6272. CriticalDamageGain = 0;
  6273. break;
  6274. case MirClass.Taoist:
  6275. HpGain = 6F;
  6276. HpGainRate = 2.5F;
  6277. MpGainRate = 0;
  6278. BagWeightGain = 4F;
  6279. WearWeightGain = 50F;
  6280. HandWeightGain = 42F;
  6281. MinAc = 0;
  6282. MaxAc = 0;
  6283. MinMac = 12;
  6284. MaxMac = 6;
  6285. MinDc = 7;
  6286. MaxDc = 7;
  6287. MinMc = 0;
  6288. MaxMc = 0;
  6289. MinSc = 7;
  6290. MaxSc = 7;
  6291. FireAC = 0;
  6292. WindAC = 0;
  6293. IceAC = 0;
  6294. LightAC = 0;
  6295. HolyAC = 0;
  6296. DarkAC = 0;
  6297. PhantomAC = 0;
  6298. FireMAC = 0;
  6299. WindMAC = 0;
  6300. IceMAC = 0;
  6301. LightMAC = 0;
  6302. HolyMAC = 0;
  6303. DarkMAC = 0;
  6304. PhantomMAC = 0;
  6305. StartAgility = 18;
  6306. StartAccuracy = 5;
  6307. StartCriticalRate = 0;
  6308. StartCriticalDamage = 0;
  6309. CritialRateGain = 0;
  6310. CriticalDamageGain = 0;
  6311. break;
  6312. case MirClass.Assassin:
  6313. HpGain = 4F;
  6314. HpGainRate = 3.25F;
  6315. MpGainRate = 0;
  6316. BagWeightGain = 3.5F;
  6317. WearWeightGain = 33F;
  6318. HandWeightGain = 30F;
  6319. MinAc = 0;
  6320. MaxAc = 0;
  6321. MinMac = 0;
  6322. MaxMac = 0;
  6323. MinDc = 8;
  6324. MaxDc = 8;
  6325. MinMc = 0;
  6326. MaxMc = 0;
  6327. MinSc = 0;
  6328. MaxSc = 0;
  6329. FireAC = 0;
  6330. WindAC = 0;
  6331. IceAC = 0;
  6332. LightAC = 0;
  6333. HolyAC = 0;
  6334. DarkAC = 0;
  6335. PhantomAC = 0;
  6336. FireMAC = 0;
  6337. WindMAC = 0;
  6338. IceMAC = 0;
  6339. LightMAC = 0;
  6340. HolyMAC = 0;
  6341. DarkMAC = 0;
  6342. PhantomMAC = 0;
  6343. StartAgility = 20;
  6344. StartAccuracy = 5;
  6345. StartCriticalRate = 0;
  6346. StartCriticalDamage = 0;
  6347. CritialRateGain = 0;
  6348. CriticalDamageGain = 0;
  6349. break;
  6350. case MirClass.Archer:
  6351. HpGain = 4F;
  6352. HpGainRate = 3.25F;
  6353. MpGainRate = 0;
  6354. BagWeightGain = 4F; //done
  6355. WearWeightGain = 33F;
  6356. HandWeightGain = 30F;
  6357. MinAc = 0;
  6358. MaxAc = 0;
  6359. MinMac = 0;
  6360. MaxMac = 0;
  6361. MinDc = 8;
  6362. MaxDc = 8;
  6363. MinMc = 8;
  6364. MaxMc = 8;
  6365. MinSc = 0;
  6366. MaxSc = 0;
  6367. FireAC = 0;
  6368. WindAC = 0;
  6369. IceAC = 0;
  6370. LightAC = 0;
  6371. HolyAC = 0;
  6372. DarkAC = 0;
  6373. PhantomAC = 0;
  6374. FireMAC = 0;
  6375. WindMAC = 0;
  6376. IceMAC = 0;
  6377. LightMAC = 0;
  6378. HolyMAC = 0;
  6379. DarkMAC = 0;
  6380. PhantomMAC = 0;
  6381. StartAgility = 15;
  6382. StartAccuracy = 8;
  6383. StartCriticalRate = 0;
  6384. StartCriticalDamage = 0;
  6385. CritialRateGain = 0;
  6386. CriticalDamageGain = 0;
  6387. break;
  6388. }
  6389. }
  6390. public BaseStats(BinaryReader reader)
  6391. {
  6392. HpGain = reader.ReadSingle();
  6393. HpGainRate = reader.ReadSingle();
  6394. MpGainRate = reader.ReadSingle();
  6395. MinAc = reader.ReadByte();
  6396. MaxAc = reader.ReadByte();
  6397. MinMac = reader.ReadByte();
  6398. MaxMac = reader.ReadByte();
  6399. MinDc = reader.ReadByte();
  6400. MaxDc = reader.ReadByte();
  6401. MinMc = reader.ReadByte();
  6402. MaxMc = reader.ReadByte();
  6403. MinSc = reader.ReadByte();
  6404. MaxSc = reader.ReadByte();
  6405. FireAC = reader.ReadInt16();
  6406. WindAC = reader.ReadInt16();
  6407. IceAC = reader.ReadInt16();
  6408. LightAC = reader.ReadInt16();
  6409. HolyAC = reader.ReadInt16();
  6410. DarkAC = reader.ReadInt16();
  6411. PhantomAC = reader.ReadInt16();
  6412. FireMAC = reader.ReadInt16();
  6413. WindMAC = reader.ReadInt16();
  6414. IceMAC = reader.ReadInt16();
  6415. LightMAC = reader.ReadInt16();
  6416. HolyMAC = reader.ReadInt16();
  6417. DarkMAC = reader.ReadInt16();
  6418. PhantomMAC = reader.ReadInt16();
  6419. StartAccuracy = reader.ReadByte();
  6420. StartAgility = reader.ReadByte();
  6421. StartCriticalRate = reader.ReadByte();
  6422. StartCriticalDamage = reader.ReadByte();
  6423. CritialRateGain = reader.ReadByte();
  6424. CriticalDamageGain = reader.ReadByte();
  6425. BagWeightGain = reader.ReadSingle();
  6426. WearWeightGain = reader.ReadSingle();
  6427. HandWeightGain = reader.ReadSingle();
  6428. }
  6429. public void Save(BinaryWriter writer)
  6430. {
  6431. writer.Write(HpGain);
  6432. writer.Write(HpGainRate);
  6433. writer.Write(MpGainRate);
  6434. writer.Write(MinAc);
  6435. writer.Write(MaxAc);
  6436. writer.Write(MinMac);
  6437. writer.Write(MaxMac);
  6438. writer.Write(MinDc);
  6439. writer.Write(MaxDc);
  6440. writer.Write(MinMc);
  6441. writer.Write(MaxMc);
  6442. writer.Write(MinSc);
  6443. writer.Write(MaxSc);
  6444. writer.Write(FireAC);
  6445. writer.Write(WindAC);
  6446. writer.Write(IceAC);
  6447. writer.Write(LightAC);
  6448. writer.Write(HolyAC);
  6449. writer.Write(DarkAC);
  6450. writer.Write(PhantomAC);
  6451. writer.Write(FireMAC);
  6452. writer.Write(WindMAC);
  6453. writer.Write(IceMAC);
  6454. writer.Write(LightMAC);
  6455. writer.Write(HolyMAC);
  6456. writer.Write(DarkMAC);
  6457. writer.Write(PhantomMAC);
  6458. writer.Write(StartAccuracy);
  6459. writer.Write(StartAgility);
  6460. writer.Write(StartCriticalRate);
  6461. writer.Write(StartCriticalDamage);
  6462. writer.Write(CritialRateGain);
  6463. writer.Write(CriticalDamageGain);
  6464. writer.Write(BagWeightGain);
  6465. writer.Write(WearWeightGain);
  6466. writer.Write(HandWeightGain);
  6467. }
  6468. }
  6469. public class RandomItemStat
  6470. {
  6471. public byte MaxDuraChance, MaxDuraStatChance, MaxDuraMaxStat;
  6472. public byte MaxAcChance, MaxAcStatChance, MaxAcMaxStat, MaxMacChance, MaxMacStatChance, MaxMacMaxStat, MaxDcChance, MaxDcStatChance, MaxDcMaxStat, MaxMcChance, MaxMcStatChance, MaxMcMaxStat, MaxScChance, MaxScStatChance, MaxScMaxStat;
  6473. public byte AccuracyChance, AccuracyStatChance, AccuracyMaxStat, AgilityChance, AgilityStatChance, AgilityMaxStat, HpChance, HpStatChance, HpMaxStat, MpChance, MpStatChance, MpMaxStat, StrongChance, StrongStatChance, StrongMaxStat;
  6474. public byte MagicResistChance, MagicResistStatChance, MagicResistMaxStat, PoisonResistChance, PoisonResistStatChance, PoisonResistMaxStat;
  6475. public byte HpRecovChance, HpRecovStatChance, HpRecovMaxStat, MpRecovChance, MpRecovStatChance, MpRecovMaxStat, PoisonRecovChance, PoisonRecovStatChance, PoisonRecovMaxStat;
  6476. public byte CriticalRateChance, CriticalRateStatChance, CriticalRateMaxStat, CriticalDamageChance, CriticalDamageStatChance, CriticalDamageMaxStat;
  6477. public byte FreezeChance, FreezeStatChance, FreezeMaxStat, PoisonAttackChance, PoisonAttackStatChance, PoisonAttackMaxStat;
  6478. public byte AttackSpeedChance, AttackSpeedStatChance, AttackSpeedMaxStat, LuckChance, LuckStatChance, LuckMaxStat;
  6479. public byte AttackFireChance, AttackFireStatChance, AttackFireMaxStat;
  6480. public byte AttackIceChance, AttackIceStatChance, AttackIceMaxStat;
  6481. public byte AttackWindChance, AttackWindStatChance, AttackWindMaxStat;
  6482. public byte AttackLightChance, AttackLightStatChance, AttackLightMaxStat;
  6483. public byte AttackHolyChance, AttackHolyStatChance, AttackHolyMaxStat;
  6484. public byte AttackDarkChance, AttackDarkStatChance, AttackDarkMaxStat;
  6485. public byte AttackPhantomChance, AttackPhantomStatChance, AttackPhantomMaxStat;
  6486. public byte EIAkNum, EiAcNum, EiAcStatChance, EiAcMaxStat;
  6487. public byte BagWeightChance, BagWeightStatChance, BagWeightMaxStat;
  6488. public byte WearWeightChance, WearWeightStatChance, WearWeightMaxStat;
  6489. public byte HandWeightChance, HandWeightStatChance, HandWeightMaxStat;
  6490. public byte CurseChance;
  6491. public byte HideMaxAcChance, HideMaxAcStatChance, HideMaxAcMaxStat;
  6492. public byte HideMaxMacChance, HideMaxMacStatChance, HideMaxMacMaxStat;
  6493. public byte HideMaxDcChance, HideMaxDcStatChance, HideMaxDcMaxStat;
  6494. public byte HideMaxMcChance, HideMaxMcStatChance, HideMaxMcMaxStat;
  6495. public byte HideMaxScChance, HideMaxScStatChance, HideMaxScMaxStat;
  6496. public byte HideAccuracyChance, HideAccuracyStatChance, HideAccuracyMaxStat;
  6497. public byte HideAgilityChance, HideAgilityStatChance, HideAgilityMaxStat;
  6498. public RandomItemStat(ItemType Type = ItemType.Book)
  6499. {
  6500. switch (Type)
  6501. {
  6502. case ItemType.Weapon:
  6503. SetWeapon();
  6504. break;
  6505. case ItemType.Armour:
  6506. SetArmour();
  6507. break;
  6508. case ItemType.Helmet:
  6509. SetHelmet();
  6510. break;
  6511. case ItemType.Belt:
  6512. case ItemType.Boots:
  6513. SetBeltBoots();
  6514. break;
  6515. case ItemType.Necklace:
  6516. SetNecklace();
  6517. break;
  6518. case ItemType.Bracelet:
  6519. SetBracelet();
  6520. break;
  6521. case ItemType.Ring:
  6522. SetRing();
  6523. break;
  6524. case ItemType.Mount:
  6525. SetMount();
  6526. break;
  6527. }
  6528. }
  6529. public void SetWeapon()
  6530. {
  6531. MaxDuraChance = 2;
  6532. MaxDuraStatChance = 13;
  6533. MaxDuraMaxStat = 13;
  6534. MaxDcChance = 15;
  6535. MaxDcStatChance = 15;
  6536. MaxDcMaxStat = 13;
  6537. MaxMcChance = 20;
  6538. MaxMcStatChance = 15;
  6539. MaxMcMaxStat = 13;
  6540. MaxScChance = 20;
  6541. MaxScStatChance = 15;
  6542. MaxScMaxStat = 13;
  6543. AttackSpeedChance = 60;
  6544. AttackSpeedStatChance = 30;
  6545. AttackSpeedMaxStat = 3;
  6546. StrongChance = 24;
  6547. StrongStatChance = 20;
  6548. StrongMaxStat = 2;
  6549. AccuracyChance = 30;
  6550. AccuracyStatChance = 20;
  6551. AccuracyMaxStat = 2;
  6552. }
  6553. public void SetArmour()
  6554. {
  6555. MaxDuraChance = 2;
  6556. MaxDuraStatChance = 10;
  6557. MaxDuraMaxStat = 3;
  6558. MaxAcChance = 30;
  6559. MaxAcStatChance = 15;
  6560. MaxAcMaxStat = 7;
  6561. MaxMacChance = 30;
  6562. MaxMacStatChance = 15;
  6563. MaxMacMaxStat = 7;
  6564. MaxDcChance = 40;
  6565. MaxDcStatChance = 20;
  6566. MaxDcMaxStat = 7;
  6567. MaxMcChance = 40;
  6568. MaxMcStatChance = 20;
  6569. MaxMcMaxStat = 7;
  6570. MaxScChance = 40;
  6571. MaxScStatChance = 20;
  6572. MaxScMaxStat = 7;
  6573. }
  6574. public void SetHelmet()
  6575. {
  6576. MaxDuraChance = 2;
  6577. MaxDuraStatChance = 10;
  6578. MaxDuraMaxStat = 3;
  6579. MaxAcChance = 30;
  6580. MaxAcStatChance = 15;
  6581. MaxAcMaxStat = 7;
  6582. MaxMacChance = 30;
  6583. MaxMacStatChance = 15;
  6584. MaxMacMaxStat = 7;
  6585. MaxDcChance = 40;
  6586. MaxDcStatChance = 20;
  6587. MaxDcMaxStat = 7;
  6588. MaxMcChance = 40;
  6589. MaxMcStatChance = 20;
  6590. MaxMcMaxStat = 7;
  6591. MaxScChance = 40;
  6592. MaxScStatChance = 20;
  6593. MaxScMaxStat = 7;
  6594. }
  6595. public void SetBeltBoots()
  6596. {
  6597. MaxDuraChance = 2;
  6598. MaxDuraStatChance = 10;
  6599. MaxDuraMaxStat = 3;
  6600. MaxAcChance = 30;
  6601. MaxAcStatChance = 30;
  6602. MaxAcMaxStat = 3;
  6603. MaxMacChance = 30;
  6604. MaxMacStatChance = 30;
  6605. MaxMacMaxStat = 3;
  6606. MaxDcChance = 30;
  6607. MaxDcStatChance = 30;
  6608. MaxDcMaxStat = 3;
  6609. MaxMcChance = 30;
  6610. MaxMcStatChance = 30;
  6611. MaxMcMaxStat = 3;
  6612. MaxScChance = 30;
  6613. MaxScStatChance = 30;
  6614. MaxScMaxStat = 3;
  6615. AgilityChance = 60;
  6616. AgilityStatChance = 30;
  6617. AgilityMaxStat = 3;
  6618. }
  6619. public void SetNecklace()
  6620. {
  6621. MaxDuraChance = 2;
  6622. MaxDuraStatChance = 10;
  6623. MaxDuraMaxStat = 3;
  6624. MaxDcChance = 15;
  6625. MaxDcStatChance = 30;
  6626. MaxDcMaxStat = 7;
  6627. MaxMcChance = 15;
  6628. MaxMcStatChance = 30;
  6629. MaxMcMaxStat = 7;
  6630. MaxScChance = 15;
  6631. MaxScStatChance = 30;
  6632. MaxScMaxStat = 7;
  6633. AccuracyChance = 60;
  6634. AccuracyStatChance = 30;
  6635. AccuracyMaxStat = 7;
  6636. AgilityChance = 60;
  6637. AgilityStatChance = 30;
  6638. AgilityMaxStat = 7;
  6639. }
  6640. public void SetBracelet()
  6641. {
  6642. MaxDuraChance = 2;
  6643. MaxDuraStatChance = 10;
  6644. MaxDuraMaxStat = 3;
  6645. MaxAcChance = 20;
  6646. MaxAcStatChance = 30;
  6647. MaxAcMaxStat = 6;
  6648. MaxMacChance = 20;
  6649. MaxMacStatChance = 30;
  6650. MaxMacMaxStat = 6;
  6651. MaxDcChance = 30;
  6652. MaxDcStatChance = 30;
  6653. MaxDcMaxStat = 6;
  6654. MaxMcChance = 30;
  6655. MaxMcStatChance = 30;
  6656. MaxMcMaxStat = 6;
  6657. MaxScChance = 30;
  6658. MaxScStatChance = 30;
  6659. MaxScMaxStat = 6;
  6660. }
  6661. public void SetRing()
  6662. {
  6663. MaxDuraChance = 2;
  6664. MaxDuraStatChance = 10;
  6665. MaxDuraMaxStat = 3;
  6666. MaxAcChance = 25;
  6667. MaxAcStatChance = 20;
  6668. MaxAcMaxStat = 6;
  6669. MaxMacChance = 25;
  6670. MaxMacStatChance = 20;
  6671. MaxMacMaxStat = 6;
  6672. MaxDcChance = 15;
  6673. MaxDcStatChance = 30;
  6674. MaxDcMaxStat = 6;
  6675. MaxMcChance = 15;
  6676. MaxMcStatChance = 30;
  6677. MaxMcMaxStat = 6;
  6678. MaxScChance = 15;
  6679. MaxScStatChance = 30;
  6680. MaxScMaxStat = 6;
  6681. }
  6682. public void SetMount()
  6683. {
  6684. SetRing();
  6685. }
  6686. }
  6687. public class ChatItem
  6688. {
  6689. public long RecievedTick = 0;
  6690. public ulong ID = 0;
  6691. public UserItem ItemStats;
  6692. }
  6693. public class UserId
  6694. {
  6695. public long Id = 0;
  6696. public string UserName = "";
  6697. }
  6698. #region ItemSets
  6699. //public class ItemSets
  6700. //{
  6701. // public ItemSet Set;
  6702. // public List<ItemType> Type;
  6703. // private byte Amount
  6704. // {
  6705. // get
  6706. // {
  6707. // switch (Set)
  6708. // {
  6709. // case ItemSet.Mundane:
  6710. // case ItemSet.NokChi:
  6711. // case ItemSet.TaoProtect:
  6712. // case ItemSet.Whisker1:
  6713. // case ItemSet.Whisker2:
  6714. // case ItemSet.Whisker3:
  6715. // case ItemSet.Whisker4:
  6716. // case ItemSet.Whisker5:
  6717. // return 2;
  6718. // case ItemSet.RedOrchid:
  6719. // case ItemSet.RedFlower:
  6720. // case ItemSet.Smash:
  6721. // case ItemSet.HwanDevil:
  6722. // case ItemSet.Purity:
  6723. // case ItemSet.FiveString:
  6724. // case ItemSet.Bone:
  6725. // case ItemSet.Bug:
  6726. // case ItemSet.魔血:
  6727. // return 3;
  6728. // case ItemSet.Recall:
  6729. // return 4;
  6730. // case ItemSet.Spirit:
  6731. // case ItemSet.WhiteGold:
  6732. // case ItemSet.WhiteGoldH:
  6733. // case ItemSet.RedJade:
  6734. // case ItemSet.RedJadeH:
  6735. // case ItemSet.Nephrite:
  6736. // case ItemSet.NephriteH:
  6737. // case ItemSet.Hyeolryong:
  6738. // case ItemSet.Monitor:
  6739. // case ItemSet.Oppressive:
  6740. // case ItemSet.Paeok:
  6741. // case ItemSet.Sulgwan:
  6742. // //case ItemSet.金刚:
  6743. // //case ItemSet.诺玛:
  6744. // //case ItemSet.魔令:
  6745. // case ItemSet.祈祷:
  6746. // return 5;
  6747. // default:
  6748. // return 0;
  6749. // }
  6750. // }
  6751. // }
  6752. // public byte Count;
  6753. // public bool SetComplete
  6754. // {
  6755. // get
  6756. // {
  6757. // return Count == Amount;
  6758. // }
  6759. // }
  6760. //}
  6761. public class ItemSetInfo
  6762. {
  6763. public int ID;
  6764. public string Name;
  6765. public List<int> ItemList = new List<int>();
  6766. public int AvaliableCount;
  6767. public bool RepeatWearCal = false;
  6768. public int MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC, MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility;
  6769. public int FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC;
  6770. public int FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC;
  6771. public int HP, MP;
  6772. public int AttackSpeed, Luck;
  6773. public int MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate;
  6774. public int CriticalRate, CriticalDamage;
  6775. public int MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, HpDrainRate;
  6776. public int Reflect, Parry, IgnoreAC, IgnoreMAC;
  6777. public int ACRate, MacRate;
  6778. public override string ToString()
  6779. {
  6780. return Name;
  6781. }
  6782. }
  6783. public class ItemSets
  6784. {
  6785. public ItemSetInfo Set;
  6786. public List<int> ItemIndex;
  6787. private byte Amount
  6788. {
  6789. get
  6790. {
  6791. return (byte)Set.AvaliableCount;
  6792. }
  6793. }
  6794. public byte Count;
  6795. public bool SetComplete
  6796. {
  6797. get
  6798. {
  6799. return Count >= Amount;
  6800. }
  6801. }
  6802. }
  6803. #endregion
  6804. #region "Mine Related"
  6805. public class MineSet
  6806. {
  6807. public string Name = string.Empty;
  6808. public byte SpotRegenRate = 5;
  6809. public byte MaxStones = 80;
  6810. public byte HitRate = 25;
  6811. public byte DropRate = 10;
  6812. public byte TotalSlots = 100;
  6813. public List<MineDrop> Drops = new List<MineDrop>();
  6814. private bool DropsSet = false;
  6815. public MineSet(byte MineType = 0)
  6816. {
  6817. switch (MineType)
  6818. {
  6819. case 1:
  6820. TotalSlots = 120;
  6821. Drops.Add(new MineDrop() { ItemName = "GoldOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6822. Drops.Add(new MineDrop() { ItemName = "SilverOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6823. Drops.Add(new MineDrop() { ItemName = "CopperOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6824. Drops.Add(new MineDrop() { ItemName = "BlackIronOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6825. break;
  6826. case 2:
  6827. TotalSlots = 100;
  6828. Drops.Add(new MineDrop() { ItemName = "PlatinumOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6829. Drops.Add(new MineDrop() { ItemName = "RubyOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6830. Drops.Add(new MineDrop() { ItemName = "NephriteOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6831. Drops.Add(new MineDrop() { ItemName = "AmethystOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  6832. break;
  6833. }
  6834. }
  6835. public void SetDrops(List<ItemInfo> items)
  6836. {
  6837. if (DropsSet) return;
  6838. for (int i = 0; i < Drops.Count; i++)
  6839. {
  6840. for (int j = 0; j < items.Count; j++)
  6841. {
  6842. ItemInfo info = items[j];
  6843. if (String.Compare(info.Name.Replace(" ", ""), Drops[i].ItemName, StringComparison.OrdinalIgnoreCase) != 0) continue;
  6844. Drops[i].Item = info;
  6845. break;
  6846. }
  6847. }
  6848. DropsSet = true;
  6849. }
  6850. }
  6851. public class MineSpot
  6852. {
  6853. public byte StonesLeft = 0;
  6854. public long LastRegenTick = 0;
  6855. public MineSet Mine;
  6856. }
  6857. public class MineDrop
  6858. {
  6859. public string ItemName;
  6860. public ItemInfo Item;
  6861. public byte MinSlot = 0;
  6862. public byte MaxSlot = 0;
  6863. public byte MinDura = 1;
  6864. public byte MaxDura = 1;
  6865. public byte BonusChance = 0;
  6866. public byte MaxBonusDura = 1;
  6867. }
  6868. public class MineZone
  6869. {
  6870. public int MapMineIndex;
  6871. public byte Mine;
  6872. public Point Location;
  6873. public ushort Size;
  6874. public MineZone()
  6875. {
  6876. }
  6877. public MineZone(MySqlDataReader readerMineZoneInfo)
  6878. {
  6879. MapMineIndex = Convert.ToInt32(readerMineZoneInfo["MapMineIndex"]);
  6880. Location = new Point(Convert.ToInt32(readerMineZoneInfo["Location_X"]), Convert.ToInt32(readerMineZoneInfo["Location_Y"]));
  6881. Size = Convert.ToUInt16(readerMineZoneInfo["Size"]);
  6882. Mine = Convert.ToByte(readerMineZoneInfo["Mine"]);
  6883. }
  6884. public MineZone(BinaryReader reader)
  6885. {
  6886. Location = new Point(reader.ReadInt32(), reader.ReadInt32());
  6887. Size = reader.ReadUInt16();
  6888. Mine = reader.ReadByte();
  6889. }
  6890. public void Save(BinaryWriter writer)
  6891. {
  6892. writer.Write(Location.X);
  6893. writer.Write(Location.Y);
  6894. writer.Write(Size);
  6895. writer.Write(Mine);
  6896. }
  6897. public override string ToString()
  6898. {
  6899. return string.Format("Mine: {0}- {1}", Functions.PointToString(Location), Mine);
  6900. }
  6901. }
  6902. #endregion
  6903. #region "Guild Related"
  6904. public class ItemVolume
  6905. {
  6906. public ItemInfo Item;
  6907. public string ItemName;
  6908. public uint Amount;
  6909. }
  6910. public class Rank
  6911. {
  6912. public List<GuildMember> Members = new List<GuildMember>();
  6913. public string Name = "";
  6914. public int Index = 0;
  6915. public RankOptions Options = (RankOptions)0;
  6916. public Rank()
  6917. {
  6918. }
  6919. public Rank(BinaryReader reader, bool Offline = false)
  6920. {
  6921. Name = reader.ReadString();
  6922. Options = (RankOptions)reader.ReadByte();
  6923. if (!Offline)
  6924. Index = reader.ReadInt32();
  6925. int Membercount = reader.ReadInt32();
  6926. for (int j = 0; j < Membercount; j++)
  6927. Members.Add(new GuildMember(reader, Offline));
  6928. }
  6929. public void Save(BinaryWriter writer, bool Save = false)
  6930. {
  6931. writer.Write(Name);
  6932. writer.Write((byte)Options);
  6933. if (!Save)
  6934. writer.Write(Index);
  6935. writer.Write(Members.Count);
  6936. for (int j = 0; j < Members.Count; j++)
  6937. Members[j].save(writer);
  6938. }
  6939. }
  6940. public class GuildStorageItem
  6941. {
  6942. public UserItem Item;
  6943. public long UserId = 0;
  6944. public GuildStorageItem()
  6945. {
  6946. }
  6947. public GuildStorageItem(BinaryReader reader)
  6948. {
  6949. Item = new UserItem(reader);
  6950. UserId = reader.ReadInt64();
  6951. }
  6952. public void save(BinaryWriter writer)
  6953. {
  6954. Item.Save(writer);
  6955. writer.Write(UserId);
  6956. }
  6957. }
  6958. public class GuildMember
  6959. {
  6960. public string name = "";
  6961. public int Id;
  6962. [JsonIgnore]
  6963. public object Player;
  6964. public DateTime LastLogin;
  6965. public bool hasvoted;
  6966. public bool Online;
  6967. public string LatestLocateMap="";
  6968. public int DonatePoint;
  6969. public GuildMember()
  6970. { }
  6971. public GuildMember(BinaryReader reader, bool Offline = false)
  6972. {
  6973. name = reader.ReadString();
  6974. Id = reader.ReadInt32();
  6975. LastLogin = DateTime.FromBinary(reader.ReadInt64());
  6976. hasvoted = reader.ReadBoolean();
  6977. Online = reader.ReadBoolean();
  6978. Online = Offline ? false : Online;
  6979. LatestLocateMap=reader.ReadString();
  6980. if (string.IsNullOrEmpty(LatestLocateMap))
  6981. {
  6982. LatestLocateMap = "";
  6983. }
  6984. DonatePoint=reader.ReadInt32();
  6985. }
  6986. public void save(BinaryWriter writer)
  6987. {
  6988. writer.Write(name);
  6989. writer.Write(Id);
  6990. writer.Write(LastLogin.ToBinary());
  6991. writer.Write(hasvoted);
  6992. writer.Write(Online);
  6993. writer.Write(LatestLocateMap);
  6994. writer.Write(DonatePoint);
  6995. }
  6996. }
  6997. [Flags]
  6998. [Obfuscation(Feature = "renaming", Exclude = true)]
  6999. public enum RankOptions : byte
  7000. {
  7001. CanChangeRank = 1,
  7002. CanRecruit = 2,
  7003. CanKick = 4,
  7004. CanStoreItem = 8,
  7005. CanRetrieveItem = 16,
  7006. CanAlterAlliance = 32,
  7007. CanChangeNotice = 64,
  7008. CanActivateBuff = 128
  7009. }
  7010. public class GuildBuffInfo
  7011. {
  7012. public int Id;
  7013. public int Icon = 0;
  7014. public string name = "";
  7015. public byte LevelRequirement;
  7016. public byte PointsRequirement = 1;
  7017. public int TimeLimit;
  7018. public int ActivationCost;
  7019. public byte BuffAc;
  7020. public byte BuffMac;
  7021. public byte BuffDc;
  7022. public byte BuffMc;
  7023. public byte BuffSc;
  7024. public byte BuffAttack;
  7025. public int BuffMaxHp;
  7026. public int BuffMaxMp;
  7027. public byte BuffMineRate;
  7028. public byte BuffGemRate;
  7029. public byte BuffFishRate;
  7030. public byte BuffExpRate;
  7031. public byte BuffCraftRate;
  7032. public byte BuffSkillRate;
  7033. public byte BuffHpRegen;
  7034. public byte BuffMPRegen;
  7035. public byte BuffDropRate;
  7036. public byte BuffGoldRate;
  7037. public GuildBuffInfo()
  7038. {
  7039. }
  7040. public GuildBuffInfo(BinaryReader reader)
  7041. {
  7042. Id = reader.ReadInt32();
  7043. Icon = reader.ReadInt32();
  7044. name = reader.ReadString();
  7045. LevelRequirement = reader.ReadByte();
  7046. PointsRequirement = reader.ReadByte();
  7047. TimeLimit = reader.ReadInt32();
  7048. ActivationCost = reader.ReadInt32();
  7049. BuffAc = reader.ReadByte();
  7050. BuffMac = reader.ReadByte();
  7051. BuffDc = reader.ReadByte();
  7052. BuffMc = reader.ReadByte();
  7053. BuffSc = reader.ReadByte();
  7054. BuffMaxHp = reader.ReadInt32();
  7055. BuffMaxMp = reader.ReadInt32();
  7056. BuffMineRate = reader.ReadByte();
  7057. BuffGemRate = reader.ReadByte();
  7058. BuffFishRate = reader.ReadByte();
  7059. BuffExpRate = reader.ReadByte();
  7060. BuffCraftRate = reader.ReadByte();
  7061. BuffSkillRate = reader.ReadByte();
  7062. BuffHpRegen = reader.ReadByte();
  7063. BuffMPRegen = reader.ReadByte();
  7064. BuffAttack = reader.ReadByte();
  7065. BuffDropRate = reader.ReadByte();
  7066. BuffGoldRate = reader.ReadByte();
  7067. }
  7068. public GuildBuffInfo(InIReader reader, int i)
  7069. {
  7070. Id = reader.ReadInt32("Buff-" + i.ToString(), "Id", 0);
  7071. Icon = reader.ReadInt32("Buff-" + i.ToString(), "Icon", 0);
  7072. name = reader.ReadString("Buff-" + i.ToString(), "Name", "");
  7073. LevelRequirement = reader.ReadByte("Buff-" + i.ToString(), "LevelReq", 0);
  7074. PointsRequirement = reader.ReadByte("Buff-" + i.ToString(), "PointsReq", 1);
  7075. TimeLimit = reader.ReadInt32("Buff-" + i.ToString(), "TimeLimit", 0); ;
  7076. ActivationCost = reader.ReadInt32("Buff-" + i.ToString(), "ActivationCost", 0);
  7077. BuffAc = reader.ReadByte("Buff-" + i.ToString(), "BuffAc", 0);
  7078. BuffMac = reader.ReadByte("Buff-" + i.ToString(), "BuffMAC", 0);
  7079. BuffDc = reader.ReadByte("Buff-" + i.ToString(), "BuffDc", 0);
  7080. BuffMc = reader.ReadByte("Buff-" + i.ToString(), "BuffMc", 0);
  7081. BuffSc = reader.ReadByte("Buff-" + i.ToString(), "BuffSc", 0);
  7082. BuffMaxHp = reader.ReadInt32("Buff-" + i.ToString(), "BuffMaxHp", 0);
  7083. BuffMaxMp = reader.ReadInt32("Buff-" + i.ToString(), "BuffMaxMp", 0);
  7084. BuffMineRate = reader.ReadByte("Buff-" + i.ToString(), "BuffMineRate", 0);
  7085. BuffGemRate = reader.ReadByte("Buff-" + i.ToString(), "BuffGemRate", 0);
  7086. BuffFishRate = reader.ReadByte("Buff-" + i.ToString(), "BuffFishRate", 0);
  7087. BuffExpRate = reader.ReadByte("Buff-" + i.ToString(), "BuffExpRate", 0);
  7088. BuffCraftRate = reader.ReadByte("Buff-" + i.ToString(), "BuffCraftRate", 0);
  7089. BuffSkillRate = reader.ReadByte("Buff-" + i.ToString(), "BuffSkillRate", 0);
  7090. BuffHpRegen = reader.ReadByte("Buff-" + i.ToString(), "BuffHpRegen", 0);
  7091. BuffMPRegen = reader.ReadByte("Buff-" + i.ToString(), "BuffMpRegen", 0);
  7092. BuffAttack = reader.ReadByte("Buff-" + i.ToString(), "BuffAttack", 0);
  7093. BuffDropRate = reader.ReadByte("Buff-" + i.ToString(), "BuffDropRate", 0);
  7094. BuffGoldRate = reader.ReadByte("Buff-" + i.ToString(), "BuffGoldRate", 0);
  7095. }
  7096. public void Save(InIReader reader, int i)
  7097. {
  7098. reader.Write("Buff-" + i.ToString(), "Id", Id);
  7099. reader.Write("Buff-" + i.ToString(), "Icon", Icon);
  7100. reader.Write("Buff-" + i.ToString(), "Name", name);
  7101. reader.Write("Buff-" + i.ToString(), "LevelReq", LevelRequirement);
  7102. reader.Write("Buff-" + i.ToString(), "PointsReq", PointsRequirement);
  7103. reader.Write("Buff-" + i.ToString(), "TimeLimit", TimeLimit); ;
  7104. reader.Write("Buff-" + i.ToString(), "ActivationCost", ActivationCost); ;
  7105. reader.Write("Buff-" + i.ToString(), "BuffAc", BuffAc); ;
  7106. reader.Write("Buff-" + i.ToString(), "BuffMAC", BuffMac); ;
  7107. reader.Write("Buff-" + i.ToString(), "BuffDc", BuffDc); ;
  7108. reader.Write("Buff-" + i.ToString(), "BuffMc", BuffMc); ;
  7109. reader.Write("Buff-" + i.ToString(), "BuffSc", BuffSc); ;
  7110. reader.Write("Buff-" + i.ToString(), "BuffMaxHp", BuffMaxHp); ;
  7111. reader.Write("Buff-" + i.ToString(), "BuffMaxMp", BuffMaxMp); ;
  7112. reader.Write("Buff-" + i.ToString(), "BuffMineRate", BuffMineRate); ;
  7113. reader.Write("Buff-" + i.ToString(), "BuffGemRate", BuffGemRate); ;
  7114. reader.Write("Buff-" + i.ToString(), "BuffFishRate", BuffFishRate); ;
  7115. reader.Write("Buff-" + i.ToString(), "BuffExpRate", BuffExpRate); ;
  7116. reader.Write("Buff-" + i.ToString(), "BuffCraftRate", BuffCraftRate); ;
  7117. reader.Write("Buff-" + i.ToString(), "BuffSkillRate", BuffSkillRate); ;
  7118. reader.Write("Buff-" + i.ToString(), "BuffHpRegen", BuffHpRegen); ;
  7119. reader.Write("Buff-" + i.ToString(), "BuffMpRegen", BuffMPRegen); ;
  7120. reader.Write("Buff-" + i.ToString(), "BuffAttack", BuffAttack); ;
  7121. reader.Write("Buff-" + i.ToString(), "BuffDropRate", BuffDropRate); ;
  7122. reader.Write("Buff-" + i.ToString(), "BuffGoldRate", BuffGoldRate); ;
  7123. }
  7124. public void Save(BinaryWriter writer)
  7125. {
  7126. writer.Write(Id);
  7127. writer.Write(Icon);
  7128. writer.Write(name);
  7129. writer.Write(LevelRequirement);
  7130. writer.Write(PointsRequirement);
  7131. writer.Write(TimeLimit);
  7132. writer.Write(ActivationCost);
  7133. writer.Write(BuffAc);
  7134. writer.Write(BuffMac);
  7135. writer.Write(BuffDc);
  7136. writer.Write(BuffMc);
  7137. writer.Write(BuffSc);
  7138. writer.Write(BuffMaxHp);
  7139. writer.Write(BuffMaxMp);
  7140. writer.Write(BuffMineRate);
  7141. writer.Write(BuffGemRate);
  7142. writer.Write(BuffFishRate);
  7143. writer.Write(BuffExpRate);
  7144. writer.Write(BuffCraftRate);
  7145. writer.Write(BuffSkillRate);
  7146. writer.Write(BuffHpRegen);
  7147. writer.Write(BuffMPRegen);
  7148. writer.Write(BuffAttack);
  7149. writer.Write(BuffDropRate);
  7150. writer.Write(BuffGoldRate);
  7151. }
  7152. public override string ToString()
  7153. {
  7154. return string.Format("{0}: {1}", Id, name);
  7155. }
  7156. public string ShowStats()
  7157. {
  7158. string text = string.Empty;
  7159. //text = name + "\n";
  7160. if (BuffAc > 0)
  7161. {
  7162. text += string.Format("防御力+ 0-{0}.", BuffAc);
  7163. if (text != "") text += "\n";
  7164. }
  7165. if (BuffMac > 0)
  7166. {
  7167. text += string.Format("魔法防御+ 0-{0}.", BuffMac);
  7168. if (text != "") text += "\n";
  7169. }
  7170. if (BuffDc > 0)
  7171. {
  7172. text += string.Format("攻击+ 0-{0}.", BuffDc);
  7173. if (text != "") text += "\n";
  7174. }
  7175. if (BuffMc > 0)
  7176. {
  7177. text += string.Format("自然系魔法+ 0-{0}.", BuffMc);
  7178. if (text != "") text += "\n";
  7179. }
  7180. if (BuffSc > 0)
  7181. {
  7182. text += string.Format("灵魂系魔法+ 0-{0}.", BuffSc);
  7183. if (text != "") text += "\n";
  7184. }
  7185. if (BuffMaxHp > 0)
  7186. {
  7187. text += string.Format("HP + {0}.", BuffMaxHp);
  7188. if (text != "") text += "\n";
  7189. }
  7190. if (BuffMaxMp > 0)
  7191. {
  7192. text += string.Format("MP + {0}.", BuffMaxMp);
  7193. if (text != "") text += "\n";
  7194. }
  7195. if (BuffHpRegen > 0)
  7196. {
  7197. text += string.Format("HP恢复+ {0}.", BuffHpRegen);
  7198. if (text != "") text += "\n";
  7199. }
  7200. if (BuffMPRegen > 0)
  7201. {
  7202. text += string.Format("MP恢复+ {0}.", BuffMPRegen);
  7203. if (text != "") text += "\n";
  7204. }
  7205. if (BuffMineRate > 0)
  7206. {
  7207. text += string.Format("采矿出矿率+ {0}%.", BuffMineRate * 5);
  7208. if (text != "") text += "\n";
  7209. }
  7210. if (BuffGemRate > 0)
  7211. {
  7212. text += string.Format("宝玉成功率+ {0}%.", BuffGemRate * 5);
  7213. if (text != "") text += "\n";
  7214. }
  7215. if (BuffFishRate > 0)
  7216. {
  7217. text += string.Format("钓鱼成功率+ {0}%.", BuffFishRate * 5);
  7218. if (text != "") text += "\n";
  7219. }
  7220. if (BuffExpRate > 0)
  7221. {
  7222. text += string.Format("获取经验+ {0}%.", BuffExpRate);
  7223. if (text != "") text += "\n";
  7224. }
  7225. if (BuffCraftRate > 0)
  7226. {
  7227. text += string.Format("制作成功率+ {0}%.", BuffCraftRate * 5);
  7228. if (text != "") text += "\n";
  7229. }
  7230. if (BuffSkillRate > 0)
  7231. {
  7232. text += string.Format("技能熟练度+ {0}.", BuffSkillRate);
  7233. if (text != "") text += "\n";
  7234. }
  7235. if (BuffAttack > 0)
  7236. {
  7237. text += string.Format("伤害+ {0}.", BuffAttack);
  7238. if (text != "") text += "\n";
  7239. }
  7240. if (BuffDropRate > 0)
  7241. {
  7242. text += string.Format("掉宝率+ {0}%.", BuffDropRate);
  7243. if (text != "") text += "\n";
  7244. }
  7245. if (BuffGoldRate > 0)
  7246. {
  7247. text += string.Format("庄园税金+ {0}%.", BuffGoldRate);
  7248. if (text != "") text += "\n";
  7249. }
  7250. return text;
  7251. }
  7252. }
  7253. public class GuildMemberRequest
  7254. {
  7255. public int Index;
  7256. public DateTime RequestTime;
  7257. public string Remark;
  7258. }
  7259. public class GuildBuff
  7260. {
  7261. public int Id;
  7262. public GuildBuffInfo Info;
  7263. public bool Active = false;
  7264. public int ActiveTimeRemaining;
  7265. public bool UsingGuildSkillIcon
  7266. {
  7267. get { return Info != null && Info.Icon < 1000; }
  7268. }
  7269. public GuildBuff()
  7270. {
  7271. }
  7272. public GuildBuff(BinaryReader reader)
  7273. {
  7274. Id = reader.ReadInt32();
  7275. Active = reader.ReadBoolean();
  7276. ActiveTimeRemaining = reader.ReadInt32();
  7277. }
  7278. public void Save(BinaryWriter writer)
  7279. {
  7280. writer.Write(Id);
  7281. writer.Write(Active);
  7282. writer.Write(ActiveTimeRemaining);
  7283. }
  7284. public string PrintTimeSpan(double secs)
  7285. {
  7286. TimeSpan t = TimeSpan.FromMinutes(secs);
  7287. string answer;
  7288. if (t.TotalMinutes < 1.0)
  7289. {
  7290. answer = string.Format("{0}s", t.Seconds);
  7291. }
  7292. else if (t.TotalHours < 1.0)
  7293. {
  7294. answer = string.Format("{0}ms", t.Minutes);
  7295. }
  7296. else // more than 1 hour
  7297. {
  7298. answer = string.Format("{0}h {1:D2}m ", (int)t.TotalHours, t.Minutes);
  7299. }
  7300. return answer;
  7301. }
  7302. public string ShowStats()
  7303. {
  7304. if (Info == null) return "";
  7305. return Info.ShowStats();
  7306. }
  7307. }
  7308. //outdated but cant delete it or old db's wont load
  7309. public class GuildBuffOld
  7310. {
  7311. public GuildBuffOld()
  7312. { }
  7313. public GuildBuffOld(BinaryReader reader)
  7314. {
  7315. reader.ReadByte();
  7316. reader.ReadInt64();
  7317. }
  7318. }
  7319. #endregion
  7320. #region Ranking Pete107|Petesn00beh 15/1/2016
  7321. public class Rank_Character_Info
  7322. {
  7323. public long PlayerId;
  7324. public string Name;
  7325. public MirClass Class;
  7326. public int level;
  7327. //排行榜;
  7328. public long Experience;//clients shouldnt care about this only server
  7329. public object info;//again only keep this on server!
  7330. public Rank_Character_Info()
  7331. {
  7332. }
  7333. public Rank_Character_Info(BinaryReader reader)
  7334. {
  7335. //rank = reader.ReadInt32();
  7336. PlayerId = reader.ReadInt64();
  7337. Name = reader.ReadString();
  7338. level = reader.ReadInt32();
  7339. Class = (MirClass)reader.ReadByte();
  7340. }
  7341. public void Save(BinaryWriter writer)
  7342. {
  7343. //writer.Write(rank);
  7344. writer.Write(PlayerId);
  7345. writer.Write(Name);
  7346. writer.Write(level);
  7347. writer.Write((byte)Class);
  7348. }
  7349. }
  7350. #endregion
  7351. public class Door
  7352. {
  7353. public byte index;
  7354. public byte DoorState;//0: 关闭, 1: 打开中, 2: 打开, 3: 关闭中
  7355. public byte ImageIndex;
  7356. public long LastTick;
  7357. public Point Location;
  7358. }
  7359. public class Accountdata
  7360. {
  7361. public virtual int IndexID { get; set; }
  7362. public virtual string AccountID { get; set; }
  7363. public virtual string Password { get; set; }
  7364. public virtual int AccountResize { get; set; }
  7365. public virtual int Gold { get; set; }
  7366. public virtual int Credit { get; set; }
  7367. public virtual short AdminAccount { get; set; }
  7368. public virtual int HookSuspicionLevel { get; set; }
  7369. public Accountdata()
  7370. {
  7371. }
  7372. public Accountdata(BinaryReader reader)
  7373. {
  7374. IndexID = reader.ReadInt32();
  7375. AccountID = reader.ReadString();
  7376. Password = reader.ReadString();
  7377. AccountResize = reader.ReadInt32();
  7378. Gold = reader.ReadInt32();
  7379. Credit = reader.ReadInt32();
  7380. AdminAccount = reader.ReadInt16();
  7381. HookSuspicionLevel = reader.ReadInt32();
  7382. }
  7383. public void Save(BinaryWriter writer)
  7384. {
  7385. writer.Write(IndexID);
  7386. writer.Write(AccountID);
  7387. writer.Write(Password);
  7388. writer.Write(AccountResize);
  7389. writer.Write(Gold);
  7390. writer.Write(Credit);
  7391. writer.Write(AdminAccount);
  7392. writer.Write(HookSuspicionLevel);
  7393. }
  7394. }