dodumap

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 15 Imported by: 3

README

dodumap

Mapping raw Dofus data to a more usable format.

go get -u github.com/dofusdude/dodumap

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages = []string{"fr", "en", "de", "es", "it", "pt"}

Functions

func CleanJSON

func CleanJSON(jsonStr string) string

func ConditionWithOperator

func ConditionWithOperator(input string, operator string, langs *map[string]LangDict, out *MappedMultilangCondition, data *JSONGameData) bool

func DeleteDamageFormatter

func DeleteDamageFormatter(input string) string

func DeleteReplacer

func DeleteReplacer(input string) string

func ElementFromCode

func ElementFromCode(codeUndef string) int

func LoadPersistedElements

func LoadPersistedElements(persistenceDir string, release string) error

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func NumSpellFormatter

func NumSpellFormatter(input string, lang string, gameData *JSONGameData, langs *map[string]LangDict, diceNum *int, diceSide *int, value *int, effectNameId int, numIsSpell bool, useDice bool, frNumSigned *int, frSideSigned *int) (string, int)

NumSpellFormatter returns info about min max with in. -1 "only_min", -2 "no_min_max"

func ParseCondition

func ParseCondition(condition string, langs *map[string]LangDict, data *JSONGameData) ([]MappedMultilangCondition, *ConditionTreeNodeMapped)

func ParseEffects

func ParseEffects(data *JSONGameData, allEffects [][]*JSONGameItemPossibleEffect, langs *map[string]LangDict) [][]MappedMultilangEffect

func ParseItemCombo added in v0.2.1

func ParseItemCombo(rawEffects [][]*JSONGameItemPossibleEffect, effects [][]MappedMultilangEffect) [][]MappedMultilangSetEffect

func ParseRawDataPart

func ParseRawDataPart[T HasId](fileSource string, result chan map[int]T, dir string)

func ParseRawLanguages

func ParseRawLanguages(dir string) map[string]LangDict

func ParseSigness

func ParseSigness(input string) (bool, bool)

func PersistElements

func PersistElements(elementPath string, itemTypePath string) error

func PrepareAndCreateRangeRegex

func PrepareAndCreateRangeRegex(input string, extract bool) (string, *regexp.Regexp)

func PrepareTextForRegex

func PrepareTextForRegex(input string) string

func PrintTree added in v0.1.1

func PrintTree(node *ConditionTreeNode, level int)

func SingularPluralFormatter

func SingularPluralFormatter(input string, amount int, lang string) string

Types

type ConditionTreeNode added in v0.1.1

type ConditionTreeNode struct {
	Value    string
	Type     NodeType
	Children []*ConditionTreeNode
}

func ParseExpression added in v0.1.1

func ParseExpression(exp string) *ConditionTreeNode

func (*ConditionTreeNode) AddChild added in v0.1.1

func (n *ConditionTreeNode) AddChild(child *ConditionTreeNode)

AddChild adds a child node

type ConditionTreeNodeMapped added in v0.1.1

type ConditionTreeNodeMapped struct {
	Value     *MappedMultilangCondition  `json:"value"`
	IsOperand bool                       `json:"is_operand"`
	Relation  *string                    `json:"relation"` // "and" or "or"
	Children  []*ConditionTreeNodeMapped `json:"children"`
}

type HasId

type HasId interface {
	GetID() int
}

type JSONGameAlamanaxCalendar added in v0.2.0

type JSONGameAlamanaxCalendar struct {
	Id         int   `json:"id"`
	DescId     int   `json:"descId"`
	NameId     int   `json:"nameId"`
	NpcId      int   `json:"npcId"`
	BonusesIds []int `json:"bonusesIds"`
}

func (JSONGameAlamanaxCalendar) GetID added in v0.2.0

func (i JSONGameAlamanaxCalendar) GetID() int

type JSONGameArea

type JSONGameArea struct {
	Id              int                `json:"id"`
	NameId          int                `json:"nameId"`
	SuperAreaId     int                `json:"superAreaId"`
	ContainHouses   bool               `json:"containHouses"`
	ContainPaddocks bool               `json:"containPaddocks"`
	Bounds          JSONGameAreaBounds `json:"bounds"`
	WorldmapId      int                `json:"worldmapId"`
	HasWorldMap     bool               `json:"hasWorldMap"`
}

func (JSONGameArea) GetID

func (i JSONGameArea) GetID() int

type JSONGameAreaBounds

