Read item data from ItemInfo.shn
This commit is contained in:
parent
a32366b8c8
commit
1811120eed
@ -8,6 +8,7 @@
|
||||
#include "olcPGEX_TransformedView.h"
|
||||
#include "FiestaOnlineEditor.h"
|
||||
#include "ActionIDs.h"
|
||||
#include "ItemEditor.h"
|
||||
|
||||
FiestaOnlineEditor::FiestaOnlineEditor()
|
||||
{
|
||||
@ -114,7 +115,7 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
||||
case LOAD_ITEM_EDITOR:{
|
||||
ItemEditor*itemEditor=new ItemEditor(this,"Item Editor: "+config["DefaultPath"].GetString(),{32,32},GetScreenSize()-vi2d{64,64});
|
||||
CreateWindow(itemEditor);
|
||||
itemEditor->Load(config["DefaultPath"].GetString());
|
||||
itemEditor->Load(config["DefaultPath"].GetString(),config["ClientPath"].GetString());
|
||||
manager.Close();
|
||||
menuOpened=false;
|
||||
}break;
|
||||
|
@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include "olcPGEX_PopupMenu.h"
|
||||
#include "SHNFileDecryptor.h"
|
||||
#include "OpenFileDialog.h"
|
||||
#include "State.h"
|
||||
#include "ItemEditor.h"
|
||||
#include "olcUTIL_DataFile.h"
|
||||
#include "Window.h"
|
||||
|
||||
class FiestaOnlineEditor : public olc::PixelGameEngine
|
||||
{
|
||||
|
@ -1,14 +1,57 @@
|
||||
#include "FiestaOnlineEditor.h"
|
||||
#include "SHNFileDecryptor.h"
|
||||
#include "ItemEditor.h"
|
||||
|
||||
MoneyDivision Money::GetMoneyDivisions(){
|
||||
return {int(money/100000000),int(money/1000000)%100,int(money/1000)%1000,int(money)%1000};
|
||||
}
|
||||
|
||||
Money::Money()
|
||||
:money(0){}
|
||||
|
||||
Money::Money(uint32_t money)
|
||||
:money(money){}
|
||||
|
||||
Item::Item(){}
|
||||
|
||||
ItemEditor::ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size)
|
||||
:Window(pge,windowTitle,pos,size){}
|
||||
|
||||
ItemEditor::~ItemEditor(){};
|
||||
|
||||
void ItemEditor::Load(std::string basePath){
|
||||
void ItemEditor::Load(std::string basePath,std::string clientPath){
|
||||
ItemInfo.Load(basePath+"/ItemInfo.shn");
|
||||
ItemInfoServer.Load(basePath+"/ItemInfoServer.shn");
|
||||
ItemViewInfo.Load(basePath+"/View/ItemViewInfo.shn");
|
||||
for(int i=0;i<ItemInfo.Rows();i++){
|
||||
Item it;
|
||||
it.id=ItemInfo.Get<uint16_t>(i,0);
|
||||
it.inxName=ItemInfo.Get<std::string>(i,1);
|
||||
it.name=ItemInfo.Get<std::string>(i,2);
|
||||
it.stackSize=ItemInfo.Get<uint32_t>(i,5);
|
||||
it.grade=ItemGrade(ItemInfo.Get<uint32_t>(i,8));
|
||||
it.attackSpd=ItemInfo.Get<uint32_t>(i,10);
|
||||
it.lvReq=ItemInfo.Get<uint32_t>(i,11);
|
||||
it.atk_min=ItemInfo.Get<uint32_t>(i,13);
|
||||
it.atk_max=ItemInfo.Get<uint32_t>(i,14);
|
||||
it.def=ItemInfo.Get<uint32_t>(i,15);
|
||||
it.magAtk_min=ItemInfo.Get<uint32_t>(i,16);
|
||||
it.magAtk_max=ItemInfo.Get<uint32_t>(i,17);
|
||||
it.magDef=ItemInfo.Get<uint32_t>(i,18);
|
||||
it.aim=ItemInfo.Get<uint32_t>(i,19);
|
||||
it.eva=ItemInfo.Get<uint32_t>(i,20);
|
||||
it.atkPctBonus=ItemInfo.Get<uint32_t>(i,21);
|
||||
it.magAtkPctBonus=ItemInfo.Get<uint32_t>(i,22);
|
||||
it.defPctBonus=ItemInfo.Get<uint32_t>(i,23);
|
||||
it.magDefPctBonus=ItemInfo.Get<uint32_t>(i,24);
|
||||
it.critRate=ItemInfo.Get<uint32_t>(i,25);
|
||||
it.useClass=Class(ItemInfo.Get<uint32_t>(i,31));
|
||||
it.buyPrice=Money(ItemInfo.Get<uint32_t>(i,32));
|
||||
it.sellPrice=Money(ItemInfo.Get<uint32_t>(i,33));
|
||||
it.enhanceLimit=ItemInfo.Get<uint32_t>(i,40);
|
||||
it.blockRate=ItemInfo.Get<uint32_t>(i,46);
|
||||
itemList[it.id]=it;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEditor::Update(FiestaOnlineEditor*pge,float fElapsedTime){
|
||||
|
@ -1,17 +1,149 @@
|
||||
#pragma once
|
||||
#include "SHNFileDecryptor.h"
|
||||
#include "olcPGEX_TransformedView.h"
|
||||
#include "Window.h"
|
||||
|
||||
class FiestaOnlineEditor;
|
||||
|
||||
struct MoneyDivision{
|
||||
int gem,gold,silver,copper;
|
||||
};
|
||||
|
||||
class Money{
|
||||
uint32_t money;
|
||||
public:
|
||||
MoneyDivision GetMoneyDivisions();
|
||||
Money();
|
||||
Money(uint32_t money);
|
||||
};
|
||||
|
||||
enum Class{
|
||||
FIGHTER=2,
|
||||
CLEVERFIGHTER=3,
|
||||
WARRIOR=4,
|
||||
KNIGHT_GLADIATOR=5,
|
||||
GLADIATOR=6,
|
||||
KNIGHT=7,
|
||||
CLIERIC=8,
|
||||
HIGHCLERIC=9,
|
||||
PALADIN=10,
|
||||
GUARDIAN=11,
|
||||
HOLYKNIGHT=12,
|
||||
HOLYKNIGHT_GUARDIAN=13,
|
||||
ARCHER=14,
|
||||
HAWKARCHER=15,
|
||||
SCOUT=16,
|
||||
RANGER=17,
|
||||
SHARPSHOOTER=18,
|
||||
SHARPSHOOTER_RANGER=19,
|
||||
MAGE=20,
|
||||
WIZMAGE=21,
|
||||
ENCHANTER=22,
|
||||
WIZARD=23,
|
||||
WARLOCK=24,
|
||||
WIZARD_WARLOCK=25,
|
||||
TRICKSTER=27,
|
||||
GAMBIT=28,
|
||||
RENEGADE=29,
|
||||
REAPER=30,
|
||||
SPECTRE=31,
|
||||
SPECTRE_REAPER=32,
|
||||
CRUSADER=33,
|
||||
TEMPLAR=34,
|
||||
};
|
||||
|
||||
enum EquipSlot{
|
||||
CONSUMABLE,
|
||||
MINIPET,
|
||||
UNKNOWN,
|
||||
MINIPET2,
|
||||
TAIL_ACC,
|
||||
BACK_ACC,
|
||||
WEAPONSKIN_1, //One-hand sword, mace, hammer
|
||||
WEAPONSKIN_2, //Shield, Bow
|
||||
WEAPONSKIN_3, //Staff, Wand, Two-hand, Axe, Crossbow, Claw, Dual Blades
|
||||
HAT_ACC,
|
||||
FACE_ACC,
|
||||
PIECE3_UPPER,
|
||||
PIECE3_LOWER,
|
||||
PIECE3_SHOES,
|
||||
PIECE2_LOWERBODY_SHOES,
|
||||
PIECE1,
|
||||
SHOE,
|
||||
LEGGING,
|
||||
RING,
|
||||
SHIELD,
|
||||
BODY,
|
||||
WEAPON1, // One-hand sword, mace, hammer
|
||||
WEAPON2, // Staff, Wand, Two-hand, Axe, Crossbow, Claw, Dual Blades
|
||||
WEAPON3, // Bow
|
||||
EARRING,
|
||||
HAT,
|
||||
NECKLACE,
|
||||
MASK,
|
||||
KQ_HAMMER,
|
||||
EVENT_MASK,
|
||||
UNKNOWN2,
|
||||
AURA,
|
||||
EVENT_SHIELD,
|
||||
BIJOU_ACC,
|
||||
};
|
||||
|
||||
enum ItemGrade{
|
||||
NORMAL,
|
||||
GREEN,
|
||||
RARE,
|
||||
LEGENDARY,
|
||||
SPECIAL,
|
||||
SETITEM,
|
||||
ULTIMATE,
|
||||
};
|
||||
|
||||
class Item{
|
||||
public:
|
||||
uint16_t id;
|
||||
Renderable*icon;
|
||||
std::string inxName;
|
||||
std::string name;
|
||||
std::string description;
|
||||
EquipSlot slot;
|
||||
uint32_t lvReq;
|
||||
uint32_t iconIndex;
|
||||
uint32_t subIconIndex;
|
||||
uint32_t stackSize;
|
||||
Class useClass;
|
||||
Money buyPrice;
|
||||
Money sellPrice;
|
||||
ItemGrade grade;
|
||||
Pixel borderCol;
|
||||
Pixel blendCol;
|
||||
uint32_t attackSpd;
|
||||
uint32_t atk_min;
|
||||
uint32_t atk_max;
|
||||
uint32_t def;
|
||||
uint32_t magAtk_min;
|
||||
uint32_t magAtk_max;
|
||||
uint32_t magDef;
|
||||
uint32_t aim;
|
||||
uint32_t eva;
|
||||
uint32_t atkPctBonus;
|
||||
uint32_t defPctBonus;
|
||||
uint32_t magAtkPctBonus;
|
||||
uint32_t magDefPctBonus;
|
||||
uint32_t critRate;
|
||||
uint32_t enhanceLimit;
|
||||
uint32_t blockRate;
|
||||
public:
|
||||
Item();
|
||||
};
|
||||
|
||||
class ItemEditor:public Window{
|
||||
SHNFile ItemInfo,ItemInfoServer,ItemViewInfo;
|
||||
vf2d pos={64,64};
|
||||
std::map<std::string,Renderable>imgLookup;
|
||||
std::map<int,Item>itemList;
|
||||
public:
|
||||
ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size);
|
||||
~ItemEditor();
|
||||
void Load(std::string basePath);
|
||||
void Load(std::string basePath,std::string clientPath);
|
||||
void Refresh(FiestaOnlineEditor*pge)override;
|
||||
void Update(FiestaOnlineEditor*pge,float fElapsedTime)override;
|
||||
void MouseFocus(FiestaOnlineEditor*pge)override;
|
||||
|
@ -98,9 +98,13 @@ public:
|
||||
void Write(int row,int col,uint32_t val);
|
||||
void Write(int row,int col,float val);
|
||||
void Write(int row,int col,std::string val);
|
||||
int Rows();
|
||||
int Cols();
|
||||
//const SHNFile::Data Get(int row,int col)const;
|
||||
template<typename T>
|
||||
const T Get(int row,int col)const;
|
||||
const T Get(int row,int col)const{
|
||||
return *(std::static_pointer_cast<T>(contents[row][col].data));
|
||||
};
|
||||
SHNFile();
|
||||
SHNFile(SHNFile&&)noexcept;
|
||||
~SHNFile();
|
||||
@ -349,6 +353,12 @@ std::string SHNFile::Data::GetDisplayText(){
|
||||
}break;
|
||||
}
|
||||
}
|
||||
int SHNFile::Rows(){
|
||||
return contents.size();
|
||||
}
|
||||
int SHNFile::Cols(){
|
||||
return columnCount;
|
||||
}
|
||||
void SHNFile::Load(std::string file){
|
||||
header=recordCount=defaultRecordLength=columnCount=0;
|
||||
columns.clear();
|
||||
@ -525,10 +535,6 @@ void SHNFile::Save(){
|
||||
WriteBytes(encryptedFile,data,readAmt-0x24);
|
||||
std::cout<<"File "<<filename<<" Saved!"<<std::endl;
|
||||
}
|
||||
template<typename T>
|
||||
const T SHNFile::Get(int row,int col)const{
|
||||
return *(std::static_pointer_cast<T>(contents[row][col].data));
|
||||
};
|
||||
void SHNFile::Write(int row,int col,std::byte val){
|
||||
contents[row][col].Set<std::byte>(val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user