Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cart config #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions conf/carts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# New cart configs by MC_CHANGECART also include MC_CARTDECORATE
# WARNING: ONLY PACKETVER >= 20150826
# @author [Cydh]

Capacity:
- Type: 1
MaxItems: 100
MaxWeight: 8000
- Type: 2
MaxItems: 100
MaxWeight: 8000
- Type: 3
MaxItems: 100
MaxWeight: 8000
- Type: 4
MaxItems: 100
MaxWeight: 8000
- Type: 5
MaxItems: 100
MaxWeight: 8000
- Type: 6
MaxItems: 100
MaxWeight: 8000
- Type: 7
MaxItems: 100
MaxWeight: 8000
- Type: 8
MaxItems: 100
MaxWeight: 8000
- Type: 9
MaxItems: 100
MaxWeight: 8000
- Type: 10
MaxItems: 150
MaxWeight: 8000
- Type: 11
MaxItems: 150
MaxWeight: 10000
- Type: 12
MaxItems: 150
MaxWeight: 12000
- Type: 13
MaxItems: 100
MaxWeight: 8000

ChangeCart:
- Skill: MC_CHANGECART
Carts:
- Type: 1
MinLevel: 1
- Type: 2
MinLevel: 40
- Type: 3
MinLevel: 65
- Type: 4
MinLevel: 80
- Type: 5
MinLevel: 90
- Type: 6
MinLevel: 100
- Type: 7
MinLevel: 110
- Type: 8
MinLevel: 120
- Type: 9
MinLevel: 130
#- Type: 10
# MinLevel: 1
#- Type: 11
# MinLevel: 1
#- Type: 12
# MinLevel: 1
#- Type: 13
# MinLevel: 100
- Skill: MC_CARTDECORATE
Carts:
- Type: 1
MinLevel: 1
- Type: 2
MinLevel: 1
- Type: 3
MinLevel: 1
- Type: 4
MinLevel: 1
- Type: 5
MinLevel: 1
- Type: 6
MinLevel: 1
- Type: 7
MinLevel: 1
- Type: 8
MinLevel: 1
- Type: 9
MinLevel: 1
- Type: 10
MinLevel: 1
- Type: 11
MinLevel: 1
- Type: 12
MinLevel: 1
# To exclude job to use this cart type
#JobExcept:
#- JOB_MERCHANT
#- JOB_BLACKSMITH
#- JOB_ALCHEMIST
#- JOB_BABY_MERCHANT
#- JOB_BABY_BLACKSMITH
#- JOB_BABY_ALCHEMIST
2 changes: 1 addition & 1 deletion src/common/mmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef uint32 t_itemid;
#define MAX_ZENY INT_MAX ///Max zeny
#define MAX_BANK_ZENY SINT32_MAX ///Max zeny in Bank
#define MAX_FAME 1000000000 ///Max fame points
#define MAX_CART 100 ///Maximum item in cart
#define MAX_CART 150 ///Maximum item in cart
#define MAX_SKILL 1250 ///Maximum skill can be hold by Player, Homunculus, & Mercenary (skill list) AND skill_db limit
#define DEFAULT_WALK_SPEED 150 ///Default walk speed
#define MIN_WALK_SPEED 20 ///Min walk speed
Expand Down
2 changes: 1 addition & 1 deletion src/map/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3935,7 +3935,7 @@ static int battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list *
case MC_CARTREVOLUTION:
skillratio += 50;
if(sd && sd->cart_weight)
skillratio += 100 * sd->cart_weight / sd->cart_weight_max; // +1% every 1% weight
skillratio += 100 * sd->cart_weight / map_cart_max_weight(sd); // +1% every 1% weight
else if (!sd)
skillratio += 100; //Max damage for non players.
break;
Expand Down
59 changes: 26 additions & 33 deletions src/map/clif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3516,7 +3516,7 @@ void clif_updatestatus(struct map_session_data *sd,int type)
case SP_CARTINFO:
WFIFOW(fd,0)=0x121;
WFIFOW(fd,2)=sd->cart_num;
WFIFOW(fd,4)=MAX_CART;
WFIFOW(fd,4)=sd->cart_num_max;
WFIFOL(fd,6)=sd->cart_weight;
WFIFOL(fd,10)=sd->cart_weight_max;
len=14;
Expand Down Expand Up @@ -12360,20 +12360,20 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd)