type JSONGameAreaBounds struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

type JSONGameBonus

type JSONGameBonus struct {
	Amount        int   `json:"amount"`
	Id            int   `json:"id"`
	CriterionsIds []int `json:"criterionsIds"`
	Type          int   `json:"type"`
}

func (JSONGameBonus) GetID

func (i JSONGameBonus) GetID() int

type JSONGameBreed

type JSONGameBreed struct {
	Id            int `json:"id"`
	ShortNameId   int `json:"shortNameId"`
	LongNameId    int `json:"longNameId"`
	DescriptionId int `json:"descriptionId"`
}

func (JSONGameBreed) GetID

func (i JSONGameBreed) GetID() int

type JSONGameCoordinate added in v0.2.0

type JSONGameCoordinate struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type JSONGameData

type JSONGameData struct {
	Items     map[int]JSONGameItem
	Sets      map[int]JSONGameSet
	ItemTypes map[int]JSONGameItemType

	Recipes map[int]JSONGameRecipe

	Mounts map[int]JSONGameMount

	MountFamilys map[int]JSONGameMountFamily
	// contains filtered or unexported fields
}

func ParseRawData

func ParseRawData(dir string) *JSONGameData

type JSONGameEffect

type JSONGameEffect struct {
	Id                       int  `json:"id"`
	DescriptionId            int  `json:"descriptionId"`
	IconId                   int  `json:"iconId"`
	Characteristic           int  `json:"characteristic"`
	Category                 int  `json:"category"`
	UseDice                  bool `json:"useDice"`
	Active                   bool `json:"active"`
	TheoreticalDescriptionId int  `json:"theoreticalDescriptionId"`
	BonusType                int  `json:"bonusType"` // -1,0,+1
	ElementId                int  `json:"elementId"`
	UseInFight               bool `json:"useInFight"`
}

func (JSONGameEffect) GetID

func (i JSONGameEffect) GetID() int

type JSONGameItem

type JSONGameItem struct {
	Id            int `json:"id"`
	TypeId        int `json:"typeId"`
	DescriptionId int `json:"descriptionId"`
	IconId        int `json:"iconId"`
	NameId        int `json:"nameId"`
	Level         int `json:"level"`

	PossibleEffects        []*JSONGameItemPossibleEffect `json:"possibleEffects"`
	RecipeIds              []int                         `json:"recipeIds"`
	Pods                   int                           `json:"realWeight"`
	ParseEffects           bool                          `json:"useDice"`
	EvolutiveEffectIds     []int                         `json:"evolutiveEffectIds"`
	DropMonsterIds         []int                         `json:"dropMonsterIds"`
	ItemSetId              int                           `json:"itemSetId"`
	Criteria               string                        `json:"criteria"`
	CriticalHitBonus       int                           `json:"criticalHitBonus"`
	TwoHanded              bool                          `json:"twoHanded"`
	MaxCastPerTurn         int                           `json:"maxCastPerTurn"`
	ApCost                 int                           `json:"apCost"`
	Range                  int                           `json:"range"`
	MinRange               int                           `json:"minRange"`
	CriticalHitProbability int                           `json:"criticalHitProbability"`
}

func (JSONGameItem) GetID

func (i JSONGameItem) GetID() int

type JSONGameItemPossibleEffect

type JSONGameItemPossibleEffect struct {
	EffectId     int `json:"effectId"`
	MinimumValue int `json:"diceNum"`
	MaximumValue int `json:"diceSide"`
	Value        int `json:"value"`

	BaseEffectId  int `json:"baseEffectId"`
	EffectElement int `json:"effectElement"`
	Dispellable   int `json:"dispellable"`
	SpellId       int `json:"spellId"`
	Duration      int `json:"duration"`
}

func (JSONGameItemPossibleEffect) GetID

func (i JSONGameItemPossibleEffect) GetID() int

type JSONGameItemType

type JSONGameItemType struct {
	Id          int `json:"id"`
	NameId      int `json:"nameId"`
	SuperTypeId int `json:"superTypeId"`
	CategoryId  int `json:"categoryId"`
}

func (JSONGameItemType) GetID

func (i JSONGameItemType) GetID() int

type JSONGameMount

type JSONGameMount struct {
	Id       int                           `json:"id"`
	FamilyId int                           `json:"familyId"`
	NameId   int                           `json:"nameId"`
	Effects  []*JSONGameItemPossibleEffect `json:"effects"`
}

