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
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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/**
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
* Copyright (C) 2019 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAP_REFINE_H
#define MAP_REFINE_H
/** @file
* Refine Interface.
**/
#include "common/hercules.h"
#include "common/mmo.h"
/* Defines */
/**
* Max Refine available to your server
* Changing this limit requires edits to refine_db.conf
**/
#ifdef RENEWAL
#define MAX_REFINE 20
#else
#define MAX_REFINE 10
#endif
/* Forward Declarations */
struct refine_interface_private;
/* Enums */
enum refine_type {
REFINE_TYPE_ARMOR = 0,
REFINE_TYPE_WEAPON1 = 1,
REFINE_TYPE_WEAPON2 = 2,
REFINE_TYPE_WEAPON3 = 3,
REFINE_TYPE_WEAPON4 = 4,
#ifndef REFINE_TYPE_MAX
REFINE_TYPE_MAX = 5
#endif
};
enum refine_chance_type {
REFINE_CHANCE_TYPE_NORMAL = 0, // Normal Chance
REFINE_CHANCE_TYPE_ENRICHED = 1, // Enriched Ore Chance
REFINE_CHANCE_TYPE_E_NORMAL = 2, // Event Normal Ore Chance
REFINE_CHANCE_TYPE_E_ENRICHED = 3, // Event Enriched Ore Chance
REFINE_CHANCE_TYPE_MAX
};
enum refine_ui_failure_behavior {
REFINE_FAILURE_BEHAVIOR_DESTROY,
REFINE_FAILURE_BEHAVIOR_KEEP,
REFINE_FAILURE_BEHAVIOR_DOWNGRADE
};
/* Structure */
struct s_refine_requirement {
int blacksmith_blessing;
int req_count;
struct {
int nameid;
int cost;
enum refine_chance_type type;
enum refine_ui_failure_behavior failure_behavior;
} req[MAX_REFINE_REQUIREMENTS];
};
/**
* Refine Interface
**/
struct refine_interface {
struct refine_interface_private *p;
/**
* Initialize refine system
* @param minimal sets refine system to minimal mode in which it won't load or initialize itself
* @return returns 0 in-case of success 1 otherwise
**/
int (*init)(bool minimal);
/**
* Finalize refine system
**/
void (*final)(void);
/**
* Get the chance to upgrade a piece of equipment.
* @param wlv The weapon type of the item to refine (see see enum refine_type)
* @param refine The target refine level
* @return The chance to refine the item, in percent (0~100)
**/
int (*get_refine_chance) (enum refine_type wlv, int refine_level, enum refine_chance_type type);
/**
* Gets the attack/deffense bonus for the given equipment type and refine level
* @param equipment_type the equipment type
* @param refine_level the equipment refine level
* @return returns the bonus from refine db
**/
int (*get_bonus) (enum refine_type equipment_type, int refine_level);
/**
* Gets the maximum attack/deffense random bonus for the given equipment type and refine level
* @param equipment_type the equipment type
* @param refine_level the equipment refine level
* @return returns the bonus from refine db
**/
int(*get_randombonus_max) (enum refine_type equipment_type, int refine_level);
/**
* Validates and send Item addition packet to the client for refinery UI
* @param sd player session data.
* @param item_index the requested item index in inventory.
**/
void (*refinery_add_item) (struct map_session_data *sd, int item_index);
/**
* Processes an refine request through Refinery UI
* @param sd player session data
* @param item_index the index of the requested item
* @param material_id the refine material chosen by player
* @param use_blacksmith_blessing sets either if blacksmith blessing is requested to be used or not
**/
void (*refinery_refine_request) (struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing);
};
#ifdef HERCULES_CORE
void refine_defaults(void);
#endif
HPShared struct refine_interface *refine;
#endif
|