You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
816 lines
32 KiB
816 lines
32 KiB
|
|
using LitJson;
|
|
using ProtoCSStruct;
|
|
using Sog;
|
|
using Sog.Log;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.Design;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using System.Security.Cryptography;
|
|
using TencentCloud.Bmeip.V20180625.Models;
|
|
|
|
namespace Game
|
|
{
|
|
public static class GameTALogUtils
|
|
{
|
|
private static readonly string Android = "ANDROID";
|
|
private static readonly string IOS = "IOS";
|
|
private static readonly string PC = "PC";
|
|
|
|
|
|
//道具关联的宝物id
|
|
private static Dictionary<int, int> ItemLinkTreasureMap = null;
|
|
|
|
public static string GetPlayerChannel(PlayerOnGame player)
|
|
{
|
|
return player.appChannelId;
|
|
}
|
|
|
|
private static string GetBdcOs(PlatformType platform)
|
|
{
|
|
switch (platform)
|
|
{
|
|
case PlatformType.PlatformType_Android:
|
|
return Android;
|
|
case PlatformType.PlatformType_IOS:
|
|
return IOS;
|
|
case PlatformType.PlatformType_Windows:
|
|
return PC;
|
|
default:
|
|
return PC;
|
|
}
|
|
}
|
|
|
|
private static string GetServerName(int realmID)
|
|
{
|
|
string realmBdcName = null;
|
|
foreach (RealmBriefInfo info in GameServerUtils.GetGameServerData().m_configRealm)
|
|
{
|
|
if (info.realmId == realmID)
|
|
{
|
|
realmBdcName = info.realmBdcName;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(realmBdcName))
|
|
{
|
|
return "0";
|
|
}
|
|
else
|
|
{
|
|
return realmBdcName;
|
|
}
|
|
}
|
|
|
|
#region 用户属性设置上报
|
|
/// <summary>
|
|
/// 玩家角色创建设置属性信息,只设置一次
|
|
/// </summary>
|
|
/// <param name="player"></param>
|
|
public static void UseSetBorn(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.USER_SET, player.UserID.ToString(), player.taDistinctID, "", "");
|
|
|
|
//区服id
|
|
ta.Add("server_create", GetServerName(player.RealmID));
|
|
//账号id
|
|
ta.Add("sdk_login_id", player.AccountInfo.AccountID.ToString());
|
|
//账号注册时间
|
|
ta.Add("reg_time", AppTime.ConvertUnixTimeToDateTime(player.accountCreateTime * 1000));
|
|
|
|
//角色创建时间
|
|
ta.Add("role_create_time", AppTime.ConvertUnixTimeToDateTime(player.RoleBase.CreateTime * 1000));
|
|
|
|
//虚拟worldId
|
|
ta.Add("virtual_world", player.LogicWorld);
|
|
//星球竞技场bigRealm
|
|
ta.Add("star_server", GameServerUtils.GetStarArenaBigRealm(player.RealmID));
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void UseSetLogin(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.USER_SET, player.UserID.ToString(), player.taDistinctID, "", "");
|
|
//最后登录时间
|
|
ta.Add("last_role_login_time", AppTime.ConvertUnixTimeToDateTime(player.RoleBase.LastLoginTime * 1000));
|
|
//区服id
|
|
ta.Add("server", GetServerName(player.RealmID));
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void UseSetLogout(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.USER_SET, player.UserID.ToString(), player.taDistinctID, "", "");
|
|
|
|
ta.Add("app_version", AppVersion.ToStringVersion(player.appVersion));
|
|
ta.Add("game_version", PlayerUtils.GetServerCurVersionForPlayer(player.Platform));
|
|
ta.Add("ip", string.IsNullOrEmpty(player.loginIpAddr) ? "0" : player.loginIpAddr);
|
|
|
|
if (player.RoleBase.LastLoginTime > 0)
|
|
ta.Add("last_role_login_time", AppTime.ConvertUnixTimeToDateTime(player.RoleBase.LastLoginTime * 1000));
|
|
|
|
ta.Add("level", player.GetLevel());
|
|
ta.Add("role_name", player.GetNick());
|
|
|
|
if (player.RoleData.PayData.LastSendDBAddDiamondTime > 0)
|
|
ta.Add("last_pay_time", AppTime.ConvertUnixTimeToDateTime(player.RoleData.PayData.LastSendDBAddDiamondTime * 1000));
|
|
|
|
ta.Add("total_money", (double)player.RoleData.PayData.TotalPayMoneyUSD / 100);
|
|
ta.Add("gold_total", player.GetGold());
|
|
ta.Add("diamond_total", player.GetDiamond());
|
|
|
|
ta.Add("task_id", TaskEXSvc.GetCurrentMainTask(player));
|
|
ta.Add("server", GetServerName(player.RealmID));
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void UseSetCharge(PlayerOnGame player, ref DBPaySuccWaitAddRole data)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.USER_SET, player.UserID.ToString(), player.taDistinctID, "", "");
|
|
|
|
ta.Add("last_pay_time", AppTime.ConvertUnixTimeToDateTime(data.PayTime3rd * 1000));
|
|
ta.Add("last_pay_amount", (float)data.Amount / 100);
|
|
//首充
|
|
if (data.IsPlayerFirstPay)
|
|
{
|
|
ta.Add("first_pay_amount", (float)data.Amount / 100);
|
|
|
|
long curOnlineTime = GameServerUtils.GetTimeSecond() - player.RoleBase.LastLoginTime;
|
|
ta.Add("first_pay_active_time", player.RoleBase.OnlineTime + curOnlineTime);
|
|
}
|
|
// 累计充值
|
|
ta.Add("total_money", (double)player.RoleData.PayData.TotalPayMoneyUSD / 100);
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void UseSetOnceFirstPay(PlayerOnGame player, ref DBPaySuccWaitAddRole data)
|
|
{
|
|
if (!data.IsPlayerFirstPay)
|
|
return;
|
|
|
|
var ta = new TALogHelper(TALOG_TYPE.USER_SETONCE, player.UserID.ToString(), player.taDistinctID, "", "");
|
|
|
|
ta.Add("first_pay", AppTime.ConvertUnixTimeToDateTime(data.PayTime3rd * 1000));
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 行为事件
|
|
|
|
/// <summary>
|
|
/// 每个事件都要上报的字段
|
|
/// </summary>
|
|
/// <param name="player"></param>
|
|
/// <param name="ta"></param>
|
|
public static void InitPublicProperties(PlayerOnGame player, TALogHelper ta)
|
|
{
|
|
var clientInfo = player.clientInfo;
|
|
|
|
ta.Add("#device_id", string.IsNullOrEmpty(player.deviceId) ? "0" : player.deviceId);
|
|
ta.Add("#device_model", string.IsNullOrEmpty(clientInfo.deviceInfo) ? "" : clientInfo.deviceInfo);
|
|
ta.Add("#os", string.IsNullOrEmpty(clientInfo.os) ? "" : clientInfo.os);
|
|
ta.Add("#device_type", string.IsNullOrEmpty(clientInfo.deviceType) ? "" : clientInfo.deviceType);
|
|
ta.Add("#os_version", string.IsNullOrEmpty(clientInfo.osVersion) ? "" : clientInfo.osVersion);
|
|
ta.Add("#app_version", string.IsNullOrEmpty(clientInfo.appVersion) ? "" : clientInfo.appVersion);
|
|
ta.Add("#network_type", string.IsNullOrEmpty(clientInfo.networkType) ? "" : clientInfo.networkType);
|
|
ta.Add("#carrier", string.IsNullOrEmpty(clientInfo.carrier) ? "" : clientInfo.carrier);
|
|
ta.Add("#bundle_id", string.IsNullOrEmpty(clientInfo.bundleId) ? "" : clientInfo.bundleId);
|
|
ta.Add("#fps", 0);
|
|
ta.Add("#ip", string.IsNullOrEmpty(player.loginIpAddr) ? "0" : player.loginIpAddr);
|
|
ta.Add("#manufacturer", string.IsNullOrEmpty(clientInfo.manufacturer) ? "" : clientInfo.manufacturer);
|
|
ta.Add("device_aid", string.IsNullOrEmpty(clientInfo.device_aid) ? "" : clientInfo.device_aid);
|
|
ta.Add("device_bid", string.IsNullOrEmpty(clientInfo.device_bid) ? "" : clientInfo.device_bid);
|
|
ta.Add("device_aid_init", string.IsNullOrEmpty(clientInfo.device_aid_init) ? "" : clientInfo.device_aid_init);
|
|
ta.Add("device_bid_init", string.IsNullOrEmpty(clientInfo.device_bid_init) ? "" : clientInfo.device_bid_init);
|
|
ta.Add("device_appid", string.IsNullOrEmpty(clientInfo.device_appid) ? "" : clientInfo.device_appid);
|
|
|
|
ta.Add("channel", GetPlayerChannel(player));
|
|
ta.Add("server", GetServerName(player.RealmID));
|
|
ta.Add("platform", GetBdcOs(player.Platform));
|
|
ta.Add("level", player.GetLevel());
|
|
ta.Add("sdk_login_id", player.AccountInfo.AccountID.ToString());
|
|
ta.Add("total_money", (double)player.RoleData.PayData.TotalPayMoneyUSD / 100);
|
|
ta.Add("openid", player.AccountInfo.AccountID.GetString());
|
|
|
|
if (player.RoleBase.CreateTime > 0)
|
|
{
|
|
ta.Add("role_create_time", AppTime.ConvertUnixTimeToDateTime(player.RoleBase.CreateTime * 1000));
|
|
}
|
|
|
|
ta.Add("role_name", player.GetNick());
|
|
|
|
ta.Add("mainline_task_id", TaskEXSvc.GetCurrentMainTask(player));
|
|
//虚拟worldId
|
|
ta.Add("virtual_world", player.LogicWorld);
|
|
}
|
|
|
|
public static void LogCreateRole(PlayerOnGame player, int roleCount)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Create_Role, "");
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("is_roll", roleCount == 1 ? 0 : 1);
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void LogLogin(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Role_Login, "");
|
|
InitPublicProperties(player, ta);
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void LogBattlePassInfo(PlayerOnGame player, out JsonData battle_pass_info)
|
|
{
|
|
battle_pass_info = new JsonData();
|
|
var bps=player.RoleData.ActExtraInfo.BattlePassData;
|
|
for (int i = 0; i < bps.Count; i++)
|
|
{
|
|
JsonData boxPassCard = new JsonData();
|
|
var bp = bps[i];
|
|
boxPassCard["bp_type"] = bp.ReasonType.ToString();
|
|
boxPassCard["bp_price"] = bp.Active[1].ToString();
|
|
boxPassCard["bp_id"] = bp.ActId;
|
|
battle_pass_info.Add(boxPassCard);
|
|
}
|
|
|
|
}
|
|
|
|
public static void LogLogout(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Role_Logout, "");
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("online_time", player.CurrOnlineTime);
|
|
//ta.Add("gold_sum", player.GetGold());
|
|
//ta.Add("diamond_sum", player.GetDiamond());
|
|
|
|
LogBattlePassInfo(player, out var battle_pass_info);
|
|
ta.Add("bp_info", battle_pass_info);
|
|
InitLogoutHeroInfo(player, ta);
|
|
|
|
ta.Add("attribute_info", LogFormatAllProp(player));
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
public static void Recruit(PlayerOnGame player,int operate,int type,int times,IDStringValue cost,List<TypeIDValueString> info)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.draw_card, "");
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("draw_operate", operate);
|
|
ta.Add("draw_type", type);
|
|
ta.Add("draw_times", times);
|
|
|
|
JsonData costJson = new JsonData();
|
|
costJson["cost_id"] = cost.Id.GetString();
|
|
costJson["cost_num"] = cost.Value;
|
|
ta.Add("draw_cost", costJson);
|
|
JsonData infos = new JsonData();
|
|
foreach (var v in info)
|
|
{
|
|
JsonData k = new JsonData();
|
|
k["rewards_id"] = v.Id.GetString();
|
|
k["rewards_num"] = v.Value;
|
|
infos.Add(k);
|
|
|
|
}
|
|
ta.Add("draw_infos", infos);
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void InitLogoutHeroInfo(PlayerOnGame player, TALogHelper ta)
|
|
{
|
|
FillLogoutHeroInfo(player, out var riderAdd, out var riderInfo, out var equipInfo, out var petInfo, out var wingInfo, out var mountInfo, out var artifactInfo, out var artifactLevelInfo);
|
|
//ta.Add("rider_handbook_add", riderAdd);
|
|
ta.Add("rider_info", riderInfo);
|
|
//ta.Add("equips_info", equipInfo);
|
|
ta.Add("pet_develop_new", petInfo);
|
|
//ta.Add("wing_develop", wingInfo);
|
|
ta.Add("mount_develop", mountInfo);
|
|
ta.Add("artifact_develop", artifactInfo);
|
|
ta.Add("level_info", artifactLevelInfo);
|
|
|
|
}
|
|
|
|
public static void FillLogoutHeroInfo(PlayerOnGame player, out JsonData riderAdd, out JsonData riderInfo, out JsonData equipInfo,
|
|
out JsonData petInfo, out JsonData wingInfo, out JsonData mountInfo, out JsonData artifactInfo, out JsonData artifactLevelInfo
|
|
)
|
|
{
|
|
// 骑士手册加成
|
|
riderAdd = new JsonData();
|
|
|
|
// 骑士自身属性
|
|
riderInfo = new JsonData();
|
|
//for (int i = 0; i < HeroProp.GetIDListForView().Count; i++)
|
|
//{
|
|
// riderInfo[((int)HeroProp.GetIDListForView()[i]).ToString()] = player.knight.prop.GetValue(HeroProp.GetIDListForView()[i]);
|
|
//}
|
|
|
|
//装备信息
|
|
equipInfo = new JsonData();
|
|
for (int i = 0; i < player.RoleData.Knight.DbHero.WearEquip.Count; i++)
|
|
{
|
|
JsonData equipJson = new JsonData();
|
|
equipJson["equip_id"] = player.RoleData.Knight.DbHero.WearEquip[i].DescId.ToString();
|
|
equipJson["equip_level"] = player.RoleData.Knight.DbHero.WearEquip[i].Level;
|
|
equipJson["equip_quality"] = player.RoleData.Knight.DbHero.WearEquip[i].Quality.ToString();
|
|
|
|
|
|
equipJson["is_enchant"] = false;
|
|
equipJson["enchant_level"] = 0;
|
|
|
|
equipInfo.Add(equipJson);
|
|
}
|
|
|
|
// 宠物信息
|
|
petInfo = new JsonData();
|
|
|
|
// 翅膀
|
|
wingInfo = new JsonData();
|
|
|
|
string wingListStr = "[";
|
|
|
|
wingListStr += "]";
|
|
wingInfo["wings_list"] = wingListStr;
|
|
wingInfo["skill_level_list"] = "[]"; //TODO 后续接入了翅膀技能功能再写入
|
|
|
|
// 坐骑
|
|
mountInfo = new JsonData();
|
|
|
|
// 神器信息
|
|
artifactInfo = new JsonData();
|
|
|
|
// 神器等级加成信息
|
|
artifactLevelInfo = new JsonData();
|
|
}
|
|
|
|
public static void LogChargeInfo(PlayerOnGame player, ref DBPaySuccWaitAddRole data,
|
|
int condParam, ref SSPayDBAddDiamondStatusRes res, List<TypeIDValueString> selfItems = null)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Payment);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("unit", data.Currency.GetString());
|
|
// 付款方式, 1是SDK支付 2是测试支付\沙盒支付
|
|
ta.Add("payment_method", data.IsTestPay == 1 || data.Sandbox == 1 ? 2 : 1);
|
|
//ta.Add("is_first_pay", data.IsPlayerFirstPay ? "1" : "0");
|
|
// 金额, todo 需要根据地区区分上报金额
|
|
ta.Add("pay_amount", (float)data.Amount / 100);
|
|
// 商品id
|
|
ta.Add("product_id", data.ItemID.ToString());
|
|
// 聚合SDK订单号
|
|
ta.Add("sdk_order_id", data.OrderId3rd.GetString());
|
|
// 游戏订单号
|
|
var orderID = data.OrderId.GetString();
|
|
ta.Add("game_order_id", orderID);
|
|
ta.Add("trade_order", data.OrderId3rd.GetString());
|
|
ta.Add("merchant_order", orderID);
|
|
GetDivGiftJson(ta, selfItems);
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void LogVoucherChargeInfo(PlayerOnGame player, ref DBPaySuccWaitAddRole data ,ref SSPayDBAddDiamondStatusRes res,List<TypeIDValueString> selfItems = null)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, "voucher_payment");
|
|
InitPublicProperties(player, ta);
|
|
|
|
ta.Add("pay_amount", data.Amount);
|
|
// 商品id
|
|
ta.Add("product_id", data.ItemID.ToString());
|
|
|
|
GetDivGiftJson(ta,selfItems);
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
|
|
private static void GetDivGiftJson(TALogHelper ta, List<TypeIDValueString> selfItems)
|
|
{
|
|
if (selfItems==null||selfItems.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
JsonData result = new JsonData();
|
|
for (int i = 0; i < selfItems.Count; i++)
|
|
{
|
|
var item = selfItems[i];
|
|
JsonData div = new JsonData();
|
|
div["type"] = item.Type;
|
|
div["id"] = item.Id.GetString();
|
|
div["value"] = item.Value;
|
|
result.Add(div);
|
|
}
|
|
|
|
ta.Add("diy_gift_info", result);
|
|
}
|
|
|
|
|
|
public static void LogResourceChange(PlayerOnGame player, string m_opReason, string subreason, ref CSPlayerGoodsChgNotify m_goods)
|
|
{
|
|
if (m_goods.ChgItems.Count <= 0) return;
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Resource_Change);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("reason", m_opReason);
|
|
if (!string.IsNullOrEmpty(subreason))
|
|
{
|
|
ta.Add("subreason", subreason);
|
|
}
|
|
|
|
JsonData costInfo = new JsonData();
|
|
for (int i = 0; i < m_goods.ChgItems.Count; i++)
|
|
{
|
|
JsonData item = new JsonData();
|
|
item["resource_id"] = m_goods.ChgItems[i].Id.GetString();
|
|
item["resource_type"] = m_goods.ChgItems[i].Type;
|
|
item["change_num"] = m_goods.ChgItems[i].ChgCount;
|
|
item["change_after"] = m_goods.ChgItems[i].Count;
|
|
if (m_goods.ChgItems[i].ChgCount > 0)
|
|
{
|
|
item["change_type"] = "get";
|
|
}
|
|
else
|
|
{
|
|
item["change_type"] = "cost";
|
|
}
|
|
costInfo.Add(item);
|
|
}
|
|
ta.Add("resource_info", costInfo);
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
public static void LogGemCompose(PlayerOnGame player, int operate, List<string> costs, string mainGem, string rewardGem = null, List<string> newGems = null)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.GEM_DEVELOP);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("gem_operate", operate);
|
|
ta.Add("cost_gem_list", costs);
|
|
ta.Add("mainGem", mainGem);
|
|
if (newGems != null)
|
|
{
|
|
ta.Add("reward_gem", newGems);
|
|
}
|
|
else
|
|
{
|
|
var list = new List<string>();
|
|
list.Add(rewardGem);
|
|
ta.Add("reward_gem", list);
|
|
}
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 玩家快照
|
|
/// </summary>
|
|
/// <param name="player"></param>
|
|
public static void LogPlayerSnap(PlayerOnGame player)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Player_Snap);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("gold_sum", player.GetGold());
|
|
ta.Add("diamond_sum", player.RoleBase.Diamond);
|
|
ta.Add("create_days_total", player.RoleData.OtherData.TotalLoginDays);
|
|
|
|
ta.Add("battle_info", PlayerUtils.GetBattleInfoJson(player));
|
|
|
|
ta.Add("mainline_chapter_id", player.RoleData.TaskEXData.MainlandChapter);
|
|
|
|
LogBattlePassInfo(player, out var battle_pass_info);
|
|
ta.Add("battle_pass_info", battle_pass_info);
|
|
|
|
ta.Add("avatar_id", player.GetIcon());
|
|
ta.Add("avatar_frame_id", player.GetIconFrame());
|
|
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
public static void LogCrystalSnap(PlayerOnGame player)
|
|
{
|
|
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID, TALogEventName.Crystal_Snap);
|
|
InitPublicProperties(player, ta);
|
|
|
|
List<int> mainHeorList = new List<int>();
|
|
int maxHeroLv = 0;
|
|
ta.Add("main_hero_list", mainHeorList);
|
|
ta.Add("max_hero_level", maxHeroLv);
|
|
ta.PutLog();
|
|
}
|
|
|
|
|
|
|
|
private static void InitItemLinkTreasureMap()
|
|
{
|
|
if (ItemLinkTreasureMap != null)
|
|
{
|
|
return;
|
|
}
|
|
ItemLinkTreasureMap = new Dictionary<int, int>();
|
|
|
|
TraceLog.Trace("GameTALogUtils.InitItemLinkTreasureMap");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 道具快照,每个道具一条
|
|
/// </summary>
|
|
/// <param name="player"></param>
|
|
public static void LogPropsRedundancy(PlayerOnGame player)
|
|
{
|
|
InitItemLinkTreasureMap();
|
|
}
|
|
|
|
|
|
|
|
public static void LogShopBuy(PlayerOnGame player, int productType, string productId, int productNum, ref JsonData costInfo, int shopType, int goodsIndex)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.Shop_Buy);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("shop_id", shopType);
|
|
ta.Add("goods_index", goodsIndex);
|
|
ta.Add("goods_type", productType);
|
|
ta.Add("goods_id", productId);
|
|
ta.Add("goods_num", productNum);
|
|
ta.Add("cost_info", costInfo);
|
|
ta.PutLog();
|
|
}
|
|
#endregion
|
|
|
|
public static void LogFinishTask(PlayerOnGame player, int taskType, int taskId)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.Finish_Task);
|
|
InitPublicProperties(player, ta);
|
|
|
|
ta.Add("task_type", taskType.ToString());
|
|
ta.Add("task_id", taskId.ToString());
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void LogSign(PlayerOnGame player, int id, int type, int day)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.Sign_Up);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("sign_id", id.ToString());
|
|
ta.Add("sign_type", type.ToString());
|
|
ta.Add("sign_days", day.ToString());
|
|
ta.PutLog();
|
|
}
|
|
public static void LogReportCheat(PlayerOnGame player, long touid)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.reported_player);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("reported_player", touid);
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void ChapterBattleEnd(PlayerOnGame player, int chapterId, int battleId, int isWin, int timeLong,int stageId,RepeatedIDValue64_512 cliProp)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.BattleEnd);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("chapter_id", chapterId);
|
|
ta.Add("pve_id", battleId);
|
|
ta.Add("is_win", isWin);
|
|
ta.Add("rounds_id", stageId);
|
|
ta.Add("fight_time", timeLong);
|
|
var addPoint = player.RoleData.Knight.DbHero.LevelData.AddPoint;
|
|
var peaks = new JsonData();
|
|
for (int i = 0; i < addPoint.Count; i++)
|
|
{
|
|
var peak = new JsonData();
|
|
peak["prop_id"] = addPoint[i].Id;
|
|
peak["prop_num"] = addPoint[i].Value;
|
|
peaks.Add(peak);
|
|
}
|
|
|
|
ta.Add("peak_prop", peaks);
|
|
ta.Add("peak_level", player.GetLevel());
|
|
var talentsJ = new JsonData();
|
|
var talents = player.RoleData.Talent.TalentPage;
|
|
for (int i = 0; i < talents.Items.Count; i++)
|
|
{
|
|
var talentsj = new JsonData();
|
|
talentsj["talent_id"] = talents.Items[i].Id;
|
|
talentsj["talent_level"] = talents.Items[i].Value;
|
|
talentsJ.Add(talentsj);
|
|
}
|
|
var peakDatas = player.RoleData.Talent.PeakData;
|
|
for (int i = 0; i < peakDatas.Items.Count; i++)
|
|
{
|
|
var talentsj = new JsonData();
|
|
talentsj["talent_id"] = peakDatas.Items[i].Id;
|
|
talentsj["talent_level"] = peakDatas.Items[i].Value;
|
|
talentsJ.Add(talentsj);
|
|
}
|
|
|
|
ta.Add("talent_info", talentsJ);
|
|
var wearEquipJ = new JsonData();
|
|
var wearEquip = player.RoleData.Knight.DbHero.WearEquip;
|
|
for (int i = 0; i < wearEquip.Count; i++)
|
|
{
|
|
var wearEquipj = new JsonData();
|
|
wearEquipj["equip_id"] = wearEquip[i].DescId;
|
|
wearEquipj["equip_score"] = wearEquip[i].Score;
|
|
wearEquipj["equip_level"] = wearEquip[i].Level;
|
|
wearEquipj["equip_quality"] = wearEquip[i].Quality;
|
|
wearEquipj["skin_id"] = 0;
|
|
wearEquipJ.Add(wearEquipj);
|
|
}
|
|
|
|
ta.Add("equip_info", wearEquipJ);
|
|
|
|
var propView = player.RoleData.Knight.PropView;
|
|
var propVal = propView.Knight.PropVal;
|
|
|
|
var ps = new JsonData();
|
|
for (int i = 0; i < propVal.Count; i++)
|
|
{
|
|
var p = new JsonData();
|
|
p["prop_id"] = propVal[i].Id;
|
|
p["prop_num"] = propVal[i].Value;
|
|
ps.Add(p);
|
|
}
|
|
|
|
ta.Add("player_prop", ps);
|
|
|
|
var psc = new JsonData();
|
|
for (int i = 0; i < cliProp.Count; i++)
|
|
{
|
|
var p = new JsonData();
|
|
p["prop_id"] = cliProp[i].Id;
|
|
p["prop_num"] = cliProp[i].Value;
|
|
ps.Add(p);
|
|
}
|
|
|
|
ta.Add("player_prop_client", psc);
|
|
|
|
var wi = new JsonData();
|
|
var w = player.RoleData.WingData.Wing;
|
|
wi["wing_id"] = w.DescId;
|
|
wi["wing_level"] = w.LevelId;
|
|
wi["wing_star"] = w.StarId;
|
|
wi["wing_rank"] = w.RankId;
|
|
ta.Add("wing_info", wi);
|
|
var sw = new JsonData();
|
|
sw["wing_id"] = w.SkinId;
|
|
sw["wing_refit"] = w.RefitId;
|
|
ta.Add("skin_wing", sw);
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void Wings(PlayerOnGame player, int option)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.BattleEnd);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("wing_operate", option);
|
|
var wing = player.RoleData.WingData.Wing;
|
|
|
|
ta.Add("wing_id", wing.DescId);
|
|
ta.Add("wing_level", wing.LevelId);
|
|
ta.Add("wing_rank", wing.RankId);
|
|
ta.Add("wing_star", wing.StarId);
|
|
ta.Add("wing_refit", wing.RefitId);
|
|
ta.PutLog();
|
|
}
|
|
|
|
public static void LogToClient(PlayerOnGame player, string type)
|
|
{
|
|
CSButryingPointSyn syn = new CSButryingPointSyn();
|
|
syn.Type.SetString(type);
|
|
player.SendToClient((int)CSGameMsgID.ButryingPointSyn, ref syn);
|
|
}
|
|
|
|
public static JsonData LogFormatAllProp(PlayerOnGame player)
|
|
{
|
|
JsonData result = new JsonData();
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
public static void LogContinueBattle(PlayerOnGame player, int begin_stage, int over_stage, int isWin, int timeLong, int get_score,
|
|
int boss_num,int kill_boss, ref RepeatedTypeIDValue32_128 rewards_info,
|
|
ref RepeatedIDValue64_512 cliProp)
|
|
{
|
|
var ta = new TALogHelper(TALOG_TYPE.TRACE, player.UserID.ToString(), player.taDistinctID,
|
|
TALogEventName.continue_battle);
|
|
InitPublicProperties(player, ta);
|
|
ta.Add("begin_stage", begin_stage);
|
|
ta.Add("over_stage", over_stage);
|
|
ta.Add("is_win", isWin);
|
|
ta.Add("get_score", get_score);
|
|
ta.Add("fight_time", timeLong);
|
|
ta.Add("boss_num", boss_num);
|
|
ta.Add("kill_boss", kill_boss);
|
|
var rewardArr = new JsonData();
|
|
for (int i = 0; i < rewards_info.Count; i++)
|
|
{
|
|
ref var reward = ref rewards_info[i];
|
|
var rewardJson = new JsonData();
|
|
rewardJson["reward_id"] = reward.Id;
|
|
rewardJson["reward_num"] = reward.Value;
|
|
rewardArr.Add(rewardJson);
|
|
}
|
|
ta.Add("rewards_info", rewardArr);
|
|
var addPoint = player.RoleData.Knight.DbHero.LevelData.AddPoint;
|
|
var peaks = new JsonData();
|
|
for (int i = 0; i < addPoint.Count; i++)
|
|
{
|
|
var peak = new JsonData();
|
|
peak["prop_id"] = addPoint[i].Id;
|
|
peak["prop_num"] = addPoint[i].Value;
|
|
peaks.Add(peak);
|
|
}
|
|
|
|
ta.Add("peak_prop", peaks);
|
|
ta.Add("peak_level", player.GetLevel());
|
|
var talentsJ = new JsonData();
|
|
var talents = player.RoleData.Talent.TalentPage;
|
|
for (int i = 0; i < talents.Items.Count; i++)
|
|
{
|
|
var talentsj = new JsonData();
|
|
talentsj["talent_id"] = talents.Items[i].Id;
|
|
talentsj["talent_level"] = talents.Items[i].Value;
|
|
talentsJ.Add(talentsj);
|
|
}
|
|
var peakDatas = player.RoleData.Talent.PeakData;
|
|
for (int i = 0; i < peakDatas.Items.Count; i++)
|
|
{
|
|
var talentsj = new JsonData();
|
|
talentsj["talent_id"] = peakDatas.Items[i].Id;
|
|
talentsj["talent_level"] = peakDatas.Items[i].Value;
|
|
talentsJ.Add(talentsj);
|
|
}
|
|
|
|
ta.Add("talent_info", talentsJ);
|
|
var wearEquipJ = new JsonData();
|
|
var wearEquip = player.RoleData.Knight.DbHero.WearEquip;
|
|
for (int i = 0; i < wearEquip.Count; i++)
|
|
{
|
|
var wearEquipj = new JsonData();
|
|
wearEquipj["equip_id"] = wearEquip[i].DescId;
|
|
wearEquipj["equip_score"] = wearEquip[i].Score;
|
|
wearEquipj["equip_level"] = wearEquip[i].Level;
|
|
wearEquipj["equip_quality"] = wearEquip[i].Quality;
|
|
wearEquipj["skin_id"] = 0;
|
|
wearEquipJ.Add(wearEquipj);
|
|
}
|
|
|
|
ta.Add("equip_info", wearEquipJ);
|
|
|
|
var propView = player.RoleData.Knight.PropView;
|
|
var propVal = propView.Knight.PropVal;
|
|
|
|
var ps = new JsonData();
|
|
for (int i = 0; i < propVal.Count; i++)
|
|
{
|
|
var p = new JsonData();
|
|
p["prop_id"] = propVal[i].Id;
|
|
p["prop_num"] = propVal[i].Value;
|
|
ps.Add(p);
|
|
}
|
|
|
|
ta.Add("player_prop", ps);
|
|
|
|
var psc = new JsonData();
|
|
for (int i = 0; i < cliProp.Count; i++)
|
|
{
|
|
var p = new JsonData();
|
|
p["prop_id"] = cliProp[i].Id;
|
|
p["prop_num"] = cliProp[i].Value;
|
|
ps.Add(p);
|
|
}
|
|
|
|
ta.Add("player_prop_client", psc);
|
|
|
|
var wi = new JsonData();
|
|
var w = player.RoleData.WingData.Wing;
|
|
wi["wing_id"] = w.DescId;
|
|
wi["wing_level"] = w.LevelId;
|
|
wi["wing_star"] = w.StarId;
|
|
wi["wing_rank"] = w.RankId;
|
|
ta.Add("wing_info", wi);
|
|
var sw = new JsonData();
|
|
sw["wing_id"] = w.SkinId;
|
|
sw["wing_refit"] = w.RefitId;
|
|
ta.Add("skin_wing", sw);
|
|
ta.PutLog();
|
|
}
|
|
}
|
|
}
|