func (JSONGameMount) GetID

func (i JSONGameMount) GetID() int

type JSONGameMountFamily

type JSONGameMountFamily struct {
	Id      int    `json:"id"`
	NameId  int    `json:"nameId"`
	HeadUri string `json:"headUri"`
}

func (JSONGameMountFamily) GetID

func (i JSONGameMountFamily) GetID() int

type JSONGameNPC

type JSONGameNPC struct {
	Id             int     `json:"id"`
	NameId         int     `json:"nameId"`
	DialogMessages [][]int `json:"dialogMessages"`
	DialogReplies  [][]int `json:"dialogReplies"`
	Actions        []int   `json:"actions"`
}

func (JSONGameNPC) GetID

func (i JSONGameNPC) GetID() int

type JSONGameQuest added in v0.2.0

type JSONGameQuest struct {
	Id             int    `json:"id"`
	NameId         int    `json:"nameId"`
	StepIds        []int  `json:"stepIds"`
	CategoryId     int    `json:"categoryId"`
	RepeatType     int    `json:"repeatType"`
	RepeatLimit    int    `json:"repeatLimit"`
	IsDungeonQuest bool   `json:"isDungeonQuest"`
	LevelMin       int    `json:"levelMin"`
	LevelMax       int    `json:"levelMax"`
	Followable     bool   `json:"followable"`
	IsPartyQuest   bool   `json:"isPartyQuest"`
	StartCriterion string `json:"startCriterion"`
}

func (JSONGameQuest) GetID added in v0.2.0

func (i JSONGameQuest) GetID() int

type JSONGameQuestCategory added in v0.2.0

type JSONGameQuestCategory struct {
	Id       int   `json:"id"`
	NameId   int   `json:"nameId"`
	Order    int   `json:"order"`
	QuestIds []int `json:"questIds"`
}

func (JSONGameQuestCategory) GetID added in v0.2.0

func (i JSONGameQuestCategory) GetID() int

type JSONGameQuestObjective added in v0.2.0

type JSONGameQuestObjective struct {
	Id         int                    `json:"id"`
	Coords     JSONGameCoordinate     `json:"coords"`
	MapId      int                    `json:"mapId"`
	Parameters JSONGameQuestParameter `json:"parameters"`
	StepId     int                    `json:"stepId"`
	TypeId     int                    `json:"typeId"`
}

func (JSONGameQuestObjective) GetID added in v0.2.0

func (i JSONGameQuestObjective) GetID() int

type JSONGameQuestParameter added in v0.2.0

type JSONGameQuestParameter struct {
	DungeonOnly bool `json:"dungeonOnly"`
	NumParams   int  `json:"numParams"`
	Parameter0  int  `json:"parameter0"`
	Parameter1  int  `json:"parameter1"`
	Parameter2  int  `json:"parameter2"`
	Parameter3  int  `json:"parameter3"`
	Parameter4  int  `json:"parameter4"`
}

type JSONGameQuestStep added in v0.2.0

type JSONGameQuestStep struct {
	Id            int     `json:"id"`
	DescriptionId int     `json:"descriptionId"`
	DialogId      int     `json:"dialogId"`
	NameId        int     `json:"nameId"`
	OptimalLevel  int     `json:"optimalLevel"`
	Duration      float64 `json:"duration"`
	ObjectiveIds  []int   `json:"objectiveIds"`
	RewardsIds    []int   `json:"rewardsIds"`
	QuestId       int     `json:"questId"`
}

func (JSONGameQuestStep) GetID added in v0.2.0

func (i JSONGameQuestStep) GetID() int

type JSONGameQuestStepRewards added in v0.2.0

type JSONGameQuestStepRewards struct {
	Id                        int     `json:"id"`
	ExperienceRatio           float64 `json:"experienceRatio"`
	KamasRatio                float64 `json:"kamasRatio"`
	ItemsReward               [][]int `json:"itemsReward"`
	KamasScaleWithPlayerLevel bool    `json:"kamasScaleWithPlayerLevel"`
	LevelMax                  int     `json:"levelMax"`
	LevelMin                  int     `json:"levelMin"`
	//SpellsReward []int `json:"spellsReward"`
	//EmotesReward []int `json:"emotesReward"`
	//TitlesReward []int `json:"titlesReward"`
	StepId int `json:"stepId"`
}

func (JSONGameQuestStepRewards) GetID added in v0.2.0

