Skip to content

Commit

Permalink
Added custom cart config, allowed to
Browse files Browse the repository at this point in the history
* Edit max weight
* Edit max item numbers
* Edit cart selection from MC_CHANGECART and MC_CARTDECORATE
  • Loading branch information
cydh committed Jun 7, 2018
1 parent 2e15fae commit 84610c8
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 47 deletions.
103 changes: 103 additions & 0 deletions conf/carts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 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

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
- 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.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#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 1200 ///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 @@ -3528,7 +3528,7 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s
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
56 changes: 26 additions & 30 deletions src/map/clif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3376,7 +3376,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 @@ -11908,20 +11908,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 @@ -11930,19 +11930,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 > MAX_CARTS )
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 @@ -11951,7 +11954,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 @@ -11965,19 +11968,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
(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 @@ -1068,7 +1068,7 @@ void clif_broadcast_obtain_special_item(const char *char_name, unsigned short na

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

0 comments on commit 84610c8

Please sign in to comment.