HERO SKIN

This commit is contained in:
hujiabin 2024-07-18 11:21:30 +08:00
parent 0ee8927bd6
commit f7768927b5
15 changed files with 418 additions and 187 deletions

74
doc/HeroSkin.py Normal file
View File

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
import _common
class HeroSkin(object):
def __init__(self):
self.apis = [
{
'name': 'skinList',
'desc': '皮肤列表',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=skinList',
'params': [
_common.ReqHead(),
['skin_id', 0, '皮肤itemId'],
],
'response': [
_common.RspHead(),
['!skin_list', [_common.HeroSkin()], '英雄皮肤列表']
]
},{
'name': 'skinDetails',
'desc': '皮肤详情',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=skinDetails',
'params': [
_common.ReqHead(),
['skin_uniid', 0, '皮肤uniid'],
],
'response': [
_common.RspHead(),
['data', _common.HeroSkin(), '皮肤详情']
]
},{
'name': 'takeonSkin',
'desc': '皮肤穿戴',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=takeonSkin',
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄uniid'],
['skin_uniid', 0, '皮肤uniid'],
],
'response': [
_common.RspHead(),
]
},{
'name': 'demountSkin',
'desc': '皮肤卸下',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=demountSkin',
'params': [
_common.ReqHead(),
['hero_uniid', 0, '英雄uniid'],
],
'response': [
_common.RspHead(),
]
},{
'name': 'synSkin',
'desc': '皮肤合成',
'group': 'HeroSkin',
'url': 'webapp/index.php?c=HeroSkin&a=synSkin',
'params': [
_common.ReqHead(),
['skin_id', 0, '皮肤itemId'],
],
'response': [
_common.RspHead(),
['property_chg', _common.PropertyChg(), '属性变更'],
]
},
]

View File

