public static void UpdateSuffocation(Player __instance) { cfg = Config.GetConfig(); saveData = SaveData.GetSaveData(); StatObject stat = new StatObject() { Name = "Suffocation Time", Level = saveData.SuffocateResistLevel, MaxLevel = cfg.MaxSuffocateResistLevel, XP = saveData.SuffocateResist_XP, XPToNextLevel = saveData.SuffocateResist_XPToNextLevel, Modifier = cfg.SuffocateResist_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __instance.suffocationTime = 8 + saveData.SuffocateResistLevel; return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); Notify_LevelUp(stat, gainedLevels, stat.Level); saveData.SuffocateResistLevel = stat.Level; saveData.SuffocateResist_XP = stat.XP; saveData.SuffocateResist_XPToNextLevel = stat.XPToNextLevel; __instance.suffocationTime = 8 + saveData.SuffocateResistLevel; }
private void UpdateWalkSpeed() { var __instance = Player.main.playerController; StatObject stat = new StatObject() { Name = "Walk Speed", Level = saveData.WalkSpeedLevel, MaxLevel = cfg.MaxWalkSpeedLevel, XP = saveData.WalkSpeed_XP, XPToNextLevel = saveData.WalkSpeed_XPToNextLevel, Modifier = cfg.Walk_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { UpdatePlayerController(__instance.groundController, saveData.WalkSpeedLevel); return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); StatMgr.NotifyLevelUp(stat, gainedLevels); saveData.WalkSpeedLevel = stat.Level; saveData.WalkSpeed_XP = stat.XP; saveData.WalkSpeed_XPToNextLevel = stat.XPToNextLevel; UpdatePlayerController(__instance.groundController, saveData.WalkSpeedLevel); }
public static float UpdateBreathPeriod(Player __instance, ref float __result) { saveData = SaveData.GetSaveData(); cfg = Config.GetConfig(); StatObject stat = new StatObject() { Name = "Breath Period", Level = saveData.BreathPeriodLevel, MaxLevel = cfg.MaxBreathPeriodLevel, XP = saveData.BreathPeriod_XP, XPToNextLevel = saveData.BreathPeriod_XPToNextLevel, Modifier = cfg.BreathPeriod_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __result += CalcBreathPeriodPercent(saveData.BreathPeriodLevel); return(__result); } int gainedLevels = StatMgr.DoWhileLevelUp(stat); Air.NotifyLevelUp(stat); saveData.BreathPeriodLevel = stat.Level; saveData.BreathPeriod_XP = stat.XP; saveData.BreathPeriod_XPToNextLevel = stat.XPToNextLevel; __result += CalcBreathPeriodPercent(saveData.BreathPeriodLevel); return(__result); }
//float defaultMaxHealth = 100f; public static void UpdateHealth(Player __instance) { saveData = SaveData.GetSaveData(); cfg = Config.GetConfig(); StatObject stat = new StatObject() { Name = "Max Health", Level = saveData.HealthLevel, MaxLevel = cfg.MaxHealthLevel, XP = saveData.Health_XP, XPToNextLevel = saveData.Health_XPToNextLevel, Modifier = cfg.Health_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __instance.liveMixin.data.maxHealth = 100 + saveData.HealthLevel; return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); StatMgr.NotifyLevelUp(stat, gainedLevels); saveData.HealthLevel = stat.Level; saveData.Health_XP = stat.XP; saveData.Health_XPToNextLevel = stat.XPToNextLevel; __instance.liveMixin.data.maxHealth = 100 + saveData.HealthLevel; }
// 开始统计充值记录 protected void onStatRecharge(object sender, EventArgs e) { GMUser user = (GMUser)Session["user"]; ParamQueryRecharge param = genParamQueryRecharge(); StatMgr mgr = user.getSys <StatMgr>(SysType.sysTypeStat); OpRes res = mgr.doStat(param, StatType.statTypeRecharge, user); genStatTable(m_result, res, mgr, user); }
private void genTable(Table table, OpRes res, GMUser user, StatMgr mgr, StatType sType) { m_result.GridLines = GridLines.Both; TableRow tr = new TableRow(); m_result.Rows.Add(tr); TableCell td = null; if (res != OpRes.opres_success) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } List <ResultActive> qresult = (List <ResultActive>)mgr.getStatResult(sType); int i = 0, j = 0; // 表头 for (i = 0; i < s_head.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head[i]; } for (i = 0; i < qresult.Count; i++) { tr = new TableRow(); if ((i & 1) == 0) { tr.CssClass = "alt"; } m_result.Rows.Add(tr); m_content[0] = qresult[i].m_time; m_content[1] = qresult[i].m_game1.ToString(); m_content[2] = qresult[i].m_game2.ToString(); m_content[3] = qresult[i].m_game3.ToString(); m_content[4] = qresult[i].m_game4.ToString(); m_content[5] = qresult[i].m_game5.ToString(); m_content[6] = qresult[i].m_game6.ToString(); m_content[7] = qresult[i].m_game7.ToString(); //m_content[8] = qresult[i].m_game8.ToString(); for (j = 0; j < s_head.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } } }
public bool CheckShootPoint(int x, int y) { if (Math.Abs(X - x) > 100) { string username = m_player.PlayerCharacter.UserName; string nickname = m_player.PlayerCharacter.NickName; StatMgr.LogErrorPlayer(Id, username, nickname, ItemRemoveType.FireError, string.Format("error shoot pos: {0} -> {1} mapId:{2}", X, x, m_game.Map.Info.ID)); m_player.Client.Disconnect(); return(false); } return(true); }
private void genVipLevelTable(Table table, GMUser user, StatMgr mgr, OpRes res) { TableRow tr = new TableRow(); table.Rows.Add(tr); TableCell td = null; if (res != OpRes.opres_success) { td = new TableCell(); td.Text = OpResMgr.getInstance().getResultString(res); tr.Cells.Add(td); return; } StatResultVipLevel qresult = (StatResultVipLevel)mgr.getStatResult(StatType.statTypeVipLevel); int i = 0, j = 0; // 表头 for (i = 0; i < s_head.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head[i]; } i = 0; foreach (var d in qresult.m_vipLevel) { tr = new TableRow(); if ((i & 1) == 0) { tr.CssClass = "alt"; } m_result.Rows.Add(tr); m_content[0] = "VIP" + d.Key.ToString(); m_content[1] = d.Value.ToString(); for (j = 0; j < s_head.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } i++; } }
private static float nextHealth;// = 0f; internal void UpdateHealth(Player __instance) { if (__instance.liveMixin.IsFullHealth()) { return; } if (Time.time > nextHealth) { nextHealth = Time.time + 0.5f;//1f; saveData.Health_XP += StatMgr.AddXP(__instance.liveMixin.health, __instance.liveMixin.maxHealth); } Health.UpdateHealth(__instance); }
// set pause menu obj ref, make inactive at start private void Start() { exit = GameObject.FindGameObjectWithTag("BtnExit").GetComponent <Button>(); boatSelect = GameObject.FindGameObjectWithTag("BtnSelectBoat").GetComponent <Dropdown>(); pauseMenu = GameObject.FindGameObjectWithTag("PauseMenu"); pauseMenu.SetActive(false); gameOverScreen = GameObject.FindGameObjectWithTag("GameOver"); gameOverScreen.SetActive(false); riverMgr = GameObject.FindGameObjectWithTag("GameMgr").GetComponent <RiverMgr>(); statMgr = GameObject.FindGameObjectWithTag("GameMgr").GetComponent <StatMgr>(); boatMgr = GameObject.FindGameObjectWithTag("GameMgr").GetComponent <PlayerBoatMgr>(); }
protected void onStat(object sender, EventArgs e) { GMUser user = (GMUser)Session["user"]; StatMgr mgr = user.getSys <StatMgr>(SysType.sysTypeStat); if (m_statWay.SelectedIndex == 0) { OpRes res = mgr.doStat(m_time.Text, StatType.statTypeActiveCount, user); genTable(m_result, res, user, mgr, StatType.statTypeActiveCount); } else { OpRes res = mgr.doStat(m_time.Text, StatType.statTypeActivePerson, user); genTable(m_result, res, user, mgr, StatType.statTypeActivePerson); } }
public static void NotifyLevelUp(StatObject stat) { Random random = new Random(); Air a = new Air(); StatMgr mgr = new StatMgr(); int responseNum = random.Next(0, a.singleLevelNotifs.Count - 1); Logger.Log(String.Format(a.singleLevelNotifs[responseNum], stat.Name, CalcBreathPeriodPercent(stat.Level) + 3)); if (stat.Level >= stat.MaxLevel) { int maxRandom = random.Next(0, mgr.maxLevelNotifs.Count - 1); Logger.Log(String.Format(mgr.maxLevelNotifs[maxRandom], stat.Name) + ". Each breath now lasts " + (CalcBreathPeriodPercent(stat.Level) + 3) + " seconds"); } }
protected void onStat(object sender, EventArgs e) { GMUser user = (GMUser)Session["user"]; if (m_statWay.SelectedIndex == 0) { StatMgr mgr = user.getSys <StatMgr>(SysType.sysTypeStat); mgr.doStat(null, StatType.statTypeVipLevel, user); genVipLevelTable(m_result, user, mgr); } else { QueryMgr mgr = user.getSys <QueryMgr>(SysType.sysTypeQuery); mgr.doQuery(m_statWay.SelectedIndex, QueryType.queryTypeLobby, user); genGeneralTable(m_result, user, mgr); } }
public static void Notify_LevelUp(StatObject stat, int gainedLevels, float currentResistance) { System.Random random = new System.Random(); Suffocation s = new Suffocation(); StatMgr mgr = new StatMgr(); int responseNum = random.Next(0, s.Notifs.Count - 1); Logger.Log(String.Format(s.Notifs[responseNum], stat.Name, 8 + stat.Level)); if (stat.Level >= stat.MaxLevel) { int maxRandom = random.Next(0, mgr.maxLevelNotifs.Count - 1); Logger.Log(String.Format(mgr.maxLevelNotifs[maxRandom], stat.Name)); } }
private void genSameOrderTable(Table table, OpRes res, StatMgr mgr, GMUser user) { m_page.InnerHtml = ""; m_foot.InnerHtml = ""; m_result.GridLines = GridLines.Both; TableRow tr = new TableRow(); m_result.Rows.Add(tr); TableCell td = null; if (res != OpRes.opres_success) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } int i = 0, j = 0; for (i = 0; i < s_head2.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head2[i]; } List <ResultSameOrderIdItem> result = (List <ResultSameOrderIdItem>)mgr.getStatResult(StatType.statTypeSameOrderId); for (i = 0; i < result.Count; i++) { tr = new TableRow(); m_result.Rows.Add(tr); m_content[0] = result[i].m_orderId; m_content[1] = result[i].m_count.ToString(); for (j = 0; j < s_head2.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } } }
// 生成统计表 private void genStatTable(Table table, OpRes res, StatMgr mgr, GMUser user) { m_page.InnerHtml = ""; m_foot.InnerHtml = ""; m_result.GridLines = GridLines.Both; TableRow tr = new TableRow(); m_result.Rows.Add(tr); TableCell td = null; if (res != OpRes.opres_success) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } int i = 0, j = 0; for (i = 0; i < s_head1.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head1[i]; } for (i = 0; i < 1; i++) { tr = new TableRow(); m_result.Rows.Add(tr); ResultStatRecharge rs = (ResultStatRecharge)mgr.getStatResult(StatType.statTypeRecharge); m_content[0] = rs.m_rechargeCount.ToString(); m_content[1] = rs.m_rechargePersonNum.ToString(); m_content[2] = rs.m_total.ToString(); for (j = 0; j < s_head1.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } } }
public override OpRes doExport(object param, GMUser user) { m_cond.startExport(); StatMgr mgr = user.getSys <StatMgr>(SysType.sysTypeStat); OpRes res = mgr.makeQuery(param, StatType.statTypeRechargePlayer, user, m_cond); if (res != OpRes.opres_success) { return(res); } ExportParam ep = new ExportParam(); ep.m_account = user.m_user; ep.m_dbServerIP = user.m_dbIP; ep.m_tableName = TableName.PUMP_RECHARGE_PLAYER; ep.m_condition = m_cond.getCond(); return(RemoteMgr.getInstance().reqExportExcel(ep)); }
public override void SetXY(int x, int y) { if (m_x == x && m_y == y) { return; } m_x = x; m_y = y; if (IsLiving) { m_energy -= Math.Abs(m_x - x); if (m_energy < -20) { StatMgr.LogErrorPlayer(m_player.PlayerCharacter.ID, m_player.PlayerCharacter.UserName, m_player.PlayerCharacter.NickName, ItemRemoveType.MoveError, m_x.ToString() + " to " + x.ToString() + ",MapID:" + m_map.Info.ID); GameServer.log.Error("move is error,player state: move energy:" + m_energy); } } else { Rectangle rect = m_rect; rect.Offset(m_x, m_y); Physics[] phys = m_map.FindPhysicalObjects(rect, this); foreach (Physics p in phys) { if (p is Box) { Box b = p as Box; PickBox(b, true); //立刻开箱子给客户端 OpenBox(b.Id); } } } }
public override void SetXY(int x, int y) { if (state != TankGameState.DEAD) { _energy -= Math.Abs(_x - x); } //else //{ // _energy -= (int)Math.Sqrt(((_x - x) * (_x - x) + (_y - y) * (_y - y))); //} if (_energy < -20) { StatMgr.LogErrorPlayer(_player.PlayerCharacter.ID, _player.PlayerCharacter.UserName, _player.PlayerCharacter.NickName, ItemRemoveType.MoveError, _x.ToString() + " to " + x.ToString() + ",MapID:" + _player.CurrentGame.Data.MapIndex); GameServer.log.Error("move is error,player state:" + state.ToString() + " move energy:" + _energy); _player.Client.Disconnect(); } _x = x; _y = y; //StartMoving(); }
public OpRes doStat(object param, StatType statName) { StatMgr mgr = getSys <StatMgr>(SysType.sysTypeStat); return(mgr.doStat(param, statName, this)); }
public void HandleCommand(BaseGame game, global::Phy.Object.Player player, GSPacketIn packet) { if (game.GameState != eGameState.Playing) { return; } if (player.IsAttacking || (player.IsLiving == false && player.Team == game.CurrentPlayer.Team)) { int type = packet.ReadByte(); int place = packet.ReadInt(); int templateID = packet.ReadInt(); ItemTemplateInfo template = PropItemMgr.FindPropBag(templateID); if (template == null) { return; } //背包中的道具 if (type == 1) { if (player.IsLiving == false) { return; } if (place == -1 && player.PlayerDetail.BuffInventory.PropBag()) { //无限道具buffer player.UseItem(template); } else { ItemInfo item = player.PlayerDetail.PropBag.GetItemAt(place); if (item != null && item.IsValidItem() && item.Count >= 0) { if (player.UseItem(PropItemMgr.FindPropBag(templateID))) { if (item.TemplateID == 10200) { player.PlayerDetail.PropBag.UseItem(item); player.PlayerDetail.PropBag.RefreshItem(item); } else { item.Count--; if (item.Count <= 0) { player.PlayerDetail.RemoveAllItem(item, false, ItemRemoveType.Use, 1); } else { StatMgr.LogItemRemove(item.TemplateID, ItemRemoveType.Use, 1); player.PlayerDetail.PropBag.RefreshItem(item); } game.AfterUseItem(item); } } } } } //道具栏的道具 else { ItemInfo item = player.PlayerDetail.PropInventory.GetItemAt(place); if (item != null && player.UseItem(item.Template)) { player.PlayerDetail.PropInventory.RemoveItemAt(place); } } } }
private void genTable(Table table, OpRes res, GMUser user, StatMgr mgr, StatType sType) { m_result.GridLines = GridLines.Both; TableRow tr = new TableRow(); m_result.Rows.Add(tr); TableCell td = null; if (res != OpRes.opres_success) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } List <ResultActive> qresult = (List <ResultActive>)mgr.getStatResult(sType); int i = 0, j = 0; // 表头 for (i = 0; i < StrName.s_gameName.Length; i++) { td = new TableCell(); tr.Cells.Add(td); if (i == 0) { td.Text = "日期"; } else { td.Text = StrName.s_gameName[i]; } } int f = 0; for (i = 0; i < qresult.Count; i++) { f = 0; tr = new TableRow(); if ((i & 1) == 0) { tr.CssClass = "alt"; } m_result.Rows.Add(tr); m_content[f++] = qresult[i].m_time; for (int k = 1; k < StrName.s_gameName.Length; k++) { m_content[f++] = qresult[i].getCount(k).ToString(); } for (j = 0; j < StrName.s_gameName.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } } }
public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet) { if (player.CurrentGame.Data.CurrentIndex == player && player.CurrentGame.Data.Players[player].State != TankGameState.DEAD) { if (player.CurrentGame.Data.CurrentFire == null) { player.CurrentGame.Data.CurrentFire = player; } int x = packet.ReadInt(); int y = packet.ReadInt(); if (Math.Abs(player.CurrentGame.Data.Players[player].X - x) > 100) { //player.Out.SendMessage(eMessageType.ALERT, LanguageMgr.GetTranslation("Game.Server.SceneGames.TankHandle")); StatMgr.LogErrorPlayer(player.PlayerCharacter.ID, player.PlayerCharacter.UserName, player.PlayerCharacter.NickName, ItemRemoveType.FireError, player.CurrentGame.Data.Players[player].X.ToString() + " to " + x.ToString() + ",MapID:" + player.CurrentGame.Data.MapIndex); player.Client.Disconnect(); return(false);; } int force = packet.ReadInt(); int angle = packet.ReadInt(); TankData data = player.CurrentGame.Data; Tile shape = Managers.BallMgr.FindTile(data.CurrentBall.ID); GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.PlayerCharacter.ID); pkg.WriteByte((byte)TankCmdType.FIRE); pkg.WriteInt(data.AddBall); for (int i = 0; i < data.AddBall; i++) { if (player.CurrentGame.Data.ReduceFireBombs) { if (data.IsFastSpeed()) { StatMgr.LogErrorPlayer(player.PlayerCharacter.ID, player.PlayerCharacter.UserName, player.PlayerCharacter.NickName, ItemRemoveType.FastError, "MapID:" + player.CurrentGame.Data.MapIndex); player.Client.Disconnect(); return(false);; } data.FireLogin = true; double reforce = 1; int reangle = 0; if (i == 1) { reforce = 0.9; reangle = -5; } else if (i == 2) { reforce = 1.1; reangle = 5; } int vx = (int)(force * reforce * Math.Cos((double)(angle + reangle) / 180 * Math.PI)); int vy = (int)(force * reforce * Math.Sin((double)(angle + reangle) / 180 * Math.PI)); data.PhyID++; BombObject bomb = new BombObject(data.PhyID, BallMgr.GetBallType(data.CurrentBall.ID), data.Players[player], shape, data.CurrentBall.Radii, data.AddMultiple < 1, data.CurrentBall.Mass, data.CurrentBall.Weight, data.CurrentBall.Wind, data.CurrentBall.DragIndex, data.BallPower); bomb.SetXY(x, y); bomb.setSpeedXY(vx, vy); data.CurrentMap.AddPhysical(bomb); pkg.WriteBoolean(bomb.IsHole); pkg.WriteInt(bomb.Id); pkg.WriteInt(x); pkg.WriteInt(y); pkg.WriteInt(vx); pkg.WriteInt(vy); pkg.WriteInt(bomb.Actions.Count); foreach (BombAction action in bomb.Actions) { pkg.WriteInt(action.TimeInt); pkg.WriteInt(action.Type); pkg.WriteInt(action.Param1); pkg.WriteInt(action.Param2); pkg.WriteInt(action.Param3); pkg.WriteInt(action.Param4); } data.SetRunTime((int)bomb.RunTime); } } player.CurrentGame.SendToAll(pkg); data.FireLogin = false; if (data.Bombs || data.Players[player].State == TankGameState.DEAD) { data.TotalDelay += data.CurrentBall.Delay; process.SendArk(player.CurrentGame, player); player.PropInventory.AddItemTemplate(PropItemMgr.GetRandomFightProp(data.MapIndex)); data.Players[player].SetDander(20); process.SendPlayFinish(player.CurrentGame, player); //GSPacketIn pkgMsg = new GSPacketIn((byte)ePackageType.GAME_CMD); //pkgMsg.WriteByte((byte)TankCmdType.PLAYFINISH); //pkgMsg.WriteInt(player.CurrentGame.Data.TurnNum); //player.CurrentGame.SendToAll(pkgMsg); } return(true); } return(false); }
public object getStatResult(StatType statName) { StatMgr mgr = getSys <StatMgr>(SysType.sysTypeStat); return(mgr.getStatResult(statName)); }