Exemple #1
0
        public void UpdateCharacter(IWhisperDatasource wshard, Character character)
        {
            log.InfoFormat("saving character '{0}'", character.Name);

            // TODO: action buttons, spells, player_fields
            int result = wshard.ExecuteNonQuery("update `character` set level = ?, position_x = ?, position_y = ?, position_z = ?, orientation = ?, map_id = ?, zone_id = ?, fields = ? where id = ?",
                                                character.Level, character.Position.X, character.Position.Y, character.Position.Z, character.Position.Orientation, character.MapID, character.ZoneID, character.GetRawFields(), character.ID.ID);

            if (result != 1)
            {
                log.ErrorFormat("expected 1 character row updated from UpdateCharacter but got {0}", result);
            }
        }
Exemple #2
0
        public void Run()
        {
            log.Info("starting shard pinger");

            try
            {
                while (true)
                {
                    int result = authDatasource.ExecuteNonQuery("update shard set last_ping = ? where id = ?", DateTime.Now, config.ShardID);
                    if (result != 1)
                    {
                        log.ErrorFormat("expected to update 1 row with ping but updated {0}. this is likely due to a mismatch between ShardID in shardd.config and wauth.shard.id", result);
                    }

                    Thread.Sleep(config.ShardPingMilliseconds);
                }
            }
            catch (ThreadInterruptedException)
            {
                // nothing to do here. this is normal behavior for stopping this thread when it's asleep
            }

            log.Info("stopping shard pinger");
        }