func (i JSONGameQuestStepRewards) GetID() int

type JSONGameRecipe

type JSONGameRecipe struct {
	Id            int   `json:"resultId"`
	NameId        int   `json:"resultNameId"`
	TypeId        int   `json:"resultTypeId"`
	Level         int   `json:"resultLevel"`
	IngredientIds []int `json:"ingredientIds"`
	Quantities    []int `json:"quantities"`
	JobId         int   `json:"jobId"`
	SkillId       int   `json:"skillId"`
}

func (JSONGameRecipe) GetID

func (i JSONGameRecipe) GetID() int

type JSONGameSet

type JSONGameSet struct {
	Id      int                             `json:"id"`
	ItemIds []int                           `json:"items"`
	NameId  int                             `json:"nameId"`
	Effects [][]*JSONGameItemPossibleEffect `json:"effects"`
}

func (JSONGameSet) GetID

func (i JSONGameSet) GetID() int

type JSONGameSpell

type JSONGameSpell struct {
	Id            int   `json:"id"`
	NameId        int   `json:"nameId"`
	DescriptionId int   `json:"descriptionId"`
	TypeId        int   `json:"typeId"`
	Order         int   `json:"order"`
	IconId        int   `json:"iconId"`
	SpellLevels   []int `json:"spellLevels"`
}

func (JSONGameSpell) GetID

func (i JSONGameSpell) GetID() int

type JSONGameSpellType

type JSONGameSpellType struct {
	Id          int `json:"id"`
	LongNameId  int `json:"longNameId"`
	ShortNameId int `json:"shortNameId"`
}

func (JSONGameSpellType) GetID

func (i JSONGameSpellType) GetID() int

type JSONGameTitle added in v0.1.4

type JSONGameTitle struct {
	Id           int  `json:"id"`
	NameMaleId   int  `json:"nameMaleId"`
	NameFemaleId int  `json:"nameFemaleId"`
	Visible      bool `json:"visible"`
	CategoryId   int  `json:"categoryId"`
}

func (JSONGameTitle) GetID added in v0.1.4

func (i JSONGameTitle) GetID() int

type JSONLangDict

type JSONLangDict struct {
	Texts    map[string]string `json:"texts"`    // "1": "Account- oder Abohandel",
	IdText   map[string]int    `json:"idText"`   // "790745": 27679,
	NameText map[string]int    `json:"nameText"` // "ui.chat.check0": 65984
}

type LangDict

type LangDict struct {
	Texts    map[int]string
	IdText   map[int]int
	NameText map[string]int
}

func ParseLangDict

func ParseLangDict(langCode string, dir string) LangDict

type MappedMultilangCharacteristic

type MappedMultilangCharacteristic struct {
	Value map[string]string `json:"value"`
	Name  map[string]string `json:"name"`
}

type MappedMultilangCondition

type MappedMultilangCondition struct {
	Element   string            `json:"element"`
	ElementId int               `json:"element_id"`
	Operator  string            `json:"operator"`
	Value     int               `json:"value"`
	Templated map[string]string `json:"templated"`
}

type MappedMultilangEffect

type MappedMultilangEffect struct {
	Min              int               `json:"min"`
	Max              int               `json:"max"`
	Type             map[string]string `json:"type"`
	MinMaxIrrelevant int               `json:"min_max_irrelevant"`
	Templated        map[string]string `json:"templated"`
	ElementId        int               `json:"element_id"`
	IsMeta           bool              `json:"is_meta"`
	Active           bool              `json:"active"`
}

type MappedMultilangItem

type MappedMultilangItem struct {
	AnkamaId               int                             `json:"ankama_id"`
	Type                   MappedMultilangItemType         `json:"type"`
	Description            map[string]string               `json:"description"`
	Name                   map[string]string               `json:"name"`
	Image                  string                          `json:"image"`
	Conditions             []MappedMultilangCondition      `json:"conditions"`
	ConditionTree          *ConditionTreeNodeMapped        `json:"condition_tree"`
	Level                  int                             `json:"level"`
	UsedInRecipes          []int                           `json:"used_in_recipes"`
	Characteristics        []MappedMultilangCharacteristic `json:"characteristics"`
	Effects                []MappedMultilangEffect         `json:"effects"`
	DropMonsterIds         []int                           `json:"dropMonsterIds"`
	CriticalHitBonus       int                             `json:"criticalHitBonus"`
	TwoHanded              bool                            `json:"twoHanded"`
	MaxCastPerTurn         int                             `json:"maxCastPerTurn"`
	ApCost                 int                             `json:"apCost"`
	Range                  int                             `json:"range"`
	MinRange               int                             `json:"minRange"`
	CriticalHitProbability int                             `json:"criticalHitProbability"`
	Pods                   int                             `json:"pods"`
	IconId                 int                             `json:"iconId"`
	ParentSet              MappedMultilangSetReverseLink   `json:"parentSet"`
	HasParentSet           bool                            `json:"hasParentSet"`
}

