Ejemplo n.º 1
0
        public void UpdateRebornRoleData4Selector(KFRebornRoleData roleData)
        {
            string sql = string.Format("UPDATE t_reborn_roles SET data1=@content WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);

            DbHelperMySQL.ExecuteSqlInsertImg(sql, new List <Tuple <string, byte[]> >
            {
                new Tuple <string, byte[]>("content", roleData.RoleData4Selector)
            });
        }
Ejemplo n.º 2
0
        public void UpdateRebornRoleData(KFRebornRoleData roleData, int chgMask, bool delay = true)
        {
            string sql = string.Format("UPDATE t_reborn_roles SET lev={2}, rarity={3}, rarity_last={4}, boss={5}, boss_last={6}, liansha={7}, liansha_last={8} WHERE ptid={0} AND rid={1};", new object[]
            {
                roleData.PtID,
                roleData.RoleID,
                roleData.Lev,
                roleData.Rarity,
                roleData.RarityLast,
                roleData.Boss,
                roleData.BossLast,
                roleData.LianSha,
                roleData.LianShaLast
            });

            if ((chgMask & 1) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_lev=NOW() WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 2) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_r=NOW() WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 4) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_rl=ranktm_r WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 8) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_b=NOW() WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 16) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_bl=ranktm_b WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 32) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_ls=NOW() WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if ((chgMask & 64) > 0)
            {
                sql += string.Format("UPDATE t_reborn_roles SET ranktm_lsl=ranktm_ls WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID);
            }
            if (delay)
            {
                this.AddDelayWriteSql(sql);
            }
            else
            {
                DbHelperMySQL.ExecuteSql(sql);
            }
        }
Ejemplo n.º 3
0
        public void InsertRebornRoleData(KFRebornRoleData roleData)
        {
            string sql = string.Format("INSERT INTO t_reborn_roles(ptid, rid, rname, lev, rarity, rarity_last, boss, boss_last, liansha, liansha_last, boss_award) VALUES({0},{1},'{2}',{3},{4},{5},{6},{7},{8},{9},'{10}');", new object[]
            {
                roleData.PtID,
                roleData.RoleID,
                roleData.RoleName,
                roleData.Lev,
                roleData.Rarity,
                roleData.RarityLast,
                roleData.Boss,
                roleData.BossLast,
                roleData.LianSha,
                roleData.LianShaLast,
                roleData.FormatBossAwardString(roleData.BossAwardList)
            });

            this.AddDelayWriteSql(sql);
        }
