loot code ok
This commit is contained in:
parent
c3a3500b9b
commit
bca6430e7a
@ -186,11 +186,9 @@ void AndroidAI::DoMoveOldAI()
|
|||||||
if (hum->room->IsWaitingStart()) {
|
if (hum->room->IsWaitingStart()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (hum->HasBuffEffect(kBET_Jump)) {
|
if (hum->HasBuffEffect(kBET_Jump)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (owner->UpdatedTimes() % 2 == 0) {
|
if (owner->UpdatedTimes() % 2 == 0) {
|
||||||
Human* hum = (Human*)owner;
|
Human* hum = (Human*)owner;
|
||||||
int speed = std::max(1, (int)hum->GetSpeed());
|
int speed = std::max(1, (int)hum->GetSpeed());
|
||||||
|
@ -228,6 +228,8 @@ enum EquipType_e
|
|||||||
{
|
{
|
||||||
EQUIP_TYPE_WEAPON = 1,
|
EQUIP_TYPE_WEAPON = 1,
|
||||||
EQUIP_TYPE_BULLET = 2,
|
EQUIP_TYPE_BULLET = 2,
|
||||||
|
EQUIP_TYPE_PROTECTION = 4,
|
||||||
|
EQUIP_TYPE_BAG = 7,
|
||||||
EQUIP_TYPE_OLDSKIN = 8,
|
EQUIP_TYPE_OLDSKIN = 8,
|
||||||
EQUIP_TYPE_CAR = 9,
|
EQUIP_TYPE_CAR = 9,
|
||||||
EQUIP_TYPE_SKIN = 10,
|
EQUIP_TYPE_SKIN = 10,
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
const int kReviveTimeAdd = 12;
|
const int kReviveTimeAdd = 12;
|
||||||
const int kSkinNum = 4;
|
const int kSkinNum = 4;
|
||||||
const int kREVIVE_BUFF_ID = 0;
|
|
||||||
|
|
||||||
Human::Human():Creature()
|
Human::Human():Creature()
|
||||||
{
|
{
|
||||||
@ -2147,7 +2146,7 @@ void Human::SendBattleReport()
|
|||||||
delete params;
|
delete params;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
{
|
{
|
||||||
switch (item_meta->i->equip_subtype()) {
|
switch (item_meta->i->equip_subtype()) {
|
||||||
case 11:
|
case 11:
|
||||||
@ -2187,19 +2186,22 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
{
|
{
|
||||||
DoGetOn(entity->GetUniId());
|
DoGetOn(entity->GetUniId());
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta)
|
void Human::ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
{
|
{
|
||||||
AddItem(item_meta->i->id(), 1);
|
AddItem(item_meta->i->id(), 1);
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::ProcSpoils(Loot* entity, MetaData::Equip* item_meta)
|
void Human::ProcSpoils(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
{
|
{
|
||||||
if (spoils_items.find(item_meta->i->id()) !=
|
if (spoils_items.find(item_meta->i->id()) !=
|
||||||
spoils_items.end()) {
|
spoils_items.end()) {
|
||||||
@ -2207,6 +2209,7 @@ void Human::ProcSpoils(Loot* entity, MetaData::Equip* item_meta)
|
|||||||
} else {
|
} else {
|
||||||
spoils_items[item_meta->i->id()] = entity->count;
|
spoils_items[item_meta->i->id()] = entity->count;
|
||||||
}
|
}
|
||||||
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::OnDie()
|
void Human::OnDie()
|
||||||
@ -3572,3 +3575,194 @@ void Human::StartRefreshViewTimer()
|
|||||||
hum->refresh_view_timer_ = nullptr;
|
hum->refresh_view_timer_ = nullptr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootBag(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
|
{
|
||||||
|
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(backpack);
|
||||||
|
if (old_item_meta) {
|
||||||
|
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
||||||
|
}
|
||||||
|
backpack = item_meta->i->id();
|
||||||
|
RecalcVolume();
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootProtection(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
|
{
|
||||||
|
if (item_meta->i->equip_subtype() == 1) {
|
||||||
|
//盔甲
|
||||||
|
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(chest);
|
||||||
|
if (old_item_meta) {
|
||||||
|
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
||||||
|
}
|
||||||
|
chest = item_meta->i->id();
|
||||||
|
RecalcBaseAttr();
|
||||||
|
} else if (item_meta->i->equip_subtype() == 2) {
|
||||||
|
//头盔
|
||||||
|
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(helmet);
|
||||||
|
if (old_item_meta) {
|
||||||
|
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
||||||
|
}
|
||||||
|
helmet = item_meta->i->id();
|
||||||
|
RecalcBaseAttr();
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootSpecItem(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
|
{
|
||||||
|
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||||
|
item_meta->i->_inventory_slot() < IS_END) {
|
||||||
|
if (GetInventory(item_meta->i->_inventory_slot()) >=
|
||||||
|
GetVolume(item_meta->i->_inventory_slot())
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int add_num = GetVolume(item_meta->i->_inventory_slot()) -
|
||||||
|
GetInventory(item_meta->i->_inventory_slot());
|
||||||
|
add_num = std::min(entity->count, add_num);
|
||||||
|
|
||||||
|
AddInventory(item_meta->i->_inventory_slot(), add_num);
|
||||||
|
switch (item_meta->i->_inventory_slot()) {
|
||||||
|
case IS_FRAG:
|
||||||
|
case IS_SMOKE:
|
||||||
|
{
|
||||||
|
Weapon* weapon = &weapons[SPEC1_SLOT_BEGIN +
|
||||||
|
(item_meta->i->_inventory_slot() - SPEC1_IS_BEGIN)
|
||||||
|
];
|
||||||
|
weapon->weapon_id = entity->item_id;
|
||||||
|
weapon->weapon_lv = 1;
|
||||||
|
weapon->ammo += entity->count;
|
||||||
|
weapon->meta = item_meta;
|
||||||
|
weapon->Recalc();
|
||||||
|
#if 0
|
||||||
|
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IS_1XSCOPE:
|
||||||
|
case IS_2XSCOPE:
|
||||||
|
case IS_4XSCOPE:
|
||||||
|
case IS_8XSCOPE:
|
||||||
|
case IS_15XSCOPE:
|
||||||
|
{
|
||||||
|
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
|
||||||
|
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IS_POSION_GAS_BOMB:
|
||||||
|
case IS_MOLOTOR_COCKTAIL:
|
||||||
|
case IS_TRAP:
|
||||||
|
case IS_MINE:
|
||||||
|
{
|
||||||
|
Weapon* weapon = &weapons[SPEC2_SLOT_BEGIN +
|
||||||
|
(item_meta->i->_inventory_slot() - SPEC2_IS_BEGIN)
|
||||||
|
];
|
||||||
|
weapon->weapon_id = entity->item_id;
|
||||||
|
weapon->weapon_lv = 1;
|
||||||
|
weapon->ammo += entity->count;
|
||||||
|
weapon->meta = item_meta;
|
||||||
|
weapon->Recalc();
|
||||||
|
#if 0
|
||||||
|
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IS_C4:
|
||||||
|
case IS_SHIELD_WALL:
|
||||||
|
case IS_SINGAL_GUN:
|
||||||
|
case IS_OIL_BUCKET:
|
||||||
|
{
|
||||||
|
Weapon* weapon = &weapons[SPEC3_SLOT_BEGIN +
|
||||||
|
(item_meta->i->_inventory_slot() - SPEC3_IS_BEGIN)
|
||||||
|
];
|
||||||
|
weapon->weapon_id = entity->item_id;
|
||||||
|
weapon->weapon_lv = 1;
|
||||||
|
weapon->ammo += entity->count;
|
||||||
|
weapon->meta = item_meta;
|
||||||
|
weapon->Recalc();
|
||||||
|
#if 0
|
||||||
|
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
#if 0
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (add_num < entity->count) {
|
||||||
|
//刷新数量
|
||||||
|
entity->count -= add_num;
|
||||||
|
entity->BroadcastFullState(room);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (action_type == AT_None) {
|
||||||
|
AutoLoadingBullet();
|
||||||
|
}
|
||||||
|
need_sync_active_player = true;
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootWeapon(Loot* entity, MetaData::Equip* item_meta, bool& handled)
|
||||||
|
{
|
||||||
|
//装备
|
||||||
|
if (item_meta->i->equip_subtype() == 1) {
|
||||||
|
//近战
|
||||||
|
if (default_weapon.weapon_id != weapons[0].weapon_id) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
weapons[0].weapon_idx = 0;
|
||||||
|
weapons[0].weapon_id = entity->item_id;
|
||||||
|
weapons[0].weapon_lv = std::max(1, entity->item_level);
|
||||||
|
weapons[0].ammo = 0;
|
||||||
|
weapons[0].meta = item_meta;
|
||||||
|
weapons[0].Recalc();
|
||||||
|
}
|
||||||
|
need_sync_active_player = true;
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
} else {
|
||||||
|
if (FreezeOperate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool switch_gun = false;
|
||||||
|
Weapon* weapon = TakeonWeapon(item_meta);
|
||||||
|
if (weapon && GetCurrWeapon() != weapon) {
|
||||||
|
switch_gun = true;
|
||||||
|
}
|
||||||
|
if (!weapon) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
weapon->weapon_id = entity->item_id;
|
||||||
|
weapon->weapon_lv = std::max(1, entity->item_level);
|
||||||
|
weapon->ammo = 0;
|
||||||
|
weapon->meta = item_meta;
|
||||||
|
weapon->Recalc();
|
||||||
|
if (HasBuffEffect(kBET_Car)) {
|
||||||
|
} else {
|
||||||
|
AutoLoadingBullet();
|
||||||
|
}
|
||||||
|
if (switch_gun) {
|
||||||
|
SetCurrWeapon(weapon);
|
||||||
|
}
|
||||||
|
need_sync_active_player = true;
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
@ -272,10 +272,14 @@ class Human : public Creature
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _InternalUpdateMove(float speed);
|
void _InternalUpdateMove(float speed);
|
||||||
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
|
void ProcLootWeapon(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
void ProcLootCar(Loot* entity, MetaData::Equip* item_meta);
|
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
void ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta);
|
void ProcLootCar(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
void ProcSpoils(Loot* entity, MetaData::Equip* item_meta);
|
void ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
|
void ProcSpoils(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
|
void ProcLootBag(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
|
void ProcLootProtection(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
|
void ProcLootSpecItem(Loot* entity, MetaData::Equip* item_meta, bool& handled);
|
||||||
void CancelRevive();
|
void CancelRevive();
|
||||||
Weapon* TakeonWeapon(MetaData::Equip* equip_meta);
|
Weapon* TakeonWeapon(MetaData::Equip* equip_meta);
|
||||||
|
|
||||||
|
@ -63,11 +63,6 @@ void Player::InternalUpdate(int delta_time)
|
|||||||
if (HasBuffEffect(kBET_Fly)) {
|
if (HasBuffEffect(kBET_Fly)) {
|
||||||
SetPos(room->plane.curr_pos);
|
SetPos(room->plane.curr_pos);
|
||||||
room->grid_service->MoveCreature(this);
|
room->grid_service->MoveCreature(this);
|
||||||
#ifdef DEBUG
|
|
||||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
|
||||||
GetCar()->SyncPos();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (HasSpecMove()) {
|
if (HasSpecMove()) {
|
||||||
_UpdateSpecMove();
|
_UpdateSpecMove();
|
||||||
@ -265,11 +260,7 @@ void Player::UpdateShot()
|
|||||||
) {
|
) {
|
||||||
Shot();
|
Shot();
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
if (room->GetFrameNo() - last_cmmove_frameno >= 4) {
|
if (room->GetFrameNo() - last_cmmove_frameno >= 4) {
|
||||||
#else
|
|
||||||
if (series_shot_frames > 8) {
|
|
||||||
#endif
|
|
||||||
shot_hold = false;
|
shot_hold = false;
|
||||||
series_shot_frames = 0;
|
series_shot_frames = 0;
|
||||||
}
|
}
|
||||||
@ -518,61 +509,21 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
if (!item_meta) {
|
if (!item_meta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool handled = false;
|
||||||
switch (item_meta->i->equip_type()) {
|
switch (item_meta->i->equip_type()) {
|
||||||
case EQUIP_TYPE_WEAPON:
|
case EQUIP_TYPE_WEAPON:
|
||||||
{
|
{
|
||||||
//装备
|
ProcLootWeapon(entity, item_meta, handled);
|
||||||
if (item_meta->i->equip_subtype() == 1) {
|
|
||||||
//近战
|
|
||||||
if (default_weapon.weapon_id != weapons[0].weapon_id) {
|
|
||||||
/*
|
|
||||||
cs::SMPickup notifymsg;
|
|
||||||
notifymsg.set_error_code(2);
|
|
||||||
SendNotifyMsg(notifymsg);
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
weapons[0].weapon_idx = 0;
|
|
||||||
weapons[0].weapon_id = entity->item_id;
|
|
||||||
weapons[0].weapon_lv = std::max(1, entity->item_level);
|
|
||||||
weapons[0].ammo = 0;
|
|
||||||
weapons[0].meta = item_meta;
|
|
||||||
weapons[0].Recalc();
|
|
||||||
}
|
}
|
||||||
need_sync_active_player = true;
|
break;
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
case EQUIP_TYPE_PROTECTION:
|
||||||
} else {
|
{
|
||||||
if (FreezeOperate()) {
|
ProcLootProtection(entity, item_meta, handled);
|
||||||
return;
|
|
||||||
}
|
|
||||||
bool switch_gun = false;
|
|
||||||
Weapon* weapon = TakeonWeapon(item_meta);
|
|
||||||
if (weapon && GetCurrWeapon() != weapon) {
|
|
||||||
switch_gun = true;
|
|
||||||
}
|
|
||||||
if (!weapon) {
|
|
||||||
/*
|
|
||||||
cs::SMPickup notifymsg;
|
|
||||||
notifymsg.set_error_code(2);
|
|
||||||
SendNotifyMsg(notifymsg);
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
weapon->weapon_id = entity->item_id;
|
|
||||||
weapon->weapon_lv = std::max(1, entity->item_level);
|
|
||||||
weapon->ammo = 0;
|
|
||||||
weapon->meta = item_meta;
|
|
||||||
weapon->Recalc();
|
|
||||||
if (HasBuffEffect(kBET_Car)) {
|
|
||||||
} else {
|
|
||||||
AutoLoadingBullet();
|
|
||||||
}
|
|
||||||
if (switch_gun) {
|
|
||||||
SetCurrWeapon(weapon);
|
|
||||||
}
|
|
||||||
need_sync_active_player = true;
|
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case EQUIP_TYPE_BAG:
|
||||||
|
{
|
||||||
|
ProcLootBag(entity, item_meta, handled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EQUIP_TYPE_OLDSKIN:
|
case EQUIP_TYPE_OLDSKIN:
|
||||||
@ -582,177 +533,33 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
break;
|
break;
|
||||||
case EQUIP_TYPE_SKIN:
|
case EQUIP_TYPE_SKIN:
|
||||||
{
|
{
|
||||||
ProcLootSkin(entity, item_meta);
|
ProcLootSkin(entity, item_meta, handled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EQUIP_TYPE_CAR:
|
case EQUIP_TYPE_CAR:
|
||||||
{
|
{
|
||||||
ProcLootCar(entity, item_meta);
|
ProcLootCar(entity, item_meta, handled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EQUIP_TYPE_CAMOUFLAGE:
|
case EQUIP_TYPE_CAMOUFLAGE:
|
||||||
{
|
{
|
||||||
ProcCamoutflage(entity, item_meta);
|
ProcCamoutflage(entity, item_meta, handled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EQUIP_TYPE_SPOILS:
|
case EQUIP_TYPE_SPOILS:
|
||||||
{
|
{
|
||||||
|
|
||||||
ProcSpoils(entity, item_meta);
|
ProcSpoils(entity, item_meta, handled);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
ProcLootSpecItem(entity, item_meta, handled);
|
||||||
item_meta->i->_inventory_slot() < IS_END) {
|
}
|
||||||
if (GetInventory(item_meta->i->_inventory_slot()) >=
|
break;
|
||||||
GetVolume(item_meta->i->_inventory_slot())
|
|
||||||
) {
|
|
||||||
/*
|
|
||||||
cs::SMPickup notifymsg;
|
|
||||||
notifymsg.set_error_code(1);
|
|
||||||
SendNotifyMsg(notifymsg);
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
int add_num = GetVolume(item_meta->i->_inventory_slot()) -
|
|
||||||
GetInventory(item_meta->i->_inventory_slot());
|
|
||||||
add_num = std::min(entity->count, add_num);
|
|
||||||
|
|
||||||
AddInventory(item_meta->i->_inventory_slot(), add_num);
|
if (handled) {
|
||||||
switch (item_meta->i->_inventory_slot()) {
|
|
||||||
case IS_FRAG:
|
|
||||||
case IS_SMOKE:
|
|
||||||
{
|
|
||||||
Weapon* weapon = &weapons[SPEC1_SLOT_BEGIN +
|
|
||||||
(item_meta->i->_inventory_slot() - SPEC1_IS_BEGIN)
|
|
||||||
];
|
|
||||||
weapon->weapon_id = entity->item_id;
|
|
||||||
weapon->weapon_lv = 1;
|
|
||||||
weapon->ammo += entity->count;
|
|
||||||
weapon->meta = item_meta;
|
|
||||||
weapon->Recalc();
|
|
||||||
#if 0
|
|
||||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IS_1XSCOPE:
|
|
||||||
case IS_2XSCOPE:
|
|
||||||
case IS_4XSCOPE:
|
|
||||||
case IS_8XSCOPE:
|
|
||||||
case IS_15XSCOPE:
|
|
||||||
{
|
|
||||||
if (item_meta->i->_inventory_slot() - IS_1XSCOPE > curr_scope_idx) {
|
|
||||||
curr_scope_idx = item_meta->i->_inventory_slot() - IS_1XSCOPE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IS_POSION_GAS_BOMB:
|
|
||||||
case IS_MOLOTOR_COCKTAIL:
|
|
||||||
case IS_TRAP:
|
|
||||||
case IS_MINE:
|
|
||||||
{
|
|
||||||
Weapon* weapon = &weapons[SPEC2_SLOT_BEGIN +
|
|
||||||
(item_meta->i->_inventory_slot() - SPEC2_IS_BEGIN)
|
|
||||||
];
|
|
||||||
weapon->weapon_id = entity->item_id;
|
|
||||||
weapon->weapon_lv = 1;
|
|
||||||
weapon->ammo += entity->count;
|
|
||||||
weapon->meta = item_meta;
|
|
||||||
weapon->Recalc();
|
|
||||||
#if 0
|
|
||||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IS_C4:
|
|
||||||
case IS_SHIELD_WALL:
|
|
||||||
case IS_SINGAL_GUN:
|
|
||||||
case IS_OIL_BUCKET:
|
|
||||||
{
|
|
||||||
Weapon* weapon = &weapons[SPEC3_SLOT_BEGIN +
|
|
||||||
(item_meta->i->_inventory_slot() - SPEC3_IS_BEGIN)
|
|
||||||
];
|
|
||||||
weapon->weapon_id = entity->item_id;
|
|
||||||
weapon->weapon_lv = 1;
|
|
||||||
weapon->ammo += entity->count;
|
|
||||||
weapon->meta = item_meta;
|
|
||||||
weapon->Recalc();
|
|
||||||
#if 0
|
|
||||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
#if 0
|
|
||||||
abort();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (add_num < entity->count) {
|
|
||||||
//刷新数量
|
|
||||||
entity->count -= add_num;
|
|
||||||
entity->BroadcastFullState(room);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (item_meta->i->equip_type()) {
|
|
||||||
case 7:
|
|
||||||
{
|
|
||||||
//背包
|
|
||||||
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(backpack);
|
|
||||||
if (old_item_meta) {
|
|
||||||
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
|
||||||
}
|
|
||||||
backpack = item_meta->i->id();
|
|
||||||
RecalcVolume();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
//防具
|
|
||||||
if (item_meta->i->equip_subtype() == 1) {
|
|
||||||
//盔甲
|
|
||||||
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(chest);
|
|
||||||
if (old_item_meta) {
|
|
||||||
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
|
||||||
}
|
|
||||||
chest = item_meta->i->id();
|
|
||||||
RecalcBaseAttr();
|
|
||||||
} else if (item_meta->i->equip_subtype() == 2) {
|
|
||||||
//头盔
|
|
||||||
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(helmet);
|
|
||||||
if (old_item_meta) {
|
|
||||||
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
|
||||||
}
|
|
||||||
helmet = item_meta->i->id();
|
|
||||||
RecalcBaseAttr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (action_type == AT_None) {
|
|
||||||
AutoLoadingBullet();
|
|
||||||
}
|
|
||||||
need_sync_active_player = true;
|
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
entity->pickuped = true;
|
entity->pickuped = true;
|
||||||
room->RemoveObjectLater(entity);
|
room->RemoveObjectLater(entity);
|
||||||
if (entity->dummy_thing_uniid != 0) {
|
if (entity->dummy_thing_uniid != 0) {
|
||||||
@ -769,6 +576,7 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Player::HumanInteraction(Human* hum)
|
void Player::HumanInteraction(Human* hum)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user