private void CharacterLoad_UCE_WorldEvents(Player player) { player.UCE_WorldEvents.Clear(); foreach (UCE_WorldEvent ev in NetworkManagerMMO.UCE_WorldEvents) { UCE_WorldEvent e = new UCE_WorldEvent(); e.name = ev.name; e.count = ev.count; player.UCE_WorldEvents.Add(e); } }
// ----------------------------------------------------------------------------------- // UCE_ModifyWorldEventCount // @Server // ----------------------------------------------------------------------------------- public static void UCE_ModifyWorldEventCount(UCE_WorldEventTemplate ev, int value) { int id = UCE_WorldEvents.FindIndex(x => x.template == ev); if (id != -1) { UCE_WorldEvent e = UCE_WorldEvents[id]; e.Modify(value); UCE_WorldEvents[id] = e; UCE_worldEventsChanged = true; } }
// ----------------------------------------------------------------------------------- // UCE_SetWorldEventCount // @Server // ----------------------------------------------------------------------------------- public static void UCE_SetWorldEventCount(string name, int value) { int id = UCE_WorldEvents.FindIndex(x => x.name == name); if (id != -1) { UCE_WorldEvent e = UCE_WorldEvents[id]; e.count = value; UCE_WorldEvents[id] = e; UCE_worldEventsChanged = true; } }
private void OnStartServer_UCE_WorldEvents() { UCE_WorldEvents.Clear(); foreach (UCE_WorldEventTemplate template in UCE_WorldEventTemplate.dict.Values) { UCE_WorldEvent e = new UCE_WorldEvent(); e.name = template.name; e.count = 0; UCE_WorldEvents.Add(e); } Database.singleton.UCE_Load_WorldEvents(); UCE_worldEventsChanged = true; }
// ----------------------------------------------------------------------------------- // UCE_ModifyWorldEventCount // ----------------------------------------------------------------------------------- public void UCE_ModifyWorldEventCount(UCE_WorldEventTemplate ev, int value) { // -- update the players event list int id = UCE_WorldEvents.FindIndex(x => x.template == ev); if (id != -1) { UCE_WorldEvent e = UCE_WorldEvents[id]; e.Modify(value, false); UCE_WorldEvents[id] = e; } // -- update the global event list as well NetworkManagerMMO.UCE_ModifyWorldEventCount(ev, value); }
private void CharacterSave_UCE_WorldEvents(Player player) { foreach (UCE_WorldEvent ev in NetworkManagerMMO.UCE_WorldEvents) { int id = player.UCE_WorldEvents.FindIndex(x => x.template == ev.template); if (id != -1) { UCE_WorldEvent e = player.UCE_WorldEvents[id]; e.count = ev.count; player.UCE_WorldEvents[id] = e; } } // -- we save the world events as well here, but only if they changed and only once (not for every player) NetworkManagerMMO.UCE_SaveWorldEvents(); }