Ejemplo n.º 4
0
        public void UpdateRebornRoleDataRoleName(KFRebornRoleData roleData)
        {
            string sql = string.Format("UPDATE t_reborn_roles SET rname='{2}' WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID, roleData.RoleName);

            this.AddDelayWriteSql(sql);
        }
Ejemplo n.º 5
0
        public void UpdateRebornRoleDataBossAward(KFRebornRoleData roleData)
        {
            string sql = string.Format("UPDATE t_reborn_roles SET boss_award='{2}' WHERE ptid={0} AND rid={1};", roleData.PtID, roleData.RoleID, roleData.FormatBossAwardString(roleData.BossAwardList));

            this.AddDelayWriteSql(sql);
        }
Ejemplo n.º 6
0
        public bool ProcessKuaFuMapEnterCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            try
            {
                int result     = 0;
                int toMapCode  = Global.SafeConvertToInt32(cmdParams[0]);
                int line       = Global.SafeConvertToInt32(cmdParams[1]);
                int toBoss     = 0;
                int teleportId = 0;
                if (cmdParams.Length >= 3)
                {
                    toBoss = Global.SafeConvertToInt32(cmdParams[2]);
                }
                if (cmdParams.Length >= 4)
                {
                    teleportId = Global.SafeConvertToInt32(cmdParams[3]);
                }
                KuaFuLineData kuaFuLineData;
                if (!KuaFuMapManager.getInstance().IsKuaFuMap(toMapCode))
                {
                    result = -12;
                }
                else if (!this.RuntimeData.LineMap2KuaFuLineDataDict.TryGetValue(new IntPairKey(line, toMapCode), out kuaFuLineData))
                {
                    result = -12;
                }
                else if (!Global.CanEnterMap(client, toMapCode) || (toMapCode == client.ClientData.MapCode && kuaFuLineData.MapType != 1))
                {
                    result = -12;
                }
                else
                {
                    if (toMapCode == client.ClientData.MapCode && kuaFuLineData.MapType == 1)
                    {
                        List <KuaFuLineData> list = KuaFuWorldClient.getInstance().GetKuaFuLineDataList(toMapCode) as List <KuaFuLineData>;
                        if (null == list)
                        {
                            result = -12;
                            goto IL_67F;
                        }
                        KuaFuLineData currentLineData = list.Find((KuaFuLineData x) => x.ServerId == GameManager.KuaFuServerId);
                        if (currentLineData != null && currentLineData.Line == kuaFuLineData.Line)
                        {
                            result = -4011;
                            goto IL_67F;
                        }
                    }
                    if (!KuaFuMapManager.getInstance().IsKuaFuMap(client.ClientData.MapCode) && !this.CheckMap(client))
                    {
                        result = -21;
                    }
                    else if (!this.IsGongNengOpened(client, false))
                    {
                        result = -12;
                    }
                    else if (kuaFuLineData.OnlineCount >= kuaFuLineData.MaxOnlineCount)
                    {
                        result = -100;
                    }
                    else
                    {
                        int fromMapCode = client.ClientData.MapCode;
                        if (teleportId > 0)
                        {
                            GameMap fromGameMap = null;
                            if (!GameManager.MapMgr.DictMaps.TryGetValue(fromMapCode, out fromGameMap))
                            {
                                result = -3;
                                goto IL_67F;
                            }
                            MapTeleport mapTeleport = null;
                            if (!fromGameMap.MapTeleportDict.TryGetValue(teleportId, out mapTeleport) || mapTeleport.ToMapID != toMapCode)
                            {
                                result = -12;
                                goto IL_67F;
                            }
                            if (Global.GetTwoPointDistance(client.CurrentPos, new Point((double)mapTeleport.X, (double)mapTeleport.Y)) > 800.0)
                            {
                                result = -301;
                                goto IL_67F;
                            }
                        }
                        KuaFuServerLoginData kuaFuServerLoginData = Global.GetClientKuaFuServerLoginData(client);
                        int kuaFuServerId;
                        if (kuaFuLineData.MapType == 1)
                        {
                            if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Reborn, true))
                            {
                                result = -400;
                                goto IL_67F;
                            }
                            string signToken;
                            string signKey;
                            int    rt = KuaFuWorldClient.getInstance().EnterPTKuaFuMap(client.ServerId, client.ClientData.LocalRoleID, client.ClientData.ServerPTID, kuaFuLineData.MapCode, kuaFuLineData.Line, kuaFuServerLoginData, out signToken, out signKey);
                            if (rt == -4010)
                            {
                                KuaFuWorldRoleData kuaFuWorldRoleData = new KuaFuWorldRoleData
                                {
                                    LocalRoleID = client.ClientData.LocalRoleID,
                                    UserID      = client.strUserID,
                                    WorldRoleID = client.ClientData.WorldRoleID,
                                    Channel     = client.ClientData.Channel,
                                    PTID        = client.ClientData.ServerPTID,
                                    ServerID    = client.ServerId,
                                    ZoneID      = client.ClientData.ZoneID
                                };
                                rt = KuaFuWorldClient.getInstance().RegPTKuaFuRoleData(ref kuaFuWorldRoleData);
                                rt = KuaFuWorldClient.getInstance().EnterPTKuaFuMap(client.ServerId, client.ClientData.LocalRoleID, client.ClientData.ServerPTID, kuaFuLineData.MapCode, kuaFuLineData.Line, kuaFuServerLoginData, out signToken, out signKey);
                            }
                            if (rt < 0)
                            {
                                result = rt;
                                goto IL_67F;
                            }
                            KFRebornRoleData rebornRoleData = KuaFuWorldClient.getInstance().Reborn_GetRebornRoleData(client.ClientData.ServerPTID, client.ClientData.LocalRoleID);
                            if (null == rebornRoleData)
                            {
                                result = KuaFuWorldClient.getInstance().Reborn_RoleReborn(client.ClientData.ServerPTID, client.ClientData.LocalRoleID, client.ClientData.RoleName, client.ClientData.RebornLevel);
                                if (result < 0)
                                {
                                    goto IL_67F;
                                }
                                LogManager.WriteLog(LogTypes.Analysis, string.Format("Reborn_RoleReborn ptId={0} roleId={1} roleName={2} rebornLevel={3}", new object[]
                                {
                                    client.ClientData.ServerPTID,
                                    client.ClientData.LocalRoleID,
                                    client.ClientData.RoleName,
                                    client.ClientData.RebornLevel
                                }), null, true);
                            }
                            kuaFuServerLoginData.PTID       = client.ClientData.ServerPTID;
                            kuaFuServerLoginData.RoleId     = client.ClientData.LocalRoleID;
                            kuaFuServerLoginData.SignToken  = signToken;
                            kuaFuServerLoginData.TempRoleID = rt;
                            kuaFuServerLoginData.SignCode   = MD5Helper.get_md5_string(kuaFuServerLoginData.SignDataString() + signKey).ToLower();
                            kuaFuServerId = kuaFuServerLoginData.TargetServerID;
                        }
                        else
                        {
                            kuaFuServerLoginData.SignCode = null;
                            kuaFuServerId = YongZheZhanChangClient.getInstance().EnterKuaFuMap(client.ClientData.LocalRoleID, kuaFuLineData.MapCode, kuaFuLineData.Line, client.ServerId, Global.GetClientKuaFuServerLoginData(client));
                        }
                        kuaFuServerLoginData.Line = line;
                        if (kuaFuServerId > 0)
                        {
                            bool flag      = 0 == 0;
                            int  needMoney = (teleportId > 0) ? 0 : Global.GetMapTransNeedMoney(toMapCode);
                            if (Global.GetTotalBindTongQianAndTongQianVal(client) < needMoney)
                            {
                                GameManager.ClientMgr.NotifyImportantMsg(client, StringUtil.substitute(GLang.GetLang(171, new object[0]), new object[]
                                {
                                    needMoney,
                                    Global.GetMapName(toMapCode)
                                }), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 27);
                                result = -9;
                                Global.GetClientKuaFuServerLoginData(client).RoleId = 0;
                            }
                            else
                            {
                                int[] enterFlags = new int[5];
                                enterFlags[0] = fromMapCode;
                                enterFlags[1] = teleportId;
                                enterFlags[2] = toBoss;
                                Global.SaveRoleParamsIntListToDB(client, new List <int>(enterFlags), "EnterKuaFuMapFlag", true);
                                GlobalNew.RecordSwitchKuaFuServerLog(client);
                                client.sendCmd <KuaFuServerLoginData>(14000, Global.GetClientKuaFuServerLoginData(client), false);
                            }
                        }
                        else
                        {
                            Global.GetClientKuaFuServerLoginData(client).RoleId = 0;
                            result = kuaFuServerId;
                        }
                    }
                }
IL_67F:
                client.sendCmd <int>(nID, result, false);
                return(true);
            }
            catch (Exception ex)
            {
                DataHelper.WriteFormatExceptionLog(ex, Global.GetDebugHelperInfo(client.ClientSocket), false, false);
            }
            return(false);
        }