func MapItems

func MapItems(data *JSONGameData, langs *map[string]LangDict) []MappedMultilangItem

type MappedMultilangItemType

type MappedMultilangItemType struct {
	Id          int               `json:"id"`
	Name        map[string]string `json:"name"`
	ItemTypeId  int               `json:"itemTypeId"`
	SuperTypeId int               `json:"superTypeId"`
	CategoryId  int               `json:"categoryId"`
}

type MappedMultilangMount

type MappedMultilangMount struct {
	AnkamaId   int                     `json:"ankama_id"`
	Name       map[string]string       `json:"name"`
	FamilyId   int                     `json:"family_id"`
	FamilyName map[string]string       `json:"family_name"`
	Effects    []MappedMultilangEffect `json:"effects"`
}

func MapMounts

func MapMounts(data *JSONGameData, langs *map[string]LangDict) []MappedMultilangMount

type MappedMultilangNPCAlmanax added in v0.2.0

type MappedMultilangNPCAlmanax struct {
	OfferingReceiver string   `json:"offeringReceiver"`
	Days             []string `json:"days"`
	Offering         struct {
		ItemId    int               `json:"itemId"`
		ItemName  map[string]string `json:"itemName"`
		Quantity  int               `json:"quantity"`
		ImageUrls struct {
			HD   string `json:"hd"`
			HQ   string `json:"hq"`
			SD   string `json:"sd"`
			Icon string `json:"icon"`
		}
	}
	Bonus       map[string]string `json:"bonus"`
	BonusType   map[string]string `json:"bonusType"`
	RewardKamas int               `json:"rewardKamas"`
}

func MapAlmanax added in v0.2.0

func MapAlmanax(data *JSONGameData, langs *map[string]LangDict) []MappedMultilangNPCAlmanax

type MappedMultilangRecipe

type MappedMultilangRecipe struct {
	ResultId int                          `json:"result_id"`
	Entries  []MappedMultilangRecipeEntry `json:"entries"`
}

func MapRecipes

func MapRecipes(data *JSONGameData) []MappedMultilangRecipe

type MappedMultilangRecipeEntry

type MappedMultilangRecipeEntry struct {
	ItemId   int `json:"item_id"`
	Quantity int `json:"quantity"`
}

type MappedMultilangSet

type MappedMultilangSet struct {
	AnkamaId int                          `json:"ankama_id"`
	Name     map[string]string            `json:"name"`
	ItemIds  []int                        `json:"items"`
	Effects  [][]MappedMultilangSetEffect `json:"effects"`
	Level    int                          `json:"level"`
}

func MapSets

func MapSets(data *JSONGameData, langs *map[string]LangDict) []MappedMultilangSet

type MappedMultilangSetEffect added in v0.2.1

type MappedMultilangSetEffect struct {
	Min              int               `json:"min"`
	Max              int               `json:"max"`
	Type             map[string]string `json:"type"`
	MinMaxIrrelevant int               `json:"min_max_irrelevant"`
	Templated        map[string]string `json:"templated"`
	ElementId        int               `json:"element_id"`
	IsMeta           bool              `json:"is_meta"`
	Active           bool              `json:"active"`
	ItemCombination  uint              `json:"item_combination"`
}
type MappedMultilangSetReverseLink struct {
	Id   int               `json:"id"`
	Name map[string]string `json:"name"`
}

type NodeType added in v0.1.1

type NodeType int

NodeType defines the type of a node - either an operator or an operand

const (
	Operand  NodeType = iota // like "a" in "a & b"
	Operator                 // like "&" in "a & b"
)

type PersistentStringKeysMap

type PersistentStringKeysMap struct {
	Entries *treebidimap.Map `json:"entries"`
	NextId  int              `json:"next_id"`
}
var (
	PersistedElements PersistentStringKeysMap
	PersistedTypes    PersistentStringKeysMap
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL