public EssentialPlayer(MiNetServer server, IPEndPoint endPoint) : base(server, endPoint) { Server = server; EndPoint = endPoint; Inventory = new PlayerInventory(this); HungerManager = new HungerManager(this); ExperienceManager = new ExperienceManager(this); ItemStackInventoryManager = new ItemStackInventoryManager(this); IsSpawned = false; IsConnected = endPoint != null; // Can't connect if there is no endpoint Width = 0.6f; Length = Width; Height = 1.80; HideNameTag = false; IsAlwaysShowName = true; CanClimb = true; HasCollision = true; IsAffectedByGravity = true; NoAi = false; EServer = (EssentialServer)server.ServerManager.GetServer(); }
public void AddProductToViewHistory(string ProductID) { var historyCookie = ExperienceManager.GetHistoryCookie(); if (!Convert.ToBoolean(historyCookie.Values[Utils.HISTORY_COOKIE_ENABLED])) { return; } string products = historyCookie.Values[Utils.HISTORY_COOKIE_DATA]; if (string.IsNullOrWhiteSpace(products)) { products = ProductID; } else { // Add a product to the top of the string if (products.IndexOf(ProductID) == -1) { products = ProductID + "|" + products; } // make sure history contains only the last 5 products string[] history = products.Split('|'); if (history.Length > 5) { Array.Resize(ref history, 5); products = String.Join("|", history); } } historyCookie.Values[Utils.HISTORY_COOKIE_DATA] = products; HttpContext.Current.Response.Cookies.Add(historyCookie); }
void VerifySharedExperienceDistribution() { string[] names = new string[] { "Russell", "Brian", "Josh", "Ian", "Adam", "Andy" }; Party heroes = new Party(); for (int i = 0; i < names.Length; ++i) { GameObject actor = new GameObject(names[i]); actor.AddComponent <Stats>(); Rank rank = actor.AddComponent <Rank>(); //rank.Init(i); rank.Init((int)UnityEngine.Random.Range(1, 5)); heroes.Add(actor); } Debug.Log("===== Before Adding Experience ======"); LogParty(heroes); Debug.Log("====================================="); ExperienceManager.AwardExperience(1000, heroes); Debug.Log("===== After Adding Experience ======"); LogParty(heroes); }
public void ChangeHistorySettings(bool HistoryOn) { var historyCookie = ExperienceManager.GetHistoryCookie(); historyCookie.Values[Utils.HISTORY_COOKIE_ENABLED] = HistoryOn.ToString(); HttpContext.Current.Response.Cookies.Add(historyCookie); }
public void SetBattleManager(BattleManager battleManager, ExperienceManager experienceManager) { this.battleManager = battleManager; this.experienceManager = experienceManager; battleManager.RedFighterTurnStartDelegateEvent += VanishSpell; battleManager.Draw += VanishSpell; battleManager.RedFighterWon += VanishSpell; battleManager.BlueFighterWon += VanishSpell; }
internal void LoadGame(SaveGame save) { MenuState = 1; GameTime = save.GameTime; _map = save.Map; _resourcesManager = save.ResourcesManager; _resourcesManager.Map = _map; _experienceManager = save.ExperienceManager; _name = save.Name; _drawUI = new DrawUI(this, _map, 100, 100, _resolution, GameTime, _resourcesManager, _experienceManager); }
void Awake() { if (instance) { Object.Destroy(gameObject); } else { instance = this; Object.DontDestroyOnLoad(gameObject); } }
public CommandsHandler(UsersManager usersManager, BotDataManager botDataManager, ExperienceManager experienceManager, PointsManager pointsManager) { _logger = Logging.GetLogger <CommandsHandler>(); _followersManager = new FollowersManager(); _usersManager = usersManager; _botDataManager = botDataManager; _experienceManager = experienceManager; _pointsManager = pointsManager; InitializeCommands(); }
public void UpdateData(Map map, ResourcesManager resources, ExperienceManager experience) { Map = map; MapUI.MapContext = map; UI.Map = map; _resourcesCtx = resources; UI.ResourcesManager = resources; UI.ExperienceManager = experience; UI.UpdateBuildingTabs(); MapUI.ResourcesManager = resources; }
public static bool InitializeEngine() { NetworkSocket.Initialize(); try { background = new EngineObject($"{Common.Configuration.GamePath}/Data/background.png", 1024, 768); background.Size = new Size2(1024, 768); background.SourceRect = new Rectangle(0, 0, 1024, 720); DataManager.Initialize(); WindowTalent.Initialize(); WindowSkill.Initialize(); WindowPin.Initialize(); WindowCash.Initialize(); WindowMail.Initialize(); WindowSelectedItem.Initialize(); WindowViewTalent.Initialize(); //Carrega os dados de classe. ClasseManager.Initialize(); //Carrega os dados de npc. NpcManager.OpenData(); //Carrega os dados de experiencia ExperienceManager.Read(); EngineFont.Initialize(); EngineMessageBox.Initialize(); EngineInputBox.Initialize(); EngineMultimedia.Initialize(); WindowLogin.Initialize(); WindowServer.Initialize(); WindowCharacter.Initialize(); WindowNewCharacter.Initialize(); WindowGame.Initialize(); WindowViewItem.Initialize(); // EngineMultimedia.PlayMusic(0, true); GameState = 1; return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
private void Start() { for (int i = 0; i < JobsLevel.Length; i++) { JobsLevel[i] = 1; } for (int i = 0; i < jobsExpToNextLevel.Length; i++) { jobsExpToNextLevel[i] = ExperienceManager.GetExpToNextLevel(1); } }
public static long GetRemainingExp(this User u) { var nextLvlExp = ExperienceManager.CalculateExpForLevel(u.Level + 1); var exp = nextLvlExp - u.ExpCnt; if (exp < 1) { exp = 1; } return(nextLvlExp - u.ExpCnt); }
public static long GetPVPCoinsFromDuel(this GameDeck deck, FightResult res) { var step = (ExperienceManager.CalculateLevel(deck.SeasonalPVPRank, PVPRankMultiplier) / 10); if (step > 5) { step = 5; } var coinCnt = 40 + (20 * step); return((res == FightResult.Win) ? coinCnt : coinCnt / 2); }
/// <summary> /// Begin the combat action(s). /// </summary> public void Begin() { ExperienceManager manager = new ExperienceManager(); _awardedExperience = 0; // iterate over all defenders foreach (var defender in _defenders) { // Give out XP _awardedExperience += manager.AwardCombatExperience(_attacker, defender); } }
internal void StartNewGame() { if (_newGame.Name != "" && _newGame.Name != null) { _name = _newGame.Name; _newGame.Name = ""; MenuState = 1; _map = new Map(100, 100); _resourcesManager = new ResourcesManager(_map); _experienceManager = new ExperienceManager(_resourcesManager); _drawUI = new DrawUI(this, _map, 100, 100, _resolution, GameTime, _resourcesManager, _experienceManager); } }
public List <ProductDisplay> GetProductHistory() { WebOperationContext.Current.OutgoingResponse.Headers.Add("Cache-Control", "no-cache"); var historyCookie = ExperienceManager.GetHistoryCookie(); string products = historyCookie.Values[Utils.HISTORY_COOKIE_DATA]; if (string.IsNullOrWhiteSpace(products)) { return(new List <ProductDisplay>()); } else { return(Products.GetProductViewHistory(products.Trim())); } }
public static string GetRankName(this GameDeck deck, long?rank = null) { switch ((ExperienceManager.CalculateLevel(rank ?? deck.SeasonalPVPRank, PVPRankMultiplier) / 10)) { case var n when(n >= 17): return("Konsul"); case 16: return("Praetor"); case 15: return("Legatus"); case 14: return("Preafectus classis"); case 13: return("Praefectus praetoria"); case 12: return("Tribunus laticavius"); case 11: return("Prefectus"); case 10: return("Tribunus angusticlavius"); case 9: return("Praefectus castorium"); case 8: return("Primus pilus"); case 7: return("Primi ordines"); case 6: return("Centurio"); case 5: return("Decurio"); case 4: return("Tesserarius"); case 3: return("Optio"); case 2: return("Aquilifier"); case 1: return("Signifer"); default: return("Miles gregarius"); } }
public static void CombatReward(CombatLog log) { int exp = 0; using (var db = new MinionWarsEntities()) { exp = Convert.ToInt32(db.ModifierCoeficients.Find(24).value); } if (log.winner.owner_id != null) { ExperienceManager.IncreaseExperience(log.winner.owner_id.Value, exp); Random r = new Random(); using (var db = new MinionWarsEntities()) { List <BattlegroupAssignment> ba = db.BattlegroupAssignment.Where(x => x.battlegroup_id == log.loser.id).ToList(); int target = r.Next(0, ba.Count); AwardMinions(log.winner.owner_id.Value, ba[target].minion_id, 5); } } }
public bool createNewExercise(string exerciseName, string muscleGroups, string equipment, string videoLink, bool rep, bool weight, bool distance, bool time, bool enabled, string desc) { bool rc = false; using (var context = new Layer2Container()) { Exercise newExercise = new Exercise(); ExperienceManager expMngr = new ExperienceManager(); try { if ((context.Exercises.FirstOrDefault(exercise => exercise.name == exerciseName).name == exerciseName)) rc = false; } catch (NullReferenceException e) { newExercise.name = exerciseName; newExercise.muscleGroups = muscleGroups; newExercise.equipment = equipment; newExercise.videoLink = videoLink; newExercise.rep = rep; newExercise.weight = weight; newExercise.distance = distance; newExercise.time = time; newExercise.enabled = enabled; newExercise.description = desc; context.Exercises.AddObject(newExercise); context.SaveChanges(); expMngr.createNewExerciseExp(exerciseName, 100, weight ? 1 : 0, rep ? 1 : 0, distance ? 1 : 0, time ? 1 : 0); rc = true; } return rc; } }
public LoggedExerciseManager() { _context = System.Web.HttpContext.Current.ApplicationInstance; expMngr = new ExperienceManager(); }
protected void btnLog_Click(object sender, EventArgs e) { if (checkZeroes()) { exerciseID = Session["exerciseID"] != null ? (int)Session["exerciseID"] : -1; //pnlExerciseDetails.Visible = false; string note = tbNotes.Text.Trim(); int weight = Convert.ToInt32(tbWeight.Text.ToString()); float distance = (float)Convert.ToDouble(tbDistance.Text.ToString()); // convert the 2 text boxes to seconds int time = Convert.ToInt32(tbTime_min.Text.ToString()) * 60 + Convert.ToInt32(tbTime_sec.Text.ToString()); int rep = Convert.ToInt32(tbRep.Text.ToString()); ExperienceManager expMngr = new ExperienceManager(); int exp = logManager.logExerciseIntoRoutine(userID, exerciseID, routineID, rep, time, weight, distance, note); ExerciseGoal eg = goalMngr.getUnachievedGoalByExerciseNameAndUserID(sysManager.getExerciseInfo(exerciseID).name, userID); if (eg != null) { if (goalMngr.achieveGoal(eg, rep, time, weight, distance)) { goalAchievedLbl.Text = "Congratulations! You have achieved your goal for this exercise. You can view your goals "; goalsLink.Visible = true; } else { goalAchievedLbl.Text = ""; goalsLink.Visible = false; } } bool leveled = expMngr.rewardExperienceToUser(userID, exp); expRewardLbl.Text = "<br />You received " + exp.ToString() + " experience"; if (leveled) expRewardLbl.Text += "<br />Congratulations, you have leveled up!"; init(); pnlInfo.Visible = true; } }
protected void recordSet_Click(object sender, EventArgs e) { int timeValue, weightValue, repValue; double distanceValue; if (timeOn) { timeValue = createTime(Convert.ToInt32(timeMinutes.Text.Trim()), Convert.ToInt32(timeSeconds.Text.Trim())); } else { timeValue = 0; } if (weightOn) { weightValue = Convert.ToInt32(weight.Text.Trim()); } else { weightValue = 0; } if (repOn) { repValue = Convert.ToInt32(rep.Text.Trim()); } else { repValue = 0; } if (distanceOn) { distanceValue = Convert.ToDouble(distance.Text.Trim()); } else { distanceValue = 0; } //Begin log operations and exp extraction ExperienceManager expMngr = new ExperienceManager(); int exp = logManager.logExercise(user.id, selectedExercise.id, repValue, timeValue, weightValue, distanceValue); ExerciseGoal eg = goalMngr.getUnachievedGoalByExerciseNameAndUserID(selectedExercise.name, user.id); if (eg != null) { if (goalMngr.achieveGoal(eg, repValue, timeValue, weightValue, distanceValue)) { goalAchievedLbl.Text = "Congratulations! You have achieved your goal for this exercise. You can view your goals "; goalsLink.Visible = true; } } if (exp != 0) { bool leveled = expMngr.rewardExperienceToUser(user.id, exp); successLbl.Visible = true; expRewardLbl.Visible = true; expRewardLbl.Text = "You received " + exp.ToString() + " experience for logging a set for " + ucViewExercise.ddlValue; if (leveled) expRewardLbl.Text += "<br />Congratulations, you have leveled up!"; displayLogs(); //Manually set the selected index to 0 (the most recently logged exercise) and set the logID to the selected one to display the most recent log (this one) loggedExercises.SelectedIndex = 0; logID = Convert.ToInt64(loggedExercises.SelectedValue); loggedExercises_SelectedIndexChanged(sender, e); } else { successLbl.Visible = true; successLbl.Text = "Something went wrong!"; successLbl.ForeColor = Color.Red; } }
protected void Page_Load(object sender, EventArgs e) { lbMngr = new LeaderboardManager(); expMngr = new ExperienceManager(); List<LeaderBoardItem> userItemSet = lbMngr.getLeaderBoardValues(1, false); if (!Page.IsPostBack) { GridView1.Columns[2].Visible = true; GridView1.Columns[3].Visible = true; GridView1.Columns[4].Visible = false; GridView1.Columns[5].Visible = false; GridView1.DataSource = userItemSet; GridView1.DataBind(); } HtmlGenericControl li = (HtmlGenericControl)this.Page.Master.FindControl("Ulnav").FindControl("liLeaderboards"); li.Attributes.Add("class", "active"); userName = User.Identity.Name; if (Request.IsAuthenticated) { userRankMultiView.ActiveViewIndex = 1; //user's rank gridview databinding LeaderBoardItem userItem = lbMngr.getUserValues(userName); List<LeaderBoardItem> userItemList = new List<LeaderBoardItem>(); userItemList.Add(userItem); GridView2.DataSource = userItemList; GridView2.DataBind(); GridView2.Columns[2].Visible = true; GridView2.Columns[3].Visible = true; GridView2.Columns[4].Visible = false; GridView2.Columns[5].Visible = false; for (int i = 0; i < GridView1.Rows.Count; i++) { if (GridView1.Rows[i].Cells[1].Text.ToLower() == userName.ToLower()) { GridView1.Rows[i].BorderWidth = 1; GridView1.Rows[i].BorderColor = System.Drawing.Color.Green; } } foreach (LeaderBoardItem lbi in userItemSet) { if (lbi.userName.ToLower() == userName.ToLower()) GridView2.Rows[0].Cells[0].Text = lbi.rank.ToString(); } } else { userRankMultiView.ActiveViewIndex = 0; } }