1111
This commit is contained in:
@@ -6,94 +6,7 @@
|
||||
*/
|
||||
|
||||
|
||||
class defaultJobItemId {
|
||||
|
||||
/**
|
||||
* 头发
|
||||
*/
|
||||
hat = 0;
|
||||
|
||||
/**
|
||||
* 帽子
|
||||
*/
|
||||
hair = 0;
|
||||
|
||||
/**
|
||||
*脸
|
||||
*/
|
||||
face = 0;
|
||||
/**
|
||||
* 披风
|
||||
*/
|
||||
breast = 0;
|
||||
/**
|
||||
* 上衣
|
||||
*/
|
||||
coat = 0;
|
||||
|
||||
/**
|
||||
* 下装
|
||||
*/
|
||||
pants = 0;
|
||||
|
||||
/**
|
||||
* 腰部
|
||||
*/
|
||||
waist = 0;
|
||||
|
||||
/**
|
||||
* 鞋子
|
||||
*/
|
||||
shoes = 0;
|
||||
|
||||
/**
|
||||
* 皮肤
|
||||
*/
|
||||
skin = 0;
|
||||
|
||||
index = null;
|
||||
|
||||
constructor(hat, hair, face, breast, coat, pants, waist, shoes, skin) {
|
||||
index = [];
|
||||
this.hat = hat;
|
||||
this.hair = hair;
|
||||
this.face = face;
|
||||
this.breast = breast;
|
||||
this.coat = coat;
|
||||
this.pants = pants;
|
||||
this.waist = waist;
|
||||
this.shoes = shoes;
|
||||
this.skin = skin;
|
||||
|
||||
index.push(hat);
|
||||
index.push(hair);
|
||||
index.push(face);
|
||||
index.push(breast);
|
||||
index.push(coat);
|
||||
index.push(pants);
|
||||
index.push(waist);
|
||||
index.push(shoes);
|
||||
index.push(skin);
|
||||
index.push(0);
|
||||
index.push(0);
|
||||
}
|
||||
}
|
||||
//默认时装
|
||||
if (!(getroottable().rawin("defaultJobItemIdMap"))) {
|
||||
getroottable().defaultJobItemIdMap <- {};
|
||||
defaultJobItemIdMap.rawset(0, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200));
|
||||
defaultJobItemIdMap.rawset(1, defaultJobItemId(0, 43400, 0, 0, 44600, 45000, 0, 45800, 46200));
|
||||
defaultJobItemIdMap.rawset(2, defaultJobItemId(0, 47400, 0, 48426, 48600, 49000, 0, 49800, 50200));
|
||||
defaultJobItemIdMap.rawset(3, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200));
|
||||
defaultJobItemIdMap.rawset(4, defaultJobItemId(0, 55400, 55820, 0, 56600, 57000, 0, 57800, 58200));
|
||||
|
||||
defaultJobItemIdMap.rawset(5, defaultJobItemId(1600000, 1610000, 0, 0, 1640000, 1650000, 0, 1670000, 1680000));
|
||||
defaultJobItemIdMap.rawset(6, defaultJobItemId(1720000, 1730000, 0, 1750000, 1760000, 1770000, 0, 1790000, 1800000));
|
||||
defaultJobItemIdMap.rawset(7, defaultJobItemId(0, 29201, 0, 0, 29202, 29203, 0, 29204, 29205));
|
||||
defaultJobItemIdMap.rawset(8, defaultJobItemId(0, 2090000, 0, 0, 2120000, 2130000, 0, 2140000, 2150000));
|
||||
defaultJobItemIdMap.rawset(9, defaultJobItemId(39278, 39400, 0, 0, 40600, 41000, 0, 41800, 42200));
|
||||
defaultJobItemIdMap.rawset(10, defaultJobItemId(51265, 51400, 0, 0, 52600, 53000, 0, 53800, 54200));
|
||||
}
|
||||
|
||||
|
||||
class Marry {
|
||||
@@ -307,44 +220,26 @@ class Marry {
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取角色身上的显示时装
|
||||
function GetAva(SUser) {
|
||||
//获取背包对象
|
||||
local InvenObj = SUser.GetInven();
|
||||
if (!InvenObj) return;
|
||||
local re = [];
|
||||
local job = SUser.GetCharacJob();
|
||||
|
||||
//遍历身上的每一件装备
|
||||
for (local u = 0; u <= 2; u++) {
|
||||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||||
if (EquObj && !EquObj.IsEmpty) {
|
||||
//先拿克隆id 如果这个值有 那说明带的克隆这个是被克隆的装备 直接用这个 但是如果这个人什么都没带 只带了克隆 会显示克隆的id 所以还得判断这个id是不是克隆时装
|
||||
local clearId = Sq_CallFunc(S_Ptr("0x850d374"), "int", ["pointer", "int"], InvenObj.C_Object, u)
|
||||
|
||||
|
||||
local EquObjId = EquObj.GetIndex();
|
||||
//如果这个是克隆
|
||||
if (clearId > 0) {
|
||||
re.push(clearId);
|
||||
} else { //不是克隆 直接把id放上去
|
||||
re.push(EquObjId);
|
||||
}
|
||||
} else { //如果这个部位没东西 直接放默认时装上去
|
||||
re.push(defaultJobItemIdMap[job].index[u]);
|
||||
//根据cid查询自己的uid
|
||||
GetUidByCid = function(cid) {
|
||||
local Sql = format(MARRY_SQL_LIST.GetUidByCid, cid);
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local Ret = SqlObj.Select(Sql, ["int"]);
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
if (Ret.len()< 1 || Ret[0][0] == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Ret[0][0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//查看是否结婚包
|
||||
function CheckMarryStateCallBack(SUser, Jso) {
|
||||
local T = {
|
||||
@@ -530,7 +425,10 @@ class Marry {
|
||||
infore.rawset("name", SUser.GetCharacName());
|
||||
infore.rawset("uid", SUser.GetUID());
|
||||
|
||||
local Muser = World.GetUserByUid(Target_CId);
|
||||
//根据cid去查uid
|
||||
local Target_Uid = Mysql_Operate_Func.GetUidByCid(Target_CId);
|
||||
|
||||
local Muser = World.GetUserByUid(Target_Uid);
|
||||
local infore2 = {};
|
||||
infore2.rawset("job", Muser.GetCharacJob());
|
||||
infore2.rawset("growjob", Muser.GetCharacGrowType());
|
||||
@@ -613,7 +511,7 @@ class Marry {
|
||||
local infore = {
|
||||
job = user.GetCharacJob(),
|
||||
growjob = user.GetCharacGrowType(),
|
||||
avatar = GetAva(user),
|
||||
avatar = user.GetAva(),
|
||||
name = user.GetCharacName(),
|
||||
};
|
||||
info.push(infore);
|
||||
@@ -686,7 +584,7 @@ class Marry {
|
||||
local infore = {};
|
||||
infore.rawset("job", SUser.GetCharacJob());
|
||||
infore.rawset("growjob", SUser.GetCharacGrowType());
|
||||
infore.rawset("avatar", GetAva(SUser));
|
||||
infore.rawset("avatar", SUser.GetAva());
|
||||
infore.rawset("name", SUser.GetCharacName());
|
||||
|
||||
|
||||
@@ -720,7 +618,6 @@ class Marry {
|
||||
if (SUser.GetLocation().Area == Config["礼堂区域编号"]) Sq_WriteAddress(C_Area, 0x68, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -850,22 +747,23 @@ class Marry {
|
||||
Channel = ConfigPath.slice(-6).slice(0, 2);
|
||||
|
||||
//注册来自客户端的收包
|
||||
ClientSocketPackFuncMap.rawset(OP + 9, CheckMarryStateCallBack.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 3, RequestMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 5, ResponseMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 7, CancelMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 11, OpenPreparationWindow.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 13, ConfirmMarry.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 15, EnterAuditorium.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 17, LeaveAuditorium.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 19, GetAuditoriumList.bindenv(this));
|
||||
ClientSocketPackFuncMap.rawset(OP + 777, GetConfig.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 9, CheckMarryStateCallBack.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 3, RequestMarry.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 5, ResponseMarry.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 7, CancelMarry.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 11, OpenPreparationWindow.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 13, ConfirmMarry.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 15, EnterAuditorium.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 17, LeaveAuditorium.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 19, GetAuditoriumList.bindenv(this));
|
||||
// ClientSocketPackFuncMap.rawset(OP + 777, GetConfig.bindenv(this));
|
||||
//注册结婚回调函数
|
||||
Cb_Insert_User_Func.Marry <- Marry_insert_user_hook.bindenv(this); //区域添加角色
|
||||
|
||||
//玩家重新上线的时候自动给他退出礼堂
|
||||
// //玩家重新上线的时候自动给他退出礼堂
|
||||
Cb_reach_game_world_Func.Auditorium <- function(SUser) {
|
||||
if (EnterAuditoriumPosList.rawin(SUser.GetUID())) {
|
||||
|
||||
if (EnterAuditoriumPosList && EnterAuditoriumPosList.rawin(SUser.GetUID())) {
|
||||
local Info = EnterAuditoriumPosList[SUser.GetCID()];
|
||||
//给这个礼堂的人发送退出可见列表的包
|
||||
foreach(cid in AuditoriumUserInfo[Info["所在礼堂编号"]]) {
|
||||
@@ -878,6 +776,7 @@ class Marry {
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
|
||||
//从池子拿连接
|
||||
local SqlObj = MysqlPool.GetInstance().GetConnect();
|
||||
local query = "SELECT COUNT(*) AS table_exists FROM information_schema.tables WHERE table_schema = 'zyk' AND table_name = 'marry';"
|
||||
@@ -892,29 +791,34 @@ class Marry {
|
||||
//把连接还池子
|
||||
MysqlPool.GetInstance().PutConnect(SqlObj);
|
||||
|
||||
|
||||
Cb_Use_Item_Sp_Func[Config["结婚等级1道具ID"]] <- function(SUser, ItemId) {
|
||||
ExpUp(SUser, Config["道具1给的心意点"]);
|
||||
}.bindenv(this);
|
||||
Cb_Use_Item_Sp_Func[Config["结婚等级2道具ID"]] <- function(SUser, ItemId) {
|
||||
ExpUp(SUser, Config["道具2给的心意点"]);
|
||||
}.bindenv(this);
|
||||
Cb_Use_Item_Sp_Func[Config["结婚等级3道具ID"]] <- function(SUser, ItemId) {
|
||||
ExpUp(SUser, Config["道具3给的心意点"]);
|
||||
}.bindenv(this);
|
||||
|
||||
}
|
||||
|
||||
function ExpUp(SUser, expUp) {
|
||||
exp = Mysql_Operate_Func.GetExpById(SUser.GetCID())
|
||||
if (!exp) {
|
||||
return;
|
||||
}
|
||||
exp = exp + expUp;
|
||||
for (local i = 6; i >= 0; i--) {
|
||||
//如果当前的经验值大于所遍历到的等级 就设定等级为这个 然后不继续向更低等级遍历
|
||||
if (Config["戒指等级"][i.tostring()]["所需经验"]< exp) {
|
||||
Mysql_Operate_Func.SetExpAndLvById(SUser.GetCID(), i, exp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Cb_Use_Item_Sp_Func[Config["结婚等级1道具ID"]] <- function(SUser, ItemId) {
|
||||
// ExpUp(SUser, Config["道具1给的心意点"]);
|
||||
// }
|
||||
// Cb_Use_Item_Sp_Func[Config["结婚等级2道具ID"]] <- function(SUser, ItemId) {
|
||||
// ExpUp(SUser, Config["道具2给的心意点"]);
|
||||
// }
|
||||
// Cb_Use_Item_Sp_Func[Config["结婚等级3道具ID"]] <- function(SUser, ItemId) {
|
||||
// ExpUp(SUser, Config["道具3给的心意点"]);
|
||||
// }
|
||||
|
||||
|
||||
// function ExpUp(SUser, expUp) {
|
||||
// exp = Mysql_Operate_Func.GetExpById(SUser.GetCID())
|
||||
// exp = exp + expUp;
|
||||
// for (local i = 6; i >= 0; i--) {
|
||||
// //如果当前的经验值大于所遍历到的等级 就设定等级为这个 然后不继续向更低等级遍历
|
||||
// if (Config["戒指等级"][i.tostring()]["所需经验"]< exp) {
|
||||
// Mysql_Operate_Func.SetExpAndLvById(SUser.GetCID(), i, exp)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//初始化结婚
|
||||
// ProjectInitFuncMap.P_Marry <- Marry();
|
||||
@@ -46,4 +46,7 @@ MARRY_SQL_LIST.RomoveRoom <- @"DELETE FROM marry_room where rindex < UNIX_TIMEST
|
||||
MARRY_SQL_LIST.GetExpById <- @"SELECT experience FROM zyk.marry WHERE cid = %d";
|
||||
|
||||
//设置自己的经验值和等级
|
||||
MARRY_SQL_LIST.SetExpAndLvById <- @"UPDATE zyk.marry SET level = %d , experience = %d WHERE cid = %d or target_cid = %d";
|
||||
MARRY_SQL_LIST.SetExpAndLvById <- @"UPDATE zyk.marry SET level = %d , experience = %d WHERE cid = %d or target_cid = %d";
|
||||
|
||||
//根据cid获取uid
|
||||
MARRY_SQL_LIST.GetUidByCid <- @"SELECT m_id FROM taiwan_caincharac_info WHERE charac_no = %d";
|
||||
Reference in New Issue
Block a user