/// Request to select cart's visual look for new cart design (ZC_SELECTCART).
/// 097f <Length>.W <identity>.L <type>.B
void clif_SelectCart(struct map_session_data *sd) {
void clif_SelectCart(struct map_session_data *sd, uint16 skill_id) {
#if PACKETVER >= 20150826
int i = 0, carts = 3;
int i = 0, carts = MAX_CARTS;
unsigned char *buf;

int fd = sd->fd;
WFIFOHEAD(fd,8 + carts);
WFIFOW(fd,0) = 0x97f;
WFIFOW(fd,2) = 8 + carts;
WFIFOL(fd,4) = sd->status.account_id;
// Right now we have 10-12, tested it you can also enable selection for all cart styles here(1-12)
for( i = 0; i < carts; i++ ) {
WFIFOB(fd,8 + i) = 10 + i;
}
WFIFOSET(fd,8 + carts);
sd->changecart_skill = skill_id;
CREATE(buf, unsigned char, 8 + MAX_CARTS);
WBUFW(buf, 0) = 0x97f;
WBUFL(buf, 4) = sd->status.account_id;
i = map_cart_avail(sd, sd->changecart_skill, buf, 8);
WBUFW(buf, 2) = 8 + i;
clif_send(buf, WBUFW(buf, 2), &sd->bl, SELF);
aFree(buf);
#endif
}

Expand All @@ -12382,19 +12382,22 @@ void clif_SelectCart(struct map_session_data *sd) {
/// 0980 <identity>.L <type>.B
void clif_parse_SelectCart(int fd,struct map_session_data *sd) {
#if PACKETVER >= 20150826
int type;
int type, error;

// Check identity
if( !sd || pc_checkskill(sd,MC_CARTDECORATE) < 1 || RFIFOL(fd,2) != sd->status.account_id )
return;
if( !sd || !sd->changecart_skill || pc_checkskill(sd, sd->changecart_skill) < 1 || RFIFOL(fd,2) != sd->status.account_id )
return;

type = (int)RFIFOB(fd,6);

// Check type
if( type < 10 || type > 12 )
if ((error = map_cart_check_type(sd, sd->changecart_skill, type)) != 0) {
ShowError("clif_parse_SelectCart: Error %d. AID: %d. Type %d ", error, RFIFOL(fd, 2), type);
return;
}

pc_setcart(sd, type);
sd->changecart_skill = 0;
#endif
}

Expand All @@ -12403,7 +12406,7 @@ void clif_parse_SelectCart(int fd,struct map_session_data *sd) {
/// 01af <num>.W
void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
{// TODO: State tracking?
int type;
int type, error;

if( !sd || pc_checkskill(sd, MC_CHANGECART) < 1 )
return;
Expand All @@ -12417,22 +12420,12 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)

type = (int)RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]);

if(
#ifdef NEW_CARTS
#if PACKETVER >= 20191106
(type == 13 && sd->status.base_level > 100) ||
#endif
(type == 9 && sd->status.base_level > 130) ||
(type == 8 && sd->status.base_level > 120) ||
(type == 7 && sd->status.base_level > 110) ||
(type == 6 && sd->status.base_level > 100) ||
#endif
(type == 5 && sd->status.base_level > 90) ||
(type == 4 && sd->status.base_level > 80) ||
(type == 3 && sd->status.base_level > 65) ||
(type == 2 && sd->status.base_level > 40) ||
(type == 1))
pc_setcart(sd, type);
if ((error = map_cart_check_type(sd, MC_CHANGECART, type)) != 0) {
ShowError("clif_parse_ChangeCart: Error %d. AID: %d. Type %d ", error, RFIFOL(fd, 2), type);
return;
}

pc_setcart(sd, type);
}


Expand Down
2 changes: 1 addition & 1 deletion src/map/clif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ void clif_broadcast_obtain_special_item(const char *char_name, t_itemid nameid,

void clif_dressing_room(struct map_session_data *sd, int flag);
void clif_navigateTo(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );
void clif_SelectCart(struct map_session_data *sd);
void clif_SelectCart(struct map_session_data *sd, uint16 skill_id);

/// Achievement System
void clif_achievement_list_all(struct map_session_data *sd);
Expand Down
Loading