@ -11,7 +11,7 @@ class Other(object):
'url': 'webapp/index.php?c=Other&a=tag',
'params': [
_common.ReqHead(),
['types', '', '红点类型(!!!注意由于红点的计算量较大,最好并发分批取红点状态)","分割 1:英雄 2:芯片 3:背包 4:签到 5:算力'],
['types', '', '红点类型(!!!注意由于红点的计算量较大,最好并发分批取红点状态)","分割 1:英雄 2:芯片 3:背包 4:签到 5:算力 6:皮肤'],
],
'response': [
_common.RspHead(),
@ -24,7 +24,7 @@ class Other(object):
'url': 'webapp/index.php?c=Other&a=cancelTag',
'params': [
_common.ReqHead(),
['type', '', '1:英雄 2:芯片 3:背包 5:算力'],
['type', '', '1:英雄 2:芯片 3:背包 5:算力 6:皮肤'],
['item_unnid', '', 'item_unnid'],
],
'response': [

View File

@ -329,9 +329,16 @@ class HeroSkin(object):
def __init__(self):
self.fields = [
['idx', 0, 'uniid'],
['account_id', 0, 'account_id'],
['skin_id', 0, '英雄皮肤id'],
['is_have', 0, '是否拥有 1拥有 0未拥有'],
['use_state', 0, '选中状态 1选中 0未选中'],
['hero_uniid', 0, '所穿戴的英雄 0=未穿戴'],
['skin_state', 0, ' 0=封装1=解封'],
['used', 0, ' 0=未使用1=使用中'],
['is_old', 0, ' 0:展示红点 1:不用展示'],
['!rand_attr', [Attr()], ' 战斗属性'],
['lucky', 0, '幸运值'],
['wealth', 0, '财富值'],
]
class Item(object):

View File

@ -194,15 +194,18 @@ CREATE TABLE `t_hero_skin` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id',
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
`skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=已经购1 = 试用状态',
`hero_uniid` int(11) NOT NULL DEFAULT '0' COMMENT '英雄uniid',
`skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=封装1=解封',
`used` int(11) NOT NULL DEFAULT '0' COMMENT '使用状态 0=未使用1=使用中',
`get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买',
`consume_num` int(11) NOT NULL DEFAULT '0' COMMENT '消耗货币的具体数量',
`try_expire_at` int(11) NOT NULL DEFAULT '0' COMMENT '试用截止时间',
`rand_attr` mediumblob COMMENT '随机属性',
`wealth_attr` mediumblob COMMENT '财富值属性',
`is_old` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 ',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `account_id_skinid` (`account_id`, `skin_id`)
PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -1885,4 +1888,4 @@ CREATE TABLE `t_server_task_battle_count` (
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View File

@ -7,7 +7,7 @@ CREATE TABLE `t_hero_skin` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤id',
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄id',
`hero_uniid` int(11) NOT NULL DEFAULT '0' COMMENT '英雄uniid',
`skin_state` int(11) NOT NULL DEFAULT '0' COMMENT '英雄皮肤状态 0=封装1=解封',
`used` int(11) NOT NULL DEFAULT '0' COMMENT '使用状态 0=未使用1=使用中',
`get_from` int(11) NOT NULL DEFAULT '0' COMMENT '获得方式 0 = 系统赠送 1 = 金币购买',
@ -15,10 +15,10 @@ CREATE TABLE `t_hero_skin` (
`try_expire_at` int(11) NOT NULL DEFAULT '0' COMMENT '试用截止时间',
`rand_attr` mediumblob COMMENT '随机属性',
`wealth_attr` mediumblob COMMENT '财富值属性',
`is_old` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 ',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `account_id_skinid` (`account_id`, `skin_id`)
PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
insert into version (version) values(2024052101);

View File

@ -1013,7 +1013,7 @@ class BattleController extends BaseAuthedController {
$info['is_valid_battle'] = 1;
$info['hero_dto'] = Hero::toDto($heroDb);
{//选用皮肤id
$skinDb = HeroSkin::findBx($heroDb['hero_id']);
$skinDb = HeroSkin::find($heroDb['skin_id']);
if ($skinDb){
$info['hero_dto']['skin_id'] = $skinDb['skin_id'];
}

View File

@ -79,50 +79,6 @@ class HeroController extends BaseAuthedController {
));
}
public function skinList()
{
$heroId = getReqVal('hero_id',0);
if (!$heroId){
$this->_rspErr(1, "param null");
return;
}
$itemMeta = \mt\Item::get($heroId);
if (!$itemMeta || $itemMeta['type']!=\mt\Item::HERO_TYPE){
$this->_rspErr(1, "param error");
return;
}
$skinList = array();
$skinMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
if ($skinMeta){
foreach ($skinMeta as $value){
if ($value['playerid'] == $heroId){
array_push($skinList,HeroSkin::toDto($value));
}
}
}
$this->_rspData(array(
'skin_list' => $skinList
));
}
public function takeonSkin()
{
$heroUniId = getReqVal('hero_uniid', 0);
$skinId = getReqVal('skin_id', 0);
$heroDb = Hero::find($heroUniId);
$heroSkinDb = HeroSkin::find($skinId);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
$itemMeta = \mt\Item::get($skinId);
if ($itemMeta['isdefaultskin'] != 1 && !$heroSkinDb) {
$this->_rspErr(2, "You don't have the skin yet");
return;
}
HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
$this->_rspOk();
}
/*
升阶预览

View File

@ -0,0 +1,155 @@
<?php
require_once('mt/Item.php');
require_once('mt/DressAttribute.php');
require_once('models/Hero.php');
require_once('models/HeroSkin.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
require_once('services/LogService.php');
use phpcommon\SqlHelper;
use models\Hero;
use models\HeroSkin;
use services\LogService;
class HeroSkinController extends BaseAuthedController {
public function skinList()
{
$skinId = trim(getReqVal('skin_id', 0));
$itemMeta = \mt\Item::get($skinId);
if ($itemMeta['type'] != \mt\Item::HERO_SKIN_TYPE){
$this->_rspErr(1, 'skin_id error');
return;
}
$skinList = array();
HeroSkin::getSkinList($skinId,function ($row) use(&$skinList) {
array_push($skinList, $row);
});
$this->_rspData(array(
'skin_list' => $skinList
));
}
public function skinDetails()
{
$skinUniid = trim(getReqVal('skin_uniid', 0));
if ( ! $skinUniid) {
$this->_rspErr(1, 'Please enter instructions');
return;
}
$heroSkinDb = HeroSkin::find($skinUniid);
if (! $heroSkinDb){
$this->_rspErr(1, "You don't have the hero yet");
return;
}
$skin = HeroSkin::toDto($heroSkinDb);
$this->_rspData(array(
'data' => $skin
));
}
public function takeonSkin()
{
$heroUniid = getReqVal('hero_uniid', 0);
$skinUniid = getReqVal('skin_uniid', 0);
$heroDb = Hero::find($heroUniid);
$heroSkinDb = HeroSkin::find($skinUniid);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
if (!$heroSkinDb) {
$this->_rspErr(1, "You don't have the hero skin yet");
return;
}
if ($heroDb['skin_id']){
HeroSkin::update($heroDb['skin_id'],array(
'used'=>HeroSkin::NO_USE,
'hero_uniid'=>0,
'modifytime'=>myself()->_getNowTime(),
));
}
Hero::update($heroUniid,array(
'skin_id' => $skinUniid,
'modifytime'=>myself()->_getNowTime()
));
HeroSkin::update($skinUniid,array(
'used'=>HeroSkin::USED,
'skin_state'=>HeroSkin::NO_LOCK,
'hero_uniid'=>$heroUniid,
'modifytime'=>myself()->_getNowTime(),
));
$this->_rspOk();
}
public function demountSkin(){
$heroUniid = getReqVal('hero_uniid', 0);
$heroDb = Hero::find($heroUniid);
if (!$heroDb) {
$this->_rspErr(1, "You don't have the hero yet");
return;
}
if (!$heroDb['skin_id']){
$this->_rspErr(1, "Useless operation");
return;
}
Hero::update($heroUniid,array(
'skin_id' => 0,
'modifytime'=>myself()->_getNowTime()
));
HeroSkin::update($heroDb['skin_id'],array(
'used'=>HeroSkin::NO_USE,
'skin_state'=>HeroSkin::NO_LOCK,
'hero_uniid'=>0,
'modifytime'=>myself()->_getNowTime(),
));
$this->_rspOk();
}
public function synSkin(){
$skinId = trim(getReqVal('skin_id', 0));
$itemMeta = \mt\Item::get($skinId);
if ($itemMeta['type'] != \mt\Item::HERO_SKIN_TYPE){
$this->_rspErr(1, 'skin_id error');
return;
}
$dressMeta = mt\DressAttribute::get($skinId);
if (!$dressMeta){
$this->_rspErr(1, 'skin_id error');
return;
}
$needItem = explode(':',$dressMeta['needItem']);
$costItems = array(
array(
'item_id' => $needItem[0],
'item_num' => $needItem[1]
),
);
$lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return;
}
$this->_decItems($costItems);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addBagChg();
HeroSkin::addSkin($itemMeta);
$lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql());
$skinDb = HeroSkin::find($lastIdx);
$propertyChgService->addHeroSkinChg();
$event = array(
'ID' => 'heroSkin',
'SUB_ID' => 'synthesis',
'SUB_KEY' => 'heroSkin_synthesis',
'cost_fragment' => $costItems,
'result' => 1,
'outcome_skin' => $skinDb,
);
LogService::burialPointEvent($event);
$this->_rspData(array(
'property_chg' => $propertyChgService->toDto(),
));
}
}

View File

@ -20,6 +20,7 @@ require_once('models/RewardsCec.php');
require_once('models/GlobalData.php');
require_once('models/HashRate.php');
require_once('models/Hero.php');
require_once('models/HeroSkin.php');
require_once('models/Chip.php');
require_once('models/Bag.php');
@ -32,6 +33,7 @@ use models\RewardsCec;
use models\GlobalData;
use models\HashRate;
use models\Hero;
use models\HeroSkin;
use models\Chip;
use models\Bag;
@ -41,6 +43,7 @@ class OtherController extends BaseAuthedController {
const BAG = 3;
const SIGN = 4;
const HASH_RATE = 5;
const HERO_SKIN = 6;
public function tag()
{
@ -117,6 +120,20 @@ class OtherController extends BaseAuthedController {
'state' => $state,
));
}
break;
case self::HERO_SKIN :{
$res = myself()->_getSelfMysql()->execQueryOne("SELECT COUNT(idx) as totalNum FROM t_hero_skin WHERE account_id=:account AND is_old=:is_old LIMIT 1",array(
'account' => myself()->_getAccountId(),
'is_old' => 0,
));
if ($res['totalNum']){
$state = 1;
}
array_push($list,array(
'type' => self::HERO_SKIN,
'state' => $state,
));
}
}
}
@ -182,6 +199,18 @@ class OtherController extends BaseAuthedController {
}
}
break;
case self::HERO_SKIN :{
$skinDb = HeroSkin::find($unnid);
if (!$skinDb){
$this->_rspErr(1, 'param item_unnid error');
return;
}
HeroSkin::update($unnid,array(
'is_old' => 1
));
$propertyChgService->addHeroSkinChg();
}
break;
default:{
$this->_rspErr(4, 'param type error');
return;

View File

@ -127,8 +127,7 @@ class RankingController extends BaseAuthedController {
$heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']);
if ($heroDb){
$heroItemId = $heroDb['hero_id'];
$skinDb = HeroSkin::findByAccountId($row['account_id'],$heroItemId);
$skinDb = HeroSkin::findByAccountId($row['account_id'],$heroDb['skin_id']);
$hero_skin = $skinDb ? $skinDb['skin_id']:0;
}

View File

@ -258,7 +258,7 @@ class Hero extends BaseModel {
if ($row['idx'] == $userDb['hero_id'] && self::findByAccountId(myself()->_getAccountId(),$userDb['hero_id'])){
$isSelect = 1;
}
$skinDb = HeroSkin::findBx($row['hero_id']);
$skinDb = HeroSkin::find($row['skin_id']);
// $attribute = self::celHeroWealthUpLimit($row);
{
$heroMeta = \mt\Item::get($row['hero_id']);
@ -381,6 +381,15 @@ class Hero extends BaseModel {
}
}
}
if ($row['skin_id']){
$skinDb= HeroSkin::find($row['skin_id']);
$skinAttrs = emptyReplace(json_decode($skinDb['wealth_attr'], true), array());
$skinResult = \mt\EconomyAttribute::getAttrValue($skinAttrs);
$wealth += $skinResult['wealth'];
$wealth_rate += $skinResult['wealth_rate'];
$lucky += $skinResult['lucky'];
$lucky_rate += $skinResult['lucky_rate'];
}
return array(
"wealth" => floor($wealth * (1+$wealth_rate)),
"lucky" => floor($lucky * (1+$lucky_rate)),
@ -584,14 +593,7 @@ class Hero extends BaseModel {
public static function internalAddHero($conn, $heroMeta, $accountId, $tokenId,$quality = 1)
{
$skinItemMeta = \mt\Item::getMetaListByType(\mt\Item::HERO_SKIN_TYPE);
if ($skinItemMeta){
foreach ($skinItemMeta as $value){
if ($value['playerid'] == $heroMeta['id'] && $value['isdefaultskin'] ==1){
HeroSkin::addSkin($value);
}
}
}
$randAttr = self::getRandAttr($heroMeta['id']) ;
$attribute = \mt\EconomyAttribute::getAttribute($heroMeta['relationship'], $quality);
$seal_type = 0;

View File

@ -3,97 +3,28 @@
namespace models;
require_once('mt/Hero.php');
require_once('mt/DressAttribute.php');
require_once('mt/BattleRandAttribute.php');
require_once('mt/EconomyAttribute.php');
use mt;
use phpcommon\SqlHelper;
class HeroSkin extends BaseModel {
const GETED_STATE = 0;
const TRY_USING_STATE = 1;
const USED = 1;
const NO_USE = 0;
public static function find($skinId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $skinId
)
);
return $row;
}
const LOCK = 0;
const NO_LOCK = 1;
public static function findBx($heroId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId(),
'hero_id' => $heroId
)
);
return $row;
}
public static function findByAccountId($accountId, $heroId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => $accountId,
'hero_id' => $heroId
)
);
return $row;
}
public static function takeonSkin($skinId,$heroId){
$row = self::findBx($heroId);
SqlHelper::update(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $row['skin_id']
),
array(
'hero_id'=>0
)
);
SqlHelper::upsert(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $skinId
),
array(
'hero_id'=>$heroId
),
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $skinId,
'skin_state' => 0,
'get_from' => 0,
'consume_num' => 0,
'try_expire_at' => 0,
'hero_id' => $heroId,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
public static function getSkinList($cb){
public static function getSkinList($skinId,$cb){
SqlHelper::ormSelect(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId()
'account_id' => myself()->_getAccountId(),
'skin_id' => $skinId
),
function ($row) use($cb) {
$cb($row);
@ -101,51 +32,121 @@ class HeroSkin extends BaseModel {
);
}
public static function toDto($meta)
public static function find($uniid)
{
$row = self::find($meta['id']);
$is_have = 0;
$use_state = 0;
if ($row || $meta['isdefaultskin'] == 1){
$is_have = 1;
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'idx' => $uniid,
)
);
if ($row && $row['account_id'] != myself()->_getAccountId()) {
$row = null;
}
if ($row && $row['hero_id']){
$use_state = 1;
return $row;
}
public static function findByAccountId($accountId, $uniid)
{
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'idx' => $uniid,
)
);
if ($row && $row['account_id'] != $accountId) {
$row = null;
}
return $row;
}
public static function update($skinUniid,$fieldsKv){
if (self::find($skinUniid)){
SqlHelper::update(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'idx' => $skinUniid,
),
$fieldsKv
);
}
}
public static function toDto($row)
{
$attr = emptyReplace(json_decode($row['rand_attr'], true), array());
return array(
'skin_id'=>$meta['id'],
'is_have' => $is_have,
'use_state' => $use_state,
'idx' => $row['idx'],
'skin_uniid' => $row['idx'],
'account_id' => $row['account_id'],
'skin_id' => $row['skin_id'],
'hero_uniid' => $row['hero_uniid'],
'skin_state' => $row['skin_state'],
'used' => $row['used'],
'is_old' => $row['is_old'],
'rand_attr' => $attr,
'lucky' => self::getSkinLucky($row),
'wealth' => self::getSkinWealth($row),
);
}
public static function addSkin($itemMeta)
{
$heroId = 0;
if ($itemMeta['isdefaultskin'] == 1){
$heroId = $itemMeta['playerid'];
$rand_attr = array();
$wealth_attr = array();
$dressMeta = mt\DressAttribute::get($itemMeta['id']);
if ($dressMeta) {
$randMeta = mt\BattleRandAttribute::getByWeight($dressMeta['battleAttribute']);
$rand_attr = mt\BattleRandAttribute::getRandAttr($randMeta);
$wealth_attr = \mt\EconomyAttribute::getAttribute($dressMeta['economyAttribute'], 1);
}
SqlHelper::upsert(
SqlHelper::insert(
myself()->_getSelfMysql(),
't_hero_skin',
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $itemMeta['id']
),
array(),
array(
'account_id' => myself()->_getAccountId(),
'skin_id' => $itemMeta['id'],
'skin_state' => 0,
'skin_state' => self::LOCK,
'used' => self::NO_USE,
'get_from' => 0,
'consume_num' => 0,
'try_expire_at' => 0,
'hero_id' => $heroId,
'rand_attr' => json_encode($rand_attr),
'wealth_attr' => json_encode($wealth_attr),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime()
)
);
}
public static function getSkinWealth($row){
return self::celEconomyAttribute($row)["wealth"];
}
public static function getSkinLucky($row){
return self::celEconomyAttribute($row)["lucky"];
}
private static function celEconomyAttribute($row){
//最大财富值和幸运值计算
$wealth = 0;
$wealth_rate = 0;
$lucky = 0;
$lucky_rate = 0;
$heroAttrs = emptyReplace(json_decode($row['wealth_attr'], true), array());
$heroResult = \mt\EconomyAttribute::getAttrValue($heroAttrs);
$wealth += $heroResult['wealth'];
$wealth_rate += $heroResult['wealth_rate'];
$lucky += $heroResult['lucky'];
$lucky_rate += $heroResult['lucky_rate'];
return array(
"wealth" => floor($wealth * (1+$wealth_rate)),
"lucky" => floor($lucky * (1+$lucky_rate)),
);
}
}

View File

@ -212,7 +212,7 @@ class User extends BaseModel {
$heroId = $heroDb['hero_id'];
}
$preset = HeroPreset::getHeroPreset($row['hero_id']);
$skinDb = HeroSkin::findBx($heroId);
$skinDb = HeroSkin::find($heroDb['skin_id']);
$honorInfo = array();
if ($row['address']){
$honorInfo = UserHonor::info($row['address']);
@ -236,7 +236,7 @@ class User extends BaseModel {
'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute,
'hero_uniId' => $row['hero_id'],
'hero_id' => $heroId,
'hero_skin' =>$skinDb['skin_id'],
'hero_skin' =>$skinDb ? $skinDb['skin_id']:0,
'hero_lv' =>$heroDb['hero_lv'],
'presetInfo' => $preset,
'is_leader' => 0,

View File

@ -0,0 +1,20 @@
<?php
namespace mt;
class DressAttribute {
public static function get($id)
{
return getXVal(self::getMetaList(), $id);
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('dressAttribute@dressAttribute.php');
}
return self::$metaList;
}
protected static $metaList;
}

View File

@ -156,21 +156,6 @@ class ShopService {
{
$errCode = 0;
$errMsg = '';
switch ($itemMeta['type']) {
case mt\Item::HERO_SKIN_TYPE: {
$heroSkinDb = HeroSkin::find($itemMeta['id']);
if ($heroSkinDb) {
$errCode = 10;
$errMsg = 'You already have the skin';
return false;
}
}
break;
default: {
return true;
}
break;
}
return true;
}